프로그램
캐드 분류

캐드 고수님들 Lisp이 안됩니다 제발 도와주세요

컨텐츠 정보

  • 86 조회
  • 1 댓글
  • 0 추천
  • 0 비추천
  • 목록

본문

기존에 리습을 잘 사용하고있었는데 캐드 상위버전으로 설치 이후 작동이 되지않습니다

제발 도와주세요ㅠㅠ 파일첨부가 안돼서 텍스트로 올릴게요
(setvar "modemacro"(strcat"레이어<$(getvar,clayer)>직교$(GETVAR,ORTHOMODE)   S=1/$(getvar,DIMSCALE)""$(edtime,$(getvar,date),    YY년MO월DD일 DDD ))
 (defun c:DO() (command "DONUT" "0″  (getvar  "dimscale"))(princ))
 (defun c:B() (command "_copybase"  
              (command "_pasteclip"  ())) )
              (princ)
(defun       reset1()
   (setvar   "osmode"  old_osm)
   (command  "layer"   "s"       old_lay   "")
)
(defun S::startup () ;cadmel used Not remove !
 (setq c_admel "\CADMAS\")
 (load (strcat c_admel "cadmel11″))
)
(defun S::startup () ;cadmas used Not remove !
 (setq c_admas "C:\CADMAS\")
 (load (strcat c_admas "cadmas11″))
)
(princ)
(defun S::startup () ;cadmas used Not remove !
 (setq c_admas "C:\CADMAS\")
 (load (strcat c_admas "cadmas11″))
)
(princ)
;*** 브레이크에 대한 명령어 ***
(defun C:mb(/ ss sno pt1 pt2 no x)
   (graphscr)
   (princ " = BREAK2P")
   (setq ss (ssget))
   (setq sno (sslength ss))
   (setq pt1 (getpoint "n>>> First Point : "))
   (setq pt2 (getpoint pt1 "n>>> Second Point : "))
   (setq no 0)
   (repeat sno
   (setq x (ssname ss no))
   (command "break" x pt1 pt2)
   (setq no (1+ no)))(prinC))
(defun C:Bb(/ ss sno pt1 no x)
       (setq ss (ssget))
       (setq sno (sslength ss))
       (setq pt1 (getpoint "n>>> First Point : "))
       (setq no 0)
       (repeat sno
           (setq x (ssname ss no))
           (command "break" x pt1 "@")
           (setq no (1+ no))
       )(prin1))
(defun c:T() (command "DDEDIT")(princ))
(defun c:s() (command "STRETCH")(princ))
(defun c:c0() (command "chamfer" "d" "0″ "" "chamfer")(princ))
 (defun c:cCC() (command "chamfer" "D" "0.5″ """chamfer")(princ))
 (defun c:cC() (command "fillet" "R" "0″  "fillet")(princ))
               (command "PICKBOX" "5″)
 (defun c:c1() (command "chamfer" "d" "1″ "" "chamfer")(princ))
 (defun c:c2() (command "chamfer" "d" "2″ "" "chamfer")(princ))
 (defun c:c3() (command "chamfer" "d" "3″ "" "chamfer")(princ))
 (defun c:c4() (command "chamfer" "d" "4″ "" "chamfer")(princ))
 (defun c:c5() (command "chamfer" "d" "5″ "" "chamfer")(princ))
(defun c:c6() (command "chamfer" "d" "6″ "" "chamfer")(princ))
(defun c:c7() (command "chamfer" "d" "7″ "" "chamfer")(princ))
(defun c:c8() (command "chamfer" "d" "8″ "" "chamfer")(princ))
(defun c:c9() (command "chamfer" "d" "9″ "" "chamfer")(princ))
 (defun c:c10() (command "chamfer" "d" "10″ "" "chamfer")(princ))
 (defun c:c15() (command "chamfer" "d" "15″ "" "chamfer")(princ))
 (defun c:c20() (command "chamfer" "d" "20″ "" "chamfer")(princ))
 (defun c:c30() (command "chamfer" "d" "30″ "" "chamfer")(princ))
  (defun c:c50() (command "chamfer" "d" "50″ "" "chamfer")(princ))
 (defun c:c40() (command "chamfer" "d" "40″ "" "chamfer")(princ))
(defun c:c100() (command "chamfer" "d" "100″ "" "chamfer")(princ))
(defun c:c200() (command "chamfer" "d" "200″ "" "chamfer")(princ))
(defun c:f1() (command "fillet" "r" "1″ "fillet")(princ)) 
 (defun c:"() (command "GRID" (*(getvar   "dimscale") 8))(princ))
 (defun c:dd() (command "lengthen" "dy")(princ))
(defun c:000() (command "layer" "ON" "8″ "s" "8″ "OFf" "0″ "")(princ))
(defun c:111() (command "layer" "ON" "8″ "s" "8″ "OFf" "1″ "")(princ))
(defun c:222() (command "layer" "ON" "8″ "s" "8″ "OFf" "2″ "")(princ))
(defun c:333() (command "layer" "ON" "8″ "s" "8″ "OFf" "3″ "")(princ))
(defun c:444() (command "layer" "ON" "8″ "s" "8″ "OFf" "4″ "")(princ))
(defun c:555() (command "layer" "ON" "8″ "s" "8″ "OFf" "5″ "")(princ))
(defun c:666() (command "layer" "ON" "8″ "s" "8″ "OFf" "6″ "")(princ))
(defun c:777() (command "layer" "ON" "8″ "s" "8″ "OFf" "7″ "")(princ))
(defun c:LL() (command "LIMITS")(princ))
(defun c:d5() (command "dimscale" "0.5″)(princ))
(defun c:d10() (command "dimscale" "1″)(princ))
(defun c:d15() (command "dimscale" "1.5″)(princ))
(defun c:d20() (command "dimscale" "2″)(princ))
(defun c:d25() (command "dimscale" "2.5″)(princ))
(defun c:d30() (command "dimscale" "3″)(princ))
(defun c:d35() (command "dimscale" "3.5″)(princ))
(defun c:d40() (command "dimscale" "4″)(princ))
(defun c:d45() (command "dimscale" "4.5″)(princ))
(defun c:d50() (command "dimscale" "5″)(princ))
(defun c:d60() (command "dimscale" "6″)(princ))
(defun c:d70() (command "dimscale" "7″)(princ))
(defun c:d80() (command "dimscale" "8″)(princ))
(defun c:d90() (command "dimscale" "9″)(princ))
(defun c:d100() (command "dimscale" "10″)(princ))
(defun c:d110() (command "dimscale" "11″)(princ))
(defun c:d120() (command "dimscale" "12″)(princ))
(defun c:d130() (command "dimscale" "13″)(princ))
(defun c:d140() (command "dimscale" "14″)(princ))
(defun c:d150() (command "dimscale" "15″)(princ))
(defun c:d160() (command "dimscale" "16″)(princ))
(defun c:d170() (command "dimscale" "17″)(princ))
(defun c:d180() (command "dimscale" "18″)(princ))
(defun c:d190() (command "dimscale" "19″)(princ))
(defun c:d200() (command "dimscale" "20″)(princ))
(defun c:d210() (command "dimscale" "21″)(princ))
(defun c:d220() (command "dimscale" "22″)(princ))
(defun c:d230() (command "dimscale" "23″)(princ))
(defun c:d240() (command "dimscale" "24″)(princ))
(defun c:d250() (command "dimscale" "25″)(princ))
(defun c:d260() (command "dimscale" "26″)(princ))
(defun c:d270() (command "dimscale" "27″)(princ))
(defun c:d280() (command "dimscale" "28″)(princ))
(defun c:d390() (command "dimscale" "29″)(princ))
(defun c:d300() (command "dimscale" "30″)(princ))
(defun c:d310() (command "dimscale" "31″)(princ))
(defun c:d320() (command "dimscale" "32″)(princ))
(defun c:d330() (command "dimscale" "33″)(princ))
(defun c:d340() (command "dimscale" "34″)(princ))
(defun c:d350() (command "dimscale" "35″)(princ))
(defun c:d360() (command "dimscale" "36″)(princ))
(defun c:d370() (command "dimscale" "37″)(princ))
(defun c:d380() (command "dimscale" "38″)(princ))
(defun c:d390() (command "dimscale" "39″)(princ))
(defun c:d400() (command "dimscale" "40″)(princ))
(defun c:V() (command "dimpost""."  "dim1″  "NEW" "%%C<>")(princ))
(defun c:ZZ() (command "ZOOM" "E")(princ))
 (defun c:f2() (command "fillet" "r" "2″ "fillet")(princ))
 (defun c:f3() (command "fillet" "r" "3″ "fillet")(princ))
 (defun c:f4() (command "fillet" "r" "4″ "fillet")(princ))
 (defun c:f5() (command "fillet" "r" "5″ "fillet")(princ))
 (defun c:f6() (command "fillet" "r" "6″ "fillet")(princ))
 (defun c:f7() (command "fillet" "r" "7″ "fillet")(princ))
 (defun c:f8() (command "fillet" "r" "8″ "fillet")(princ))
 (defun c:f9() (command "fillet" "r" "9″ "fillet")(princ))
 (defun c:f10() (command "fillet" "r" "10″ "fillet")(princ))
 (defun c:f15() (command "fillet" "r" "15″ "fillet")(princ))
 (defun c:f20() (command "fillet" "r" "20″ "fillet")(princ))
 (defun c:f30() (command "fillet" "r" "30″ "fillet")(princ))
(defun c:f40() (command "fillet" "r" "40″ "fillet")(princ))
(defun c:f50() (command "fillet" "r" "50″ "fillet")(princ))
(defun c:f100() (command "fillet" "r" "100″ "fillet")(princ))
 (defun c:s0() (command "layer" "s" "0″ "")(princ))
 (defun c:s1() (command "layer" "s" "1″ "")(princ))
 (defun c:s2() (command "layer" "s" "2″ "")(princ))
 (defun c:s3() (command "layer" "s" "3″ "")(princ))
 (defun c:s4() (command "layer" "s" "4″ "")(princ))
 (defun c:1() (ssget) (command "change" "p" "" "p" "c" "bylayer" "la" "1″  "lt"     "bylayer" ""))
 (defun c:0() (ssget) (command "change" "P" "" "P" "c" "bylayer" "la" "0″  "lt"     "bylayer" ""))
 (defun c:2() (ssget) (command "change" "P" "" "P" "c" "bylayer" "la" "2″  "lt"     "bylayer" ""))
 (defun c:3() (ssget) (command "change" "P" "" "p" "c" "bylayer" "la" "3″  "lt"     "bylayer" ""))
 (defun c:4() (ssget) (command "change" "P" "" "P" "c" "bylayer" "la" "4″  "lt"     "bylayer" ""))
 (defun c:5() (ssget) (command "change" "p" "" "p" "c" "bylayer" "la" "5″  "lt"     "bylayer" ""))
 (defun c:6() (ssget) (command "change" "p" "" "p" "c" "bylayer" "la" "6″  "lt"     "bylayer" ""))
 (defun c:7() (ssget) (command "change" "p" "" "p" "c" "bylayer" "la" "7″  "lt"     "bylayer" ""))
 (defun c:Q0() (ssget) (command "change" "p" "" "p" "C" 0 ""))
 (defun c:Q1() (ssget) (command "change" "p" "" "p" "C" 1 ""))
 (defun c:Q2() (ssget) (command "change" "p" "" "p" "C" 2 ""))
 (defun c:Q3() (ssget) (command "change" "p" "" "p" "C" 3 ""))
 (defun c:Q4() (ssget) (command "change" "p" "" "p" "C" 4 ""))
 (defun c:Q5() (ssget) (command "change" "p" "" "p" "C" 5 ""))
 (defun c:Q6() (ssget) (command "change" "p" "" "p" "C" 6 ""))
 (defun c:Q7() (ssget) (command "change" "p" "" "p" "C" 7 ""))
 (defun c:Q8() (ssget) (command "change" "p" "" "p" "C" 8 ""))
 (defun c:EE()
 (command "ERASE" "ALL""R" "w") 
 (princ))
(defun C:sp() (setvar "cmdecho" 0)
(setq wirediam (getreal "nSpring wire diameter: ")
coils (getint "nEnter number of coils: ")
outsidediam (getreal "nEnter  Spring OD: ")
nominaldia(- outsidediam wirediam)
nominaldiam (* nominaldia 1.035300)
startlocation (getpoint "nStarting point: ")
lowerleft (list (- (car startlocation) wirediam)
(- (cadr startlocation) wirediam))
upperright (list (+ (car startlocation) (* outsidediam 2))
  (+ (cadr startlocation) (* wirediam 2))))
(command "layer" "s" "3″ "" "circle" startlocation "D" wirediam)
(command "layer" "s" "7″ "" "hatch" "u" "45″ (/ wirediam 4) "N" "w" lowerleft upperright "")
(command "copy" "w" lowerleft upperright "" (list nominaldiam 0.0) "")
(command "layer" "s" "3″ """line" startlocation  (list (+ (car startlocation) nominaldiam) (cadr startlocation)) "")
(command "move" "L" "" (list 0.0 (/ wirediam 2)) """copy" "L" "" (list 0.0 (- 0.0 wirediam)) "")
(command "rotate" "W" lowerleft upperright "" startlocation "15″)
(command "array" "p" "" "r" coils "1″ (* nominaldia     0.5359))
(princ))
(defun C:PG() (setvar "cmdecho" 0)
(prompt (strcat "nPurging all unreferenced blocks, layers, " "linetypes, shapes, and styles…"))
(purge nil) (setq c:autopurge nil purge nil)(princ))
(defun c:nn(/ lmin lmax dimsc scal1 scal2 scale dwgno dwgpr d1 yy mm dd d2
              dcode lcode scode ncode partno lfno saveno)
    (setq olderr  *error*  *error* error)
    (setvar "cmdecho" 0)
    (setq lmin (getvar "limmin")
          lmax (getvar "limmax")
          dimsc (getvar "dimscale"))
    (if (< dimsc 1)
       (setq scal1 (/ 1 dimsc)
             scal2 (rtos scal1 2)
             scale (strcat scal2 "/1″))
       (setq scal1 (float dimsc)
             scal2 (rtos scal1 2)
             scale (strcat "1/" scal2))
    )
    (setq dwgno (strcase (getvar "dwgname"))
          dwgln(strlen (getvar "dwgname"))
          dcode(substr dwgno 1 (- dwgln 4))
          d1 (rtos (getvar "cdate") 2 0)
          yy (substr d1 3 2)
          mm (substr d1 5 2)
          dd (substr d1 7 2)
          d2 (strcat "'" yy "." mm "." dd ".")
    )
;    (if (= dcode "/")
 ;      (setq dwgno (substr dwgno (1+ dwgpr)))
 ;   )
    (setq lcode (substr dwgno 1 1)
          scode (substr dwgno 12 1)
          ncode (substr dwgno 8 8)
          pcode (substr dwgno 15 1)
    )
;    (if (or (= lcode "1″) (and (= lcode "2″) (= scode "0″)))
    (if (and (= lcode "2″) (= scode "0″))
       (setq partno (substr dwgno 8 3))
       (setq partno (substr dwgno 15 3))
    )
    (if (= pcode "P")
       (command "attedit" "y" "" "dwg.no" "" "c" lmin lmax "v" "r" dcode ""
                "attedit" "y" "" "date" "" "c" lmin lmax "v" "r" d2 ""
;                "attedit" "y" "" "title_name" "" "c" lmin lmax "v" "r" "DIVERTER" ""
;                "attedit" "y" "" "project name" "" "c" lmin lmax "v" "r" "#4 LINE MODIFICATION (SDI-SUWON)" ""
      )
       (command "attedit" "y" "" "dwg.no" "" "c" lmin lmax "v" "r" dcode ""
                "attedit" "y" "" "scale" "" "c" lmin lmax "v" "r" scale ""
                "attedit" "y" "" "pl_no" "" "c" lmin lmax "v" "r" partno ""
                "attedit" "y" "" "date" "" "c" lmin lmax "v" "r" d2 ""
;                "attedit" "y" "" "title_name" "" "c" lmin lmax "v" "r" "DIVERTER" ""
;                "attedit" "y" "" "project_name" "" "c" lmin lmax "v" "r" "#4 LINE MODIFICATION (SDI-SUWON)" ""
       )
    )
;    (setvar "filedia" 0)
;    (command "qsave")
;    (setvar "filedia" 1)
    (setvar "cmdecho" 1)
    (prin1)
)
(defun C:TT() (setvar "cmdecho" 0)(command "osnap" "int,per" "ortho" "on" )
(setq ob1 (ssget)
      pt1 (getpoint "nSelect to Extend or Trim point: ")
      roof (sslength ob1)
      roof1 0
);** setq end **
(repeat roof
(setq ssn (ssname ob1 roof1)
      obl1 (entget ssn)
      sp (assoc 10 obl1)
      ep (assoc 11 obl1)
      la (assoc 8 obl1)
      ang (rtd (angle (cdr sp) (cdr ep)))
      pt2 (polar pt1 (dtr (+ ang 90)) 500)
      pt3 (inters (cdr sp) (cdr ep) pt1 pt2 nil)
      anp (cons 11 (list (car pt3) (cadr pt3)))
      anp2 (cons 10 (list (car pt3) (cadr pt3)))
      dist1 (distance (cdr sp) pt3)
      dist2 (distance (cdr ep) pt3)
);** setq end **
(cond ((> dist1 dist2)
       (setq obl1 (subst anp ep obl1))
      )
      ((> dist2 dist1)
       (setq obl1 (subst anp2 sp obl1))
      )
);** cond end **
(entmod obl1)
(setq roof1 (1+ roof1)))
                  (princ))
(defun C:AA() (setvar "cmdecho" 0) (command  "osnap"   "int,cen")
(setq   bas     (getpoint "n첫째점찍어 주라이~~ :"))
(setq   상현     (getdist  bas "n끝점 찍어라이~~ :"))
(setq   p1     (polar    bas (dtr   0)     상현))
(setq   p2     (polar    bas (dtr   90)     상현))
(setq   p3     (polar    bas (dtr   180)     상현))
(setq   p4     (polar    bas (dtr   270)     상현))
(command  "osnap"   "OFF"  "layer"   "ON"  "1″  "S"  "1″    ""
  "color"   "bylayer" "linetype"   "s" "bylayer"   ""
  "line"    p1  p3 ""   "line"    p2  p4 "")
(command "layer" "s" "0″ "")(princ))
(defun c:G() (setvar "cmdecho" 0)(command  "osnap"   "nea"  "ortho"   "on")
(setq   siz     (getvar   "dimscale"))
(setq   dist     (*       3 siz))
(setq   bas     (getpoint "n어디찍을래???? :"))
(setq   num     1 )
(command "osnap"  "off" "layer"   "ON" "3″ "S" "10″ """c""2″ "" )
                (setq   p1     (polar    bas (dtr   60)     dist))
(setq   p2     (polar    bas (dtr   120)     dist))
(command  "pline"   bas       p1        p2        "c")      (setq     e1        (entlast))
(prompt   "n<시바 돌려>/R맘대로돌려 :")
(command  "rotate"  e1  ""  bas pause)(princ))
;–
(defun c:GG() (setvar "cmdecho" 0)(command  "osnap"   "nea" "ortho"   "on")
(setq   siz     (getvar   "dimscale"))
(setq   dist     (* 3     siz))
(setq   bas     (getpoint "nPick base point :"))
(setq   num     2 )
(command "osnap"  "off" "layer"   "ON" "3″ "S" "10″ """c""2″ "" )
(setq   p1     (polar    bas (dtr   180)     (/       dist 2)))
(setq   p2     (polar    p1 (dtr   120)     dist))
(setq   p3     (polar    p2 (dtr   0)     dist))
(setq   p4     (polar    p3 (dtr   0)     dist))
(setq   p5     (polar    bas (dtr   0)     (/       dist 2)))
(command  "pline"   p1        p2        p3        "c")      (setq     e1        (entlast))
(command  "pline"   p3        p4        p5        "c")      (setq     e2        (entlast))
(prompt   "n/Reference :")
(command  "rotate"  e1  e2  ""  bas  pause) (princ))
;–
(defun c:GGG() (setvar "cmdecho" 0)(command  "osnap"   "nea" "ortho"   "on")
(setq   siz     (getvar   "dimscale"))
(setq   dist     (*       3 siz))
(setq   bas     (getpoint "nPick base point :"))
(command  )
(setq   num     2 )
(command "osnap"  "off" "layer"   "ON" "3″ "S" "10″ """c""2″ "" )
(setq   p1     (polar    bas (dtr   180)     dist))
(setq   p2     (polar    p1 (dtr   120)     dist))
(setq   p3     (polar    p2 (dtr   0)     dist))
(setq   p4     (polar    p3 (dtr   0)     dist))
(setq   p5     (polar    p4 (dtr   0)     dist))
(setq   p6     (polar    bas (dtr   0)     dist))
(command  "pline"   p1        p2        p3        "c")      (setq     e1        (entlast))
(command  "pline"   bas       p3        p4        "c")      (setq     e2        (entlast))
(command  "pline"   p4        p5        p6        "c")      (setq     e3        (entlast))
(prompt   "n/Reference :")
(command  "rotate"  e1        e2        e3        ""        bas       pause)
(princ))
;–
(defun c:GGGG()(setvar "cmdecho" 0)(command  "osnap"   "nea" "ortho"   "on")
(setq   siz     (getvar   "dimscale")
  dist     (*       3 siz)
  distT     (*       4.5 siz)
  bas     (getpoint "nPick base point :"))
(command  "osnap"   "off")
(setq   num     2
  p1     (polar    bas (dtr   180)     dist)
  p2     (polar    p1 (dtr   120)     dist)
  p3     (polar    p2 (dtr   0)     dist)
  p4     (polar    p3 (dtr   0)     dist)
  p5     (polar    p4 (dtr   0)     dist)
  p6     (polar    bas (dtr   0)     dist)
  p7     (polar    bas (dtr   90)    distT))
(command "osnap"  "off" "layer"   "ON" "3″ "S" "10″ """c""2″ "" 
  "pline"   p1        p2        p3        "c")      (setq     e1        (entlast))
(command  "pline"   bas       p3        p4        "c")      (setq     e2        (entlast))
(command  "pline"   p4        p5        p6        "c")      (setq     e3        (entlast))
(setq   txt_hi    (*       3.0 siz))   ;text size
(command  "text"    "j"       "mc"      p7        txt_hi    0   "G") (setq     e4        (entlast))
(command  "rotate"  e1        e2        e3   E4   ""        bas       pause)
(princ))
;
(defun c:w() (setvar "cmdecho" 0)(command  "osnap"   "int,end" "ortho"   "on")
(setq   bas     (getpoint "nPick base point :"))
(command  "osnap"   "off" "layer" "on" "4″  "s" "4″ "")
(if   (=     L11   nil) (setq L21  "5″))
(setq   L11     (GETDIST  (strcat "nEnter ROUND SIZE <"L21″> :")))
(if   (=     L11    nil) (setq   L11 (atof    L21)))
(setq dist1 (*     0.15  L11)
p1  (polar  bas  (dtr  90) dist1)
p2  (polar  bas  (dtr 0) dist1))
(command  "line"    p1  p2 "") (setq  e1 (entlast))
(setq  dist2  (*      0.20  L11)
p1  (polar  bas  (dtr 90)  dist2)
p2  (polar  bas  (dtr 0)  dist2))
(command  "line"    p1  p2 "") (setq  e2 (entlast))
(setq  dist3  (*     0.35   L11)
p1     (polar bas   (dtr  90) dist3)
p2     (polar bas   (dtr   0) dist3))
(command  "line"    p1  p2 "") (setq  e3 (entlast))
(setq  dist4  (*      0.4  L11)
p1     (polar  bas  (dtr  90) dist4)
p2     (polar  bas  (dtr   0) dist4))
(command  "line"    p1  p2 "") (setq  e4 (entlast))
(setq   dist5     (*       0.55 L11)
p1    (polar    bas       (dtr 90)  dist5)
p2    (polar    bas       (dtr 0)   dist5))
(command  "line"    p1  p2 "")   (setq  e5        (entlast))
(setq   dist6     (*       0.6 L11)
p1   (polar    bas       (dtr 90)  dist6)
p2   (polar    bas       (dtr 0)   dist6))
(command  "line"    p1  p2 "")   (setq  e6        (entlast))
(setq   dist7     (*       0.75 L11)
p1   (polar    bas       (dtr 90)  dist7)
p2   (polar    bas       (dtr 0)   dist7))
(command  "line"    p1  p2 "")   (setq  e7        (entlast))
(setq   dist8     (*       0.8 L11)
p1   (polar    bas       (dtr 90)  dist8)
p2   (polar    bas       (dtr 0)   dist8))
(command  "line"    p1  p2 "")   (setq  e8        (entlast))
(setq   dist9     (*       0.95 L11)
p1   (polar    bas       (dtr 90)  dist9)
p2   (polar    bas       (dtr 0)   dist9))
(command  "line"    p1  p2 "")   (setq  e9        (entlast))
(setq   dist10    (*       1 L11)
p1   (polar    bas       (dtr 90)  dist10)
p2   (polar    bas       (dtr 0)   dist10))
(command  "line"    p1  p2 "")   (setq  e10       (entlast))
(command  "rotate"  e1  e2  e3  e4  e5  e6  e7  e8  e9  e10   ""    bas    pause)
(command "layer" "s" "3″ "")(princ))
(defun c:00() (command "layer" "ON" "0″ "s" "0″ "OFF" "1,2,3,4,5,6,7″ "")(princ))
(defun c:"`() (command "layer" "ON" "0″ "s" "0″ "on" "1,2,3,4,5,6,7″ "")(princ))
(defun c:11() (command "layer" "ON" "1″ "s" "1″ "OFF" "0,2,3,4,5,6,7″ "")(princ))
(defun c:22() (command "layer" "ON" "2″ "s" "2″ "OFf" "1,0,3,4,5,6,7″ "")(princ))
(defun c:33() (command "layer" "ON" "3″ "s" "3″ "OFf" "1,2,0,4,5,6,7″ "")(princ))
(defun c:44() (command "layer" "ON" "4″ "s" "4″ "OFf" "1,2,3,0,5,6,7″ "")(princ))
(defun c:55() (command "layer" "ON" "5″ "s" "5″ "OFf" "1,2,3,4,0,6,7″ "")(princ))
(defun c:66() (command "layer" "ON" "6″ "s" "6″ "OFf" "1,2,3,4,5,0,7″ "")(princ))
(defun c:77() (command "layer" "ON" "7″ "s" "7″ "OFf" "1,2,3,4,5,6,0″ "")(princ))
(defun c:Y() (command "osnap" "END,int,cen,MID,PER,NEAR,QUA" "ortho" "on") (setq ent (ssget))(command "copy" ent "" "m" )(princ))
(defun c:R() (command "osnap" "END,int,cen,NEAR,QUA,PER,MID" "ortho" "on") (princ))
(defun c:di() (command "osnap" "END,int,cen,MID,PER,NEAR,QUA" "ortho" "on") (command "DIST" )(princ))
               
(defun c:qq()
   (setvar   "cmdecho" 0)
;; (princ    "nMake Layer Now …")
   (command  "layer"   "t"       "0,1,2,3,4,5,6,"     "")
   (command  "layer"   "m"       "0″       "c"      "7″     ""     "lt"     "continuous"   ""
       "m"       "1″       "c"      "1″     ""     "lt"     "center"      ""
       "m"       "2″       "c"      "2″     ""     "lt"     "hidden"      ""
      "m"       "3″       "c"      "3″     ""     "lt"     "continuous"   "" 
       "m"       "4″       "c"      "4″     ""     "lt"     "continuous"   ""
       "m"       "5″       "c"      "5″     ""     "lt"     "phantom"      ""
       "m"       "6″       "c"      "6″     ""     "lt"     "phantom"   ""
       "m"       "7″       "c"      "7″     ""     "lt"     "continuous"   ""
                       "m"       "8″       "c"      "7″     ""     "lt"     "continuous"   ""         
                       "m"       "d"       "c"      "1″     ""     "lt"     "continuous"   ""
                      "m"       "10″       "c"      "2″     ""     "lt"     "continuous"   ""
                       "m"       "DEEPOINTS"       "c"      "7″     """" 
   
(command "layer" "s" "3″ ""))(princ))
(defun c:+-2() (setvar "cmdecho" 0) (command  "osnap" "nea")
(setq  tol_u  "%%p0.02″
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66)
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi  2)))
(command  "osnap" "off" "layer" "on" "4″ "s" "4″ "" "text" "j" "ml" p1 txt_hi  0  tol_u )
(setq  e1  (entlast))
(command  "rotate"  e1     ""  bas pause)  (princ))
(defun c:+-5() (setvar "cmdecho" 0) (command  "osnap" "nea")
(setq  tol_u  "%%p0.05″
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66)
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi  2)))
(command  "osnap" "off" "layer" "on" "4″ "s" "4″ "" "text" "j" "ml" p1 txt_hi  0  tol_u )
(setq  e1  (entlast))
(command  "rotate"  e1     ""  bas pause)  (princ))
(defun c:+-10()(setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "%%p0.1″
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66)
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi  2)))
(command  "osnap" "off" "layer" "on" "4″ "s" "4″ "" "text" "j" "ml" p1 txt_hi  0  tol_u )
(setq  e1  (entlast))
(command  "rotate"  e1     ""  bas pause)  (princ))
(defun c:+-20()(setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "%%p0.2″
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66)
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi  2)))
(command  "osnap" "off" "layer" "on" "4″ "s" "4″ "" "text" "j" "ml" p1 txt_hi  0  tol_u )
(setq  e1  (entlast))
(command  "rotate"  e1     ""  bas pause)  (princ))
(defun c:+1 () (setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "+0.01″
       tol_d  " 0   "
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66) ;tolerance height
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi 2.5))
       p2   (polar  bas  (dtr  90) (*  txt_hi 1.2)))
(command  "layer"  "on" "4″ "s"  "4″  ""   "osnap" "off"
      "text"  "j"  "ml"  p1  txt_hi  0  tol_u ) (setq  e1  (entlast))
(command  "text"  "j"  "ml"  p2  txt_hi  0  tol_d ) (setq  e2  (entlast))
(command  "rotate"  e1   e2  ""  bas pause) (princ))
(defun c:+2 () (setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "+0.02″
       tol_d  "+0.01″
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66) ;tolerance height
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi 2.5))
       p2   (polar  bas  (dtr  90) (*  txt_hi 1.2)))
(command  "layer"  "on" "4″ "s"  "4″  ""   "osnap" "off"
  "text"  "j"  "ml"  p1  txt_hi  0  tol_u ) (setq  e1  (entlast))
(command  "text"  "j"  "ml"  p2  txt_hi  0  tol_d ) (setq  e2  (entlast))
(command  "rotate"  e1   e2  ""  bas pause) (princ))
(defun c:+3 () (setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "+0.03″
       tol_d  "+0.02″
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66) ;tolerance height
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi 2.5))
       p2   (polar  bas  (dtr  90) (*  txt_hi 1.2)))
(command  "layer"  "on" "4″ "s"  "4″  ""   "osnap" "off"
  "text"  "j"  "ml"  p1  txt_hi  0  tol_u ) (setq  e1  (entlast))
(command  "text"  "j"  "ml"  p2  txt_hi  0  tol_d ) (setq  e2  (entlast))
(command  "rotate"  e1   e2  ""  bas pause) (princ))
(defun c:+10() (setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "+0.1 "
       tol_d  " 0   "
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66) ;tolerance height
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi 2.5))
       p2   (polar  bas  (dtr  90) (*  txt_hi 1.2)))
(command  "layer"  "on" "4″ "s"  "4″  ""   "osnap" "off"
  "text"  "j"  "ml"  p1  txt_hi  0  tol_u ) (setq  e1  (entlast))
(command  "text"  "j"  "ml"  p2  txt_hi  0  tol_d ) (setq  e2  (entlast))
(command  "rotate"  e1   e2  ""  bas pause) (princ))
(defun c:+20() (setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "+0.2 "
       tol_d  "+0.1 "
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66) ;tolerance height
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi 2.5))
       p2   (polar  bas  (dtr  90) (*  txt_hi 1.2)))
(command  "layer"  "on" "4″ "s"  "4″  ""   "osnap" "off"
  "text"  "j"  "ml"  p1  txt_hi  0  tol_u ) (setq  e1  (entlast))
(command  "text"  "j"  "ml"  p2  txt_hi  0  tol_d ) (setq  e2  (entlast))
(command  "rotate"  e1   e2  ""  bas pause) (princ))
(defun c:-1() (setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  " 0  "
      tol_d  "-0.01″
      dm_txt (getvar "dimtxt")
      dm_siz (getvar "dimscale")
      txt_hi (* dm_txt dm_siz 0.66) ;tolerance height
      bas  (getpoint "nPick base point :")
      p1   (polar  bas (dtr  90) (*  txt_hi 2.5))
      p2   (polar  bas (dtr  90) (*  txt_hi 1.2)))
(command  "layer"  "on" "4″ "s"  "4″  ""   "osnap" "off"
  "text"  "j"  "ml"  p1  txt_hi  0  tol_u ) (setq  e1  (entlast))
(command  "text"  "j"  "ml"  p2  txt_hi  0  tol_d ) (setq  e2  (entlast))
(command  "rotate"  e1   e2  ""  bas pause) (princ))
(defun c:-2() (setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "-0.01″
       tol_d  "-0.02″
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66) ;tolerance height
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi 2.5))
       p2   (polar  bas  (dtr  90) (*  txt_hi 1.2)))
(command  "layer"  "on" "4″ "s"  "4″  ""   "osnap" "off"
  "text"  "j"  "ml"  p1  txt_hi  0  tol_u ) (setq  e1  (entlast))
(command  "text"  "j"  "ml"  p2  txt_hi  0  tol_d ) (setq  e2  (entlast))
(command  "rotate"  e1   e2  ""  bas pause) (princ))
(defun c:-3() (setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "-0.02″
       tol_d  "-0.03″
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66) ;tolerance height
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi 2.5))
       p2   (polar  bas  (dtr  90) (*  txt_hi 1.2)))
(command  "layer"  "on" "4″ "s"  "4″  ""   "osnap" "off"
  "text"  "j"  "ml"  p1  txt_hi  0  tol_u ) (setq  e1  (entlast))
(command  "text"  "j"  "ml"  p2  txt_hi  0  tol_d ) (setq  e2  (entlast))
(command  "rotate"  e1   e2  ""  bas pause) (princ))
(defun c:-10() (setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  " 0   "
       tol_d  "-0.1 "
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66) ;tolerance height
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi 2.5))
       p2   (polar  bas  (dtr  90) (*  txt_hi 1.2)))
(command  "layer"  "on" "4″ "s"  "4″  ""   "osnap" "off"
  "text"  "j"  "ml"  p1  txt_hi  0  tol_u ) (setq  e1  (entlast))
(command  "text"  "j"  "ml"  p2  txt_hi  0  tol_d ) (setq  e2  (entlast))
(command  "rotate"  e1   e2  ""  bas pause) (princ))
(defun c:-20() (setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "-0.1 "
       tol_d  "-0.2 "
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66) ;tolerance height
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi 2.5))
       p2   (polar  bas  (dtr  90) (*  txt_hi 1.2)))
(command  "layer"  "on" "4″ "s"  "4″  ""   "osnap" "off"
  "text"  "j"  "ml"  p1  txt_hi  0  tol_u ) (setq  e1  (entlast))
(command  "text"  "j"  "ml"  p2  txt_hi  0  tol_d ) (setq  e2  (entlast))
(command  "rotate"  e1   e2  ""  bas pause) (princ))
(defun c:+-1()(setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "%%p0.1″
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66)
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi  2)))
(command  "osnap" "off" "layer" "on" "4″ "s" "4″ "" "text" "j" "ml" p1 txt_hi  0  tol_u )
(setq  e1  (entlast))
(command  "rotate"  e1     ""  bas pause)  (princ))
(DEFUN C:cb ()
(graphscr)(setvar "cmdecho" 0)(setq cla (getvar "clayer") an (/ pi 180))
(menucmd "S=X")(menucmd "S=State2″)(menucmd "S=State")
(COMMAND "VSLIDE" "CBOR")
(setq s (strcase (getstring "nInput state [ LF  RF  AP  HP  QP ] ?")))
(if (= s "")(setq s "AF"))(menucmd "S=MSIZE")(setq fsp "0″ a "m")
(while (/= fsp "S")
 (if (= (type isp) 'STR)
 (if (= (substr isp 1 1) "M")(setq b isp)(setq b "M10″))(setq b "M10″))
 (setq fna (open (strcat  "C:/lsp/CBOR.DAT") "r"))
 (princ "nInput Hex Soket Bolt size ?< ")(princ b)(princ " >" )
 (setq isp (getstring ""))(if (= isp "")(setq isp b))
 (setq isp1 (strcase (strcat "S" isp)))
 (while (/= isp1 a)
  (setq ffsp (read-line fna) a (substr ffsp 2 (strlen isp1)) fsp (substr a 1 1))
  (if (= fsp "0″)(setq a isp1))
 )
 (if (= fsp "0″)(progn (princ "error: ")(princ isp)(princ " not found..")(setq isp nil)))
 (close fna)
)
(setq a (atof (substr ffsp 4 2)) b (/ (atof (substr ffsp 11 5)) 2)
      c (/ (atof (substr ffsp 16 5)) 2))
(if (or (= s "AF")(= s "RF")(= s "LF"))(progn
 (menucmd "S=sDepth")
 (princ "nInput C,Boring Depth <")(princ a)(princ ">")
 (setq d (atof (getstring "?")))
 (if (= d 0.0)(setq d a))
 (menucmd "S=OSNAPB")
 (command "redraw")
 (setq ipt (getpoint "nInserting point ?"))(princ)
 (setq pt3 (getpoint ipt "nDepth,2nd point ?")e (distance ipt pt3)ian (angle ipt pt3))
 (if (>= ian (* pi 1.5))(setq ian (- ian (* pi 1.5)))(setq ian (+ ian (* pi 0.5))))
 (setq clo (getvar "osmode"))(setvar "osmode" 0)
))
(if (or (= s "AP")(= s "HP")(= s "QP"))(progn
 (menucmd "S=OSNAPB")
 (setq ipt (getpoint "nInserting point ?"))(princ)
 (setq clo (getvar "osmode"))(setvar "osmode" 0)
 (setq ian (getangle ipt "nInserting angle <0>?"))(if (= ian nil)(setq ian 0))
))
(setq x0 (car ipt) y0 (cadr ipt) san (sin ian) can (cos ian))
(if (or (= s "AF")(= s "RF")(= s "LF"))
 (setq xx1 (* san d) yy1 (* can d) xx2 (* san e) yy2 (* can e))
)
(setq x1 (* can c) y1 (* san c) x2 (* can b) y2 (* san b))
(if (or (= s "AF")(= s "LF")(= s "RF"))(progn
 (setq pt1 (list (+ x0 x1)(+ y0 y1)) pt11 (list (- x0 x1)(- y0 y1))
       pt2 (list (+ x0 xx1 x1)(+ (- y0 yy1) y1)) pt12 (list (- (+ x0 xx1) x1)(- y0 yy1 y1))
       pt3 (list (+ x0 xx1 x2)(+ (- y0 yy1) y2)) pt13 (list (- (+ x0 xx1) x2)(- y0 yy1 y2))
       pt4 (list (+ x0 xx2 x2)(+ (- y0 yy2) y2)) pt14 (list (- (+ x0 xx2) x2)(- y0 yy2 y2))
       pt (list (+ x0 xx1)(- y0 yy1)))
 (if (= s "AF")
  (command "line" pt1 pt2 pt12 pt11 "" "line" pt3 pt4 "" "line" pt13 pt14 "")
 )
 (if (= s "LF")(command "line" pt pt12 pt11 "" "line" pt13 pt14 ""))
 (if (= s "RF")(command "line" pt1 pt2 pt "" "line" pt3 pt4 ""))
))
(if (= s "AP")(command "circle" ipt b"circle" ipt c))
(if (or (= s "HP")(= s "QP"))(progn
 (setq pt1 (list (+ x0 y2)(- y0 x2)) pt11 (list (- x0 y2)(+ y0 x2))
       pt2 (list (+ x0 y1)(- y0 x1)) pt12 (list (- x0 y1)(+ y0 x1))
       pt3 (list (+ x0 x2)(+ y0 y2)) pt4 (list (+ x0 x1)(+ y0 y1)))
 (if (= s "HP")(command "arc" pt1 "c" ipt pt11 "arc" pt2 "c" ipt pt12))
 (if (= s "QP")(command "arc" pt3 "c" ipt pt11 "arc" pt4 "c" ipt pt12))
))
(setvar "osmode" clo)(menucmd "S=S")(princ))
(defun c:aplot(/ t file name file_open vctr string_a string_b string_c)
        (setq t 1)
        (setq spc " ")
        (setvar "cmdecho" 0)
        (setvar "blipmode" 0)
        (setvar "filedia" 1)
        (setq index 0)
        (setq vctr (getvar "viewctr"))
        (setq file (getfiled "File to list" "" "lst" 4))
        (setq dirname (new_dir file))
        (setq file_open (open file "r"))
        (script_file_name file)
        (while t
                (setq index (1+ index))
                (setq name (read-line file_open))
                (if (/= name nil)
                        (progn
                                (setq string_a (strcat "OPEN" SPC "Y" SPC DIRNAME NAME SPC "(grtext 0 " (chr 34) (itoa index) (chr 34)  ")" spc "ZOOM" SPC "E" SPC))
                                (setq string_b (strcat "(C:W_DWG)" SPC "ZOOM" SPC "0.95X" SPC "PLOT" SPC "D" SPC "N" SPC "LPT1″))
                                (setq string_c (strcat SPC "(C:ERASE_TEXT)"))
                                (setq string_lst (strcat string_a string_b string_c))
                                (write-line string_lst writing_script_file)
                        )
                        (progn
                                (close file_open)
                                (close writing_script_file)
                                (command "text" "mc" vctr 5 0 "All Drawing will be plotted automatically !!")
                               ;(command "delay" "20000″)
                                (command "erase" "l" "")
                                (setq t nil)
                        )
                )
        )
;       (command "script" (strcat new_file_name ".SCR"))
        (princ)
)
;———————————————————————————————————–
(defun script_file_name (script_file / t index str_len text) ; create new file name
        (setq t 1)
        (setq index 0)
        (setq str_len (strlen script_file))
        (while t
                (setq index (1+ index))
                (setq text (substr script_file (- str_len index) 1))
                (if (= text ".")
                        (progn
                                (setq new_file_name (substr script_file 1 (- str_len index 1)))
                                (setq writing_script_file (open (strcat new_file_name "." "scr") "w"))
                                (setq t nil)
                        )
                )
        )
)
;———————————————————————————————————–
(defun new_dir (script_file / t dir_len index name index_s index_e name0 first
                second third fourth fifth sexth qty)
        (setq t 1)
        (setq index 0)
        (setq qty 0)
        (setq dir_name1 "")
        (while t
                (setq index (1+ index))
                (setq name (substr script_file index 1))
                (if (= name (chr 92))
                        (setq qty (1+ qty))
                )
              (cond
                        ((and (= qty 1) (= name (chr 92)))
                                (setq first index)
                                (setq dir_name (substr script_file 1 (- first 1)))
                                (setq dir_name1 (strcat dir_name1 dir_name "/"))
                        )
                        ((and (= qty 2) (= name (chr 92)))
                                (setq second index)
                                (setq dir_name (substr script_file (+ first 1) (- second first 1)))
                                (setq dir_name1 (strcat dir_name1 dir_name "/"))
                        )
                        ((and (= qty 3) (= name (chr 92)))
                                (setq third index)
                                (setq dir_name (substr script_file (+ second 1) (- third second 1)))
                                (setq dir_name1 (strcat dir_name1 dir_name "/"))
                        )
                        ((and (= qty 4) (= name (chr 92)))
                                (setq fourth index)
                                (setq dir_name (substr script_file (+ third 1) (- fourth third 1)))
                                (setq dir_name1 (strcat dir_name1 dir_name "/"))
                        )
                        ((and (= qty 5) (= name (chr 92)))
                                (setq fifth index)
                                (setq dir_name (substr script_file (+ fourth 1) (- fifth fourth 1)))
                                (setq dir_name1 (strcat dir_name1 dir_name "/"))
                        )
                        ((and (= qty 6) (= name (chr 92)))
                                (setq sexth index)
                                (setq dir_name (substr script_file (+ fifth 1) (- sexth fifth 1)))
                                (setq dir_name1 (strcat dir_name1 dir_name "/"))
                        )
                        ((and (= qty 7) (= name (chr 92)))
                                (setq sevth index)
                                (setq dir_name (substr script_file (+ sexth 1) (- sevth sexth 1)))
                                (setq dir_name1 (strcat dir_name1 dir_name "/"))
                        )
                        ((and (= qty 8) (= name (chr 92)))
                                (setq eagth index)
                                (setq dir_name (substr script_file (+ sevth 1) (- eagth sevth 1)))
                                (setq dir_name1 (strcat dir_name1 dir_name "/"))
                        )
                        ((and (= qty 9) (= name (chr 92)))
                                (setq ninth index)
                                (setq dir_name (substr script_file (+ eagth 1) (- ninth eagth 1)))
                                (setq dir_name1 (strcat dir_name1 dir_name "/"))
                        )
                )
                (if (= name "") (setq t nil))
        )
        (setq new_dir_name dir_name1)
)
(defun c:W_dwg (/ dwg_name p1 p2 first_dist second_dist text_height ent text_style)
        (setvar "cmdecho" 0)
        (setq dwg_name (getvar "dwgname"))
        (setq text_style (getvar "textstyle"))
        (if (/= (strcat text_style) "ROMANS")
                (command "style" "romans" "romans" "" "" "" "" "" "")
        )
        (command "color" bylayer)
        (setq p1 (getvar "extmin"))
        (setq p2 (getvar "extmax"))
        (setq first_dist (- (car p2) (car p1)))
        (setq second_dist (- (cadr p2) (cadr p1)))
        (cond
                ((> first_dist second_dist)
                        (setq text_height (/ (* first_dist 0.1) 12.0))
                )
                ((< first_dist second_dist)
                        (setq text_height (/ (* second_dist 0.1) 12.0))
                )
        )
        (setq ent (ssget "x"))
        (if (/= ent nil)
             (setq nn (sslength ent))
        )
        (if (< nn 5)
             (progn
                       (princ (strcat "nPlot mode is 1″)) (terpri)
                       (command "limits" "0,0″ "420,297″ "zoom" "all")
                       (command "text" "mc" "210,148″ 10 0 "Form Paper or Empty Drawing")
                       (command "text" "0,0″ 5 0 dwg_name)
                       (setq last_text (entlast))
             )
             (progn
                       (princ (strcat "nPlot mode is 2″)) (terpri)
       (command "style" "" "" "0″ "" "" "" "" "")
                       (command "text" p1 text_height 0 dwg_name)
                       (setq last_text (entlast))
             )
        )
        (princ)
)
(defun c:erase_text (/ ent)
        (command "erase" last_text "")
)
(defun c:mct()
 (setq sele1 (ssget))
 (setq selelen1 (sslength sele1))
 (setq index1 0)
 (repeat selelen1
 (setq name1 (ssname sele1 index1))
 (redraw name1 3)
 (setq list1 (entget name1))
 (setq oldtext (assoc 1 list1))
 (setq newtext (getstring "enter text value..:" t))
 (setq chantext (cons 1 newtext))
 (setq list1 (subst chantext oldtext list1))
 (entmod list1)
 (redraw name1 4)
 (setq index1 (+ 1 index1))))  
(defun      part_start( / form0 form1)
   (mode_tile        part_sym1 4)
   (setq     part_lst  (list "1″       "2″       "3″       "4″))
   (foreach  part0     part_lst
     (setq     part1 (strcat   "part_"   part0))
     (start_image part1)
     (slide_image
       0 0
       (- (dimx_tile      part1)    1)
       (- (dimy_tile      part1)    1)
       (strcat "partnum(part"      part0     ")")
     )
     (end_image)
   )
   (foreach  part_sym  part_lst
     (action_tile (strcat   "part_"   part_sym)
"(mode_tile part_sym1 4) (setq part_sym1 $key) (mode_tile part_sym1 4)"
     )
   )
)
;——————————————————————————-
(defun      part( / form0 form1)
   (mode_tile        part_sym1 4)
   (setq     part_lst  (list "1″       "2″       "3″       "4″))
   (foreach  part0     part_lst
     (setq     part1 (strcat   "part_"   part0))
     (start_image part1)
     (slide_image
       0 0
       (- (dimx_tile      part1)    1)
       (- (dimy_tile      part1)    1)
       (strcat "partnum(part"      part0     ")")
     )
     (end_image)
   )
   (foreach  part_sym  part_lst
     (action_tile (strcat   "part_"   part_sym)
"(mode_tile part_sym1 4) (setq part_sym1 $key) (mode_tile part_sym1 4)"
     )
   )
)
;——————————————————————————-
(defun c:MM( / lmin lmax dwgno dwgpr a d1 yy mm dd d2 
               p_cod p_data fo_ori projt ch1 ch2 )
    (setq olderr  *error*  *error* error)
    (setvar "cmdecho" 0)
    (setq lmin(getvar "limmin")
          lmax(getvar "limmax")
          dwgno(strcase (getvar "dwgname"))
          dwgpr(strlen (getvar "dwgprefix"))
          a(substr dwgno 1 1)
          d1(rtos (getvar "cdate") 2 0)
          yy(substr d1 3 2)
          mm(substr d1 5 2)
          dd(substr d1 7 2)
          d2(strcat "'" yy "." mm "." dd ".")
    )
    (if (= a "/")
       (setq dwgno(substr dwgno (1+ dwgpr)))
    )
          (command "attedit" "y" "title" "dwg.no" "" "c" lmin lmax "v" "r" dwgno ""
                   "attedit" "y" "" "date" "" "c" lmin lmax "v" "r" d2 ""
          )
    (setvar "cmdecho" 1)
    (prin1)
)
(defun c:aaaa()(setvar "cmdecho" 0)(command  "osnap" "nea")
(setq  tol_u  "%%p0.5″
       dm_txt (getvar "dimtxt")
       dm_siz (getvar "dimscale")
       txt_hi (* dm_txt  dm_siz  0.66)
       bas  (getpoint "nPick base point :")
       p1   (polar  bas  (dtr  90) (*  txt_hi  2)))
(command  "osnap" "off" "layer" "on" "0″ "s" "0″ "" "text" "j" "ml" p1 txt_hi  0  tol_u )
(setq  e1  (entlast))
(command  "rotate"  e1     ""  bas pause)  (princ))
; 부품을 그리는 lisp과 parts.dcl, 그리고 data table을 연결한다.
; lsp-dcl.lsp를 사용하려는 lisp file에서 를 먼저 실행시킨다.
; f_f -> lsp-dcl.lsp를 사용하려는 lisp file에서 보내주는 data file name에 대응한다.
; 부품table에서 읽어 온 모든 data를  라는 list로 만든다 
; 는 c:lsp-dcl의 외부변수가 된다.
; head line의 data 는 "hdnm" tile로 넘겨 준다.
; 은 c:lsp-dcl의 외부변수가 된다.
;——————-
  (defun read_yoso ( f_f / opfile)
    (setq opfile (open f_f "r"))
    (setq hdln (read-line opfile))
    
    ;    (prompt "nHDLN    —  ") (princ  hdln) (terpri)  ; head-line 내용
    
    (setq lstdt '())                                                ; 빈 list를 만든다.
    (while (setq line_x (read-line opfile))
      (setq lstdt (append lstdt (list line_x)))
    );while
    (setq leng1 (length lstdt))
    (close opfile)
  );defun
  
;***********************   Main process   **************************
; lstdt -> 부품 data list.
; name2의 내용은 data table의 내용으로 "*** BEARING TABLE ***" 등인데
; 이 file을 사용하려는 lisp file에서 보내준다.
; hdln은 data table의 head line의 내용으로 부품 각 부분의 변수인데
; 에서 받아 온다. 예를 들어 ID, OD. W …..등이다.
(defun c:lsp-dcl (lstdt hdln / dcl_id)
  (setq dcl_id (load_dialog "C:\MDB\parts.dcl"))
  (if (not (new_dialog "parts" dcl_id)) (exit));if
  
  (set_tile "name1″ name2)
  (set_tile "hdnm" hdln)
  
  (setq edbox "edbox")       ; parts.dcl의 edit_box의 key "edbox"의 값을 edbox변수에 대입한다.
  
  (start_list "lstbox")      ; list_box의 구성을 시작.
    (mapcar 'add_list lstdt) ; (read_yoso)에서 만든 list 내용을 받아 정렬한다.
  (end_list)                 ; list_box의 구성을 끝.
  
  (if (= edbox2 nil)
    (setq hdln3 nil)
  );if
;—————-
; (= hdln3 nil)    1조건 – 해당 부품lisp을 처음 사용했을 때,
; (/= hdln3 hdln)  2조건 – 다른 부품lisp으로 바꾸어 사용했을 때.
; hdln3 – 먼저 사용했던 head line내용, hdln – 새로 받은 head line내용.
; edbox2 – 먼저 실행했던 n번째 line의 data내용이다.
  
  (if (or (= hdln3 nil) (/= hdln3 hdln))
    (set_tile "edbox" (nth 0 lstdt))
    (set_tile "edbox" edbox2)
  );if
;——————
; 이 file을 사용했던 lisp file로부터 변수의 line number를 받는다.
  (if (> nth9 leng1)
    (setq nth9 (fix (/ leng1 2)))
  );if
  (if (/= nth9 nil)
    (progn
      (set_tile "edbox" (nth nth9 lstdt))
;      (set_tile "lstbox" (itoa (+ nth9 5)))  ; default cursor를 list box의 중앙으로 위치.
      (set_tile "lstbox" (itoa nth9))
    );progn
  );if
  ;—————-
  (action_tile "lstbox" "(move_l_e edbox lstdt)" )
  (action_tile "cancel" "(setq edbox2 (get_tile edbox))
                         (done_dialog) (exit)" )
  (action_tile "accept" "(get_val edbox hdln)
                         (setq edbox2 (get_tile edbox))
                         (done_dialog)" )
  (start_dialog)
  (unload_dialog dcl_id)
  ;—————-
  (setq hdln3 hdln)
  ;—————-
  (setq nth9 nil)
);defun
;====================
;;;  "(", ")"를 써서 hdln의 list를 만든다.
;;;  선택한 edbox의 data를 읽어 data_g의 list를 만든다.
  
  (defun get_val (edbox hdln)
    (setq hdln (read (strcat "(" hdln ")")))
    (setq data_g (read (strcat "(" (get_tile edbox) ")" )))
      
;;;   (print "nHDLN   —   ") (princ  hdln) (princ) (terpri)
;;;   (print "nDATA_G — ") (princ data_g) (princ) (terpri)
      
;;;   hdln의 내용인 <부품 각부분 이름>에 data_g의 data내용을 대응시킨다.
;;;   (mapcar 'set hdln data-g)
    
    (mapcar 'set_tn hdln data_g)
  );defun
  
;;; <부품 각부분 이름>에 str.과int.가 섞여 변수 type이 'SYM 이면 data의 대응처리가
;;; 되지않으므로 'STR 로 변환키 위해 아래 함수를 사용한다.
;;; <외부변수> hdln data_g.
  
  (defun set_tn (hdln data_g / f)
    (if (= (type data_g) 'SYM)
      (progn
        (setq f (open "C:\MDB\imsi" "w"))
        (prin1 data_g f)
        (close f)
        (setq f (open "C:\MDB\imsi" "r"))
        (set hdln (read-line f))
        (close f)
      );progn
      (set hdln data_g)
    );if
  );defun
  ;———————-
  
; $value – "lstbox"에서 선택됬던 line number의 값.
; n번째 줄의 lstdt data로 data_n를 만든다.
  
  (defun move_l_e (edbox lstdt)
    (setq line_n (atoi (setq line_n $value)))
    (setq data_n "" data_n (nth line_n lstdt))
    ;———————–
    ; 이 file을 사용한 lisp file이 line number를 받아
    ; 그 자신이 설정한 변수에 기억시키고,
    ;
    ;;;    (princ (strcat "nLINE_N—" (itoa line_n))) (terpri)
    ;
    ;n번째 line의 내용 data_n을 "edbox" tile로 준다.
    (set_tile "edbox" data_n)
  );defun
  
(prompt "nLoaded …    ") (princ)
;—
;—03-05-26; 06-01-17
(defun c:dwgmk-a (/ dir1 dwg0 dwg1 fil1 fil2 fil3 lp1 dwg4 lp2 nbr1
                    str1 dwg3 fln1 mnp1 mxp1 mxp2 sg1 yy1)
  ;——–
  (trde-rd)
  ;——–
  (setq dir1 (getvar "dwgprefix"))
  (setq dwg0 (getvar "dwgname"))
  (setq dwg1 (substr dwg0 1 (- (strlen dwg0) 4) ))
  (if (findfile "d:\Program Files\Mine\lsp\fil0.fnm")
    (setq fil1 (open "d:\Program Files\Mine\lsp\fil0.fnm" "r"))
    (setq fil1 (open "d:\Program Files\Mine\lsp\fil0.fnm" "w"))
  );if
  (setq fil2 (read-line fil1))
  (close fil1)
  (if (or (= fil2 nil) (= fil2 ""))
    (setq fil3 "바로 전에 사용한 이름은 없읍니다.")
    (setq fil3 (strcat fil2 " -> 바로 전에 사용한 이름입니다."))
  );if
  ;——-
  (setq lp1 T msg1 "no")
  (while lp1
    (prompt fil3)
    (setq dwg4 dwg1 dwg1 "" lp2 T nbr1 1)
    (while lp2
      (setq str1 (substr dwg4 nbr1 1))
      (if (= str1 "-")
        (setq lp2 nil)
        (setq dwg1 (strcat dwg1 str1) nbr1 (+ nbr1 1))
      );if
    );while-lp2
    (setq dwg1 (strcat dwg1 "-"))
    (setq dwg2 (getstring (strcat "n기본명칭은 <" dwg1 "> ??   추가할 숫자 또는 글자만…. :" )))
    (if (/= dwg2 "")
      (progn
        (setq dwg3 (strcat dwg1 dwg2))
        (setq fln1 (strcat dir1 dwg3 ".dwg"))
        (if (findfile fln1)
          (progn
            (setq yy1 (getstring (strcat "n이미 사용중. <" dwg3 ">: 그대로 쓰려면 – es.  아니면 – . ")))
            (if (= (strcase yy1) "Y")
              (setq msg1 "ok" lp1 nil)
              (setq msg1 "no")
            );if
          );progn
          (setq lp1 nil)
        );if
      );progn
    );if
  );while
  ;—-
  (setq mnp1 (getpoint "nPick a Left Lower base point!…."))
  (setq mxp1 (getcorner mnp1 "nPick a Left Lower base point!…."))
  (setq mxp2 (mapcar '- mxp1 mnp1))
  (setq sg1 (ssget "w" mnp1 mxp1))
  ;—-
  (command "move" sg1 "" mnp1 '(0.0 0.0));
  (command "limmin" '(0.0 0.0) "limmax" mxp2)
  (command "zoom" "w" '(0.0 0.0) mxp2)
  (if (= msg1 "ok")
    (command "wblock" fln1 "y" "" mnp1 sg1 "")
    (command "wblock" fln1 "" mnp1 sg1 "")
  );if
  ;—-
  (setq fil1 (open "d:\Program Files\Mine\lsp\fil0.fnm" "w"))
  (write-line fln1 fil1)
  (close fil1)
  ;—-
  ; (command "open" "y" fln1)
  ;========
  (command "script" "d:\Program Files\Mine\lsp\dwgset-a.scr")
  ;========
  (setq sg1 nil)
);defun
;================================================================
  ;— Programed by Yang Jong Suk  1996 10 1
  (defun trde-rd (/ scl1 ss1 as10 y1a y1b pt1a pt1b mch1 mch2 y2a y2b pt2a
                    pt2b prt1 prt2 y3a y3b pt3a pt3b ord1 ord2)
    (setq scl1 (/ (car (getvar "limmax")) 297.0))
    (setq dir9 (findfile "C:\Documents and Settings\Yang Jong Suk"))
    (if dir9
      (setq ss1 (ssget "X" '((0 . "INSERT") (2 . "TRADE-J1″)) ))
      (setq ss1 (ssget "X" '((0 . "INSERT") (2 . "TRADE-CH")) ))
    );if
    (if (= ss1 nil)
      (setq yn1 (getstring "nPerform Trade-B to input TRADE.   Not-: "))
      (progn
        (setq as10 (cdr (assoc 10 (entget (ssname ss1 0)))))
        (setq fnm1 (open "d:\Program Files\Mine\lsp\fnm0.fnm" "w"))
        
        (setq y1a (mapcar '(lambda (x1a) (* x1a scl1)) '(10.072 18.632 0.0) ))
        (setq y1b (mapcar '(lambda (x1b) (* x1b scl1)) '(49.000 22.689 0.0) ))
        
        (setq pt1a (mapcar '+ as10 y1a))
        (setq pt1b (mapcar '+ as10 y1b))
        (setq mch0 (ssget "w" pt1a pt1b))
        
        (if (= mch0 nil)
          (setq mch1 "NAME of MACHINE?…")
          (setq mch1 (cdr (assoc 1 (entget (ssname mch0 0)))))  ; machin
        );if
        (write-line mch1 fnm1)
        
        (setq y2a (mapcar '(lambda (x2a) (* x2a scl1)) '(10.072 14.932 0.0) ))
        (setq y2b (mapcar '(lambda (x2b) (* x2b scl1)) '(49.000 18.632 0.0) ))
        (setq pt2a (mapcar '+ as10 y2a))
        (setq pt2b (mapcar '+ as10 y2b))
        (setq prt0 (ssget "w" pt2a pt2b))
        
        (if (= prt0 nil)
          (setq prt1 "NAME of PARTS?….")
          (setq prt1 (cdr (assoc 1 (entget (ssname prt0 0)))))  ; part's name
        );if
        (write-line prt1 fnm1)
        
        (setq y3a (mapcar '(lambda (x3a) (* x3a scl1)) '(10.072 11.224 0.0) ))
        (setq y3b (mapcar '(lambda (x3b) (* x3b scl1)) '(49.000 14.932 0.0) ))
        (setq pt3a (mapcar '+ as10 y3a))
        (setq pt3b (mapcar '+ as10 y3b))
        (setq ord0 (ssget "w" pt3a pt3b))
        (if (= ord0 nil)
          (setq ord1 "NAME of ORDER?….")
          (setq ord1 (cdr (assoc 1 (entget (ssname ord0 0)))))  ; machine
        );if
        (write-line ord1 fnm1)
        (close fnm1)
        (setq ss1 nil)
      );progn
    );if
  );defun
  ;============================================================================
(defun C:JJ () 
(setvar "cmdecho" 0)
        (princ "nSelect 2 lines to make one ") (setq w1 (ssget)) 
        (setq ll1 (ssname w1 0)) (setq ll2 (ssname w1 1)) 
        (setq l1 (entget (ssname w1 0))) (setq l2 (entget (ssname w1 1)))
  (setq x1 (car (setq v1 (cdr (setq k1(assoc 10 l1)))))) 
        (setq y1 (car (cdr v1)))
  (setq x2 (car (setq v2 (cdr (setq k2(assoc 11 l1)))))) 
        (setq y2 (car (cdr v2)))
(setq x3 (car (setq v3 (cdr (assoc 10 l2))))) (setq y3 (car (cdr v3)))      
(setq x4 (car (setq v4 (cdr (assoc 11 l2))))) (setq y4 (car (cdr v4)))
(setq d1 (+ (abs (- x1 x3)) (abs (- y1 y3)))) 
        (setq d2 (+ (abs (- x1 x4)) (abs (- y1 y4))))
(if (> d1 d2) (progn (setq d3 (+ (abs (- x2 x3)) (abs (- y2 y3))))
(if (> d1 d3) (setq xh1 x1 yh1 y1 xl1 x3 yl1 y3))  
        (if (< d1 d3) (setq xh1 x2 yh1 y2 xl1 x3 yl1 y3))  ))
(if (< d1 d2) (progn (setq d3 (+ (abs (- x2 x4)) (abs (- y2 y4))))
(if (> d2 d3) (setq xh1 x1 yh1 y1 xl1 x4 yl1 y4))  
        (if (< d2 d3) (setq xh1 x2 yh1 y2 xl1 x4 yl1 y4))  ))
(entdel ll2) (setq l1 (subst (cons 10 (list xh1 yh1)) k1 l1)) 
        (setq l1 (subst (cons 11 (list xl1 yl1)) k2 l1)) (entmod l1) (prin1)
        (setq w1 nil ll1 nil ll2 nil l1 nil) 
 (prin1))
;
(DEFUN C:NOTE ()     
   (setq olderr  *error*  *error* error)
   (setvar "cmdecho" 0 )
   (setq ds (getvar "dimscale"))
   (setq a 3)
   (setq p1 (getpoint "n Note Insert Point:"))
   (setvar "blipmode" 0)         
   (command "vslide" "c:/R14/JKH/sld/note")
   (setq n1 (strcase (getstring "n Hangul or English: ")))
   (while a
      (setq fname (getstring "n NOTE file name:"))
      (if (= n1 "H")
         (setq fname (strcat "*c:/R14/JKH/NOTE/" fname))
         (setq fname (strcat "*c:/R14/JKH/note/" fname "-e"))
      )
      (command "insert" fname p1 ds "")
      (setq p1 (list (car p1) (- (cadr p1) (* ds 6.0))))
   )  ;while               
   (setvar "cmdecho" 1 )
   (setvar "blipmode" 1)         
   (prin1)
)  ;defun
(defun c:wb1(/ b wblock_name wblock_data)
 (command "-layer" "U" "*" "")
 (prompt "nt Select of Wblock NAME : ")
 (setq b (entsel))
 (if b (setq wblock_name (strcat (getvar "DWGPREFIX") (cdr (assoc 1 (entget (car b))))))(exit))
 (prompt "nt Select of DATA : ")
 (setq wblock_data (ssget))
 (if (and (/= wblock_data nil)(/= wblock_name))
  (command "wblock" wblock_name "" "0,0″ wblock_data "")
 )
)
——————————————————————————————————-
(defun noele(dev num / olddata newdata data data1)
            (setq data (cdr (assoc num dev)))
            (setq  olddata  (assoc num dev))
            (setq  data1 (list (car data) (cadr data) 0))
            (setq  newdata (cons num data1))   
            (setq dev (subst newdata olddata dev))            
)
(defun chtime(data / rtcode)
           (setq rtcode (strcat (rtos (/ data 3600.) 2 0) ":"))
           (setq data (- data (* (fix (/ data 3600)) 3600.)))
           (setq rtcode (strcat rtcode (rtos (/ data 60.) 2 0) ":"))
           (setq data (- data (* (fix (/ data 60)) 60.)))
           (setq rtcode (strcat rtcode (rtos data 2 0)))
)
;|*********************Dim Text Change**********************************|;
(defun 3d2d_main(  / 
                      dcl_id3 selobj selnum idnum ed obj name starttime endtime
                    )
  
  (setq oldcmd (getvar "cmdecho"))
  (setvar "cmdecho" 0)      
  (princ "n>>Select Object<<")
  (setq selobj (ssget))  
  (setq selnum (sslength selobj))  
  (setq starttime (getvar "DATE"))
  (setq starttime (fix (* (- starttime (fix starttime)) 100000.)))  
  (setq idnum 0.)
  (repeat selnum
    (setq ename (ssname selobj idnum))
    (setq ed (entget ename))
    (if (= (cdr (assoc 0 ed)) "POLYLINE")
      (progn ;THEN
        (setq nxt ename)                                ;첫 엔티티 이름
        (while (setq nxt (entnext nxt))
            (setq ent (entget nxt))                        ;엔티티정보축출
            (if (= (cdr (assoc 0 ent)) "VERTEX")           ;절점일때만
              (progn
(setq oldpnt (cdr (assoc 10 ent)))
        (setq ent (subst (cons 10 (list (car oldpnt) (cadr oldpnt) 0))
(assoc 10 ent) ent))
        (entmod ent)
        (entupd nxt)
      );progn
            );if
        );while
      );progn
      (progn ;ELSE
        (setq o38 (assoc 38 ed))
        (setq n38 (cons (car o38) 0.0))
        (setq ed (subst n38 o38 ed))
        (setq obj (cdr (assoc 0 ed)))
        (setq name (cdr (assoc 1 ed)))
        (setq ed (noele ed 10))
        (setq ed (noele ed 11))
        (setq ed (noele ed 13))
        (setq ed (noele ed 14))    
        (setq ed (noele ed 21)) 
        (setq ed (noele ed 30)) 
        (setq ed (noele ed 31)) 
        (entmod ed) 
      );progn
    );if  
    (setq idnum (1+ idnum))
    (princ (strcat "Converting Data Num : " (rtos idnum 2 0) "(" (rtos (* (/ idnum selnum) 100) 2 0) "%)" (chr 13)))
  );repeat
  (setvar "ELEVATION" 0)
  (setq endtime (getvar "DATE"))
  (setq endtime (fix (* (- endtime (fix endtime)) 100000.)))  
  (princ (strcat "nElapsed Time : " (chtime (- endtime starttime)) "nConverting End….."))
  (setq *error* OLDERROR)
  (setvar "cmdecho" OLDCMD)
  (princ)           
);defun
;|**********************************************************************|;
(defun C:3d2d() (3d2d_main))
(princ "nLoading Complete……  .nType : 3d2d")
(princ)
——————————————————————————————————–
(defun $delta_a (%_c %_a)
 (sqrt (- (expt %_c 2) (expt %_a 2)))
)
;;—
(defun #ssadd (#ent1 / #ssent)
  (setq  #ssent (ssadd))
  (ssadd #ent1 #ssent)
  (while #ent1 
         (ssadd #ent1 #ssent)
         (setq #ent1 (entnext #ent1))
  )
  #ssent
)
;;—
(defun c:ti ()
  (setvar "cmdecho" 0)
  (setq $old_textstyle (getvar "TEXTSTYLE"))
  (if (= nil (tblsearch "style" "굴림체"))
      (COMMAND "STYLE" "굴림체" "굴림체" "0″ "0.85″ "0″ "n" "n")
  )
  (if (= nil (tblsearch "style" "돋움"))
      (COMMAND "STYLE" "돋움" "돋움" "0″ "0.85″ "0″ "n" "n")
  )
  (if (= nil (tblsearch "block" "time"))
      (progn
        (command "donut" 26.8 27.2 "0,0″ "")
        (setq $time_en1 (entlast))
        (command "donut" 38.8 39.2 "0,0″ "")
        (command "line" '(0 13.5) "@6<90″ "")
        (command "array" (entlast) "" "p" '(0 0) "24″ "360″ "y")
        (command "line" '(0 13.5) "@2<90″ "")
        (command "rotate" (entlast) "" '(0 0) "3.75″)
        (setq $ent_1 (entlast))
        (command "array" (entlast) "" "p" '(0 0) "3″ "7.5″ "y")
        (command "array" (entlast) (entnext $ent_1) $ent_1 "" "p" '(0 0) "24″ "360″ "y")
        (setq ii 1
              ai (- 7.5)
        )
        (repeat 24
          (command "text" "j" "m" '(0 17.5) "2.5″ "0″ (rtos ii 2 0))
          (command "rotate" (entlast) "" '(0 0) ai)
          (setq ii (1+ ii)
                ai (- ai 15)
          )
        )
        (command "block" "time" '(0 0) (#ssadd $time_en1) "")
      )
  )
  (if (= nil (tblsearch "block" "date"))
      (progn
        (command "line" (list (- ($delta_a 13.5 4)) 4) (list ($delta_a 13.5 4) 4) "")
        (setq $date_en1 (entlast))
        (command "line" (list (- ($delta_a 13.5 4)) (- 4)) (list ($delta_a 13.5 4) (- 4)) "")
        (command "pline" '(0 6) "w" "2.2″ "2.2″ "@2.75<90″ "w" "4.65″ "0″ "@2.75<90″ "")
        (setvar "TEXTSTYLE" "돋움")
;        (command "text" "j" "m" '(0 8) "  (*(getvar   "dimscale") 3.1)" "0″ "출      도")
        (command "text" "j" "Fit" '(-7 6.2) '(7 6.2) "3.1″ "출    도")
        (command "text" "j" "M" '(0 -7.5) "2.5″ "0″ "대한시스텍") ;;==>"(주) E & EC"는 업체명이므로 변경 가능
;        (command "text" "j" "Fit" '(-10 -7.7) '(10 -7.7) "2.5″ "원신기계공업(주)")
        (command "block" "date" "0,0″ (#ssadd $date_en1) "")
      )
  )
  (C:L0)
  (setq #insp (getpoint "nInsert Point : "))
  (setq #cd (rtos (getvar "cdate") 2 8)
        #cdate (strcat (substr #cd 1 4) "." (substr #cd 5 2) "." 
                       (substr #cd 7 2))
        #tih (atoi (substr #cd 10 2))
        #tim (atoi (substr #cd 12 2))
        #_ang (+ (* 15 (1- #tih)) (* 3.75 (/ #tim 15.0)))
  )
  (setvar "TEXTSTYLE" "돋움")
  (command "text" "J" "M" #insp 4 "0″ #cdate)
  (command "insert" "time.dwg" #insp 1 1 #_ang)
  (command "insert" "date.dwg" #insp 1 1 0)
  (setvar "TEXTSTYLE" $old_textstyle)
  (princ)
)
(defun c:L0 ()
  (command "layer" "m" "0″ "")
)
(defun c:BL (/ a p1)
  (prompt "nt = 도면내에서 임의의 Block을 생성함. ")
  (prompt "nt Block에 포함될 객체를 선택해 보시구랴… :")
  (setq a (ssget))
     ;  (setq p1 (getvar "VIEWCTR")) ; 가끔 위치변동이 생김
  (setq p1 (getpoint "nSpecify insertion base point:"))
  (command "Copybase" p1 a "")
  (command "Erase" "P" "")
  (command "Pasteblock" p1)
  (prompt "nt 임의의 Block이 생성되었읍니다. ")
  (princ))
;탭  치수쓰기 리습
(defun c:AT(/ #os #a #b dia k dp n txt ep ep1 ep2 p2 df)
(setvar "cmdecho" 0)
(setq df (getvar "dimlfac" ))
(setq #os (getvar "osmode"))
(setvar "osmode" 512)
(setq #a(getpoint "n≫≫≫TAP 외경을 선택하세요:"))
(setq p2 (getpoint #a "n2번째 포인트 :"))
(setvar "osmode" #os)
(if (setq #b (osnap #a "cen"))
(progn
(setq dia (fix (atof (rtos (* (* (distance #a #b) 2.0) df)2 0)))) ;; 0.5이상이면 1로인식
(initget "T D")
(setq k (getkword "n관통 … < [T]hru > / [D]p : "))
(if (= k "D")
(progn
(setq dp (getint (strcat "n깊이< " (itoa (* dia 2)) " >: "))) ;;DP 미지정시 탭 지름의 2배로 인식
(if (= dp nil) (setq dp (* dia 2)))
)
)
(setq n (getint "n수량< 1 = Enter >: "))
  
(if (or (= n nil)(= n "")(= n "1″))
  (progn
    (if (or (= k nil) (= k "T")) ; T,1
      (setq txt (strcat "M" (itoa dia) " TAP THRU")))    
    (if (= k "D")  ;D,1
   (setq txt (strcat "M" (itoa dia) " TAP DP" (itoa dp))))
  ) 
  (progn
    (if (or (= k nil) (= k "T")) ; T,2~   
   (setq txt (strcat (itoa n) "-" "M" (itoa dia) " TAP THRU")))
   
    (if (= k "D") ;D,2~   
      (setq txt (strcat (itoa n) "-" "M" (itoa dia) " TAP DP" (itoa dp))))
  ) 
 )
(setvar "osmode" 0);;;osnap 없애기
(command "leader" #a p2 "a" txt "")
(setvar "osmode" #os);;;osnap 복구
)
)
(princ)
)
 
——————————————————————————–
위 리습 응용…드릴홀 치수기입 리습
 
;드릴 구멍 치수쓰기 리습
(defun c:AD(/ #os #a #b dia k dp n txt ep ep1 ep2 p2 df)
(setvar "cmdecho" 0)
(setq df (getvar "dimlfac" ))
(setq #os (getvar "osmode"))
(setvar "osmode" 512)
(setq #a (getpoint "n≫≫≫구멍 외경을 선택하세요:"))
(setq p2 (getpoint #a "n≫≫2번째 포인트 :"))
(setvar "osmode" #os)
(if (setq #b (osnap #a "cen"))
(progn
(setq dia (*(*(distance #a #b )2.0)df))
(initget "T D")
(setq k (getkword "n≫ 관통…< [T]hru = Enter > / [D]p : "))
(if (= k "D")
(progn
(setq dp (getint (strcat "n≫ 깊이 < 구멍크기는 Ø"(rtos dia)" 입니다>: ")))
)
)
(setq n (getint "n수량< 1 = Enter >: "))
  
(if (or (= n nil)(= n "")(= n "1″))
  (progn
    (if (or (= k nil) (= k "T"))
      (setq txt (strcat "%%C" (rtos dia) " DR THRU")))    
    (if (= k "D") 
   (setq txt (strcat "%%C" (rtos dia) " DR DP" (rtos dp))))
  ) 
  (progn
    (if (or (= k nil) (= k "%%C"))
   (setq txt (strcat (rtos n) "-" "%%C" (rtos dia) " DR THRU")))
   
    (if (= k "D")
      (setq txt (strcat (rtos n) "-" "%%C" (rtos dia) " DR DP" (rtos dp))))
  ) 
 )
(setvar "osmode" 0)
(command "leader" #a p2 "a" txt "")
(setvar "osmode" #os)
)
)
(princ))
;카운트 보아치수기입
;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
;Count bore dimensioning lisp
;Command : ac
;by ysJeong 2009.06.08
;;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defun dtr (a) (* pi (/ a 180.0))) ;degree to radian
(defun c:ac(/ ort os gap df ts dsc tad  cla dic m ins dic p1 p2 #b ts1 gap1 d1 t1 nt1 nt2)
 (defun *error* (msg)
 (princ "error: ")(princ msg) (setvar "osmode" os) (setvar "dimtad" tad)   
 (setvar "orthomode" ort)(setvar "clayer" cla)(princ)) 
  (setq ort (getvar "orthomode") os (getvar "osmode") gap (getvar "dimgap") df (getvar "dimlfac" )
         ts (getvar "dimtxt") dsc (getvar "dimscale") tad (getvar "dimtad") cla (getvar "clayer")) 
  (setvar "osmode" 512)
  (setq p1 (getpoint "n카운터보어 바깥원 선택:"))
  (setvar "osmode" os)
  (setvar "orthomode" 0)
  (setq p2 (getpoint p1 "n리더선 끝점 선택:"))
  (setvar "orthomode" 1)   
  (setq #b (osnap p1 "cen"))
  (setq ts1 (* ts dsc) gap1 (* gap dsc))    
  (setq d1 (+ (/ (+ (* ts1 1.66) ts1) 2) gap1))  
 (setq tex (getreal "n갯수 입력 [1 = 엔터]: "))
   (if (>= tex 2)
   (setq t1 (strcat (rtos tex 2 0) "-")) 
   (progn (setq t1 tex) (setq t1 ""))
   )
 (setq m (itoa(fix(atof(rtos(* (*(distance p1 #b )2.0) df)2 0)))))
    (if (= m "48″)        ;;;m30       
 (progn (setq d1 "33″) (setq d2 "48″) (setq d3 "32″) )) 
    (if (= m "43″)        ;;;m27     
 (progn (setq d1 "30″) (setq d2 "43″) (setq d3 "29″) )) 
    (if (= m "39″)         ;;;m24      
 (progn (setq d1 "26″) (setq d2 "39″) (setq d3 "25.5″) )) 
    (if (= m "35″)         ;;;m22
 (progn (setq d1 "24″) (setq d2 "35″) (setq d3 "23.5″) )) 
    (if (= m "32″)         ;;;m20       
 (progn (setq d1 "22″) (setq d2 "32″) (setq d3 "21.5″) )) 
    (if (= m "29″)       ;;;m18        
 (progn (setq d1 "20″) (setq d2 "29″) (setq d3 "19.5″) )) 
    (if (= m "26″)        ;;;m16        
 (progn (setq d1 "18″) (setq d2 "26″) (setq d3 "17.5″) )) 
    (if (= m "23″)       ;;;m14         
 (progn (setq d1 "16″) (setq d2 "23″) (setq d3 "15.2″) )) 
    (if (= m "20″)             ;;;m12   
 (progn (setq d1 "14″) (setq d2 "20″) (setq d3 "13″) )) 
    (if (or (= m "18″) (= m "17″))        ;;;m10       
 (progn (setq d1 "11″) (setq d2 "17.5″) (setq d3 "10.8″) )) 
    (if (= m "14″)       ;;;m8   
 (progn (setq d1 "9″) (setq d2 "14″) (setq d3 "8.6″) )) 
    (if (= m "11″)        ;;;m6        
 (progn (setq d1 "6.6″) (setq d2 "11″) (setq d3 "6.5″) )) 
    (if (or (= m "10″)  (= m "9″))     ;;;m5       
 (progn (setq d1 "5.5″) (setq d2 "9.5″) (setq d3 "5.5″) )) 
    (if (= m "8″)        ;;;m4         
 (progn (setq d1 "4.5″) (setq d2 "8″) (setq d3 "4.4″) )) 
    (if (= m "6″)         ;;;m3
 (progn (setq d1 "3.4″) (setq d2 "6″) (setq d3 "3.3″) )) 
        (setq nt1 (strcat t1 "%%c" d1 " DR THRU"))  
        (setq nt2 (strcat "%%c" d2 " C'BORE DP" d3 )) 
  (setvar "osmode" 0)
  (setvar "dimtad" 0)
  (command "layer" "s" "4″ "") ; 여기 레이어이름 4(치수레이어)  바꾸세요
  (command "leader" p1 p2 "" nt1 nt2  "") 
  ;(command "stretch" "c" (polar p2 (dtr 215) 0.1)  (polar p2 (dtr 45) 0.1) "" (list  0 0 0) (list 0 d1)) ; 현재 미사용
  (setvar "osmode" os) 
  (setvar "dimtad" tad) 
  (setvar "clayer" cla)
  (setvar "orthomode" ort)
(princ)
);defun
;[출처] 카운터보어 치수기입리습 (메카피아닷컴) |작성자 SuHa
;————————————————————————–
;;===============================================================
;  치수기입하기(1996 주말농부)
;  ->치수기입을 빠르고 편리하게 쓸수있는 명령어
;  ->치수보조선 정렬 / 연속치수기입 기능추가(2007.6.11)
;  ->더블라인 치수표기 수정(2007.7.24)
;;—— Quick dimension —————————————-
(defun c:as(/ os dis hva a tem pt1 pt2 pt3 p1 p2 p3 dx dy ag
              en ed ed1 db10)
;->*error* start
 (defun *error* (msg)(princ "error: ")(princ msg)
 (setvar "osmode" os)(setvar "clayer" cl)
 (princ))
;-<*error* end
   (setq os (getvar "osmode") cl (getvar "clayer"))
   (setq dis (* (getvar "dimscale") (getvar "dimdli")))
   (if (= dwqd nil)(setq dwqd dis)(setq dis dwqd))
   (prompt "n현재 치수선간격:")(princ (rtos dwqd 2 0))
   (prompt "  레이어:")(princ cl)
   (initget "Lin Ali Opt")
   (setq hva (getkword "n[선형(L)/정렬(A)/간격,레이어조정(O)]<선형>:"))
   (while (= hva "Opt")
      (setq a (strcat "n치수선간격<" (rtos dwqd 2 0) ">: "))
      (setq tem (getdist a))
      (if (= tem nil) (setq dis dwqd)(setq dis tem))
      (setq dwqd dis)
      (setq ss1(entsel "n레이어지정->"))
      (if (= ss1 nil)
         (setq la cl)
         (progn
         (setq la (cdr (assoc 8 (entget (car ss1)))))
         (setvar "clayer" la))
      )
   (prompt "n현재 치수선간격:")(princ (rtos dwqd 2 0))
   (prompt "  레이어:")(princ la)
      (initget "Lin Ali Opt")
      (setq hva (getkword "n[선형(L)/정렬(A)/간격(O)]<선형>:"))
   )
   (setvar "osmode" 9);end,node
(while (setq pt1 (getpoint "n첫 번째 치수보조선 원점 지정->"))
   (setvar "osmode" 128);per
   (setq pt2 (getpoint pt1 "n두 번째 치수보조선 원점 지정->"))
   (if pt2 (progn
      (setq pt3 (getpoint pt2 "n치수선의 위치 지정->"))
      (setq p1 pt1 p2 pt2 p3 pt3)
      (setq dx (abs (- (car pt1) (car pt2)))
               dy (abs (- (cadr pt1) (cadr pt2))) )
      (if (/= hva "Ali")
         (if (> (- dx dy) 0)
            (progn
               (setq hva "Hor" p1 pt1)
               (setq p2 (list (car pt2) (cadr pt1))) )
            (progn
               (setq hva "Ver" p1 pt1)
               (setq p2 (list (car pt1) (cadr pt2))) )
      )   )
      (setvar "osmode" 0)
      (command "dim" hva p1 p2 p3 "" "e")
      (if (= hva "Ali")(setvar "osmode" 128)(setvar "osmode" 9))
      (setq pt2 (getpoint p2 "n두 번째 치수보조선 원점 지정->"))
      (while pt2
         (cond
            ( (= hva "Hor") (setq p1 p2 p2 (list (car pt2) (cadr pt1))) )
            ( (= hva "Ver") (setq p1 p2 p2 (list (car pt1) (cadr pt2))) )
            ( (= hva "Ali") (setq p1 p2  p2 pt2) )
         )
         (setvar "osmode" 0)
         (command "dim" hva p1 p2 p3 "" "e")
         (if (= hva "Ali")(setvar "osmode" 128)(setvar "osmode" 9))
         (setq pt2 (getpoint p2 "n두 번째 치수보조선 원점 지정->"))
      )
      (setq en (entlast))
      (setq ed (entget en))
      (setq db10 (cdr (assoc 10 ed)))
      (setq ag (angle p2 db10))
      (setq p3 (polar db10 ag dis))
      (setvar "osmode" 0)
      (command "dim" hva pt1 p2 p3 "" "e")
      (setvar "osmode" 9);end,node
   ));if end
);while end
   (setvar "osmode" os)(setvar "clayer" cl)
(prin1))
;;———————————————————————————————–;;
;;   숫자 증감 문자 수정_150824                                                                  ;;
;;   1. 숫자 증감                                                                                ;;
;;     -NUMINCV3-4: 도면 번호 생성 시 사용, 별도 창 생성                                         ;;
;;     -IncArrayV1-6: 파트 번호 생성 시 사용, 번호만 변경, 문자 안 됨                            ;;
;;     -ADD: 클릭 번호만 한번만 증감, 특수문자 등 오류                                           ;;
;;   2. 문자 수정                                                                                ;;
;;     -SED: 선택 문자 수정                                                                      ;;
;;     -TCO: 문자내용 복사                                                                       ;;
;;     -TSD: 블럭내 문자 삭제                                                                    ;;
;;     -TSW: 문자 교환                                                                           ;;
;;                                                                                               ;;
;;                                                                                               ;;
;;———————————————————————————————–;;
;;—————————–=={  Incremental Numbering Suite  }==—————————–;;
;;                                                                                               ;;
;;  ——————————————–                                                 ;;
;;  Program Overview                                                                             ;;
;;  ——————————————–                                                 ;;
;;                                                                                               ;;
;;  Incremental Numbering Suite enables the user to dynamically place incrementing alphabetical  ;;
;;  or numerical text in a drawing, with a range of positioning utilities and an optional        ;;
;;  prefix and/or suffix.                                                                        ;;
;;                                                                                               ;;
;;  The sequential text can be created using Text, MText or Attributed Blocks; furthermore, the  ;;
;;  style and formatting of these objects can be altered directly from the main dialog, with     ;;
;;  all settings remembered between drawing sessions.                                            ;;
;;                                                                                               ;;
;;  The user can modify the Text or Block layer, choose from a list of available Text Styles in  ;;
;;  the drawing, alter the Text or MText alignment, and also change the Text Height by either    ;;
;;  entering an arbitrary value, picking a value from the drawing, or using the height defined   ;;
;;  by the selected Text Style.                                                                  ;;
;;                                                                                               ;;
;;  If the Object type is set to use an attributed block, the user may choose the block that is  ;;
;;  to be used from a list of attribute blocks defined in the drawing, or select a block object  ;;
;;  directly from the drawing.                                                                   ;;
;;                                                                                               ;;
;;  The user also has control over which attribute will house the incrementing string, and the   ;;
;;  scale at which the block is inserted. This scale value can take an arbitrary value entered   ;;
;;  by the user or picked from the drawing, or can be dependent upon the current value of a      ;;
;;  selected System Variable, such as DIMSCALE.                                                  ;;
;;                                                                                               ;;
;;  If MText is selected, the user may also toggle the use of an MText Background Mask and       ;;
;;  control both the Background Mask Offset Factor and Colour.                                   ;;
;;                                                                                               ;;
;;  The user can enter optional Prefix, Middle and Suffix text, and has the option to increment  ;;
;;  any or all sections, with the ability to increment alphabetical text and use decimals and    ;;
;;  leading zeros. The user can also specify any numerical increment, positive or negative.      ;;
;;                                                                                               ;;
;;  If the user has chosen to use Text or MText objects in which to house the incremental text,  ;;
;;  there is an additional option to enclose such objects with a border. The border may be       ;;
;;  Circular, Rectangular, Slot or an n-sided Polygon; created on a layer chosen from the main   ;;
;;  dialog.                                                                                      ;;
;;                                                                                               ;;
;;  The size of the border may be controlled using an Offset Factor from the Text or MText       ;;
;;  object. The Offset Factor has behaviour identical to that of the Background Mask Offset      ;;
;;  Factor wherein the offset is dependent upon the text height: an offset factor of 1.0         ;;
;;  exactly fits the Text or MText object, a factor of 1.5 extends the border by 0.5 times the   ;;
;;  text height etc. Alternatively, the user may specify a fixed border size, with the option    ;;
;;  to pick either dimension from the drawing.                                                   ;;
;;                                                                                               ;;
;;  ——————————————–                                                 ;;
;;  Creating an Array                                                                            ;;
;;  ——————————————–                                                 ;;
;;                                                                                               ;;
;;  The program also offers the ability for the user to array the selected object, with the      ;;
;;  content automatically incremented sequentially for each object in the array.                 ;;
;;                                                                                               ;;
;;  Upon enabling the option to 'Create Array' (located towards the base of the centre panel of  ;;
;;  the dialog), the user can specify the number of items in the array and furthermore control   ;;
;;  the rotation of each object in the array, either relative to the direction of the array,     ;;
;;  or by entering a fixed value or picking such value from the drawing.                         ;;
;;                                                                                               ;;
;;  After submitting the desired dialog settings, the user is then prompted to specify a base    ;;
;;  point for the array. This is the point at which the first object in the array will be        ;;
;;  created and the point from which the array will emanate.                                     ;;
;;                                                                                               ;;
;;  Following the valid specification of an array base point, the user is given the option to    ;;
;;  supply either an array spacing vector, or the array endpoint.                                ;;
;;                                                                                               ;;
;;  The array spacing vector describes the vector between each successive object in the array.   ;;
;;  Conversely, the array endpoint specifies the point at which the last object in the array     ;;
;;  will be inserted; with the remaining objects inserted equispaced between the two points.     ;;
;;                                                                                               ;;
;;  Concerning object rotation, the user has three options to determine how objects are          ;;
;;  oriented relative to the array. If the user decides to align objects in the direction of     ;;
;;  the array, the rotation of each object will reflect the direction of the array vector.       ;;
;;                                                                                               ;;
;;  Similarly, selecting to rotate objects perpendicular to the array will result in objects     ;;
;;  oriented at right-angles to the array direction, whilst retaining readability.               ;;
;;                                                                                               ;;
;;  Finally, the user may also specify an arbitrary fixed rotation, or pick such a value         ;;
;;  directly from the drawing.                                                                   ;;
;;                                                                                               ;;
;;  ——————————————–                                                 ;;
;;  Dynamic Positioning Mode                                                                     ;;
;;  ——————————————–                                                 ;;
;;                                                                                               ;;
;;  Dynamic Mode is activated by enabling the option: 'Text Follows Cursor'.                     ;;
;;                                                                                               ;;
;;  This mode will display a real-time preview of the Text, MText or Attributed Block with any   ;;
;;  border or background mask that may be specified.                                             ;;
;;                                                                                               ;;
;;  Note: As a result of the method used to display the real-time preview, Dynamic Mode          ;;
;;  restricts the use of standard AutoCAD functionality such as Object Snap, Orthomode,          ;;
;;  Tracking etc. To enable such functionality, uncheck the 'Text Follows Cursor' option at      ;;
;;  the top-left corner of the dialog.                                                           ;;
;;                                                                                               ;;
;;  Various positioning controls displayed at the command line:                                  ;;
;;                                                                                               ;;
;;  ——————————————–                                                 ;;
;;  Dynamic Mode Positioning Controls:                                                           ;;
;;  ——————————————–                                                 ;;
;;                                                                                               ;;
;;  [ Enter ]  –  (or Space/Right-Click) Exit Program [Cancel]                                   ;;
;;  [ Click ]  –  Place Object                                                                   ;;
;;  [   <   ]  –  Rotate Object Counter Clockwise                                                ;;
;;  [   >   ]  –  Rotate Object Clockwise                                                        ;;
;;  [   O   ]  –  Specify Object Rotation                                                        ;;
;;  [  Tab  ]  –  Rotate Object by 90?                                                          ;;
;;  [   M   ]  –  Mirror Object Rotation                                                         ;;
;;  [   C   ]  –  Align Object to Curve                                                          ;;
;;  [   R   ]  –  Replace Existing Text/Attribute String                                         ;;
;;  [   T   ]  –  Toggle Counter Increment                                                       ;;
;;  [   I   ]  –  Increment String                                                               ;;
;;  [   B   ]  –  Rotate Polygonal Border                                                        ;;
;;  [   A   ]  –  Toggle MText Background Mask                                                   ;;
;;                                                                                               ;;
;;  ——————————————–                                                 ;;
;;  Align Object to Curve                                                                        ;;
;;  ——————————————–                                                 ;;
;;                                                                                               ;;
;;  The user can choose to align the object to a selected curve object (Line, LWPolyline,        ;;
;;  Polyline, XLine, Spline, Arc, Circle, Ellipse etc.) by pressing 'C' or 'c' during            ;;
;;  placement.                                                                                   ;;
;;                                                                                               ;;
;;  The user is then prompted to select a curve to which the text will be aligned. The text      ;;
;;  will follow the selected curve with various positioning controls available at the            ;;
;;  command-line:                                                                                ;;
;;                                                                                               ;;
;;  ——————————————–                                                 ;;
;;  Curve Alignment Controls                                                                     ;;
;;  ——————————————–                                                 ;;
;;                                                                                               ;;
;;  [ Enter ]  –  (or Space/Right-Click) Exit Curve Alignment [Cancel]                           ;;
;;  [ Click ]  –  Place Object                                                                   ;;
;;  [  +/-  ]  –  Increase/Decrease Object Offset                                                ;;
;;  [   O   ]  –  Specify Object Offset                                                          ;;
;;  [   P   ]  –  Toggle Object Perpendicularity                                                 ;;
;;  [   B   ]  –  Rotate Polygonal Border                                                        ;;
;;  [   A   ]  –  Toggle MText Background Mask                                                   ;;
;;                                                                                               ;;
;;  ——————————————–                                                 ;;
;;  Replace Existing Text or Attribute String                                                    ;;
;;  ——————————————–                                                 ;;
;;                                                                                               ;;
;;  Upon pressing 'R' or 'r' during placement, the user is continuously prompted to select       ;;
;;  either Text, MText or Attribute, which, upon selection will be modified to contain the       ;;
;;  sequential text string.                                                                      ;;
;;                                                                                               ;;
;;  The user can exit this mode and return to standard text placement by pressing Enter,         ;;
;;  Space, or by Right-clicking the mouse at the prompt.                                         ;;
;;                                                                                               ;;
;;  ——————————————–                                                 ;;
;;  Standard Positioning Mode                                                                    ;;
;;  ——————————————–                                                 ;;
;;                                                                                               ;;
;;  This mode is available when the 'Text Follows Cursor' is disabled (unticked).                ;;
;;                                                                                               ;;
;;  When using this mode, there is no longer a real-time preview of the text at the cursor,      ;;
;;  however all standard AutoCAD functionality is available, (such as Object Snap, Tracking,     ;;
;;  Orthomode, etc.).                                                                            ;;
;;                                                                                               ;;
;;  The majority of placement controls are still available at the command-line:                  ;;
;;                                                                                               ;;
;;  ——————————————–                                                 ;;
;;  Standard Mode Positioning Controls:                                                          ;;
;;  ——————————————–                                                 ;;
;;                                                                                               ;;
;;  [ Enter ]  –  (or Space/Right-Click) Exit Program [Cancel]                                   ;;
;;  [ Click ]  –  Place Object                                                                   ;;
;;  [   O   ]  –  Specify Object Rotation                                                        ;;
;;  [  RO   ]  –  Rotate Object by 90?                                                          ;;
;;  [   M   ]  –  Mirror Object Rotation                                                         ;;
;;  [   C   ]  –  Align Object to Curve                                                          ;;
;;  [   R   ]  –  Replace Existing Text/Attribute String                                         ;;
;;  [   T   ]  –  Toggle Counter Increment                                                       ;;
;;  [   I   ]  –  Increment String                                                               ;;
;;  [   B   ]  –  Rotate Polygonal Border                                                        ;;
;;  [   A   ]  –  Toggle MText Background Mask                                                   ;;
;;                                                                                               ;;
;;———————————————————————————————–;;
;;                                                                                               ;;
;;  Function Syntax:  NumInc                                                                     ;;
;;                                                                                               ;;
;;———————————————————————————————–;;
;;                                                                                               ;;
;;  Author: Lee Mac, Copyright ?2009 – http://www.lee-mac.com&nbsp;                                         ;;
;;                                                                                               ;;
;;———————————————————————————————–;;
;;                                                                                               ;;
;;  TERMS AND CONDITIONS OF USE                                                                  ;;
;;                                                                                               ;;
;;  This license and disclaimer statement constitutes a legal agreement between you (either as   ;;
;;  an individual or a single entity) and Lee Mac (the "Author"), for this software product      ;;
;;  (the "Software").                                                                            ;;
;;                                                                                               ;;
;;  By downloading, installing, copying, or otherwise using the software, you agree to be bound  ;;
;;  by all of the following terms and conditions of this license and disclaimer agreement.       ;;
;;                                                                                               ;;
;;  If you do not agree with all the terms and conditions of this agreement, you must            ;;
;;  immediately cease use of the Software and destroy all copies of the Software and all of      ;;
;;  its component or constituent parts in your possession or under your control.                 ;;
;;                                                                                               ;;
;;  The Software is freeware. You may use it royalty free for private use.                       ;;
;;                                                                                               ;;
;;  You may redistribute the Software providing you have written consent from the Author, and    ;;
;;  that no modifications are made to the original content.                                      ;;
;;                                                                                               ;;
;;  You may not charge any fees for the redistribution or use of this Software.                  ;;
;;                                                                                               ;;
;;  The Software is provided "as is", and with all faults. All warranties, expressed or          ;;
;;  implied, including, but not limited to implied warranties of fitness for a particular use    ;;
;;  or purpose are hereby disclaimed. There is no guarantee that the operation of this Software  ;;
;;  will be uninterrupted or error free.                                                         ;;
;;                                                                                               ;;
;;  You acknowledge and agree that your use of the Software is at your own risk.                 ;;
;;                                                                                               ;;
;;  The Software is a copyrighted work and is protected by copyright law and international       ;;
;;  copyright treaty.                                                                            ;;
;;                                                                                               ;;
;;———————————————————————————————–;;
;;                                                                                               ;;
;;  Version:                                                                                     ;;
;;                                                                                               ;;
;;  1.0:  12/04/2009  –  First Release.                                                          ;;
;;———————————————————————————————–;;
;;  1.1:  14/04/2009  –  Added Prefix/Suffix Option.                                             ;;
;;———————————————————————————————–;;
;;  1.2:  15/04/2009  –  Added Dialog.                                                           ;;
;;———————————————————————————————–;;
;;  1.3:  15/04/2009  –  Added Option to Replace Existing text/attribute string.                 ;;
;;———————————————————————————————–;;
;;  1.4:  18/04/2009  –  Made program compatible with leading zeros.                             ;;
;;———————————————————————————————–;;
;;  1.5:  16/06/2009  –  Upgraded program code.                                                  ;;
;;———————————————————————————————–;;
;;  1.6:  27/06/2009  –  Added Counter Toggle.                                                   ;;
;;                    –  General Bug Fixes.                                                      ;;
;;———————————————————————————————–;;
;;  1.7:  18/02/2010  –  General Program Upgrade.                                                ;;
;;———————————————————————————————–;;
;;  1.8:  19/02/2010  –  Change Rotation Controls.                                               ;;
;;———————————————————————————————–;;
;;  1.9:  22/02/2010  –  Added option to not use GrRead loop, and hence allow OSnap to function. ;;
;;                    –  Added ability to place text in Table Cells.                             ;;
;;———————————————————————————————–;;
;;  2.0:  24/02/2010  –  Fixed Text Height Bug.                                                  ;;
;;———————————————————————————————–;;
;;  2.1:  05/05/2010  –  Removed imitation OSnap.                                                ;;
;;                    –  Modified loop to allow multiple replacements when in standard mode.     ;;
;;                    –  Added ability to use Alphabetical Increment.                            ;;
;;———————————————————————————————–;;
;;  2.2:  06/05/2010  –  Fixed bug with text case when incrementing alphabetical strings.        ;;
;;                    –  Added ability to border text with either Circle, Rectangle or Slot;     ;;
;;                       and offset from text.                                                   ;;
;;———————————————————————————————–;;
;;  2.3:  07/05/2010  –  Changed the way that layer/style globals are stored to allow for        ;;
;;                       layer/style changes between uses.                                       ;;
;;                    –  Removed Xref layers/styles from list.                                   ;;
;;                    –  Fixed UCS bugs.                                                         ;;
;;———————————————————————————————–;;
;;  2.4:  10/05/2010  –  Added a 'By Style' option for text height selection.                    ;;
;;                    –  Added option to enclose text with n-sided Polygon.                      ;;
;;                    –  Added ability to rotate polygonal border.                               ;;
;;———————————————————————————————–;;
;;  2.5:  11/05/2010  –  Allowed for Zero height in TextStyle.                                   ;;
;;                    –  Added ability to fix border size.                                       ;;
;;                    –  Fixed Text Height variable bug.                                         ;;
;;                    –  Fixed Rotation of odd-sided polygons.                                   ;;
;;———————————————————————————————–;;
;;  2.6:  12/05/2010  –  Fixed Rotation of odd-sided polygons when text is not set to follow     ;;
;;                       cursor.                                                                 ;;
;;                    –  Fixed Slot Bulges.                                                      ;;
;;                    –  Added 'B' control to DCL About page.                                    ;;
;;———————————————————————————————–;;
;;  2.7:  22/05/2010  –  Fixed Border issue when in different view.                              ;;
;;———————————————————————————————–;;
;;  2.8:  24/05/2010  –  Changed DCL/CFG file save path to make program                          ;;
;;                       compatible with Bricscad.                                               ;;
;;———————————————————————————————–;;
;;  2.9:  29/05/2010  –  Upgraded code to determine DCL/CFG Filepath, to allow for AutoCAD       ;;
;;                       Versions pre 2004.                                                      ;;
;;———————————————————————————————–;;
;;  3.0:  10/10/2011  –  Program completely rewritten to improve program performance, update     ;;
;;                       code formatting and include the following new features:                 ;;
;;                    –  Ability to use Text, MText or an Attributed Block to house              ;;
;;                       incrementing string.                                                    ;;
;;                    –  Ability to change Text / MText Alignment.                               ;;
;;                    –  Ability to toggle the use of a Background Mask with MText.              ;;
;;                    –  Ability to specify both dimensions for the fixed size Slot /            ;;
;;                       Rectangular border.                                                     ;;
;;                    –  Vastly improved alphabetical text incrementing.                         ;;
;;                    –  Improved handling of negative numbers.                                  ;;
;;                    –  Dialog interface completely redesigned to make it more user-friendly    ;;
;;                       and intuitive to navigate.                                              ;;
;;                    –  Improved non-dynamic mode interface & functionality.                    ;;
;;                    –  Program works in all UCS/Views correctly.                               ;;
;;———————————————————————————————–;;
;;  3.1:  11/10/2011  –  Fixed bug concerning null text size variable when object is set to      ;;
;;                       attributed block.                                                       ;;
;;———————————————————————————————–;;
;;  3.2:  02/03/2012  –  Fixed bug wherein the object type default is a block but there are no   ;;
;;                       blocks in the drawing.                                                  ;;
;;                    –  Altered structure of numinc:popup function and introduced new           ;;
;;                       numinc:wsh function to avoid repetitive creation of the Windows         ;;
;;                       Script Host (WSH) Object.                                               ;;
;;                    –  Modified *error* function to release global WSH object and improve      ;;
;;                       error handling.                                                         ;;
;;                    –  Fixed bug pertaining to collection of attributed block data.            ;;
;;———————————————————————————————–;;
;;  3.3:  18/06/2012  –  Fixed bug causing program to crash if the Object type is set to 'Text'  ;;
;;                       and Text Alignment is set to 'Left', then the Object type is switched   ;;
;;                       to 'MText'.                                                             ;;
;;                    –  Redesigned 'About' dialog to include appropriate bitmap images and      ;;
;;                       stylized program title.                                                 ;;
;;                    –  Added the ability to increment multiple sections of the incrementing    ;;
;;                       string.                                                                 ;;
;;                    –  Fixed bug in which the program would check for incorrect border         ;;
;;                       parameters when the Object type is set to 'Block'.                      ;;
;;                    –  Added the ability to create an array of incrementing Text, MText or     ;;
;;                       Block objects, with the selected object aligned or perpendicular to     ;;
;;                       the array, or with rotation set to an arbitrary angle.                  ;;
;;                    –  Included set of controls within the Formatting section of the dialog    ;;
;;                       to give the user the ability to control MText Background Mask offset    ;;
;;                       factor and colour.                                                      ;;
;;                    –  Added ability to specify the block scale as an arbitrary value, a       ;;
;;                       value picked from the drawing, or based on the value of a selected      ;;
;;                       System Variable.                                                        ;;
;;                    –  Provided the user the option to pick the Text Height value from the     ;;
;;                       drawing.                                                                ;;
;;                    –  Redesigned all object selection and pick buttons to conform with        ;;
;;                       standard AutoCAD dialog interfaces.                                     ;;
;;                    –  Added the ability to increment the string during placement by pressing  ;;
;;                       the I/i key.                                                            ;;
;;                    –  Text & MText Border Offset is now a factor of text height where an      ;;
;;                       offset factor of 1.0 exactly fits the Text or MText object, a factor    ;;
;;                       of 1.5 extends the border by 0.5 times the text height etc. This        ;;
;;                       emulates the behaviour of the MText Background Mask, to enable the      ;;
;;                       user to easily create a rectangular border around the background mask   ;;
;;                       by specifying the same offset factor for both. This to me seemed        ;;
;;                       more intuitive.                                                         ;;
;;———————————————————————————————–;;
;;  3.4:  16/03/2014  –  Error handler function rewritten to fix a bug causing modified          ;;
;;                       system variables to not be reset.                                       ;;
;;                    –  Error messages rewritten to provide user with additional detailed       ;;
;;                       diagnostic information.                                                 ;;
;;                    –  Removed locked layers from layer drop-down menus, as these will cause   ;;
;;                       the program to error.                                                   ;;
;;                    –  Altered loading message to correctly display copyright symbol.          ;;
;;                    –  The program configuration is now saved if user presses 'Esc' during     ;;
;;                       object placement.                                                       ;;
;;                    –  numinc:writeconfig & numinc:tostring functions rewritten.               ;;
;;                    –  numinc:gettextbox rewritten and numinc:createtextborder function        ;;
;;                       updated to fix border elevation bug.                                    ;;
;;———————————————————————————————–;;
(setq numincversion "3.4″)
;;———————————————————————————————–;;
(defun c:nu
    (
        /
        *error*
        _alignment
        _attachment
        _blocks
        _layers
        _scalevars
        _styles
        a
        acdoc
        acspc
        alignment
        arr-end
        arr-qty
        arr-qty#
        arr-rot
        arr-rot#
        arr-typ
        arr-typ-fun
        arr-use
        arr-use-fun
        att-nme
        attachment
        attrib
        attribs
        b
        blk-nme
        blk-scl
        blk-scl-fun
        blk-scl#
        block
        blocks
        bor
        bor-enc
        bor-enc-fun
        bor-lay
        bor-rot
        bor-shp
        bor-shp-fun
        bor-sid
        bor-sid#
        bor-typ
        bor-typ-fun
        cfgfname
        create-bor
        create-obj
        dclflag
        dclfname
        dclid
        deg
        dyn-flg
        elst
        ent
        file
        fix-ed1
        fix-ed1#
        fix-ed2
        fix-ed2#
        g1
        g2
        gr
        i
        inc-sec
        inc-str
        mid-str
        mode_color
        mode_image
        msg
        msk-col
        msk-off
        msk-off#
        msk-trn
        msk-trn-fun
        msk-use
        msk-use-fun
        mtx-bak
        nm
        obj
        obj-typ
        obj-typ-fun
        off-ed1
        off-ed1#
        p1
        p2
        pre-str
        prop
        pt
        r1
        savepath
        scalevars
        scl-pop
        scl-var
        ss
        string
        style
        suf-str
        symb
        symlist
        table
        tile
        tmp
        tog-cnt
        txt-aln
        txt-bst
        txt-lay
        txt-rot
        txt-sty
        txt-sty-fun
        txt-sze
        txt-sze#
        v1
        vallst
        varlst
        x
        xa
    )
    (defun *error* ( msg )
        (if
            (and
                (= 1 dclflag)
                (= 'str (type cfgfname))
                symlist
            )
            (numinc:writeconfig cfgfname (mapcar 'eval (mapcar 'car symlist)))
        )
        (if
            (and
                (= 'vla-object (type numinc:wshobject))
                (not (vlax-object-released-p numinc:wshobject))
            )
            (progn
                (vlax-release-object numinc:wshobject)
                (setq numinc:wshobject nil)
            )
        )
        (if (= "1″ dyn-flg)
            (foreach obj (list obj bor)
                (if (and (= 'vla-object (type obj))
                         (not (vlax-erased-p obj))
                         (vlax-write-enabled-p obj)
                    )
                    (vla-delete obj)
                )
            )
        )
        (mapcar 'setvar varlst vallst)
        (if (= 'file (type file))
            (close file)
        )
        (if (< 0 dclid)
            (unload_dialog dclid)
        )
        (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
            (princ (strcat "nNumInc Error: " msg))
        )
        (princ)
    )
    (setq varlst '(dimzin modemacro)
          vallst  (mapcar 'getvar varlst)
    )
    (cond
        (   (= 4 (logand 4 (cdr (assoc 70 (tblsearch "layer" (getvar 'clayer))))))
            (princ "nCurrent layer locked.")
        )
        (   (not (vl-file-directory-p (setq savepath (numinc:getsavepath))))
            (numinc:popup "Save Path Invalid" 16
                (princ
                    (strcat
                        "The following path does not exist or is invalid:nn"
                        savepath
                    )
                )
            )
        )
        (   (progn
                (setq dclfname (strcat savepath "\LMAC_NumInc_V" (vl-string-translate "." "-" numincversion) ".dcl")
                      cfgfname (strcat savepath "\LMAC_NumInc_V" (vl-string-translate "." "-" numincversion) ".cfg")
                )
                (not (numinc:writedcl dclfname))
            )
            (numinc:popup "DCL File could not be Written" 16
                (princ
                    (strcat
                        "The DCL file required by this application was unable to be written to the following location:nn"
                        dclfname
                        "nnPlease ensure that you have write permissions for this directory."
                    )
                )
            )
        )
        (   (<= (setq dclID (load_dialog dclfname)) 0)
            (numinc:popup "DCL File could not be Loaded" 16
                (princ
                    (strcat
                        "The following DCL file could not be loaded:nn"
                        dclfname
                        "nnPlease check the integrity of this file."
                    )
                )
            )
        )
        (   t
            (setq symlist
                (list
                    (cons 'arr-use "0″)
                    (cons 'arr-qty "5″)
                    (cons 'arr-typ "arr-aln")
                    (cons 'arr-rot "0.0″)
                    (cons 'arr-end nil)
                    (cons 'crv-per (/ pi 2.0))
                    (cons 'crv-off 0.0)
                    (cons 'txt-rot 0.0)
                    (cons 'bor-rot nil)
                    (cons 'tog-cnt t)
                    (cons 'dyn-flg "1″)
                    (cons 'pre-str  "")
                    (cons 'mid-str "1″)
                    (cons 'suf-str  "")
                    (cons 'inc-str "1″)
                    (cons 'inc-sec 2)
                    (cons 'obj-typ "obj-txt")
                    (cons 'blk-nme "")
                    (cons 'att-nme "")
                    (cons 'blk-scl "1.0″)
                    (cons 'scl-var "0″)
                    (cons 'scl-pop "DIMSCALE")
                    (cons 'bor-enc "0″)
                    (cons 'bor-shp "0″)
                    (cons 'bor-sid "6″)
                    (cons 'bor-lay (getvar 'clayer))
                    (cons 'bor-typ "bor-off")
                    (cons 'off-ed1 "1.0″)
                    (cons 'fix-ed1 "1.0″)
                    (cons 'fix-ed2 "1.0″)
                    (cons 'txt-lay (getvar 'clayer))
                    (cons 'txt-sty (getvar 'textstyle))
                    (cons 'txt-aln "Middle-Center")
                    (cons 'txt-bst "1″)
                    (cons 'txt-sze
                        (rtos
                            (if
                                (zerop
                                    (cdr
                                        (assoc 40
                                            (setq style
                                                (tblsearch "style" (getvar 'textstyle))
                                            )
                                        )
                                    )
                                )
                                (cdr (assoc 42 style))
                                (cdr (assoc 40 style))
                            )
                        )
                    )
                    (cons 'msk-use "0″)
                    (cons 'msk-off "1.5″)
                    (cons 'msk-trn "0″)
                    (cons 'msk-col '((62 . 1)))
                )
            )
            (if (null (findfile cfgfname))
                (numinc:writeconfig cfgfname (mapcar 'cdr symlist))
            )
            (numinc:readconfig cfgfname (mapcar 'car symlist))
            (foreach x SymList
                (if (null (boundp (car x)))
                    (set (car x) (cdr x))
                )
            )
            (setq _layers (numinc:gettableitems "layer")
                  _styles (numinc:gettableitems "style")
                  _blocks (numinc:getblockdata)
            )
            (setq Alignment
                (list
                    (cons "Left"          acAlignmentLeft)
                    (cons "Center"        acAlignmentCenter)
                    (cons "Right"         acAlignmentRight)
                    (cons "Middle"        acAlignmentMiddle)
                    (cons "Top-Left"      acAlignmentTopLeft)
                    (cons "Top-Center"    acAlignmentTopCenter)
                    (cons "Top-Right"     acAlignmentTopRight)
                    (cons "Middle-Left"   acAlignmentMiddleLeft)
                    (cons "Middle-Center" acAlignmentMiddleCenter)
                    (cons "Middle-Right"  acAlignmentMiddleRight)
                    (cons "Bottom-Left"   acAlignmentBottomLeft)
                    (cons "Bottom-Center" acAlignmentBottomCenter)
                    (cons "Bottom-Right"  acAlignmentBottomRight)
                )
            )
            (setq Attachment
                (list
                    (cons "Top-Left"      acAttachmentPointTopLeft)
                    (cons "Top-Center"    acAttachmentPointTopCenter)
                    (cons "Top-Right"     acAttachmentPointTopRight)
                    (cons "Middle-Left"   acAttachmentPointMiddleLeft)
                    (cons "Middle-Center" acAttachmentPointMiddleCenter)
                    (cons "Middle-Right"  acAttachmentPointMiddleRight)
                    (cons "Bottom-Left"   acAttachmentPointBottomLeft)
                    (cons "Bottom-Center" acAttachmentPointBottomCenter)
                    (cons "Bottom-Right"  acAttachmentPointBottomRight)
                )
            )
            (setq _Alignment  (mapcar 'car Alignment))
            (setq _Attachment (mapcar 'car Attachment))
            (setq ScaleVars
                (vl-remove-if 'null
                    (mapcar
                        (function
                            (lambda ( var / value )
                                (if
                                    (and
                                        (setq value (getvar var))
                                        (< 0.0 value)
                                    )
                                    (if (= "CANNOSCALEVALUE" (strcase var))
                                        (cons var (rtos (/ 1.0 value)))
                                        (cons var (rtos value))
                                    )
                                )
                            )
                        )
                        (acad_strlsort
                           '(
                                "CANNOSCALEVALUE"
                                "CELTSCALE"
                                "DIMLFAC"
                                "DIMSCALE"
                                "DIMTFAC"
                                "DIMTXT"
                                "HPSCALE"
                                "LTSCALE"
                                "MLEADERSCALE"
                                "MSOLESCALE"
                                "TEXTSIZE"
                            )
                        )
                    )
                )
            )
            (setq _ScaleVars (mapcar 'car ScaleVars))
            (
                (lambda ( / i j x y )
                    (repeat (setq i 20)
                        (setq j 1)
                        (repeat 20
                            (setq x (cons j x)
                                  y (cons i y)
                                  j (1+ j)
                            )
                        )
                        (setq i (1- i))
                    )
                    (setq mode_image
                        (eval
                            (list 'lambda '( key mode )
                                (list 'cond
                                   '(   (= 1 mode)
                                        (start_image key)
                                        (fill_image 0 0 (dimx_tile key) (dimy_tile key) -15)
                                        (end_image)
                                        (mode_tile key mode)
                                    )
                                    (list 't
                                       '(start_image key)
                                       '(fill_image 0 0 (dimx_tile key) (dimy_tile key) -15)
                                        (list 'mapcar "vector_image (list 'quote x) (list 'quote y) (list 'quote x) (list 'quote y)
                                           '(cond
                                                (   (member key '("scl-pik" "arr-pik" "txt-pik" "msk-pik"))
                                                   '(
                                                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 095 096 096 096 096 096 096 096 096 095 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 096 254 254 254 254 254 254 254 254 096 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 096 063 063 -15 063 063 063 063 063 096 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 096 063 -15 250 -15 063 063 063 063 096 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 096 -15 250 250 -15 063 063 063 063 096 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 254 250 -15 250 -15 063 063 063 063 096 -15 -15 -15 -15
                                                        254 254 254 254 254 254 250 -15 -15 250 -15 063 063 063 063 096 254 254 254 254
                                                        254 254 254 254 254 250 -15 -15 -15 250 -15 063 063 063 063 096 254 254 254 254
                                                        254 254 254 254 250 -15 -15 -15 -15 250 -15 063 063 063 063 096 254 254 254 254
                                                        254 254 254 250 250 250 -15 -15 -15 250 -15 063 063 063 063 096 254 254 254 254
                                                        254 254 254 254 254 250 -15 250 -15 250 -15 063 063 063 063 096 254 254 254 254
                                                        254 254 254 254 254 250 -15 250 250 250 -15 063 063 063 063 096 254 254 254 254
                                                        254 254 254 254 250 -15 250 254 254 250 254 096 096 096 096 095 254 254 254 254
                                                        254 254 254 254 250 -15 250 254 254 254 254 254 254 254 254 254 254 254 254 254
                                                        254 254 254 254 254 250 254 254 254 254 254 254 254 254 254 254 254 254 254 254
                                                        254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254
                                                        -15 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 -15
                                                    )
                                                )
                                                (
                                                   '(
                                                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 -15 095 096 096 096 096 096 095 -15 -15 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 -15 096 063 063 063 063 063 096 -15 -15 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 -15 096 254 254 063 063 063 096 -15 -15 -15 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 -15 253 250 254 063 063 063 096 254 008 254 -15 -15 -15
                                                        -15 -15 -15 -15 -15 -15 -15 250 250 254 063 063 063 096 -15 252 251 254 -15 -15
                                                        -15 -15 -15 -15 -15 -15 250 -15 250 254 063 063 063 096 -15 254 252 008 -15 -15
                                                        254 254 254 254 254 250 -15 -15 250 253 096 096 096 095 -15 254 254 149 254 254
                                                        254 254 254 254 250 -15 -15 -15 250 -15 254 -15 -15 -15 -15 254 254 149 254 254
                                                        254 254 254 250 -15 -15 -15 -15 250 -15 008 253 -15 -15 -15 -15 253 008 254 254
                                                        254 254 250 250 250 -15 -15 -15 250 254 254 251 253 -15 -15 253 251 254 254 254
                                                        254 254 254 254 250 -15 250 -15 250 254 254 254 008 149 149 008 254 254 254 254
                                                        254 254 254 254 250 -15 250 250 250 254 254 254 254 254 254 254 254 254 254 254
                                                        254 254 254 250 -15 250 254 254 250 254 254 254 254 254 254 254 254 254 254 254
                                                        254 254 254 250 -15 250 254 254 254 254 254 254 254 254 254 254 254 254 254 254
                                                        254 254 254 254 250 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254
                                                        254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254
                                                        -15 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 -15
                                                    )
                                                )
                                            )
                                        )
                                       '(end_image)
                                       '(mode_tile key mode)
                                    )
                                )
                               'mode
                            )
                        )
                    )
                )
            )
            (setq mode_color
                (lambda ( key col )
                    (start_image key)
                    (fill_image 0 0 (dimx_tile key) (dimy_tile key) col)
                    (end_image)
                    (if
                        (or
                            (=   0 col)
                            (= -15 col)
                        )
                        (mode_tile key 1)
                        (mode_tile key 0)
                    )
                )
            )
            
            (while (not (member dclflag '(1 0)))
                (cond
                    (   (not (new_dialog "numinc" dclID))
                        (numinc:popup "NumInc Dialog could not be Loaded" 16
                            (princ
                                (strcat
                                    "The Incremental Numbering Suite dialog could not be loaded. "
                                    "The DCL file required by the application resides in the following location:nn"
                                    dclfname
                                    "nnPlease check the integrity of this file."
                                )
                            )
                        )
                    )
                    (   (eval (read (vl-list->string '(40 110 117 109 105 110 99 58 109 105 115 99 41))))
                        
                        ;;———————————————————————————————–;;
                        ;;                                        Top of Dialog                                          ;;
                        ;;———————————————————————————————–;;
                     
                        (set_tile "dyn-flg" dyn-flg)
                        (action_tile "dyn-flg" "(setq dyn-flg $value)")
                        ;;———————————————————————————————–;;
                        ;;                                  Top-Left Increment Format Panel                              ;;
                        ;;———————————————————————————————–;;
                        (foreach symb '(pre-str mid-str suf-str inc-str)
                            (setq tile (strcase (vl-symbol-name symb) t))
                            (set_tile tile (eval symb))
                            (action_tile tile (strcat "(setq " tile " $value)"))
                        )
                        (
                            (lambda ( / bit )
                                (setq bit 1)
                                (foreach tile '("inc-pre" "inc-mid" "inc-suf")
                                    (if (= bit (logand bit inc-sec))
                                        (set_tile tile "1″)
                                    )
                                    (action_tile tile (strcat "(setq inc-sec (boole (if (eq "1" $value) 7 4) " (itoa bit) " inc-sec))"))
                                    (setq bit (lsh bit 1))
                                )
                            )
                        )
                     
                        ;;———————————————————————————————–;;
                        ;;                                     Right Formatting Panel                                    ;;
                        ;;———————————————————————————————–;;
                     
                        (numinc:makelist "txt-lay" _layers)
                     
                        (set_tile "txt-lay"
                            (itoa
                                (cond
                                    (   (vl-position txt-lay _layers))
                                    (   (vl-position (setq txt-lay (getvar 'clayer)) _layers))
                                )
                            )
                        )
                        (action_tile "txt-lay" "(setq txt-lay (nth (atoi $value) _layers))")
                        ;;———————————————————————————————–;;
                        (numinc:MakeList "txt-sty" _styles)
                     
                        (set_tile "txt-sty"
                            (itoa
                                (cond
                                    (   (vl-position txt-sty _styles))
                                    (   (vl-position (setq txt-sty (getvar 'textstyle)) _styles))
                                )
                            )
                        )
                        (
                            (setq txt-sty-fun
                                (lambda ( style / tmp )
                                    (if (zerop (setq tmp (cdr (assoc 40 (tblsearch "style" style)))))
                                        (progn
                                            (set_tile  "txt-bst" (setq txt-bst "0″))
                                            (mode_tile "txt-bst"   1)
                                            (mode_tile "txt-sze"   0)
                                        )
                                        (progn
                                            (mode_tile "txt-bst" 0)
                                            (if (= "1″ txt-bst)
                                                (set_tile "txt-sze" (setq txt-sze (rtos tmp)))
                                            )
                                        )
                                    )
                                )
                            )
                            txt-sty
                        )
                        (action_tile "txt-sty" "(txt-sty-fun (setq txt-sty (nth (atoi $value) _styles)))")
                     
                        ;;———————————————————————————————–;;
                     
                        (numinc:MakeList "txt-aln" (if (= "obj-mtx" obj-typ) _Attachment _Alignment))
                        (set_tile "txt-aln"
                            (itoa
                                (cond
                                    (   (vl-position txt-aln (if (= "obj-mtx" obj-typ) _Attachment _Alignment))
                                    )
                                    (   (setq txt-aln
                                            (car
                                                (if (= "obj-mtx" obj-typ)
                                                    _Attachment
                                                    _Alignment
                                                )
                                            )
                                        )
                                        0
                                    )
                                )
                            )
                        )
                        (action_tile "txt-aln"
                            (vl-prin1-to-string
                                (quote
                                    (setq txt-aln
                                        (nth (atoi $value)
                                            (if (= "obj-mtx" obj-typ)
                                                _Attachment
                                                _Alignment
                                            )
                                        )
                                    )
                                )
                            )
                        )
                        ;;———————————————————————————————–;;
                        (set_tile    "txt-sze" txt-sze)
                        (action_tile "txt-sze" "(setq txt-sze $value)")
                        (if (= "1″ txt-bst)
                            (if (zerop (setq tmp (cdr (assoc 40 (tblsearch "style" txt-sty)))))
                                (progn
                                    (set_tile  "txt-bst" (setq txt-bst "0″))
                                    (mode_tile "txt-bst" 1)
                                )
                                (progn
                                    (set_tile "txt-bst" txt-bst)
                                    (set_tile "txt-sze" (setq txt-sze (rtos tmp)))
                                )
                            )
                        )
                        (mode_tile  "txt-sze" (atoi txt-bst))
                        (mode_image "txt-pik" (atoi txt-bst))
                     
                        (action_tile "txt-bst"
                            (vl-prin1-to-string
                                (quote
                                    (progn
                                        (mode_tile  "txt-sze" (atoi (setq txt-bst $value)))
                                        (mode_image "txt-pik" (atoi txt-bst))
                                        (if (= "1″ $value)
                                            (set_tile "txt-sze" (rtos (cdr (assoc 40 (tblsearch "style" txt-sty)))))
                                        )
                                    )
                                )
                            )
                        )
                        (action_tile "txt-pik" "(done_dialog 4)")
                        ;;———————————————————————————————–;;
                        (set_tile "msk-trn" msk-trn)
                        (
                            (setq msk-trn-fun
                                (lambda ( value )
                                    (if (= "1″ value)
                                        (mode_color "msk-col" 0)
                                        (mode_color "msk-col" (cdr (assoc 62 msk-col)))
                                    )
                                )
                            )
                            msk-trn
                        )
                        (action_tile "msk-trn" "(msk-trn-fun (setq msk-trn $value))")
                        (action_tile "msk-col"
                            (vl-prin1-to-string
                               '(
                                    (lambda ( / tmp )
                                        (if
                                            (setq tmp
                                                (acad_truecolordlg
                                                    (vl-some
                                                        (function
                                                            (lambda ( x ) (assoc x msk-col))
                                                        )
                                                       '(430 420 62)
                                                    )
                                                    nil
                                                )
                                            )
                                            (mode_color "msk-col" (cdr (assoc 62 (setq msk-col tmp))))
                                        )
                                    )
                                )
                            )
                        )
                        ;;———————————————————————————————–;;
                        (set_tile "msk-off" msk-off)
                        (action_tile "msk-off" "(setq msk-off $value)")
                        (action_tile "msk-pik" "(done_dialog 7)")
                        ;;———————————————————————————————–;;
                        (set_tile "msk-use" msk-use)
                        (
                            (setq msk-use-fun
                                (lambda ( value )
                                    (if (= "1″ value)
                                        (progn
                                            (mode_tile  "msk-off" 0)
                                            (mode_image "msk-pik" 0)
                                            (mode_tile  "msk-trn" 0)
                                            (msk-trn-fun msk-trn)
                                        )
                                        (progn
                                            (mode_tile  "msk-off" 1)
                                            (mode_image "msk-pik" 1)
                                            (mode_tile  "msk-trn" 1)
                                            (mode_color "msk-col" -15)
                                        )
                                    )      
                                )
                            )
                            msk-use
                        )
                        (action_tile "msk-use" "(msk-use-fun (setq msk-use $value))")
                        ;;———————————————————————————————–;;
                        ;;                                   Bottom-Left Border Panel                                    ;;
                        ;;———————————————————————————————–;;
                        (set_tile "bor-enc" bor-enc)
                        (
                            (setq bor-enc-fun
                                (lambda ( value )
                                    (if (= "1″ value)
                                        (progn
                                            (mode_tile "bor-shp" 0)
                                            (if (= "3″ bor-shp) (mode_tile "bor-sid" 0))
                                            (mode_tile "bor-lay" 0)
                                            (mode_tile "bor-off" 0)
                                            (mode_tile "bor-fix" 0)
                                            (mode_tile "bor-pik" 0)
                                            (mode_tile "bor-ltx" 0)
                                            (if (= "bor-off" bor-typ)
                                                (progn
                                                    (mode_tile "off-ed1″ 0)
                                                    (mode_tile "fix-ed1″ 1)
                                                    (mode_tile "fix-txt" 1)
                                                    (mode_tile "fix-ed2″ 1)
                                                )
                                                (progn
                                                    (mode_tile "off-ed1″ 1)
                                                    (mode_tile "fix-ed1″ 0)
                                                    (if (member bor-shp '("1″ "2″))
                                                        (progn
                                                            (mode_tile "fix-txt" 0)
                                                            (mode_tile "fix-ed2″ 0)
                                                        )
                                                        (progn
                                                            (mode_tile "fix-txt" 1)
                                                            (mode_tile "fix-ed2″ 1)
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                        (foreach tile
                                           '(
                                                "bor-shp" "bor-sid" "bor-lay"
                                                "bor-off" "bor-fix" "off-ed1″
                                                "fix-ed1″ "fix-ed2″ "bor-pik"
                                                "fix-txt" "bor-ltx"
                                            )
                                            (mode_tile tile 1)
                                        )
                                    )
                                )
                            )
                            bor-enc
                        )
                        (action_tile "bor-enc" "(bor-enc-fun (setq bor-enc $value))")
                        ;;———————————————————————————————–;;
                        (numinc:makelist "bor-shp" '("Circle" "Rectangle" "Slot" "Polygon"))
                        (set_tile "bor-shp" bor-shp)
                        (
                            (setq bor-shp-fun
                                (lambda ( value )
                                    (if (= "bor-fix" bor-typ)
                                        (mapcar 'mode_tile '("bor-sid" "fix-txt" "fix-ed2″)
                                            (cond
                                                (   (= value "0″)
                                                   '(1 1 1)
                                                )
                                                (   (member value '("1″ "2″))
                                                   '(1 0 0)
                                                )
                                                (  '(0 1 1)
                                                )
                                            )
                                        )
                                        (mapcar 'mode_tile '("bor-sid" "fix-txt" "fix-ed2″)
                                            (cond
                                                (   (member value '("0″ "1″ "2″))
                                                   '(1 1 1)
                                                )
                                                (  '(0 1 1)
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                            bor-shp
                        )
                        (action_tile "bor-shp" "(bor-shp-fun (setq bor-shp $value))")
                        ;;———————————————————————————————–;;
                        (set_tile "bor-sid" bor-sid)
                        (action_tile "bor-sid" "(setq bor-sid $value)")
                        ;;———————————————————————————————–;;
                        (numinc:makelist "bor-lay" _layers)
                     
                        (set_tile "bor-lay"
                            (itoa
                                (cond
                                    (   (vl-position bor-lay _layers))
                                    (   (vl-position (setq bor-lay (getvar 'clayer)) _layers))
                                )
                            )
                        )
                        (action_tile "bor-lay" "(setq bor-lay (nth (atoi $value) _layers))")
                        ;;———————————————————————————————–;;
                        (set_tile bor-typ "1″)
                        (
                            (setq bor-typ-fun
                                (lambda ( typ )
                                    (if (= "1″ bor-enc)
                                        (if (= "bor-off" typ)
                                            (mapcar 'mode_tile '("off-ed1″ "fix-ed1″ "fix-ed2″ "fix-txt") '(0 1 1 1))
                                            (progn
                                                (mode_tile "off-ed1″ 1)
                                                (mode_tile "fix-ed1″ 0)
                                                (if (member bor-shp '("1″ "2″))
                                                    (progn
                                                        (mode_tile "fix-ed2″ 0)
                                                        (mode_tile "fix-txt" 0)
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                            bor-typ
                        )
                        (action_tile "bor-off" "(bor-typ-fun (setq bor-typ $key))")
                        (action_tile "bor-fix" "(bor-typ-fun (setq bor-typ $key))")
                        ;;———————————————————————————————–;;
                        (foreach symb '(off-ed1 fix-ed1 fix-ed2)
                            (setq tile (strcase (vl-symbol-name symb) t))
                            (set_tile tile (eval symb))
                            (action_tile tile (strcat "(setq " tile " $value)"))
                        )
                        (action_tile "bor-pik" "(done_dialog 3)")
                        ;;———————————————————————————————–;;
                        ;;                                    Bottom-Middle Array Panel                                  ;;
                        ;;———————————————————————————————–;;
                     
                        (set_tile "arr-use" arr-use)
                        (
                            (setq arr-use-fun
                                (lambda ( value )
                                    (if (= "1″ value)
                                        (progn
                                            (foreach tile
                                               '(
                                                    "arr-qty"
                                                    "arr-aln"
                                                    "arr-per"
                                                    "arr-oth"
                                                )
                                                (mode_tile tile 0)
                                            )
                                            (if (= "arr-oth" arr-typ)
                                                (progn
                                                    (mode_tile  "arr-rot" 0)
                                                    (mode_image "arr-pik" 0)
                                                )
                                                (progn
                                                    (mode_tile  "arr-rot" 1)
                                                    (mode_image "arr-pik" 1)
                                                )
                                            )
                                        )
                                        (progn
                                            (foreach tile
                                               '(
                                                    "arr-qty"
                                                    "arr-aln"
                                                    "arr-per"
                                                    "arr-oth"
                                                    "arr-rot"
                                                )
                                                (mode_tile tile 1)
                                            )
                                            (mode_image "arr-pik" 1)
                                        )
                                    )
                                )
                            )
                            arr-use
                        )
                        (action_tile "arr-use" "(arr-use-fun (setq arr-use $value))")
                        ;;———————————————————————————————–;;
                     
                        (set_tile "arr-qty" arr-qty)
                        (action_tile "arr-qty" "(setq arr-qty $value)")
                        ;;———————————————————————————————–;;
                        (set_tile arr-typ "1″)
                        (
                            (setq arr-typ-fun
                                (lambda ( typ )
                                    (foreach tile '("arr-aln" "arr-per" "arr-oth")
                                        (if (/= typ tile)
                                            (set_tile tile "0″)
                                        )
                                    )
                                    (if (= "arr-oth" arr-typ)
                                        (progn
                                            (mode_tile  "arr-rot" 0)
                                            (mode_image "arr-pik" 0)
                                        )
                                        (progn
                                            (mode_tile  "arr-rot" 1)
                                            (mode_image "arr-pik" 1)
                                        )
                                    )
                                )
                            )
                            arr-typ
                        )
                     
                        (foreach tile
                           '(
                                "arr-aln"
                                "arr-per"
                                "arr-oth"
                            )
                            (action_tile tile "(arr-typ-fun (setq arr-typ $key))")
                        )
                        ;;———————————————————————————————–;;
                        (set_tile "arr-rot" arr-rot)
                        (action_tile "arr-rot" "(setq arr-rot $value)")
                        ;;———————————————————————————————–;;
                        (action_tile "arr-pik" "(done_dialog 5)")
                        ;;———————————————————————————————–;;
                        ;;                                     Block Scale Section                                       ;;
                        ;;———————————————————————————————–;;
                        (set_tile "blk-scl" blk-scl)
                        (action_tile "blk-scl" "(setq blk-scl $value)")
                        (numinc:makelist "scl-pop" _ScaleVars)
                        (set_tile "scl-pop"
                            (itoa
                                (cond
                                    (   (vl-position scl-pop _ScaleVars)
                                    )
                                    (   (setq scl-pop (car _ScaleVars))
                                        0
                                    )
                                )
                            )
                        )                                            
                        (
                            (setq blk-scl-fun
                                (lambda ( value )
                                    (if (= "1″ value)
                                        (progn
                                            (mode_tile  "blk-scl" 1)
                                            (mode_tile  "scl-pop" 0)
                                            (mode_image "scl-pik" 1)
                                            (set_tile "blk-scl" (setq blk-scl (cdr (assoc scl-pop ScaleVars))))
                                        )
                                        (progn
                                            (mode_tile  "blk-scl" 0)
                                            (mode_tile  "scl-pop" 1)
                                            (mode_image "scl-pik" 0)
                                        )
                                    )
                                )
                            )
                            scl-var
                        )
                        (action_tile "scl-var" "(blk-scl-fun (setq scl-var $value))")
                        (action_tile "scl-pop"
                            (vl-prin1-to-string
                               '(set_tile "blk-scl"
                                    (setq blk-scl
                                        (cdr
                                            (assoc
                                                (setq scl-pop (nth (atoi $value) _ScaleVars))
                                                ScaleVars
                                            )
                                        )
                                    ) 
                                )
                            )
                        )
                        (action_tile "scl-pik" "(done_dialog 6)")
                        ;;———————————————————————————————–;;
                        ;;                                  Top-Center Object Type Panel                                 ;;
                        ;;———————————————————————————————–;;
                        (if (and (= "obj-blk" obj-typ) (null _blocks))
                            (setq obj-typ "obj-txt")
                        )
                        (set_tile obj-typ "1″)
                     
                        (
                            (setq obj-typ-fun
                                (lambda ( typ )
                                    (if (= typ "obj-blk")
                                        (progn
                                            (set_tile "lay-txt" "Block Layer: ")
                                            (foreach pair
                                               '(
                                                    ("blk-nme" 0)
                                                    ("blk-txt" 0)
                                                    ;("blk-pik" 0) image tile
                                                    ("att-txt" 0)
                                                    ("att-nme" 0)
                                                    ;("blk-scl" 0) set by blk-scl-fun
                                                    ;("scl-pik" 0) image tile
                                                    ("scl-var" 0)
                                                    ;("scl-pop" 0) set by blk-scl-fun
                                                    ("sty-txt" 1)
                                                    ("txt-sty" 1)
                                                    ("aln-txt" 1)
                                                    ("txt-aln" 1)
                                                    ("txt-bst" 1)
                                                    ("txt-sze" 1)
                                                    ("bor-enc" 1)
                                                    ("bor-shp" 1)
                                                    ("bor-sid" 1)
                                                    ("bor-ltx" 1)
                                                    ("bor-lay" 1)
                                                    ("bor-off" 1)
                                                    ("bor-fix" 1)
                                                    ("off-ed1″ 1)
                                                    ("fix-ed1″ 1)
                                                    ("fix-ed2″ 1)
                                                    ("bor-pik" 1)
                                                    ("msk-use" 1)
                                                    ("msk-off" 1)
                                                    ;("msk-pik" 1) image tile
                                                    ("msk-trn" 1)
                                                    ;("msk-col" 1) color tile
                                                )
                                                (apply 'mode_tile pair)
                                            )
                                            (mode_image "blk-pik" 0)
                                            (mode_image "msk-pik" 1)
                                            (mode_color "msk-col" -15)
                                            ;(mode_image "scl-pik" 0)
                                            (blk-scl-fun scl-var)
                                        )
                                        (progn
                                            (set_tile "lay-txt" "Text Layer: ")
                                            (foreach pair
                                               '(
                                                    ("blk-txt" 1)
                                                    ("blk-nme" 1)
                                                    ;("blk-pik" 1) image tile
                                                    ("att-txt" 1)
                                                    ("att-nme" 1)
                                                    ("blk-scl" 1)
                                                    ;("scl-pik" 1) image tile
                                                    ("scl-var" 1)
                                                    ("scl-pop" 1)
                                                    ("sty-txt" 0)
                                                    ("txt-sty" 0)
                                                    ("aln-txt" 0)
                                                    ("txt-aln" 0)
                                                    ("bor-enc" 0)
                                                )
                                                (apply 'mode_tile pair)
                                            )
                                            (mode_image "blk-pik" 1)
                                            (mode_image "scl-pik" 1)
                                            (bor-enc-fun bor-enc)
                                            (txt-sty-fun txt-sty)
                                            (numinc:makelist "txt-aln" (if (= "obj-mtx" obj-typ) _Attachment _Alignment))
                                            (set_tile "txt-aln"
                                                (itoa
                                                    (cond
                                                        (   (vl-position txt-aln (if (= "obj-mtx" obj-typ) _Attachment _Alignment))
                                                        )
                                                        (   (setq txt-aln
                                                                (car
                                                                    (if (= "obj-mtx" obj-typ)
                                                                        _Attachment
                                                                        _Alignment
                                                                    )
                                                                )
                                                            )
                                                            0
                                                        )
                                                    )
                                                )
                                            )
                                            (if (= "obj-mtx" typ)
                                                (progn
                                                    (mode_tile "msk-use" 0)
                                                    (msk-use-fun msk-use)
                                                )
                                                (progn
                                                    (msk-use-fun "0″)
                                                    (mode_tile "msk-use" 1)
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                            obj-typ
                        )
                        (foreach tile
                           '(
                                "obj-txt"
                                "obj-mtx"
                                "obj-blk"
                            )
                            (action_tile tile "(obj-typ-fun (setq obj-typ $key))")
                        )
                     
                        (if _blocks
                            (progn
                                (numinc:makelist "blk-nme" (setq blocks (mapcar 'car _blocks)))
                                (set_tile "blk-nme"
                                    (setq block
                                        (itoa
                                            (cond
                                                (   (vl-position blk-nme blocks))
                                                (   (setq blk-nme (car blocks))
                                                    0
                                                )
                                            )
                                        )
                                    )
                                )
                                (numinc:makelist "att-nme" (setq attribs (cdr (nth (atoi block) _blocks))))
                                (set_tile "att-nme"
                                    (setq attrib
                                        (itoa
                                            (cond
                                                (   (vl-position att-nme attribs))
                                                (   (setq att-nme (car attribs))
                                                    0
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                            (mode_tile "obj-blk" 1)
                        )
                        (action_tile "blk-nme"
                            (vl-prin1-to-string
                                (quote
                                    (progn
                                        (setq blk-itm (nth (atoi (setq block $value)) _blocks)
                                              blk-nme (car blk-itm)
                                        )
                                        (numinc:makelist "att-nme" (setq attribs (cdr blk-itm)))
                                        (set_tile "att-nme"
                                            (setq attrib
                                                (itoa
                                                    (cond
                                                        (   (vl-position att-nme attribs))
                                                        (   (setq att-nme (car attribs))
                                                            0
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                        (action_tile "blk-pik" "(done_dialog 2)")
                        (action_tile "att-nme" "(setq attrib $value att-nme (nth (atoi $value) attribs))")
                        ;;———————————————————————————————–;;
                        ;;                                        Base of Dialog                                         ;;
                        ;;———————————————————————————————–;;
                        (action_tile "about" "(numinc:about dclid)")
                        (action_tile "accept"
                            (vl-prin1-to-string
                                (quote
                                    (progn
                                        (if (= "" inc-str)
                                            (setq inc-str "0″)
                                        )
                                        (if (= "" txt-sze)
                                            (setq txt-sze (rtos (getvar 'textsize)))
                                        )
                                        (cond
                                            (   (and
                                                    (/= "obj-blk" obj-typ)
                                                    (= "1″ bor-enc)
                                                    (= "bor-off" bor-typ)
                                                    (not (setq off-ed1# (distof off-ed1)))
                                                )
                                                (numinc:popup "Information" 48 "Border Offset must be numerical.")
                                                (mode_tile "off-ed1″ 2)
                                            )
                                            (   (and
                                                    (/= "obj-blk" obj-typ)
                                                    (= "1″ bor-enc)
                                                    (= "bor-off" bor-typ)
                                                    (< off-ed1# 1.0)
                                                )
                                                (numinc:popup "Information" 48 "Border Offset Factor must be greater than or equal to one.")
                                                (mode_tile "off-ed1″ 2)
                                            )
                                            (   (and
                                                    (/= "obj-blk" obj-typ)
                                                    (= "1″ bor-enc)
                                                    (= "bor-fix" bor-typ)
                                                    (or (not (setq fix-ed1# (distof fix-ed1)))
                                                        (and
                                                            (member bor-shp '("1″ "2″))
                                                            (not (setq fix-ed2# (distof fix-ed2)))
                                                        )
                                                    )
                                                )
                                                (numinc:popup "Information" 48 "Border Size must be numerical.")
                                                (mode_tile "fix-ed1″ 2)
                                            )
                                            (   (and
                                                    (/= "obj-blk" obj-typ)
                                                    (= "1″ bor-enc)
                                                    (= "bor-fix" bor-typ)
                                                    (or (<= fix-ed1# 0.0)
                                                        (and
                                                            (member bor-shp '("1″ "2″))
                                                            (<= fix-ed2# 0.0)
                                                        )
                                                    )
                                                )
                                                (numinc:popup "Information" 48 "Border Size must be greater than zero.")
                                                (mode_tile "fix-ed1″ 2)
                                            )
                                            (   (and
                                                    (= "1″ arr-use)
                                                    (< (setq arr-qty# (atoi arr-qty)) 1)
                                                )
                                                (numinc:popup "Information" 48 "Number of Items in Array must be greater than or equal to one.")
                                                (mode_tile "arr-qty" 2)
                                            )
                                            (   (and
                                                    (= "1″ arr-use)
                                                    (= "arr-oth" arr-typ)
                                                    (not (setq arr-rot# (angtof arr-rot)))
                                                )
                                                (numinc:popup "Information" 48 "Array Object Rotation must be numerical.")
                                                (mode_tile "arr-rot" 2)
                                            )
                                            (   (and
                                                    (= "obj-mtx" obj-typ)
                                                    (= "1″ msk-use)
                                                    (not (setq msk-off# (distof msk-off)))
                                                )
                                                (numinc:popup "Information" 48 "Background Mask Offset Factor must be numerical.")
                                                (mode_tile "msk-off" 2)
                                            )
                                            (   (and
                                                    (= "obj-mtx" obj-typ)
                                                    (= "1″ msk-use)
                                                    (or (< 5.0 msk-off#)
                                                        (< msk-off# 1.0)
                                                    )
                                                )
                                                (numinc:popup "Information" 48 "Background Mask Offset Factor must be between 1 and 5.")
                                                (mode_tile "msk-off" 2)
                                            )
                                            (   (and
                                                    (= "obj-blk" obj-typ)
                                                    (not (setq blk-scl# (distof blk-scl)))
                                                )
                                                (numinc:popup "Information" 48 "Block Scale must be numerical.")
                                                (mode_tile "blk-scl" 2)
                                            )
                                            (   (and
                                                    (= "obj-blk" obj-typ)
                                                    (<= blk-scl# 0.0)
                                                )
                                                (numinc:popup "Information" 48 "Block Scale must be greater than zero.")
                                                (mode_tile "blk-scl" 2)
                                            )
                                            (   (not (distof inc-str 2))
                                                (numinc:popup "Information" 48 "Increment must be numerical.")
                                                (mode_tile "inc-str" 2)
                                            )
                                            (   (and
                                                    (/= "obj-blk" obj-typ)
                                                    (not (setq txt-sze# (distof txt-sze)))
                                                )
                                                (numinc:popup "Information" 48 "Text Height must be numerical.")
                                                (if (= "0″ txt-bst)
                                                    (mode_tile "txt-sze" 2)
                                                )
                                            )
                                            (   (and
                                                    (/= "obj-blk" obj-typ)
                                                    (<= txt-sze# 0.0)
                                                )
                                                (numinc:Popup "Information" 48 "Text Height must be greater than zero.")
                                                (if (= "0″ txt-bst)
                                                    (mode_tile "txt-sze" 2)
                                                )
                                            )
                                            (   (and
                                                    (/= "obj-blk" obj-typ)
                                                    (= "1″ bor-enc)
                                                    (= "3″ bor-shp)
                                                    (< (setq bor-sid# (atoi bor-sid)) 3)
                                                )
                                                (numinc:popup "Information" 48 "Number of Polygon Sides must be numericalnand greater than 2.")
                                                (mode_tile "bor-sid" 2)
                                            )
                                            (   t
                                                (done_dialog 1)
                                            )
                                        )
                                    )
                                )
                            )
                        )
                        (setq dclflag (start_dialog))
                    )
                )
                (cond
                    (   (= 2 dclflag)
                        (while
                            (progn (setvar 'errno 0) (setq ent (car (entsel "nSelect block: ")))
                                (cond
                                    (   (= 7 (getvar 'errno))
                                        (princ "nMissed, try again.")
                                    )
                                    (   (= 'ename (type ent))
                                        (if
                                            (and
                                                (= "INSERT" (cdr (assoc 0 (setq elst (entget ent)))))
                                                (= 1 (cdr (assoc 66 elst)))
                                            )
                                            (progn
                                                (setq blk-nme
                                                    (if (vlax-property-available-p (setq obj (vlax-ename->vla-object ent)) 'effectivename)
                                                        (vla-get-effectivename obj)
                                                        (vla-get-name obj)
                                                    )
                                                )
                                                nil
                                            )
                                            (princ "nPlease select a block.")
                                        )
                                    )
                                )
                            )
                        )
                    )
                    (   (= 3 dclflag)
                        (cond
                            (   (= "bor-off" bor-typ)
                                (while
                                    (and
                                        (progn
                                            (initget 6)
                                            (setq tmp
                                                (getdist
                                                    (strcat "nSpecify border offset factor <" off-ed1 ">: ")
                                                )
                                            )
                                        )
                                        (< tmp 1.0)
                                    )
                                    (princ "nPlease provide a value greater than or equal to one.")
                                )
                                (if tmp
                                    (setq off-ed1 (rtos tmp))
                                )
                            )
                            (   t
                                (cond
                                    (   (member bor-shp '("0″ "3″))
                                        (setq fix-ed1
                                            (cond
                                                (   (setq tmp
                                                        (getdist
                                                            (strcat "nSpecify border radius <" fix-ed1 ">: ")
                                                        )
                                                    )
                                                    (rtos tmp)
                                                )
                                                (   fix-ed1   )
                                            )
                                        )
                                    )
                                    (   t
                                        (if
                                            (and
                                                (setq p1 (getpoint "nSpecify first point: "))
                                                (setq p2 (getcorner p1 "nSpecify opposite corner: "))
                                            )
                                            (setq fix-ed1 (rtos (abs (- (car  p2) (car  p1))))
                                                  fix-ed2 (rtos (abs (- (cadr p2) (cadr p1))))
                                            )
                                        )
                                    )
                                )
                            )  
                        )
                    )
                    (   (= 4 dclflag)
                        (initget 6)
                        (setq txt-sze
                            (cond
                                (   (setq tmp
                                        (getdist
                                            (strcat "nSpecify text size <" txt-sze ">: ")
                                        )
                                    )
                                    (rtos tmp)
                                )
                                (   txt-sze   )
                            )
                        )
                    )
                    (   (= 5 dclflag)
                        (setq arr-rot
                            (cond
                                (   (setq tmp
                                        (getangle
                                            (strcat "nSpecify object angle <" arr-rot ">: ")
                                        )
                                    )
                                    (angtos tmp)
                                )
                                (   arr-rot   )
                            )
                        )
                    )
                    (   (= 6 dclflag)
                        (initget 6)
                        (setq blk-scl
                            (cond
                                (   (setq tmp
                                        (getdist
                                            (strcat "nSpecify block scale <" blk-scl ">: ")
                                        )
                                    )
                                    (rtos tmp)
                                )
                                (   blk-scl   )
                            )
                        )
                    )
                    (   (= 7 dclflag)
                        (while
                            (and
                                (progn
                                    (initget 6)
                                    (setq tmp
                                        (getdist
                                            (strcat "nSpecify background mask offset factor <" msk-off ">: ")
                                        )
                                    )
                                )
                                (or
                                    (< 5.0 tmp)
                                    (< tmp 1.0)
                                )
                            )
                            (princ "nPlease provide a value between 1 and 5.")
                        )
                        (if tmp
                            (setq msk-off (rtos tmp))
                        )
                    )
                )
            )
            (if (= 1 dclflag)
                (progn
                    (if
                        (setq ss
                            (ssget "_X"
                                (list '(0 . "ACAD_TABLE")
                                    (if (= 1 (getvar 'cvport))
                                        (cons 410 (getvar 'ctab))
                                       '(410 . "Model")
                                    )
                                )
                            )
                        )
                        (repeat (setq i (sslength ss))
                            (setq table (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) table))
                        )
                    )
                    (setq acdoc (vla-get-activedocument (vlax-get-acad-object))
                          acspc (vlax-get-property acdoc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace))
                    )
                    (setq nm (trans '(0.0 0.0 1.0) 1 0 t)
                          xa (angle '(0.0 0.0 0.0) (trans (getvar 'ucsxdir) 0 nm t))
                    )
                    (if
                        (and
                            (/= "obj-blk" obj-typ)
                            (numinc:annotative-p txt-sty)
                        )
                        (setq txt-sze# (/ txt-sze# (cond ((getvar 'cannoscalevalue)) (1.0))))
                    )
                    (setq symb
                        (mapcar 'cdr
                            (vl-remove-if
                                (function
                                    (lambda ( pair )
                                        (zerop (logand (car pair) inc-sec))
                                    )
                                )
                               '(
                                    (1 . pre-str)
                                    (2 . mid-str)
                                    (4 . suf-str)
                                )
                            )
                        )
                    )
                    
                    (setq prop
                        (if
                            (and
                                (= "obj-txt" obj-typ)
                                (/= "Left" txt-aln)
                            )
                            'textalignmentpoint
                            'insertionpoint
                        )
                    )
                    (if (= "1″ msk-use)
                        (setq mtx-bak :vlax-true)
                        (setq mtx-bak :vlax-false)
                    )
                    
                    (setq create-obj
                        (cond
                            (   (= "obj-txt" obj-typ)
                                (lambda ( point string / obj )
                                    (setq point (vlax-3D-point (trans point 1 0))
                                            obj (vla-addtext acspc string point txt-sze#)
                                    )
                                    (vla-put-stylename obj txt-sty)
                                    (vla-put-layer     obj txt-lay)
                                    (vla-put-alignment obj (cdr (assoc txt-aln Alignment)))
                                    (if (= "Left" txt-aln)
                                        (vla-put-insertionpoint     obj point)
                                        (vla-put-textalignmentpoint obj point)
                                    )
                                    (vla-put-rotation  obj (+ xa txt-rot))
                                    obj
                                )
                            )
                            (   (= "obj-mtx" obj-typ)
                                (lambda ( point string / obj )
                                    (setq point (vlax-3D-point (trans point 1 0)))
                                    (setq obj
                                        (vla-addmtext acspc point
                                            (
                                                (lambda ( box ) (* 1.01 (- (caadr box) (caar box))))
                                                (textbox
                                                    (list
                                                        (cons 1  string) ;(strcat string "."))
                                                        (cons 40 txt-sze#)
                                                        (cons 7  txt-sty)
                                                    )
                                                )
                                            )
                                            string
                                        )
                                    )
                                    (vla-put-stylename obj txt-sty)
                                    (vla-put-layer     obj txt-lay)
                                    (vla-put-height    obj txt-sze#)
                                    (vla-put-attachmentpoint obj (cdr (assoc txt-aln Attachment)))
                                    (vla-put-insertionpoint obj point)
                                    (vla-put-rotation  obj txt-rot)
                                    (if (= "1″ msk-use)
                                        (entmod
                                            (append
                                                (vl-remove-if
                                                    (function
                                                        (lambda ( pair )
                                                            (member (car pair) '(45 63 90 421 431 441))
                                                        )
                                                    )
                                                    (entget (vlax-vla-object->ename obj))
                                                )
                                                (if (= "1″ msk-trn)
                                                   '((90 . 3))
                                                   '((90 . 1))
                                                )
                                                (if (= "1″ msk-trn)
                                                   '((63 . 256))
                                                    (mapcar '(lambda ( x ) (cons (1+ (car x)) (cdr x))) msk-col)
                                                )
                                                (list
                                                    (cons 45 msk-off#)
                                                   '(441 . 0)
                                                )
                                            )
                                        )
                                    )
                                    
                                    (vla-put-backgroundfill obj mtx-bak)
                                    obj
                                )
                            )
                            (   (= "obj-blk" obj-typ)
                                (lambda ( point string / obj )
                                    (setq point (vlax-3D-point (trans point 1 0))
                                          obj   (vla-insertblock acspc point blk-nme blk-scl# blk-scl# blk-scl# (+ xa txt-rot))
                                    )
                                    (vl-some
                                        (function
                                            (lambda ( attrib )
                                                (if (eq (vla-get-tagstring attrib) att-nme)
                                                    (null (vla-put-textstring attrib string))
                                                )
                                            )
                                        )
                                        (vlax-invoke obj 'getattributes)
                                    )
                                    (vla-put-layer obj txt-lay)
                                    obj
                                )
                            )
                        )
                    )
                    (if
                        (and
                            (/= "obj-blk" obj-typ)
                            (= "1″ bor-enc)
                            (= "bor-off" bor-typ)
                            off-ed1#
                        )                       
                        (setq off-ed1# (* txt-sze# (1- off-ed1#)))
                    )
                    (setq create-bor
                        (lambda ( obj prop / bor )
                            (setq bor
                                (vlax-ename->vla-object
                                    (numinc:createtextborder
                                        (vlax-vla-object->ename obj) bor-shp
                                        (cond (off-ed1#) (0.0)) fix-ed1# fix-ed2# bor-sid#
                                    )
                                )
                            )
                            (vla-put-layer bor bor-lay)
                            (if (and (= "3″ bor-shp) bor-rot)
                                (vla-rotate bor (vlax-3D-point (numinc:polygoncentroid bor)) (/ pi bor-sid#))
                            )
                            bor
                        )
                    )
                    
                    (cond
                        (   (= "1″ arr-use)
                            (if (setq p1 (getpoint "nSpecify array base point: "))
                                (progn
                                    (while
                                        (progn
                                            (if arr-end
                                                (progn
                                                    (initget "Spacing")
                                                    (setq p2 (getpoint "nSpecify array endpoint [Spacing]: " p1))
                                                )
                                                (progn
                                                    (initget "Endpoint")
                                                    (setq p2 (getpoint "nSpecify array spacing vector [Endpoint]: " p1))
                                                )
                                            )
                                            (cond
                                                (   (null p2)
                                                    nil
                                                )
                                                (   (= "Endpoint" p2)
                                                    (setq arr-end t)
                                                )
                                                (   (= "Spacing" p2)
                                                    (setq arr-end nil)
                                                    t
                                                )
                                                (   (and
                                                        (listp p2)
                                                        (equal p1 p2 1e-8)
                                                    )
                                                    (princ "nPoints must be distinct.")
                                                )
                                            )
                                        )
                                    )
                                    (if (and arr-end (< 1 arr-qty#))
                                        (setq v1 (mapcar '(lambda ( a b ) (/ (- a b) (float (1- arr-qty#)))) p2 p1))
                                        (setq v1 (mapcar '- p2 p1))
                                    )
                                    (cond
                                        (   (= "arr-aln" arr-typ)
                                            (setq r1 (numinc:makereadable (angle p1 p2)))
                                        )
                                        (   (= "arr-per" arr-typ)
                                            (setq r1 (numinc:makereadable (+ (angle p1 p2) (/ pi 2.0))))
                                        )
                                        (   (setq r1 arr-rot#)   )
                                    )
                                    (if (/= "obj-mtx" obj-typ)
                                        (setq r1 (+ r1 xa))
                                    )
                                    (repeat arr-qty#
                                        (setq obj (create-obj p1 (strcat pre-str mid-str suf-str)))
                                        (vla-put-rotation obj r1)
                                        (if
                                            (and
                                                (/= "obj-blk" obj-typ)
                                                (= "1″ bor-enc)
                                            )
                                            (create-bor obj prop)
                                        )
                                        (numinc:increment symb inc-str)
                                        (setq p1 (mapcar '+ p1 v1))
                                    )
                                )
                            )        
                        )
                        (   (= "1″ dyn-flg)
                            (setq obj (create-obj (cadr (grread t 13 0)) (strcat pre-str mid-str suf-str)))
                            (if
                                (and
                                    (/= "obj-blk" obj-typ)
                                    (= "1″ bor-enc)
                                )
                                (setq bor (create-bor obj prop))
                            )
                         
                            (princ
                                (setq msg
                                    (strcat
                                        "n[C]urve Aligned, [R]eplace, R[o]tate CCW[<] / CW[>], [T]oggle Count, [I]ncrementn"
                                        (if
                                            (and
                                                (/= "obj-blk" obj-typ)
                                                (= "1″ bor-enc)
                                                (= "3″ bor-shp)
                                            )
                                            "Rotate [B]order, " ""
                                        )
                                        "[Tab] = Rotate 90″ (chr 186)
                                        ", [M]irror Rotation"
                                        (if (= "obj-mtx" obj-typ) ", B[a]ckground Mask" "")
                                        " "
                                    )
                                )
                            )
                            (setvar 'modemacro
                                (strcat "Rotation: "
                                    (rtos (rem (+ 360.0 (* 180.0 (/ txt-rot pi))) 360) 2 2) (chr 186)
                                )
                            )
                            (while
                                (progn
                                    (setq gr (grread t 15 0)
                                          g1 (car  gr)
                                          g2 (cadr gr)
                                    )
                                    (cond
                                        (   (member g1 '(3 5))
                                            (setq p1 (vlax-3D-point (trans g2 1 0)))
                                            (if bor
                                                (vla-move bor (vlax-get-property obj prop) p1)
                                            )
                                            (vlax-put-property obj prop p1)
                                            (if (= 3 g1)
                                                (progn
                                                    (if (and table (numinc:textincell table p1 (strcat pre-str mid-str suf-str)))
                                                        (progn
                                                            (vla-delete obj)
                                                            (if bor (vla-delete bor))
                                                        )
                                                    )
                                                    (if tog-cnt (numinc:increment symb inc-str))
                                                    (setq obj (create-obj g2 (strcat pre-str mid-str suf-str)))
                                                    (if
                                                        (and
                                                            (/= "obj-blk" obj-typ)
                                                            (= "1″ bor-enc)
                                                        )
                                                        (setq bor (create-bor obj prop))
                                                    )
                                                    (redraw)
                                                )
                                            )
                                            t
                                        )
                                        (   (= 25 g1)
                                            (vla-delete obj)
                                            (if bor (vla-delete bor))
                                            nil
                                        )
                                        (   (= 2 g1)
                                            (cond
                                                (   (member g2 '(67 99))  ;; C/c
                                                    (vla-delete obj)
                                                    (if bor (vla-delete bor))
                                                 
                                                    (while
                                                        (setq ent
                                                            (numinc:selectif "nSelect curve : "
                                                                (function
                                                                    (lambda ( x )
                                                                        (not
                                                                            (vl-catch-all-error-p
                                                                                (vl-catch-all-apply 'vlax-curve-getendparam (list x))
                                                                            )
                                                                        )
                                                                    )
                                                                )
                                                                entsel
                                                            )
                                                        )
                                                        (if (numinc:aligntocurve
                                                                (setq obj (create-obj (cadr ent) (strcat pre-str mid-str suf-str)))
                                                                prop
                                                                (car ent)
                                                                (if
                                                                    (and
                                                                        (/= "obj-blk" obj-typ)
                                                                        (= "1″ bor-enc)
                                                                    )
                                                                    (setq bor (create-bor obj prop))
                                                                )
                                                            )
                                                            (if tog-cnt (numinc:increment symb inc-str))
                                                            (progn
                                                                (vla-delete obj)
                                                                (if bor (vla-delete bor))
                                                            )
                                                        )
                                                    )
                                                    (setq obj (create-obj (cadr (grread t 13 0)) (strcat pre-str mid-str suf-str)))
                                                    (if
                                                        (and
                                                            (/= "obj-blk" obj-typ)
                                                            (= "1″ bor-enc)
                                                        )
                                                        (setq bor (create-bor obj prop))
                                                    )
                                                    (princ msg)
                                                )
                                                (   (member g2 '(44 46 60 62))  ;; >
                                                    (if (member g2 '(44 60))
                                                        (setq deg (/ pi  180.0))
                                                        (setq deg (/ pi -180.0))
                                                    )
                                                    (setvar 'modemacro
                                                        (strcat "Rotation: "
                                                            (rtos
                                                                (rem
                                                                    (+ 360.0
                                                                        (* 180.0
                                                                            (/ (setq txt-rot (+ txt-rot deg)) pi)
                                                                        )
                                                                    )
                                                                    360
                                                                )
                                                                2 2
                                                            )
                                                            (chr 186)
                                                        )
                                                    )
                                                    (vla-put-rotation obj (+ (vla-get-rotation obj) deg))
                                                    (if bor
                                                        (vla-rotate bor (vlax-get-property obj prop) deg)
                                                    )
                                                    t
                                                )
                                                (   (member g2 '(79 111))  ;; O/o
                                                    (setq txt-rot
                                                        (cond
                                                            (
                                                                (getangle
                                                                    (strcat "nSpecify "
                                                                        (cdr
                                                                            (assoc obj-typ
                                                                               '(
                                                                                    ("obj-txt" . "text")
                                                                                    ("obj-mtx" . "mtext")
                                                                                    ("obj-blk" . "block")
                                                                                )
                                                                            )
                                                                        )
                                                                        " rotation <" (angtos txt-rot) ">: "
                                                                    )
                                                                )
                                                            )
                                                            (   txt-rot   )
                                                        )
                                                    )
                                                    (setvar 'modemacro
                                                        (strcat "Rotation: "
                                                            (rtos
                                                                (rem
                                                                    (+ 360.0 (* 180.0 (/ txt-rot pi)))
                                                                    360
                                                                )
                                                                2 2
                                                            )
                                                            (chr 186)
                                                        )
                                                    )
                                                    (if bor
                                                        (vla-rotate bor (vlax-get-property obj prop)
                                                            (- txt-rot
                                                                (if (= "obj-mtx" obj-typ)
                                                                    (vla-get-rotation obj)
                                                                    (- (vla-get-rotation obj) xa)
                                                                )
                                                            )
                                                        )
                                                    )
                                                    (vla-put-rotation obj
                                                        ((lambda ( a ) (if (= "obj-mtx" obj-typ) a (+ a xa))) txt-rot)
                                                    )
                                                    (princ msg)
                                                )
                                                (   (member g2 '(84 116))  ;; T/t
                                                    (if (setq tog-cnt (not tog-cnt))
                                                        (princ "n")
                                                        (princ "n")
                                                    )
                                                    (princ msg)
                                                )
                                                (   (member g2 '(73 105)) ;; I/i
                                                    (vla-delete obj)
                                                    (if bor (vla-delete bor))
                                                 
                                                    (numinc:increment symb inc-str)
                                                    (setq obj (create-obj (cadr (grread t 13 0)) (strcat pre-str mid-str suf-str)))
                                                    (if
                                                        (and
                                                            (/= "obj-blk" obj-typ)
                                                            (= "1″ bor-enc)
                                                        )
                                                        (setq bor (create-bor obj prop))
                                                    )
                                                    t
                                                )
                                                (   (member g2 '(66 98))  ;; B/b
                                                    (if
                                                        (and
                                                            (/= "obj-blk" obj-typ)
                                                            (= "1″ bor-enc)
                                                            (= "3″ bor-shp)
                                                            bor
                                                        )
                                                        (progn
                                                            (setq bor-rot (not bor-rot))
                                                            (vla-rotate bor
                                                                (vlax-3D-point (numinc:PolygonCentroid bor))
                                                                (/ pi bor-sid#)
                                                            )
                                                        )
                                                        (princ (strcat "nInvalid keypress." msg))
                                                    )
                                                    t
                                                )
                                                (   (= g2 9)  ;; Tab
                                                    (setq txt-rot (rem (+ pi pi txt-rot) (+ pi pi)))
                                                 
                                                    (if
                                                        (vl-some
                                                            (function
                                                                (lambda ( x )
                                                                    (equal txt-rot x 1e-6)
                                                                )
                                                            )
                                                            (list (* pi 0.0) (* pi 0.5) (* pi 1.0) (* pi 1.5))
                                                        )
                                                        (setq txt-rot (rem (+ txt-rot (/ pi 2.0)) (+ pi pi)))
                                                        (setq txt-rot (numinc:roundto txt-rot (/ pi 2.0)))
                                                    )
                                                    (setvar 'modemacro
                                                        (strcat "Rotation: "
                                                            (rtos
                                                                (rem
                                                                    (+ 360.0 (* 180.0 (/ txt-rot pi)))
                                                                    360
                                                                )
                                                                2 2
                                                            )
                                                            (chr 186)
                                                        )
                                                    )
                                                    (if bor
                                                        (vla-rotate bor (vlax-get-property obj prop)
                                                            (- txt-rot
                                                                (if (= "obj-mtx" obj-typ)
                                                                    (vla-get-rotation obj)
                                                                    (- (vla-get-rotation obj) xa)
                                                                )
                                                            )
                                                        )
                                                    )
                                                    (vla-put-rotation obj
                                                        ((lambda ( a ) (if (= "obj-mtx" obj-typ) a (+ a xa))) txt-rot)
                                                    )
                                                    t
                                                )
                                                (   (member g2 '(77 109))  ;; M/m
                                                    (setq txt-rot (rem (+ pi pi (* -1.0 txt-rot)) (+ pi pi)))
                                                    (setvar 'modemacro
                                                        (strcat "Rotation: "
                                                            (rtos
                                                                (rem
                                                                    (+ 360.0 (* 180.0 (/ txt-rot pi)))
                                                                    360
                                                                )
                                                                2 2
                                                            )
                                                            (chr 186)
                                                        )
                                                    )
                                                 
                                                    (if bor
                                                        (vla-rotate bor (vlax-get-property obj prop)
                                                            (- txt-rot
                                                                (if (= "obj-mtx" obj-typ)
                                                                    (vla-get-rotation obj)
                                                                    (- (vla-get-rotation obj) xa)
                                                                )
                                                            )
                                                        )
                                                    )
                                                    (vla-put-rotation obj
                                                        ((lambda ( a ) (if (= "obj-mtx" obj-typ) a (+ a xa))) txt-rot)
                                                    )
                                                    t
                                                )
                                                (   (member g2 '(82 114))  ;; R/r
                                                    (vla-delete obj)
                                                    (if bor (vla-delete bor))
                                                    (while
                                                        (setq ent
                                                            (car
                                                                (numinc:selectif "nSelect text, mtext or attribute : "
                                                                    (function
                                                                        (lambda ( x )
                                                                            (member (cdr (assoc 0 (entget x))) '("TEXT" "MTEXT" "ATTRIB"))
                                                                        )
                                                                    )
                                                                    nentsel
                                                                )
                                                            )
                                                        )
                                                        (if
                                                            (= 4
                                                                (logand 4
                                                                    (cdr
                                                                        (assoc 70
                                                                            (tblsearch "layer"
                                                                                (cdr (assoc 8 (entget ent)))
                                                                            )
                                                                        )
                                                                    )
                                                                )
                                                            )
                                                            (princ "nSelected object is on a locked layer.")
                                                            (progn
                                                                (vla-put-textstring (vlax-ename->vla-object ent) (strcat pre-str mid-str suf-str))
                                                                (if tog-cnt (numinc:increment symb inc-str))
                                                            )
                                                        )
                                                    )
                                                    (setq obj (create-obj (cadr (grread t 13 0)) (strcat pre-str mid-str suf-str)))
                                                    (if
                                                        (and
                                                            (/= "obj-blk" obj-typ)
                                                            (= "1″ bor-enc)
                                                        )
                                                        (setq bor (create-bor obj prop))
                                                    )
                                                    (princ msg)
                                                )
                                                (   (member g2 '(65 97))  ;; A/a
                                                    (if (= "obj-mtx" obj-typ)
                                                        (progn
                                                            (vlax-put obj 'backgroundfill
                                                                (setq mtx-bak (~ (vlax-get obj 'backgroundfill)))
                                                            )
                                                            (if (zerop mtx-bak)
                                                                (princ "n")
                                                                (princ "n")
                                                            )
                                                        )
                                                        (princ "nInvalid keypress.")
                                                    )
                                                    (princ msg)
                                                )
                                                (   (member g2 '(13 32))  ;; Enter/Space
                                                 
                                                    (vla-delete obj)
                                                    (if bor (vla-delete bor))      
                                                    nil
                                                )
                                                (   (princ (strcat "nInvalid keypress." msg))   )
                                            )
                                        )
                                        (   t
                                            (vla-delete obj)
                                            (if bor (vla-delete bor))
                                            nil
                                        )
                                    )
                                )
                            )
                        )
                        (   t
                            (setq msg
                                (strcat
                                    "nPick Point or [C]urve Aligned, [R]eplace, R[o]tation, [T]oggle Count, [I]ncrementn"
                                    (if
                                        (and
                                            (/= "obj-blk" obj-typ)
                                            (= "1″ bor-enc)
                                            (= "3″ bor-shp)
                                        )
                                        "Rotate [B]order, " ""
                                    )
                                    "[Ro]tate 90″ (chr 186) ", [M]irror Rotation"
                                    (if (= "obj-mtx" obj-typ) ", B[a]ckground Mask" "")
                                    " : "
                                )
                            )
                            (setvar 'modemacro
                                (strcat "Rotation: "
                                    (rtos (rem (+ 360.0 (* 180.0 (/ txt-rot pi))) 360) 2 2) (chr 186)
                                )
                            )
                         
                            (while
                                (progn
                                    (initget
                                        (strcat
                                            "Curve Replace rOtation Toggle Increment ROtate"
                                            (if
                                                (and
                                                    (/= "obj-blk" obj-typ)
                                                    (= "1″ bor-enc)
                                                    (= "3″ bor-shp)
                                                )
                                                " Border" ""
                                            )
                                            " Mirror"
                                            (if (= "obj-mtx" obj-typ) " bAckground" "")
                                        )
                                    )
                                    (setq pt (getpoint msg))
                                    (cond
                                        (   (null pt)
                                            nil
                                        )
                                        (   (listp pt)
                                            (if
                                                (null
                                                    (and table
                                                        (numinc:textincell table
                                                            (vlax-3D-point (trans pt 1 0)) (strcat pre-str mid-str suf-str)
                                                        )
                                                    )
                                                )
                                                (progn
                                                    (setq obj (create-obj pt (strcat pre-str mid-str suf-str)))
                                                    (if
                                                        (and
                                                            (/= "obj-blk" obj-typ)
                                                            (= "1″ bor-enc)
                                                        )
                                                        (setq bor (create-bor obj prop))
                                                    )
                                                )
                                            )
                                            (if tog-cnt (numinc:increment symb inc-str))
                                            (princ "n——————–")
                                            t
                                        )
                                        (   (= "Curve" pt)
                                                  
                                            (while
                                                (setq ent
                                                    (numinc:selectif "nSelect curve : "
                                                        (function
                                                            (lambda ( x )
                                                                (not
                                                                    (vl-catch-all-error-p
                                                                        (vl-catch-all-apply 'vlax-curve-getendparam (list x))
                                                                    )
                                                                )
                                                            )
                                                        )
                                                        entsel
                                                    )
                                                )
                                                (if (numinc:aligntocurve
                                                        (setq obj (create-obj (cadr ent) (strcat pre-str mid-str suf-str))) prop (car ent)
                                                        (if
                                                            (and
                                                                (/= "obj-blk" obj-typ)
                                                                (= "1″ bor-enc)
                                                            )
                                                            (setq bor (create-bor obj prop))
                                                        )
                                                    )
                                                    (if tog-cnt (numinc:increment symb inc-str))
                                                    (progn
                                                        (vla-delete obj)
                                                        (if bor (vla-delete bor))
                                                    )
                                                )
                                            )
                                            t
                                        )
                                        (   (= "Replace" pt)
                                            (while
                                                (setq ent
                                                    (car
                                                        (numinc:selectif "nSelect text, mtext or attribute : "
                                                            (function
                                                                (lambda ( x )
                                                                    (member (cdr (assoc 0 (entget x))) '("TEXT" "MTEXT" "ATTRIB"))
                                                                )
                                                            )
                                                            nentsel
                                                        )
                                                    )
                                                )
                                                (if
                                                    (= 4
                                                        (logand 4
                                                            (cdr
                                                                (assoc 70
                                                                    (tblsearch "layer"
                                                                        (cdr (assoc 8 (entget ent)))
                                                                    )
                                                                )
                                                            )
                                                        )
                                                    )
                                                    (princ "nSelected object is on a locked layer.")
                                                    (progn
                                                        (vla-put-textstring (vlax-ename->vla-object ent) (strcat pre-str mid-str suf-str))
                                                        (if tog-cnt (numinc:increment symb inc-str))
                                                    )
                                                )
                                            )
                                            t
                                        )
                                        (   (= "rOtation" pt)
                                         
                                            (setq txt-rot
                                                (cond
                                                    (
                                                        (getangle
                                                            (strcat "nSpecify "
                                                                (cdr
                                                                    (assoc obj-typ
                                                                       '(
                                                                            ("obj-txt" . "text")
                                                                            ("obj-mtx" . "mtext")
                                                                            ("obj-blk" . "block")
                                                                        )
                                                                    )
                                                                )
                                                                " rotation <" (angtos txt-rot) ">: "
                                                            )
                                                        )
                                                    )
                                                    (   txt-rot   )
                                                )
                                            )
                                            (setvar 'modemacro
                                                (strcat "Rotation: "
                                                    (rtos
                                                        (rem
                                                            (+ 360.0 (* 180.0 (/ txt-rot pi)))
                                                            360
                                                        )
                                                        2 2
                                                    )
                                                    (chr 186)
                                                )
                                            )
                                            t
                                        )
                                        (   (= "Toggle" pt)
                                            (if (setq tog-cnt (not tog-cnt))
                                                (princ "n")
                                                (princ "n")
                                            )
                                            t
                                        )
                                        (   (= "Increment" pt)
                                            (numinc:increment symb inc-str)
                                            t
                                        )
                                        (   (= "Border" pt)
                                            (princ "n")
                                            (setq bor-rot (not bor-rot))
                                            t
                                        )
                                        (   (= "ROtate" pt)
                                            (setq txt-rot (rem (+ pi pi txt-rot) (+ pi pi)))
                                            (if
                                                (vl-some
                                                    (function
                                                        (lambda ( x )
                                                            (equal txt-rot x 1e-6)
                                                        )
                                                    )
                                                    (list (* pi 0.0) (* pi 0.5) (* pi 1.0) (* pi 1.5))
                                                )
                                                (setq txt-rot (rem (+ txt-rot (/ pi 2.0)) (+ pi pi)))
                                                (setq txt-rot (numinc:roundto txt-rot (/ pi 2.0)))
                                            )
                                            (princ
                                                (strcat "n"
                                                    (setvar 'modemacro
                                                        (strcat "Rotation: "
                                                            (rtos
                                                                (rem
                                                                    (+ 360.0 (* 180.0 (/ txt-rot pi)))
                                                                    360
                                                                )
                                                                2 2
                                                            )
                                                            (chr 186)
                                                        )
                                                    )
                                                )
                                            )
                                            t
                                        )
                                        (   (= "Mirror" pt)
                                            (setq txt-rot (rem (+ pi pi (* -1.0 txt-rot)) (+ pi pi)))
                                            (princ
                                                (strcat "n"
                                                    (setvar 'modemacro
                                                        (strcat "Rotation: "
                                                            (rtos
                                                                (rem
                                                                    (+ 360.0 (* 180.0 (/ txt-rot pi)))
                                                                    360
                                                                )
                                                                2 2
                                                            )
                                                            (chr 186)
                                                        )
                                                    )
                                                )
                                            )
                                            t
                                        )
                                        (   (= "bAckground" pt)
                                            (if (zerop (setq mtx-bak (~ mtx-bak)))
                                                (princ "n")
                                                (princ "n")
                                            )
                                            t
                                        )
                                    )
                                )
                            )
                        )
                    )
                    (numinc:writeconfig cfgfname (mapcar 'eval (mapcar 'car symlist)))
                )
                (princ "n*Cancel*")
            )
        )
    )
    (if (< 0 dclid)
        (setq dclid (unload_dialog dclid))
    )
    (if
        (and
            (= 'vla-object (type numinc:wshobject))
            (not (vlax-object-released-p numinc:wshobject))
        )
        (progn
            (vlax-release-object numinc:wshobject)
            (setq numinc:wshobject nil)
        )
    )
    (mapcar 'setvar varlst vallst)
    (princ)
)
;;———————————————————————————————–;;
(defun numinc:selectif ( msg pred func / ent )
    (setq pred (eval pred))
    (while
        (progn (setvar 'errno 0) (setq ent (func msg))
            (cond
                (   (= 7 (getvar 'errno))
                    (princ "nMissed, try again.")
                )
                (   (= 'ename (type (car ent)))
                    (if (and pred (null (pred (car ent))))
                        (princ "nInvalid object selected.")
                    )
                )
            )
        )
    )
    ent
)
;;———————————————————————————————–;;
(defun numinc:annotative-p ( sty )
    (and
        (setq sty (tblobjname "style" sty))
        (setq sty (cadr (assoc -3 (entget sty '("AcadAnnotative")))))
        (= 1 (cdr (assoc 1070 (reverse sty))))
    )
)
;;———————————————————————————————–;;
(defun numinc:getblockdata ( / a b c )
    (while (setq a (tblnext "block" (null a)))
        (if
            (and
                (null (wcmatch (cdr (assoc 02 a)) "`**,*|*"))
                (= 2 (logand 2 (cdr (assoc 70 a))))
                (setq c
                    (
                        (lambda ( c / d e )
                            (while (setq c (entnext c))
                                (if (= "ATTDEF" (cdr (assoc 0 (setq d (entget c)))))
                                    (setq e (cons (strcase (cdr (assoc 2 d))) e))
                                )
                            )
                            (vl-sort e '<)
                        )
                        (tblobjname "block" (cdr (assoc 2 a)))
                    )
                )
            )
            (setq b (cons (cons (cdr (assoc 2 a)) c) b))
        )
    )
    (vl-sort b '(lambda ( a b ) (< (car a) (car b))))
)
;;———————————————————————————————–;;
(defun numinc:gettableitems ( table / a b )
    (while (setq a (tblnext table (null a)))
        (if
            (not
                (or (wcmatch (cdr (assoc 2 a)) "`**,*|*")
                    (and (= "layer" (strcase table t))
                         (= 4 (logand 4 (cdr (assoc 70 a))))
                    )
                )
            )
            (setq b (cons (cdr (assoc 2 a)) b))
        )
    )
    (acad_strlsort b)
)
;;———————————————————————————————–;;
(defun numinc:roundto ( a b )
    (* b (fix (/ (+ a (* b (if (minusp a) -0.5 0.5))) b)))
)
;;———————————————————————————————–;;
(defun numinc:about ( id / _dialogtext _displaybitmap i j x y )
    (defun _dialogtext ( key str )
        (set_tile key str)
        (start_image key)
        (vector_image 0 (1- (dimy_tile key)) (dimx_tile key) (1- (dimy_tile key)) 0)
        (end_image)
    )
    (cond
        (   (not (new_dialog "about" id))
            (numinc:popup "About Dialog could not be Loaded" 16
                (princ
                    (strcat
                        "The Incremental Numbering Suite About dialog could not be loaded. "
                        "The DCL file required by the application resides in the following location:nn"
                        dclfname
                        "nnPlease check the integrity of this file."
                    )
                )
            )
            (princ)
        )
        (   t
            (repeat (setq i 32)
                (setq j 1)
                (repeat 32
                    (setq x (cons j x)
                          y (cons i y)
                          j (1+ j)
                    )
                )
                (setq i (1- i))
            )
            (foreach pair
               '(
                    ;("title1″ "Incremental Numbering Suite")
                    ("title2″ "Placement Controls")
                    ("title3″ "Curve Alignment Controls")
                )
                (apply '_dialogtext pair)
            )
            (setq _displaybitmap
                (eval
                    (list 'lambda '( key lst )
                       '(start_image key)
                       '(fill_image 0 0 (dimx_tile key) (dimy_tile key) -15)
                        (list 'mapcar "vector_image (quote x) (quote y) (quote x) (quote y) 'lst)
                       '(end_image)
                    )
                )
            )
            (_displaybitmap "info1″
               '(
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 008 -15 008 -15 008 -15 008 -15 008 -15 008 -15 008 -15 008 -15 008 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 -15 008 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 008 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 008 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 008 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 008 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 008 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 008 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 008 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 008 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 008 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 008 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 009 008 -15 008 -15 008 -15 008 -15 008 -15 008 -15 008 -15 008 -15 008 -15 254 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 009 253 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 253 254 253 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 253 254 -15 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 253 254 254 254 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 253 009 254 009 254 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 253 253 254 009 009 254 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 253 253 254 009 009 009 254 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 253 253 254 254 254 254 009 254 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 253 253 254 254 254 254 254 254 254 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 253 253 254 254 254 254 254 254 254 254 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 252 252 252 252 008 254 254 254 254 254 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 254 009 009 253 253 254 009 252 254 254 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 254 254 252 009 254 252 252 252 009 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 254 252 254 254 252 009 252 252 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 253 253 254 253 009 254 254 252 252 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 008 254 254 252 254 -15 -15 254 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 253 252 252 253 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 254 254 009 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                )
            )
            (_displaybitmap "info2″
               '(
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 251 251 251 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 251 251 251 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 251 251 251 253 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 009 252 008 253 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 254 252 008 253 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 254 252 008 253 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 254 252 008 253 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 254 009 009 151 151 151 151 151 151 009 009 252 251 251 251 008 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 254 009 143 143 153 153 145 145 145 145 145 153 153 143 251 252 254 254 252 008 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 254 143 143 153 145 145 153 153 253 009 009 009 253 253 153 145 251 254 009 009 254 251 -15 -15 -15 -15 -15 -15 -15 -15
                    -15 143 153 135 145 153 253 009 009 254 254 254 254 254 254 254 009 009 251 254 009 009 254 251 254 -15 -15 -15 -15 -15 -15 -15
                    -15 135 135 153 253 009 254 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 251 252 254 254 252 251 253 -15 -15 -15 -15 -15 -15 -15
                    254 135 253 009 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 251 251 251 251 252 008 253 -15 -15 -15 -15 -15 -15
                    -15 254 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 254 253 153 143 009 252 008 253 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 153 153 143 009 252 008 253 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 009 135 143 254 254 252 008 253 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 145 143 254 254 254 252 251 251 251 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 153 153 009 -15 254 254 251 251 251 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 143 153 143 -15 -15 254 251 251 251 254
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 253 153 143 -15 -15 -15 254 009 254 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 009 135 143 -15 -15 -15 -15 254 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 153 153 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 135 153 254 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 135 153 254 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 135 153 254 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 135 153 254 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 135 153 254 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 135 153 254 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 135 153 254 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 135 135 254 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 254 -15 -15 -15 -15 -15 -15 -15
                    -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                )
            )
            (start_image "title1″)
            (fill_image 0 0 (dimx_tile "title1″) (dimy_tile "title1″) -15)
            (foreach l
               '(
                    (
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 163 163 163 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 176 176 175 -15
                        -15 163 175 176 176 176 166 165 009 -15 -15 -15 -15 175 175 175 -15 -15 -15 -15 -15 165 175 175 163 -15 -15 -15 176 176 175 -15
                        166 176 176 175 175 177 176 176 176 163 -15 -15 -15 175 176 175 -15 -15 -15 -15 253 166 176 176 163 -15 -15 -15 176 176 175 -15
                        166 253 -15 -15 -15 -15 254 175 176 176 253 -15 -15 175 176 175 -15 -15 -15 253 176 176 176 176 163 -15 -15 -15 176 176 175 -15
                        254 -15 -15 -15 -15 -15 -15 -15 175 176 166 -15 -15 175 176 175 -15 -15 165 176 176 165 176 176 163 -15 -15 -15 176 176 175 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 163 176 176 -15 -15 175 176 175 -15 165 176 176 163 -15 176 176 163 -15 -15 -15 176 176 175 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 165 176 166 -15 -15 175 176 177 177 176 176 253 -15 -15 176 176 163 -15 -15 -15 176 176 175 -15
                        177 254 -15 -15 -15 -15 -15 163 176 176 163 -15 -15 175 176 176 176 166 253 -15 -15 -15 176 176 163 -15 -15 -15 176 176 175 -15
                        176 176 175 163 163 163 166 176 176 177 -15 -15 -15 175 176 176 166 254 -15 -15 -15 -15 176 176 163 -15 -15 -15 176 176 175 -15
                        009 175 176 176 176 176 176 166 163 -15 -15 -15 -15 166 176 176 253 -15 -15 -15 -15 254 176 176 175 -15 -15 254 176 176 166 -15
                        -15 -15 -15 009 009 009 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    )
                    (
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        175 175 175 163 -15 -15 166 175 175 175 175 175 175 175 175 175 -15 -15 -15 253 175 175 175 175 175 175 175 175 175 254 -15 -15
                        176 176 176 163 -15 -15 166 175 175 175 175 175 175 166 176 175 -15 -15 163 176 176 177 175 175 175 175 166 176 176 -15 -15 163
                        176 176 176 163 -15 -15 -15 -15 -15 -15 -15 -15 -15 175 176 175 -15 -15 176 176 163 -15 -15 -15 -15 -15 163 176 176 -15 -15 253
                        177 176 176 163 -15 -15 -15 -15 253 009 009 009 009 177 176 175 -15 -15 166 176 177 253 009 009 009 009 165 176 176 -15 -15 -15
                        254 176 176 163 -15 -15 -15 -15 175 176 176 176 176 176 176 175 -15 -15 254 166 176 176 176 176 176 176 176 176 176 -15 -15 -15
                        -15 176 176 163 -15 -15 -15 -15 253 009 009 009 009 177 176 175 -15 -15 -15 -15 253 176 176 177 009 009 165 176 176 -15 -15 -15
                        -15 176 176 163 -15 -15 -15 -15 -15 -15 -15 -15 -15 175 176 175 -15 -15 -15 254 166 176 166 -15 -15 -15 163 176 176 -15 -15 254
                        -15 176 176 163 -15 009 163 163 163 163 163 163 163 166 176 175 -15 -15 -15 166 176 166 254 -15 -15 -15 163 176 176 -15 -15 175
                        254 176 176 175 -15 009 176 176 176 176 176 176 176 176 176 166 -15 009 166 176 176 165 -15 -15 -15 -15 175 176 176 254 -15 -15
                        -15 -15 -15 -15 -15 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    )
                    (
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 165 175 175 163 -15 -15 166 175 175 175 175 175 175 175 175 175 -15 -15 253 175 175 175 254 -15 -15 -15 -15 254
                        -15 -15 -15 253 166 176 176 163 -15 -15 166 175 175 175 175 175 175 166 176 175 -15 -15 009 176 176 176 009 -15 -15 -15 -15 009
                        -15 -15 253 176 176 176 176 163 -15 -15 -15 -15 -15 -15 -15 -15 -15 175 176 175 -15 -15 009 176 176 176 166 -15 -15 -15 -15 166
                        -15 165 176 176 165 176 176 163 -15 -15 -15 -15 253 009 009 009 009 177 176 175 -15 -15 009 176 176 177 176 163 -15 -15 163 176
                        165 176 176 163 -15 176 176 163 -15 -15 -15 -15 175 176 176 176 176 176 176 175 -15 -15 009 176 176 253 166 176 009 009 176 176
                        176 176 253 -15 -15 176 176 163 -15 -15 -15 -15 253 009 009 009 009 177 176 175 -15 -15 009 176 176 009 009 176 166 166 176 163
                        166 253 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 -15 -15 -15 -15 175 176 175 -15 -15 009 176 176 009 -15 163 176 176 177 -15
                        254 -15 -15 -15 -15 176 176 163 -15 009 163 163 163 163 163 163 163 166 176 175 -15 -15 009 176 176 009 -15 -15 166 176 254 -15
                        -15 -15 -15 -15 254 176 176 175 -15 009 176 176 176 176 176 176 176 176 176 166 -15 -15 163 176 176 163 -15 -15 009 163 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    )
                    (
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        175 175 254 -15 -15 -15 -15 -15 253 175 175 175 -15 -15 -15 -15 166 175 175 175 175 175 175 175 175 175 163 -15 175 175 175 -15
                        176 176 -15 -15 -15 -15 -15 -15 163 176 176 166 -15 -15 -15 -15 166 175 175 175 176 176 166 175 175 175 163 -15 175 176 175 -15
                        176 176 -15 -15 -15 -15 -15 -15 166 176 176 176 163 -15 -15 -15 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 175 176 175 -15
                        176 176 -15 -15 -15 -15 -15 175 176 176 163 176 166 254 -15 -15 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 175 176 175 -15
                        176 176 -15 -15 -15 -15 009 176 176 165 -15 165 176 175 -15 -15 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 175 176 175 -15
                        176 176 -15 -15 -15 -15 166 176 176 163 163 163 176 176 009 -15 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 175 176 177 177
                        176 176 -15 -15 -15 163 176 176 177 175 175 175 177 176 166 -15 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 175 176 176 176
                        176 176 -15 -15 254 176 176 175 -15 -15 -15 -15 -15 177 176 163 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 175 176 176 166
                        176 176 254 254 177 176 176 165 -15 -15 -15 -15 -15 175 176 166 009 -15 -15 254 176 176 175 -15 -15 -15 -15 -15 166 176 176 253
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    )
                    (
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 253 163 163 163 -15 -15 -15 -15 -15 -15 253 163 163 163 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 009 176 176 163 -15 -15 -15 -15 -15 -15 175 176 176 176 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        175 163 -15 -15 009 176 176 163 -15 -15 -15 -15 -15 177 176 176 176 176 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 163
                        176 163 -15 -15 009 176 176 163 -15 -15 -15 254 177 176 176 176 176 176 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 163
                        176 163 -15 -15 009 176 176 163 -15 -15 254 166 176 176 163 175 176 176 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 163
                        176 163 -15 -15 009 176 176 163 -15 009 166 176 176 253 -15 175 176 176 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 163
                        176 163 -15 -15 009 176 176 163 253 176 176 166 009 -15 -15 175 176 176 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 163
                        176 163 -15 -15 009 176 176 177 176 176 166 254 -15 -15 -15 175 176 176 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 163
                        176 163 -15 -15 009 176 176 176 176 177 254 -15 -15 -15 -15 175 176 176 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 163
                        176 254 -15 -15 009 176 176 176 177 -15 -15 -15 -15 -15 -15 175 176 176 -15 -15 -15 -15 -15 -15 163 163 163 163 163 163 163 175
                        253 -15 -15 -15 163 176 176 176 -15 -15 -15 -15 -15 -15 -15 166 176 176 254 -15 -15 -15 -15 -15 163 176 176 176 176 176 176 176
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    )
                    (
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        175 175 175 175 163 -15 -15 163 175 175 175 -15 -15 -15 -15 -15 253 175 175 175 253 -15 -15 175 175 175 -15 -15 -15 -15 254 175
                        175 175 176 176 163 -15 -15 163 176 176 166 -15 -15 -15 -15 -15 163 176 176 176 009 -15 -15 175 176 175 -15 -15 -15 -15 -15 176
                        -15 -15 176 176 163 -15 -15 163 176 176 176 175 -15 -15 -15 254 176 176 176 176 009 -15 -15 175 176 175 -15 -15 -15 -15 -15 176
                        163 163 176 176 163 -15 -15 163 176 176 177 176 253 -15 -15 177 176 177 176 176 009 -15 -15 175 176 175 -15 -15 -15 -15 -15 176
                        176 176 176 176 163 -15 -15 163 176 176 254 176 166 -15 163 176 166 253 176 176 009 -15 -15 175 176 175 -15 -15 -15 -15 -15 176
                        -15 -15 176 176 163 -15 -15 163 176 176 -15 163 176 177 176 176 009 009 176 176 009 -15 -15 175 176 175 -15 -15 -15 -15 -15 176
                        -15 -15 176 176 163 -15 -15 163 176 176 -15 -15 177 176 176 163 -15 009 176 176 009 -15 -15 175 176 166 -15 -15 -15 -15 009 176
                        163 163 176 176 163 -15 -15 163 176 176 -15 -15 254 176 166 -15 -15 009 176 176 009 -15 -15 253 176 176 166 163 163 165 166 176
                        176 176 176 176 175 -15 -15 175 176 176 254 -15 -15 163 009 -15 -15 163 176 176 163 -15 -15 -15 163 166 176 176 176 176 176 177
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 009 009 009 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    )
                    (
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 009 165 175 175 175 175 175 175 175 175 253 -15 009 177 175 175 175 175 175 175 175 175 163 -15 -15 -15 163 175 175 175 175
                        253 176 176 166 175 175 175 175 177 176 176 009 -15 009 177 175 175 175 175 175 175 176 176 163 -15 -15 175 176 176 175 175 175
                        175 176 177 -15 -15 -15 -15 -15 009 176 176 009 -15 -15 -15 -15 -15 -15 -15 -15 -15 176 176 163 -15 -15 176 176 163 -15 -15 -15
                        165 176 166 253 009 009 009 009 163 176 176 009 -15 -15 -15 -15 163 009 009 009 009 176 176 163 -15 -15 165 176 166 163 163 163
                        -15 175 176 176 176 176 176 176 176 176 176 009 -15 -15 -15 -15 176 176 176 176 176 176 176 163 -15 -15 009 166 176 176 176 176
                        -15 -15 254 166 176 166 253 009 163 176 176 009 -15 -15 -15 -15 163 009 009 009 009 176 176 163 -15 254 176 176 165 -15 -15 -15
                        -15 -15 177 176 176 254 -15 -15 009 176 176 009 -15 -15 -15 -15 -15 -15 -15 -15 -15 176 176 163 -15 009 176 176 253 -15 -15 -15
                        -15 175 176 176 253 -15 -15 -15 009 176 176 009 -15 163 163 163 163 163 163 163 163 176 176 163 -15 -15 166 176 166 163 163 163
                        175 176 176 177 -15 -15 -15 -15 163 176 176 163 -15 163 176 176 176 176 176 176 176 176 176 175 -15 -15 254 165 166 176 176 176
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    )
                    (
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        009 163 175 166 176 176 177 165 254 -15 -15 -15 -15 175 175 175 -15 -15 -15 -15 -15 165 175 175 163 -15 -15 163 175 175 254 -15
                        175 176 176 177 175 175 176 176 176 253 -15 -15 -15 175 176 175 -15 -15 -15 -15 253 166 176 176 163 -15 -15 163 176 176 -15 -15
                        254 165 254 -15 -15 -15 -15 165 176 176 253 -15 -15 175 176 175 -15 -15 -15 253 176 176 176 176 163 -15 -15 163 176 176 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 175 176 177 -15 -15 175 176 175 -15 -15 165 176 176 165 176 176 163 -15 -15 163 176 176 -15 -15
                        175 175 175 175 175 -15 -15 -15 163 176 176 -15 -15 175 176 175 -15 165 176 176 163 -15 176 176 163 -15 -15 163 176 176 -15 -15
                        176 166 175 175 175 -15 -15 -15 165 176 166 -15 -15 175 176 177 177 176 176 253 -15 -15 176 176 163 -15 -15 163 176 176 -15 -15
                        176 163 -15 -15 -15 -15 -15 253 176 176 163 -15 -15 175 176 176 176 166 253 -15 -15 -15 176 176 163 -15 -15 163 176 176 -15 -15
                        176 176 175 163 163 163 177 176 176 177 -15 -15 -15 175 176 176 166 254 -15 -15 -15 -15 176 176 163 -15 -15 163 176 176 -15 -15
                        253 175 176 176 176 176 176 166 163 -15 -15 -15 -15 166 176 176 253 -15 -15 -15 -15 254 176 176 175 -15 -15 175 176 176 254 254
                        -15 -15 -15 254 009 009 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    )
                    (
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 163 165 175 175 175 163 009 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 165 166 176 176 176 176 176 176 176 176 175 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        175 175 254 -15 -15 -15 -15 175 175 175 -15 -15 009 176 166 163 254 -15 -15 254 163 176 176 163 -15 -15 -15 -15 -15 -15 -15 -15
                        176 176 -15 -15 -15 -15 -15 175 176 175 -15 -15 -15 163 -15 -15 -15 -15 -15 -15 -15 176 176 175 -15 -15 -15 -15 -15 -15 -15 -15
                        176 176 -15 -15 -15 -15 -15 175 176 175 -15 -15 -15 -15 -15 009 163 163 163 175 166 176 176 165 -15 -15 -15 -15 -15 -15 -15 -15
                        176 176 -15 -15 -15 -15 -15 175 176 175 -15 -15 -15 165 176 176 176 176 176 176 176 176 177 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        176 176 -15 -15 -15 -15 -15 175 176 175 -15 -15 165 176 176 176 166 175 175 163 163 009 -15 -15 -15 -15 -15 -15 -15 -15 -15 163
                        176 176 -15 -15 -15 -15 -15 175 176 175 -15 -15 176 176 166 254 -15 -15 -15 -15 -15 -15 254 -15 -15 -15 -15 -15 -15 -15 -15 163
                        176 176 009 -15 -15 -15 -15 166 176 175 -15 -15 166 176 166 -15 -15 -15 -15 -15 -15 009 177 253 -15 -15 -15 -15 -15 -15 -15 163
                        176 176 166 165 163 163 166 176 176 253 -15 -15 253 176 176 166 165 163 163 165 166 176 176 166 -15 -15 -15 -15 -15 -15 -15 175
                        253 177 176 176 176 176 176 166 163 -15 -15 -15 -15 009 175 176 176 176 176 176 176 175 163 254 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 009 009 009 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 254 009 009 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    )
                    (
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 166 175 175 175 175 175 175 175 175 175 -15 -15 166 175 175 175 175 175 175 175 175 175 163 254 175 175 163 -15 -15 163
                        -15 -15 166 175 175 175 175 175 175 166 176 175 -15 -15 166 175 175 175 176 176 166 175 175 175 163 -15 176 176 163 -15 -15 163
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 175 176 175 -15 -15 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 176 176 163 -15 -15 163
                        -15 -15 -15 -15 253 009 009 009 009 177 176 175 -15 -15 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 176 176 163 -15 -15 163
                        -15 -15 -15 -15 175 176 176 176 176 176 176 175 -15 -15 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 176 176 163 -15 -15 163
                        -15 -15 -15 -15 253 009 009 009 009 177 176 175 -15 -15 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 176 176 163 -15 -15 163
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 175 176 175 -15 -15 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 176 176 163 -15 -15 163
                        -15 009 163 163 163 163 163 163 163 166 176 175 -15 -15 -15 -15 -15 -15 176 176 163 -15 -15 -15 -15 -15 176 176 163 -15 -15 254
                        -15 009 176 176 176 176 176 176 176 176 176 166 -15 -15 -15 -15 -15 254 176 176 175 -15 -15 -15 -15 254 176 176 175 -15 -15 -15
                        -15 254 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                        -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15 -15
                    )
                )                
                (mapcar 'vector_image x y x y l)
                (setq x (mapcar '(lambda ( a ) (+ a 32)) x))
            )
            (end_image)
            (start_dialog)
        )
    )
)
;;———————————————————————————————–;;
(defun numinc:fixdir ( dir )
    (vl-string-right-trim "\" (vl-string-translate "/" "\" dir))
)
;;———————————————————————————————–;;
(defun numinc:getsavepath ( / tmp )
    (cond      
        (   (setq tmp (getvar 'roamablerootprefix))
            (strcat (numinc:fixdir tmp) "\Support")
        )
        (   (setq tmp (findfile "acad.pat"))
            (numinc:fixdir (vl-filename-directory tmp))
        )
        (   (numinc:fixdir (vl-filename-directory (vl-filename-mktemp))))
    )
)
;;———————————————————————————————–;;
(defun numinc:writedcl ( dcl / file )
    (cond
        (   (findfile dcl))
        (   (setq file (open dcl "w"))
            (foreach line
               '(
                    "//————=={ Incremental Numbering Suite }==————-//"
                    "//                                                            //"
                    "//  NumInc.dcl dialog definition file to be used in           //"
                    "//  conjunction with NumInc.lsp                               //"
                    "//————————————————————//"
                    "//  Author: Lee Mac, Copyright ?2014 – http://www.lee-mac.com&nbsp;      //"
                    "//————————————————————//"
                    ""
                    "//  –=={ Sub-Assembly Definitions }==–"
                    ""
                    "edit : edit_box"
                    "{"
                    "    edit_width = 5.0;"
                    "    alignment = centered;"
                    "    fixed_width = true;"
                    "}"
                    ""
                    "but1 : button"
                    "{"
                    "    width = 12.0;"
                    "    fixed_width = true;"
                    "    alignment = centered;"
                    "}"
                    ""
                    "but2 : button"
                    "{"
                    "    width = 19.5;"
                    "    fixed_width = true;"
                    "    alignment = centered;"
                    "}"
                    ""
                    "but3 : button"
                    "{"
                    "    width = 15.0;"
                    "    fixed_width = true;"
                    "    alignment = centered;"
                    "    fixed_height = true;"
                    "    height = 2.2;"
                    "}"
                    ""
                    "rad1 : radio_button"
                    "{"
                    "    alignment = centered;"
                    "}"
                    ""
                    "txt1 : text"
                    "{"
                    "    alignment = centered;"
                    "    fixed_width = false;"
                    "}"
                    ""
                    "txt2 : text"
                    "{"
                    "    alignment = centered;"
                    "    fixed_width = true;"
                    "    width = 8.8;"
                    "}"
                    ""
                    "txt3 : text"
                    "{"
                    "    alignment = left;"
                    "    fixed_width = false;"
                    "}"
                    ""
                    "btxt : image"
                    "{"
                    "    fixed_width = true;"
                    "    height = 1.2;"
                    "    fixed_height = true;"
                    "    color = dialog_background;"
                    "}"
                    ""
                    "ctxt : text"
                    "{"
                    "    width = 30;"
                    "    fixed_width = true;"
                    "    alignment = centered;"
                    "}"
                    ""
                    "pop1 : popup_list"
                    "{"
                    "    width = 31;"
                    "    fixed_width = true;"
                    "}"
                    ""
                    "spc1 : spacer"
                    "{"
                    "    height = 0.1;"
                    "    fixed_height = true;"
                    "    width = 0.1;"
                    "    fixed_width = true;"
                    "}"
                    ""
                    "imgbox : image_button"
                    "{"
                    "    alignment = centered;"
                    "    height = 1.5;"
                    "    aspect_ratio = 1;"
                    "    fixed_width = true;"
                    "    fixed_height = true;"
                    "    color = 1;"
                    "}"
                    ""
                    "img20b : image_button"
                    "{"
                    "    fixed_width = true;"
                    "    fixed_height = true; "
                    "    width = 3.5;"
                    "    aspect_ratio = 1.0; "
                    "}"
                    ""
                    "img32 : image"
                    "{"
                    "    fixed_width = true;"
                    "    fixed_height = true;"
                    "    width = 5.5;"
                    "    aspect_ratio = 1.0;"
                    "}"
                    ""
                    "img320 : image"
                    "{"
                    "    fixed_width = true;"
                    "    fixed_height = true;"
                    "    width = 53.5;"
                    "    aspect_ratio = 0.1;"
                    "}"
                    ""
                    "//pick : button"
                    "//{"
                    "//    label = ">>";"
                    "//    fixed_width = true;"
                    "//    fixed_height = true;"
                    "//    alignment = left;"
                    "//}"
                    ""
                    "//————————————————————//"
                    "//                    Main Dialog Definition                  //"
                    "//————————————————————//"
                    ""
                    "numinc : dialog"
                    "{"
                    "    key = "dcl";"
                    "    spacer;"
                    "    : row"
                    "    {"
                    "        : column"
                    "        {"
                    "            : toggle"
                    "            {"
                    "                alignment = left;"
                    "                key = "dyn-flg";"
                    "                label = "Text Follows Cursor";"
                    "            }"
                    "        }"
                    "        : column"
                    "        {"
                    "            : text"
                    "            {"
                    "                label = "Copyright (c) Lee Mac 2014";"
                    "                key = "aut";"
                    "                alignment = right;"
                    "            }"
                    "        }"
                    "    }"
                    "    spacer;"
                    "    : row"
                    "    {"
                    "        : column"
                    "        {"
                    "            : boxed_column"
                    "            {"
                    "                label = "Increment Format";"
                    "                width = 37;"
                    "                fixed_width = true;"
                    "                : row"
                    "                {"
                    "                    alignment = centered;"
                    "                    fixed_width = true;"
                    "                    : column"
                    "                    {"
                    "                        : edit { key =  "pre-str"; }"
                    "                        : txt2 { label = "Prefix"; }"
                    "                    }"
                    "                    : column"
                    "                    {"
                    "                        : edit { key =  "mid-str"; }"
                    "                        : txt2 { label = "Middle"; }"
                    "                    }"
                    "                    : column"
                    "                    {"
                    "                        : edit { key =  "suf-str"; }"
                    "                        : txt2 { label = "Suffix"; }"
                    "                    }"
                    "                }       "
                    "                spacer;"
                    "                : edit { label = "Increment: "; key = "inc-str"; }"
                    "                spacer;"
                    "                : boxed_column"
                    "                {"
                    "                    label = "Sections to Increment";"
                    "                    : row"
                    "                    {"
                    "                        alignment = centered;"
                    "                        fixed_width = true;"
                    "                        : toggle { label = "Prefix"; key = "inc-pre"; }"
                    "                        : toggle { label = "Middle"; key = "inc-mid"; }"
                    "                        : toggle { label = "Suffix"; key = "inc-suf"; }"
                    "                    }"
                    "                    spacer;"
                    "                }"
                    "                spacer;"
                    "            }"
                    "            : boxed_column"
                    "            {"
                    "                label = "Border Options";"
                    "                spacer;"
                    "                : toggle { key = "bor-enc"; label = "Enclose Text with: "; }"
                    "                : row"
                    "                {"
                    "                    : popup_list { key = "bor-shp"; width = 18; fixed_width = true;  }"
                    "                    : column"
                    "                    {"
                    "                        spc1;"
                    "                        : edit_box"
                    "                        {"
                    "                            edit_width = 5;"
                    "                            fixed_width = true;"
                    "                            key = "bor-sid";"
                    "                            label = "Sides:";"
                    "                        }"
                    "                        spc1;"
                    "                    }"
                    "                }"
                    "                : text { label = "Layer: "; key = "bor-ltx"; }"
                    "                : popup_list { key = "bor-lay"; }"
                    "                spacer;"
                    "                : boxed_column"
                    "                {"
                    "                    label = "Border Size";"
                    "                    : row"
                    "                    {"
                    "                        fixed_width = true;"
                    "                        alignment = centered;"
                    "                        : radio_column"
                    "                        {"
                    "                            : radio_button { key = "bor-off"; label = "  Offset:"; }"
                    "                            : radio_button { key = "bor-fix"; label = "   Fixed:"; }"
                    "                        }"
                    "                        : column"
                    "                        {"
                    "                            : edit { key = "off-ed1" ; }"
                    "                            : edit { key = "fix-ed1" ; }"
                    "                        }"
                    "                        : column"
                    "                        {"
                    "                            fixed_width = true;"
                    "                            spacer_1;"
                    "                            : text { label = " x"; key = "fix-txt"; }"
                    "                        }"
                    "                        : column"
                    "                        {"
                    "                            spacer_1;"
                    "                            : edit { key = "fix-ed2"; }"
                    "                        }"
                    "                    }"
                    "                    : row"
                    "                    {"
                    "                        fixed_width = true;"
                    "                        alignment = centered;"
                    "                        : spacer"
                    "                        {"
                    "                            height = 0.1;"
                    "                            fixed_height = true;"
                    "                            width = 11;"
                    "                            fixed_width = true;"
                    "                        }"
                    "                        : but2 { key = "bor-pik"; label = ">>"; }"
                    "                    }"
                    "                    spacer;"
                    "                }"
                    "                spacer;"
                    "            }"
                    "        }"
                    "        : column"
                    "        {"
                    "            alignment = top;"
                    "            : boxed_column"
                    "            {"
                    "                label = "Object";"
                    "                width = 37;"
                    "                fixed_width = true;"
                    "                fixed_height = true;"
                    "                : radio_row"
                    "                {"
                    "                    alignment = centered;"
                    "                    fixed_width = true;"
                    "                    : rad1 { label = "Text";  key = "obj-txt"; }"
                    "                    : rad1 { label = "MText"; key = "obj-mtx"; }"
                    "                    : rad1 { label = "Block"; key = "obj-blk"; }"
                    "                }"
                    "                : text { label = "Block:"; key = "blk-txt"; }"
                    "                : row"
                    "                {"
                    "                    fixed_width = true;"
                    "                    : pop1 { key = "blk-nme"; }"
                    "                    //: pick { key = "blk-pik"; }"
                    "                    : column"
                    "                    {"
                    "                        spc1;"
                    "                        : img20b { key = "blk-pik"; alignment = top; }"
                    "                    }"
                    "                }"
                    "                spacer;"
                    "                : text { label = "Attribute:"; key = "att-txt"; }"
                    "                : popup_list { key = "att-nme"; }"
                    "                spacer;"
                    "                : boxed_column"
                    "                {"
                    "                    label = "Block Scale";"
                    "                    : row"
                    "                    {"
                    "                        fixed_width = true; alignment = centered;"
                    "                        : edit { label = "Scale:"; key = "blk-scl"; }"
                    "                        : column"
                    "                        {"
                    "                            spc1;"
                    "                            : img20b { key = "scl-pik"; alignment = top; }"
                    "                        }"
                    "                        //: pick { key = "scl-pik"; }"
                    "                    }"
                    "                    spacer;"
                    "                    : toggle { key = "scl-var"; label = "Use System Variable:"; }"
                    "                    : popup_list { key = "scl-pop"; }"
                    "                    spacer;"
                    "                }"
                    "                spacer;"
                    "            }"
                    "            : boxed_column"
                    "            {"
                    "                label = "Array Options";"
                    "                width = 37;"
                    "                fixed_width = true;"
                    "                : row"
                    "                {"
                    "                    fixed_width = true;"
                    "                    : toggle { label = "Create Array"; key = "arr-use"; }"
                    "                    : edit { label = "Items:"; key = "arr-qty"; }"
                    "                }"
                    "                spacer;"
                    "                : boxed_column"
                    "                {"
                    "                    label = "Object Rotation";"
                    "                    : row"
                    "                    {"
                    "                        : radio_button { key = "arr-aln"; label = "Aligned"; }"
                    "                        : radio_button { key = "arr-per"; label = "Perpendicular"; }"
                    "                    }"
                    "                    : row"
                    "                    {"
                    "                        fixed_width = true;"
                    "                        : radio_button { key = "arr-oth"; label = "Other:"; }"
                    "                        : edit { key = "arr-rot"; }"
                    "                        : column"
                    "                        {"
                    "                            spc1;"
                    "                            : img20b { key = "arr-pik"; alignment = top; }"
                    "                        }"
                    "                        //: pick { key = "arr-pik"; }"
                    "                    }"
                    "                    spacer;"
                    "                }"
                    "                spacer;"
                    "            }"
                    "        }"
                    "        : column"
                    "        { "
                    "            : boxed_column"
                    "            {"
                    "                label = "Formatting";"
                    "                : text { label = "Text Layer: "; key = "lay-txt"; }"
                    "                : popup_list { key = "txt-lay"; }"
                    "                spacer;"
                    "                : text { label = "Text Style: "; key = "sty-txt"; }"
                    "                : popup_list { key = "txt-sty"; }"
                    "                spacer;"
                    "                : text { label = "Text Alignment:"; key = "aln-txt"; }"
                    "                : popup_list { key = "txt-aln"; }"
                    "                spacer;"
                    "                : boxed_column"
                    "                {"
                    "                    label = "Text Height";"
                    "                    : row"
                    "                    {"
                    "                        fixed_width = true;"
                    "                        alignment = centered;"
                    "                        : toggle { key = "txt-bst"; label = "By Style"; }"
                    "                        : edit { key = "txt-sze"; }"
                    "                        : column"
                    "                        {"
                    "                            spc1;"
                    "                            : img20b { key = "txt-pik"; alignment = top; }"
                    "                        }"
                    "                        //: pick { key = "txt-pik"; }"
                    "                    }"
                    "                    spacer;"
                    "                }"
                    "                spacer;"
                    "                : boxed_column"
                    "                {"
                    "                    label = "Background Mask";"
                    "                    width = 37;"
                    "                    fixed_width = true;"
                    "                    fixed_height = true;"
                    "                    : toggle { label = "Use Background Mask"; key = "msk-use"; }"
                    "                    spacer;"
                    "                    : boxed_column"
                    "                    {"
                    "                        label = "Mask Offset";"
                    "                        : row"
                    "                        {"
                    "                            alignment = centered;"
                    "                            fixed_width = true;"
                    "                            : edit { label = "Offset Factor:"; key = "msk-off"; }"
                    "                            : column"
                    "                            {"
                    "                                spc1;"
                    "                                : img20b { key = "msk-pik"; alignment = top; }"
                    "                            }"
                    "                            //: pick { key = "msk-pik"; }"
                    "                        }"
                    "                        spacer;"
                    "                    }"
                    "                    : boxed_column"
                    "                    {"
                    "                        label = "Fill Color";"
                    "                        : row"
                    "                        {"
                    "                            alignment = centered;"
                    "                            fixed_width = true;"
                    "                            : toggle { key = "msk-trn"; label = "Transparent"; }"
                    "                            : imgbox { key = "msk-col"; }"
                    "                        }"
                    "                        spacer;"
                    "                    }"
                    "                    spacer;"
                    "                }"
                    "                spacer;"
                    "            }"
                    "        }"
                    "    }"
                    "    spacer;"
                    "    : row"
                    "    {"
                    "        fixed_width = true;"
                    "        alignment = centered;"
                    "        spacer;"
                    "        : but1 { key = "about";  label = "About"; }"
                    "        spacer_1;"
                    "        : but3 { key = "accept"; label = "OK"; is_default = true; }"
                    "        spacer_1;"
                    "        : but1 { key = "cancel"; label = "Cancel"; is_cancel = true; }"
                    "        spacer;"
                    "    }"
                    "    spacer;"
                    "}"
                    ""
                    "//————————————————————//"
                    "//                  'About' Dialog Definition                 //"
                    "//————————————————————//"
                    ""
                    "about : dialog"
                    "{"
                    "    label = "About";"
                    "    spacer;"
                    "    //: btxt { key   = "title1"; alignment = centered; width = 31.5; }"
                    "    : img320 { key = "title1"; alignment = centered; }"
                    "    : ctxt { value = "Designed and Created by Lee Mac 2011"; }"
                    "    : button"
                    "    {"
                    "        key = "weblink";"
                    "        label = "www.lee-mac.com";"
                    "        fixed_width = true;"
                    "        alignment = centered;"
                    "        action = "(startapp \"explorer\" \"http://www.lee-mac.com\")";"
                    "    }"
                    "    : row"
                    "    {"
                    "        fixed_width = true;"
                    "        alignment = left;"
                    "        spacer;"
                    "        : img32 { key = "info1"; }"
                    "        : btxt  { width = 21.5; key = "title2"; alignment = centered; }"
                    "    }"
                    "    spacer;"
                    "    : row"
                    "    {"
                    "        fixed_width = true;"
                    "        alignment = centered;"
                    "        spacer;"
                    "        : column"
                    "        {"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "        }"
                    "        : column"
                    "        {"
                    "            : txt1 { label = "Enter" ; }"
                    "            : txt1 { label = "Click" ; }"
                    "            : txt1 { label = "<"     ; }"
                    "            : txt1 { label = ">"     ; }"
                    "            : txt1 { label = "O"     ; }"
                    "            : txt1 { label = "Tab"   ; }"
                    "            : txt1 { label = "M"     ; }"
                    "            : txt1 { label = "C"     ; }"
                    "            : txt1 { label = "R"     ; }"
                    "            : txt1 { label = "T"     ; }"
                    "            : txt1 { label = "I"     ; }"
                    "            : txt1 { label = "B"     ; }"
                    "            : txt1 { label = "A"     ; }"
                    "        }"
                    "        : column"
                    "        {"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "        }"
                    "        spacer;"
                    "        : column"
                    "        {"
                    "            : txt3 { label = "(or Space/Right-Click) Exit Program"    ; }"
                    "            : txt3 { label = "Place Object"                           ; }"
                    "            : txt3 { label = "Rotate Object Counter-Clockwise"        ; }"
                    "            : txt3 { label = "Rotate Object Clockwise"                ; }"
                    "            : txt3 { label = "Specify Object Rotation"                ; }"
                    "            : txt3 { label = "Rotate Object by 90 Degrees"            ; }"
                    "            : txt3 { label = "Mirror Object Rotation"                 ; }"
                    "            : txt3 { label = "Align Object to Curve"                  ; }"
                    "            : txt3 { label = "Replace Existing Text/Attribute String" ; }"
                    "            : txt3 { label = "Toggle Increment Counter"               ; }"
                    "            : txt3 { label = "Increment String"                       ; }"
                    "            : txt3 { label = "Rotate Polygonal Border"                ; }"
                    "            : txt3 { label = "Toggle MText Background Mask"           ; }"
                    "        }"
                    "    }"
                    "    spacer;"
                    "    : row"
                    "    {"
                    "        fixed_width = true;"
                    "        alignment = left;"
                    "        spacer;"
                    "        : img32 { key = "info2"; }"
                    "        : btxt  { width = 28; key = "title3"; alignment = centered; }"
                    "    }"
                    "    spacer;"
                    "    : row"
                    "    {"
                    "        fixed_width = true;"
                    "        alignment = centered;"
                    "        spacer;"
                    "        : column"
                    "        {"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "            : txt1 { label = "["     ; }"
                    "        }"
                    "        : column"
                    "        {"
                    "            : txt1 { label = "Enter" ; }"
                    "            : txt1 { label = "Click" ; }"
                    "            : txt1 { label = "+/-"   ; }"
                    "            : txt1 { label = "O"     ; }"
                    "            : txt1 { label = "P"     ; }"
                    "            : txt1 { label = "B"     ; }"
                    "            : txt1 { label = "A"     ; }"
                    "        }"
                    "        : column"
                    "        {"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "            : txt1 { label = "]"     ; }"
                    "        }"
                    "        spacer;"
                    "        : column"
                    "        {"
                    "            : txt3 { label = "(or Space/Right-Click) Exit Alignment"  ; }"
                    "            : txt3 { label = "Place Object"                           ; }"
                    "            : txt3 { label = "Increase/Decrease Object Offset"        ; }"
                    "            : txt3 { label = "Specify Object Offset"                  ; }"
                    "            : txt3 { label = "Toggle Object Perpendicularity"         ; }"
                    "            : txt3 { label = "Rotate Polygonal Border"                ; }"
                    "            : txt3 { label = "Toggle MText Background Mask"           ; }"
                    "        }"
                    "    }"
                    "    spacer_1;"
                    "    ok_only;"
                    "}"
                    ""
                    "//————————————————————//"
                    "//                 End of Dialog Definition                   //"
                    "//————————————————————//"
                )
                (write-line line file)
            )
            (setq file (close file))
            (while (not (findfile dcl)))
            dcl
        )
    )
)
;;———————————————————————————————–;;
(defun numinc:misc ( )
    (mapcar 'set_tile (mapcar 'vl-list->string '((100 99 108) (97 117 116)))
        (list
            (strcat
                (vl-list->string 
                   '(
                        073 110 099 114 101 109 101 110
                        116 097 108 032 078 117 109 098
                        101 114 105 110 103 032 083 117
                        105 116 101 032 086
                    )
                )
                numincversion
                (vl-list->string
                   '(
                        032 092 085 043 048 048 065 057
                        032 076 101 101 032 077 097 099
                        032
                    )
                )
                (menucmd "m=$(edtime,0,yyyy)")
            )
            (strcat
                (vl-list->string
                   '(
                        067 111 112 121 114 105 103 104
                        116 032 040 099 041 032 076 101
                        101 032 077 097 099 032
                    )
                )
                (menucmd "m=$(edtime,0,yyyy)")
            )
        )
    )
)
;;———————————————————————————————–;;
(defun numinc:tostring ( arg / dim )
    (cond
        (   (= 'int (type arg))
            (itoa arg)
        )
        (   (= 'real (type arg))
            (setq dim (getvar 'dimzin))
            (setvar 'dimzin 8)
            (setq arg (rtos arg 2 15))
            (setvar 'dimzin dim)
            arg
        )
        (   (vl-prin1-to-string arg))
    )
)
;;———————————————————————————————–;;
(defun numinc:writeconfig ( name lst / file )
    (if (setq file (open name "w"))
        (progn
            (foreach x lst (write-line (numinc:tostring x) file))
            (setq file (close file))
            t
        )
    )
)
;;———————————————————————————————–;;
(defun numinc:readconfig ( name lst / file line )
    (if
        (and
            (setq name (findfile name))
            (setq file (open name "r"))
        )
        (progn
            (foreach x lst
                (if (setq line (read-line file))
                    (set x (read line))
                )
            )
            (setq file (close file))
            t
        )
    )
)
;;———————————————————————————————–;;
(defun numinc:popup ( title flags msg / err )
    (setq err (vl-catch-all-apply 'vlax-invoke-method (list (numinc:wsh) 'popup msg 0 title flags)))
    (if (null (vl-catch-all-error-p err))
        err
    )
)
;;———————————————————————————————–;;
(defun numinc:wsh nil
    (cond (numinc:wshobject) ((setq numinc:wshobject (vlax-create-object "wscript.shell"))))
)
;;———————————————————————————————–;;
(defun numinc:makelist ( key lst )
    (start_list key)
    (foreach x lst (add_list x))
    (end_list)
)
;;———————————————————————————————–;;
(defun numinc:textincell ( lst pnt str / data dir )
    (setq dir (vlax-3D-point (trans (getvar 'viewdir) 1 0)))
    (if
        (setq data
            (vl-some
                (function
                    (lambda ( table / row col )
                        (if (= :vlax-true (vla-hittest table pnt dir 'row 'col))
                            (list table row col)
                        )
                    )
                )
                lst
            )
        )
        (not (apply 'vla-settext (append data (list str))))
    )
)
;;———————————————————————————————–;;
(defun numinc:increment ( lst inc )
    (foreach sym lst
        (if (distof (eval sym) 2)
            (set sym (numinc:incrementnumba (eval sym) inc))
            (set sym (numinc:incrementalpha (eval sym) (fix (abs (distof inc)))))
        )
    )
)
;;———————————————————————————————–;;
(defun numinc:incrementnumba ( str inc / _rtos _decimalplaces incd maxd num slen strd )
    (defun _rtos ( real prec / dimzin result )
        (setq dimzin (getvar 'dimzin))
        (setvar 'dimzin 0)
        (setq result (rtos real 2 prec))
        (setvar 'dimzin dimzin)
        result
    )
    (defun _decimalplaces ( string / pos )
        (if (setq pos (vl-string-position 46 string))
            (- (strlen string) pos 1)
            0
        )
    )
    
    (setq num (+ (distof str) (distof inc)))
    (if (minusp (distof str))
        (setq str (substr str 2))
    )
    (if (minusp (distof inc))
        (setq inc (substr inc 2))
    )
    (setq incd (_decimalplaces inc)
          strd (_decimalplaces str)
          maxd (max incd strd)
          slen (strlen str)
    )
    (cond
        (   (and (< 0 strd) (< 0 incd))
            (setq slen (+ (- slen strd) maxd))
        )
        (   (and (= 0 strd) (< 0 incd))
            (setq slen (+ incd slen 1))
        )
    )
    (setq str (_rtos num maxd))
    (if (minusp num)
        (setq str (substr str 2))
    )
    (while (< (strlen str) slen)
        (setq str (strcat "0″ str))
    )
    (if (minusp num)
        (strcat "-" str)
        str
    )
)
;;———————————————————————————————–;;
(defun numinc:incrementalpha ( str inc / _incrementalpha a )
    (defun _incrementalpha ( a b / c d e )
        (cond
            (   (cond
                    (   (< 47 (setq c (car a)) 58)
                        (setq d 48
                              e 10
                        )
                    )
                    (   (< 64 c 91)
                        (setq d 65
                              e 26
                        )
                    )
                    (   (< 96 c 123)
                        (setq d 97
                              e 26
                        )
                    )
                )
                (setq c (+ (- c d) b)
                      b (/ c e)
                )
                (cons (+ d (rem c e))
                    (if (zerop b)
                        (cdr a)
                        (if (cdr a)
                            (_incrementalpha (cdr  a) b)
                            (_incrementalpha (list d) (if (= 10 e) b (1- b)))
                        )
                    )
                )
            )
            (   (cons c
                    (if (cdr a)
                        (_incrementalpha (cdr a) b)
                        (_incrementalpha (list 65) (1- b))
                    )
                )
            )
        )
    )
    (vl-list->string
        (reverse
            (if (setq a (reverse (vl-string->list str)))
                (_incrementalpha a inc)
                (_incrementalpha '(65) (1- inc))
            )
        )
    )
)
;;———————————————————————————————–;;
        
(defun numinc:aligntocurve ( obj prp ent bor / a1 fac fl g1 g2 gr ll msg mtx p1 ur xa )
    
    (setq fac
        (if (= "AcDbBlockReference" (vla-get-objectname obj))
            (progn
                (vla-getboundingbox obj 'll 'ur)
                (/
                    (-
                        (cadr (vlax-safearray->list ur))
                        (cadr (vlax-safearray->list ll))
                    )
                    2.0
                )
            )
            (vla-get-height obj)
        )
    )
    
    (setq msg
        (princ
            (strcat
                "nClick to Align : [+/-] for [O]ffset, [P]erpendicular"
                (if (and bor (= "3″ bor-shp)) ", Rotate [B]order" "")
                (if (setq mtx (= "AcDbMText" (vla-get-objectname obj)))
                    ", B[a]ckground Mask"
                    ""
                )
            )
        )
    )
    (setq xa
        (angle '(0.0 0.0 0.0)
            (trans
                (getvar 'ucsxdir) 0
                (trans '(0.0 0.0 1.0) 1 0 t)
            )
        )
    )
    
    (while
        (progn
            (setq gr (grread t 15 0)
                  g1 (car  gr)
                  g2 (cadr gr)
            )
            (cond
                (   (member g1 '(5 3))
                    (setq p1 (vlax-curve-getclosestpointto ent (setq g2 (trans g2 1 0)))
                          a1 (angle p1 g2)
                          p1 (vlax-3D-point (polar p1 a1 (* fac crv-off)))
                          a1 (numinc:makereadable (+ a1 crv-per))
                    )
                    (if bor
                        (vla-move bor (vlax-get-property obj prp) p1)
                    )
                    (vlax-put-property obj prp p1)
                    (if bor
                        (vla-rotate bor p1
                            (- a1
                                (if mtx
                                    (+ (vla-get-rotation obj) xa)
                                    (vla-get-rotation obj)
                                )
                            )
                        )
                    )
                    (vla-put-rotation obj ((lambda ( a ) (if mtx (- a xa) a)) a1))
                    (null (setq fl (= g1 3)))
                )
                (   (= 25 g1)
                    nil
                )
                (   (= 02 g1)
                    (cond
                        (   (member g2 '(80 112))  ;; P/p
                            (setq crv-per (- (/ pi 2.0) crv-per))
                        )
                        (   (member g2 '(45 95))   ;; –
                            (setq crv-off (- crv-off 0.1))
                        )
                        (   (member g2 '(43 61))   ;; +
                            (setq crv-off (+ crv-off 0.1))
                        )
                        (   (member g2 '(13 32))   ;; Enter/Space
                            nil
                        )
                        (   (member g2 '(79 111))  ;; O/o
                            (setq crv-off
                                (/
                                    (cond
                                        (   (getdist (strcat "nSpecify offset <" (rtos (* fac crv-off)) ">: ")))
                                        (   (* fac crv-off))
                                    )
                                    fac
                                )
                            )
                            (princ msg)
                        )
                        (   (and (member g2 '(65 97)) mtx)  ;; A/a
                            (vlax-put obj 'backgroundfill
                                (setq mtx-bak (~ (vlax-get obj 'backgroundfill)))
                            )
                            (if (zerop mtx-bak)
                                (princ "n")
                                (princ "n")
                            )
                            (princ msg)
                        )
                        (   (member g2 '(66 98))  ;; B/b
                            (if (and bor (= "3″ bor-shp))
                                (progn
                                    (setq bor-rot (not bor-rot))
                                    (vla-rotate bor
                                        (vlax-3D-point (numinc:polygoncentroid bor))
                                        (/ pi bor-sid#)
                                    )
                                )
                                (princ (strcat "nInvalid keypress." msg))
                            )
                            t
                        )
                        (   (princ (strcat "nInvalid keypress." msg)))
                    )
                )
            )
        )
    )
    (redraw)
    fl  
)
;;———————————————————————————————–;;
(defun numinc:makereadable ( a )
    (   (lambda ( a )
            (if (and (< (* pi 0.5) a) (<= a (* pi 1.5)))
                (numinc:makereadable (+ a pi))
                a
            )
        )
        (rem (+ a pi pi) (+ pi pi))
    )
)
;;———————————————————————————————–;;
(defun numinc:polygoncentroid ( obj / _group )
    (defun _group ( lst )
        (if lst
            (cons (list (car lst) (cadr lst)) (_group (cddr lst)))
        )
    )
    (
        (lambda ( lst )
            (
                (lambda ( len )
                    (mapcar '/ (apply 'mapcar (cons '+ lst)) (list len len))
                )
                (length lst)
            )              
        )
        (_group (vlax-get obj 'coordinates))
    )
)
;;———————————————————————————————–;;
(defun numinc:createtextborder ( ent typ off fx1 fx2 sid / cen enx i inc lst mat pts rad rot vec )
    (setq enx (entget ent))
    (cond
        (   (setq lst (numinc:gettextbox enx off))
            (setq cen (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) (car lst) (caddr lst))
                  rot (if (= "MTEXT" (cdr (assoc 0 enx)))
                          (angle '(0. 0. 0.) (trans (cdr (assoc 11 enx)) 0 (cdr (assoc 210 enx))))
                          (cdr (assoc 50 enx))
                      )
            )
            (cond
                (   (= "0″ typ) ;; Circle
                    (entmakex
                        (list
                           '(0 . "CIRCLE")
                            (cons  010 cen)
                            (cons  040 (cond ( fx1 ) ((distance cen (car lst)))))
                            (assoc 210 enx)
                        )
                    )
                )
                (   (member typ '("1″ "2″))  ;; Rectangle / Slot
                    (if (and fx1 fx2)
                        (progn
                            (setq fx1 (/ fx1 2.0)
                                  fx2 (/ fx2 2.0)
                            )
                            (setq mat
                                (list
                                    (list (cos rot) (- (sin rot)) 0.0)
                                    (list (sin rot)    (cos rot)  0.0)
                                    (list   0.0           0.0     1.0)
                                )
                            )
                            (setq vec (mapcar '- cen (mxv mat cen)))
                            (setq lst
                                (list
                                    (list (- (car cen) fx1) (- (cadr cen) fx2))
                                    (list (+ (car cen) fx1) (- (cadr cen) fx2))
                                    (list (+ (car cen) fx1) (+ (cadr cen) fx2))
                                    (list (- (car cen) fx1) (+ (cadr cen) fx2))
                                )
                            )
                            (entmakex
                                (append
                                   '(
                                        (000 . "LWPOLYLINE")
                                        (100 . "AcDbEntity")
                                        (100 . "AcDbPolyline")
                                        (090 . 4)
                                        (070 . 1)
                                    )
                                    (list (cons 38 (caddar lst)))
                                    (apply 'append
                                        (mapcar
                                            (function
                                                (lambda ( a b )
                                                    (list (cons 10 (mapcar '+ (mxv mat a) vec)) (cons 42 b))
                                                )
                                            )
                                            lst (if (= "1″ typ) '(0.0 0.0 0.0 0.0) '(0.0 1.0 0.0 1.0))
                                        )
                                    )
                                    (list (assoc 210 enx))
                                )
                            )
                        )
                        (entmakex
                            (append
                               '(
                                    (000 . "LWPOLYLINE")
                                    (100 . "AcDbEntity")
                                    (100 . "AcDbPolyline")
                                    (090 . 4)
                                    (070 . 1)
                                )
                                (list (cons 38 (caddar lst)))
                                (apply 'append
                                    (mapcar
                                        (function
                                            (lambda ( a b ) (list (cons 10 a) (cons 42 b)))
                                        )
                                        lst (if (= "1″ typ) '(0.0 0.0 0.0 0.0) '(0.0 1.0 0.0 1.0))
                                    )
                                )
                                (list (assoc 210 enx))
                            )
                        )
                    )
                )
                (   t ;; Polygon
                    (setq inc (/ (+ pi pi) sid)
                          rad (cond ( fx1 ) ((/ (distance cen (car lst)) (cos (/ inc 2.0)))))
                            i -1
                    )
                    (if (= 1 (logand 1 sid)) (setq rot (+ rot (/ pi 2.))))
                    (repeat sid
                        (setq pts
                            (cons
                                (cons 10
                                    (polar cen (+ rot (* (setq i (1+ i)) inc)) rad)
                                )
                                pts
                            )
                        )
                    )
                    (entmakex
                        (append
                            (list
                               '(000 . "LWPOLYLINE")
                               '(100 . "AcDbEntity")
                               '(100 . "AcDbPolyline")
                                (cons 90 (length pts))
                               '(070 . 1)
                            )
                            (list (cons 38 (caddar lst)))
                            (reverse pts)
                            (list (assoc 210 enx))
                        )
                    )
                )
            )
        )
    )
)
;;———————————————————————————————–;;
;; The following function is based on code by gile
 
(defun numinc:gettextbox ( enx off / b h j l m n o p r w )
    (if
        (setq l
            (cond
                (   (= "TEXT" (cdr (assoc 0 enx)))
                    (setq b (cdr (assoc 10 enx))
                          r (cdr (assoc 50 enx))
                          l (textbox enx)
                    )
                    (list
                        (list (- (caar  l) off) (- (cadar  l) off))
                        (list (+ (caadr l) off) (- (cadar  l) off))
                        (list (+ (caadr l) off) (+ (cadadr l) off))
                        (list (- (caar  l) off) (+ (cadadr l) off))
                    )
                )
                (   (= "MTEXT" (cdr (assoc 0 enx)))
                    (setq n (cdr (assoc 210 enx))
                          b (trans  (cdr (assoc 10 enx)) 0 n)
                          r (angle '(0.0 0.0 0.0) (trans (cdr (assoc 11 enx)) 0 n))
                          w (cdr (assoc 42 enx))
                          h (cdr (assoc 43 enx))
                          j (cdr (assoc 71 enx))
                          o (list
                                (cond
                                    ((member j '(2 5 8)) (/ w -2.0))
                                    ((member j '(3 6 9)) (- w))
                                    (0.0)
                                )
                                (cond
                                    ((member j '(1 2 3)) (- h))
                                    ((member j '(4 5 6)) (/ h -2.0))
                                    (0.0)
                                )
                            )
                    )
                    (list
                        (list (- (car o)   off) (- (cadr o)   off))
                        (list (+ (car o) w off) (- (cadr o)   off))
                        (list (+ (car o) w off) (+ (cadr o) h off))
                        (list (- (car o)   off) (+ (cadr o) h off))
                    )
                )
            )
        )
        (   (lambda ( m ) (mapcar '(lambda ( p ) (mapcar '+ (mxv m p) b)) l))
            (list
                (list (cos r) (sin (- r)) 0.0)
                (list (sin r) (cos r)     0.0)
               '(0.0 0.0 1.0)
            )
        )
    )
)
;;———————————————————————————————–;;
;; Matrix x Vector – Vladimir Nesterovsky
(defun mxv ( m v )
    (mapcar (function (lambda ( r ) (apply '+ (mapcar '* r v)))) m)
)
;;———————————————————————————————–;;
(vl-load-com)
(princ)
(princ
    (strcat
        "n:: NumInc.lsp | Version "
        numincversion
        " | \U+00A9 Lee Mac "
        (menucmd "m=$(edtime,0,yyyy)")
        " http://www.lee-mac.com ::"
        "n:: Type "NumInc" to Invoke ::"
    )
)
(princ)
;;———————————————————————————————–;;
;;                                          End of File                                          ;;
;;———————————————————————————————–;;
;;———————–=={ Incremental Array }==———————-;;
;;                                                                      ;;
;;  This program will array a selection of objects, whilst incrementing ;;
;;  any numerical content found in annotation objects within the        ;;
;;  selection.                                                          ;;
;;                                                                      ;;
;;  The program has two modes of operation: standard & dynamic. The     ;;
;;  standard command: 'incarray' will not display the dynamic preview,  ;;
;;  but in turn will run faster and smoother than the dynamic version   ;;
;;  – this difference is especially significant when attempting to      ;;
;;  array a large number of objects.                                    ;;
;;                                                                      ;;
;;  The dynamic mode: 'incarrayd' will display a preview of the         ;;
;;  arrayed objects as the mouse is dragged across the screen. However, ;;
;;  due to the method used to generate this preview, this mode is only  ;;
;;  suitable when using the program to array a small number of objects. ;;
;;                                                                      ;;
;;  Upon starting the program, the user is prompted to specify an       ;;
;;  increment value and then prompted to make a selection of objects    ;;
;;  to array. This selection may include any drawing object with the    ;;
;;  exception of viewports.                                             ;;
;;                                                                      ;;
;;  Following a valid selection, the user should specify a base point   ;;
;;  and array vector relative to the base point. The angle and length   ;;
;;  of this vector will determine the direction and density of the      ;;
;;  array respectively; a shorter vector will result in a denser array. ;;
;;                                                                      ;;
;;  The array may now be generated by dragging the mouse across the     ;;
;;  screen until the array reaches a desired size. If the object        ;;
;;  selection includes Text, MText, Attribute Definitions, Dimensions,  ;;
;;  or Multileader objects, any numerical data found in the text        ;;
;;  content of these objects will be automatically incremented by the   ;;
;;  given increment value as the object is arrayed.                     ;;
;;———————————————————————-;;
;;  Author:  Lee Mac, Copyright ?2014  –  http://www.lee-mac.com&nbsp;             ;;
;;———————————————————————-;;
;;  Version 1.0    –    2011-07-27                                      ;;
;;                                                                      ;;
;;  – First Release.                                                    ;;
;;———————————————————————-;;
;;  Version 1.1    –    2011-07-29                                      ;;
;;                                                                      ;;
;;  – Fixed UCS bug by adding displacement flag to trans expressions.   ;;
;;    With thanks to Swamp user HighflyingBird for finding this.        ;;
;;———————————————————————-;;
;;  Version 1.2    –    2011-07-29                                      ;;
;;                                                                      ;;
;;  – Added non-dynamic version of the program.                         ;;
;;  – Added ability to increment Attribute Def Tags, Prompts & Text.    ;;
;;  – Improved increment functionality to retain all leading and        ;;
;;    trailing zeros.                                                   ;;
;;———————————————————————-;;
;;  Version 1.3    –    2011-08-05                                      ;;
;;                                                                      ;;
;;  – Added ability to array all objects, not just annotation objects.  ;;
;;    Any annotation objects in the selection which contain numerical   ;;
;;    data will still be incremented.                                   ;;
;;  – Attributes within arrayed attributed blocks are now incremented.  ;;
;;  – MLeader Text & Dimension Override Text are incremented.           ;;
;;———————————————————————-;;
;;  Version 1.4    –    2011-09-30                                      ;;
;;                                                                      ;;
;;  – Fixed bug when arraying attributes on locked layers.              ;;
;;———————————————————————-;;
;;  Version 1.5    –    2014-04-13                                      ;;
;;                                                                      ;;
;;  – Program completely rewritten.                                     ;;
;;  – Added prompt for increment value.                                 ;;
;;———————————————————————-;;
;;  Version 1.6    –    2014-04-13                                      ;;
;;                                                                      ;; 
;;  – Fixed variable name clash and grvecs bug present in AutoCAD 2006  ;;
;;    as reported by Swamp user CAB – many thanks.                      ;;
;;———————————————————————-;;
(defun c:incarray  nil (LM:incarray nil)) ;; Standard version
(defun c:NA nil (LM:incarray  t )) ;; Dynamic  version
;;———————————————————————-;;
(defun LM:incarray ( dyn / *error* bpt dim dis ept inc lst obl qty tmp vxu vxw )
    (defun *error* ( msg )
        (if (= 'int (type dim))
            (setvar 'dimzin dim)
        )
        (foreach obj obl
            (if (and (= 'vla-object (type obj)) (not (vlax-erased-p obj)) (vlax-write-enabled-p obj))
                (vla-delete obj)
            )
        )
        (incarray:endundo (incarray:acdoc))
        (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
            (princ (strcat "nError: " msg))
        )
        (redraw) (princ)
    )
    (if (not (and (setq inc (getenv "LMac\incarray")) (setq inc (distof inc))))
        (setq inc 1)
    )
    (if (setq tmp (getreal (strcat "nSpecify increment <" (incarray:num->str inc) ">: ")))
        (setenv "LMac\incarray" (incarray:num->str (setq inc tmp)))
    )
    (incarray:startundo (incarray:acdoc))
    (setq dim (getvar 'dimzin))
    (setvar 'dimzin 0)
    (cond
        (   (not
                (and
                    (setq lst (incarray:selection->list (ssget "_:L" '((0 . "~VIEWPORT")))))
                    (setq bpt (getpoint "nSpecify base point: "))
                    (progn
                        (while
                            (and
                                (setq vxu (getpoint "nSpecify array vector: " bpt))
                                (equal bpt vxu 1e-8)
                            )
                            (princ "nInvalid array vector.")
                        )
                        vxu
                    )
                    (setq vxu (mapcar '- vxu bpt)
                          vxw (trans vxu 1 0 t)
                          dis (distance '(0.0 0.0 0.0) vxw)
                    )
                )
            )
        )
        (   dyn
            (princ "nSpecify array end point: ")
            (while (= 5 (car (setq ept (grread t 13 0))))
                (redraw)
                (foreach obj obl (vla-delete obj))
                (setq qty (/ (caddr (trans (mapcar '- (cadr ept) bpt) 1 vxw t)) dis)
                      obl (incarray:copyvector lst (mapcar (if (minusp qty) '- '+) vxw) (abs (fix qty)) inc)
                )
                (grvecs (list -3 bpt (mapcar '(lambda ( a b ) (+ (* a qty) b)) vxu bpt)))
            )
        )
        (   (setq ept (getpoint bpt "nSpecify array end point: "))
            (setq qty (fix (/ (caddr (trans (mapcar '- ept bpt) 1 vxw t)) dis)))
            (incarray:copyvector lst (mapcar (if (minusp qty) '- '+) vxw) (abs (fix qty)) inc)
        )
    )
    (setvar 'dimzin dim)
    (incarray:endundo (incarray:acdoc))
    (redraw) (princ)
)
;;———————————————————————-;;
(defun incarray:num->str ( x / dim rtn )
    (if (= 'int (type x))
        (itoa x)
        (progn
            (setq dim (getvar 'dimzin))
            (setvar 'dimzin 8)
            (setq rtn (vl-catch-all-apply 'rtos (list x 2 15)))
            (setvar 'dimzin dim)
            (if (not (vl-catch-all-error-p rtn)) rtn)
        )
    )
)
;;———————————————————————-;;
(defun incarray:copyvector ( lst vec qty inc / cnt obj obl org )
    (setq org (vlax-3D-point 0 0)
          cnt 1
    )
    (repeat qty
        (foreach itm lst
            (setq obj (vla-copy (car itm))
                  obl (cons obj obl)
            )
            (vla-move obj org (vlax-3D-point (mapcar '* vec (list cnt cnt cnt))))
            (if (= "AcDbBlockReference" (vla-get-objectname obj))
                (mapcar
                    (function
                        (lambda ( att prp )
                            (vl-catch-all-apply 'vlax-put-property
                                (list att (car prp)
                                    (apply 'strcat
                                        (mapcar '(lambda ( x ) (incarray:increment x (* cnt inc)))
                                            (cdr prp)
                                        )
                                    )
                                )
                            )
                        )
                    )
                    (vlax-invoke obj 'getattributes)
                    (cdr itm)
                )
                (foreach prp (cdr itm)
                    (vlax-put-property obj (car prp)
                        (apply 'strcat
                            (mapcar '(lambda ( x ) (incarray:increment x (* cnt inc)))
                                (cdr prp)
                            )
                        )
                    )
                )
            )
        )
        (setq cnt (1+ cnt))
    )
    obl
)
;;———————————————————————-;;
(defun incarray:selection->list ( sel / idx lst obj obn )
    (if sel
        (repeat (setq idx (sslength sel))
            (setq obj (vlax-ename->vla-object (ssname sel (setq idx (1- idx))))
                  obn (vla-get-objectname obj)
            )
            (if (and (= "AcDbBlockReference" obn) (= :vlax-true (vla-get-hasattributes obj)))
                (setq lst
                    (cons
                        (cons obj
                            (mapcar '(lambda ( a ) (vl-list* 'textstring (incarray:splitstring (vla-get-textstring a))))
                                (vlax-invoke obj 'getattributes)
                            )
                        )
                        lst
                    )
                )
                (setq lst
                    (cons
                        (cons obj
                            (mapcar '(lambda ( p ) (vl-list* p (incarray:splitstring (vlax-get-property obj p))))
                                (cond
                                    (   (wcmatch obn "AcDb*Text,AcDbMLeader") '(textstring))
                                    (   (wcmatch obn "AcDb*Dimension")        '(textoverride))
                                    (   (= "AcDbAttributeDefinition" obn)     '(tagstring promptstring textstring))
                                )
                            )
                        )
                        lst
                    )
                )
            )
        )
    )
)
;;———————————————————————-;;
(defun incarray:splitstring ( str / lst )
    (setq lst (vl-string->list str))
    (read (vl-list->string (vl-list* 40 34 (incarray:split lst (< 47 (car lst) 58)))))
)
;;———————————————————————-;;
(defun incarray:split ( lst flg )
    (cond
        (   (null lst) '(34 41))
        (   (= 92 (car lst))
            (if flg
                (vl-list* 34 32 34 92 92 (incarray:split (cdr lst) nil))
                (vl-list* 92 92 (incarray:split (cdr lst) flg))
            )
        )
        (   (or (< 47 (car lst) 58) (and (= 46 (car lst)) flg (< 47 (cadr lst) 58)))
            (if flg
                (vl-list* (car lst) (incarray:split (cdr lst) flg))
                (vl-list* 34 32 34 (car lst) (incarray:split (cdr lst) t))
            )
        )
        (   flg (vl-list* 34 32 34 (car lst) (incarray:split (cdr lst) nil)))
        (   (vl-list* (car lst) (incarray:split (cdr lst) nil)))
    )
)
;;———————————————————————-;;
(defun incarray:increment ( str inc / dci dcs len num )
    (if (numberp (read str))
        (progn
            (setq num (+ (distof str) inc)
                  inc (incarray:num->str inc)
                  str (vl-string-left-trim "-" str)
                  inc (vl-string-left-trim "-" inc)
                  dci (incarray:decimalplaces inc)
                  dcs (incarray:decimalplaces str)
                  len (strlen str)
                  str (vl-string-left-trim "-" (rtos num 2 (max dci dcs)))
            )
            (cond
                (   (< 0 dcs) (setq len (+ (- len dcs) (max dci dcs))))
                (   (< 0 dci) (setq len (+ dci len 1)))
            )
            (repeat (- len (strlen str))
                (setq str (strcat "0″ str))
            )
            (if (minusp num)
                (strcat "-" str)
                str
            )
        )
        str
    )
)
;;———————————————————————-;;
(defun incarray:decimalplaces ( str / pos )
    (if (setq pos (vl-string-position 46 str))
        (- (strlen str) pos 1)
        0
    )
)
;;———————————————————————-;;
(defun incarray:startundo ( doc )
    (incarray:endundo doc)
    (vla-startundomark doc)
)
;;———————————————————————-;;
(defun incarray:endundo ( doc )
    (while (= 8 (logand 8 (getvar 'undoctl)))
        (vla-endundomark doc)
    )
)
;;———————————————————————-;;
(defun incarray:acdoc nil
    (eval (list 'defun 'incarray:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
    (incarray:acdoc)
)
;;———————————————————————-;;
(vl-load-com)
(princ
    (strcat
        "n:: IncArray.lsp | Version 1.6 | \U+00A9 Lee Mac "
        (menucmd "m=$(edtime,0,yyyy)")
        " http://www.lee-mac.com ::"
        "n:: "incarray" – Standard | "incarrayd" – Dynamic ::"
    )
)
(princ)
;;———————————————————————-;;
;;                             End of File                              ;;
;;———————————————————————-;;
(defun c:add(/ ss num k ed txt n numt q len @1 @2 txt1 txt2 txt3 newtxt)
 (prompt "n>> 입력수치로 숫자만 증감시키기, -기호 인식 불가,앞번호만 인식") 
 (setq ss (ssget (list (cons 0 "text,mtext"))))
 (if (not $num) (setq $num 1))
 (setq num (getint (strcat "n증가할 수치<" (rtos $num 2 0) ">:")))
 (if num (setq $num num))
 (setq k 0)
 (repeat (sslength ss)
  (setq ed (entget (ssname ss k)))
  (setq txt (cdr (assoc 1 ed)))
  (setq n 1 numt "" q 0 len (strlen txt))
  (repeat len
   (setq @1 (substr txt n 1))
   (setq @2 (ascii @1))
   (if (and (>= @2 48) (<= @2 57))
    (progn
     (setq numt (strcat numt @1))
     (setq q n)
    )
   )
   (setq n (1+ n))
  )
  (setq txt1 (substr txt 1 (- q (strlen numt))))
  (setq txt2 (rtos (+ (atof numt) $num) 2 0))
  (setq txt3 (substr txt (1+ q) (- len q)))
  (setq newtxt (strcat txt1 txt2 txt3))
  (entmod (subst (cons 1 newtxt) (assoc 1 ed) ed))
  (setq k (1+ k))
 )
(princ)
(defun c:SA(/ ss ssn a k en db1)
   (prompt "n선택순으로 문자편집 또는 <글쓰기순>:")
   (setq ss (ssget '( (-4 . "
                      (-4 . "
                      (-4 . "AND>")(-4 . "OR>")  ) ))(terpri)
   (if (= ss nil) (progn
      (prompt "n글쓰기순으로 문자편집하기…")
      (setq ss (ssget '((0 . "TEXT,MTEXT"))))
      (setq ssnew (@ss_new_lst ss))
      (setq ss ssnew)  )
   )
   (prompt "nSpace Bar입력=>전단계 편집상태로 돌아감…")
   (setq ssn (sslength ss))
   (setq k 0)
   (while (< k ssn)
      (setq en (ssname ss k))
      (setq tem (cdr (assoc 0 (entget en))))
      (if (= tem "TEXT") (redraw en 3))
      (command "ddedit" en "")
      (setq db1 (cdr (assoc 1 (entget en))))
      (if (and (> k 0) (= db1 " "))
         (progn (command "u") (setq k (- k 2))))
      (if (= tem "TEXT") (redraw en 4))
      (setq k (+ k 1))
   )
(prin1))
(defun C:TC (/ dec ent ed ena otex var ss k ed1)
 (princ " n>> 문자 내용 동일화 (Text All Same…)")
 (princ "n선택된 문자를 모두 동일한 문자 내용으로 변경합니다!")
 (setq dec (getvar "dimdec"))
 (if (setq ent (entsel "nOriginal object select:"))
  (progn (redraw (car ent) 3)
   (setq ed (entget (car ent))) 
   (setq ena (cdr (assoc 0 ed)))
   (cond ((or (= ena "TEXT") (= ena "MTEXT")) (setq otex (assoc 1 ed)))
         ((= ena "DIMENSION") 
          (setq var (cdr (assoc 1 ed)))
          (if (= var "") 
           (setq otex (cons 1 (rtos (cdr (assoc 42 ed)) 2 dec)))
           (setq otex (assoc 1 ed))
          )
         )
   )
   (princ "nAlteration object select:")
   (if (setq ss (ssget (list (cons 0 "text,mtext,dimension"))))
    (progn (setq k 0) 
     (repeat (sslength ss) 
      (setq ed1 (entget (ssname ss k)))
      (entmod (subst otex (assoc 1 ed1) ed1))
      (setq k (1+ k))
     ) ;repeat
    );progn
   );if
  (redraw (car ent) 4)
  );progn
 );if
(princ) 
)
;                                                      
; 선택한 객체의 문자,치수,블럭내문자,블럭내치수를 삭제 
;Text Sellect Delete
(defun delblock ( e / obj blname blocks blobj ee een eename item )
  (setq obj (vlax-ename->vla-object e))
  (setq blname (vla-get-name obj))
  (setq blocks (vla-get-blocks doc))
  (setq blobj (vla-item blocks blname))
  (vlax-for item blobj
    (setq ee (vlax-vla-object->ename item))
    (setq een (entget ee))
    (setq eename (cdr (assoc 0 een)))
    (if (or (= eename "TEXT") (= eename "MTEXT") (= eename "LEADER") (= eename "MULTILEADER") (= eename "DIMENSION")) (vla-delete item))
  )
)
(defun c:td ( / ss doc index e en ename )
  (if (setq ss (ssget (list (cons 0 "TEXT,MTEXT,DIMENSION,LEADER,MULTILEADER,INSERT"))))
    (progn
      (setq doc (vla-get-activedocument (vlax-get-acad-object)))
      (vla-startundomark doc)
      (setq index 0)
      (repeat (sslength ss)
(setq e (ssname ss index))
(setq en (entget e))
(setq ename (cdr (assoc 0 en)))
(cond
  ((or (= ename "TEXT") (= ename "MTEXT") (= ename "LEADER") (= ename "MULTILEADER") (= ename "DIMENSION")) (entdel e))
  ((= ename "INSERT") (delblock e))
)
(setq index (1+ index))
      )
      (vla-regen doc acAllViewports)
      (vla-endundomark doc)
    )
  )
  (princ)
)
(vl-load-com)
;(prompt "n[ EB ]")
(princ)
(defun c:TW (/ ss obj1 obj2 str1 str2) ; 명령어 본인이 원하는 단어로 바꾸어서 사용할수 도 있어요
        (prompt " ………문자열 1:1 맞교환하기…   A <-> B   선택문자가 2개인 경우만 1:1 맞교환됨 ")
  (if (and
(setq ss (ssget '((0 . "TEXT")))) ;문자를 선택해라
(= (sslength ss) 2) ;선택한 문자가 두개일경우만 실행시켜라
(setq obj1 (vlax-ename->vla-object (ssname ss 0)))
(setq obj2 (vlax-ename->vla-object (ssname ss 1)))
(setq str1 (vla-get-textstring obj1))
(setq str2 (vla-get-textstring obj2))
      )
      (progn
(vla-put-textstring obj1 str2)
(vla-put-textstring obj2 str1)
      )
  )
)
(defun c:fa(/ ss len)
 (setq name(getstring t "n검색하실 블럭이름:"))
 (setq ss(ssget "x" (list (cons -4 ""))))
 (setq len (sslength ss))
 (princ (strcat "n" name "의 갯수="))(princ len)(princ)
)
(defun c:bv(/ ss k ss1 ed1 bn1 en ed bn k bco)
  (setq ss (ssget (list (cons 0 "insert"))))
  (setq k 0 ss1 nil bco 0)
  (while (= ss1 nil)
    (setq ss1 (entsel "n블록을 선택해주세요 :"))
  );while
  (setq ed1 (entget (car ss1))
        bn1 (cdr (assoc 2 ed1))) 
  (repeat (sslength ss)
    (setq en (ssname ss k) 
          ed (entget en))
    (setq bn (cdr (assoc 2 ed)))
    (if (= bn bn1) (setq bco (1+ bco)))
    (setq k (1+ k))
   );repeat
   (princ "n블록 ")(princ bn1)(princ " 는 총 ")(princ bco)(princ " 개 입니다.")
(princ)
)
(defun c:ww(/ ss n k en cly oly) ;켜고 싶은 레이어만 선택하여 킨다.
   (prompt "nCommand: select Preeze…")
   (prompt "n켤 레이어만을 선택-> ")
   (setq ss (ssget))
   (setq n (sslength ss))
   (setq k 0)
   (setq cly (cdr (assoc 8 (entget (ssname ss (1- n))))))
   (command "layer" "s" cly "")
   (command "layer" "off" "*" "" "")
   (while (<= 1 n)
       (setq en (ssname ss k))
       (setq oly (cdr (assoc 8 (entget en))))
       (command "layer" "on" oly "")
       (setq n (- n 1))
       (setq k (+ k 1))
    )
    (princ)
)
(DEFUN C:cen (/ A b c D E F)
                 (setvar "osmode" 1715)
                 (setq b (getpoint "n Point first point"))
                 (setq n (getpoint b "Wn Select second point"))
                 (setq l1 (car b))
                 (setq m1 (cadr b))
                 (setq l2 (car n))
                 (setq m2 (cadr n))
                 (SETQ A (sqrt (+ (expt (- l1 l2) 2) (expt (- m1 m2) 2))))
                 (setq o (list (/ (+ l1 l2) 2) (/ (+ m1 m2) 2)))
                 (setq c (/ a 2))
                 (SETQ D (ENTSEL))
                 (setvar "osmode" 0)
                 (command cancel cancel "offset" c D o cancel)
                 (SETQ E (ENTLAST))
                 (SETQ F (SSADD))
                 (SETQ G (SSADD E F))
                 (SETQ H (ASSOC 10 (ENTGET E)))
   (SETQ I (CADR H))
                 (SETQ J (CADDR H))
                 (SETQ H (ASSOC 11 (ENTGET E)))
   (SETQ L (CADR H))
                 (SETQ M (CADDR H))
                 (SETQ K (LIST (/ (+ I L) 2) (/ (+ M J) 2))) 
                 (COMMAND "CHPROP" G "" "la" "3″ "COLOR" "BYLAYER" "LTYPE" "BYLAYER" "")
                 (COMMAND "CHPROP" G "" "la" "3″ "COLOR" "BYLAYER" "LTYPE" "BYLAYER" "")
                 (SETVAR "OSMODE" 0)
                 (COMMAND "SCALE" G "" K "1.50″)
                 (SETVAR "OSMODE" 5303))
————————————————————————-
(defun dtr (a)  (* pi (/ a 180.0)))
;;텍스트 일괄 정렬 리습————————
(defun c:TL (/ a ap kw sty ss1 index elist a10 a11 a11n new a72 a10n b)
  (defun errhand (err)
    (if (/= err "Function cancelled")
      (princ (strcat "nError: " err)))
    (setvar "cmdecho" 1)
    (setq *error* nil)
    (princ)
  )
  (setvar "cmdecho" 0)
  (setq *error* errhand)
  (setq a (strcat "nAlignment point" (if *ap '" : " '": ")))
  (setq ap (getpoint a))
  (setq a "nJustification – Left/Center/Middle/Right : ")
  (initget "Left Center Middle Right")
  (setq kw (getkword a))
  (cond ((= kw "Left")   (setq sty (cons 72 0)))
        ((= kw "Center") (setq sty (cons 72 1)))
        ((= kw "Middle") (setq sty (cons 72 4)))
        ((= kw "Right")  (setq sty (cons 72 2)))
        (t (setq sty nil))
  )
  (prompt "Select text… ")
  (setq ss1 (ssget '((0 . "TEXT")) ))
  (setq index 0)
  (repeat (sslength ss1)
    (setq elist (entget (ssname ss1 index)))
    (if (or (= (cdr (assoc 50 elist)) 0.0)
            (= (cdr (assoc 50 elist)) (dtr 90)) )
      (progn
        (if (/= sty nil)
          (progn
            (setq a10 (assoc 10 elist))
            (setq a11 (assoc 11 elist))
            (setq a11n (cons 11 (cdr a10)))
            (setq new (subst a11n a11 elist))
            (setq a72 (assoc 72 elist))
            (setq elist (subst sty a72 new))
        ))
        (setq a10 (assoc 10 elist))
        (setq a11 (assoc 11 elist))
        (if (equal ap nil)
          (setq ap *ap)
        )
        (if (= (cdr (assoc 50 elist)) 0.0)
          (setq *ap (list (car ap) (cadr (cdr a10))))
          (setq *ap (list (car (cdr a10)) (cadr ap)))
        )
        (setq a10n (cons 10 *ap))
        (setq a11n (cons 11 *ap))
        (if (equal (assoc 72 elist) (cons 72 0))
          (setq new (subst a10n a10 elist))
          (setq new (subst a11n a11 elist))
        )
        (entmod new)
      )
      (if (and (= (cdr (assoc 0 elist)) "TEXT") (= b nil))  (progn
        (princ "nCannot ALIGN non-horizontal or non-vertical text")
        (setq b T)
      ))
    )
    (setq index (1+ index))
  );;repeat
  (setvar "cmdecho" 1)
  (setq *error* nil)
  (prin1)
)
;*********************************************
; 원이나 사각형안에 순서대로 번호 쓰기
;*********************************************
(DEFUN C:BCN(/
            sn      cbn     th      txth
            num     pnt     txt     bh    addnum
)
  (defun SETERR(s)
    (if (/= s "Function cancelled")
        (princ (strcat "nError: " s))
    ); of If
    (setq *error* oer seterr nil)
    (princ)
  ); of SETERR
  (setq oer *error* *error* seterr)                 ;릟툃킕쒊엨鉀 늏빓
  (setvar "cmdecho" 0)
  (setq sn (getint "nStart Number : "))            ;?퇬츜퇫
  ;(setq sn 1)
  (setq addnum (getint "nAdd Number: "))           ;퍆쫭츜퇫
  (initget "Box Circle None")
  (setq cbn (getkword "nBox/Circle/: "))
  (setq th (getvar "textsize"))
  (princ "nPick text/Text height<")
  (princ th)
  (initget "Pick")
  (setq txth (getdist ">: "))
  (cond
      ((= txth nil) (setq txth th))
      ((= txth "Pick")
          (progn
              (setq txth (cdr (assoc 40 (entget (car (entsel "Pick text"))))))
              (princ "Text height is ")
              (princ txth)
          ) ;of progn
      ) ;of cond txth="Pick"
  ) ;of cond
  (setq num sn)
  (princ "nNumber ")
  (princ num)
  (initget "Change")
  (while (setq pnt (getpoint ", ChangeNum/: "))
      (if (= pnt "Change")
          (setq num (getint "Enter New Number"))
          (progn
              (setq txt (itoa num))
              (command "text" "j" "m" pnt txth "0″ TXT)
              (setq bh (* 1.2 txth))
              (cond
                  ((= cbn "Circle") (command "CIRCLE" pnt bh))
                  ((= cbn "Box")
                      (progn
                          (setq lu (list (- (car pnt) bh) (+ (cadr pnt) bh)))
                          (setq ru (list (+ (car pnt) bh) (+ (cadr pnt) bh)))
                          (setq rl (list (+ (car pnt) bh) (- (cadr pnt) bh)))
                          (setq ll (list (- (car pnt) bh) (- (cadr pnt) bh)))
                          (command "pline" lu ru rl ll "c")
                      ) ;of progn
                  ) ;of cond cbn="Box"
              ) ;of cond
;              (setq num (+ num 1))                 ;1쟢? 붳?
              (setq num (+ num addnum))             ;퍆쫭쟢? 붳?
          ) ;of progn
      ) ;of if pnt="Change"
      (princ "nNumber")
      (princ num)
      (initget "Change")
  ) ; of while
  (setq *error* oer seterr nil)                     ;킕쒊엨鉀 ⅱ듻
  (princ)
);;; End of program
(defun c:test( / kw str block bn nbn)
(setvar "cmdecho" 0)
(if
(progn
(initget 0 "F B")
(setq kw (cond ((getkword "n추가할 위치 선택 [전(F)/후(B)] <후>:")) ("B")))
(/= (setq str (getstring "n추가할 문자 입력:")) "")
)
(progn
(setq block (tblnext "block" T))
(while block 
(and
(/= (substr (setq bn (cdr (assoc 2 block))) 1 1) "*")
(setq nbn (cond ((= kw "F") (strcat str bn)) ((= kw "B") (strcat bn str))))
(not (tblsearch "block" nbn))
(command "rename" "b" bn nbn)
)
(setq block (tblnext "block"))
)
)
)
(princ)
)
================================================================================
;;; FLATTEN.LSP version 2k.01f, 14-Jul-2000
;;;
;;; FLATTEN sets the Z-coordinates of these types of objects to 0
;;; in the World Coordinate System:
;;;  "3DFACE" "ARC" "ATTDEF" "CIRCLE" "DIMENSION" 
;;;  "ELLIPSE" "HATCH" "INSERT" "LINE" "LWPOLYLINE"
;;;  "MTEXT" "POINT" "POLYLINE" "SOLID" "TEXT"
;;;
;;;———————————————————————–
;;; copyright 1990-2000 by Mark Middlebrook
;;;   Daedalus Consulting
;;;   e-mail: mark@markcad.com
;;;
;;; Before you e-mail me with support questions, please make sure that
;;; you're using the current version. You can download it from
;;;
;;; This program is free software. You can redistribute it and/or modify 
;;; it under the terms of the GNU General Public License as published by 
;;; the Free Software Foundation: http://www.gnu.org/copyleft/gpl.html.&nbsp;
;;;
;;; Thanks to Vladimir Livshiz for improvements in polyline handling
;;; and the addition of several other object types.
;;;
;;;———————————————————————–
;;; Revision history
;;;  v. 2k.0   25-May-1999  First release for AutoCAD 2000.
;;;  v. 2k.01  25-Jun-1999  Fixed two globalization bugs ("_World" & "_X")
;;;                         and revised error handler.
;;;  v. 2k.01f 14-Jul-1999  Added GNU GPL and download info to header.
;;;
;;;———————————————————————–
;;;*Why Use FLATTEN?
;;;
;;; FLATTENing is useful in at least two situations:
;;;  1) You receive a DXF file created by another CAD program and discover
;;;     that all the Z coordinates contain small round-off errors. These
;;;     round-off errors can prevent you from object snapping to
;;;     intersections and make your life difficult in other ways as well.
;;;  2) In a supposedly 2D drawing, you accidentally create one object with
;;;     a Z elevation and end up with a drawing containing objects partly
;;;     in and partly outside the Z=0 X-Y plane. As with the round-off
;;;     problem, this situation can make object snaps and other procedures
;;;     difficult.
;;;
;;; Warning: FLATTEN is not for flattening the custom objects created by
;;; applications such as Autodesk's Architectural Desktop. ADT and similar
;;; programs create "application-defined objects" that only the
;;; application really knows what to do with. FLATTEN has no idea how
;;; to handle application-defined objects, so it leaves them alone.
;;;
;;;———————————————————————–
;;;*How to Use FLATTEN
;;;
;;; This version of FLATTEN works with AutoCAD R12 through 2000.
;;;
;;; To run FLATTEN, load it using AutoCAD's APPLOAD command, or type:
;;;   (load "FLATTEN")
;;; at the AutoCAD command prompt. Once you've loaded FLATTEN.LSP, type:
;;;   FLATTEN
;;; to run it. FLATTEN will tell you what it's about to do and ask you
;;; to confirm that you really want to flatten objects in the current
;;; drawing. If you choose to proceed, FLATTEN prompts you to select objects
;;; to be flattened (press ENTER to flatten all objects in the drawing).
;;; After you've selected objects and pressed ENTER, FLATTEN goes to work.
;;; It reports the number of objects it flattens and the number left
;;; unflattenened (because they were objects not recognized by FLATTEN; see 
;;; the list of supported objects above).
;;;
;;; If you don't like the results, just type U to undo FLATTEN's work.
;;;
;;;———————————————————————–
;;;*Known limitations
;;;  1) FLATTEN doesn't support all of AutoCAD's object types. See above
;;;     for a list of the object types that it does work on.
;;;  2) FLATTEN doesn't flatten objects nested inside of blocks.
;;;     (You can explode blocks before flattening. Alternatively, you can
;;;     WBLOCK block definitions to separate DWG files, run FLATTEN in
;;;     each of them, and then use INSERT in the parent drawing to update
;;;     the block definitions. Neither of these methods will flatten
;;;     existing attributes, though.
;;;  3) FLATTEN flattens objects onto the Z=0 X-Y plane in AutoCAD's
;;;     World Coordinate System (WCS). It doesn't currently support
;;;     flattening onto other UCS planes.
;;;
;;;=======================================================================
(defun C:FLATTEN (/       tmpucs  olderr  oldcmd  zeroz   ss1     ss1len
                  i       numchg  numnot  numno0  ssno0   ename   elist
                  etype   yorn    vrt     crz
                 )
  (setq tmpucs "$FLATTEN-TEMP$")        ;temporary UCS
  ;;Error handler
  (setq olderr *error*)
  (defun *error* (msg)
    (if (or
          (= msg "Function cancelled")
          (= msg "quit / exit abort")
        )
      ;;if user cancelled or program aborted, exit quietly
      (princ)
      ;;otherwise report error message
      (princ (strcat "nError: " msg))
    )
    (setq *error* olderr)
    (if (tblsearch "UCS" tmpucs)
      (command "._UCS" "_Restore" tmpucs "._UCS" "_Delete" tmpucs)
    )
    (command "._UNDO" "_End")
    (setvar "CMDECHO" oldcmd)
    (princ)
  )
  ;;Function to change Z coordinate to 0
  (defun zeroz (key zelist / oplist nplist)
    (setq oplist (assoc key zelist)
          nplist (reverse (append '(0.0) (cdr (reverse oplist))))
          zelist (subst nplist oplist zelist)
    )
    (entmod zelist)
  )
  ;;Setup
  (setq oldcmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (command "._UNDO" "_Group")
  (command "._UCS" "_Delete" tmpucs "._UCS" "_Save" tmpucs "._UCS" "_World")
                                        ;set World UCS
  ;;Get input
  (prompt
    (strcat
      "nFLATTEN sets the Z coordinates of most objects to zero."
    )
  )
  (initget "Yes No")
  (setq yorn (getkword "nDo you want to continue : "))
  (cond ((/= yorn "No")
         (graphscr)
         (prompt "nChoose objects to FLATTEN ")
         (prompt
           "[press return to select all objects in the drawing]"
         )
         (setq ss1 (ssget))
         (if (null ss1)                 ;if enter…
           (setq ss1 (ssget "_X"))      ;select all entities in database
         )
         ;;*initialize variables
         (setq ss1len (sslength ss1)    ;length of selection set
               i      0                 ;loop counter
               numchg 0                 ;number changed counter
               numnot 0                 ;number not changed counter
               numno0 0                 ;number not changed and Z /= 0 counter
               ssno0  (ssadd)           ;selection set of unchanged entities
         )                              ;setq
         ;;*do the work
         (prompt "nWorking.")
         (while (< i ss1len)            ;while more members in the SS
           (if (= 0 (rem i 10))
             (prompt ".")
           )
           (setq ename (ssname ss1 i)   ;entity name
                 elist (entget ename)   ;entity data list
                 etype (cdr (assoc 0 elist)) ;entity type
           )
           ;;*Keep track of entities not flattened
           (if (not (member etype
                            '("3DFACE"     "ARC"        "ATTDEF"
                              "CIRCLE"     "DIMENSION"  "ELLIPSE"
                              "HATCH"      "INSERT"     "LINE"
                              "LWPOLYLINE" "MTEXT"      "POINT"
                              "POLYLINE"   "SOLID"      "TEXT"
                             )
                    )
               )
             (progn                     ;leave others alone
               (setq numnot (1+ numnot))
               (if (/= 0.0 (car (reverse (assoc 10 elist))))
                 (progn                 ;add it to special list if Z /= 0
                   (setq numno0 (1+ numno0))
                   (ssadd ename ssno0)
                 )
               )
             )
           )
           ;;Change group 10 Z coordinate to 0 for listed entity types.
           (if (member etype
                       '("3DFACE"    "ARC"       "ATTDEF"    "CIRCLE"
                         "DIMENSION" "ELLIPSE"   "HATCH"     "INSERT"
                         "LINE"      "MTEXT"     "POINT"     "POLYLINE"
                         "SOLID"     "TEXT"
                        )
               )
             (setq elist  (zeroz 10 elist) ;change entities in list above
                   numchg (1+ numchg)
             )
           )
           ;;Change group 11 Z coordinate to 0 for listed entity types.
           (if (member etype
                       '("3DFACE" "ATTDEF" "DIMENSION" "LINE" "TEXT" "SOLID")
               )
             (setq elist (zeroz 11 elist))
           )
           ;;Change groups 12 and 13 Z coordinate to 0 for SOLIDs and 3DFACEs.
           (if (member etype '("3DFACE" "SOLID"))
             (progn
               (setq elist (zeroz 12 elist))
               (setq elist (zeroz 13 elist))
             )
           )
           ;;Change groups 13, 14, 15, and 16
           ;;Z coordinate to 0 for DIMENSIONs.
           (if (member etype '("DIMENSION"))
             (progn
               (setq elist (zeroz 13 elist))
               (setq elist (zeroz 14 elist))
               (setq elist (zeroz 15 elist))
               (setq elist (zeroz 16 elist))
             )
           )
           ;;Change each polyline vertex Z coordinate to 0.
           ;;Code provided by Vladimir Livshiz, 09-Oct-1998
           (if (= etype "POLYLINE")
             (progn
               (setq vrt ename)
               (while (not (equal (cdr (assoc 0 (entget vrt))) "SEQEND"))
                 (setq elist (entget (entnext vrt)))
                 (setq crz (cadddr (assoc 10 elist)))
                 (if (/= crz 0)
                   (progn
                     (zeroz 10 elist)
                     (entupd ename)
                   )
                 )
                 (setq vrt (cdr (assoc -1 elist)))
               )
             )
           )
           ;;Special handling for LWPOLYLINEs
           (if (member etype '("LWPOLYLINE"))
             (progn
               (setq elist  (subst (cons 38 0.0) (assoc 38 elist) elist)
                     numchg (1+ numchg)
               )
               (entmod elist)
             )
           )
           (setq i (1+ i))              ;next entity
         )
         (prompt " Done.")
         ;;Print results
         (prompt (strcat "n" (itoa numchg) " object(s) flattened."))
         (prompt
           (strcat "n" (itoa numnot) " object(s) not flattened.")
         )
         ;;If there any entities in ssno0, show them
         (if (/= 0 numno0)
           (progn
             (prompt (strcat "  ["
                             (itoa numno0)
                             " with non-zero base points]"
                     )
             )
             (getstring
               "nPress enter to see non-zero unchanged objects… "
             )
             (command "._SELECT" ssno0)
             (getstring "nPress enter to unhighlight them… ")
             (command "")
           )
         )
        )
  )
  (command "._UCS" "_Restore" tmpucs "._UCS" "_Delete" tmpucs)
  (command "._UNDO" "_End")
  (setvar "CMDECHO" oldcmd)
  (setq *error* olderr)
  (princ)
)
(prompt
  "nFLATTEN version 2k.01f loaded.  Type FLATTEN to run it."
)
(princ)
;;;eof

관련자료

댓글 1 / 1 페이지

수야12님의 댓글

어후 길다  이거 드래그 하다 힘들어서 포기.. 

캐드에서는 오류메세지가 뭐라고 뜨던가요?? 
전체 7,152 / 1 페이지
번호
제목
이름

최근글


새댓글


알림 0