Thư viện xây dựng: Tiêu chuẩn xây dựng- Văn bản- File mẫu- Sơ đồ- Quy trình- Phần mềm xây dựng

Tiêu đề: Bộ AutoLISP Do kts. Trần Ngọc Thắng TỰ BIÊN SOẠN + SƯU TẦM [In trang]

Tác giả: TranNgocThang76    Thời gian: 12/5/2025 18:11
Tiêu đề: Bộ AutoLISP Do kts. Trần Ngọc Thắng TỰ BIÊN SOẠN + SƯU TẦM
  1. ********************************************************************************
    - R) V& `2 ^9 t$ U3 P8 d/ F- c
  2. *             ACADLISP FOR AUTOCAD R.14 -> AUTOCAD R.2012                      *; v& E8 C* {& K7 d9 K& E
  3. *         Tran Ngoc Thang DHXD-HaNoi41 from years 1999 -> 2015                 *1 E) ^! a! e3 P' `
  4. *                         Suu tam & Soan                                       *
    5 e+ |+ F% o. F
  5. ********************************************************************************
    . G6 x; h" ~5 B

  6. ; A5 n. O0 z" r7 N
  7. ; Next available MSG number is  1046 T, K' I- h0 Z& ]2 X6 i4 X
  8. ; MODULE_ID ACAD2000doc_LSP_
    : d6 P- G6 F4 N; ^! ^
  9. ;;;    ACAD2000DOC.LSP Version 1.0 for AutoCAD 2000+ Z9 \- a& b9 t* D# s  v2 s' M- o
  10. ;;;2 H- s! F) h& f9 ~) y
  11. ;;;    Copyright (C) 1994 - 1999 by Autodesk, Inc.& j0 i) N6 l( U7 I
  12. ;;;
    3 A% i( o2 E! j; l
  13. ;;;    Permission to use, copy, modify, and distribute this software
    + r( W) V- o7 F' Q4 V2 q2 i: s
  14. ;;;    for any purpose and without fee is hereby granted, provided
    $ l( F/ Y7 p4 C* G- f) Y$ Y
  15. ;;;    that the above copyright notice appears in all copies and
    0 @7 J8 A! |* R0 `- y
  16. ;;;    that both that copyright notice and the limited warranty and+ Q; }3 L) U8 T- _' g' ]
  17. ;;;    restricted rights notice below appear in all supporting
    3 f  R3 D: b( Z1 d
  18. ;;;    documentation.- _1 O$ j% n  ~- F% }- b! M4 ]$ O
  19. ;;;9 E: Z. w2 q0 J2 M# z- ?
  20. ;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
    + U8 w/ p6 p5 W. p' n1 g% A4 F! {
  21. ;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF; A: ]: V4 j* d. V, D
  22. ;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.  M. F7 {2 _% @- \4 l; G  _# ?
  23. ;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
    4 H9 M4 \, z! z. N9 _9 Q! u
  24. ;;;    UNINTERRUPTED OR ERROR FREE.: _( e9 q+ Z, @6 V
  25. ;;;" C. Y7 J: G# Z7 W2 U, Z( P5 h! ^8 U
  26. ;;;    Use, duplication, or disclosure by the U.S. Government is subject to
    2 j6 E6 h  `3 L6 }
  27. ;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer7 b% Z+ Q1 n; t$ ~8 b5 E2 d+ l. p
  28. ;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) $ h8 ^" r* @! l+ S; \
  29. ;;;    (Rights in Technical Data and Computer Software), as applicable.4 r% E( Y: K4 R+ T$ `
  30. ;;;" H% c3 U6 ~4 M7 C
  31. ;;;.
    . f: e, O$ d+ s( x8 X8 K, A
  32. ;;;3 B2 d; w2 _' B$ K. }
  33. ;;;    Note:
      P$ ^" h6 J- e3 _6 k# u
  34. ;;;            This file is loaded automatically by AutoCAD every time
    , b1 x0 L  K) H! M( g
  35. ;;;            a drawing is opened.  It establishes an autoloader and
    ! H% }, Y; D+ ^
  36. ;;;            other utility functions.
    6 ]$ S8 f9 z* W
  37. ;;;
    ) K% `1 Y' w0 P8 k. t) W
  38. ;;;    Globalization Note:   + S9 Z; M* K! L3 i% H/ o6 a
  39. ;;;            We do not support autoloading applications by the native
    ( }8 G) \$ j. J1 s1 c6 E( a! r
  40. ;;;            language command call (e.g. with the leading underscore) ?( X; C) a, N* @* Z, N
  41. ;;;            mechanism.)% K) O. p' Y5 _8 U9 u4 V0 U/ `

  42. ' T+ g  ~& k: Z1 I$ D; N

  43. $ h* i7 k; s6 |# I1 q
  44. ;;;===== Raster Image Support for Clipboard Paste Special =====
    7 B: o5 n; a0 b3 v
  45. ;;
    # w; d/ b- K" D+ L# ~
  46. ;; IMAGEFILE
    5 l9 y0 u  B6 b9 M0 K5 s, e
  47. ;;( M9 ^( x2 x* M! }9 {" f! ^
  48. ;; Allow the IMAGE command to accept an image file name without, p- o7 }& |( T: n) a/ a% C, H
  49. ;; presenting the file dialog, even if filedia is on.# i: m  d, ?4 V4 G
  50. ;; Example: (imagefile "c:/images/house.bmp")
    : ]$ m4 i, G! E" o2 P% O
  51. ;;- {* K3 U( U, ~" j- F' ~9 y! |
  52. (defun imagefile (filename / filedia-save cmdecho-save)
    8 x0 H' L7 F" f7 u7 n" ]5 g
  53.   (setq filedia-save (getvar "FILEDIA"))
    ; n+ V( `' q" `9 b) w6 ~0 U8 M& S8 Q( Z
  54.   (setq cmdecho-save (getvar "CMDECHO"))4 Y' s! A$ X. ^' \( c; |* w+ o
  55.   (setvar "FILEDIA" 0)
    . C* M5 v6 \0 }  q
  56.   (setvar "CMDECHO" 0)
    . Q! X! K1 m, D" g& |
  57.   (command "_.-image" "_attach" filename)* o( @7 J$ q6 M; n! S
  58.   (setvar "FILEDIA" filedia-save)
    4 K  x* h  V1 L/ U$ A9 P
  59.   (setvar "CMDECHO" cmdecho-save)6 x( E& G1 ]4 ~
  60.   (princ)
    ( r% @* h+ M  k
  61. )8 C' Z' W* m' d0 o

  62. ' V4 ~4 a7 ], d
  63. (defun c:zx () (command "zoom" ".5x"))
    4 Q, B7 j& D4 e* V) T
  64. (defun c:zz () (command "zoom" "p"))
    4 R8 t# ~$ C9 E+ s
  65. (defun c:za () (command "zoom" "a"))
    $ Q# d5 J4 f* t: p& u0 Q3 t
  66. (defun c:zd () (command "zoom" "d"))/ d- h. t* H4 I5 C( D: k# w) r1 e
  67. (defun c:ze () (command "zoom" "e"))
    - }7 Z+ e1 m! i) B8 i( Y. c: `; [
  68. (defun c:zr () (command "zoom" "" "")); c: ?8 j6 X9 U6 x2 v, K; D' A% e6 Z
  69. (defun c:vv () (command "ucs" "v"))( L1 L6 j) Y- W2 m$ D7 L* z
  70. (defun c:co () (ssget) (command "copy" "p" "" "m")): x9 L# a$ Q4 h, u+ E6 e
  71. (defun c:c () (command "circle"))
    6 I( x4 `# u' i& _
  72. (defun c:rt () (command "rotate"))
    + A6 ?# B. ]+ D& ^3 c
  73. (defun c:3q () (ssget) (command "_rotate3d" "ANGDIR" "value" pause (princ)))1 ^+ a8 ^  g; Q2 M9 L
  74. (defun c:30 () (ssget) (command "rotate" "p" "" pause "30"))
    * t6 |: F) {5 W
  75. (defun c:-30 () (ssget) (command "rotate" "p" "" pause "-30"))
    $ u+ E0 B: R& n5 W
  76. (defun c:45 () (ssget) (command "rotate" "p" "" pause "45"))
    ; y/ O( y4 ^9 G  [4 k) }! F" }
  77. (defun c:r5 () (ssget) (command "rotate" "p" "" pause "5"))
    - R* }3 h- D0 v7 T* v3 J2 E% [
  78. (defun c:60 () (ssget) (command "rotate" "p" "" pause "60"))
    " {- w2 C9 |2 Z4 b' }( ]9 P
  79. (defun c:-60 () (ssget) (command "rotate" "p" "" pause "-60"))
    ' n1 @) r5 r( b
  80. (defun c:90 () (ssget) (command "rotate" "p" "" pause "90"))+ [$ B) W9 x3 q
  81. (defun c:180 () (ssget) (command "rotate" "p" "" pause "180")): e& w4 e! E' R  U4 d4 L' e+ _
  82. (defun c:-45 () (ssget) (command "rotate" "p" "" pause "-45"))% V- g- d+ A; h
  83. (defun c:-90 () (ssget) (command "rotate" "p" "" pause "-90")), r. f" {% X5 m, p, N, C
  84. (defun c:md () (ssget) (command "mirror" "p" "" pause pause "y")), q' Y$ F% ^4 K2 w2 G- h, b
  85. (defun c:fd () (command "find" "p" "" )(princ))(princ)) |" `: _, X' m2 T
  86. . q- i7 K7 R6 @- ]( e5 p3 |
  87. (defun c:romantdim () (command "-style" "ROMANT-DIM" "romant,vnh.shx" "200""1""0""n""n""n"))(princ)" T% W" {9 t: a0 h- @  z
  88. (defun c:romantext () (command "-style" "ROMANT-TEXT" "romant,vnh.shx" "200""1""0""n""n""n"))(princ)
    / R/ U7 Z# l( K& W( \, [
  89. (defun c:vnhelvthuong () (command "-style" "VNHELVLT-Thuong" "vnhelv,vnh.shx" "500""1""0""n""n""n"))(princ)6 y  I' p: h. W, r) Q6 h
  90. (defun c:vnhelvhoa () (command "-style" "VNHELVLT-Hoa" "vnhelvh,vnh.shx" "500""1""0""n""n""n"))(princ)3 j) D4 z! b* u
  91. (defun c:truc () (command "-style" "TRUC" "impact" "0""1""0""n""n""n"))
    ) q5 y5 A& x) M: B5 P6 k
  92. (defun c:chu () (command "-style" "VERDANA" "verdana" "200""1""0""n""n"))
    # K, H2 H2 B+ t# R
  93. (defun c:cot () (command "-style" "COTES" "verdana" """1""0""n""n"))
    4 [  w) c% _+ S1 H' P) I* {. b1 M

  94. 5 Y3 K1 l4 f1 k& E- U
  95. (defun c:an () (command "-style" ".AVANT" ".vnavant" "200""1""0""n""n"))
    & x7 E% [! g3 k4 T, l( x8 V% c
  96. (defun c:ah () (command "-style" ".AVANTH" ".vnavanth" "200""1""0""n""n"))
    0 L1 _, a( e$ y1 E& N/ G) i. h
  97. (defun c:ha () (command "-style" ".ARIALH" ".vnarialh" "200""1""0""n""n"))
    6 {! B* D2 Z* M: Z2 R7 \0 H5 s7 I! ^7 m
  98. (defun c:na () (command "-style" ".ARIALNARROWH" ".vnarial narrowh""1200""1""0""n""n")): `* I+ l) z8 e& L; Z7 |
  99. (defun c:vn () (command "-style" ".VNTIME" ".vntime" "200""1""0""n""n"))7 a7 {0 ~% m- M% s: O& {
  100. (defun c:vh () (command "-style" ".VNTIMEH" ".vntimeh" "200""1""0""n""n"))
    1 ~) E/ v4 u2 s2 Q

  101. # ]0 |& ?4 B, |! I2 s- d
  102. (defun c:ps () (command "PSOUT" "CorelDraw-import-Photoshop" "W"))(princ);export the current view of a drawing as an EPS file: Y* g' C% s/ Z5 i2 C; `
  103. ( ~" X8 W2 A) Q3 H' `9 Q/ u
  104. ;free lisp by cadviet,cd2k44
    $ O3 J9 B1 H  w% b5 ~- u3 B
  105. ;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830" x7 l8 n1 Y& s+ {+ b/ G$ @0 K9 N
  106. (defun c:FTEXT (/ ent tstyle )  u/ u. P, h) k0 d) L/ l
  107. (command "undo" "be")
    ' ~9 N9 S4 ^9 ]3 p" `: V; q5 U5 F
  108. (setq ent (entsel "\n Pick text :"))
    1 `& n) ~/ y# D/ j
  109. (setq TSTYLE (cdr (assoc 7 (entget (car ent)))))
      i+ c, X9 ]' G) y# c, T8 K3 A3 R
  110. (command "STYLE" TSTYLE "romant.shx,vnh.shx" "0" "1" "0" "N" "N" "n")
    : ]- U$ L( J  ?2 d0 R9 u
  111. (setvar "TEXTSTYLE" Tstyle)
    * R1 f" m; C0 a# p- X( M0 C
  112. (command "undo" "end")
    / r( L/ t# i( r, o9 U; s1 O- l. O$ i2 B
  113. )
    - p9 E! E8 w* U- x
  114. ;Cam on cadviet nhieu 27-11-2023 04h15p36s (thanks cadviet)
    & {4 N: |( p( R3 h
  115. 9 ?3 q# S5 i0 M$ f3 J$ k# A) S
  116. ;free lisp by cadviet,cd2k44
    ( V0 h- h# L9 O$ `8 G# V" Z7 T" j- s
  117. ;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830
    3 Z4 L  Q3 `: _/ g! C: }1 ^3 ^
  118. (defun c:Fvnh (/ ent tstyle )
    ! A+ L9 X$ k% v% Q
  119. (command "undo" "be")
    8 D4 R4 N7 w: y" M* S/ v
  120. (setq ent (entsel "\n Pick text :")), [5 T' c  i2 M# {* _8 K* i
  121. (setq TSTYLE (cdr (assoc 7 (entget (car ent)))))
    4 [% H& y" q5 w6 L
  122. (command "STYLE" TSTYLE "vnhelvh.shx,vnh.shx" "0" "1" "0" "N" "N" "n")
    $ v6 L6 Q4 y4 f$ z  ^' n: Q
  123. (setvar "TEXTSTYLE" Tstyle)1 j5 T4 Q4 s! S3 l1 u# {$ k
  124. (command "undo" "end")
    2 d9 m. V: @) K& ]3 w
  125. )
    ; C8 ~9 m5 O% \
  126. % g# @3 X! f2 ~% @
  127. ;free lisp by cadviet,cd2k44
    ( j( q1 Q% P3 M- {
  128. ;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830
    2 q2 X4 S4 A' w" q% [; J, \  z' I
  129. (defun c:Chbg (/ ent tstyle )) c5 `5 u4 R5 E4 u+ ~7 Z9 v
  130. (command "undo" "be")% m; k) E$ H6 M0 O1 O1 O
  131. (setq ent (entsel "\n Pick text :"))
    8 O) y# z) m7 w. g
  132. (setq TSTYLE (cdr (assoc 7 (entget (car ent)))))
    1 y/ G, p  u. c0 E' c2 N
  133. (command "STYLE" TSTYLE "chhbg.shx,vnh.shx" "0" "1" "0" "N" "N" "n")
    # G- I4 T7 U1 ~' \4 l) D9 H
  134. (setvar "TEXTSTYLE" Tstyle)
    % T5 T7 T  @3 P/ ^" K/ [% I
  135. (command "undo" "end")1 @4 c& P* o( u4 p
  136. ), k! _: `4 o$ m' P
  137. + ~5 R) x/ s" R  B) ~9 X2 n
  138. ;free lisp by cadviet,cd2k44
    ) `; O2 o$ j, w; d0 C/ P
  139. ;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830
    + I- D: }+ Q; K* j: z
  140. (defun c:Chsm (/ ent tstyle )5 [" R+ U& g2 n! O6 O2 g" k, ]& R
  141. (command "undo" "be")2 `' g9 u3 H3 t/ ^5 d7 k* Y0 [
  142. (setq ent (entsel "\n Pick text :"))
    6 U% S+ ?( x& E
  143. (setq TSTYLE (cdr (assoc 7 (entget (car ent)))))
    2 X4 T( r. k: k
  144. (command "STYLE" TSTYLE "chhsml.shx,vnh.shx" "0" "1" "0" "N" "N" "n")/ x0 d$ H. C( ^9 ?! b2 W
  145. (setvar "TEXTSTYLE" Tstyle)
    ' U5 l; O5 O4 R0 Q3 T. {
  146. (command "undo" "end")# r+ Q, i9 f7 G, Y! [: W# O
  147. )7 Q1 x% P/ G" M+ O9 p
  148. 3 [0 r8 @6 G' }4 o, Y
  149. ;free lisp by cadviet,cd2k44% s, ?1 ]9 B+ O' g9 o1 m. B
  150. ;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830
    ( x& C% W0 y8 V' d" W
  151. (defun c:Fttf (/ ent tstyle )
    1 i; @3 I% D3 p
  152. (command "undo" "be")
    4 u/ h; E2 e% D+ m
  153. (setq ent (entsel "\n Pick text :"))5 [+ Q6 |/ f) }
  154. (setq TSTYLE (cdr (assoc 7 (entget (car ent)))))
    6 E) [9 B  ~/ b7 m6 {, L! A
  155. (command "STYLE" TSTYLE "verdana.ttf" "0" "1" "0" "N" "N" "n")
      S  e% G+ T$ D2 k; }/ T: K
  156. (setvar "TEXTSTYLE" Tstyle); R8 ~+ A) Z. V8 v  n7 [; G0 n: r
  157. (command "undo" "end")
    , _% l) W2 P, U0 F1 Y; z7 f1 E/ E4 l
  158. )
    " W+ h2 a* b1 @# U
  159. . ]" B5 n! F0 J
  160. ;;; ============================================
    & p% {3 _0 r5 J9 w9 L
  161. ;;;
    + v; j7 S( ]  g" G+ Q
  162. ;;;   LISP Creater Tao Duong Dan AUTOCAD2000
      u. h9 i/ |' }! I/ s
  163. ;;;
    : ?, Y6 H* L7 l0 Y( c
  164. ;;; ============================================
    8 A! Y1 X3 u+ I
  165. 4 z& s) C* i' ]3 D! B
  166. ;;; ============================================; u" ~+ Q5 i1 {8 `# P; l
  167. ;;;
    & V& z- G! n) G
  168. ;;;          CREATING FROM AUTOCAD2000
    ! ]$ M- r8 y+ x  }4 ?
  169. ;;;+ Y" f7 m; f- p$ {
  170. ;;; ============================================: k: x3 v4 f6 d% v
  171. 4 n7 ^; r! Q& n3 P$ K# b
  172. (setvar "INSUNITS"4)
    , o9 B8 q; H4 R' Q+ O
  173. (setvar "ANGBASE"0)$ G: j) y8 [* x7 o
  174. (setvar "ANGDIR"0)) g" c' \2 u- e8 [5 y/ Q- E
  175. (setvar "AUNITS"0)/ I, m  N  n( x1 z: V9 g- `" j1 G* y
  176. (setvar "AUPREC"8), m9 e4 W  n8 p5 Q
  177. (setvar "LUNITS"2)) _5 n9 d* q- @- f" Y
  178. (setvar "LUPREC"8)
    . `& A8 K* I; C9 q
  179. (setvar "ACADLSPASDOC"1)
    ) K- X/ x2 i% {: l8 u% N
  180. (setvar "pickbox"5)9 y+ S; @  \5 X1 Z
  181. (setvar "blipmode"0)
    + l3 j! w  r8 q7 l* X
  182. (setvar "mirrtext"0)) |8 B- |( l: n1 e
  183. (setvar "cursorsize"100)
    . ~& y! V, V& M, c% M
  184. (setvar "ZOOMFACTOR"75)
    / R( J- k- E+ W- _
  185. (setvar "LTSCALE" 10). r; q/ N& J* K& ^; u1 U8 i! q
  186. (setvar "lwunits"1)8 b, ], u5 ?! p& g$ p( W
  187. (setvar "DIMBLK" "Closed")
    + c! F# K2 T2 J" F- h
  188. (setvar "DIMGAP"0.0693)
    7 o& _" `5 G9 s5 J& H+ D; e& c7 g: l
  189. (setvar "DIMASZ"0.20)' M2 F7 r5 t& u# d. M
  190. (setvar "DIMCEN"0.2)
    - j. B- t, h7 E! j' C3 ?0 r6 p2 @/ i* y) G
  191. (setvar "DIMDLI"0.1)+ ~8 L8 S. y- G/ z* [1 `2 D" [
  192. (setvar "DIMEXE"0.0693)
    # B4 ~, q9 i6 b: R
  193. (setvar "DIMEXO"0.25): U9 C8 F& c" f
  194. (setvar "DIMDEC"0)
    3 b' t+ m. k0 G' A5 f' E" a8 q6 k
  195. (setvar "DIMTIX" 1)8 H! k2 ~" M- s3 t
  196. (setvar "DIMTXT" 0.099)% k  q. t# m1 D" }" j8 ^) A5 y  U
  197. (setvar "DIMCLRT" 7)' ]7 t% A( ?! [! B8 s) u, w
  198. (setvar "DIMTVP" 1)5 f" Q2 E" f3 o4 w
  199. (setvar "DIMJUST" 0)5 x! n9 i, S" b
  200. (setvar "DIMTIH" 0)
    0 L! c) }- ?$ L, Z3 c6 [9 W4 Y
  201. (setvar "DIMTOFL" 1)
    ' [' e& f( m' h! h$ }% E* o) H
  202. (setvar "DIMSCALE" 1111.1111)  f3 Z3 ?( a6 R% g' B

  203. " g$ @& b. c9 \( }% |: H
  204. 2 t! d" i. M0 u/ c, R$ o. u, v

  205. * V" e/ q6 T" F
  206. (defun c:zp ()  (command "'.zoom" "p"))0 y( n% y: ]: ~1 ?# `
  207. (defun c:zz ()  (command "'.zoom" "p"))+ b' C7 Z* g* u8 ~+ D& ^; h; W2 L% R, V
  208. (defun c:ze ()  (command "'.zoom" "e"))
    " W# K3 `8 i9 E4 i: z) g, Z
  209. (defun c:za ()  (command "'.zoom" "a"))
    / `7 D6 D& Z/ K* }
  210. (defun c:zd ()  (command "'.zoom" "d")): x; X; W+ j( _; ]& l
  211. (DEFUN C:ZZZ () (COMMAND "ZOOM" ".25X"))
    + R4 `) V, ?" g  k  Q
  212. (DEFUN C:ZX  () (COMMAND "ZOOM" "2X"))7 Q0 N5 N6 A" X
  213. (defun c:de () (command "ddedit")(princ))
    * Z7 M  ?* T0 I2 c6 p
  214. (defun c:dda () (command "Dimaligned"))& Q: }+ e. M8 U4 x8 a: @- w8 M
  215. (defun c:ddb () (command "Dimabaseline"))$ C% ?+ k3 }; Y
  216. (defun c:ddc () (command "Dimcontinue"))8 W1 n0 q. L& h9 h9 z
  217. (defun c:dde () (command "Dimtedit"))5 y. L7 G! N/ k3 \5 N
  218. (defun c:ddf () (command "Ddattdef"))
    ' ?" a+ K1 i  m: ]2 ~' p/ J
  219. (defun c:ddi () (command "Dimdiameter"))
      h% S9 I# |8 B/ V
  220. (defun c:ddl () (command "Dimlinear"))4 a- Q/ K1 {& W( T6 V- h2 C
  221. (defun c:ddn () (command "Dimangular")). h  x8 u, c+ _
  222. (defun c:ddo () (command "Dimordinate"))/ y6 `3 d4 c, e, X9 k
  223. (defun c:ddr () (command "Dimradius"))
    & F( m, A  l% d4 W
  224. (defun c:dds () (command "Dimstyle"))
    $ j" v) @9 A  A, u' ^

  225. 0 L+ H; T) e* v( o* ^/ q
  226. (defun c:DU () (command "dim1" "up" "select" "exit" pause ))(princ)0 ]% T# D) j# U4 h2 N# O
  227. (defun c:DH () (command "Dim1" "home" "select" "exit" pause))(princ)
    % L( e" Y. F9 Y7 @! d
  228. (defun c:UU () (command "dim1""update""all")). y1 `, \1 u. t2 z" s
  229. (defun c:ded() (command "dim1""tedit"))! r8 `( \& ?% N# M& o
  230. (defun c:da () (command "dim1""ali"))
    2 z2 z; m4 j  l/ k" R- Z
  231. (defun c:dll() (command "dim1""l"))( ?$ L2 ^# p# i, j
  232. (defun c:dan() (command "dim1""an"))# X6 _) c( C: W
  233. (defun c:d1 () (command "dim1""ra"))& o" g& }' b0 @! O) t
  234. (defun c:n  () (command "dim1""new"))' e+ n0 j" c$ g+ Q2 q

  235. + L3 h2 U$ o2 I
  236. (DEFUN C:PE  () (COMMAND "PEDIT"))# j: h# i6 [- z4 h% z, j, z
  237. (DEFUN C:PL  () (COMMAND "PLINE")): }; a! s: L8 b2 M
  238. (defun c:dd () (command "dist")(princ))" V4 }: F9 q" o$ p& z# P* l8 H8 |
  239. (defun c:w () (command "pedit" pause "w" "au")(princ))
    ; N2 T0 `7 I9 O+ P$ F% u
  240. (defun c:pg  () (command "polygon" "polygon"))
    ! |& J, s& x7 P/ N8 o; v. R
  241. (defun c:el  () (command "ellipse"))0 n4 R& k9 G6 x
  242. (defun c:xe  () (command "explode"))3 w' I+ d* o; v8 F. t( O7 q/ x1 e
  243. (defun c:eex  () (command "extrude"))
    7 P! ?% t. x5 k0 y
  244. (defun c:xg  () (command "xline""a"))
    " l/ T$ a9 X/ {7 e4 D
  245. (defun c:xh  () (command "xline""h"))4 \  p# _$ x" S( G9 p5 a& h
  246. (defun c:xv  () (command "xline""v"))3 @  }; S  ^9 S! ?) v( p+ _- y

  247. / C( B+ Q1 \& P/ Y6 |. ~9 V# z. P
  248. (defun c:oc () (command "osnap""cen"))1 u( f0 j' y) U9 c' a  k
  249. (defun c:od () (command "osnap""nod"))
    , j* Y7 l5 _1 F6 o
  250. (defun c:oe () (command "osnap""end")); g& t! |2 }+ \  {9 e7 b' B1 b
  251. (defun c:oi () (command "osnap""int"))4 s" _8 K4 L# Y( E+ o& {/ o
  252. (defun c:or () (command "osnap""per"))% o# i; |5 S/ h* b% v- n
  253. (defun c:on () (command "osnap""none"))
    ) n# B* d) W) b
  254. (defun c:oq () (command "osnap""qua"))8 j9 n: M8 Q: a
  255. (defun c:om () (command "osnap""mid"))
    # g" J7 Y- {7 {( F
  256. (defun c:ot () (command "osnap""tan"))8 [8 N' k$ U. Z
  257. (defun c:oin () (command "osnap""ins"))
    & E5 R6 b& a/ z% l* S1 x1 }
  258. (defun c:oa () (command "osnap""nea"))" t! d1 ]; ]1 |5 J* d* I
  259. (defun c:ol () (command "osnap" "End,Mid,Cen,Node,Nea,Int,Perp,Qua")(princ))* y* r* @) `& Q# Y3 e* V
  260. ;(defun c:du () (command "dim1" "up" "s" "pick" "other"))$ l; b- w5 V# J2 k
  261. ;(defun c:nn () (command "new" "y" ))* J; w: O- p8 k( g3 m

  262. : }- m9 [8 ]: `
  263. (defun c:/ () (command "limits"))
    # }4 H& A% U' E+ H
  264. (defun c:`1 () (command "region"))
    - J& B( Z0 z/ x5 J- W
  265. (defun c:`2 () (command "subtract"))2 E& [  ]- k0 R, A1 p
  266. (defun c:`3 () (command "union"))2 U# H1 @& w5 i- u% H
  267. (defun c:`4 () (command "intersect"))
    8 o+ E7 M3 G3 q4 W4 U1 U. g  x( P4 j$ I
  268. (defun c:`c () (command "cal"))
    : V  y* G9 s) k' n( B9 G) B
  269. (defun c:`g () (command "Polygon"))
    % H- C! P* ?7 \4 f; x

  270. 2 A6 m' e2 c) Z' ^3 C, w" X. C
  271. (defun c:lmi() (command "LIMMAX" pause "" "zoom" "all" )(princ))4 r8 ~. h' P8 h) X+ B
  272. (defun c:drt () (command "DRAWORDERCTL" pause "Integer" "" "" )(princ))) d* ~  u. z. w4 R" @4 P" }
  273. (defun c:ip () (ssget) (command "print,_plot" ))(princ)
    ; g1 ]1 ~) p# v) \* W4 ]3 f, @' W

  274. + E. d6 C8 c' S+ b- D+ B8 O
  275. (defun c:ddm () (command "ddlmodes" pause))2 ~+ X) w9 Z' O) r4 s; Q8 I/ K6 H

  276. + r* O" w9 H2 U4 S! V2 M
  277. (defun c:sha () (command "shade" pause))
    9 K# B7 t- m3 H4 }" m, ?% f

  278. ; \6 m) S, f# z& p4 ?8 X
  279. (defun c:sr1 () (command "surftab1" "p" "" pause))5 E1 D; b# q$ X1 Y; C# _, ~! q# U
  280. (defun c:sr2 () (command "surftab2" "p" "" pause))
    6 t" k, r" `; Y* k" ~: @1 [& w: H
  281. * P7 Z# I( T6 ?2 z7 i. f/ p
  282. (defun c:ad () (command "audit""y"))% _6 ]2 a2 l- u/ s! P
  283. (defun c:q () (command "quit"))0 h7 i* S0 r9 D& {. L$ T5 _

  284. ) Y8 [$ k. J  p, k$ m* E" ?
  285. (defun c:30 () (ssget) (command "rotate" "p" "" pause "30"))
    0 @$ G, M% A! T. g
  286. (defun c:-30 () (ssget) (command "rotate" "p" "" pause "-30")), b) J- A8 W, l7 w  a, [
  287. (defun c:45 () (ssget) (command "rotate" "p" "" pause "45"))
    # X$ D. o! ]& w! F
  288. (defun c:-45 () (ssget) (command "rotate" "p" "" pause "-45")). w, b2 Y, b3 u
  289. (defun c:60 () (ssget) (command "rotate" "p" "" pause "60"))
    " c; ?' p5 W! G+ |$ k' @: ^. r/ [
  290. (defun c:-60 () (ssget) (command "rotate" "p" "" pause "-60"))
    $ [- q* Q! F5 I
  291. (defun c:90 () (ssget) (command "rotate" "p" "" pause "90"))" }/ b; t$ s! s
  292. (defun c:-90 () (ssget) (command "rotate" "p" "" pause "-90"))- O' W3 ~1 W6 a( u* @$ F) \: m
  293. (defun c:180 () (ssget) (command "rotate" "p" "" pause "180"))
    * \! G+ P. B1 ^- J# A) S/ D

  294. / w  K3 {8 x9 C6 M
  295. (defun c:u3 () (command "ucs""3"))" I0 H2 y; f6 u' A' G; H
  296. (defun c:ue () (command "ucs""o""end"))1 D$ P( T* B6 @  E  Q; {: G! @& z' E* H
  297. (defun c:ui () (command "ucs""o""int"))
    $ a* \: d, ]+ Z. e; |
  298. (defun c:um () (command "ucs""o""mid"))4 X8 q) Z! f/ a9 c1 _; s6 O; @
  299. (defun c:uc () (command "ucs""o""cen"))' Y% E  C' F7 Y  i# G( c
  300. (defun c:uq () (command "ucs""o""qua"))3 T1 p; q+ L  g
  301. (defun c:3s () (command "ucs""3"))
    / Z8 A" b8 l" ~3 t7 q
  302. (defun c:sx () (command "ucs""s"))+ m5 q. Q+ u9 ?3 a" d9 Z
  303. (defun c:sf () (command "ucs""o"))
    * \! |1 u2 |) j5 v& m0 N+ P" ~# m
  304. (defun c:sz () (command "ucs""p"))  Y2 y& h9 h( F
  305. (defun c:sr () (command "ucs""r")). ~0 E0 K8 K) i; F
  306. (defun c:sw () (command "ucs""w"))
    : m' w) z2 ^* Q% t
  307. (defun c:fv () (command "ucs""v"))
    & v& s/ U9 Z9 W6 y6 K* u" M
  308. (defun c:ux () (command "ucs""x"))
    $ r* O2 i. ~. i* O
  309. (defun c:uux () (command "ucs""x""90")), e, b5 A! B+ H& A- _* A
  310. (defun c:xxu () (command "ucs""x""-90"))/ q8 s% l1 n  D; w8 J, I* e" y
  311. (defun c:uy () (command "ucs""y")); w7 ]5 _1 c1 ^& f+ w
  312. (defun c:uuy () (command "ucs""y""90"))2 N9 O% J8 O( v7 g
  313. (defun c:yyu () (command "ucs""y""-90"))
    $ G; u4 o) i8 t0 X( [2 G
  314. (defun c:uz () (command "ucs""z"))! Y* a& w2 N0 _. y$ X
  315. (defun c:uuz () (command "ucs""z""90"))
    " T8 Y1 B; z- w
  316. (defun c:zzu () (command "ucs""z""-90"))( V& p7 B( B) I& Z/ [
  317. (defun c:uci () (command "ucsicon" "Properties" ))(princ)
    + _3 ]# x& x# B! s+ T
  318. (defun c:ucm () (command "ucsman" ))(princ)9 N* l5 K9 L: y9 W1 d( G' _
  319. " D) i0 a% k1 ^5 X) p
  320. (defun c:sa () (command "vpoint""_non""-1,-1,1"))
    " H; _# \+ o& Q
  321. (defun c:sd () (command "vpoint""_non""1,-1,1"))- n- H4 }$ d! w  ^+ K) G
  322. (defun c:se () (command "vpoint""_non""1,1,1"))+ a' @# A$ D' Z# ]' }( L
  323. (defun c:sq () (command "vpoint""_non""-1,1,1"))6 S6 B/ M& p: h5 v" w
  324. (defun c:vc () (command "plan"""))
      A5 E% H, G9 z' E) P
  325. (defun c:vd () (command "dview""all"))
    ( l) j6 f1 u& F
  326. / t/ A- Q7 f* `# p
  327. (defun c:TT0 () (command "tilemode""0")): Y# X9 V; s) K" C& R
  328. (defun c:TT1 () (command "tilemode""1"))
    . w6 ]. Z8 ^* I2 w0 r

  329. ! L9 q# ?: z% V8 L
  330. (defun c:vt () (command "vpoint""_non""0,0,1"))9 ?% Q" m3 N* j' d9 B
  331. (defun c:vb () (command "vpoint""_non""0,0,-1"))- v/ R9 W6 H" N* P
  332. (defun c:vl () (command "vpoint""_non""-1,0,0")). ~  `' |" T% V! J3 C
  333. (defun c:vr () (command "vpoint""_non""1,0,0"))3 e: Y0 h( J% _( e" m
  334. (defun c:vf () (command "vpoint""_non""0,-1,0"))
    ( ?5 b+ v: Y% _2 [% k# T
  335. (defun c:vk () (command "vpoint""_non""0,1,0")). g( Y. [( s1 x$ C7 [  p7 Z

  336. 8 ]. e' E/ I$ P/ m
  337. (DEFUN C:MM  () (COMMAND "MIRROR"))8 h- j. f( g0 x
  338. (DEFUN C:MP  () (COMMAND "MOVE" "P"))) R1 }* ]3 I4 X. {, w3 [

  339. , g4 ~; Y4 @- ?* v/ g# V2 f" D9 ~
  340. (defun c:mee (/ a)
    6 ?% m/ M4 o, U8 O$ V2 O) X7 g4 ]8 t
  341.   (setq a (ssget))(command "move"a"""end"pause"end"))0 T8 y* H9 C9 z; P8 g9 d; d
  342. (defun c:mc (/ a), E* x2 e4 A) [7 _' n" J
  343.   (setq a (ssget))(command "move"a"""cen"pause"cen"))1 @1 A2 ^: }# H/ a+ W) X
  344. (defun c:cc (/ a)" ?# l: \, N3 C* R% u
  345.   (setq a (ssget))(command "copy"a"""m"))
    . E4 I2 ]& c/ p7 P  N3 c: s
  346. (defun c:ce (/ a)3 y: g- a2 |2 W# K' {: _
  347.   (setq a (ssget))(command "copy"a"""m""end"pause"end"))- l' t1 |) q+ M# e
  348. (defun c:cn (/ a)
    ; T7 J- C' d; B' L- v, V
  349.   (setq a (ssget))(command "copy"a"""m""cen"pause"cen")). X) F7 _  p% x; B. i
  350. (defun c:tl ()(command "trim""l"""))
    & j# R4 [5 a: \8 Y1 b% s' ~! h
  351. (defun c:tf (/ a)* @! e2 P& ?  [7 i" l9 w
  352. (setq a (ssget))(command "trim"a"""f"))
    / {. j8 K0 q- ?( S( \' [
  353. (defun c:el ()(command "extend""l"""))0 s  g- x+ M2 x: B! _' F+ h- K
  354. (defun c:ef (/ a)
    ) {& H  A3 X( O' t' U' C# E& e
  355.   (setq a (ssget))(command "extend"a"""f"))
    2 _% p+ T" S% ]% a# l1 r4 K4 C  n
  356. ) B9 w2 S- ]9 ]* y5 i
  357. 3 z4 P9 B3 }' S4 S2 l7 y' z
  358. (DEFUN C:110   ()(princ "\nChon doi tuong can offset ra 110.......") (COMMAND "offset" "110"))+ x: J* P0 O, k8 N
  359. (DEFUN C:220   ()(princ "\nChon doi tuong can offset ra 220.......")(COMMAND "offset" "220"))6 y# i  t3 y2 E
  360. (DEFUN C:330   ()(princ "\nChon doi tuong can offset ra 330.......")(COMMAND "offset" "330"))  N" x6 i* \4 ]; U* S. \* }
  361. (DEFUN C:400   ()(princ "\nChon doi tuong can offset ra 400.......")(COMMAND "offset" "400"))
    9 P+ ~7 d, E  Z$ z0 h9 S
  362. (DEFUN C:55   ()(princ "\nChon doi tuong can offset ra 55.......") (COMMAND "offset" "55"))
    * I: h: N4 Z/ u5 M
  363. (DEFUN C:600   ()(princ "\nChon doi tuong can offset ra 600.......") (COMMAND "offset" "600"))$ @# G3 @  E) J* S" K9 \  r0 |0 u
  364. (DEFUN C:700   ()(princ "\nChon doi tuong can offset ra 700.......") (COMMAND "offset" "700"))5 {( d9 k- h/ M; w
  365. (DEFUN C:800   ()(princ "\nChon doi tuong can offset ra 800.......") (COMMAND "offset" "800"))
    * Q. n$ j* S# b2 U6 ]
  366. (DEFUN C:900   ()(princ "\nChon doi tuong can offset ra 900.......") (COMMAND "offset" "900"))
    2 [, C1 a) g  r1 }2 a0 t
  367. (DEFUN C:1200   ()(princ "\nChon doi tuong can offset ra 1200.......") (COMMAND "offset" "1200"))+ G2 d0 y: B( V. r7 u, ~9 k
  368. (DEFUN C:1500   ()(princ "\nChon doi tuong can offset ra 1500.......") (COMMAND "offset" "1500"))
    : c+ h& _  a: u: n7 ~- f
  369. (DEFUN C:1800   ()(princ "\nChon doi tuong can offset ra 1800.......") (COMMAND "offset" "1800"))1 X  h3 Z/ W- H1 |
  370. (DEFUN C:2400   ()(princ "\nChon doi tuong can offset ra 2400.......") (COMMAND "offset" "2400")); S3 K' u) \4 M
  371. (DEFUN C:3000   ()(princ "\nChon doi tuong can offset ra 3000.......") (COMMAND "offset" "3000"))6 _) C0 A( {- v. C/ {
  372. (DEFUN C:3600   ()(princ "\nChon doi tuong can offset ra 3600.......") (COMMAND "offset" "3600"))
    & ^) m: ?: n1 b( M
  373. (DEFUN C:4200   ()(princ "\nChon doi tuong can offset ra 4200.......") (COMMAND "offset" "4200"))
    + R( v0 R/ D) f2 G2 h& J$ N6 w7 [( A) _
  374. (DEFUN C:5000   ()(princ "\nChon doi tuong can offset ra 5000.......") (COMMAND "offset" "5000"))
    : {. E3 S8 g: |3 t9 G

  375. - L4 k' T1 v& t- u6 H; R
  376. (defun c:mla () (command "-mledit""av"))) i' Y* E. ~# U$ M! [0 @* k
  377. (defun c:mlc () (command "-mledit""mc"))
      E: `& h( C; L% w: u3 M7 f+ ?* z
  378. (defun c:mld () (command "-mledit""dv"))- |1 V+ Q4 S8 E! i
  379. (defun c:mle () (command "mline""end"pause"end"))* p4 T# S9 x% v& K2 v
  380. (defun c:mli () (command "-mledit""ca""int"pause"int"))7 e0 ]8 M8 O, ]. Y& V
  381. (defun c:mlj () (command "-mledit""cj"))
    ! v, l! k# ?$ i
  382. (defun c:mlt () (command "-mledit""mt"))
    " m  v6 b: ~& d$ K0 P2 W3 f: a
  383. (defun c:mlk () (command "-mledit""ca""end"pause"end"))/ I% Z) `' U% v4 T: y
  384. (defun c:mlw () (command "-mledit""wa"))
    ( S+ I7 w/ \, O. K  _8 [: e' u

  385. 7 N( W( H* G: a5 c' X7 |
  386. (DEFUN C:DCA () (COMMAND "DVIEW" "all" "" "CA"))
    , X; d' K- l& {$ e( f
  387. (DEFUN C:DPA () (COMMAND "DVIEW" "all" "" "PA"))
    - y  v5 y' P, X) [" o
  388. (DEFUN C:DPO () (COMMAND "DVIEW" "all" "" "PO"))
    " V* r5 D: i5 ~8 T" a/ b% Q
  389. (DEFUN C:DDD () (COMMAND "DVIEW" "all" "" "D"))" p0 M; l! z9 y$ e
  390. (DEFUN C:DZ  () (COMMAND "DVIEW" "all" "" "Z"))6 V( r! Z& Q8 ?7 F( L
  391. & M0 p- Y" \- C6 f4 \; u) u$ ^
  392. (defun c:p0 () (command "pline""""w""0""0"))1 t$ _" Q  c  m
  393. (defun c:ot  () (command "offset""t"))8 l: M+ c# M4 {3 O7 W
  394. (defun c:t  () (command "mtext"pause"j""bl""h"pause))( f8 g9 c$ L0 I2 J
  395. (defun c:uo () (command "ucs""ob"pause))
    2 W" W9 L1 Z% ]  y" Q
  396. (defun c:f0 () (command "fillet""r""0"))5 ]9 _9 D  w: i+ l/ b' ?
  397. (defun c:fr () (command "fillet""r"))
    ) B# ?6 }8 p) ]- H% c- e

  398. ( p" }" E7 b* Y3 }9 P$ l8 A$ B
  399. ;CHAMFER
    2 c) i. g2 m/ H* A2 o4 _4 V
  400. (defun c:cf () (command "chamfer"))
    ; _' E/ \6 t) x$ i) m
  401. (defun c:cfd () (command "chamfer" "d"))
    1 u4 j8 }, y  J3 Z8 G! b" E) I% C! U
  402. (defun c:cf0 () (command "chamfer" "d" "0" ""))
    : G7 k* T% T. s" ^0 S; v

  403. : @4 N: y; `7 u' G# _7 a! Q; {
  404. ;FILLET! _7 [. {. r3 g
  405. (defun c:f () (command "fillet"))
    ! F. C8 l* x* m* C+ G+ ]" C" W' h
  406. (defun c:fr () (command "fillet" "r")): g6 i* e8 `0 w5 \5 Z* D8 T8 g
  407. (defun c:f0 () (command "fillet" "r" "0"))
    . }' ~9 \9 b0 y9 o
  408. ( H9 z6 Q( p; ^! v# Q8 {/ i
  409. (defun c:OO  () (command "oops"))
    ) R0 s8 m/ t# y& q2 B7 `
  410. (defun c:dln  () (command "dimlinear"))8 @2 {& a- d5 J/ `" k- Q
  411. (defun c:dan  () (command "dimaligned"))
    ! \, S; U4 _6 l5 @! o9 ^
  412. (defun c:ddc  () (command "dimcontinue"))# Z# B, p% N' ~3 i+ ^* w0 c
  413. ! X6 a2 C: G! X% H- s
  414. (defun c:sc () (command "scale" "auto"))" e  K7 k& J% ~% i' Y+ R
  415. (DEFUN C:XO  () (COMMAND "snapang"))& l5 |% W2 P  m& g6 z* x
  416. (defun c:cc (/ a)
    0 {( |# S) O2 ^5 B
  417.   (setq a (ssget))(command "copy"a"""m"))* S% M6 A" \/ k& L; ^2 ~
  418. % e8 R# ?8 |0 {% P6 H5 L( n
  419. (defun c:PJ (/ a)
    9 I) O9 N5 i1 a. l% [% ]( t; l
  420.   (setq a (ssget))(command "pedit"a"""j""all""y"))1 F) c4 W5 n+ L. u! k
  421. (defun c:JJ (/ a)& O0 U4 J! p: u  X1 \5 T
  422.   (setq a (ssget))(command "pedit"a"""j""y"))
    % k( E  b1 V5 C: q
  423. (defun c:TN (/ a)
    & n+ I7 s" k. _8 j& }; t! H) x' p7 }% E
  424.   (setq a (ssget))(command "change"a"""p""T"))) T6 H- I/ X' P3 O+ G5 {( I9 T

  425. . B, Y: C( x/ p8 C7 [

  426. 8 ]4 I- h! O5 [; J! D+ _
  427. ;=======================Tran Ngoc Thang - Tu nam 2000 - Hoc nam cuoi KTS . DHXD=========================0 v5 c. D2 ?5 ]- H

  428.   v; `* p$ X! P& k+ @3 `
  429. (defun C:IB ()(setvar"cmdecho"1)
    " X5 w2 u0 F7 n0 [
  430.   (setq pt(cadr(entsel"\nSelect Block:")))  N/ y5 h: h2 `( K( b
  431.   (setq e1(ssget pt))
    9 o7 ?2 a9 d' x' L* ?  o
  432.   (setq e2 (entget (ssname e1 0)))
    0 i0 n0 h6 D- d* T- q
  433.   (setq blname (cdr(assoc 2 e2)))
    4 n9 c: j) c0 a' R
  434.   (setq oer *error* *error* err2)(command ".insert" blname))
      z6 C# f9 y3 |' j# c' z
  435. / L& L% L4 |8 N0 b, @/ I
  436. (defun c:II ()" P" v+ W( s4 S. r
  437.     (setvar "cmdecho" 0)
    4 r( _) H( l+ b0 W: v$ ]: ]$ n
  438.     (setq olderr *error* *error* myerror)
    ! V4 B/ `* M- t3 @" S
  439.     (prompt "\nSelect objects: ")
    ! O; `! v5 ]# j% w
  440.     (command "select" "au" pause)% g/ s2 I! \. w6 C
  441.     (setq sstxt (ssget "p")
    1 h  [% ^& R: q
  442.           sslen (sslength sstxt)
    8 W$ v1 \3 ~. _5 J  C! C# h' ^, B
  443.           ctr 0
    3 J5 n# j$ z* n& O; D$ g
  444.     ), A) H- X- D$ c' q1 @, L
  445.     (command ".undo" "mark")
    ) A1 d/ O: \9 t& r, t7 a
  446.     (while (< ctr sslen)2 U* P2 p/ a) y( {
  447.            (setq listxt (entget (ssname sstxt ctr))
    ' J1 k2 `6 j" q6 w, f" n' j- ^
  448.                  txttxt (cdr (assoc 1 listxt))- }+ D6 X8 }3 d& ~3 T3 U" x
  449.                  enttxt (cdr (assoc 0 listxt))3 ^) z  l- b3 J: ^) c% {
  450.            )
    5 |0 \" K' P6 X3 l% e
  451.            (if (= enttxt "TEXT")1 [) B' c# t! n
  452.                (progn' |6 }) f. W: _; i# K2 T
  453.                    (setq testxt (substr txttxt 1 3))
    - v# v" _3 k+ x8 ^4 _6 T
  454.                    (if (or (= testxt "%%C") (= testxt "%%C"))
    4 J# u- x3 G4 _: k& I# Z4 j
  455.                        (setq newtxt (substr txttxt 4))
    * M8 @- I. U+ ~+ F' @- h+ z
  456.                        (setq newtxt (strcat "%%C" txttxt)). C0 p! o6 M5 h) l8 ?, Y3 f6 _
  457.                    )  w3 z" s9 g+ @1 ?3 c3 d0 y4 \
  458.                    (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))* A  x% T1 s. ~0 `# [+ u
  459.                    (entmod listxt)! C6 _; @3 M2 I& q  H: j
  460.                 )
    ! }" Q" Y% H4 C4 B' ^2 _
  461.             )7 S! p' L3 g# o% F: J
  462.             (setq ctr (1+ ctr))+ e: |; p1 _4 a$ f
  463.     )+ _2 R4 q# ~6 R# ~4 q: S
  464.     (setq *error* olderr)
    5 _4 \2 r  E' P" t
  465.     (setvar "cmdecho" 1)
    # `* m# E% r7 g7 _- Y! h% v2 H& B/ }
  466.     (princ)
    ( |+ @  @* _/ r
  467. )# y2 A  i  D5 b3 ]
  468. 4 A' B- F6 H1 k7 ~( w) Q. x
  469. (defun c:DG ()/ q9 r3 e- @/ O. ^
  470.     (setvar "cmdecho" 0)/ P7 v' y! \5 v' N; s  _
  471.     (setq olderr *error* *error* myerror)4 u# @( s7 ?+ g$ [
  472.     (prompt "\nSelect objects: "). m7 c# J: ]8 w
  473.     (command "select" "au" pause)
    1 E0 \+ ^; k! n. S
  474.     (setq sstxt (ssget "p")$ P* B$ {8 e2 E6 p8 i. i) g  Q  a0 A8 ?
  475.           sslen (sslength sstxt)
    0 G1 K( K5 [* N% r! K$ a8 c2 s
  476.           ctr 0* |8 k+ N5 ~2 o+ s% A, E/ m
  477.     )5 o' C" C( U; C% z* U
  478.     (command ".undo" "mark")
    $ i: Y5 j- {( H4 R8 O. d/ Q' K
  479.     (while (< ctr sslen)
    ) S: o$ o! C/ p
  480.            (setq listxt (entget (ssname sstxt ctr)): s4 d' {5 U: z0 B2 n8 Y
  481.                  txttxt (cdr (assoc 1 listxt))$ A/ m1 y: i1 ]" j
  482.                  enttxt (cdr (assoc 0 listxt))
    0 v+ p1 T* M1 N# c% H6 v
  483.            )
    , w4 {4 ?/ n% [% ]8 y. I  W: ]
  484.            (if (= enttxt "TEXT"), s" o- q8 ~, G6 {. u; D
  485.                (progn+ k8 |# h* y/ Q7 f4 i4 g8 K
  486.                    (setq testxt (substr txttxt 1 3))
    " S3 l3 o9 c+ _' s3 W
  487.                    (if (or (= testxt "%%d") (= testxt "%%d"))0 _& u3 q- F% z' v, K3 {+ M: G. R
  488.                        (setq newtxt (substr txttxt 4))
    ' S  w  `: |7 F  j) P% A- K
  489.                        (setq newtxt (strcat txttxt "%%dC" ))
    " K3 T- I7 X- p( {2 f
  490.                    )  m) s7 D- W; Q- t
  491.                    (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))
    9 l# V- v6 K( ^& V" f
  492.                    (entmod listxt)% h7 m; s' ~! P1 }! e& R. E
  493.                 )
    3 i3 b5 \7 z! |* `: s8 t, }" ^
  494.             )
    % a: |+ ]; H4 S% U9 T5 U2 r
  495.             (setq ctr (1+ ctr))
    8 z4 d/ |4 b6 p* p( M( C$ G8 A
  496.     )" f+ @4 i4 f; ]/ E' @% Z0 Z
  497.     (setq *error* olderr)
    ; P! T$ D6 c" y# P0 L7 O
  498.     (setvar "cmdecho" 1)9 D6 v' v; g: a$ J1 F
  499.     (princ)# w/ U% s% c  Y" q7 w' s, ^
  500. )4 ]' a8 d, ~! [) K3 k1 G1 Y6 _" q

  501. ( Y) s% k5 H; n: _4 c; o9 N
  502. (defun c:PI ()' A& P$ T1 G) R! [% H7 j) W
  503.     (setvar "cmdecho" 0)/ j1 W1 m5 w; T3 o0 ~3 D+ P
  504.     (setq olderr *error* *error* myerror)
    5 t$ [" |( Y* C# w
  505.     (prompt "\nSelect objects: ")
    % T. x- m9 p7 y  h" S; k
  506.     (command "select" "au" pause)
    5 [; H" ]" c: y) I7 w2 T
  507.     (setq sstxt (ssget "p")$ \# O+ t# ~$ V. a
  508.           sslen (sslength sstxt): P+ L% g( {) w) M. {  B# E) {
  509.           ctr 0
    & a3 \' }9 A! `5 q" Z9 w) h6 L
  510.     )7 t( E7 l3 {5 ]4 l
  511.     (command ".undo" "mark")
    1 z) r8 `5 g0 F1 H$ P
  512.     (while (< ctr sslen)
    5 U& }# Z7 e& `
  513.            (setq listxt (entget (ssname sstxt ctr))7 [$ l: P0 z" x& a# d: {% D
  514.                  txttxt (cdr (assoc 1 listxt))9 b# f0 I9 P& \; T4 c% Y& S; Q
  515.                  enttxt (cdr (assoc 0 listxt))
    5 o  n0 v+ a6 U0 t: u, K
  516.            )  ^* b" U8 Q/ g* \. H& }
  517.            (if (= enttxt "TEXT")
      l0 T) l% c. h8 X, `) y3 O
  518.                (progn( u3 J6 {. @; u1 I/ I! h! D
  519.                    (setq testxt (substr txttxt 1 3)): W3 Q/ D# S' ?9 A  l- y, H0 U# O& A
  520.                    (if (or (= testxt "%%p") (= testxt "%%p"))
    6 z9 H1 O5 E: X! B- E6 x
  521.                        (setq newtxt (substr txttxt 4))# B3 R# t; q  N) ^
  522.                        (setq newtxt (strcat "%%p" txttxt))
    0 k2 J8 Y) `) V# K& @; Z
  523.                    )
    ) u. B, O: M+ V# v% E7 p9 Y8 o  z
  524.                    (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))
    7 t4 _: q5 E- `
  525.                    (entmod listxt)
    9 o: G! s5 B+ {& i& _
  526.                 )
    4 J2 L  \: `$ ~+ X
  527.             )9 Y3 i$ ^$ C& j
  528.             (setq ctr (1+ ctr))4 l+ H+ q1 x0 }% ~
  529.     )' y5 u/ |3 o% i+ N: x8 B
  530.     (setq *error* olderr)
    ) ~% d2 c% Y. D
  531.     (setvar "cmdecho" 1)# Z5 ^' h& L  Z9 f2 h; b' R
  532.     (princ)
    $ q& n  b' B* l! _3 g4 O8 T2 E
  533. )
    * x9 }! }. K0 w) p, Y! g
  534. 7 z% C, b: m) g2 S/ w. }
  535. (Defun c:CB (/ a)
    & n: r8 D3 }' a% k% t: G
  536.    (setq olderr *error* *error* myerror)
    . f: i! Z& t' w: g& T/ S( }
  537.    (setq ocmd (getvar "cmdecho"))( Y0 ~. _  G8 |, G) E
  538.    (setq oblp (getvar "blipmode"))
    6 b; o4 M- l1 P
  539.    (setvar "cmdecho" 0)$ G. z& B: J, q* ~  B
  540.    (setq a (ssget))1 n& ]7 J% O) Z0 d. Q" P9 t
  541.    (command "CHPROP" a "" "C" "bylayer" "")
    - {) \* A1 U1 J* |5 {2 L) C
  542.    (setvar "cmdecho" ocmd)* X3 z1 M% b% t0 o, p
  543.    (setvar "blipmode" oblp)# [& [" P! f% B- j" k" u6 x
  544.    (setq *error* olderr)
    8 x" O2 v9 ^9 a4 n, i
  545.    (princ)
    ) ?( J% ~" d5 K
  546. )
    8 |3 D/ P) N. Y

  547. 0 x0 v% N9 b8 D; F5 J0 b
  548. (defun c:LCC (/ co43 obj23 la23)3 i- t5 a; v: \0 r3 J
  549.    (setvar "cmdecho" 0)3 q& k# Z+ i  d# j. n# A7 V
  550.    (setq co43 (getstring "\nNew color : ")): B4 {% ^( a+ _" P! q$ S' `
  551.    (setq obj23 (car (entsel "\nPick object on desired layer: ")))
    0 a, ?( m+ y$ M8 y. ~
  552.    (if obj23 (progn- M  |' @/ `& Y4 u% z* B: [" }
  553.              (setq obj23 (entget obj23))
    + c& M7 |$ m* }3 S9 S
  554.              (setq la23 (cdr (assoc 8 obj23)))% W. J/ a/ H0 w6 S5 ^# E4 D4 q, M
  555.              (command "layer" "c" co43 la23 "")" }6 P/ E( N8 ~& B+ {
  556.           )
    # U* c4 G1 V+ H8 \" Q8 G
  557.     )3 b+ m* g( S! ?+ T9 @
  558.    (prompt (strcat  "\nLayer has changed..." la23))
    ; N* |$ J$ r; a" ~
  559.    (setvar "cmdecho" 1)
    " k3 R7 u8 N9 x
  560.    (princ), Z% f& ~4 C. Y, j# b' I
  561. )  6 ~: n2 }# [  b- y6 }8 [  `
  562. & D; N6 j* x! _- ~% ?7 N
  563. (Defun c:RP (/ a)- L4 v1 |' l" z( q
  564.    (setq olderr *error* *error* myerror)  {- W9 q+ _& [9 I* X
  565.    (setq ocmd (getvar "cmdecho"))$ q' I0 i. W6 C
  566.    (setq oblp (getvar "blipmode"))) i8 \1 s1 q4 @
  567.    (setvar "cmdecho" 0)
    : p' I1 T* d8 \6 ?, I
  568.    (prompt (strcat "\nUSE: Delete object(s) belonging to"
    3 o/ M2 N# |8 X! i. Z8 q: H
  569.                    " the layer of the entity picked...!"))8 q- _* c8 i8 I$ Z
  570.    (setq a (entsel "\nPick the entity with the desired layer to delete: "))- T. t% g( o6 E
  571.    (if (/= a nil)
    0 k2 G2 a0 ?# k& r4 K: W
  572.       (progn (setq a (cdr (assoc 8 (entget (car a )))))  u  G8 {: M1 @% P% n) k4 I
  573.       (command "Erase" (ssget "x" (cons (cons 8 (eval a)) tempword)) ""))8 G# e5 U% P: T8 U* N
  574.       (prompt "\nNo entity selected!"))
    $ b1 w  K) X! g. Y5 i
  575.    (setvar "cmdecho" ocmd)
    * y/ a* j2 r* t& Q, n, p) y) J
  576.    (setvar "blipmode" oblp)! s% g6 T$ ?! L* q3 W8 @8 P: ~
  577.    (setq *error* olderr)
    " k$ B8 d) K3 F) h
  578.    (princ)
    & N/ B- v) k+ l& C/ @
  579. )
    . J# R- n) A9 C
  580. 4 B0 \4 ~1 H0 V. K. Z+ S
  581. (DEFUN C:WL(/ SSET NET SSL M)$ G. E( c+ y7 d1 w# N' W
  582.    (PRINC "\nSelect lines :")
    6 R5 f: l& R- n4 f# b- y
  583.    (SETQ SSET (SSGET))
    7 p$ E$ `8 D% ]4 v: o' s5 m3 |: t. P9 H
  584.    (IF (/= NIL SSET) (PROGN$ a* e+ @. w7 k0 T$ M* V, w3 Z- S
  585.    (SETQ SSL (SSLENGTH SSET))8 u+ F; C# C  F6 l6 G' P0 c0 D6 s
  586.    (INITGET 4)
      w# @/ \& u) p4 i- l1 Z
  587.    (SETQ NET (GETREAL "New width : "))1 N# ~2 U, M5 I
  588.    (IF (/= NIL NET)
    ( F5 L3 r: h7 F2 w6 j$ O* ]
  589.     (WHILE (> SSL 0)# R1 t1 d, T. e- a$ p2 K3 d  R
  590.       (SETQ M (SSNAME SSET (SETQ SSL (- SSL 1)) ))4 M5 r+ `6 p: C4 L1 P2 p6 T& ?
  591.       (IF (= (CDR (ASSOC '0 (ENTGET M))) "LINE")
    ) _7 K$ N  e6 g! r, K) ]' o( K
  592.           (COMMAND "PEDIT" M "Y" "W" NET "") ( g: Q) L7 W4 g$ P7 s. P$ U1 j0 p
  593.       )
    / c; v: a4 [3 b. Q
  594.     ) ! o1 q; _. c. A" B- f
  595.    )))
    $ r! _7 F. ~- M% A
  596.    (PRINC): C7 b3 {* T$ F* N6 Y/ O
  597. )
    ; a+ P  p' r$ |/ n
  598. 1 r# e( @1 ^* n% S( m' \
  599. (defun C:MML ()2 _3 D/ i/ i; N
  600.   (princ "\nSelect objects to move to another Layer.")
    8 S0 l) q$ v# B  \3 Z% K% E
  601.   (setq ss (ssget))
    # w! V' D5 g5 ]2 m( d$ P
  602.   (SETQ UL1(GETSTRING "\nLayer to move entities to : "))9 _% J1 r& l# n) _! {
  603.   (setq counter 0)
    * a: ?  j" l9 l- x' L6 w
  604.   (prompt "Moving to layer.....")(princ ul1)
    ; J7 S5 P: ]: b7 S  W0 Q/ K3 e
  605.   (setq e (ssname ss counter))# L4 G9 I8 L2 L1 y2 K7 X# |& g/ Z
  606.   (setq l (cdr (assoc 8 (entget e))))0 _. {+ Y- {( p/ g" I
  607.   (setq S (ssget "X" (list (cons 8 l))))
    7 s1 W5 [+ T5 E1 U- J
  608.   (command "CHANGE" ss "" "P" "LA" UL1 "")
    & T2 G  F0 `1 V- t+ F# M# z  O
  609.   (setq counter (+ counter 1))- j* Q' U$ w3 H% F
  610. (princ)2 |0 ?( r2 Y% @: b) {% o9 u
  611. )
    $ ^) R# \2 n& o( ]* ^' s& m( {
  612. 5 G& L  b% i8 m5 Z7 C
  613. ;;; ================================ GHI CHU ============================
    . q; [! ?* e$ u- D2 b
  614. ;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========
    0 {6 E3 I+ p. ~% r! x6 G$ X' k
  615. ;;; =======================Thuong Dung Font Romant.vnh===================7 V" ]! R3 _! N
  616. $ r! ]: W4 f+ \7 ?- R7 I
  617. (defun c:RS (/ pta ptb ptc ptd X Y X1 Y1 rmsz pl1)6 c$ K& O  V+ w# M. n( E- k; D
  618.   (setq oer *error* *error* err2)+ {! ^# R" i7 f9 M7 r
  619.   (PROMPT "\n(UNICODE-Verdana)(D)ining room. (S)torage. c(L)oset. (C)onference. (O)ffice. (K)itchen. (B)ath. (M)aster Bedroom. ")) x! Q; |$ i. R: e
  620.   (SETQ Cpt(GETSTRING "\n (ROMANT-vnh)(DD).(SS).(LL).(CC).(OW).(KK).(BB).(MM). (UNKNOWN-font)(oD).(oS).(oL).(oC).(oww).(oK).(oB).(oM)."))
    ( Y* f. ~* l. A
  621.   (IF(OR(= Cpt "K")(= cpt "k"))(SETQ CPT ' "Nha`  Bê´p"))! f, e: v7 }( m" ]1 P- j* g
  622.   (IF(OR(= cpt "B")(= cpt "b"))(SETQ CPT ' "Pho`ng Vê? Sinh"))
      p" |) y8 d. ]. w
  623.   (IF(OR(= cpt "C")(= cpt "c"))(SETQ CPT ' "Pho`ng  Ho?p"))
    7 u% n; ^/ F" {4 L: c  p! a2 U
  624.   (IF(OR(= cpt "O")(= cpt "o"))(SETQ CPT ' "Pho`ng La`m Viê?c"))
    ! H$ ~, z1 N% n" J8 l/ U
  625.   (IF(OR(= cpt "M")(= cpt "m"))(SETQ CPT ' "Pho`ng Ngu?"))
    / E2 w/ p  b& O8 y2 k
  626.   (IF(OR(= cpt "D")(= cpt "d"))(SETQ CPT ' "Pho`ng Bê´p + An")); O4 r; W' o7 Y
  627.   (IF(OR(= cpt "S")(= cpt "s"))(SETQ CPT ' "Nha`  Kho"))
    & \% k0 ]  G& t  f
  628.   (IF(OR(= cpt "L")(= cpt "l"))(SETQ CPT ' "Pho`ng Ðê? Ðô`"))0 f" _# i9 v' ]' ]7 Z- {" m
  629. ; s. R1 k$ g' G$ Q5 F
  630.   (IF(OR(= Cpt "KK")(= cpt "kk"))(SETQ CPT ' "Nhµ BÕp"))
    : A( E! o  L8 h, G' W* |
  631.   (IF(OR(= cpt "BB")(= cpt "bb"))(SETQ CPT ' "Phßng VÖ Sinh"))9 u( y& I% l- l' d2 T2 l
  632.   (IF(OR(= cpt "CC")(= cpt "cc"))(SETQ CPT ' "Phßng Häp"))
    - B2 _* m: ?( S* {( ], [9 _% y
  633.   (IF(OR(= cpt "OW")(= cpt "ow"))(SETQ CPT ' "Phßng Lµm ViÖc"))
      i. G+ \2 }1 o' v' P. }5 M, R8 n8 o
  634.   (IF(OR(= cpt "MM")(= cpt "mm"))(SETQ CPT ' "Phßng Ngñ"))
    * O" |5 T% H+ N8 ~5 @; M1 }
  635.   (IF(OR(= cpt "DD")(= cpt "dd"))(SETQ CPT ' "Phßng BÕp-¡n")). J5 w; m7 C- ~! ^) _
  636.   (IF(OR(= cpt "SS")(= cpt "ss"))(SETQ CPT ' "Nhµ Kho"))  {2 }* d, J5 e. [" L  O7 b1 r$ N
  637.   (IF(OR(= cpt "LL")(= cpt "ll"))(SETQ CPT ' "Phßng §Ó §å"))3 X3 ~0 B, K) g, [5 F
  638. * y# U' [9 ~( f. l% v
  639.   (IF(OR(= Cpt "oK")(= cpt "ok"))(SETQ CPT '"NHA/F BE/M/SP"))
    + O* `, k$ c, O9 @. v, ?
  640.   (IF(OR(= cpt "oB")(= cpt "ob"))(SETQ CPT '"PHO/F/NG TA/W/SM"))  {# m6 }4 A4 {
  641.   (IF(OR(= cpt "oC")(= cpt "oc"))(SETQ CPT '"PHO/FNG HO/JP"))
    , N4 K  r0 w3 @! `/ N
  642.   (IF(OR(= cpt "oww")(= cpt "oww"))(SETQ CPT '"P.LA/FM VI/E/M/JC"))+ Z0 u0 B$ r% d( c, h$ z) T6 f
  643.   (IF(OR(= cpt "oM")(= cpt "om"))(SETQ CPT '"PHO/FNG NGU/R"))4 K& e5 J5 _8 P. e# E; @
  644.   (IF(OR(= cpt "oD")(= cpt "od"))(SETQ CPT '"PHO/FNG A/WN"))
    & m% \8 j+ e2 n/ S* n' _
  645.   (IF(OR(= cpt "oS")(= cpt "os"))(SETQ CPT '"NHA/F KHO"))
    7 e6 l8 o: h9 D% o. k2 m
  646.   (IF(OR(= cpt "oL")(= cpt "ol"))(SETQ CPT '"PHO/FNG /DO/M/F"))
    - ]5 }  L; j) c! [; q
  647. (setq pta (getpoint* i4 p% c9 G; C1 z7 T6 a. [
  648.     "\nPick first corner. : "))  x; M7 k& o% f8 m
  649.   (setq ptb (getcorner pta
    ; f" h  h/ N1 s3 p1 h! b9 C1 [
  650.     "\nPick second corner. : "))
    ( Q2 t! e7 w7 t; M+ h" K. z- o7 b
  651.   (setq ptc (list (car ptb)(cadr pta)))
    8 L- b2 ^: R* n2 L1 {! l
  652.   (setq ptd (list (car pta)(cadr ptb)))
    0 f0 N6 `0 D3 V5 H; X* \
  653.   (setq ang (angle pta ptb))0 l9 m0 v9 z  s; g: `( u
  654.   (setq d1 (/(distance pta ptb) 2))
    1 s9 A6 j& o2 y2 f5 w
  655.   (setq cp (polar pta (- ang (dtr 0)) d1))* T5 ~$ p& X. J, X& A! ]; _( D% |% X
  656.   (setq X (distance pta ptc))
    ' i, M% I0 @$ T" z
  657.   (setq Y (distance pta ptd))
    8 r% }4 H& L5 R7 _( L
  658.   (setq X1 (rtos x 2 1))0 ]( H5 t' x8 A2 A/ }$ u
  659.   (setq Y1 (rtos y 2 1))  A0 K  j& ]$ G6 x
  660.   (setq rmsz (strcat "(" X1 " x " Y1 ")"))7 u9 P/ [. D: N. {9 O5 W
  661.   (command "TEXT" "c" cp "0" CPT "ROMANT-TEXT" "" rmsz))1 ~8 m, [* {0 F* p. U/ E
  662.   (defun dtr (angg)
    4 C4 C1 H. v! F* x! G
  663.   (* pi (/ angg 180.0)))
    2 z( L4 J, S1 K! t4 R
  664. 8 ]' F  C% R" R; `  W
  665. (defun c:WS (/ pta ptb rmsz pl1)
    2 S" a0 F" s8 I7 o
  666.   (setq oer *error* *error* err2)
    , w6 d4 P  u' a
  667.   (PROMPT "\n (RomanT.TXT)floorp(L)an.(E)levation.(S)ection.(M)planFoundation.(C)Found.(K).(P).")" B/ @8 V% F' o% ^3 b) R
  668.   (SETQ Cpt(GETSTRING "\n (VnHELVH.Vnh)(LL)floorplan.(EE)elevation.(SS)section.(BM)planFoundation.(CM)foundation.(KC)Structure.(PP)perspective."))
    2 s, C- E# E1 R: U( X% @
  669. 7 s# u+ L2 V3 s' v! r0 Y
  670.   (IF(OR(= Cpt "LL")(= cpt "ll"))(SETQ CPT ' "MÆt B»ng TÇng 1 : TØ LÖ - 1:100"))
    3 R' T4 U5 U4 o( w) q, }& H
  671.   (IF(OR(= cpt "EE")(= cpt "ee"))(SETQ CPT ' "MÆt §øng Trôc ?-? : TØ LÖ - 1:100"))
    + h, ?( T& L3 W& C  V; d7 f
  672.   (IF(OR(= cpt "SS")(= cpt "ss"))(SETQ CPT ' "MÆt C¾t A-A : TØ LÖ - 1:100"))
    ( n$ X9 n) S- g: W6 a
  673.   (IF(OR(= cpt "BM")(= cpt "bm"))(SETQ CPT ' "MÆt B»ng Mãng : TØ LÖ - 1 : 100"))
      p) G; @4 L! s, u7 u5 _
  674.   (IF(OR(= cpt "CM")(= cpt "cm"))(SETQ CPT ' "MÆt C¾t Mãng : TØ LÖ - 1 : 100"))' V' c8 y. R# |, K7 c
  675.   (IF(OR(= cpt "KC")(= cpt "kc"))(SETQ CPT ' "KÕt CÊu Khung Däc Nhµ : TØ LÖ - 1 : 100"))
    $ b6 |5 U- Q) A% C3 A
  676.   (IF(OR(= cpt "PP")(= cpt "pp"))(SETQ CPT ' "Phèi C¶nh Mét Gãc Nh×n"))  s# u6 \0 C* W9 {" J

  677. 9 e, i' e8 Q1 M; U7 z9 M
  678.   (IF(OR(= Cpt "L")(= cpt "l"))(SETQ CPT '"MA/W/JT BA/W/FNG TA/M/FNG 1 : TI/R LE/M/J - 1:100"))1 ]& \2 K1 @/ g8 _$ _- l2 P, P
  679.   (IF(OR(= cpt "E")(= cpt "e"))(SETQ CPT '"MA/W/JT /D/}/SNG TRU/JC ?-? : TI/R LE/M/J - 1:100"))
    4 Y5 p6 C7 @% {1 x, D1 K; [: D
  680.   (IF(OR(= cpt "S")(= cpt "s"))(SETQ CPT '"MA/W/JT CA/W/ST A-A TI/R : LE/M/J - 1:100"))7 f5 i+ ~. \% X/ z
  681.   (IF(OR(= Cpt "M")(= cpt "m"))(SETQ CPT '"MA/W/JT BA/W/FNG MO/SNG : TI/R LE/M/J - 1:100"))
    3 M7 r" V$ g: K5 [/ y) b
  682.   (IF(OR(= Cpt "C")(= cpt "c"))(SETQ CPT '"MA/W/JT CA/W/ST MO/SNG : TI/R LE/M/J - 1:100"))
    . R6 H; I' ^. j1 y. X$ ^4 u$ k
  683.   (IF(OR(= Cpt "K")(= cpt "k"))(SETQ CPT '"KE/M/S/T CA/M/SU KHUNG DO/JC NHA/F : TI/R LE/M/J - 1:100"))8 H0 _3 d. Z3 l( O$ R
  684.   (IF(OR(= cpt "P")(= cpt "p"))(SETQ CPT '"PHO/M/SI CA/R/NH MO/M/JT GO/SC NHI/FN"))  ]' d2 V7 Q" B9 ~- k& y$ k/ U2 |
  685. (setq pta (getpoint+ S/ Q' ]% y' t5 X6 B
  686.     "\nPick first corner. : "))
    ) z7 _5 l& J( u# F
  687.   (setq ptb (getcorner pta
    # W9 V, ]7 Y9 [$ b
  688.     "\nPick second corner. : "))% s1 h" }$ z' C/ _5 v; I
  689.   (setq ptc (list (car ptb)(cadr pta)))# F! S/ H! I8 N* [2 w
  690.   (setq ptd (list (car pta)(cadr ptb)))
    3 r0 ]! A+ y* w6 f
  691.   (setq ang (angle pta ptb))6 o8 o& Z9 P2 q/ b9 k) v
  692.   (setq d1 (/(distance pta ptb) 2))2 a  P" D/ r! m
  693.   (setq cp (polar pta (- ang (dtr 0)) d1))  i2 E! F; Y- v+ p" a
  694.   (command "TEXT" "c" cp "0" CPT "ROMANT-TEXT" "" rmsz))
    2 k+ U0 O6 y- l. A, g
  695.   (defun dtr (angg)
    1 h" \2 A9 n( g
  696.   (* pi (/ angg 180.0)))' Y4 {; T- p* G* F

  697. % Q* v! K% v1 `4 ]. b- q! d( k
  698. ;;; ================================ GHI CHU ============================) ?8 w$ z( x6 L1 v
  699. ;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========9 t, B& }- o+ B4 D" I, X2 F: K
  700. ;;; =======================Thuong Dung Font Romant.vnh===================2 q% S% ]8 C# i4 {, j& `
  701. / L. K: i" N3 ^( ]
  702. (defun c:RRS (/ pta ptb ptc ptd X Y X1 Y1 rmsz pl1)1 w8 o  g( @0 e' U
  703.   (setq oer *error* *error* err2)" x' t, _+ \2 ^+ l; k+ v4 q
  704.   (PROMPT "\n(D)ining room. (S)torage. c(L)oset. (C)onference. (O)ffice. (K)itchen. (B)ath. ")
    ( |3 H( P8 t0 I3 |
  705.   (SETQ Cpt(GETSTRING "\n(M)aster Bedroom. (DD). (SS). (LL). (CC). (OO). (KK). (BB). (MM). "))
    - `# X3 W. G$ U* o+ ]" u- W6 }
  706.   (IF(OR(= Cpt "K")(= cpt "k"))(SETQ CPT ' "Nhà B?p"))
    7 m, y! O5 t3 V
  707.   (IF(OR(= cpt "B")(= cpt "b"))(SETQ CPT ' "Phòng T?m")); K# f" k0 d0 Z  M: u" R) X
  708.   (IF(OR(= cpt "C")(= cpt "c"))(SETQ CPT ' "Nhà H?p")): Q9 j4 W+ ?! ~1 p
  709.   (IF(OR(= cpt "O")(= cpt "o"))(SETQ CPT ' "Phòng Làm Vi?c"))
    . e+ b# k; Y2 s9 I9 `3 J
  710.   (IF(OR(= cpt "M")(= cpt "m"))(SETQ CPT ' "Phòng Ng?"))) O3 R' d* a( W- l# t( @; K
  711.   (IF(OR(= cpt "D")(= cpt "d"))(SETQ CPT ' "Phòng B?p-An"))
    & K' Z7 T: D7 H" v& z* q* P
  712.   (IF(OR(= cpt "S")(= cpt "s"))(SETQ CPT ' "Nhà Kho"))
    % c% [- _7 O- Z" Y
  713.   (IF(OR(= cpt "L")(= cpt "l"))(SETQ CPT ' "Phòng d? Ð?"))
    ) z* C- v  {7 M: S0 {5 o& C4 B9 N
  714.   (IF(OR(= Cpt "KK")(= cpt "kk"))(SETQ CPT ' "Nhµ BÕp"))
    " V4 D- C9 Z) m
  715.   (IF(OR(= cpt "BB")(= cpt "bb"))(SETQ CPT ' "Phßng VÖ Sinh"))( w' Z2 L1 H, s! F4 O2 N3 Y8 y3 H
  716.   (IF(OR(= cpt "CC")(= cpt "cc"))(SETQ CPT ' "Phßng Häp"))
    ) s" N( m: Q" H* C! Y; ^: r$ S
  717.   (IF(OR(= cpt "OO")(= cpt "oo"))(SETQ CPT ' "Phßng Lµm ViÖc")), T# U1 X' c7 {7 b
  718.   (IF(OR(= cpt "MM")(= cpt "mm"))(SETQ CPT ' "Phßng Ngñ"))
    ; \. Q. T" o* F+ {" @0 F, L
  719.   (IF(OR(= cpt "DD")(= cpt "dd"))(SETQ CPT ' "Phßng BÕp-¡n"))
    * [8 z% W! P: Z) m" ]
  720.   (IF(OR(= cpt "SS")(= cpt "ss"))(SETQ CPT ' "Nhµ Kho"))
    5 t5 x: D& P) E, _4 ]4 m; ?5 q
  721.   (IF(OR(= cpt "LL")(= cpt "ll"))(SETQ CPT ' "Phßng §Ó §å"))
    3 `( q) X- y2 T( u* y: m
  722. (setq pta (getpoint
    + N9 W. Y. m3 a1 }8 `; [
  723.     "\nPick first corner. : "))9 o# _/ I5 w! c5 @
  724.   (setq ptb (getcorner pta+ r$ K: f" P" `2 F, w) S7 o
  725.     "\nPick second corner. : "))! Y7 ]6 I7 h4 D: t
  726.   (setq ptc (list (car ptb)(cadr pta)))% u) v  V4 Z' d4 j. e; a
  727.   (setq ptd (list (car pta)(cadr ptb)))% R% W0 D3 S# F6 r! U/ d4 G# E
  728.   (setq ang (angle pta ptb))
    + j& m! T# Y& u( e
  729.   (setq d1 (/(distance pta ptb) 2))
    * \1 A) O1 }  r6 j. d
  730.   (setq cp (polar pta (- ang (dtr 0)) d1)): I" m; k* h+ e/ S. p1 k2 B
  731.   (setq X (distance pta ptc))
    + s! u4 u. ]/ i" T0 C* O$ L
  732.   (setq Y (distance pta ptd))
    9 u1 [- N% A, a2 [/ @2 L
  733.   (setq X1 (rtos x 2 1))# d8 H. U2 Y, S2 |4 i
  734.   (setq Y1 (rtos y 2 1))# Z# `& s" |! c, ?
  735.   (setq rmsz (strcat "(" X1 " x " Y1 ")"))9 B" [1 n3 {6 S% r/ t* H
  736.   (command "TEXT" "c" cp "0" CPT "text" "" rmsz))5 {  r" _: o8 P7 n
  737.   (defun dtr (angg)
    8 h8 f. K/ z# j. H& ]
  738.   (* pi (/ angg 180.0)))2 E/ W- I7 q2 f+ D7 {. h/ ]2 a

  739. , V9 W* m6 Z' t$ E: {" Q9 E
  740. ;;; ================================ GHI CHU ============================: N0 A% q6 J/ Y
  741. ;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========8 b8 a6 e% @3 S5 n1 `$ `
  742. ;;; =======================Thuong Dung Font Romant.vnh===================/ N7 ~' ?  K. W" N( B. a

  743. / [2 o3 Q* X6 D, b5 P; u3 j
  744. (defun c:GS (/ a b c d)
    " ~- [4 }* ]4 E! r' S
  745.   (graphscr)6 K1 G! v9 v% R, w+ r; V
  746.   (prompt "\nSelect text to set style....")
    1 L1 I  o) \, S9 C# j% \( l
  747.   (setq a (entsel))
    ' l3 W# n- J1 T# z$ V
  748.   (setq b (entget (car a)))" y+ ?3 k6 E; j0 _, K
  749.   (setq c (cdr (assoc 7 b)))5 [5 m+ W. A" f( r8 Q
  750.   (setq d (cdr (assoc 40 b)))
    : x* g0 d( t" @) F& ^: Y
  751.   (command "style" c "" d "" "" "" ""))
    ; Z5 w; s0 \; s8 b
  752.   (princ "\nType GS to set text style.")& y3 W; w1 c% s# Q4 i% A3 ?
  753. " }& n0 V3 ~  D- v7 u
  754. (defun c:RC (/ olderr ocmd oblp pt1 pt2 pt3 pt4 l w)/ U8 W% P* k3 ^) L) {
  755.   (setq olderr *error* *error* myerror)
    6 ^2 Q1 |; P+ C" S, {
  756.   (setq ocmd (getvar "cmdecho"))
    ' z: o# N9 i1 N) c( N# u  f
  757.   (setq oblp (getvar "blipmode"))+ ?; A- {4 f) n. l/ W
  758.   (setvar "cmdecho" 0): d$ y5 N2 M* `9 d2 F0 y& u
  759.   (initget 1)                         ;3D point can't be null
    * [  K7 U3 f6 M3 H$ j6 \8 ^) X% V
  760.   (Setq pt1 (getpoint (strcat "\nCorner of rectangle or square: ")))
    + R0 J' \/ v- C) K% y4 F! D+ F
  761.   (setvar "ORTHOMODE" 1)3 F1 A* y1 D7 i/ b# ?1 @2 [
  762.   (initget 7)                         ;Length can't be 0, neg, or null
    / L5 h1 F) ?! i2 _# v, ~
  763.   (Setq l (getdist pt1 "\nLength: "))
    % x5 S# G, d! }: i/ Q
  764.   (Setq pt2 (list (+ (car pt1) l) (cadr pt1) (caddr pt1)))& P; r  C  L( ]5 \
  765.   (grdraw pt1 pt2 2)1 |4 F' R# ?0 k
  766.   (initget 7 "Square")                ;Width can't be 0, neg, or null
    : l8 H2 q+ d0 A: j: K- n. u* S' S
  767.   (setq w (getdist pt1 "\nSquare/<Width>: "))
    4 c: w+ f) l- ]) ~$ N3 u
  768.   (if (= w "Square")
    1 }* X' a3 ^2 C- A: J* h
  769.       (setq w l)
    0 ^  J) E& ?" d+ N  J; H. `1 ^1 S
  770.   )
    ) }3 Y& `' X/ r( v: I5 h1 v
  771.   (setq pt3 (list (car pt2) (+ (cadr pt2) w) (caddr pt2)))
    ' R% _$ \$ z3 Z6 D- P7 o, u
  772.   (setq pt4 (list (car pt1) (+ (cadr pt1) w) (caddr pt1)))
    ' I7 ~* K) f- E5 t3 V- v
  773.   (grdraw pt2 pt3 2)
    . I, o* w: z# n3 Y9 a
  774.   (grdraw pt3 pt4 2)
    % P0 _8 ^* j; j2 m5 q+ c) E
  775.   (grdraw pt4 pt1 2)
    3 J9 Q3 K2 w! q$ u% y9 N, N
  776.   (setvar "ORTHOMODE" 0)
    % y- a6 z) o4 g
  777.   (command "pline"  pt1 pt2 pt3 pt4 "close")
    6 d* P7 F- G1 a) m
  778.   (setvar "cmdecho" ocmd)
    6 W! [0 P% R) D5 D# h4 o/ |% d  ~
  779.   (setvar "blipmode" oblp)
    & k  {$ O4 a& L% B9 ~/ g  [1 Q6 Q& Q
  780.   (setq *error* olderr)               ; Restore old *error* handler+ c! p* Q0 J8 _% ^- ?/ f/ D
  781.   (princ)
    * c8 S( X& E0 y
  782. )
    , w- z! \! v9 z2 e' e

  783. ) l3 `' b* L! H" z+ A3 t, T
  784. (defun c:SG (/ ent pt1 pt2 ang): O$ D7 q* A" l9 M. C( k
  785.   (setq cmd (getvar "cmdecho"))$ W, M" m: H- f1 h8 f/ V1 j5 b
  786.   (setvar "cmdecho" 1)
    $ [0 p; Z3 H5 G) @: ^4 C
  787.   (prompt (strcat"\nSnap angle will be set to angle of line"))* \9 ]* h; R( Y& Y% f% V! c
  788.   (setq ent (entget (car (entsel))))
    ( Y+ e/ P2 |2 S' {8 [
  789.   (setq pt1 (cdr (assoc 10 ent)))
    8 H/ b/ k: F- r7 C9 Q+ q+ h
  790.   (setq pt2 (cdr (assoc 11 ent)))+ w7 S" I5 ^, a' }8 w: o6 ?6 V
  791.   (setq ang (angle pt1 pt2))1 `7 Y$ [5 I2 j7 M; E# R
  792.   (setq ang (/ (* ang 180.0) pi))" R; d8 W+ ~5 l/ n! O, s7 p/ B
  793.   (setvar "cmdecho" 0)
    7 @" {; i) o3 C/ Q5 I5 D' w) k# ~
  794.     (command "setvar" "snapang" ang)
    . j  ?- T; T$ r. U* W/ K
  795.     (setvar "cmdecho" cmd)1 e1 f- B! t: G
  796. )
      ^. y1 d( a, \$ ^, y. L9 X; k* c
  797.   X& \+ V+ w* k0 |( S2 [
  798. (defun C:TG ()0 e1 q$ m2 t# w2 ?! t
  799.   (initget "Increase New")
    7 ?0 {5 m6 r/ H+ N9 Z% @
  800.   (setq ans (getkword "Increase/<New>: "))( e% U& F( H8 C6 ]2 @
  801.   (modang)8 S, }% U' T2 x% R! K2 ]) l. a; ?
  802. )
      Y7 D' t4 g, \5 k
  803. (defun modang (/ ang ss ca e na ssl)
    5 f& q4 \- y2 d. g8 Q- T# q# G7 O
  804. (if (= ans "Increase")
    % b* Y" k9 B9 h( |! h$ L  B* C6 ^3 _
  805.      (princ "\nIncrease angle for text by: ")) ^' K* Y  o' i' v4 d) r+ B
  806.      (princ "\nNew angle for text: ")& q  ?" F& j5 t5 a! b$ [
  807. )
    * J4 f2 a3 T$ E7 y! e5 T6 j; k: q
  808. (setq ang (getreal))
      m1 l4 P  Q2 t8 u9 Z) ^' G
  809. (setq ang (* (/ ang 180) pi))3 w+ X6 A: _7 r0 a7 X) b% g5 j7 v
  810. (setq ss (ssget))9 e# C! c4 ]* L8 H8 i3 a
  811. (setq ca 0 ssl (sslength ss))
    * C- T  M0 s8 R
  812. (while (< ca ssl)( c) D+ X9 z% x2 r1 I; |
  813.   (if (= "TEXT" (cdr (assoc 0 (setq e (entget (ssname ss ca))))))- F- a% a8 r0 i& U, D
  814.    (progn4 Q1 w4 D) ]" g1 w
  815.     (if (= ans "Increase")
    ! C  [* K% A( p$ I  E. K- |
  816.         (setq na (cons 50 (+ (cdr (assoc 50 e)) ang)))2 @) U$ l) i0 T* M9 J2 J$ P
  817.         (setq na (cons 50 ang))2 z; T; d/ u* w5 k$ B
  818.     )7 |0 r3 l1 D: k4 a
  819.     (setq e (subst na (assoc 50 e) e)), N% m5 u( y# N- U1 l
  820.     (entmod e)
    9 c$ c2 ~$ G0 }* L
  821.   (setq ca (1+ ca))$ `, j+ }# T1 ^6 P. M$ v3 f
  822. )
    ; d! t2 R# ~! }" \
  823. )
    $ x: {3 b& z; p5 t) }  P4 e& G5 M
  824. )- A3 ?: n6 ?( Y+ g# r+ {( f/ T
  825. (terpri)
    5 c% O( P( Q/ x3 t/ b+ E6 F2 s
  826. )' w, p6 E. |$ y) K

  827. * ]" @' ]4 B/ b7 {' J6 p

  828. 8 \" k! ]  h9 }
  829. (defun c:WL (), u7 @/ U5 M; W4 b& c+ W3 }( O
  830.   (setvar "cmdecho" 0)
    - t: g3 L# t  V/ j
  831.   (setq a 1)9 d8 I! y7 z' b7 w6 m% ~4 ]
  832.   (prompt "\nSelect Polylines to change: ")' V$ S/ j1 F, g- a: w- P& I- e
  833.   (while (/= a nil)1 \% r6 p! k) l5 r' }* C# c; V  z8 o
  834.     (progn. a0 K1 j+ r: G% W$ s
  835.     (setq a (entsel))
    * O" V" z# h, w; t
  836.     (if (/= a nil)2 h" }9 n: `$ Y! {3 k# T- B
  837.         (progn
    9 e: r: T& `: W; p8 d/ B8 e+ c5 p
  838.           (setq b (entget (car a)))
    5 A, _8 O. D6 y. E
  839.           (setq c (cdr (assoc 40 b)))
    7 [- J, L( [( Y( R- l
  840.           (princ c)
    " E, ~$ D& D5 b0 [& N) c' F0 s
  841.           (command "pedit"a"w""lw""")
    9 k2 f7 ^* W2 U
  842.         ))))
    5 N$ y/ b* J% F' n6 r
  843.   (princ)
    1 [4 R: g# R6 O
  844. )2 I3 s  L2 F7 S
  845. " c' v; n1 _6 w  r
  846. ;;; ================================ TEXT FIT ============================
    ; M8 K2 [, F/ M: z3 X& ^0 g% B* }$ b3 G
  847. 7 t* l/ ?6 A* ?0 F; c" d
  848. (Defun c:FT ( )7 e+ g% H6 l4 [4 b5 f! Z5 x
  849.   (defun setsnapang (arg /) (setvar "snapang" (angtof (angtos (cdr (assoc 50 arg)) 0 8) 0 ))  )+ T! R: e, a$ b( e/ d- ^3 N& [- q7 ]
  850.   (Defun LL-xyz (arg) (CAR (TextBox arg))  )
    ; ^* p( u3 L$ S8 b+ k& j
  851.   (Defun UR-x (arg) (CAADR (TextBox arg))  )
    4 H2 @1 m! b& Q3 c& R: u
  852.   (Defun LL-y (arg)     (CADAR (TextBox arg))  ), K# r" K3 Y; r0 `
  853.   (Defun LR-xy (arg)     (List (UR-x arg) (LL-y arg))  ); B* W# \# V6 f: _1 q( E3 K0 o9 O3 \
  854.    (Setq ename (CAR (EntSel "\nSelect Text to stretch/shrink:"   )  )
    / {% k  @# z) Y3 n$ e
  855.       Textent (If ename (EntGet ename))   )   0 J" z9 X7 ?; T( A
  856.    (If (= (CDR (Assoc 0 textent)) "TEXT"). A4 k: r( w7 j7 B8 v; e  Z
  857.       (Progn (initget 0 "Start")# a6 m$ i+ [' Z; ?6 a
  858.          (Setq  NewEnd  (Distance  (LR-xy Textent) (LL-xyz Textent) ) )
    " G3 W+ J  d4 X, k( P
  859.          (setsnapang Textent)                 ;set snap along text entity
    $ [) p+ E; U. \9 m$ N" L
  860.          (setvar "ORTHOMODE" 1)                   ;drag along the text8 A9 z/ C5 b/ S
  861.          (setq
    7 Z9 s9 i+ a+ O1 F2 K
  862. TMP (getpoint (cdr (assoc 10 Textent)) "\nStarting Point/<Pick new ending point>: ") )
    $ ~& F0 e3 [2 Y" M1 G  V) |' y
  863.          (setvar "snapang" 0)$ ?* U* F5 f5 c) D- G9 b7 g5 H# T
  864.          (cond" b& ]) P3 Z" D4 S) X" G, s2 {- D: f0 F
  865.            ((= (type TMP) 'STR) ;;new starting point to be selected) H. X4 M1 ^8 m8 U/ X' E& A4 u# U) e
  866.                (setq Start (getpoint "\nPick new starting point: "))
    ( \1 ^6 T, T$ Y9 J
  867.                (if Start  (progn9 G+ l2 X! U2 _3 u* p0 s
  868.                   (command "_UCS" "_E" (cdr (assoc -1 textent)))
    : Y( {3 h( k, ^
  869.                   (setvar "ORTHOMODE" 1)6 Q6 e& |0 j  P: Y5 z
  870.                   (setq NewPt
    6 ^! ]0 P) H  v& [9 L8 j) C
  871.                         (if Start
    - T! y) [( F, R9 r' @+ m( k* t4 c
  872.           (getpoint (trans Start 0 1) " ending point: ") nil ) )4 _4 o  t  |( ]; N( {6 w$ Q
  873.                   (if NewPt (setq NewPt (trans NewPt 1 0))), n, X' z# X/ f8 F9 ^1 R& B
  874.                   (setvar "ORTHOMODE" 0)
    # s! i% e/ b  f9 K- g
  875.                   (command "_UCS" "_W") ) ) )
    # [& E8 K- }& ~- L* `' i
  876.            ((not (null TMP))    ;;new ending point selected
    7 [: l& b6 K  \! U/ o! E3 W) ~
  877.                (setq Start (cdr (assoc 10 Textent)) NewPt TMP)  )
    : B/ Y7 H' |/ i5 ^; c$ \9 q7 u
  878.            (t  (setq Start nil NewPt nil) ) )
    ; q7 c$ j( l8 J! X/ F
  879.          (if (and Start NewPt) (progn2 S- q, n* P' M! H
  880.            (setq Val (Assoc 41 Textent) ;;current width factor
    , u8 T2 @  V2 h+ V3 R* O* c
  881.                  Val (if Val (cdr Val) 1.0)  LTC_%      
    ; K- w7 Y) r+ T
  882.           (* (/ (Distance Start NewPt) NewEnd ) Val )
    & i4 F* y; ~! [3 ]( T9 r, [& e0 p+ ]  |
  883.                  textent (Subst (cons 41 LTC_%); ~) o) W' A: l/ u
  884.            (assoc 41 textent) textent)+ A% E  I/ X  g! o
  885.   textent (subst (cons 10 Start) (assoc 10 textent) textent)
    6 f8 L3 o. c( J
  886.   textent (subst (cons 11 NewPt) (assoc 11 textent) textent) )( T$ j$ z$ o. V  \9 H
  887.    (EntMod textent) (EntUpd (cdr (assoc -1 textent))))))) (Princ))! u+ l4 d' T5 O- S$ H2 [+ m- g

  888. 8 P7 Z, j0 q6 k% Y+ q( T/ X
  889. ;=====================================================================4 Z8 Y3 u/ S- r& g( g/ D7 u
  890. ;=========================COPY + ROTATE ==============================
    - r- a( B, N$ T7 n* F
  891. ;=====================================================================1 A6 C1 b( Q1 |" V

  892. & k( o9 }, O- r' R0 o% K6 q8 @
  893. (defun c:CR(/ olderr cm loop ss1 ss2 bp mult lent ss2 lp1 lp2)' U: ]5 Z% L; X3 O% I
  894.   (setq olderr *error*
    ! i4 f# P6 `8 {) B' a" }% ~
  895.         *error* croerr)
    2 V' ?: H# u9 V7 |/ \# t' \: |
  896.   (setq cm (getvar "cmdecho"))
    3 O* k/ G6 T/ i5 D% H2 ~
  897.   (setvar "cmdecho" 0)
    4 \& z# h/ |7 x( _8 L) O7 O2 w
  898.   (setq loop t)
    # N' |# f; d. s/ l
  899.   (while (not (setq ss1 (ssget))))+ F, L( P+ t3 D/ e
  900.   (initget 1 "Multiple")
    # t1 a. p- q: \4 A# v  e9 ^9 J
  901.   (setq bp (getpoint "\nBase point or displacement>/Multiple: "))
    # ~+ u5 M, r* d) Y
  902.   (if (= bp "Multiple")$ ?4 [3 Q% o  l8 o
  903.     (progn
    4 S5 k( ]  X9 C$ y
  904.       (setq bp (getpoint "\nBase point: "))
      w: J' w3 P. |* \5 A/ H' A
  905.       (setq mult t)% R: n# |/ F9 C3 @, g# `
  906.     )
    ) z1 K- a$ t& c+ T7 @2 q
  907.   )
    4 ?" _6 a7 _+ c& e/ p7 K
  908.   (while loop
    8 T! ?1 J1 m, _7 W4 w, X
  909.     (setq loop mult)5 m5 Q9 J8 j& E- s
  910.     (setq lent (lastent))
    3 T$ m  ?2 ?2 Z& X. E# x! x, \
  911.     (command ".copy" ss1 "" bp bp)2 b% \: n+ d( Q3 m) x
  912.     (setq ss2 (lss lent))
    ! v0 _7 D5 }& m7 c1 \
  913.     (setq lp1 (getvar "lastpoint"))0 \  @- s5 n6 ]0 X6 b* V
  914.     (prompt "\nSecond point of displacement: ")7 O( z8 `0 f) A
  915.     (command ".move" ss2 "" bp pause)( {) h6 f( B% p" i2 k1 W* X
  916.     (setq lp2 (getvar "lastpoint"))3 ]' g! r: V# @
  917.     (redss ss1)
    * h* S' n0 ~% X% _2 I1 t8 L
  918.     (if (and (not mult)
    ; }4 s: K3 l6 e3 n  O- F
  919.              (= (distance lp1 lp2) 0)
    6 r$ u0 P1 s3 l) y6 e2 Q  b
  920.         )
    7 _! D9 F2 ?' J7 W5 C3 l. v5 ?0 z4 E
  921.       (setq lp2 (getpoint "\nRotation Point: "))
    8 R3 `6 B& X5 j* N; ?7 S
  922.     )* L2 @: e  f4 i
  923.     (if mult
    ( E1 M2 Q+ ^6 \4 S5 a7 B: ]. r
  924.       (prompt "\nRotation angle ")# E3 l6 W3 i; d: {
  925.       (prompt "\nReference/<Rotation angle>: ")
    0 S& H# S9 g5 A
  926.     ): }! C( S; ]. y
  927.     (command ".rotate" ss2 "" lp2 pause)
    ) v% e( p& K+ o, w$ P3 q5 t7 b+ q( Q
  928.   )
    7 n/ p" c  J4 {
  929.   (setvar "CMDECHO" cm): t2 T0 V$ p0 _) A& l( M4 T+ `7 s
  930.   (setq *error* olderr)3 i! |9 c& |! y5 }8 w
  931.   (princ)
    ; `3 I( Z; i! @! B% O
  932. )- |, ], i6 u* T; w/ K) A
  933. (princ)% v% ~- U, ~  M/ }3 R# t7 @3 t
  934. (defun croerr (s)        - N( ~" D7 V- @6 w
  935.   (if (/= s "Function cancelled")
    7 @; ]  S8 ]  T4 X7 _
  936.     (princ (strcat "\nError: " s))4 D  g  q5 L( z
  937.   ) 4 F8 l' n1 A5 C( B
  938.   (setq S nil)
    - O8 L, y( C0 K( u; ]+ c
  939.   (setvar "CMDECHO" cm)" n7 i  E- @6 T9 ]  g
  940.   (setq *error* olderr)
    6 v2 K/ y% G1 a  a& B* ~
  941.   (princ)2 t+ ]5 ~0 e/ Q# k) y0 w9 B$ E0 b
  942. )
    4 y. u, ^6 g8 \( U9 _/ k2 d, ^
  943. (defun lastent (/ a b)
    9 B" v# s! T; S
  944.   (if (setq a (entlast))* j( A+ @- n( H3 Q
  945.     (while (setq b (entnext a))
    ! i( u; S, L6 M/ m+ D9 R
  946.       (setq a b); y. d3 t5 ?3 w8 p6 k5 t, M
  947.     )
    ( H  t  |5 c* r4 z9 \) k
  948.   )
    % s" z& o8 N- ?5 ?
  949.   a# H8 O+ m* W1 c7 k
  950. )2 P% E; m5 U4 R1 l; w' d. X
  951. (defun redss (ss / en i)0 Z9 k: e( D6 m
  952.   (setq i 0)
    # \4 O6 L6 f2 j1 x0 q6 i
  953.   (while (setq en (ssname ss i))
    ! |1 f" k, o  N
  954.     (redraw en 1)
    , Y% ]: n" }# \3 s% N2 d
  955.     (setq i (1+ i))8 n  q. K9 ~9 Q' L  p" t
  956.   )2 f8 O' ?- A) H( D
  957. )
    9 S) z! v, W$ f3 @
  958. (defun lss (en / sels ed)/ j' e! F' W3 X$ U1 q/ S
  959.   (setq sels (ssadd))+ {) S: N+ }2 e2 ?4 }  a$ q
  960.   (while (/= en nil)
    . q! p0 P' X# y6 t! p& K
  961.     (if (setq en (entnext en)) (setq ed (entget en)))
    3 X0 h. Y# ~" y" g( L6 ]' S
  962.     (if (/= en nil) (setq sels (ssadd en sels)))
    6 k9 x7 A5 Y# ^/ b
  963.     (if (or (= (cdr (assoc 0 ed)) "Polyline")
    0 u4 r  H( ^) C2 t3 p' D% U
  964.             (= (cdr (assoc 0 ed)) "Insert")
    0 w% G- t7 E3 D. y; @2 C
  965.         )
    6 b& _8 T+ j% U( z
  966.       (while (/= (cdr (assoc 0 (entget (setq en (entnext en))))) "Seqend"))  i! Y7 `% v7 L8 e  P
  967.     )9 c5 j$ j. u+ A7 v
  968.   ), ~; A+ ^. A' }/ T9 d- ~0 }
  969.   sels
    : U3 a0 n  w3 S. }- d; |8 I
  970. )  O/ [" m; O2 t/ ?

  971. 9 n. h$ ?; r+ ?9 I
  972. ;;;; ================== CAC FUNCTIONS DUNG TRONG ACAD.LSP ==================
    ( @) l; D5 N3 ?, e- N! p  D

  973. / q( }: {/ M# j; n6 p+ }& }
  974. (defun c:00 ()(princ "\nChon doi tuong net Defpoints")(ssget)(command "change" "p" "" "p" "la" "Defpoints" ""))( m, ?- n$ j# r# H4 H4 W* H7 @# w' f
  975. (defun c:0 ()(princ "\nChon doi tuong net 0")(ssget)(command "change" "p" "" "p" "la" "0" ""))
    ; |# T- [& X. W1 _! @* X; ?
  976. (defun c:1 ()(princ "\nChon doi tuong net COT")(ssget)(command "change" "p" "" "p" "la" "COT" ""))
    & I7 e  U5 Z) o& H/ a
  977. (defun c:11 ()(princ "\nChon doi tuong net DIM")(ssget)(command "change" "p" "" "p" "la" "DIM" "")). x: M! h( o1 F! ~! A* P
  978. (defun c:22 ()(princ "\nChon doi tuong net MANH")(ssget)(command "change" "p" "" "p" "la" "MANH" ""))
    7 U2 ~! l" }3 A' G: ^( t, {5 q
  979. (defun c:33 ()(princ "\nChon doi tuong net NETMANH")(ssget)(command "change" "p" "" "p" "la" "NETMANH" ""))$ Z( f/ H3 C) d+ G
  980. (defun c:2 ()(princ "\nChon doi tuong net NETDUT")(ssget)(command "change" "p" "" "p" "la" "NETDUT" ""))
    # e' B0 ]4 c4 ?3 e0 ^
  981. (defun c:3 ()(princ "\nChon doi tuong net NOITHAT")(ssget)(command "change" "p" "" "p" "la" "NOITHAT" ""))
    5 L& ~# S0 T" P- U
  982. (defun c:4 ()(princ "\nChon doi tuong net TUONG")(ssget)(command "change" "p" "" "p" "la" "TUONG" "")): _6 _2 _# g( c% u" I  V" y
  983. (defun c:44 ()(princ "\nChon doi tuong net KHUNGTEN")(ssget)(command "change" "p" "" "p" "la" "KHUNGTEN" ""))
    ( D" ^$ V3 ~4 X
  984. (defun c:5 ()(princ "\nChon doi tuong net TIMTUONG")(ssget)(command "change" "p" "" "p" "la" "TIMTUONG" ""))
    : ]& W  y; n6 {' N' s  o  R
  985. (defun c:6 ()(princ "\nChon doi tuong net CUA")(ssget)(command "change" "p" "" "p" "la" "CUA" ""))
    / I  \  e4 z, C' G4 S
  986. (defun c:7 ()(princ "\nChon doi tuong net THAY")(ssget)(command "change" "p" "" "p" "la" "THAY" ""))
    , D% j+ ?& D0 f7 `
  987. (defun c:77 ()(princ "\nChon doi tuong net NETTHAY")(ssget)(command "change" "p" "" "p" "la" "NETTHAY" ""))
    " `8 Y5 K) ^3 V$ N
  988. (defun c:8 ()(princ "\nChon doi tuong net HATCH")(ssget)(command "change" "p" "" "p" "la" "HATCH" ""))
    6 G$ r. R: s4 u" {( b% Q9 V0 D
  989. (defun c:9 ()(princ "\nChon doi tuong net TEXT")(ssget)(command "change" "p" "" "p" "la" "TEXT" ""))
    & b% n9 m" ~: s) L: `
  990. (defun c:99 ()(princ "\nChon doi tuong net CUAMATDUNG")(ssget)(command "change" "p" "" "p" "la" "CUAMATDUNG" "p" "C" "bylayer" ""))
    % z$ U2 s7 d8 A6 e
  991. (defun c:td ()(princ "\nChon doi tuong net THEPDOC")(ssget)(command "change" "p" "" "p" "la" "THEPDOC" ""))
    0 S9 ^" u" W( j# y) S% J6 M: I$ [
  992. (defun c:ddt ()(princ "\nChon doi tuong net THEPDAI")(ssget)(command "change" "p" "" "p" "la" "THEPDAI" "")), u2 J, s( Y/ y/ F

  993. ' Z  Z% A, n+ q# G
  994. ;=============== DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =============
    0 G" I' H0 k$ e  M

  995. $ X$ z6 l, B' x. C) @* A7 I
  996. ;=============== DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =============
    0 V) m+ }8 z6 I* _  Q

  997. 5 a  G: n7 X4 b# L
  998. (alert "Using the NetXuatAnh-[ 5940.00 x 4200.00 <pixels> ] command!")
    4 U0 y* F- @2 u) x  w7 j
  999. (princ "\nEnter (DEFUN C:netxuatanh () to get to real LAYER command.\n") (command "NETXUATANH")
    2 |2 L  C' Z0 e" Q

  1000. # l9 Q5 t6 y  f- e" |  y8 V8 i
  1001. ;=============== DAT LAYER NET de xuat anh JPG [W x H] [5940.00 x 4200.00] ===DRAW===
    2 ]- p% J+ {5 R; F  H3 b

  1002. ' q* o% ?! n2 A/ v0 z
  1003. ;(DEFUN C:netxuatanh ()6 K2 f1 h; ^& z# r$ v5 f
  1004.                  (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.6" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "5" ""$ u: E7 x2 k" Y) f* ]2 Z
  1005.                               "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "1.58" ""
      s( {* V+ q, R9 V  k% q+ k; L
  1006.                                            "M" "MANH" "C" "9" "" "Lw" "0.5" ""
    9 D; i, g. W& M, t0 Z2 ?
  1007.                                        "M" "TEXT" "C" "7" "" "Lw" "0.5" ""
    % D6 G$ v8 K# F) S
  1008.                                        "M" "DIM" "C" "1" "" "Lw" "0.6" ""$ f3 [  d( S' X! R; W
  1009.                                        "M" "THAY" "C" "7" "" "Lw" "0.7" ""9 y4 \" p$ V! B1 w; J& o: H  n
  1010.                                        "M" "NOITHAT" "C" "3" "" "Lw" "0.5" ""
    # z: n8 Q' ^+ ?5 F# H. L. m+ O; W# k
  1011.                                        "M" "HATCH" "C" "5" "" "Lw" "0.35" ""* B5 f/ \. f8 M" m( N& }" Y
  1012.                                        "M" "COT" "C" "2" "" "Lw" "2" ""# h9 B. y  p3 P
  1013.                                        "M" "Defpoints" "C" "7" ""# t% ~% P% m; Z* f. R4 `
  1014.                                        "M" "0" "C" "3" "" "Lw" "0.5" "": g" n: h" G+ A+ y  Y; c
  1015. ;                                       "M" "1" "C" "1" "" "Lw" "0.5" ""% x5 Q1 n6 b3 v, I3 Q3 r
  1016. ;                                       "M" "2" "C" "31" "" "Lw" "0.5" ""4 e2 p" ?2 _4 h
  1017. ;                                       "M" "3" "C" "8" "" "Lw" "0.35" ""- p& t) f6 B8 p  N) U' N! [% v
  1018. ;                                       "M" "4" "C" "4" "" "Lw" "0.8" ""
    7 L" N1 @8 C0 d3 |' y- J
  1019. ;                                       "M" "6" "C" "6" "" "Lw" "0.35" ""3 P( E" R( T+ E' g
  1020. ;                                       "M" "7" "C" "7" "" "Lw" "0.4" ""
    , U! n: L  b' L* E
  1021. ;                                       "M" "8" "C" "8" "" "Lw" "0.35" ""; \, {9 y, i; ~1 P  ~2 m
  1022.                                        "M" "DAY-DIEN" "C" "3" "" "Lw" "0.5" "": ~4 Q- Z$ x7 o/ p7 F
  1023.                                        "M" "DUONGBAO" "C" "7" "" "Lw" "1" ""
    - T) [4 `+ L7 P+ B" P
  1024.                                        "M" "KE" "C" "8" "" "Lw" "0.3" ""7 ~# @( D1 N* I4 q4 p  C1 L
  1025.                                        "M" "KT" "C" "9" "" "Lw" "0.35" ""0 m3 D/ f& E. U5 O& ^9 b5 Y
  1026.                                        "M" "NETTHAY" "C" "255" "" "Lw" "0.7" ""3 \, N& X& n0 X4 n, S$ ^
  1027.                                        "M" "NETMANH" "C" "43" "" "Lw" "0.5" ""+ Y) ~' B; Z* E
  1028.                                        "M" "TBD" "C" "2" "" "Lw" "0.8" ""
    ' ^* a4 o+ ?) E6 P# n" B
  1029.                                        "M" "TEXTTXT" "C" "7" "" "Lw" "0.4" ""
    $ s$ H4 R# ]) M  L- ?: l1 L! d
  1030.                                        "M" "TEXTVN" "C" "132" "" "Lw" "0.4" ""7 f% k# J  g5 f" n6 }7 m% v3 e
  1031.                                        "M" "THEPDAI" "C" "3" "" "Lw" "0.7" ""+ T4 C2 Q/ ~( I- M; {
  1032.                                        "M" "THEPDOC" "C" "2" "" "Lw" "1.58" ""0 e; o* G& |3 B
  1033.                                        "M" "CUA" "C" "6" "" "Lw" "0.5" ""
    8 R! l2 Z2 m' y
  1034.                                        "M" "CUAMATDUNG" "C" "6" "" "Lw" "0.5" ""
    . P7 w* b- V# L7 P) X3 i
  1035. 7 c% r. Y6 f0 F  ?
  1036. ;=============== DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] ===NUOC===- I2 L6 c0 M2 ?) n, n& g
  1037. + t* F7 U9 S8 _; v: |4 E2 U+ Y
  1038.                                        "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.5" ""  }+ U: A5 b$ g, D6 z. K
  1039.                                        "M" "4-WateR_IN" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE1" ""
    3 c$ |9 I' u/ m% o: B$ P
  1040.                                        "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE2" ""
    - X) w9 N% K. f: {" S6 @0 w
  1041. ;                                       "M" "250" "C" "250" "" "Lw" "0.35" ""
    ) g; c. W8 u  U9 p; y5 t
  1042.                                        "M" "KHUNGTEN" "C" "4" "" "Lw" "1" ""  y- ]2 E# E- V, t! M% @( }0 ], d
  1043.                                        "M" "TIMTUONG" "C" "5" "" "Lw" "0.5" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "10" "" )$ _5 \" V5 ~9 R( t3 {- \$ a

  1044. / E& R0 K0 U8 }3 {
  1045. ;=============== DAT LAYER TEXT de xuat anh JPG [DIM] [TEXT] [GHI CHU]======# `6 u9 z3 ?& J6 G2 S
  1046. ;===================================30|04|2024==============================
    9 _6 l! D% m9 V/ n) [
  1047. . I+ P  ]8 g4 o' N0 |$ g7 P* D
  1048.                      (Command "-style" "Vni-VietNam" "vn_vni,vns.shx" "0" "1" "0" "n" "n" "n" )1 e! j2 x+ K( `+ S/ ^
  1049.                      (Command "-style" "Vni-ROMANS-TEXT" "vni-romans,vns.shx" "200" "1" "0" "n" "n" "n" )
    # ~+ X, ^! |- w3 a8 A$ i
  1050.                      (Command "-style" "COTES" "verdana" "" "1" "0" "n" "n" )
    , r% |8 P2 r9 H( R
  1051.                      (Command "-style" "TRUC" "impact" "0" "1" "0" "n" "n" "n" ), x- ?) a; u& p) v* {  s1 h
  1052.                      (Command "-style" "VNHELVLT-Hoa" "vnhelvh,vnh.shx" "500" "1""0" "n" "n" "n" )1 {2 B1 W3 N' y4 G* O
  1053.                      (Command "-style" "VNHELVLT-Thuong" "vnhelv,vnh.shx" "500""1" "0" "n" "n" "n" ); ]" T' g+ H: I: H& e: d
  1054.                      (Command "-style" "STANDARD" "Verdana" "200" "1" "0" "n" "n" "n" )
    . O# p7 ^/ B- P4 l( v' Q  z2 Q0 g
  1055.                      (Command "-style" "VERDANA" "verdana" "200" "1" "0" "n" "n" )
    , h9 I3 v. w' U& ?
  1056.                      (Command "-style" "ROMANT-DIM" "romant,vnh.shx" "0" "1" "0" "n" "n" "n" )2 e2 g$ i( b) s% {8 O+ _* l. h5 z+ r
  1057.                      (Command "-style" "ROMANT-TEXT" "romant,vnh.shx" "200" "1" "0" "n" "n" "n" )(princ)
    ; O/ V, ^4 |& o0 F, {
  1058. . Q2 v. r( R0 s  e2 o8 {1 o
  1059. ;============= DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =DIM-STYLE=
    3 X" ?8 I3 F8 u- b& f
  1060. ;===================================17|10|2024===================================
    / H: K; n: `$ [* b
  1061. 9 C3 U. b6 e/ g/ X8 ]- @
  1062.                      (Command "DIMTXSTY" "ROMANT-DIM" )
    5 D# D0 |: O. p& m3 A; V. O  p
  1063.                      (Command "DIMBLK" "" "Closed" )
    $ v5 U$ i' t% O  W; t2 o9 _

  1064. ; \/ c9 r8 F6 e2 k: f7 X3 x& O6 }2 V4 R" h% z
  1065. ;============= DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =DIM-STYLE=
    ; l' y0 C3 C5 Z) ?* C
  1066. ;===================================17|10|2024===================================5 m+ h$ y9 I& N2 q
  1067. 0 S6 t  I9 x2 y) a
  1068. ;(Command "-units" "2" "8" "1" "8" "" "N")* R2 R+ f; V% \. B( g6 j" N
  1069. (Command "-plot" "Y" "" "publishtoweb jpg.pc3" "User 1 (5940.00 x 4200.00 Pixels)" "Landscape" "N" "Display" "Fit" "Center" "Y" "monochrome.ctb" "Y" "")(princ)
    ; |' X( T7 Z: u3 o

  1070. 5 x+ s$ \& B4 r/ z8 U
  1071. ;============= DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =DIM-STYLE=
    : k! S9 Q! C/ ^; Y: S8 ], W
  1072. ;===================================17|10|2024===================================7 U$ ~# d$ G" i4 J. T
  1073. " L/ N8 X' g4 X8 q: l$ }& y
  1074. ;======== KET THUC - DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =====/ q7 r' z/ |( g& b8 q
  1075. 7 x/ s. p' }" B, T  ~
  1076. ;======================== DAT NET IN & TI LE BAN VE =============================
    0 n- ~4 r2 q+ x

  1077. ) w" S* x! h" {- L0 i2 `* ?
  1078. ;=================LENH VE KHUNG TEN - Tieu Diet Lenh==================
    ( W0 ]  }) j8 s) V# I6 P
  1079. ;=============== DAT KHO GIAY BAN VE - KIEU KHUNG TEN ================; v% \, S( y& F! X8 H3 L
  1080. ;=============================11|07|2025==============================* w; R! X: B* `
  1081. ;Ti Le Ban Ve - 1 : 1004 O; Y' o  x* t
  1082. (Defun c:kta4 (). d  C! R9 K& D& r, T/ Y2 g
  1083.     (setq mv_sc 100);Ti le  ban ve
    ! k+ c1 a4 p* G6 H/ P# o
  1084.       (setq x4  297)% b$ @$ G: W2 {. d+ I
  1085.       (setq y4  210)5 ], |2 g$ |4 @# q- O
  1086.   (setq x4 (* mv_sc x4) 3 F$ g/ Z$ H& R3 u  r% @9 M
  1087.         y4 (* mv_sc y4)  )
    % H- k$ J: P% Q: ~% f# v  f
  1088.   (command  * y, @: n$ J" ~2 ]
  1089.     "LIMITS" "0,0" (list x4 y4); ]8 e/ X" F4 i- ^6 a
  1090.     "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C". Y& D9 N! \; @" u! h, c' @
  1091. ;Khung CHU NHAT Chinh   
    9 h& v3 Q6 H' I; _
  1092.     "RECTANG" "500,500" "@28700,20000"
    ; \) [8 c' a8 ^6 U
  1093.     "RECTANG" "700,700" "@28300,19600"' ]# Q7 n; ~0 q+ v7 B
  1094. ;Khung Ten Chung
    ( B6 A: f7 e0 ^/ v7 \" Q2 ]
  1095.     "RECTANG" "700,700" "@8000,1250"4 l- y+ ?* T/ n
  1096.     "RECTANG" "700,700" "@17300,2500", F; a) x3 N* G  f! e4 b
  1097. ;Ten Ban Ve
    , A8 v3 F, D, `9 L" ]( j3 h
  1098.     "RECTANG" "18000,700" "@11000,1250"
    + t( j8 Y9 e# [% B0 E; {0 O
  1099.     "RECTANG" "18000,700" "@11000,2500"
    7 {5 r% X7 @/ [3 S1 l4 Z1 x
  1100. ;Khung Ti Le + Ngay Thang Nam" e, F( f2 m1 g1 t- f( ?/ C
  1101.     "RECTANG" "22500,700" "@2000,2500", |3 K; y+ o, i+ H* P* A
  1102. ;Khung CHU TRI/ K' W4 V7 [3 _% l
  1103.     "RECTANG" "8700,700" "@3800,2500"! x; \& a+ K% ?, I1 i, z
  1104. "ZOOM" "_a"  ))* e: j) u2 C& U& v
  1105. ;=====================================================================
    5 J1 n3 P" X# F9 y1 j2 V4 c
  1106. ;Ti Le Ban Ve - 1 : 100! b# x: B) ]0 x! O! u
  1107. (Defun c:kt4a (): o8 {- B+ i8 i9 A6 s
  1108.     (setq mv_sc 100);Ti le  ban ve
    * G. a; c0 w: l- B5 X
  1109.       (setq x4  297). h+ r. O1 k6 j# [; x* M3 H$ l
  1110.       (setq y4  210)
    ! T$ X3 n3 @/ K+ F. U
  1111.   (setq x4 (* mv_sc x4)
    % N' w2 I; w: W
  1112.         y4 (* mv_sc y4)  )( t8 b: v0 Y% ^" b  V3 z; A
  1113.   (command  
    8 G6 d0 {) S) J/ Z
  1114.     "LIMITS" "0,0" (list x4 y4)- _( k" M. S) V3 w/ L
  1115.     "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"' k4 i8 D) s& O8 N( i8 w5 B9 r
  1116. ;Khung CHU NHAT Chinh  ( X6 o) c/ {# M2 i8 j
  1117.     "RECTANG" "2000,500" "@27200,20000"
    ! G! o, S% G/ p5 a7 [% E+ F
  1118.     "RECTANG" "2200,700" "@26800,19600"/ |9 \  a' ~. Z, {  ^2 W
  1119. ;Khung Ten Chung
    # C: Y- M9 ]/ c7 ~# ]2 E8 b* Z
  1120.     "RECTANG" "2200,700" "@6500,1250"
    ! A  A/ \7 O2 A/ p1 _2 r: G/ j& n
  1121.     "RECTANG" "2200,700" "@15800,2500"
    % a- H2 A( i5 z; ?2 N  S
  1122. ;Ten Ban Ve/ m( G! o( b% X, w) U& P: Y
  1123.     "RECTANG" "18000,700" "@11000,1250"
    3 |+ L% f3 H! P. u2 ~. L% o% J5 r
  1124.     "RECTANG" "18000,700" "@11000,2500"% b$ @$ m* ?3 I. f9 |% C
  1125. ;Khung Ti Le + Ngay Thang Nam9 G# t& c) I: O* d
  1126.     "RECTANG" "22500,700" "@2000,2500"
    7 \6 V: C5 a* h7 F. `0 l  F
  1127. ;Khung CHU TRI5 V' b2 j) u4 R. S; S4 F
  1128.     "RECTANG" "8700,700" "@3800,2500"
    8 t+ t1 j* c4 G* j: p
  1129.     "ZOOM" "_a"  ))
    ( x0 L! f+ o6 O/ C. F$ ~
  1130. 9 a, s1 n# i4 y3 J( q: R$ Z1 g
  1131. ;;; ============================GHI CHU Khung Ten========================
    ' b) t$ [# ]" J
  1132. ;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========
    9 j8 L# p4 m# t$ g3 e* P6 `
  1133. ;;; =======================Thuong Dung Font Romant.vnh===================
    + ~! k/ D9 i# A6 E+ g

  1134. + |8 D. f* j: g7 v9 m
  1135. (defun c:GhiChu (/ pta ptb ptc ptd X Y X1 Y1 rmsz pl1)
    / |9 h$ q2 d0 p% v' H3 {
  1136.   (setq oer *error* *error* err2)0 R, [, s8 Q# D
  1137.   (PROMPT "\nChuTri. ThietKe. KiemTra. TiLe. Ngay. HangMuc. QuyMo. KieuNha. CongTrinh. KyHieu. TenBanVe. Kts. TranNgocThang. ")& S+ r9 Z- j/ _. g6 ]. `
  1138.   (SETQ Cpt(GETSTRING "\n(CT). (TK). (KT). (TL). (Ng). (HM). (QM). (KN). (CTr). (KH). (TBV). (Kts). (TnT). "))
    7 F' j0 f% C# t
  1139.   (IF(OR(= Cpt "QM")(= cpt "qm"))(SETQ CPT ' "Hå S¬ ThiÕt KÕ Nhµ D©n Dông quy M« :"))
    5 n* W1 N8 F  v9 b5 }) X/ N
  1140.   (IF(OR(= cpt "KN")(= cpt "kn"))(SETQ CPT ' "2 TÇng 1 Tum Thang"))
    1 m% L8 n* s  F4 T$ s7 u4 d
  1141.   (IF(OR(= cpt "CT")(= cpt "ct"))(SETQ CPT ' "Chñ Tr× :")); e, h3 f) F8 C7 S% V( f9 B1 @
  1142.   (IF(OR(= cpt "HM")(= cpt "hm"))(SETQ CPT ' "H¹ng Môc :"))
    - W: s0 S9 S$ c6 {! p4 Z
  1143.   (IF(OR(= cpt "CTr")(= cpt "ctr"))(SETQ CPT ' "Nhµ ë Gia §×nh - Nhµ LiÒn KÒ"))
    8 Y; l! p; [  \
  1144.   (IF(OR(= cpt "TK")(= cpt "tk"))(SETQ CPT ' "ThiÕt KÕ :")); E8 H1 q$ E7 i2 O
  1145.   (IF(OR(= cpt "KT")(= cpt "kt"))(SETQ CPT ' "KiÓm Tra :"))
    * u+ B$ U0 c8 R
  1146.   (IF(OR(= cpt "TL")(= cpt "tl"))(SETQ CPT ' "TØ LÖ :"))
    3 u# v: s: N% U5 o
  1147.   (IF(OR(= cpt "KH")(= cpt "kh"))(SETQ CPT ' "Ký HiÖu :"))' B6 v) W( |& b; E2 O8 T9 `/ }
  1148.   (IF(OR(= cpt "TBV")(= cpt "tbv"))(SETQ CPT ' "Tªn B¶n VÏ :"))7 ~9 n4 L& D1 f- o
  1149.   (IF(OR(= cpt "Ng")(= cpt "ng"))(SETQ CPT ' "Ngµy :"))
    6 v9 {2 S3 x- S- {' `- j) I
  1150.   (IF(OR(= cpt "Kts")(= cpt "kts"))(SETQ CPT ' "Kts. TrÇn Ngäc Th¾ng"))1 ]: x- n6 I2 M& w5 [
  1151.   (IF(OR(= cpt "TnT")(= cpt "tnt"))(SETQ CPT ' "TrÇn Ngäc Th¾ng"))8 \& L' Y; K. X& c7 d
  1152. (setq pta (getpoint  }7 t- N' t, D6 r& _3 o
  1153.     "\nPick first corner. : "))
      B. t7 i8 n3 M7 p& z
  1154.   (setq ptb (getcorner pta' q% c; y! F9 i) b! k9 i
  1155.     "\nPick second corner. : "))$ P% ]# x2 q# S- u5 Y
  1156.   (setq ptc (list (car ptb)(cadr pta)))5 P' i" M3 [: m; I# @
  1157.   (setq ptd (list (car pta)(cadr ptb)))% g$ |8 d; F$ u# ]
  1158.   (setq ang (angle pta ptb))
    , l+ T: g: z% }0 q+ R; a% I
  1159.   (setq d1 (/(distance pta ptb) 2))" f" o; X7 a, U+ P$ J
  1160.   (setq cp (polar pta (- ang (dtr 0)) d1)): B' g& ~9 C5 `& N- e3 H0 y
  1161.   (setq X (distance pta ptc))" Q( t7 y7 u' c
  1162.   (setq Y (distance pta ptd)); l* ~! k" b. R1 a/ N% p  U
  1163.   (setq X1 (rtos x 2 1))
    . y( i+ q! b0 Z/ g
  1164.   (setq Y1 (rtos y 2 1))' N& f! i. w3 D% Y
  1165.   (setq rmsz (strcat "(" X1 " x " Y1 ")"))7 ?4 p+ g; y" a! `
  1166.   (command "TEXT" "c" cp "0" CPT "text" "" rmsz))" L' W+ W. I6 ?9 ~7 V
  1167.   (defun dtr (angg)
    6 u& {. b7 @2 T
  1168.   (* pi (/ angg 180.0)))
    # i1 @6 Q  t2 M0 f; I( T+ Y- L
  1169. $ L4 K2 Q6 S: o) _4 a+ l9 p5 r; ?
  1170. ;=====================================================================
    4 e: ]4 v) K, E6 d1 z3 \
  1171. ;==========================DAT KHO GIAY BAN VE - KIEU 1========================
    / C) I: ]$ O* ], X# ?. c
  1172. ;=====================================================================
    , y& o$ [/ |; j- l

  1173. : S+ z8 R+ n" u- C
  1174. (Defun c:a6 ()" F1 |, y$ N0 F; S5 X
  1175.         (setq mv_sc 100);Ti le  ban ve
    7 C) W( I6 e$ Q" _8 [, z( f9 S
  1176.       (setq x4  74.25)
    8 [7 D0 ]' ]5 E# O+ [' E7 m+ V
  1177.       (setq y4  52.5)
    9 \0 \; d0 O' f" F$ Z$ \
  1178.   (setq x4 (* mv_sc x4) $ G- Q7 O9 B, R" u! e
  1179.         y4 (* mv_sc y4)  )
    ( R# \' g: V0 X( c' U$ p: Q
  1180.   (command  
    * o# H5 R. C" f  S
  1181.     "LIMITS" "0,0" (list x4 y4)! ?5 v: ~3 l! j& Q% x
  1182.     "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
    + w& ~+ c8 t4 w2 S& ^- f; N& v# z5 |
  1183.     "RECTANG" "125,125" "@7175,5000"
    ( r( H4 N, U7 I' s2 ?$ w7 ?
  1184.     "RECTANG" "175,175" "@7075,4900"$ Q) d" s( F3 I1 J7 C8 [, s. ?. Q
  1185.     "ZOOM" "_a"  ))
    6 K% C- z. r4 h: `5 c
  1186. ;=====================================================================- z' [$ Z, Z; g& x( `& ^' [
  1187. (Defun c:a5 ()* ~" v( B- O, e5 r$ U: e
  1188.         (setq mv_sc 100);Ti le  ban ve( b( J7 e+ u8 N% c
  1189.       (setq x4  147.5)
    # ~3 W0 _1 h0 s8 \; B
  1190.       (setq y4  104)0 N* Z2 |* Z9 K0 L
  1191.   (setq x4 (* mv_sc x4) 4 J' M) u, z+ Q$ e! w0 E
  1192.         y4 (* mv_sc y4)  )0 G" J8 c2 A* K4 g3 z& f
  1193.   (command  " y% \% @  Z1 A0 F7 ^5 Y
  1194.     "LIMITS" "0,0" (list x4 y4)9 v" s7 M5 d: C6 Q6 l; G
  1195.     "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"8 t( T6 ~% l" D. H% p
  1196.     "RECTANG" "250,250" "@14350,10000"
    ; i" ~# N7 Q- C+ N
  1197.     "RECTANG" "350,350" "@14150,9800"
    / c: [. G, x  [. M, g$ h5 l
  1198.     "ZOOM" "_a"  ))
    3 S1 i3 r" g# l" Z+ t! x' d8 c
  1199. ;=====================================================================. [0 z  o" @* a, q
  1200. (Defun c:a4 ()
    + Q. s) j: M2 e# z
  1201.         (setq mv_sc 100);Ti le  ban ve. w* d& }+ |. S- o& \# T( Y
  1202.       (setq x4  297)
    & E5 e) [, J3 e
  1203.       (setq y4  210)
    9 Z- N( _3 }; k
  1204.   (setq x4 (* mv_sc x4) , h4 M! h2 b) e$ ?  r$ p4 E
  1205.         y4 (* mv_sc y4)  )* t& z2 `" Q- g# r0 S( t0 B
  1206.   (command  
    ' A# x- s$ M: `" [" A, U
  1207.     "LIMITS" "0,0" (list x4 y4)
    ! q" V7 Q, d9 H
  1208.     "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
    ( `6 P( z& S) s# y( b8 @! n( M
  1209.     "RECTANG" "500,500" "@28700,20000"
    % N  z0 t2 o9 _# ]* f; X5 j' \  t
  1210.     "RECTANG" "700,700" "@28300,19600"
    1 P' _2 f0 z& j, U
  1211.     "ZOOM" "_a"  ))
    3 ^2 U5 S/ X1 P" k
  1212. ;=====================================================================# Q# P; e0 W$ R1 k
  1213. (Defun c:a3 ()
    * N6 D! M9 H5 C( [7 l7 B) D0 ?
  1214.         (setq mv_sc 100)
    # I% C0 s. H3 K" R) }9 K; n
  1215.       (setq x3  420)8 `+ ~. q8 B! b  d
  1216.       (setq y3  297)3 Z7 b% }, n, U( O! i7 Z" K  x
  1217.   (setq x3 (* mv_sc x3) : Y5 Z4 B. r. R6 q  K! g. s' Z
  1218.         y3 (* mv_sc y3)  )
    - I4 m) k0 W; Q
  1219.   (command  4 |2 S# e2 n, ~, ]" E4 N' j
  1220.     "LIMITS" "0,0" (list x3 y3)
    6 c3 C$ f  A4 Q1 e6 i8 r
  1221.     "PLINE" "0,0" (list 0 y3) (list x3 y3) (list x3 0) "0,0" "_C"
    2 x* x4 \: K, u0 Q# y9 B1 u6 L, P; C
  1222.     "RECTANG" "707.14285714,707.14285714" "@40590,28285.71428571"
    ; n3 {* \+ e) r" u! z
  1223.     "RECTANG" "990,990" "@40024.28571429,27720"
    6 X: z; o" k5 P0 J) |
  1224.     "ZOOM" "_a"  ))
    ) n' m" H5 D3 d6 `/ [1 o
  1225. ;=====================================================================
    " c0 z8 J& ?3 P  l
  1226. (Defun c:a2 (). Y5 _3 x; l/ R  [+ D: ~+ K# C) a
  1227.         (setq mv_sc 100)8 L, m/ p& ~* x. D7 x8 y
  1228.       (setq x2  594)
    , p* P1 h7 d/ Z7 t4 E: C
  1229.       (setq y2  420)6 A- M* w# |( w
  1230.   (setq x2 (* mv_sc x2)
    % a" `2 P; _/ {  T3 N# B
  1231.         y2 (* mv_sc y2)  )
    0 J2 E' v1 a2 N4 J8 x
  1232.   (command  , M4 K9 W1 B$ I) c9 U  t
  1233.     "LIMITS" "0,0" (list x2 y2)
    0 v- l* ]' d0 ?2 W# g0 Y/ J) V0 V
  1234.     "PLINE" "0,0" (list 0 y2) (list x2 y2) (list x2 0) "0,0" "_C"
    5 ~# x/ ^0 A: R" y5 v
  1235.     "RECTANG" "1000,1000" "@57400,40000"
    - E; z$ P: l$ I! D% N2 s
  1236.     "RECTANG" "1400,1400" "@56600,39200"; Z9 ^% C& \! i4 Q/ x0 D6 V
  1237.     "ZOOM" "_a"  ))
    9 r. k, j4 L/ w
  1238. ;=====================================================================1 p) v) ]: Z8 b
  1239. (Defun c:a1 ()  v* b( V/ k2 V/ f: a
  1240.         (setq mv_sc 100)
    : |  v6 P! u% a. N6 A2 `: {; }# v
  1241.       (setq x1  840)
      l& _" F, h4 C9 ~6 y& c
  1242.       (setq y1  594)
    2 C' s2 [! n' G) Z1 {8 M6 V! N
  1243.   (setq x1 (* mv_sc x1)
    " v$ K3 @5 l" f% U* B( R
  1244.         y1 (* mv_sc y1)  )2 T) F' Q3 l; l
  1245.   (command  
    ) L$ l1 H) `! a6 Q5 d
  1246.     "LIMITS" "0,0" (list x1 y1)
    3 A6 q0 b. s8 V: i* i- a
  1247.     "PLINE" "0,0" (list 0 y1) (list x1 y1) (list x1 0) "0,0" "_C"
    1 a6 Q2 S2 G$ U- V0 @1 o$ ~
  1248.     "RECTANG" "1414.28571429,1414.28571429" "@81180,56571.42857143", P+ O. [8 M+ X; ?1 X* R6 |
  1249.     "RECTANG" "1980,1980" "@80048.57142857,55440"
    + b: a# W5 {$ a5 H
  1250.     "ZOOM" "_a"  ))8 T0 b$ V8 t1 }% z& ^+ \
  1251. ;=====================================================================- L& p2 i3 M. O4 t% y
  1252. (Defun c:a0 ()
    / @( T+ z. y1 R4 c9 \
  1253.         (setq mv_sc 100)# V+ W# }2 @) w8 c
  1254.       (setq x0  1188)% Z6 n; ?/ t( X( \9 V% ?) o
  1255.       (setq y0  840)
    ) S4 O! j; `; k, _
  1256.   (setq x0 (* mv_sc x0) 7 C) \9 L% l& @  p% R
  1257.         y0 (* mv_sc y0)  )0 C& d. B, R! Q  o7 g
  1258.   (command  + P; O0 b) g# a: ^2 J6 \( k; U; ~
  1259.     "LIMITS" "0,0" (list x0 y0)0 Y* z2 T" B( t3 d
  1260.     "PLINE" "0,0" (list 0 y0) (list x0 y0) (list x0 0) "0,0" "_C"
    , j$ z! D$ j% ?4 G! Q( n
  1261.     "RECTANG" "2000,2000" "@114800,80000"
    " z% `" x' z5 ?: C7 D5 N  a
  1262.     "RECTANG" "2800,2800" "@113200,78400"! A2 {3 F* K# w, f' i: E, ?
  1263.     "ZOOM" "_a"  ))
    5 G! [* o+ {3 L# X; Z/ |; g
  1264. . p1 {0 ^& O) E, k  |
  1265. ;=====================================================================
    + I7 O/ J0 e3 b7 W
  1266. ;=========================DAT KHO GIAY BAN VE - KIEU 2=========================
    . {9 N- X. `: T# O! {7 D5 Q8 D: X
  1267. ;=====================================================================! q+ g1 E) ?4 A* O

  1268. 9 f# j& H0 l  y1 }
  1269. (Defun c:6a ()
    , |, N! {- s. u
  1270.         (setq mv_sc 100);Ti le  ban ve
    2 x5 w9 E1 e  m1 ]" L! z
  1271.       (setq x4  74.25)
    # `; r5 Z$ a' H( j9 F. N6 B& g5 ~
  1272.       (setq y4  52.5)
    8 \# Z, M. h* ~; K7 I
  1273.   (setq x4 (* mv_sc x4)
    - N- x, V) D( ~- Q; f' ^
  1274.         y4 (* mv_sc y4)  )
    4 u( v" _) Q. E: N/ _: M) }* p
  1275.   (command  % S1 D6 t4 g0 U7 E
  1276.     "LIMITS" "0,0" (list x4 y4). t" J$ p# ~! N2 _3 C$ f( z
  1277.     "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"5 K& o% W2 o+ h, ?
  1278.     "RECTANG" "505,125" "@6800,5000"
    & e& H4 f, Q  i5 Y2 V0 U
  1279.     "RECTANG" "555,175" "@6700,4900"
    8 w# h9 e7 M# V, t2 O% R5 w
  1280.     "ZOOM" "_a"  )), y6 E% i+ Y; Q; L* T, v- T
  1281. ;=====================================================================
    9 f' p: l5 Z2 |/ Y+ n
  1282. (Defun c:5a ()
    # X( N: Q5 d. k% e
  1283.         (setq mv_sc 100);Ti le  ban ve
    : D% l1 @4 F2 \
  1284.       (setq x4  148.5). F8 X* Z+ Z; c* w5 U, U; N5 F" e8 z
  1285.       (setq y4  105)/ [  Y' V0 h4 f/ E. d
  1286.   (setq x4 (* mv_sc x4)
    3 f& _0 ~/ t& E; c) }  W2 X
  1287.         y4 (* mv_sc y4)  )/ J* b9 w2 o5 J( O! M
  1288.   (command  
    4 e, T; d" a; O+ g$ ^& b
  1289.     "LIMITS" "0,0" (list x4 y4)+ \: L2 E" p( X5 ]; n* Y
  1290.     "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
    / i) r9 S, |0 `1 N$ r
  1291.     "RECTANG" "1000,250" "@13600,10000"
    : J. A+ H' }" @! X3 M/ f: o3 ~
  1292.     "RECTANG" "1100,350" "@13400,9800"
    8 t9 A8 a6 d, [$ y
  1293.     "ZOOM" "_a"  )): `. g1 z4 p3 e2 D0 c
  1294. ;=====================================================================! E, P5 ~0 Z2 F) |( p" H% t/ {
  1295. (Defun c:4a ()7 K  I1 K& ~9 I2 \+ T% X7 u9 C1 @
  1296.         (setq mv_sc 100);Ti le  ban ve
    ' W1 H4 Q, n% O. l0 g# m
  1297.       (setq x4  297)
    : D& Q. B6 X: f, c$ _
  1298.       (setq y4  210)9 }5 `  V5 x+ |* ?" \5 J
  1299.   (setq x4 (* mv_sc x4)
    . ]" _' C/ T5 z# l7 h3 G
  1300.         y4 (* mv_sc y4)  )0 A0 N1 c4 m- q' B3 {1 T8 c3 r
  1301.   (command  
    $ X5 G9 {( [$ ]. A- G9 S3 v
  1302.     "LIMITS" "0,0" (list x4 y4)
    & {' c# X5 X+ }) o
  1303.     "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C". h9 W- B, ]9 |0 S$ `: ^  \3 G
  1304.     "RECTANG" "2000,500" "@27200,20000"$ E, N# ?/ _& z
  1305.     "RECTANG" "2200,700" "@26800,19600"$ h! t' Z, h5 N; g+ i
  1306.     "ZOOM" "_a"  ))- q1 V) [- X/ Y# j' I! T! F
  1307. ;=====================================================================
    3 T+ A( V$ q# P0 y7 u
  1308. (Defun c:3a ()
    0 H; H! c# B% S/ h: @& V
  1309.         (setq mv_sc 100)5 l$ v) K. O- R. T
  1310.       (setq x3  420.0428571429)
    3 q9 A) ~9 r3 }! R
  1311.       (setq y3  297)' J" H( T  s, G3 _3 T
  1312.   (setq x3 (* mv_sc x3) ! m7 a; K  m; j$ a, }. v# [9 q
  1313.         y3 (* mv_sc y3)  )
    2 z1 e& s. d) k& `2 f8 j) ~; j
  1314.   (command  ' e$ @, V/ i% G0 m" W
  1315.     "LIMITS" "0,0" (list x3 y3)4 U7 D5 B9 W( l) Q% T  n
  1316.     "PLINE" "0,0" (list 0 y3) (list x3 y3) (list x3 0) "0,0" "_C"" d" j8 s$ L9 f5 R$ f9 e+ h
  1317.     "RECTANG" "2828.57142857,707.14285714" "@38468.57142857,28285.71428571"
    $ Z, ]9 O0 m7 Z4 @% A
  1318.     "RECTANG" "3111.42857142,989.99999999" "@37902.85714287,27720.00000001"
    0 B, d' O% K$ o5 \4 d$ J4 d
  1319.     "ZOOM" "_a"  ))+ o$ R. }# }7 h! [/ `+ }6 O# z( Q
  1320. ;=====================================================================# m# K' u# g0 o8 v
  1321. (Defun c:2a ()
      Y& I8 K1 O* s8 F  z5 c% ^
  1322.         (setq mv_sc 100)) S0 z" K" c% ~8 ?. a$ x
  1323.       (setq x2  594)
    , j- q7 ?# W$ Y  G6 K' o5 e5 b
  1324.       (setq y2  420)) _6 X7 B; S7 d/ c
  1325.   (setq x2 (* mv_sc x2)
    : ^( w" @  T& G
  1326.         y2 (* mv_sc y2)  )
    - q  k$ F3 [; Q# y
  1327.   (command  
    $ C4 z5 P$ j! @, {3 ~' e0 B
  1328.     "LIMITS" "0,0" (list x2 y2)0 q1 e+ ^; R9 `& v3 h
  1329.     "PLINE" "0,0" (list 0 y2) (list x2 y2) (list x2 0) "0,0" "_C"
    , ~# ^# t  y5 x7 d  Z* x
  1330.     "RECTANG" "4000,1000" "@54400,40000"
    & Q8 `; T/ H4 \  _
  1331.     "RECTANG" "4400,1400" "@53600,39200"
    8 z' g5 p8 l% T; u; ~( C* a0 Z) G
  1332.     "ZOOM" "_a"  ))
    8 A6 v/ f# z4 U  x% R
  1333. ;=====================================================================
    * ?6 C& R. w: i% @$ |$ \
  1334. (Defun c:1a ()
    ! B$ G: r% i( B1 {
  1335.         (setq mv_sc 100)
    7 O/ @9 u% m; \/ U8 y, {& P  n4 z  D
  1336.       (setq x1  840.0857142857): Y6 O0 z: g3 C! V8 v7 Q$ F6 m
  1337.       (setq y1  594): e8 n! u  {0 e, ^4 I
  1338.   (setq x1 (* mv_sc x1) . V/ c( @  d' e
  1339.         y1 (* mv_sc y1)  )
    9 h# i+ z2 P% q& N4 H
  1340.   (command  
    % Z4 S: s0 V/ k: l! N2 [" l) {
  1341.     "LIMITS" "0,0" (list x1 y1)1 n2 Q: H! g! ^8 b# W$ m5 _, H1 j
  1342.     "PLINE" "0,0" (list 0 y1) (list x1 y1) (list x1 0) "0,0" "_C"
    $ n3 v9 e* H* L
  1343.     "RECTANG" "5657.14285714,1414.28571429" "@76937.14285714,56571.428571436". R* D" N9 ^% g; W# F- P$ Z
  1344.     "RECTANG" "6222.85714286,1980.00000001" "@75805.71428570,55440"- q/ u( s3 x/ H( R- [- Z
  1345.     "ZOOM" "_a"  ))
      W, y- T  a( ]0 U; b
  1346. ;=====================================================================
    2 c+ {! x7 T. r9 g7 g
  1347. (Defun c:0a ()
    * Z! q0 e/ [' B( r
  1348.         (setq mv_sc 100)
    4 {3 a" \7 N+ K4 G, ~8 }
  1349.       (setq x0  1188)  n4 c" g5 Y( R7 y2 y* _
  1350.       (setq y0  840)* b5 c% F; f+ j) w
  1351.   (setq x0 (* mv_sc x0) ( [+ G9 P8 Z7 Z( Y6 P8 A
  1352.         y0 (* mv_sc y0)  ), e9 b! m2 K0 F# Y
  1353.   (command  
    9 O+ e5 X2 ^% ^: u1 t/ E
  1354.     "LIMITS" "0,0" (list x0 y0)
    ' Z0 j: Y$ H% r/ {% V% O6 ]0 c
  1355.     "PLINE" "0,0" (list 0 y0) (list x0 y0) (list x0 0) "0,0" "_C"- q' t4 }+ L! M# F0 i7 [* L3 s. F
  1356.     "RECTANG" "8000,2000" "@108800,80000"
    4 q* q5 W- F" {0 r, Q$ A; z: V' Y
  1357.     "RECTANG" "8800,2800" "@107200,78400"
    . m  Z: p2 b7 E# i4 J$ l! B3 C* H
  1358.     "ZOOM" "_a"  ))# `. h' f5 T  O4 D( D0 i8 U; w3 \
  1359. / ~  u# w4 f& T' O0 s0 P! `
  1360. ;=====================================================================9 I: `1 [$ L" k2 a8 f; n
  1361. ;==================DAT KhoGiay Theo KHO GIAY BAN VE===================
    2 i# P5 @0 v" b, Y
  1362. ;=====================================================================7 d8 _+ O' }' s! Y( a6 Y7 G
  1363. (defun c:khogiay (/ oldlst a b c d e f g h kho TL)
    ) u% ]' j: T* Y! c# L# |( V
  1364. (command "undo" "be")) J4 q# G6 [3 c5 \) {
  1365. (setq oldlst (mapcar 'getvar (list "CMDECHO" "OSMODE" "cecolor")))- e7 q- p; a+ k/ T6 c
  1366. (setvar "CMDECHO" 0)% d0 q4 J) L5 F) B3 O8 X
  1367.     (setq a (getpoint "\n chon diem chen :"))
    ; U0 G0 D6 v' w1 n3 ^
  1368. (if (not TL) (setq TL 1.00))$ F5 V: p6 d& G4 a3 {2 w! U
  1369. (setq TL1 (getDIST (strcat "\nScale <" (rtos TL 2 2) ">:")))
    4 C( F# o% J! @! V2 P0 d. y* Y
  1370. (if TL1 (setq TL TL1))& m9 A* v, O3 y4 ^2 }& P1 d
  1371. (setvar "osmode" 0)
    ) j7 \& |" X" N2 y
  1372. (if (not (tblsearch "layer" "Defpoints")) (Command "layer" "N" "Defpoints" ""))
    ! v; f( l3 o) {. [0 F* W
  1373. (initget "0 1 2 3 4")
      W1 A, p/ V5 A  I/ d
  1374.        (setq kho (getkword "\Kho A0 _ Kho A1 _ Kho A2 _ Kho A3 _ Kho A4 [0/1/2/3/4]? <0>:")). Q2 q" V/ S; S
  1375. (if (= kho "0")
    4 x: [" q" ~( \  h
  1376.      (progn7 l" q  Q, B+ P
  1377.              (setq b (polar a 0 (* TL 1189))): @: C/ g  Y$ W# l/ r* P9 g2 \
  1378.                      (setq c (polar b (/ pi 2) (* TL 841)))
      ]( \. F, g# _1 O2 v; ^: _3 N
  1379.                      (setq d (polar a (/ pi 2) (* TL 841)))6 S6 t1 `4 q% Q. d5 G
  1380.              (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 12 12)))))
    * r$ A! ?" {% v
  1381.                      (setq f (polar e 0 (- (* TL 1189) (* TL 24))))' t% I% R* O! H6 L& j7 ?6 Z# Z0 [
  1382.                      (setq g (polar f (/ pi 2) (- (* TL 841) (* TL 24)))). M' \+ \4 Q) v" V0 z: r! |
  1383.                      (setq h (polar e (/ pi 2) (- (* TL 841) (* TL 24))))
    , T( [. C7 G( r% S! G3 s
  1384.   (command "Pline" e f g h "c")            
    $ D. h/ j& [; p- m; ^3 ?: Q0 ]
  1385. (command "change" "last" "" "properties" "layer" "0" "")
    $ S1 ?" Z/ c0 q; ?
  1386. (setvar "cecolor" "4")
    " U7 r! ^1 q+ A: v
  1387.   (command "Pline" a b c d "c")# m( ?: [; W3 T9 f- T
  1388. (command "change" "last" "" "properties" "layer" "defpoints" "")))   
      U+ K( B" I* V. L2 z+ W& e
  1389. (if (= kho "1")* z& j' D8 S' H0 I
  1390.      (progn
    + ]# d$ C- Y8 t. ~  j" R( V
  1391.              (setq b (polar a 0 (* TL 841)))
    ! \/ h; L6 O$ p: v, X) }
  1392.                      (setq c (polar b (/ pi 2) (* TL 594))); P, Q2 t( x, b; @! T! h8 b7 G" i
  1393.                      (setq d (polar a (/ pi 2) (* TL 594)))7 ^6 e- q1 Q3 N8 T( w
  1394.             (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 12 12)))))# w* H( Y1 [. U! C. K" ?+ e/ q
  1395.                      (setq f (polar e 0 (- (* TL 841) (* TL 24))))
    ! U+ C" F9 D! K  [
  1396.                      (setq g (polar f (/ pi 2) (- (* TL 594) (* TL 24))))
    + ~2 V  G' f+ W! h: d/ {# ]
  1397.                      (setq h (polar e (/ pi 2) (- (* TL 594) (* TL 24))))+ A* {, O( s. ~" k5 ^- i4 B: Z
  1398.   (command "Pline" e f g h "c")            2 [: T: g  {4 E, q( b
  1399. (command "change" "last" "" "properties" "layer" "0" ""): ^2 k! j& ~; o- P7 |
  1400. (setvar "cecolor" "4")
    , M( |1 ~6 M* Z, n0 _
  1401.   (command "Pline" a b c d "c")
    6 e2 k. k; |$ Z: [( q; ?
  1402. (command "change" "last" "" "properties" "layer" "defpoints" ""))). i& }7 K- g3 a" Y: t9 V! `
  1403. (if (= kho "2")( K# O' ^% u4 K" n+ z' _
  1404.      (progn& R6 `! X9 j" I0 {. u
  1405.              (setq b (polar a 0 (* TL 594)))% n' N0 Q9 I! D' k7 e* ^
  1406.                      (setq c (polar b (/ pi 2) (* TL 420)))
    + |" p4 W0 r* k: Q
  1407.                      (setq d (polar a (/ pi 2) (* TL 420)))
    8 L" ]; l" n4 }' h; K( P
  1408.              (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 100)))))1 ]0 ~2 a; L' p* d5 {7 f
  1409.                      (setq f (polar e 0 (- (* TL 594) (* TL 20))))- {0 o# X% l. N8 L$ W
  1410.                      (setq g (polar f (/ pi 2) (- (* TL 420) (* TL 20))))
    ! c9 C1 r! B/ N. n7 D; ]2 v" N4 c
  1411.                      (setq h (polar e (/ pi 2) (- (* TL 420) (* TL 20))))
    % h/ b1 _7 o; ~: c  a' Q( ^8 E
  1412.   (command "Pline" e f g h "c")            8 s! c8 K' P9 c; g  o$ C
  1413. (command "change" "last" "" "properties" "layer" "0" "")3 K3 Q7 B1 c: r3 c" }2 W" N6 Y
  1414. (setvar "cecolor" "4")
    ; i+ l8 o, S. a. v
  1415.   (command "Pline" a b c d "c")/ R# q! v$ }8 N. Z/ ?+ m, |
  1416. (command "change" "last" "" "properties" "layer" "defpoints" ""))): L7 H  q2 J( i8 R
  1417. (if (= kho "3")
    " E8 t$ x- H/ w8 P. t( e. V+ O
  1418.      (progn. b5 f* L( {9 F# J' K/ Y8 ?
  1419.              (setq b (polar a 0 (* tl 420)))
    + H6 s0 Y" I$ r5 Y# i$ K
  1420.                      (setq c (polar b (/ pi 2) (* TL 297)))
    & k: p+ P8 d5 }# O
  1421.                      (setq d (polar a (/ pi 2) (* TL 297)))5 T) ?+ ^4 x  W8 l# p2 j
  1422.              (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 100)))))
    " |" F8 Y& h4 d: K# D
  1423.                      (setq f (polar e 0 (- (* TL 420) (* TL 20))))' A. l- n) J' o( u5 H% I) N2 V6 O
  1424.                      (setq g (polar f (/ pi 2) (- (* TL 297) (* TL 20))))
    $ v/ [& J- s  G9 c3 x0 T
  1425.                      (setq h (polar e (/ pi 2) (- (* TL 297) (* TL 20))))
    ! W/ l  c- H8 v' S( a  H5 x8 w
  1426. (command "Pline" e f g h "c")
    . h6 j8 i, @+ j# [8 q, i
  1427.   (command "change" "last" "" "properties" "layer" "0" "")
    9 t# M8 J7 e' ^/ F- A$ s
  1428. (setvar "cecolor" "4")3 g7 h8 c+ e* l  z4 O/ O! _4 c& [
  1429. (command "Pline" a b c d "c")
    ' N" H. Z, V) N/ |( ]) N; P
  1430.   (command "change" "last" "" "properties" "layer" "defpoints" "")))  O5 j6 E1 c7 D9 }$ A- w1 K
  1431. (if (= kho "4")3 l: y5 t$ s% w; ?4 H) S6 F
  1432.      (progn; E0 I% ?: ?( [* A
  1433.              (setq b (polar a 0 (* TL 297)))
    ) i0 u" D/ l. z8 h. V
  1434.               (setq c (polar b (/ pi 2) (* TL 210)))
    & a+ ?3 {9 X' l* l
  1435.                      (setq d (polar a (/ pi 2) (* TL 210)))+ n& T3 l" \; O# K+ W
  1436.             (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 81)))))
    $ g; h' M; I. c7 y7 ~
  1437.                      (setq f (polar e 0 (- (* TL 297) (* TL 18))))
    0 d! Y5 y8 y) `( k, ]1 W
  1438.                      (setq g (polar f (/ pi 2) (- (* TL 210) (* TL 18))))" K1 Q- E& S1 D
  1439.                      (setq h (polar e (/ pi 2) (- (* TL 210) (* TL 18))))$ P7 E1 b" k* o3 O* ?% i; U
  1440.   (command "Pline" e f g h "c")            
    7 j2 m$ W  X; n5 g% @
  1441. (command "change" "last" "" "properties" "layer" "0" "")9 s& N( y- {, F( ~& R5 r" [/ G
  1442. (setvar "cecolor" "4")
    1 G5 }% \$ i( T' l6 F6 a
  1443.   (command "Pline" a b c d "c")
    1 H( d4 p3 R/ O& \) T
  1444. (command "change" "last" "" "properties" "layer" "defpoints" "")))
    # ?& q4 [, f. m+ V% y9 d
  1445. (mapcar 'setvar (list "CMDECHO" "OSMODE" "cecolor") oldlst)
    # Y  x/ W* V% @. p
  1446. (command "undo" "e")
    ' C/ ^, ^: _/ J: K
  1447. (princ))
    / \: k" S# n6 O0 L8 H( T
  1448. ;=====================================================================
    9 u# j5 u: _. n/ w) a# d
  1449. ;==================DAT KhoGiay Theo KHO GIAY BAN VE===================: |- E1 k, |' B, b
  1450. ;=====================================================================" x/ C6 N$ U. t( j

  1451. " R- u+ ]- Y& S. |! c
  1452. ;=====================================================================
    5 ~: `3 r! D- d1 b) w& Z3 t
  1453. ;===================DAT Ti Le Theo KHO GIAY BAN VE====================. w9 v& b( d4 n, a
  1454. ;=====================================================================2 |/ O% L, s4 B+ w" S1 `5 s
  1455. ( H# |& X. O1 c4 C( t" a: x1 l% r2 q5 R& d
  1456. (DEFUN C:SA6 () (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.1" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "5" ""
    2 x6 n% z; e% [5 \6 p, ~4 t
  1457.                               "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.3" ""+ z4 L3 S9 J8 g0 e+ a% \
  1458.                                            "M" "MANH" "C" "9" "" "Lw" "0.1" ""$ C( U' h: k" O. l; [' i3 y; a; V
  1459.                                        "M" "TEXT" "C" "7" "" "Lw" "0.12" ""
    . W- Y. Y- ]! }7 O- z/ I* ]$ i" _
  1460.                                        "M" "DIM" "C" "1" "" "Lw" "0.12" ""
    0 L- F  S! G8 \# `* M
  1461.                                        "M" "THAY" "C" "7" "" "Lw" "0.2" ""
    7 \$ a$ [9 w3 J
  1462.                                        "M" "NOITHAT" "C" "3" "" "Lw" "0.12" "") l2 t; T0 @- M' z7 N' A, |
  1463.                                        "M" "HATCH" "C" "5" "" "Lw" "0.1" ""
    3 A+ @$ K8 G: Y
  1464.                                        "M" "COT" "C" "1" "" "Lw" "0.3" ""+ q8 a' W* H; w6 v9 `
  1465.                                        "M" "Defpoints" "C" "7" "": c4 }5 G6 L( Q3 D) x
  1466.                                        "M" "0" "C" "3" "" "Lw" "0.12" ""( M5 I$ Q: Y% M! |8 \
  1467.                                        "M" "CUA" "C" "6" "" "Lw" "0.12" ""
    & j: |2 E4 v# r2 Y0 @
  1468.                                        "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.12" ""
    ! B( y9 V& x' q1 X
  1469.                                        "M" "TIMTUONG" "C" "5" "" "Lw" "0.1" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "3" ""))
    - d( I* h2 f2 d0 c. R4 e6 R
  1470. (DEFUN C:SA5 () (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.12" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "10" ""' t) [( C$ u' m8 D
  1471.                               "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.4" ""
    6 J& d  Q! L; q0 {+ {; S) N0 n7 _
  1472.                                            "M" "MANH" "C" "9" "" "Lw" "0.12" ""7 ~& _2 d( |8 Z
  1473.                                        "M" "TEXT" "C" "7" "" "Lw" "0.12" ""
    ' ]9 v: A/ s- E
  1474.                                        "M" "DIM" "C" "1" "" "Lw" "0.2" ""
    : u/ o1 i: ?: Y8 Z1 t- k
  1475.                                        "M" "THAY" "C" "7" "" "Lw" "0.2" ""
    2 ?9 v- a+ k; t  ~7 l, S
  1476.                                        "M" "NOITHAT" "C" "3" "" "Lw" "0.2" ""& P+ P. m" k  p/ I. O4 t7 p# [: d
  1477.                                        "M" "HATCH" "C" "5" "" "Lw" "0.1" ""
    7 A8 y) b$ F1 G* C9 R/ C& \
  1478.                                        "M" "COT" "C" "1" "" "Lw" "0.4" "": z# V& [0 w0 p
  1479.                                        "M" "Defpoints" "C" "7" ""7 @, K$ A0 n0 R2 K$ K
  1480.                                        "M" "0" "C" "3" "" "Lw" "0.2" ""
    . b/ T2 y9 B. P: E& I5 H2 j, @
  1481.                                        "M" "CUA" "C" "6" "" "Lw" "0.12" ""
    " Q' \' T  N: Q
  1482.                                        "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.12" ""
    " Y% X+ h8 m, F% N, I# x$ @
  1483.                                        "M" "TIMTUONG" "C" "5" "" "Lw" "0.15" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "5" ""))1 _. B1 W$ P1 G1 B
  1484. (DEFUN C:SA4 () (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.2" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "20" ""
    2 r6 W* j- J  D$ W9 X
  1485.                               "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.6" ""+ r, y7 d  c& ^7 a0 F
  1486.                                            "M" "MANH" "C" "9" "" "Lw" "0.2" ""3 D& z* G! P- u; j3 Z
  1487.                                        "M" "TEXT" "C" "7" "" "Lw" "0.2" ""
    2 j! K. j7 A$ t) e5 q6 M* j1 P' n
  1488.                                        "M" "DIM" "C" "1" "" "Lw" "0.25" ""4 y4 q" @4 V+ G6 u+ l" w' i
  1489.                                        "M" "THAY" "C" "7" "" "Lw" "0.35" ""
    ! m  m" E" T: ~9 J# V
  1490.                                        "M" "NOITHAT" "C" "3" "" "Lw" "0.25" ""
    * `7 t! A( I9 \; G/ l, o* c7 ~. h
  1491.                                        "M" "HATCH" "C" "5" "" "Lw" "0.15" ""
    1 C1 E# L2 a- T5 w; n& @, ~
  1492.                                        "M" "COT" "C" "1" "" "Lw" "0.6" ""
    - q" i* L. `5 n4 y
  1493.                                        "M" "Defpoints" "C" "7" ""7 ^  k8 O) o9 w. V( y& g5 C% c
  1494.                                        "M" "0" "C" "3" "" "Lw" "0.25" ""- C6 s- a/ K) I% W5 ?2 o& C" W
  1495.                                        "M" "CUA" "C" "6" "" "Lw" "0.25" ""
    2 i9 E( r& q+ n2 I/ q' a" d$ q
  1496.                                        "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.25" ""
    5 v( Y  r9 ?0 ^, j
  1497.                                        "M" "TIMTUONG" "C" "5" "" "Lw" "0.2" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "10" ""))
    7 _% g/ |9 d3 L9 w- c( H
  1498.         & C/ }% S3 F& p9 U8 U
  1499. (DEFUN C:SA3 () (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.35" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "30" ""- l& o3 m% m& ], w: c* M! T, N
  1500.                               "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.7" ""+ d4 h* H; l: Y2 @8 a2 B8 g4 R
  1501.                                            "M" "MANH" "C" "9" "" "Lw" "0.25" "", `7 i7 J% A2 t
  1502.                                        "M" "TEXT" "C" "7" "" "Lw" "0.2" ""6 R( ^8 h% w) K. H
  1503.                                        "M" "DIM" "C" "1" "" "Lw" "0.35" ""
    * j( ?( {% p+ K  r: {% b
  1504.                                        "M" "THAY" "C" "7" "" "Lw" "0.4" ""' k  \3 E* f$ l% o* j$ s; @
  1505.                                        "M" "NOITHAT" "C" "3" "" "Lw" "0.25" ""6 `8 M' F( p: L3 p7 ]" `  F
  1506.                                        "M" "HATCH" "C" "5" "" "Lw" "0.2" ""
    & H4 \; D3 V# d; n0 ]" \
  1507.                                        "M" "COT" "C" "1" "" "Lw" "0.7" ""# h" J1 z$ k5 C% W; a. ]
  1508.                                        "M" "Defpoints" "C" "7" ""
    ( K# X) u5 ^; [- }% w
  1509.                                        "M" "0" "C" "3" "" "Lw" "0.25" ""
    $ Y3 P8 ^5 l( ?. R
  1510.                                        "M" "CUA" "C" "6" "" "Lw" "0.35" ""
    1 k  |6 o4 r' Q, a
  1511.                                        "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.3" ""/ ~1 U4 T7 @4 N; B
  1512.                                        "M" "TIMTUONG" "C" "5" "" "Lw" "0.25" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "20" ""))(PRINC)3 d. b5 ]/ U5 A! _

  1513. 8 A8 g. o. n6 v/ y3 h
  1514. (DEFUN C:SA2 () (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.35" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "45" ""
    3 a2 C8 M7 }: f% K
  1515.                               "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.7" ""
    ) Y2 G, m+ K0 K0 g* S2 @9 o# ~
  1516.                                            "M" "MANH" "C" "9" "" "Lw" "0.25" ""
    7 ^: e3 Y8 m) d& y9 h5 P
  1517.                                        "M" "TEXT" "C" "7" "" "Lw" "0.25" ""0 A# f+ Y- x4 n5 t5 Z
  1518.                                        "M" "DIM" "C" "1" "" "Lw" "0.3" ""
    . ?" C' E! ~  q1 `: d, `, j' ]/ n
  1519.                                        "M" "THAY" "C" "7" "" "Lw" "0.4" ""8 E, _6 v3 g$ F& [
  1520.                                        "M" "NOITHAT" "C" "3" "" "Lw" "0.3" ""
    5 h1 p% ^  v. O7 q  ]! M# u
  1521.                                        "M" "HATCH" "C" "5" "" "Lw" "0.2" ""
    & d. W& P9 {" q4 E
  1522.                                        "M" "COT" "C" "1" "" "Lw" "0.7" ""
    # T/ L' o' S* H9 @
  1523.                                        "M" "Defpoints" "C" "7" "", X" z* U' N1 j3 v6 b+ X
  1524.                                        "M" "0" "C" "3" "" "Lw" "0.35" ""
    ; ], C# {  [+ ?, n" R: Q
  1525.                                        "M" "CUA" "C" "6" "" "Lw" "0.35" ""
    1 }6 H6 `4 X! c( O
  1526.                                        "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.3" "": p. k# E8 D! v8 \% N
  1527.                                        "M" "TIMTUONG" "C" "5" "" "Lw" "0.25" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "30" ""))
      ~4 k% m8 L$ _( ?3 X+ q0 f
  1528. 8 _' _/ X1 q) c2 z% K3 i6 u
  1529. (DEFUN C:SA1 () (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.4" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "60" ""
    ) I  |; X, m6 S' Q3 @0 D7 O
  1530.                               "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.85" ""  _) i5 S0 @; W4 @3 j/ I
  1531.                                            "M" "MANH" "C" "9" "" "Lw" "0.35" ""
    5 @1 w/ K3 F3 }3 |- w
  1532.                                        "M" "TEXT" "C" "7" "" "Lw" "0.5" ""# [$ g# |  [/ }7 d/ T! l* {
  1533.                                        "M" "DIM" "C" "1" "" "Lw" "0.35" ""
    # J! Q1 i. B- j  B% q* ~: {
  1534.                                        "M" "THAY" "C" "7" "" "Lw" "0.4" ""
    ; I% }3 f) x3 M. @% \, T$ @+ n
  1535.                                        "M" "NOITHAT" "C" "3" "" "Lw" "0.35" ""4 b* E- l  c& w  ^; @) @" G$ \6 ?
  1536.                                        "M" "HATCH" "C" "5" "" "Lw" "0.25" ""
    9 E, [) E$ F& g" G! }
  1537.                                        "M" "COT" "C" "1" "" "Lw" "0.85" ""# A/ P7 d5 M5 R
  1538.                                        "M" "Defpoints" "C" "7" ""% @, J3 K, w- K& h6 W2 D2 `( s
  1539.                                        "M" "0" "C" "3" "" "Lw" "0.35" ""
    : I$ f7 y' b/ A
  1540.                                        "M" "CUA" "C" "6" "" "Lw" "0.4" ""7 b5 r/ R4 i: J# R# R/ O
  1541.                                        "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.35" ""  A; A2 r2 o) Q! d
  1542.                                        "M" "TIMTUONG" "C" "5" "" "Lw" "0.3" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "40" ""))- q7 S/ h# K6 a9 Q
  1543.         0 N: i3 G  @" ]
  1544. (DEFUN C:SA0 () (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.5" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "85" ""* J( {- @) @4 F
  1545.                               "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "1" ""
    ! ]0 V; ^$ ~/ i- s. B3 t) e' K
  1546.                                            "M" "MANH" "C" "9" "" "Lw" "0.35" ""
    " d8 B8 B8 e# z' {# Z$ t
  1547.                                        "M" "TEXT" "C" "7" "" "Lw" "0.5" ""
    5 [; E% Z2 P$ w# c+ q  r
  1548.                                        "M" "DIM" "C" "1" "" "Lw" "0.35" ""$ y1 q; `2 d9 l  N; _
  1549.                                        "M" "THAY" "C" "7" "" "Lw" "0.5" ""
    $ s6 b( ]: ~1 s( Q* v) p6 ~( D* V
  1550.                                        "M" "NOITHAT" "C" "3" "" "Lw" "0.4" ""' M& B; p3 D  \4 M9 z
  1551.                                        "M" "HATCH" "C" "5" "" "Lw" "0.35" ""6 x" h+ U# b& A
  1552.                                        "M" "COT" "C" "1" "" "Lw" "0.1" ""8 d6 t( Z# S3 J% I) n5 O% u5 A
  1553.                                        "M" "Defpoints" "C" "7" ""7 u( S# W* g: K6 C$ v  N! [5 W
  1554.                                        "M" "0" "C" "3" "" "Lw" "0.5" ""0 |! F$ M' d1 C# U  q( J
  1555.                                        "M" "CUA" "C" "6" "" "Lw" "0.5" ""
    # w9 q9 {5 i- {; g8 t
  1556.                                        "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.4" ""
    $ [4 Y0 Z3 G, f
  1557.                                        "M" "TIMTUONG" "C" "5" "" "Lw" "0.35" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "55" ""))
    8 o& C$ |4 t& g6 }7 w4 x3 {
  1558. (DEFUN C:O   () (COMMAND "OFFSET"))
    4 S/ o. `: D, A7 ^1 h
  1559. (defun c:s1 () (command "surftab1"))
    % p+ i& o$ i+ G1 k  m6 b/ Q
  1560. (defun c:s2 () (command "surftab2"))( g% V& [/ w8 V4 U. S& G2 v6 V0 @
  1561. (defun c:ep () (command "explode"))  }* Y+ T5 c/ ?. d/ N
  1562. (DEFUN C:QS () (COMMAND "AUDIT" "Y" "purge" "all" "*" "N" "QSAVE"))% S0 W* \0 l5 u& V
  1563. (DEFUN C:QV   () (COMMAND "QSAVE")), H5 F# l7 \5 j1 M- u
  1564. (DEFUN C:S    () (COMMAND "STRETCH" "C"))  C: Y1 E; p3 Z  i5 K7 i5 m
  1565. : O$ ]- [5 V. |# q" U
  1566. ;************************** CAT DIM **************************8 H0 L$ R3 L: Y  ?
  1567. 8 m6 p# [  v$ ^+ h6 I& I
  1568. (DEFUN C:DC (/ CMD SS LTH DEM PT DS KDL N70 GOCX GOCY PT13 PT14 PTI PT13I PT14I
    " Q2 l2 E# f7 h/ {1 X7 t7 I" n' A) ~
  1569.                 PT13N PT14N O13 O14 N13 N14 OSM OLDERR PT10 PT11)
    9 W$ T0 D! g* A* O) W: b4 P2 i
  1570. (SETQ CMD (GETVAR "CMDECHO"))
    : h) y4 c" @0 V* A/ V- M, Q
  1571. (SETQ OSM (GETVAR "OSMODE"))
    ; v1 P: E4 [9 B8 i
  1572. (SETQ OLDERR *error*
    ; t2 c$ u& U( y
  1573.       *error* myerror)/ I& b7 E/ C% ]- f: O
  1574. (PRINC "Please select dimension object!")
      g* y$ z8 T" ^$ X, G5 b7 D5 b2 b! @, B5 ]
  1575. (SETQ SS (SSGET))* S, J; x& x' n9 i( T* V7 J
  1576. (SETVAR "CMDECHO" 0)" }# N& G2 b, x/ Q% i8 G
  1577. (SETQ PT (GETPOINT "Point to trim or extend:"))
    * ~; f, q- E) t* m* S
  1578. (SETQ PT (TRANS PT 1 0))1 k0 w6 f' Q# e2 @$ W
  1579. (COMMAND "UCS" "W")
    - r# K" M) @6 f+ Q% M# C
  1580. (SETQ LTH (SSLENGTH SS))5 O2 w5 M1 v2 h# `! i+ K' Y; q
  1581. (SETQ DEM 0)
    0 D# W+ |# y- x# o
  1582. (WHILE (< DEM LTH)
    * D2 [9 r: d* I# [: ~/ \" c) {
  1583.     (PROGN, o- s) D- q5 G# n& h& j! l
  1584.         (SETQ DS (ENTGET (SSNAME SS DEM)))
    2 y+ s5 L5 j0 b
  1585.         (SETQ KDL (CDR (ASSOC 0 DS)))
    0 g0 @4 d5 |1 w; a5 R* x# B
  1586.         (IF (= "DIMENSION" KDL)
    3 X: d+ J; \$ t6 Z- a- x% O
  1587.            (PROGN
      |4 v5 E. z% k) ^* V+ D! A
  1588.                 (SETQ PT10 (CDR (ASSOC 10 DS)))# Y' }8 g# T2 z) W
  1589.                 (SETQ PT11 (CDR (ASSOC 11 DS)))
    6 a- m. w, v1 m& ~6 Z  Z0 f) n
  1590.                 (SETQ PT13 (CDR (ASSOC 13 DS)))7 ]( N6 w3 n$ v) l+ [4 N
  1591.                 (SETQ PT14 (CDR (ASSOC 14 DS)))! f! Y$ Z0 G& I! g6 U
  1592.                 (SETQ N70 (CDR (ASSOC 70 DS)))
    5 M8 I2 J* V. E$ ?0 d, t
  1593.                 (IF (OR (= N70 32) (= N70 33) (= N70 160) (= N70 161))
    # `; ~" @6 j+ n* o
  1594.                    (PROGN; V+ p, H5 B, r- O1 ~( a# u
  1595.                         (SETQ GOCY (ANGLE PT10 PT14))( t( [3 ]# W- v: o9 n
  1596.                         (SETQ GOCX (+ GOCY (/ PI 2)))
    7 r; s6 p7 ]! L& r+ Q
  1597.                    )( a# A  i# E& I5 j
  1598.                 )
    1 Q8 F9 s+ e5 [8 Y: o6 Y# g
  1599.                 (SETVAR "OSMODE" 0)
    ! M3 J4 H4 i/ B& S' a1 [' ]: m" j
  1600.                 (SETQ PTI (POLAR PT GOCX 2))
    : z) p3 s- x" \) g2 A
  1601.                 (SETQ PT13I (POLAR PT13 GOCY 2))! [% u" q+ J0 @8 c5 @1 l: F" g. k
  1602.                 (SETQ PT14I (POLAR PT14 GOCY 2))& s; d: {/ E5 Y
  1603.                 (SETQ PT13N (INTERS PT PTI PT13 PT13I NIL))
    7 F+ ~& i1 U4 b6 m
  1604.                 (SETQ PT14N (INTERS PT PTI PT14 PT14I NIL))
    ' G( {6 K1 V! }. z/ v; \8 K
  1605.                 (SETQ O13 (ASSOC 13 DS))
    ' a) {" h8 |8 p9 T& x  O3 e' w, u
  1606.                 (SETQ O14 (ASSOC 14 DS))$ _4 n6 _2 X, A6 q) E, V
  1607.                 (SETQ N13 (CONS 13 PT13N)). T3 }  v3 ~! d, S7 y# j
  1608.                 (SETQ N14 (CONS 14 PT14N))2 Q; d" j. m8 t
  1609.                 (SETQ DS (SUBST N13 O13 DS))  W% M8 _" t) X) p
  1610.                 (SETQ DS (SUBST N14 O14 DS))
    5 u- C9 N0 x( Y  m/ g# Y, }
  1611.                 (ENTMOD DS)
    , j: O+ t) N0 c! M1 ?# v
  1612.            )
    ( c" U; A* ^# }
  1613.         )/ u& O( C; {% z8 H/ k
  1614.         (SETQ DEM (+ DEM 1))
    ' S/ h% L( e, g1 M
  1615.     )1 v0 T" u+ K2 w3 o' \& B
  1616. )
    8 \/ X" O- o% [" n) K$ V# `
  1617. (COMMAND "UCS" "P")
    6 A  M+ F7 N8 F( O) }! C$ H
  1618. (SETVAR "CMDECHO" CMD)5 i6 n# E9 i$ V6 O. a& o
  1619. (SETVAR "OSMODE" OSM)# |  Q2 A1 o1 h$ g, x2 B% ~
  1620. (setq *error* OLDERR)               ; Restore old *error* handler
    9 F( T" S0 F6 T; ?. v0 u2 A
  1621. (PRINC)- O7 v0 G4 }9 C1 a4 N) H* j  d* _
  1622. )* z7 L% @, y1 d, g- [* q

  1623. 3 d: N  p( e; _$ J2 ?
  1624. (DEFUN C:BD (/ CMD SS LTH DEM PT DS KDL N70 GOCX GOCY PT13 PT14 PTI" \) X: K7 W( a, U; I  Y
  1625.                 PT10 PT10I PT10N O10 N10 PT11 PT11N O11 N11 KC OSM OLDERR)7 ~1 m. H/ z/ v% V5 P! j1 z" d1 s
  1626. (SETQ CMD (GETVAR "CMDECHO"))
    3 g) @3 G9 G* E! V$ F
  1627. (SETQ OSM (GETVAR "OSMODE")), r! t  Y8 T  ~4 H
  1628. (SETQ OLDERR *error*" y3 D& K( W" T( A4 ?4 y  _" G
  1629.       *error* myerror)
    / [" Y9 A( k+ f9 c0 g" f
  1630. (PRINC "Please select dimension object!"); j' v2 m- {% M2 M
  1631. (SETQ SS (SSGET))
    ; `+ M7 j6 u$ F. b, @; y
  1632. (SETVAR "CMDECHO" 0)$ A- ~$ e, k2 P1 [4 k/ A
  1633. (SETQ PT (GETPOINT "Point to trim or extend:"))
    7 ^; ?+ o" \+ _. T) n2 T1 w
  1634. (SETQ PT (TRANS PT 1 0))
    7 c8 a& b% V# D: u
  1635. (COMMAND "UCS" "W")3 V/ }1 z) K* W) }- J
  1636. (SETQ LTH (SSLENGTH SS))
    & S, X  s' Q& M; [
  1637. (SETQ DEM 0)
    - B; i: r2 |% ?4 ^& A
  1638. (WHILE (< DEM LTH)
    4 u# O1 ?9 p+ W. W3 K
  1639.     (PROGN
    ; K' G1 Q# N+ h8 b" M* b
  1640.         (SETQ DS (ENTGET (SSNAME SS DEM)))
    0 w5 }4 n3 r) @" ?% U$ [, Q
  1641.         (SETQ KDL (CDR (ASSOC 0 DS))), h: ]0 e) J+ E$ U
  1642.         (IF (= "DIMENSION" KDL)
      l) X2 Q) o+ b" J3 P" H
  1643.            (PROGN
    , {' G7 s' O( K+ M6 Y
  1644.                 (SETQ PT13 (CDR (ASSOC 13 DS)))* U# b7 l$ S8 c2 [. g! @6 n1 ]
  1645.                 (SETQ PT14 (CDR (ASSOC 14 DS)))! B# m4 D( |+ K6 l
  1646.                 (SETQ PT10 (CDR (ASSOC 10 DS)))) ^5 r- i+ P- c7 Z, ?4 j3 `
  1647.                 (SETQ PT11 (CDR (ASSOC 11 DS)))
    ) c" ]  o: z; r. e- Z% L3 R) |% i; \
  1648.                 (SETQ N70 (CDR (ASSOC 70 DS)))$ ?# O& y1 N' b% c: r
  1649.                 (IF (OR (= N70 32) (= N70 33) (= N70 160) (= N70 161))
    ' \) n( B# |6 z! s' f
  1650.                    (PROGN# n: v7 a/ n! ^8 G9 J8 K0 O: }
  1651.                         (SETQ GOCY (ANGLE PT10 PT14))
      W7 v" j" Z- N& o" p2 q8 h% k
  1652.                         (SETQ GOCX (+ GOCY (/ PI 2)))
    ' T( Z" }( U; Q  o& Q4 O& |
  1653.                    )
    ( K+ U% q" s$ c6 ^
  1654.                 ). Y5 L3 l% ]8 o3 J  k
  1655.                 (SETVAR "OSMODE" 0)
    ( M" @2 M3 T# P3 p4 ?7 A
  1656.                 (SETQ PTI (POLAR PT GOCX 2))
    0 Q/ e7 \3 i, _3 ^. a/ _. k9 L
  1657.                 (SETQ PT10I (POLAR PT10 GOCY 2))& d/ B: H( K, ~4 c' ?  S3 E- W' v! a! P
  1658.                 (SETQ PT10N (INTERS PT PTI PT10 PT10I NIL))
    1 k2 `. O# v- A( }. x2 ^- ~
  1659.                 (SETQ KC (DISTANCE PT10 PT10N))
    6 ^, P% C  P  {$ X2 B
  1660.                 (SETQ O10 (ASSOC 10 DS))0 h& z& m* L5 l; E" g9 h5 g
  1661.                 (SETQ N10 (CONS 10 PT10N))
    & {# R* c- h- Y  n- t9 G
  1662.                 (SETQ DS (SUBST N10 O10 DS)); J3 S$ m2 c" t9 e5 [% z
  1663.                 (SETQ PT11N (POLAR PT11 (ANGLE PT10 PT10N) KC))
    6 q1 z' m2 Y) l' R8 l* a
  1664.                 (SETQ O11 (ASSOC 11 DS))1 _6 D; F* q' d: I& ]) X7 B
  1665.                 (SETQ N11 (CONS 11 PT11N))% h! g, o% v- m
  1666.                 (SETQ DS (SUBST N11 O11 DS))
    , i, L- V% R/ J: {: k
  1667.                 (ENTMOD DS). K  ?0 T; o/ ^
  1668.            )
    ; W3 s6 ~, V- A
  1669.         )
    3 j9 R: @$ g$ T6 \2 y  O" U
  1670.         (SETQ DEM (+ DEM 1))& O/ O. z  E; H8 Z% p
  1671.     )& f/ Y' @3 M) |4 N
  1672. )  X( |# j1 a" u  n
  1673. (COMMAND "UCS" "P")
    ( j$ H2 y6 G; q7 v, x
  1674. (SETVAR "CMDECHO" CMD)0 u, }! I7 C2 d$ x8 j/ o/ d. U. |
  1675. (SETVAR "OSMODE" OSM). t% ^" V) {4 x" s
  1676. (setq *error* OLDERR)4 z0 r' z* W0 @* Z/ t2 h6 Z
  1677. (PRINC)4 D2 ?/ U8 ]. r! g
  1678. ). ]" w  f. q% T' @' N* E& O

  1679. ' ~$ T# H1 p1 @8 x
  1680. ;;; ================ BAT - TAT CHE DO GACH CHAN TEXT (TU) =================
    * _1 O# P& A: i. B9 M. C3 i
  1681. ( D5 v" J( [( t7 q4 X
  1682. (defun c:tu ()  (setvar "cmdecho" 0)(prompt "\nHay chon dong TEXT can gach chan ")7 P6 I* L; N/ q3 S) `
  1683.           (prompt "\nSelect objects: ")(command "select" "au" pause)(setq sstxt (ssget "p"): N( b/ G: \. D
  1684.         sslen (sslength sstxt) ctr 0)(command ".undo" "mark")(while (< ctr sslen)(setq listxt; G6 w$ \$ C) O; j
  1685.         (entget (ssname sstxt ctr))txttxt (cdr (assoc 1 listxt))enttxt (cdr (assoc 0 listxt)))
    ( X5 v- ~5 F/ K& }1 K
  1686.         (if (= enttxt "TEXT")(progn(setq testxt (substr txttxt 1 3))(if (or (= testxt "%%u")* m& [$ k/ F. Z+ U
  1687.         (= testxt "%%U"))(setq newtxt (substr txttxt 4))(setq newtxt (strcat "%%u" txttxt))). C+ W# q5 O3 R
  1688.         (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))(entmod listxt)))- X$ A6 g1 I' c7 o3 A& u
  1689.         (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))
    9 d/ j/ _5 o1 P( c

  1690. ! A4 L4 q9 i) {* K
  1691. ;;; ================ CHEN COT (TUU) =================1 @! X1 A: C3 n; h1 {( }

  1692. * c3 U$ U7 Q2 `
  1693. (defun c:tuu ()  (setvar "cmdecho" 0)(prompt "\nHay chon dong TEXT can chen cot ")
    7 Y2 H# d* w& T( o+ p( p' u+ x
  1694.           (prompt "\nSelect objects: ")(command "select" "au" pause)(setq sstxt (ssget "p")
    , @# e4 B* ~* {
  1695.         sslen (sslength sstxt) ctr 0)(command ".undo" "mark")(while (< ctr sslen)(setq listxt- M( f- \( k/ ?, c+ Y# \: g- x: E- C8 s
  1696.         (entget (ssname sstxt ctr))txttxt (cdr (assoc 1 listxt))enttxt (cdr (assoc 0 listxt)))
    1 X) r! b7 e# f, \4 [6 Y
  1697.         (if (= enttxt "TEXT")(progn(setq testxt (substr txttxt 1 3))(if (or (= testxt "%%p 0,000")
    , a2 I9 S6 N% P
  1698.         (= testxt "%%P 0,000"))(setq newtxt (substr txttxt 4))(setq newtxt (strcat "%%P 0,000" txttxt)))
    6 t3 y5 A$ M0 S+ a$ q* v2 @
  1699.         (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))(entmod listxt)))
    $ P( @; m. ~2 ]& E8 X
  1700.         (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))3 x. a1 X+ n; @* c1 l! p1 _" a
  1701. $ L0 b6 P( R& j( e1 Z' }
  1702. ;;; ================ CHEN KY HIEU THEP (TP) =================( @; q) S( _. u! D! J9 v
  1703. 4 T! {+ |' p% c8 o$ q. d
  1704. (defun c:tp ()  (setvar "cmdecho" 0)(prompt "\nHay chon dong TEXT can chen ky hieu thep ")8 c) I, b9 E0 ^! h' b
  1705.           (prompt "\nSelect objects: ")(command "select" "au" pause)(setq sstxt (ssget "p")
    5 A/ T: c' i  ]2 T' A, q
  1706.         sslen (sslength sstxt) ctr 0)(command ".undo" "mark")(while (< ctr sslen)(setq listxt
    ) p: P: f7 j- A, P0 Z
  1707.         (entget (ssname sstxt ctr))txttxt (cdr (assoc 1 listxt))enttxt (cdr (assoc 0 listxt)))" S6 k  R( B/ ~1 i% F' h# ?- L
  1708.         (if (= enttxt "TEXT")(progn(setq testxt (substr txttxt 1 3))(if (or (= testxt "%%c")/ h; {1 x& ^7 x3 S2 r
  1709.         (= testxt "%%C"))(setq newtxt (substr txttxt 4))(setq newtxt (strcat "%%c" txttxt)))% |1 D+ S+ |: ]3 [, S2 Q
  1710.         (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))(entmod listxt)))/ E1 a* Q; ?( H) i1 i
  1711.         (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))
    % l, i0 X2 }; `6 K( a& b" _

  1712. # f( W+ u" j+ v
  1713. ;=========================== TAM TUONG (TAM) =================================
      b( {( M5 a- ^) t3 \$ i+ W! e

  1714. 6 b* p8 V# r- D# C" g% p0 d/ C
  1715. (defun c:tam(/ data_m)2 }! i! q3 o5 \7 M# d
  1716.             (defun import_data(/ i)(setq data_m (ssget))(if (= nil distan_m) (setq distan_m 110.0))0 g$ |& @/ B! Q. D: e
  1717.             (princ "Distance (")(princ distan_m)(princ "):")(setq i (getreal ))(if (not (= nil i))* e; O5 I- T! k& c
  1718.         (setq distan_m i)))(defun process(/ ent check)(defun p_check()(setq check 0)2 C) p/ |' S2 z* d& E/ O9 P! ?3 [
  1719.         (if (= "LINE" (cdr (assoc 0 ent))) (setq check 1))(princ))(defun p_d_offset
    " ^9 s+ X. x2 v" {9 ]3 Q
  1720.         (/ p1 p2 p3 p4)(defun makeline(/ e2 e5)(setq la (list (cons 0 "LINE")(cons 5 (cdr2 ~, J$ t" V7 A! j! f  G
  1721.         (assoc 5 ent)))(cons 8 (cdr (assoc 8 ent)))(cons 10 p3)(cons 11 p4)))(entmake la)(princ)
    + b2 c! D) M+ B) k
  1722.         )(setq p1 (cdr (assoc 10 ent)) p2 (cdr (assoc 11 ent)))(if (not (= p1 p2)) (progn (if3 P- t5 T/ x2 p
  1723.         (< (abs (- (nth 0 p1) (nth 0 p2))) 0.000001) (progn (setq p3 (list (+ (nth 0 p1)
    # h' C& `- w& Y# _. J$ M
  1724.         distan_m) (nth 1 p1) (nth 2 p1)))(setq p4 (list (+ (nth 0 p2) distan_m)(nth 1 p2)9 q# g' i. W% O$ U$ {+ ^' x
  1725.         (nth 2 p2))) (makeline) (setq p3 (list (- (nth 0 p1) distan_m) (nth 1 p1) (nth 2 p1)))
    , M6 K) G( I! N( b
  1726.         (setq p4 (list (- (nth 0 p2) distan_m) (nth 1 p2) (nth 2 p2))) (makeline)))(if (<
    3 \( w. R. l" r& j6 \7 O
  1727.         (abs (- (nth 1 p1) (nth 1 p2))) 0.000001) (progn (setq p3 (list (nth 0 p1) (+ (nth 1 p1)- U, g6 ^/ }4 Q, \* l  `; L# j
  1728.         distan_m) (nth 2 p1)))(setq p4 (list (nth 0 p2) (+ (nth 1 p2) distan_m) (nth 2 p2)))3 q$ m5 l/ ~/ Y2 u5 G
  1729.         (makeline) (setq p3 (list (nth 0 p1) (- (nth 1 p1) distan_m) (nth 2 p1))) (setq p4/ J: y+ f# ?" [" q1 A
  1730.         (list (nth 0 p2) (- (nth 1 p2) distan_m) (nth 2 p2)))(makeline)))))(princ))(if (not( s4 z" U- F3 [3 ~* _1 w: e2 g
  1731.         (= nil data_m)) (progn (setq i 0)(while (< i (sslength data_m)) (progn(setq ent (entget5 T1 u; @7 O# K
  1732.         (ssname data_m i)))(p_check)(if (= 1 check) (p_d_offset))(setq i (+ i 1))))))(princ))- M; i! u1 x4 A3 I) M
  1733.           (import_data)(ai_undo_push)(process)(ai_undo_pop)(princ))8 ]) b7 e$ |6 |8 y
  1734. ! z5 n7 y2 R" e) ^
  1735. ;============ GHI CHU PHI (T1) ================, j/ o1 {3 j) D$ q9 l  r5 H' A8 }
  1736. 0 ~( {' J- p8 a
  1737. (defun c:DuongDan ()(setq D1 (getpoint " Diem thu nhat: "))(setq D2 (getpoint "Diem thu hai: " D1)). k: `" c/ c+ i8 ]- {' }
  1738.           (if (> (car D2) (car D1)) (setq D3 (polar D2 0 16)))(if (< (car D2) (car D1)) (setq D3* q/ v* g. ]% _+ ]6 {2 S# f
  1739.         (polar D2 PI 16)))(if (= (car D2) (car D1)) (setq D3 (polar D2 0 16)))(if (> (car D2)
    % C$ Y0 B+ K! L9 L
  1740.         (car D1)) (setq D4 (polar D3 0 3.2)))(if (< (car D2)(car D1))(setq D4 (polar D3 PI 3.2)1 a" a1 z1 Q2 A# d$ `
  1741.         ))(if (= (car D2) (car D1)) (setq D4 (polar D3 0 3.2)))(if (> (car D2) (car D1))
    & t4 R/ r; G- z8 m% V# X+ k. k& H- R
  1742.         (setq D5 (polar D2 (/ PI 9) 3)))(if (< (car D2) (car D1)) (setq D5 (polar D3 (/ PI 9)
    6 Y  v( B& J( n2 {3 D" |- L
  1743.         3)))(if (= (car D2) (car D1)) (setq D5 (polar D2 (/ PI 9) 3)))(command "color" 1)$ ?5 @, m0 n; _; x
  1744.           (command "line" D1 D2 D3 "")(command "circle" D4 "3.5")(command "color" 7 )( X# I% A4 i: o& ~" d0 G: x. D
  1745.           (command "text" "m" D4 2.5 0 "1")(command "text" D5 2.5 0 "%%c6a150")( {! Z) u' x6 \/ E- P* Y) k& ^, z
  1746.           (command "ddedit" pause))  l; a! ^- L, f9 u3 x  j8 }+ x

  1747. 2 C1 W2 E! B4 Z3 H6 p
  1748. ;;; ========================== Join (J) =================
    ' D; g2 w5 O8 u8 m5 |

  1749. ' D. w5 B, X0 T
  1750. (defun C:J () (Setvar "cmdecho" 0)(setq m:err *error* *error* *merrmsg*)(setq sset (ssget))
    9 O/ g! i) O- O* a3 f& F. u8 Y
  1751.            (if (null sset) (exit))(setq kt (getstring "\nJoin all (Y/N) <Y> ? "))
    / F, L' I1 `* u, M
  1752.           (setq ssl (sslength sset))(setq temp  (entget (ssname sset 0))etype (cdr (assoc 0 temp)
    : ~* y( v3 M9 I$ C# i, m
  1753.         ))(cond((or (= kt "Y") (= kt "y") (= kt ""))(progn (cond((= etype "POLYLINE")
    # t+ C  k+ x: Y0 r! i- f
  1754.         (COMMAND "PEDIT" sset "J" "all" "" ""))(if (or (= etype "LINE") (= etype "ARC"))4 x1 T' e+ W. V; \, {
  1755.            (COMMAND "PEDIT" sset "" "J" "all" "" "")))))((or (/= kt "Y") (/= kt "y") (/= kt ""))$ `* s% t* H- n4 P, Z
  1756.         (progn (cond((= etype "POLYLINE")(COMMAND "PEDIT" sset "J" sset "" ""))  
    : E7 K% S' R, \, {2 G4 w8 d
  1757.            (if (or (= etype "LINE") (= etype "ARC"))(COMMAND "PEDIT" sset "" "J" sset "" ""))))))6 U3 u' Z3 ?1 a8 a- ]
  1758.           (setq *error* m:err m:err nil)(princ))2 O# E. b4 Y- S: M: Q: H4 u
  1759. ' G$ k& J& L0 t- `: I" r" l0 G4 I4 v
  1760. ;=====================================================================
    0 r/ X9 V0 s7 l& R  m$ M, y2 a, R( x
  1761. ;;; DOOR.LSP 1.0, Copyright (C) 1998 by CAD Department, HUCE.
    9 r: @1 z: I, \" U8 B6 d  h
  1762. ;=====================================================================9 \* y$ P  _2 G6 B3 k

  1763. 4 ~& r0 ?& n! P' Y# ?
  1764. (defun C:D1 (/ p1 p2 p3 p4 side dis wid ang angsile old)
    % E# r$ r4 q2 r$ `
  1765. (setq old (getvar "OSMODE"))
    3 H' [5 Q+ `0 U7 z' c3 {6 ~

  1766. 4 b1 x" X" J7 }# w" c- V7 v
  1767. (setq p1 (getpoint "\nStart point:"))# a5 O9 ^  B2 {6 Z, E6 _
  1768. (setq p2 (getpoint p1 "\nEnd point:"))
    ' n5 H3 k) i3 |8 q+ \
  1769. (setq side (getpoint p2 "\nOpen side"))
    * B' g7 e" j+ ?$ q  O

  1770. ( }  f# M: G6 S+ S# T  X& [
  1771. (setq dis (distance p1 p2))
    6 x# u: N8 q9 {
  1772. (setq ang (angle p1 p2))
    ' J* _9 Y3 D9 u* |2 @
  1773. (if (< ang (angle p1 side))
    8 y0 A2 E; I, ~
  1774.   (setq angside    (/ pi 2) )0 ~. w8 b; s% [
  1775.   (setq angside (- (/ pi 2))); g* X; _8 ~$ c
  1776. )
    7 {' o1 U0 p3 D
  1777. (if  (>= (- (angle p1 side) ang) pi); B/ S& e# _  O, b. [
  1778.   (setq angside (- (/ pi 2)))
    6 \5 Z$ ^/ T- m- @
  1779. )
    : H- T9 n/ A' I' ~
  1780. (if  (>= (- ANG (angle p1 side) ) pi)
    $ b. {8 ^0 i" P  v& K; v& K+ L
  1781.   (setq angside (/ pi 2))' H# ~4 T9 X  I' N7 e' A/ Q
  1782. )
    7 b0 p' p* T& k$ m, K' h/ J1 M

  1783. 0 N/ R0 |' l- K7 m, j! d
  1784. (setq p3 (polar p2 (+ ang angside) dis) )) X+ a% A! y' x0 F
  1785. (setq p4 (polar p1 (+ ang angside) dis) )5 [; B7 b9 p' g# |/ Y; s
  1786. (setq wid (/ dis 15))
    + M$ [1 _- v6 W+ U, A. {* X: K& _
  1787. 2 Z0 G9 @( v% y% |4 z6 K
  1788. (setvar "OSMODE" 0)
    : L( J$ k) S) V7 N1 M

  1789. # ~0 R4 o8 O; V5 t
  1790. (command "PLINE" p1 "A" "D" p4 p3 "L" p2
    ! ^2 l0 h1 `' c+ H6 c# c6 y' u
  1791.                   (polar p2 (+ ang pi) wid) 5 K3 F; w: j- R- T9 Q2 [
  1792.                   (polar p3 (+ ang pi) wid)
    0 g/ \6 w; F/ a  i
  1793. "")" |0 b7 L5 v( m2 a

  1794. 8 R" L4 E1 F. L9 F9 Y5 G
  1795. (setvar "OSMODE" old)0 M. |9 \) J' p: y
  1796. (princ)
    8 \$ C  w! o# o# H/ D6 [7 n8 S
  1797. )7 Z0 {0 j8 a' A; j( h7 f& _
  1798. 7 n3 ~1 Z* O& V0 t, E
  1799. ;=====================================================================8 \' ]$ |6 K5 n

  1800. + h) q+ j4 H8 d& q, V0 a5 k, K* G
  1801. (defun C:D2 (/ p1 p2 p3 p4 side dis wid ang angsile old)1 u8 d3 n$ p1 F
  1802. (defun cua1 (pt1 pt2)
    ' c! _  K1 k! H* E- Q, W
  1803.   (setq p1 pt1/ q- z6 Z. }1 @5 I2 t# }4 {
  1804.         p2 pt2)6 c- r( p* x" ^3 Y7 M/ L2 Q
  1805. ( g- }5 _4 {/ r8 b; r( F
  1806.   (setq ang (angle p1 p2))
    6 w' M' N. L6 d  M+ J- W9 [2 t9 x
  1807.   (if (< ang (angle p1 side))) I0 ^- N, q# t) R" _6 X3 r
  1808.    (setq angside    (/ pi 2) )
    3 [% m# D0 c, c' I% e
  1809.    (setq angside (- (/ pi 2)))8 K% I% d0 X% I4 W
  1810.   )3 ^1 e5 O7 n' u
  1811.   (if  (>= (- (angle p1 side) ang) pi)2 M$ N: m8 S! n4 A; }- ^; _
  1812.    (setq angside (- (/ pi 2)))
    # f* U) b* F0 `! U! |1 T, s
  1813.   )
    # G+ i1 d8 o, w+ J0 d% F
  1814.   (if  (>= (- ANG (angle p1 side) ) pi)
    1 w/ |$ `9 z& }9 J
  1815.    (setq angside (/ pi 2))9 X0 w7 U. ^; R! Z; n
  1816.   )3 _: C$ u$ e* m# M6 C) j

  1817. - z) \! N$ P3 C5 f! o: R) U
  1818.   (setq p3 (polar p2 (+ ang angside) dis) )
      E) L& M( S( k* u
  1819.   (setq p4 (polar p1 (+ ang angside) dis) )
    7 _; u; @/ N0 B, i
  1820.   (setq wid (/ dis 15))
    # P# \0 S$ J1 V4 D6 _

  1821. 3 i$ U" d" [' ?: c- y
  1822.   (command "PLINE" p1 "A" "D" p4 p3 "L" p2 9 }) {, v8 X; q$ F/ K7 g
  1823.                    (polar p2 (+ ang pi) wid)
    $ |! j( \, S1 i( N3 M, p" d0 e/ B' t
  1824.                    (polar p3 (+ ang pi) wid)
    * a+ s6 ~1 }3 H; [: g4 d* p0 x
  1825.   "")0 Z8 K! r6 U4 r9 l* z' f
  1826. )
    5 ^# T0 N3 j: A( d/ O
  1827. ;=====================================================================, n' ?0 C1 I9 n9 j
  1828. (setq old (getvar "OSMODE")) ( K6 `% U* o" @$ N' V4 I
  1829. + k$ {5 m" O& J- o: \$ k! Z9 d
  1830. (setq p1 (getpoint "\nStart point:"))
    * x3 S2 A) V1 \3 s
  1831. (setq p2 (getpoint p1 "\nEnd point:"))" p. K& A% [4 C. A* b* y
  1832. (setq side (getpoint p2 "\nOpen side"))
    ( l/ L$ i8 S+ O. P, @& b% f2 Q2 g3 r4 W
  1833. 5 r0 F. Z$ N7 C& G. A* T& O
  1834. (setq dis (distance p1 p2))1 ^. `1 |: v6 E
  1835. (setq dis (/ dis 2))9 Q3 `- V; [! M7 Y. h3 |" l# E: z( i
  1836. 6 x7 S0 a: ?, n0 |7 h3 X9 Z
  1837. (setvar "OSMODE" 0)7 I# U, {& Q, F8 I5 A' Y

  1838.   \, S  p; Y( V1 n3 o
  1839. (setq p1 (polar p1 (angle p1 p2) dis))/ p0 M' Z. `0 }  c  V
  1840. (cua1 p1 p2)  
    % i3 x' @% k/ m. a8 t$ q

  1841. . F, F- V/ {5 P3 t% X% I
  1842. (setq ang (+ ang pi))7 E4 w' @6 G, C
  1843. (setq p2 (polar p1 ang dis))' v' |4 g( T9 ^! Y; D( U
  1844. ; (setq side (polar p1 () dis))
    ! E* @; u# D$ W' s( Z
  1845. (cua1 p1 p2)  . ^% N' o! Y& T% M  a

  1846. + |: I$ P4 ?# q. D1 K$ ~5 _
  1847. (setvar "OSMODE" old)' U: R  Y( p+ t+ V9 T! Z
  1848. (princ)9 u" d8 [) E0 ?* n* d6 ]
  1849. )
    0 o2 Q; Q$ V* v" [- D% o

  1850. # D5 w& n  W( M9 S
  1851. ;=====================================================================
    . d; q0 F" D1 ~/ t7 X, }7 j3 _; o
  1852. ;"Glue" text strings.  All adopt first's properties.9 }8 A. B7 Q# o  N* b
  1853. ;        Author:
    $ C8 E3 g  Z: ?  X
  1854. ;                Henry C. Francis
    7 o6 Z$ X* |4 h5 R7 I
  1855. ;                425 N. Ashe St./ h8 C* Q5 V3 [& C- D
  1856. ;                Southern Pines, NC 28387
    8 W; ^7 v$ F% r: s! c
  1857. ;        http://www.pinehurst.net/~pfrancis
    * u: @5 y, c0 Y- i5 S* I# {
  1858. ;        e-mail hfrancis@pinehurst.net9 M' x% M/ W3 Y4 I' }+ a
  1859. ;        All rights reserved.
    8 [, v- E- i6 K+ B# B8 A& ~2 D
  1860. (defun c:gst ( / ename ent1 ent2 old1 oldsl old10 old11 old40 old50 newstr newsl new1 new10 new11)
    : W5 \& {# G& _0 n  ?  A
  1861. (while* f& h* d. x3 g$ t# I$ B, ]- t0 D8 |/ T
  1862.   (not5 J/ C' P3 n+ Y
  1863.     (and: p$ f% ]3 w+ ?4 m3 R: i2 g
  1864.       (setq ename1 (car(entsel "\nSelect first text string to join: ")))( i, B/ }( m9 t- N5 U3 t% V2 g
  1865.       (setq ent1 (entget ename1))& I5 p/ ]* D$ n6 _0 G( [: @1 K
  1866.       (eq(cdr(assoc 0 ent1))"TEXT")% V# a, e) i& q/ A
  1867.     );and! E6 e% D* v0 c- c2 [( E2 X8 E1 P
  1868.   );not+ \- E6 f) r' W3 M# R6 h- C/ D+ r
  1869. );while
    / ^' I) j" T- H  N7 V; a
  1870. (setq old1 (cdr(assoc 1 ent1)))2 X, n8 L- V4 N4 G. Z% \% M/ @! v
  1871. (while
    , T# r3 j" `4 H/ Z- ]
  1872.   (not
    4 N' v% b5 x) T  a3 M$ e5 v
  1873.     (and
    6 n- h* j. @. {3 Y; ~. S- l7 Q% W8 @
  1874.       (setq ename2 (car(entsel "\nSelect second text string to join: "))). e$ G  {1 v. T
  1875.       (setq ent2 (entget ename2))
    - ^& u( V6 s! f
  1876.       (eq(cdr(assoc 0 ent2))"TEXT")2 c. I- V/ e6 L+ z2 @
  1877.       (not(eq ename1 ename2))5 u; q+ v1 B6 a/ H! D; h
  1878.     );and0 A" s& G$ z+ d0 C" d
  1879.   );not4 S* N6 W9 _) c' H# O; t; l
  1880. );while; a+ q6 W: E# f4 T; I
  1881. (setq old2 (cdr(assoc 1 ent2)))8 d/ X  W% X- w
  1882. (setq new1 (strcat old1 " " old2)
    & i8 d9 z# A2 _
  1883.       ent1
    7 S6 {; R* o' ~; x' U
  1884.         (subst (cons 1 new1)
    9 g9 {1 t$ Z% j  B! ?" f$ j2 l* [* K0 G
  1885.                (assoc 1 ent1)% ^7 f5 B( G8 R6 c  m
  1886.                ent1)
    1 |! r6 ^1 B2 b( M8 N# e
  1887. );setq
    8 L* l. A+ j* s4 i  c+ U( \
  1888. (entmod ent1)- H- S# }7 g' X& t+ l/ V
  1889. (entdel ename2)
    % P' f4 s, L5 }# B% r$ c
  1890. (princ)
    ) U5 l! A# l/ C( {0 S
  1891. );defun- B% g5 V! O" S" f' q

  1892. / g3 `  i* B- ~
  1893. ;=====================================================================8 M/ M. R  X1 A/ j1 g" ]  V
  1894. / S& _0 R  W; J& m6 d
  1895. (defun c:nt (/ g1 g2 ss1 olderr nterr l i temp e1 e2 new old dd dc)
    ( m' }. J" j6 a$ j& l9 A0 i% u

  1896. $ \: k# m' d( L/ O2 G
  1897.     (defun nterr (s)" S2 U( T" H$ F3 q, R4 }
  1898.         (command "_.UCS" "" "_.UNDO" "E")6 L6 W+ A3 W3 k4 N
  1899.         (setvar "cmdecho" 1)9 w# G3 i8 ]" K* l
  1900.         (setvar "blipmode" 0)3 M/ f7 S6 i0 s: `' u& \+ n
  1901.         (setq *error* olderr)$ ~) U' z7 d+ o( Q# G' U; P8 t
  1902.         (setq g1 nil g2 nil ss1 nil e1 nil e2 nil olderr nil
    ( M3 F1 G7 K8 {: J1 Y
  1903.                 nterr nil temp nil i nil l nil new nil old nil dd nil dc nil)# z; s5 P) j5 t5 f1 j1 g7 o
  1904.         (princ); _2 X7 G  y0 j4 j. ^# ?
  1905.     )/ I2 b$ Y* ]. N: [* n7 @; q
  1906. ) b3 f& b( O# [
  1907.     (defun tim_in (dt / p01 p02 ktra)
    , R9 i' Y" r7 r, u
  1908.         (setq p01 (cdr (assoc 10 (entget dt))))
    8 M# M/ O- {, p! Q9 A& t
  1909.         (setq p02 (cdr (assoc 11 (entget dt))))
    * W! @' [! u" t) r0 ^
  1910.         (setq ktra T)
    * L8 B2 a! t$ J5 ~
  1911.         (if (and (> (car p01) (car g1)) (< (car p01) (car g2)) & b! r9 G9 L1 K4 k3 X2 l2 a
  1912.                  (> (cadr p01) (cadr g1)) (< (cadr p01) (cadr g2)))2 V8 o( @8 p3 _5 m) p5 e
  1913.             (setq ktra nil)
    6 b2 R/ D  s+ L/ Z' S7 [
  1914.         )/ M$ ]/ |& p, W  Q9 I! W" ]( T
  1915.         (if (and (> (car p02) (car g1)) (< (car p02) (car g2))
    " n. j" U% E2 C% u5 h
  1916.                  (> (cadr p02) (cadr g1)) (< (cadr p02) (cadr g2)))
    2 X9 k6 L$ H  u4 A
  1917.             (setq ktra nil)
    " a( G$ X0 m/ |
  1918.         )
    1 e) w& l  N8 k2 ~2 A! |4 ]: ~
  1919.         ktra# C1 _9 J0 u( v% M( V( V3 j  S2 v
  1920.    )( G. ?" c! y. _

  1921. # h7 p0 t4 i! x1 s; P/ P( X) r
  1922.    (defun timdt (dt1 dt2 / p01 p02)) K' f+ v5 f+ p+ V$ d
  1923.         (setq p01 (cdr (assoc 10 (entget dt2))))
    * [" O9 j8 l4 B+ N% x- w/ W
  1924.         (setq p02 (cdr (assoc 11 (entget dt2))))
    ; A6 v  q2 Y  c1 o/ H, K
  1925.         (setvar "ucsicon" 0)/ [. h5 ^' L1 m: ~+ o
  1926.         (command "_.UCS" "E" dt1)! I8 E8 x8 q+ I8 ]% e& V
  1927.         (setq p01 (trans p01 0 1))
    4 T8 F+ a9 ^, `
  1928.         (setq p02 (trans p02 0 1))7 l$ D# h( \' A- _) t8 y- V. c
  1929.         (command "_.UCS" "")/ o4 @% _1 P8 s
  1930.         (setvar "ucsicon" 1)
    $ j' E$ I; h9 ^* J" ?. U; L
  1931.         (if (and (equal (cadr p01) 0 0.001) (equal (cadr p02) 0 0.001))( n5 J: E  ]: T. T- X2 ?- g5 E0 C
  1932.                 T
    ; C0 ^' y  V: N
  1933.                 nil* y  t* i. \+ c: v; E8 B8 h
  1934.         )
    , f4 v" B9 [* D7 ]$ _# O
  1935.    )
    - f3 t; m! |# U* [

  1936. 3 W' b0 H+ Z' [  v. X7 T
  1937.     (defun tim_out (dt / p01 p02 kt)
    . N. `% m7 k! ]# t- l0 h  i
  1938.         (setq p01 (cdr (assoc 10 (entget dt))))
    % b# l7 R+ [* E- `8 Q; x; z
  1939.         (setq p02 (cdr (assoc 11 (entget dt))))
    , f4 L6 F$ J  A& D: o+ G1 d
  1940.         (if (and (> (car p01) (car g1)) (< (car p01) (car g2))
    # `' y: P/ U/ P
  1941.                  (> (cadr p01) (cadr g1)) (< (cadr p01) (cadr g2)))
    7 [& m' B. j8 v/ q8 ?
  1942.             (setq kt p02)9 l* A3 _0 w+ e/ T4 o# `
  1943.         )4 e7 `- c" x( i: V# u' z6 Q% C: n- @
  1944.         (if (and (> (car p02) (car g1)) (< (car p02) (car g2))
    4 x& f, ^2 {& s: ~  E2 l
  1945.                  (> (cadr p02) (cadr g1)) (< (cadr p02) (cadr g2)))
    5 V2 f6 _1 b/ y: r. N
  1946.             (setq kt p01)
    2 k' B& n# N; f+ a; S
  1947.         ), N* u: X! f6 n5 J
  1948.         kt        
    6 u  w6 y6 e, |1 B9 p4 M! h0 i
  1949.    )* E# P! h1 ]/ I' o+ x1 h1 i7 X
  1950. # T4 o( A1 h$ z
  1951.     (setvar "cmdecho" 0)( H. m9 C) F$ \; i
  1952.     (setq olderr *error* *error* nterr)8 n; p1 T1 _- c( R
  1953.     (command "_.UNDO" "G" "_.UCS" "")
    . V) e" \: i4 n8 i3 l
  1954.     (while (null ss1)
    + V8 _6 p5 |2 b9 ]# A5 w& _
  1955.         (princ "\nChon tuong muon noi...")" [. w- E/ O- A
  1956.         (initget 1)
    , n: w9 K. S5 S/ \7 i
  1957.         (setq g1 (getpoint "\n>Goc thu nhat:"))
    ' Q$ E5 ]; `! j% T6 T5 ^6 K9 }' T
  1958.         (initget (+ 1 32))8 \, L$ C$ c4 c& |8 z3 a
  1959.         (setq g2 (getcorner g1 "\n>Goc thu hai:"))
    5 g9 _9 z& K+ q4 `' x6 `
  1960.         (setq ss1 (ssget "c" g1 g2 '((0 . "LINE"))))5 l; F! h3 R1 f1 F, r! o( ?
  1961.         (if (null ss1) (princ "\nKhong tim thay doi tuong!"))
    % x. C+ g9 o3 n8 F
  1962.     )
    * N( c# W( @2 x9 X0 b
  1963.     " W0 z; o9 W; k+ i# m" I" K0 U5 h! @
  1964.     (setq temp (list (min (car g1) (car g2)) (min (cadr g1) (cadr g2)))2 E% T+ D' X3 r3 E' `
  1965.           g2 (list (max (car g1) (car g2)) (max (cadr g1) (cadr g2)))7 J3 S$ x$ P) [4 G2 `2 q
  1966.           g1 temp): o1 k& Q$ d  O# f
  1967.    (setq ss1 (ssget "w" g1 g2))9 \8 `' ~: ?# V) {  m
  1968.    (if ss1 (command "_.ERASE" ss1 ""))& a5 F. k1 `0 c$ Q) X
  1969.    (setq ss1 (ssget "c" g1 g2 '((0 . "LINE")))). P' J2 H: E9 z) v" R( V
  1970.    
    3 I2 k% n. W9 U
  1971.     (setvar "blipmode" 0)
    5 ^8 v$ F* H6 c8 B" r1 _8 u  Z+ |
  1972.         (setq i 0 l (sslength ss1))" `5 s; u4 q! P
  1973.         (while (< i l)
    7 w9 R  p5 b: m( O
  1974.            (if (tim_in (ssname ss1 i))6 ]  r8 Y/ Z; {: r3 ~
  1975.               (progn 4 N2 m- x9 }3 _* l; z
  1976.                     (ssdel (ssname ss1 i) ss1)7 \# ^! h( Z* B% b2 l: N: z/ G
  1977.                     (setq i 0 l (1- l)), e1 K9 d' I9 x. T/ E$ }
  1978.               )        
    1 o  ~3 m9 \* D
  1979.               (setq i (1+ i))
    4 R7 g9 K7 C3 P0 d; \8 G
  1980.            )
    . g% @4 F9 x7 Z. s! ?& m
  1981.         )% S2 e. T* P9 q% ]
  1982.         (setq l (sslength ss1))
    7 Z* [- K1 \; {) _8 H
  1983.       (while (>= l 2)
    1 A: Q/ y. E/ W
  1984.         (setq e1 (ssname ss1 0)); y1 m$ t' T( {: M
  1985.         (ssdel e1 ss1)
    . E1 N& ^" J* l
  1986.         (setq e2 nil i 0 l (sslength ss1))9 @' N# U' D$ F) k7 K. D2 d
  1987.             (while (< i l)
    : Z/ E6 L) n: n! c
  1988.                 (if (timdt e1 (ssname ss1 i))
    4 l) q3 b, _& D" T
  1989.                     (progn
    $ c# T2 {; N# q; C' v$ o: \5 R
  1990.                         (setq e2 (ssname ss1 i))! B# M; x5 Y5 ]/ X, v) R
  1991.                              (setq dd (tim_out e1))
    " J5 @% c0 |: f& S6 h
  1992.                              (setq dc (tim_out e2))
    # u( b6 @, z6 q2 M
  1993.                     )
    $ `% |: r9 }. W1 [/ C# a
  1994.                 )
    / ~1 f9 T, ~/ w% t
  1995.                 (setq i (1+ i))
    & z+ @9 u" G! b' X3 V9 Y
  1996.             )) f/ _7 y0 \" p% N, k$ R' |1 y
  1997.             (if e2 (progn
    ) i8 Z% D" r4 Y- ^% t
  1998.                         (ssdel e2 ss1)                        ; E& k/ l$ ?1 m* g/ U
  1999.                         (command "_.ERASE" e2 "")' X& w# P# ^( ]) f& t$ Q* ~
  2000.                         (setq temp (entget e1))
    6 `* C* ^& w" Q/ j) v" z& K4 i2 a
  2001.                         (setq old (assoc 10 temp))2 z7 I* X# y- z( r0 p9 u: X( D" B
  2002.                         (setq new (cons 10 dd))
    $ F  U9 W, `# u6 R; o; B
  2003.                         (setq temp (subst new old temp)): f# v  o/ Y0 b1 C: k# c
  2004.                         (entmod temp)- U3 M8 P6 P, Z5 j: S( e
  2005.                         (setq temp (entget e1))
    $ {4 U: D$ i6 c: o% T9 \3 K$ C' t
  2006.                         (setq old (assoc 11 temp))
    * }3 v8 q, S/ g* n! Z* j8 o
  2007.                         (setq new (cons 11 dc))
    * e4 z# |8 h" E* n
  2008.                         (setq temp (subst new old temp))
    2 s1 T0 g5 |) D& N; Q" S2 L
  2009.                         (entmod temp)2 n% n! S+ A) g) S( \: L3 K
  2010.                         (redraw e1)" e9 r: j8 m2 [
  2011.                         (setq l (sslength ss1))
    $ d, z- K6 ]. s( L
  2012.                    )
    5 W+ b! K5 K) G+ i! n6 L0 i
  2013.             )! q- g( }/ b$ Y+ Y: Z& Q) [
  2014.         )
    9 |/ S1 \; C! i! f& H1 ~. o
  2015. 1 q5 V( P& Q6 j, }' N5 {4 N" y$ k3 s
  2016.         (command "_.UCS" "" "_.UNDO" "E")4 s2 R' H6 ]' ~, A
  2017.         (setvar "cmdecho" 1)1 s8 z) G% ]5 L4 A
  2018.         (setvar "blipmode" 0)
    ; V# r5 ^  @0 t* h9 {/ {; W1 [
  2019.         (setq *error* olderr)7 L. A* ~" H1 b0 _
  2020.         (princ)
    . a  O) g' T0 v( [6 c
  2021. )' {3 a# ^6 w; V' x. A/ U
  2022. ;*********************************************************************
    + i( X: r7 Z! K* X3 \$ ^  A5 h
  2023. (defun ketthuc ()  |9 ^; C. G- N* S# t- x
  2024.         (setvar        "cmdecho"        luuecho)& G- J! t3 D$ C, R7 V
  2025.         (setq *error*        luu
    / C' ]! Z$ f& |! ]3 v+ V! C
  2026.                 luu                nil        
    ; ~/ b0 C- G5 Q* E7 l
  2027.                 luuecho        nil
    ( J7 O/ M/ r* U' w1 W' T7 L
  2028.         );setq6 U# o$ V  R4 W! D& ^
  2029.         (princ)( k% f' K: t+ \! Z2 [
  2030. )               
    5 e1 W; b4 c% y' Q/ u" S0 k, d
  2031. ;*********************************************************************; E/ W/ d! ?) ^% E
  2032. (defun modau (). q5 ?3 [; D3 l+ a
  2033. (setq         luu *error
    # g% I5 }: L6 u" D( j: a2 M# J
  2034.                 luuecho        (getvar        "cmdecho")
    3 W- n, h& i- v7 [: n  v
  2035.                 *error        (ketthuc)( {6 Z2 ]8 h4 f9 V
  2036. )
    : J; C+ [$ N, l# q$ |2 J) d& Q4 U
  2037. )
    ) [8 V6 \0 s; ]! v. M# p, y! f
  2038. ;*********************************************************************
    / n7 v9 Y' i1 p1 v5 q' H- M
  2039. (defun xulytext (text / kytu ma sokt luusokt lui )
    # N' n* D! \0 K+ q& J2 m/ w$ ]3 ?
  2040. (setq         kytu        (substr text (strlen text))3 n0 ?: T  K! x! h1 t
  2041.                 ma        (ascii kytu)
    % P/ y) b9 j% w& @+ ^! X+ v1 _
  2042.                 sokt        (read kytu)
    5 D. A7 j) m2 o) [2 ?
  2043.                 lui        1
    3 R$ |& g& h+ N  a. e% \. S
  2044. )
    # X9 Q/ E9 \. K4 I- l( v6 e, I
  2045. (if (numberp sokt)
    5 ?, ]6 l" w  v5 P' |9 x
  2046.                 (progn
    & I- i5 C8 m; R+ \( ?
  2047.                         (setq luusokt        (1+ sokt))
    , ~, `# A  y- ?+ u& D
  2048.                         (if (and         (numberp sokt) ) c0 T0 }/ P7 B( @
  2049.                                         (> (strlen text) 1)
    * z% z% k; }. V. K, V2 j
  2050.                             )        
    5 Q( E: k* a" Q
  2051.                            (progn7 d- ^( x% j1 \6 n- v! k6 D* T
  2052.                                 (setq         kytu        (substr text (1- (strlen text))): T5 k+ i( o& G9 k/ U$ H
  2053.                                                 sokt        (read kytu)
    2 O( L: U8 ~! J& i9 P
  2054.                                                                                 )% L" f0 w! _) H
  2055.                                 (if         (numberp sokt) " o7 B6 ?2 ^7 T
  2056.                                         (setq luusokt (1+        sokt). o# x! u4 n  O2 G4 ?0 R1 v5 D# s8 T
  2057.                                                         lui         23 v- y: K' F$ W& N& W! K9 k
  2058. 8 ]8 p" @; U* [9 A+ ?$ K9 p
  2059.                                                 )
    7 l' l4 s; y, y; ?5 e
  2060.                                 )
    ' Y% ]7 e* M8 L/ o6 P
  2061.                             );progn        
    $ U. Q: I! N& o. s7 i3 j. C3 U7 u
  2062.                         )
    ' p! `  H3 ?1 M0 m
  2063.                         (if (= luusokt        100)        (setq         luusokt        0))3 T% @3 O$ ?% n& B% o: `
  2064.                         (setq         kytu                (rtos luusokt 2 0)
    $ E$ o. _* n4 E& N; ~/ j3 B( u
  2065.                                         1 V/ Y: d: k8 `! u. |% h, W
  2066.                                         text        (strcat        (substr text 1 (- (strlen text) lui))  kytu); u$ f: @+ q7 ]9 q. V
  2067.                         )
    7 E7 l+ C. W" @; X# b# ]+ ~
  2068.                 );progn                         ; @5 s8 w! p7 x, D
  2069.                 (if   (or         (= kytu "z")
    5 w: y5 q9 y! p4 @
  2070.                                 (= kytu "Z")
    3 t# A, a  i( ^9 t1 ]
  2071.                         )
    % D! w) T8 B# r6 r5 a( n$ g
  2072.                         (setq         text                (strcat         text        "0")
    - Q; I, X* N& L6 a/ M0 R* e
  2073.                                 textxl                "0"# g1 I" C  X, `( @
  2074.                         )9 `$ x& O  _2 F& Z  Y
  2075.                         (setq                ma        (1+        ma)
    + I$ [( A* d! N* W  I
  2076.                                         text        (strcat        (substr text 1 (1- (strlen text)))  (chr ma))
    - `1 h. L( [5 |6 _
  2077.                         )
    + H; g# b" F( @- S0 }' h5 j
  2078.                 );if
    5 E' v9 J# t# I1 ~& j$ F2 P2 k: S
  2079. );if
    $ o0 U$ \. U+ k) o- J4 L
  2080. )
    4 J* x4 X5 d/ X8 w
  2081. ;*********************************************************************4 U0 J: ~* ^2 `! h
  2082. (defun doitext(tendoituong / chuoi doituong thoat tam dsach kieu text vitri10 vitri11 dem canle)
      R5 C) C2 M7 u
  2083. ;Neu doi tuong la text thi tiep tuc
    , o* d) T1 V* C
  2084. (setq         doituong         (entget  tendoituong)
    & v+ c3 |. p5 V8 u8 o1 n& F% X
  2085.         kieu                (cdr (assoc         0        doituong))9 @5 i* s' Z( Y( t" ^- x
  2086.         canle                (cdr (assoc         72        doituong))
    * l  F7 X4 ~$ H
  2087. )        , F0 M& Z6 \- T: B2 I3 R
  2088. (if (or (= kieu                "TEXT")( P" A2 V; R6 y4 |2 N3 Q
  2089.         (= kieu         "MTEXT")        $ k! Y( W. L- e0 j+ u+ P" h
  2090.     )         
    9 r! A7 {+ P; I, ~) K, D
  2091.         (progn: L. n4 e8 ~: F  V4 d7 @0 g% H
  2092.                 (setq        textxl        (xulytext textxl)8 G1 r1 [6 Y$ x& D
  2093.                         text        (cons 1 textxl)3 O: z5 P3 x9 N' ^* G
  2094.                         vitri10         (cdr (assoc 10 doituong))
    % \% w- Z, E6 s7 j
  2095.                         vitri10         (list (+ (car vitri10) (car vitrilech)) (+ (nth 1 vitri10) (nth 1 vitrilech)))' H# f7 v+ I9 m( P2 u
  2096.                         vitri10                (cons 10 vitri10)
      n6 F3 L9 u4 M5 N( H
  2097.                         vitri11         (cdr (assoc 11 doituong))9 d' l7 \) [  V3 ~* F4 r" E% o, t
  2098.                         vitri11         (list (+ (car vitri11) (car vitrilech)) (+ (nth 1 vitri11) (nth 1 vitrilech)))
    + y8 G( D6 F8 J" L6 A1 v9 t
  2099.                         vitri11                (cons 11 vitri11)
    7 |  g, i) s, g. O; Q
  2100.                         dem        0. h- D. b+ m% w
  2101.                         dsach        nil, I( x3 x' }2 D: x
  2102.                 )
    9 g, g9 p% ^( M4 D7 o
  2103.                 (foreach tam         doituong* A# I- U6 Q& L* o+ G+ `; C
  2104.                         (cond' N6 @* p' c, P
  2105.                                 ((= (car tam)        1)        (setq dsach         (append dsach (list text))))( T; I( h3 E- g0 M* [+ q8 ^- u
  2106.                                 ((= (car tam)        10)        (setq dsach         (append dsach (list vitri10))))" c6 P( k1 G; [3 p
  2107.                                 ((= (car tam)        11)        (setq dsach         (append dsach (list vitri11))))8 I) C( b7 B" ~- Y% L
  2108.                                 ((setq dsach         (append dsach (list tam))))
    . J: G) L1 w1 n/ L
  2109.                         ); w5 y% h" T  A4 C( C
  2110.                 )
    8 H6 L$ W, d3 n7 y1 @
  2111.                 (entmake dsach)4 U6 l, [0 o( m( _& A2 p
  2112.         );progn
    % e  f5 a( Z# T; i8 h% b
  2113. );if9 p( b$ R4 f) A4 _- P# M. Q
  2114.         );8 l" k( f+ ^2 T# p1 [. [7 N
  2115. ;*********************************************************************
    ( c$ ^9 i+ _3 j; U1 e
  2116. ;sao doi tuong cu sang vi tri moi
    7 c; r. o4 a  w8 ]2 j. ?
  2117. & l; x0 q# \: {5 N
  2118. (defun copy_dt (tendoituong )9 X: E: G( r! D% M
  2119. (command "copy" tendoituong "" goc toi )
    # ~2 j4 B0 `" ^0 i
  2120. );defun: [. t; J" w' [2 V8 g
  2121. " ]+ n/ ?/ |; i$ v1 [
  2122. ;*********************************************************************
    ! f( A" B: @8 x  B
  2123. 1 ]# J- [( |' K& e6 I! D
  2124. (defun c:ct ( / cumdt dodai thoat dem ten doituong textxl dem goc toi)
    ! f* p* c7 \1 l1 W
  2125. ; Khoi dau cua chuong trinh
    * w# p4 V( D- h# s  H. J0 C& t
  2126. (princ "\nCopy Inteligent...\n")
    / K2 \2 z  p6 n9 w. Q# u/ T
  2127. (setq         luuecho        (getvar        "cmdecho"). R) c) Z1 k# R# |
  2128.         luu        *error*( R, E6 C2 D. C4 X$ L
  2129.         *error*        ketthuc
    ' F. ~3 l: T" g/ m% B+ I
  2130.         cumdt         (ssget)
    , G: R- F5 z0 U+ h3 P& e
  2131.         dodai         (sslength cumdt)3 ]8 |8 N7 S3 g4 l4 d2 o
  2132.         goc                (getpoint "\nSelect base point:")
    9 e1 t) H* v$ i1 Z0 w& V& t$ j
  2133.         thoat                nil
    . V3 S' @5 s9 {! w
  2134.         dem                0
    4 t( j% S2 z% g. u5 o
  2135.         textxl                nil
    4 z6 K2 I7 Y3 e5 p! w! z$ [! q
  2136. );4 Y; x# E" w+ n% W3 Q" [5 _" J
  2137. (setvar "cmdecho" 0)
    0 t5 Y/ L+ S) `* T
  2138. ; Loc ra duoc ong text de xu ly
    - r( L% a/ g! T  \" S
  2139. (while        (and         (= thoat        nil)
    " |7 J2 `$ Q: M. T
  2140.                 (< dem        dodai)
    . r( j4 I3 ]6 R
  2141.         )
    1 M" }3 m" F: w# E/ P; _* V; V
  2142.         (setq         ten        (ssname cumdt dem)& `' z' P" T( F, \2 ?+ A& h
  2143.                 dem        (1+         dem)8 I5 V3 D: S$ _2 C+ C
  2144.                 doituong (entget ten)( q. R: N# I3 O( j, G
  2145.                 kieu         (cdr (assoc         0        doituong))                        9 S8 H, a3 J  A  T0 f/ r: W3 b6 Z
  2146.         )
    2 e+ r' Q& y/ q: @# ?+ ]$ L. `
  2147.         
    ; K8 p2 x% B( }5 h3 A& I7 V
  2148.         (if (or (= kieu                "TEXT")
    - \# S  a8 }) A" U7 X
  2149.                 (= kieu         "MTEXT")          _- o8 q! g7 o$ m- `4 a) z! m
  2150.                 )5 u' A$ Q- G2 n3 W& L: G% [2 a
  2151.                 (setq         thoat        T+ g, _3 E7 _  E( i3 P6 @- g' E1 m
  2152.                         textxl         (cdr (assoc 1 doituong))         1 t- e) J, Y  l+ ^+ B
  2153.                 )
    / [' V9 {0 U" i
  2154.         )" T' g& p. ]' }9 e
  2155. );) P( \5 D1 u; V
  2156. (while T
    5 P/ _8 K* U$ H+ Q( c1 y+ e, b8 w
  2157. (setq        toi                (getpoint "\nSelect next point: " goc)
    4 Z' S8 p' P% a- M
  2158.         vitrilech         (list         (- (car toi) (car goc)) (- (nth 1 toi) (nth 1 goc)))* J2 }. Z% u3 a, y
  2159.         dem                0
    * \# ~: D0 I  B& B9 s$ x3 T
  2160. )
    3 G! U6 |* z& X! ?+ D# c
  2161. (while        (< dem dodai)
    ' A; L1 M+ g! V# o
  2162.         (setq         ten        (ssname cumdt dem)
    / v( n! f2 w3 @2 y
  2163.                 dem        (1+         dem)
    3 b; e) I$ ^) ^2 L, i2 R3 I) s
  2164.                 doituong (entget ten)! I+ S* W+ o. x' w: g4 u
  2165.                 kieu         (cdr (assoc         0        doituong))                        , E; k; ^" |; o
  2166.         )$ Y2 r' P  a8 }; D! \$ Q
  2167. : Z1 ~4 M! l! J+ w! @" S
  2168.         (if (or (= kieu                "TEXT")
    8 S% G* n6 J6 Y
  2169.                 (= kieu         "MTEXT")        
    4 e% U& {( j+ V, V" r/ b" }' w
  2170.                 )' z. g# \! t/ d* W4 g2 K9 b8 X7 B
  2171.                 (doitext        ten), M; m3 k6 j  t7 Z# Q: j$ s) N# X
  2172.                 (copy_dt        ten)
    5 J3 H3 n, {( d1 U
  2173. $ v% x4 `' O6 p6 p: y
  2174.         );if
    * J+ n' a  g1 m# b$ L+ j+ M
  2175. )8 U0 K# J: }" e5 p
  2176. );while8 A4 {* o0 n& W: j3 A) F- }
  2177. (ketthuc)
    : W7 q( [7 e8 K" K
  2178. );defun
    ( ^: ?+ c$ R' _% X* A/ O% R
  2179. (princ "Type \"DG\" to start")$ Y; i. i  `9 A) e
  2180. ;Note: bien toan cuc: textxl vitrilech7 P: M- p+ `# N
  2181. & S# N- j6 q5 n6 ?
  2182. ;=====================================================================6 _6 p# F/ D, Z8 ~
  2183. ;;; PLJOINFUZZ.LSP
    7 G) A  D; z% }: p
  2184. ;;; Joins lines, arcs and polylines using a fuzz distance
      Z6 u) G/ R) H' x% @4 J2 C
  2185. ;;; If only one object is selected it tries to join to all objects that are possible; p- f+ h; A! T7 _: r
  2186. ;;; By Jimmy Bergmark
    8 q! H3 S$ ]4 Q) k
  2187. ;;; Copyright (C) 2003-2004 JTB World, All Rights Reserved
    # }- j1 {0 P/ m9 X7 b6 r4 s( Z, [
  2188. ;;; Website: www.jtbworld.com
    4 g; R2 v/ e  H% d
  2189. ;;; E-mail: info@jtbworld.com. [* S% I( F1 e: F. ^
  2190. ;;; Tested on AutoCAD 2002,2004 and 20059 _' A' K1 M& m. G
  2191. ;;; Latest revision made 2004-11-11
    % }2 Z) M  q1 X5 ^0 |, W# I
  2192. ;;; Minor code cosmetic change made 2004-11-13
    & c8 u6 ^6 u! }9 O4 o& \% }* j& ~+ x
  2193. ;;; Bug corrected 2004-12-23$ ^. K% H4 d3 C% _
  2194. * ^& x! J; `+ d
  2195. (defun c:jf () (c:pljoinfuzz)) ; this line can be commented out if there is an existing command called jf
    ) J2 w0 n- O/ X  W. H
  2196. (defun c:pljoinfuzz (/ ss1 entLine objType oldcmdecho oldpeditaccept fuzz okObjects)% G# Y) h/ t* V; a" T# u. E2 K5 u  b
  2197.   (setq oldcmdecho (getvar "cmdecho"))- E# z9 G2 v( Z7 {& Q
  2198.   (setq oldpeditaccept (getvar "PEDITACCEPT"))
    ; C; r: v: a  L4 z# t- N
  2199.   (setvar "cmdecho" 0)% N# G6 R6 h) K. F% `
  2200.   (setq A2k4 (>= (substr (getvar "ACADVER") 1 2) "16"))
    2 {' t1 w/ A% q) I( `
  2201.   (if A2k4 (setvar "PEDITACCEPT" 0))
    ; ?# X( }5 I, M& |# i, b
  2202.   (setq        okObjects '((0 . "LINE,ARC,POLYLINE,LWPOLYLINE")))
    " r: p7 I# E6 c- v; n- x- E
  2203.   (princ "\nSelect object to join: ")$ m6 h5 x) x- u
  2204.   (setq ss1 (ssget okObjects))1 e. i  O  H4 z1 m9 V' M
  2205.   (setq fuzz (getdist "\nFuzz distance <0>: "))0 o" R' S% t% H' ]- \9 R
  2206.   (if (= fuzz nil) (setq fuzz 0))
    7 d+ K/ b; m5 B: L3 _/ ~& F( X
  2207.   (if (/= ss1 nil)3 F  e: l, M0 x
  2208.       (progn
    3 t5 N; L, r8 x
  2209.         (setq objType (cdr (assoc 0 (entget (setq entLine (ssname ss1 0))))))
    $ c1 P* g; q3 S8 [& T: v, p
  2210.         (if (= (sslength ss1) 1) (setq ss1 (ssget "X" okObjects)))3 H! H# p' R; Y* W; V: {
  2211.         (if (member objType '("LINE" "ARC"))1 `7 \7 o& ?) [- E/ n7 ^& k
  2212.           (command "_.pedit" "_M" ss1 "" "_Y" "_J" "_J" "_B" fuzz "")7 n+ j9 x( j; U9 I5 e4 t1 N
  2213.           (command "_.pedit" "_M" ss1 "" "_J" "_J" "_B" fuzz "")3 W: ~" L! q9 ~& ?' C
  2214.         )8 ?- ^& L+ S8 p* Y( M
  2215.       )
    9 j, ~: z1 v! B/ L- u
  2216.   )
    . e6 Y2 I' j' ?: W
  2217.   (setvar "cmdecho" oldcmdecho)5 N4 g1 \6 A" F+ T. u% S
  2218.   (if A2k4 (setvar "PEDITACCEPT" oldpeditaccept))
    . q- }+ J6 f6 ^5 h0 y  Y8 g
  2219.   (princ)
    ) |7 N* I3 e8 S+ X5 H0 f
  2220. )6 O3 T% q8 S3 ?5 h$ q" |. \+ B. [
  2221.   q" U' w% @/ m' C( |+ ]
  2222. ;===========================VE CAO TRINH===========================5 y) _9 M6 t, J8 b
  2223. 9 t7 i/ M# _0 t( T
  2224. (DEFUN C:Cotcao (/ CMD PT1 PT2 PT3 PT4 PT5 PT6 PT7 PT8 NPI TX DX DY TL OSM OLL
    % @+ a. x( H5 {( w$ Q
  2225.                 CRST RSIZE TSIZE STR PRMT FCH NBC OLDERR)4 J+ Z% [: @* t. ?- f
  2226. (SETQ OLDERR *error*
    6 R8 v8 T* y7 l+ z! ?$ B) x: m
  2227.       *error* loisb)8 ]. R' p) [3 B- l: B
  2228. (command "layer" "m" "dim" "c" "" """")
      ?2 U0 u$ m+ Y  t( c( Z
  2229. (SETQ CMD (GETVAR "CMDECHO"))
    + ]9 h; {2 e1 @( {/ ?+ V3 H# S
  2230. (SETQ NBC (GETVAR "CLAYER"))
    . ~* E& x3 E/ O/ `: Z
  2231. (SETQ OSM (GETVAR "OSMODE"))) h$ F# X: |, U
  2232. (SETVAR "CMDECHO" 0)" G4 i1 o0 n+ ]3 Q" a
  2233. (SETQ PT1 (GETPOINT "\nDiem cao trinh:"))5 x' R6 B6 Y! A: [
  2234. (SETQ TX (GETSTRING "\nCao trinh:"))2 a% n0 z3 A  g' x- l
  2235. (SETQ FCH (SUBSTR TX 1 1))
    . w8 f0 \" L- T& G6 l: c7 i
  2236. (IF (= FCH "@") (SETQ TX (STRCAT "%%P" (SUBSTR TX 2 (- (STRLEN TX) 1)))))
    0 R( n( |6 J  {- X: ]3 Y
  2237. (SETQ CRST (GETVAR "TEXTSTYLE"))' H4 Z$ n( H3 q* ?+ y7 I/ k" H
  2238. (SETQ RSIZE (CDR (ASSOC 40 (TBLSEARCH "STYLE" CRST)))); h- i( I1 G9 u3 d$ R- O) @
  2239. (SETQ TSIZE (GETVAR "TEXTSIZE"))
    4 @/ o5 y9 S, z2 F( j* B, ?! Y
  2240. (SETQ STR (RTOS TSIZE 2))1 k+ W; ]4 ~) G+ I+ C& a7 G
  2241. (SETQ PRMT (STRCAT "\nText height <" STR ">:"))' l! h+ @. G" _  w
  2242. (IF (= RSIZE 0)$ [) ^: Q' g% j
  2243.   (PROGN
    , p* _; q1 w2 ?' i
  2244.         (INITGET 4)
    # n: l8 {) l  y7 m
  2245.         (SETQ TSIZE (GETREAL PRMT))
    " d" N, V: N' c- c& A! d  A+ G0 K
  2246.         (IF (= TSIZE NIL) (SETQ TSIZE (GETVAR "TEXTSIZE"))
    7 \7 ~! U4 g3 Z# O' B, G
  2247.                           (SETVAR "TEXTSIZE" TSIZE))
    7 [) \8 K; L" ?$ o
  2248.   )4 J; Q7 Q8 {& |$ F- g$ B, X$ m
  2249. )6 j) l% @: s3 \- {  I' Q
  2250. (PRINC)8 v! z2 W8 p* T* F: E: Z/ ~
  2251. (SETQ TL (/ (GETVAR "TEXTSIZE") 2))
    $ X) y% L5 T$ Q+ ], E+ k) |
  2252. (SETVAR "OSMODE" 0)
    6 a8 r1 b( M1 b% f
  2253. (SETQ DX (CAAR (CDR (TEXTBOX (LIST (CONS 1 TX))))))
    ( h' y% o; G: K
  2254. (SETQ NPI (/ PI 2))8 }/ }, S1 Q2 P- R* Z6 M
  2255. (SETQ PT4 (POLAR PT1 NPI (* 1 TL)))* m3 }, `7 T4 z5 F
  2256. (SETQ PT2 (POLAR PT4 PI (* 2 TL)))* n% `, u* Q- B4 f( h
  2257. (SETQ PT3 (POLAR PT4 0 (* 2 TL)))
    6 L/ J! q% L  Y- G3 f
  2258. (SETQ PT5 (POLAR PT4 NPI (* 5 TL)))
    # l  V9 r' `4 S4 Y" d
  2259. (SETQ PT6 (POLAR PT2 NPI  TL))# Q. A7 H& A9 _( T' o* V
  2260. (SETQ PT7 (POLAR PT6 0 (+ (* 3.7 TL) DX)))5 Q" i( T( T% g) w
  2261. (SETQ PT8 (POLAR PT6 NPI (* 1 TL)))
    $ p9 K9 ~/ p" }
  2262. (SETQ PT8 (POLAR PT8 0 (* 2.5 TL)))
    ; C: L3 Y5 q2 J
  2263. (SETQ PT9 (POLAR PT1 pi (* 2 TL))); o( v. f, i5 n+ |3 l
  2264. (SETQ PT10 (POLAR PT1 0 (* 2 TL)))" @) U* w. k4 r/ v/ ^( V, n" `6 N# ]
  2265. (COMMAND "COLOR" "7" "")
    # P3 [) z  k6 c2 w3 k5 B
  2266. (COMMAND "STYLE" "COTES"  "Verdana" "" "" "" "" "")# B3 j. s+ C+ J$ w
  2267. (IF (= RSIZE 0)(COMMAND "TEXT" PT8 TSIZE 0 tX) (COMMAND "TEXT" PT8 0 TX))* X" s  U  S" V4 I3 ^5 `$ p) d; c# t
  2268. (COMMAND "COLOR" "BYLAYER" "")$ m8 s8 @. D0 k9 Q  R+ u. `# w' T
  2269. (COMMAND "SOLID" PT1 PT2 PT4 "" "" "pLINE"  PT1 pt3 pt2  "")
    ! F5 b: v# K' J, J/ r- `, T% ^2 B
  2270. (COMMAND "COLOR" "BYLAYER" "")0 V' M/ s, M1 V) c, v
  2271. (COMMAND "pLINE" PT1 PT5 "" "pLINE" PT6 PT7 "" "pLINE" pt9 pt10"")% o6 \8 ]& G. P5 `0 x- ?) e2 n
  2272. (SETVAR "CLAYER" "0")- f# ^" [+ n- F5 G
  2273. (command "ddedit" pause)
    $ ^% r9 w7 O0 F; r9 d
  2274. (COMMAND "COLOR" "BYLAYER" "")' \# q' U7 g! O4 t, M$ s% ?
  2275. (SETVAR "CMDECHO" CMD): ~+ |; K1 M6 V, D1 g- |
  2276. (SETVAR "CLAYER" NBC)
    . G& ^$ P. C5 k$ m( |: Z
  2277. (SETVAR "OSMODE" OSM)' \7 V4 j- y# D3 Q7 z
  2278. (PRINC)
    : K7 n2 F2 n7 @5 l) W, J
  2279. )
    , |$ n/ o! M- r0 ]4 `- V! o: F
  2280.   M- o# h7 e% J( z- {# z3 P8 N8 Y
  2281. ;;; =========================== VE NET CAT CHEO (GC) =============================& L% F2 E' k; T2 [( ^4 N
  2282. % i. z& B+ z% a8 k% t! J' K
  2283. (Defun c:G1(/ p1 p2 p3 p4 p5 p6 p11 p12 l ang)
    7 G0 i! M7 y9 E5 b
  2284.         (setq x (getvar "osmode"))! p% V- C0 b" a' i2 Q
  2285.         (setq p1 (getpoint "First point : ")0 _2 d# g" R7 o3 J8 v5 c4 C( {1 u( n
  2286.               p2 (getpoint p1 "Second point : "))
    7 u% ~/ |% s5 e6 N& v
  2287.         (setq l (distance p1 p2))
    ' U: W" ?" K# p1 G7 _6 u7 X& N
  2288.         (setq p11 (polar p1 (angle p2 p1) (/ l 5))- E7 Y) ?, r7 P) y
  2289.               p12 (polar p2 (angle p1 p2) (/ l 5)))
    : V% J! E. k$ \
  2290.         (setq ang (angle p1 p2))
    0 r& s( Y7 T, f4 o- `; T5 S8 s
  2291.         (setq p3 (polar p1 ang (/ l 2.5))
    % l7 F: X0 s6 ^
  2292.               p4 (polar p3 (+ (/ pi 2) ang) (/ l 5))
    3 q, K6 l+ w' i5 J+ l7 a# [
  2293.               p5 (polar p3 ang (/ l 5)); c, e! I0 o6 k; O, n3 t0 Q- I0 Q
  2294.                 p6 (polar p5 (- ang (/ pi 2)) (/ l 5)))
    . L! X, F0 f% K( n: ?% O  [
  2295.         (setvar "osmode" 0)
    6 n* p( l: i2 @5 I5 R! j
  2296. (command "pline" p11 p3 p4 p6 p5 p12 "")3 n3 a5 `# e% \
  2297. (setvar "osmode" x)" U% u& q- ~- z: p
  2298. )
    + ^( a& _7 u: p+ A3 B; O
  2299. ;----------------------------------------------------------------------------------
    & L) v' C/ {- o( L3 h6 D
  2300. (Defun C:G2 (/  ps1  ps2  pf1  pf2  pf3  pf4  pf5  pf65 H  F, ~7 A8 k2 D3 B6 B  u# x
  2301.    pf7  pf8  sb   sh   se   ang  old_osmode);   (setq old_osmode (getvar "OSMODE"))' K' v# A+ G6 o2 w& t0 ?
  2302.    (setq ps1 (getpoint "\Chon diem thu nhat: "))/ J# K' m3 a! K: W  K1 N
  2303.    (setq ps2 (getpoint ps1 "\nChon diem tiep theo: "))' ^1 W& ]7 l( J2 j  H: p
  2304.    (setq sb 50.0 sh 200.0 se 20.0)) e1 Z; _( @" V) f* J% _& B
  2305.    (setq ang (angle ps1 ps2))
    % k2 @, ]  g! F* a, V6 ~( [. j, T: _
  2306.    (setq pf1 (polar ps1 ang (- 0.0 se)))* ~( F6 W6 f2 X1 y
  2307.    (setq pf2 (polar ps1 ang (/ (- (distance ps1 ps2) sb) 2.0) ))
    8 }( w8 r# S& ^; ?
  2308.    (setq pf3 (polar pf2 (+ ang (/ pi 2)) (/ sh 2.0)))
    0 q2 ^/ A7 q& {, G3 \* f
  2309.    (setq pf5 (polar pf2 ang sb))% ]8 n! G* a+ f5 q0 ]9 [+ `7 f3 u$ H
  2310.    (setq pf4 (polar pf5 (- ang (/ pi 2)) (/ sh 2.0)))0 s: T7 |4 N% t( E) l( ]. C: P
  2311.    (setq pf6 (polar ps2 ang se))* C9 k# _# q; J
  2312.    (setvar "OSMODE" 0)4 n! B( R) h  _& |/ J
  2313.    (setvar "BLIPMODE" 0)
    8 }  B% G  b4 k2 n: l
  2314.    (command "PLINE" pf1 pf2 pf3 pf4 pf5 pf6 "")# u# N3 T1 m9 ?3 o
  2315.    (setvar "OSMODE" 703)' p  h2 L9 s( g, ^, E
  2316.    (princ) )
    - n. s5 b+ Q- A' u' b* L
  2317. ;----------------------------------------------------------------------------------
    ( e% y2 \% t& P% F* r8 r# z) C$ P
  2318. (Defun C:G3 (/  ps1  ps2  pf1  pf2  pf3  pf4  pf5  pf6. K; F8 J$ R6 H7 Q, a
  2319.    pf7  pf8  sb   sh   se   ang  old_osmode);   (setq old_osmode (getvar "OSMODE"))
    ) _* x( G  T2 b4 T% z' v
  2320.    (setq ps1 (getpoint "\Chon diem thu nhat: "))5 B$ \, d- ~2 I& F4 B  C+ j
  2321.    (setq ps2 (getpoint ps1 "\nChon diem tiep theo: "))
    5 [- {2 E. |, u
  2322.    (setq sb 100.0 sh 150.0 se 20.0)- o; [$ v9 g$ L' |( T- f- ~
  2323.    (setq ang (angle ps1 ps2))$ h9 e8 f8 `" z9 y! k9 n. f
  2324.    (setq pf1 (polar ps1 ang (- 0.0 se)))
    $ F! I% b9 H- J+ Z% T
  2325.    (setq pf2 (polar ps1 ang (/ (- (distance ps1 ps2) sb) 2.0) ))
      S: F  T3 d8 v# x6 v  z  j1 p9 ~
  2326.    (setq pf3 (polar pf2 (+ ang (/ pi 2)) (/ sh 2.0)))
    4 w5 x  F/ O; `5 v1 q) J) y
  2327.    (setq pf5 (polar pf2 ang sb))
    ( t8 |* _. G- F7 ^) @1 J
  2328.    (setq pf4 (polar pf5 (- ang (/ pi 2)) (/ sh 2.0))); K8 {' z$ m, v% [$ E. ~
  2329.    (setq pf6 (polar ps2 ang se))
    9 H( Z( x- a# K
  2330.    (setvar "OSMODE" 0)# {1 ~" k/ X8 s& @+ ?8 }
  2331.    (setvar "BLIPMODE" 0). _" b7 R! t' V! ?5 n# C
  2332.    (command "PLINE" pf1 pf2 pf3 pf4 pf5 pf6 "")( i! V) V2 ?3 s: L
  2333.    (setvar "OSMODE" 703)$ \, [5 Z" ~  g5 Z. E+ q1 M1 P
  2334.    (princ) )' {6 w! P0 R& B, u$ S1 v
  2335. ;----------------------------------------------------------------------------------
    6 C3 `, f* A9 b
  2336. (Defun C:G4 (/  ps1  ps2  pf1  pf2  pf3  pf4  pf5  pf6
    % E$ Q( T& X3 o
  2337.    pf7  pf8  sb   sh   se   ang  old_osmode);   (setq old_osmode (getvar "OSMODE"))- _2 d9 a7 ]" X% }* e
  2338.    (setq ps1 (getpoint "\Chon diem thu nhat: "))
    1 N( s8 \' O6 \8 g
  2339.    (setq ps2 (getpoint ps1 "\nChon diem tiep theo: "))
    % b3 o( P8 P1 b( s  @" {9 @& g
  2340.    (setq sb 100.0 sh 250.0 se 20.0)
    7 O# ~' T/ F" T/ f
  2341.    (setq ang (angle ps1 ps2))* i6 B) ~7 p9 ~( D7 F
  2342.    (setq pf1 (polar ps1 ang (- 0.0 se)))5 a$ L3 H; M- d: U5 ^
  2343.    (setq pf2 (polar ps1 ang (/ (- (distance ps1 ps2) sb) 2.0) ))
    - [  u3 }( l& @0 z- x& ]5 S
  2344.    (setq pf3 (polar pf2 (+ ang (/ pi 2)) (/ sh 2.0))); Z6 a& s7 N: B6 n4 u% ^% N% G
  2345.    (setq pf5 (polar pf2 ang sb))
    # b8 d7 F8 Q& a; c
  2346.    (setq pf4 (polar pf5 (- ang (/ pi 2)) (/ sh 2.0)))  m% j" \" ?$ Y
  2347.    (setq pf6 (polar ps2 ang se))6 g+ _* Y+ `: h- z, @* Z; ?# ]
  2348.    (setvar "OSMODE" 0)
    , }  x! O% a) X1 d+ n
  2349.    (setvar "BLIPMODE" 0)8 j$ Y* Y, R" t+ ?9 `- S* O  ?* ^
  2350.    (command "PLINE" pf1 pf2 pf3 pf4 pf5 pf6 "")
    ' t2 Q( H. E3 b
  2351.    (setvar "OSMODE" 703)1 x% O3 H/ M! ]- c7 y
  2352.    (princ) )
    3 T4 P' z9 b. U

  2353.   S* G1 f9 J6 C$ t2 g
  2354. ;==================================================================================+ B$ J' _7 \' K( X
  2355. (defun c:ang (/ ent pt1 pt2 ang)
      [3 @5 N2 n$ C( S' G. n( R3 y
  2356.    (setq cmd (getvar "cmdecho"))6 x- E3 w; g' ~* p# r8 v# b. G
  2357.   (setvar "cmdecho" 1), J2 `' a( G) ?$ v
  2358.   (prompt (strcat"\nThay doi truc toa do theo duong thang chon truoc"))
    , w( N7 N2 G# ~
  2359.   (setq ent (entsel "\nChon duong thang:"))
    " h$ u4 P" z/ H
  2360.   (if ent " y; k8 [) P- w0 M6 H$ Q, t0 T
  2361.    (progn
    ! f* Z/ r# |% y  @5 {! L
  2362.     (setq ent (entget (car ent)))
    2 [. ~6 v3 l& e8 P$ i
  2363.     (setq pt1 (cdr (assoc 10 ent)))
    ! s' |0 D- b: q4 `& T" G& G& K: i' r
  2364.     (setq pt2 (cdr (assoc 11 ent)))6 s) `5 u* I' _+ Z
  2365.     (setq ang (angle pt1 pt2))$ l# ^2 g3 B& R8 T5 u
  2366.     (setq ang (/ (* ang 180.0) pi))6 n2 R  v" E8 a( @
  2367.     (setvar "cmdecho" 0)" f  a) ^5 Q1 g; G0 [9 K, `* x
  2368.     (command "setvar" "snapang" ang)8 A" H+ l. e' N! u7 I- T) j3 [2 C' c
  2369.     (princ "\nGoc cua truc toa do moi : ")
    4 n& U  j0 N" X/ F- U
  2370.     (princ ang)8 x# @( M) d  b/ X% p/ ?5 l0 C
  2371.    )
    5 l1 }1 \! ~3 d) a) E% Y
  2372.   )
    ) K; x& |2 s5 O+ w% I: _+ ~
  2373.   (setvar "cmdecho" cmd)
    8 i  L+ z4 `& X- N' {9 n) p
  2374.   (princ)7 E; m: N' C6 E' U
  2375. )
    " `: h$ d+ g% S) n" X& P  E0 Z% |
  2376. ;==================================================================================
    - J. z4 x" \+ }2 f
  2377. ;==============================   KY HIEU DOI XUNG   ==============================
    8 u2 R- X4 Z, U: C
  2378. ;==================================================================================
    . o  u* g0 I) P7 M3 R7 @
  2379. ! V! N2 a6 J  c: O. B" R
  2380. (DEFUN C:DX (/ CMD OSM OLDERR PT1 PT2 PT3 PT4 PT5 PT6 PT7 PT8 PT9! A# r1 U8 T9 Q1 N! C+ W
  2381.                 SZ G45 G135 G90 G180 SS loi)
    9 }: e2 m! a1 o! S
  2382. (defun loi (s)' X' q9 f% _, o7 S8 F% a
  2383. (if (= s "Function cancelled")
    # |- K% {9 g. g& [$ G- `! {# z
  2384.      (princ)
    ; [+ G3 h2 x" z, y
  2385.      (princ (strcat "Error:" s))
    % W& R, o/ j# q, ^( I
  2386. )  r/ U$ U+ a: k
  2387.          (SETVAR "CMDECHO" CMD)
    1 B8 M; v0 g- k
  2388.          (SETVAR "OSMODE" OSM)2 V6 _) U% g3 _  o% c$ f
  2389.         (SETQ *error* OLDERR)
    " \% f& C1 Z5 _; z
  2390.          (PRINC)6 D( \6 V6 Z+ n
  2391. )
    ' X, p- f3 ~$ ~
  2392. (SETQ CMD (GETVAR "CMDECHO"))
    . n- ]8 A1 x, b5 A/ R
  2393. (SETQ OSM (GETVAR "OSMODE"))
    ; L0 T6 y8 r4 Y* Q) Z- [* G
  2394. (SETVAR "CMDECHO" 0)
    " W/ n( X' }) d2 T6 B
  2395. (SETQ OLDERR *error*
    % y7 X) d7 d5 R* A4 a
  2396.         *error* loi): O2 o1 W  C6 \% C' }9 i- |* i
  2397. (SETQ SZ (GETREAL "Size <1>:")); y) c( g# w; i
  2398. (IF (= SZ nil) (SETQ SZ 100))
      A5 g1 z8 y- G& G9 E0 F% D
  2399. (SETQ G45 (/ PI 4))
    3 D0 I8 S0 C+ ]) I- o9 v
  2400. (SETQ G135 (* 3 (/ PI 4)))
    1 g1 k9 a. ]8 H( C1 n# }" Y; ]
  2401. (SETQ G90 (- G45 (/ PI 2)))5 x4 t$ s) _' Y( Q5 o
  2402. (SETQ G180 (+ G135 (/ PI 2)))
    / w9 j7 A: @% t$ N+ z
  2403. (SETQ PT1 (GETPOINT "\nDiem doi xung:"))
    " V+ e6 O! q. q
  2404. (SETVAR "OSMODE" 0)
    2 \+ E" D% N7 G% |% F
  2405. (SETQ PT2 (POLAR PT1 G45 (* 2 SZ)))
    ' t# _1 ^9 _0 W+ _3 X# B# w( C" l
  2406. (SETQ PT3 (POLAR PT2 G90 (* 2 SZ)))+ y- y- @4 i( _$ `& t  d
  2407. (SETQ PT4 (POLAR PT1 G45 (* 1 SZ)))5 h# Y! P; n0 o8 o. ]
  2408. (SETQ PT5 (POLAR PT1 G135 (* 2 SZ)))
    , x% A1 c! j" N( W% M
  2409. (SETQ PT6 (POLAR PT5 G180 (* 2 SZ)))) |0 U. ?5 L. b9 C2 G% ?
  2410. (SETQ PT7 (POLAR PT1 G135 (* 1 SZ)))
      ?2 R0 o: f$ N2 [( k- g+ U  {
  2411. (SETQ PT8 (POLAR PT1 G45 (* -0.7 SZ))). t3 K$ X/ E: j! G% t
  2412. (SETQ PT9 (POLAR PT1 G135 (* -0.7 SZ)))  ~4 n% A2 F+ |/ R8 _2 q8 Y
  2413. (PRINC "\nGoc quay:")
    9 x/ E* O1 m7 w7 O2 X0 u
  2414. (SETQ SS (SSADD))0 w2 r8 V6 R; S+ D4 U
  2415. (command "layer" "m" "Dim" "c" "" """")
    # p; w# G/ s% u5 m( b3 o
  2416. (COMMAND "COLOR" "1" "")
    % K% u: f7 O) c9 ?# t7 E
  2417. (COMMAND "LINE" PT8 PT2 "")/ W2 ~/ j8 z9 E
  2418. (SETQ SS (SSADD (ENTLAST) SS))
    / u4 q! v/ [8 |# n* g' @
  2419. (COMMAND "LINE" PT9 PT5 "")
    ! Q% N, q& H) P3 E1 ]$ \/ Q  q% Z
  2420. (SETQ SS (SSADD (ENTLAST) SS))
    7 ^' O$ t7 G% j
  2421. (COMMAND "COLOR" "1" "")
      B9 N9 Y  y# \4 }  k4 D
  2422. (COMMAND "SOLID" PT2 PT3 PT4 "" "")6 i6 y/ O+ @( I) T; N
  2423. (SETQ SS (SSADD (ENTLAST) SS))/ ]" ^. {. i) Q/ O/ e$ e5 i' x; P
  2424. (COMMAND "SOLID" PT5 PT6 PT7 "" "")6 Z0 J; c1 \/ y5 S: _- ^
  2425. (SETQ SS (SSADD (ENTLAST) SS))! N+ x6 q" _, h( h
  2426. (COMMAND "ROTATE" SS "" PT1 PAUSE)+ G6 U8 w) v4 C( t$ G, ^
  2427. (COMMAND "COLOR" "BYLAYER" "")2 Y  W+ y  `% ^( F3 M
  2428. (SETVAR "CMDECHO" CMD)4 R4 ~+ o: o4 |( a. B# A
  2429. (SETVAR "OSMODE" OSM)/ E; O1 l- Y. L: F) \6 Z
  2430. (SETQ *error* OLDERR)
    ' {/ F. G% A/ z) m& i
  2431. (PRINC)
    % F( |  R  w5 \( I1 ]
  2432. )
    0 X( j3 t" L- ]. `

  2433. ' ]  r3 B+ z1 ], O
  2434. ;==================================================================================9 u7 z3 a) \  T! u% w9 @7 T) @
  2435. ;=================================   KY HIEU TRUC   ===============================
    / n4 j, Z$ \$ A
  2436. ;==================================================================================8 z1 c4 D. X3 @+ @/ m4 J9 |

  2437. 3 p: J% y/ V# s4 M) w4 x0 u/ }; S
  2438. (defun C:vetruc ()! E* f5 |1 E2 Z  A1 ~  T. K
  2439. (setq bk (getvar "USERR3"))! Y% d! m# d8 j8 }/ s
  2440. (if (= bk 0)( _' h* J. g8 ]
  2441.   (progn' n* S( i3 f, k
  2442.     (setq cont "1")
    " i' j% ~8 y5 D) F
  2443.     (setvar "USERR3" 1)
    5 c& C! `! l% q3 f6 I9 A
  2444.     )
    # f& I# l$ d2 H. g) t3 I7 Z7 E& {
  2445.         (setq cont (rtos bk))
    ; F" F; m$ s$ _# U8 ^0 A/ Q* R
  2446. )
    9 f8 Z: ]6 j* C! p1 u* p
  2447. (setq pt1 (getpoint "\n Nhap diem dat:"))
    / Q9 b0 }9 u3 L+ S- J' p
  2448. (command "layer" "m" "Dim" "c" "" """")4 h0 e% s9 }1 l# x; A$ O
  2449. (command "osnap"  ""); M" h. [& V) n  M  g
  2450. (COMMAND "COLOR" "7" "")
    " p* O/ [* k( f3 }  x) ^
  2451. (command "circle" pt1 150 ""); t7 P# u& R; k. X
  2452. (setq pt2 (polar pt1 0 150))
    6 k* x1 @9 u% ^# T
  2453. (setq pt3 (polar pt1 (/ pi 1) 150))9 Z: v/ A$ C1 b4 m
  2454. (setq pt4 (polar pt1 0 300))4 p: T, C5 }0 M  ]0 b
  2455. (setq pt5 (polar pt1 (/ pi 1) 300))1 B& B- k8 F$ I% Z. ]1 A
  2456. (setq pt6 (polar pt1 (- 0 (/ pi 2)) 150))
    9 `. [, y2 |+ S- S7 X- ~
  2457. (setq pt7 (polar pt1 (- 0 (/ pi 2)) 300))
    : k: _0 a+ R: n. T  K7 Y, q% M" T
  2458. (setq pt8 (polar pt1 (/ pi 2) 150))
    5 O( }& A. f3 W( {
  2459. (setq pt9 (polar pt1 (/ pi 2) 300))
    ( q$ h9 ?3 s# t9 e  |: y: l: ?. r
  2460. (setq pt10 (polar pt1 0 150))& T9 [8 W  b9 `! U1 F
  2461. (setq pt11 (polar pt1 (/ pi 4) 150))
    7 q+ w+ d; W3 r8 S) B3 J
  2462. (COMMAND "COLOR" "BYLAYER" "")
    + c9 y/ D( r% H4 {0 x/ H
  2463. (command "line" pt2 pt4 "")
    ! n$ P$ F$ c& u
  2464. (command "line" pt6 pt7 "")
    ! `9 [& j/ }2 t, D+ {# ?1 D. n& {% Y
  2465. (command "line" pt3 pt5 "")
    1 t; |3 O& ~4 P0 V
  2466. (command "line" pt8 pt9 "")
    4 S7 s: r* J8 D5 A( S; D
  2467. (setq dk (strcat "\n Size:<"cont">")): @7 D' i/ [% G- J. \: ?& l
  2468. (setq bk (getreal dk))6 c; v$ _4 `1 r( o" e) E! R& ?; K
  2469. (if (= bk nil)
    0 Q1 t4 T8 G- N! q8 P( S
  2470. (progn0 W6 X7 \; v; A0 N8 x# S
  2471.   (setq bk (getvar "USERR3"))9 \6 @' J, u9 s, P" l, ^8 c
  2472.         )
    1 [" {* ]% J1 ?  [; O9 m) w
  2473.   (setvar "USERR3" bk)& _3 Q1 F( Z) {. w
  2474.   )
    8 }$ h) |" U8 d% Z, j
  2475. (command "scale" pt4 pt5 pt7 pt9 pt11"" pt1 bk"")! z7 k3 e9 R0 B4 h9 U
  2476. (COMMAND "COLOR" "7" ""), h3 |+ O' O/ k/ Q. K" r
  2477. (COMMAND "STYLE" "Truc"  "impact" "" "" "" "" "")
    2 I/ t" t/ x; N0 F9 t7 @$ ~
  2478. (command "text" "j" "mc" pt1 (* 150 bk) pt10 "A" "") 5 s$ c' k' h" ~; {! ?
  2479. (COMMAND "COLOR" "BYLAYER" "")3 C: G) R0 Y  n4 }3 K3 o
  2480. )
    5 e* a. d3 E( r2 i$ j7 B

  2481. % f5 Y9 m* C: {1 `5 {1 e
  2482. ;=====================================================================$ F: V3 `# L! t! n7 _+ K) q- D: P
  2483. ;CA - Reverses the case of text.  (Upper to Lower and Lower to Upper.)
    ; `4 U% U5 a$ a
  2484. ;* j0 r5 Q8 [% D% m* k
  2485. ;Jeffery P Sanders: B4 F5 Z' E* n; f* {8 @
  2486. ;
    0 ?/ z- [. l# w9 j
  2487. (defun C:CA(/ en enlist tx newtx cnt tp asc note)
    : q8 i% L' J$ f. r! W
  2488. (setvar "cmdecho" 0)4 R+ k2 K( |5 x8 p
  2489. (if(setq en(entsel))6 `! Z' [9 A& ?7 z3 _. g; d
  2490.    (progn
    + x+ K0 \0 w0 b0 T9 K3 ~
  2491.       (setq enlist(entget(car en)))
    5 A% Y2 h; \3 }
  2492.       (if(= "TEXT"(cdr(assoc 0 enlist)))7 N1 R3 w9 S; V, G( w/ V- Q
  2493.         (progn7 `' P- E& U0 x- g( W
  2494.           (setq tx(cdr(assoc 1 enlist))* ?- s) k* L3 i6 `& Q% ]% y
  2495.              newtx "" cnt(strlen tx)
    ' m6 ^" \: q' ~: c6 `( s
  2496.               note "\n...CASE Reversed. \n "
      v. z5 Q' Q3 f* |" i" Y1 U
  2497.           )7 n0 M+ V4 k: W; A2 H, t
  2498.           (while (> cnt 0)
    * a" N8 E; _  d# Y  K
  2499.              (setq tp(substr tx cnt 1)). i: j3 J- x) f. U1 @2 I0 ?( P- [
  2500.              (setq asc(ascii tp))' [5 ]9 `7 ^# {2 p. U
  2501.              (if (> asc 96)# C9 C" g: [! y# I/ b6 r& {7 z
  2502.                (setq tp(strcase tp))- ^  F3 t+ m) P( m/ z
  2503.                (setq tp(strcase tp T))4 B) [; T# a; y% l& a
  2504.              )
      r; ?4 R# Q' z- U: q& t3 @
  2505.              (setq newtx(strcat tp newtx))+ ~! T6 I3 K/ d/ O4 V' C; H
  2506.              (setq cnt(- cnt 1))( J! L3 \: U& I# a& a/ {
  2507.           ). }6 v9 C9 i, V  P$ h- y' ~
  2508.           (setq enlist(subst(cons 1 newtx)(assoc 1 enlist)enlist))- i% \* R, o( b
  2509.           (entmod enlist)
    2 ]; A# {- O+ i0 V. n
  2510.         )3 ?! o( @4 u4 \" u- R3 i
  2511.         (setq note "\n....Text Only Please. \n ")# {- }' e/ t- E; y
  2512.       )  U0 B: t4 b9 ?
  2513.    )
    9 Q# x  c" q3 O
  2514.    (setq note "\n....Nothing Selected. \n ")2 `! W+ C6 c. B/ l. h0 w0 x2 i8 t: g
  2515.   )+ q0 R& |! F1 _$ ]
  2516.   (setvar "cmdecho" 1)" E: p8 _# s, D( L  v8 l* Q
  2517.   (princ note)- M5 o' x8 o/ t, _, ]1 I
  2518.   (princ)5 L6 v8 {0 a; h. M8 ]
  2519. )
    $ Y& C, e2 B6 n2 Y6 v: t# C0 x! V& [

  2520. 3 L$ r" M- w* q5 q5 m
  2521. ;=====================================================================
    7 i0 `. R5 J8 o9 c1 B
  2522. ;==================== NEW TEXT STYLE UPDATE ==========================4 }. S0 C5 o6 C( Y/ S
  2523. ;=====================================================================
    ( P& K/ q$ N2 {  n; {9 a5 \* n# h
  2524. % D; |: e& K( Q6 D% D% S: `$ E
  2525. (defun c:nS (/ tdt ssdt sodt index)8 I, k1 z: _7 [! [/ j/ |( w
  2526. (defun ObjName (ssdt /)9 ?, U2 B# a- O6 K4 m& |
  2527. (cdr (assoc '0 (entget ssdt)))- {5 D! T' L! f' ]% C4 F# d& t
  2528. )8 z6 k& k+ C4 a% h: L( Q5 H7 e
  2529. (defun MoPL (ssdt /)- Y0 k5 D0 A+ n: s7 @
  2530. (= (cdr (assoc '70 (entget ssdt))) 0)6 [  T- l- E- c$ B
  2531. )
    9 w% [/ M, w5 }/ A
  2532. (defun NoiPL (ssdt /)" f% X+ N/ v: B9 \8 x8 l
  2533. (if (MoPL ssdt)
    9 [/ x& G0 |0 u  \) Z+ ^
  2534. (command ".PEDIT" ssdt "J" "All" "" "X")
    9 y1 ?* w' w3 B7 j+ ?! Q
  2535. ); ?% D) K- J3 G
  2536. )
    * E  e: s- @/ z: G1 N$ p' [4 \. ^
  2537. (defun NoiLC (ssdt /), z5 j: h& s7 ?. z+ p
  2538. (command ".PEDIT" ssdt "Y" "J" "All" "" "X")
    9 n0 V$ T% \* b
  2539. )
    & h# T7 {/ O% C/ h& h9 L0 G
  2540. (setq0 R7 O, O1 h6 F# P2 [1 Z
  2541. tdt (ssget)
    ! v: I* g% J8 S
  2542. sodt (sslength tdt)
    9 F" y6 u/ \5 o! C
  2543. index 0
    3 P: b" w' ?4 S% u6 B" X
  2544. ): y$ n% Y- r0 E$ t9 [
  2545. (repeat sodt
    ( j8 g) [  F$ |( l" ]3 c# a3 u0 A
  2546. (setq% e  a4 q. l" @' X
  2547. ssdt (ssname tdt index)& K0 s1 `5 B0 X  X: W) Q: W* F3 g
  2548. index (1+ index)
    & y  v6 u/ H. L( d( c3 ~8 Q3 f6 Y
  2549. )
    ! [+ Q- x* p/ V+ m7 v$ f. ~
  2550. (if (or (= (Objname ssdt) "LWPOLYLINE")
    % B  d& I- t* V" I' L( c
  2551. (= (Objname ssdt) "POLYLINE")1 n1 u% N. A; ?7 j( _4 B6 y0 C8 w
  2552. )
    ! v5 u9 s, c9 G% T8 m* E
  2553. (NoiPL ssdt)4 b: t- z! X5 Q* W6 \' v
  2554. )5 Y6 M" D8 L9 `7 Y9 j0 s* f
  2555. (if (or (= (Objname ssdt) "LINE") (= (Objname ssdt) "ARC"))  M- j( O9 O1 S" b
  2556. (NoiLC ssdt)
    ; S4 e+ g: {! F: c+ y! U% w
  2557. )- [8 s+ R; R! Z" L; _. ~0 g
  2558. )7 B, E7 G3 R: ~2 m0 y
  2559. (princ)
    : n7 v4 U2 J7 [' T
  2560. )1 Z4 G' x" V  E
  2561.   S6 s" I# Q: b- f* Q+ _
  2562. ;=====================================================================6 A0 [7 Q/ {3 I5 W% F2 S
  2563. ;;; AREAM.LSP
    * T% @9 N3 @6 S4 k
  2564. ;;; Function: Calculates the total area of selected objects- N" A% k" U# Z3 Y9 d4 A, ]
  2565. ;;; By Jimmy Bergmark
    5 v1 p- @  P' O5 z3 ~; b
  2566. ;;; Copyright (C) 1997-2006 JTB World, All Rights Reserved
      x9 b, h. I- O: W7 {
  2567. ;;; Tested on AutoCAD 2000- T; Z; Z8 W" ?$ p
  2568. $ k2 M* g8 J7 v! i, k
  2569. (defun c:ea (/ olderr oldcmdecho errexit undox restore ss1 nr en tot_area)
    1 s, m4 s7 Z$ Q7 Q3 O' z' s
  2570.   (defun errexit (s)  n, u, D+ z  H* V
  2571.     (restore)
    & t  I& X+ K6 i4 h& p
  2572.   )$ P: g; D4 t7 _2 U3 B

  2573. ) I% S  z1 q/ I) J- ^0 l" @5 j
  2574.   (defun undox ()2 \5 K9 g8 [/ F; e0 {
  2575.     (command "._undo" "_E")
    : o5 X+ O. I2 t1 x8 m+ P
  2576.     (setvar "cmdecho" oldcmdecho)2 ~1 \! o1 W& Y& F' k9 X, ]3 @
  2577.     (setq *error* olderr)' p0 Z5 V* s* t9 v; c- }
  2578.     (princ)$ w( O" b( Q2 r
  2579.   )0 r: y# n* s2 l6 M

  2580. : S( T6 k0 A, Z4 i( v
  2581.   (setq olderr  *error*
    ) `  g0 p% c6 h0 m8 @, w* u
  2582.         restore undox
    / Q5 X2 k/ D1 i6 \# D
  2583.         *error* errexit. x2 b( N1 M/ a# d" [" V
  2584.   )
    ) J" Z6 N, k: L0 Z6 ?* D$ ?( I
  2585.   (setq oldcmdecho (getvar "cmdecho"))7 G* o' a3 v+ Y
  2586.   (setvar "cmdecho" 0)
    * I( H& R- B! B
  2587.   (command "._UNDO" "_BE")
    & w, H: A8 y3 I( p; {- B
  2588.   (if (setq ss1 (ssget '((-4 . "<OR")9 `* w" ?8 j: z5 m6 _8 G4 m
  2589.                          (0 . "POLYLINE")$ l, [2 _7 O- j4 ^3 X
  2590.                          (0 . "LWPOLYLINE")" G; w0 d2 V% @9 {
  2591.                          (0 . "CIRCLE")( v& T( i9 P7 h- ?2 V
  2592.                          (0 . "ELLIPSE")- C2 G- ?6 H( @  s, I2 S! E
  2593.                          (0 . "SPLINE")* ]: Z6 Z; O0 f3 E& j
  2594.                          (0 . "REGION")
    ; S8 ]% c; B' r2 F% P& n
  2595.                          (-4 . "OR>")
    3 w9 w; S- i8 X: U1 X
  2596.                         )
    3 B4 L7 {$ R7 Q
  2597.                 )
    ! A. V5 s) i. r) P/ F
  2598.       )+ ]( U+ _# {. w
  2599.     (progn+ C+ u; S* U- a+ a' U/ j
  2600.       (setq nr 0)# Q- f2 O2 d% l: e2 Y. k& o: g+ S
  2601.       (setq tot_area 0.0)4 [8 U; n: Z3 U3 Y; o" Q8 ?
  2602.       (setq en (ssname ss1 nr))
    , h9 k3 E' k* O) z2 Q
  2603.       (while en
    ! M1 ?' J9 w! a5 @( v
  2604.         (command "._area" "_O" en): ?/ Z3 B+ F. ~, h) Z) q6 z
  2605.         (setq tot_area (+ tot_area (getvar "area")))
    6 u1 \0 Z* y7 d: |4 {8 d! J; w
  2606.         (setq nr (1+ nr))
    2 _4 o, V9 k: s3 a( ]# K
  2607.         (setq en (ssname ss1 nr))
    9 f0 Y; p) e- r7 `- o) Q
  2608.       )1 d. f3 i6 o  R$ w; B' g; h4 }
  2609.       (princ "\nTotal Area = ")
    ( _9 P$ q1 B' J
  2610.       (princ tot_area)
    9 o, z6 g# H/ a
  2611.     )" s/ m, n( e1 u% U
  2612.   )
    , M: b% i3 o- Y2 D; f
  2613.   (restore)
    6 ]1 z* C3 l' n& m+ {. z
  2614. )
    5 @5 F( S/ u0 F3 s- c/ ^! @3 o# c
  2615. 2 o. f/ E- w- q: ]: @. P
  2616. ;=====================================================================' r* ~. j7 @, z& g  q& K$ V) J( W
  2617. ;;; By Jimmy Bergmark
    2 F( V) N" ?8 p; S  P- {
  2618. ;;; Copyright (C) 2008 JTB World, All Rights Reserved: X* J2 \% O7 _! ~* l3 h
  2619. ;;;) n# c# F: y8 r9 O& K- R! v
  2620. ;;; Created: 2008-03-31
    7 J* w" m2 }) P, r
  2621. ;;;
    9 {! X5 i& |) J4 d3 l# l
  2622. ;;; Convert Attribute definitions to mtext
    : K$ m* @8 w% i& F3 Z
  2623. ;;;
    - Z5 H6 S! n3 O! X& p

  2624.   H' I: d5 J& [; D2 Q8 `
  2625. (defun c:ATB (/ eset1 blkcnt en enlist tag1 ht pnt vl space)
      V6 p3 }. g' E: l' ?9 ~$ o. _
  2626.   (setq        eset1  (ssget (list (cons 0 "ATTDEF"))). I/ Z$ H2 p# Q. E
  2627.         blkcnt 0
    ; @+ e$ g" ~, o
  2628.   ): _" B8 D7 ?; l3 R) }! L+ x4 {% t1 T

  2629. 1 m" E- H& ^# j8 f9 `0 k5 z9 T
  2630.   (if eset1
    3 W+ g7 B2 r* k, q/ S3 |, P
  2631.     (while (<= blkcnt (- (sslength eset1) 1))
    8 Q: F' I, D9 F' J. J- ~) d
  2632.       (setq en           (ssname eset1 blkcnt)
    3 a9 v; T( f) \0 c9 o+ _
  2633.             enlist (entget en)
    * z4 \! C) G) I0 P0 ?
  2634.             ht           (cdr (assoc 40 enlist))2 O+ K2 }% F" @4 z4 E' A# V
  2635.             pnt           (assoc 10 enlist)
    # U5 a8 A& ]" a2 @
  2636.             pnt           (subst (+ ht (caddr pnt)) (caddr pnt) pnt)
    ' R9 b/ O: X7 J0 u' D) w! Q
  2637.             space  (cdr (assoc 67 enlist))2 [4 I1 S' ?$ N
  2638.       )
    5 K# ^/ L- F; a% P
  2639.       (setq vl (list1 x+ u7 X# H' Y9 x( L+ m
  2640.                  (cons 0 "MTEXT")0 h- ]- F5 t0 q2 [0 @! l5 }- v
  2641.                  (cons 100 "AcDbEntity")* |: j, ^) y6 ]9 L! M
  2642.                  (cons 100 "AcDbMText")
    ) Z1 l! k# R/ n3 j% G- i
  2643.                  (assoc 7 enlist)7 w9 |: q8 P# D$ V
  2644.                  (assoc 8 enlist), B' S$ S# f" n. x2 V  E3 s. ]
  2645.                  pnt
    , q4 z. y: p. R  [3 b( @
  2646.                  (assoc 40 enlist)
    & G( p$ ]' L% z5 E3 z
  2647.                  (cond ((assoc 62 enlist))
    . h) d! R, m: Z
  2648.                        ((cons 62 256))* j& P8 [( o2 W0 [: H& q4 ]! o2 |
  2649.                  )
    : J. d$ F2 R4 S3 [, s
  2650.                  (cons 1 (cdr (assoc 2 enlist)))
    7 s3 _8 U" O$ K( Y! u
  2651.                  (if (= space nil)
    7 J* `& n# _7 }7 [/ j
  2652.                    (cons 67 0)* s, G8 T. {: Y4 s% W
  2653.                    (cons 67 space)
    5 G7 Z6 t6 k: _
  2654.                  )
    . ^1 j8 t) D8 ^4 s: |  b6 F5 X9 Y# U3 o
  2655.                )9 T) f8 a7 `; ]3 D0 W6 h: Q7 f! m& U
  2656.       )3 y" F* v+ n( ~' K5 }9 N
  2657.       (entdel en)  h8 H& o! l; \! m' b6 a3 C6 J
  2658.       (entmake vl)
    ' v6 V4 K- V1 a$ O: ~. G
  2659.       (setq blkcnt (1+ blkcnt))
    8 J( V- w) W) ~% s4 h1 i5 c, A3 z
  2660.     )
    / {5 f" l/ e% H& u( ?; I
  2661.   )
    + B3 Z7 E2 H! k/ Q/ L2 _8 `
  2662. )' i0 d! A- n) p. J/ D5 D
  2663. 5 V# V- g1 \# a7 T0 p5 d* Q
  2664. ;=====================================================================
    ' d0 C8 [; ]- w! N  a

  2665. ( P$ B8 s' a9 ]. q( ]. {; {. Q2 |
  2666. (defun c:xxx ( / cumdt dodai thoat dem ten doituong textxl dem goc toi)
    " F$ H9 G) g$ v, e- m
  2667. ; Khoi dau cua chuong trinh; f/ \2 X: l" u3 U7 E" K, k5 Y
  2668. (princ "\nCopy Inteligent...\n")5 s5 _6 M! e4 Q2 f
  2669. (setq         luuecho        (getvar        "cmdecho")" [3 m! R& d  M6 N1 T/ J  v6 I6 q
  2670.         luu        *error*
    ' z1 c' M8 h9 {0 Q! |( u
  2671.         *error*        ketthuc; A+ j4 y2 R6 A1 A, f
  2672.         cumdt         (ssget)* t0 p5 {; V: |; c
  2673.         dodai         (sslength cumdt)
    7 C2 p/ O- P8 n, X6 ~" K* u1 j  Z. X+ Y
  2674.         goc                (getpoint "\nSelect base point:")
    & G( d) Q1 t3 a' Z
  2675.         thoat                nil# B" h/ Z' O% X" j- c; l( h
  2676.         dem                0
    ( B! F# L4 r6 e9 W$ [3 l
  2677.         textxl                nil: b/ g0 b: s( Q7 L7 N! u  I# |
  2678. );
    0 w3 q9 B" D! S6 y0 t
  2679. (setvar "cmdecho" 0)
    ) t' |8 T* n8 @% a& t; p6 r  X! q! O
  2680. ; Loc ra duoc ong text de xu ly2 u  D! D" I7 u# L# m
  2681. (while        (and         (= thoat        nil)/ H2 j( z# g1 ?. W  ~0 t* n) J
  2682.                 (< dem        dodai)
    5 N3 a0 k- L: F1 N% G4 C
  2683.         ), \* a1 g1 U7 h0 w! [1 ?+ x+ L2 I
  2684.         (setq         ten        (ssname cumdt dem)
    ( _: E! ?2 r9 a  g# P- r! N
  2685.                 dem        (1+         dem)+ t5 o# f* F, U8 Z& ]) l+ w
  2686.                 doituong (entget ten)
    ! Y- Q+ _+ l3 S5 l3 A
  2687.                 kieu         (cdr (assoc         0        doituong))                        
    . A( Z  z9 W( d5 M4 A/ X6 G) B
  2688.         )
    6 e; g7 E& B* ]# C9 V6 D: ~
  2689.         ; _! G, Y$ S! _6 W! F' |0 x  |8 q
  2690.         (if (or (= kieu                "TEXT")" D( c6 @3 g4 ~- A, L
  2691.                 (= kieu         "MTEXT")        
    ( o" c" K0 U( t# `; v/ B1 l: v
  2692.                 )
    2 W% i% a* z' ]/ k5 Q
  2693.                 (setq         thoat        T
    $ |' f3 j  z& \/ m* r  W
  2694.                         textxl         (cdr (assoc 1 doituong))         
    # a& s- R- }# x$ }- I: L
  2695.                 )
    ( t3 x8 C: [5 s8 w- j; B) r. G. m8 q
  2696.         )2 u( T8 a2 G# w; a- e9 D
  2697. );% {5 e2 `, L+ z" H/ K: K- w
  2698. (while T
    7 N' M8 u7 V# E! U5 S
  2699. (setq        toi                (getpoint "\nSelect next point: " goc)
    1 _/ j4 p: v: ?: b* @$ ]0 s
  2700.         vitrilech         (list         (- (car toi) (car goc)) (- (nth 1 toi) (nth 1 goc)))7 M* p* l$ {- |' p) x4 G  M
  2701.         dem                0
    $ c0 j3 O2 l* u% N0 }0 C; S
  2702. )
    , E& G) }, Y) d4 y* o
  2703. (while        (< dem dodai)
    4 Y0 I( d0 \1 W' t3 x2 g, ~. Y
  2704.         (setq         ten        (ssname cumdt dem). x" _3 a8 \) D
  2705.                 dem        (1+         dem)) I- Z$ F$ o* {  b
  2706.                 doituong (entget ten)
    ! l3 ~' g. I( L3 \
  2707.                 kieu         (cdr (assoc         0        doituong))                        ) h7 v) t  l0 q/ @, }( R
  2708.         )
    ( n3 `! Z! F' f0 D

  2709. / y  S5 ]4 b0 u' X( n  L+ ?
  2710.         (if (or (= kieu                "TEXT")
    2 z  m; _9 i7 D. |8 {
  2711.                 (= kieu         "MTEXT")        
    - G4 ?( k6 P) ~7 D& w: E, i5 a8 Q
  2712.                 )* `& t8 W! Z2 \0 u( K1 G0 x; w( M& h8 {
  2713.                 (doitext        ten)( A" M. O& j  R
  2714.                 (copy_dt        ten)$ F* |' I: c% o0 f" J# P: u" K8 k

  2715. ( Z9 Y: S, o4 I
  2716.         );if
    ' t$ C: r3 D) h7 M
  2717. ). \9 Y9 E1 t( {6 l1 Z( {8 ?
  2718. );while" V) _6 i  ~5 ^8 V, B# d
  2719. (ketthuc)
    : ^6 _) s6 w/ R) q( P4 p; [' s
  2720. );defun
    4 D' R7 }! E, c0 y* N9 i
  2721. (princ)  S, `0 ^% `0 V$ j

  2722. $ U* _7 S. ~; k# i1 {3 t  r
  2723. ;=====================================================================
    5 W* [: X$ h1 K8 ]$ U
  2724. ;;; By Jimmy Bergmark# R7 R4 a8 h9 f
  2725. ;;; Copyright (C) 2008 JTB World, All Rights Reserved7 Q( e6 d, t* N7 P' C" ^2 Z
  2726. ;;;
    4 }* F. Z3 @$ w3 p& k
  2727. ;;; Created: 2008-03-31
    1 g1 p: ?4 J/ p$ R9 C" a
  2728. ;;;& x" v4 s! ^1 E8 R
  2729. ;;; Convert Attribute definitions to text( X( n3 X' H2 H
  2730. ;;;
    - O# @. S9 ?8 g! U) G
  2731. " i9 I" @( R9 |
  2732. (defun c:ATT (/ eset1 blkcnt en enlist vl space)
    5 |: f4 @, T' w% d4 N7 |6 r: c$ \
  2733.   (setq        eset1  (ssget (list (cons 0 "ATTDEF")))
    ; `2 L9 B. y1 G
  2734.         blkcnt 0: Y% D% E5 a, S$ J* X
  2735.   )
    : x1 C5 T6 I) z, f

  2736. . ?4 n  t, X- U4 `# ^5 Y
  2737.   (if eset1- z: n. o7 Q# N7 t1 Z! u+ ?" \
  2738.     (while (<= blkcnt (- (sslength eset1) 1))
    ( J$ [8 o: U9 n! `! m; [' K
  2739.       (setq en           (ssname eset1 blkcnt)% {% L# s5 N# I7 F: f
  2740.             enlist (entget en)
    - P! d. z2 b  q+ M* ?
  2741.             space  (cdr (assoc 67 enlist))4 x1 M* I/ z5 y8 G+ R1 Y7 J7 r/ l
  2742.       )
    * A3 J7 Z$ A; M' M/ z6 ?) m
  2743.       (setq vl (list
    6 D/ x) C. {8 c; a& M5 N
  2744.                  (cons 0 "TEXT")9 q- m0 i' K8 K4 A) A
  2745.                  (cons 100 "AcDbEntity")
    , o* u/ |- w8 _$ B* k' C. a4 q
  2746.                  (cons 100 "AcDbText")
    % I$ b7 k) Q2 s' T
  2747.                  (assoc 7 enlist)( `' W+ K* B7 X- o* C7 A8 N( K/ Q8 l
  2748.                  (assoc 8 enlist)/ U" u  q4 g& }6 d2 x. B) e
  2749.                  (assoc 10 enlist)' V& Y6 R6 h3 K
  2750.                  (assoc 40 enlist)( v0 }! W8 w+ ^$ u( }8 S: `
  2751.                  (cond ((assoc 62 enlist))0 Z  }4 {2 G7 v+ ^3 R
  2752.                        ((cons 62 256))
    , L/ L2 o' i1 t4 [. [# ?
  2753.                  ). P/ W* i' Q$ F6 F. ]1 W0 q3 d# U
  2754.                  (cons 1 (cdr (assoc 2 enlist)))
      M& A2 ?+ A! h1 B- L3 ]
  2755.                  (if (= space nil)( p! f2 q5 H4 r4 t8 k" j- {) [* Y4 U
  2756.                    (cons 67 0)
    * V4 @4 ~! `+ _8 @; [- T$ i; V
  2757.                    (cons 67 space)0 b5 ^5 `! i9 T2 ?+ k' S. _9 n
  2758.                  )
    . }" Q# ]% A8 w2 F% g
  2759.                )2 D9 V* J3 {+ p3 \& l
  2760.       )
    $ K  o  |4 q8 |; i
  2761.       (entdel en)
    " x$ d  I+ ~' Q( X/ ?
  2762.       (entmake vl). M- L% v9 H# h9 K. F
  2763.       (setq blkcnt (1+ blkcnt))
    4 F" k0 d3 U: L5 e
  2764.     )" g6 {0 o% M+ V8 Y, t! z: T7 A3 m( w
  2765.   )
    8 p3 s7 x8 z$ d+ N# r
  2766. )% `( j# L" t  `
  2767. ;=====================================================================
    3 X1 O. |9 \! n" T
  2768. ;============================ Doi Truc ===============================* {4 X! H& ^9 m+ z
  2769. ;=====================================================================
    . R# V- w1 i2 J, a
  2770. 3 \7 i' e) l/ g% L: C9 U; y8 W. B, Q: c
  2771. ;=====================================================================
    ( {6 @  v; x6 V6 o! m( V- i
  2772. ;=============== FUNCTIONS GA 1+3+5+7+9+11+13+15+17+19 ===============: S" n+ z, p4 F, k* o
  2773. ;=====================================================================; `% j8 ~1 M% ~6 I5 [
  2774. (defun c:ga1 ()% u: a4 y! ~. s+ C. z. j6 d$ M" c
  2775. (setq a (getpoint "\nChon diem: "))
    % D( ?4 ~$ n4 j
  2776. (setq b (getpoint a"\nChon diem: "))  k! E0 O, F# U# J
  2777. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))$ k, G, P0 [4 J
  2778. (command ".circle" c a)
    ( @; u# c- |9 D6 f' k. u+ ~
  2779. (command ".line" a c "")
    . P, q% F# D  ]: d
  2780. (command ".array" "last" "" "p" c "1" "" "")
    6 @1 r' T& Z& l0 q, U7 y, A
  2781. (princ)); l: U" M; s7 t: ]2 r
  2782.   b9 B4 }2 _: `
  2783. (defun c:ga3 ()
    ; z6 e3 v* y3 ~( L( H  I
  2784. (setq a (getpoint "\nChon diem: "))
    : v, i. o( `9 }8 n  J* z0 D
  2785. (setq b (getpoint a"\nChon diem: "))7 \1 ^% W/ U; a7 Q- p4 C
  2786. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))  f9 C" Z  b5 y' N2 R# y
  2787. (command ".circle" c a). X0 N6 j8 A1 B% `" ~0 E7 l
  2788. (command ".line" a c "")
      H& O) _1 B6 c! O
  2789. (command ".array" "last" "" "p" c "3" "" "")0 S3 A2 m$ M- N, e% f  t4 }
  2790. (princ))1 z5 N) R+ D- @9 Y3 C0 A; y( {

  2791. 2 O1 M: I8 R, a# ?) o
  2792. (defun c:ga5 (). v# v% E; C; U9 Z; j% l
  2793. (setq a (getpoint "\nChon diem: "))
      k6 E9 B4 G. m* |4 `
  2794. (setq b (getpoint a"\nChon diem: ")). a" R/ f: a2 M8 Y* U* @
  2795. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
    2 D+ {, H& `% z/ a% [- v7 ^
  2796. (command ".circle" c a)  A5 M0 M% J5 y) H1 w- ^
  2797. (command ".line" a c "")
    - ~5 t7 f, O! c! f2 X
  2798. (command ".array" "last" "" "p" c "5" "" "")* n" y8 x( w5 s# K
  2799. (princ))
    3 Y, e1 @2 g/ U% @! T- H& O

  2800.   `. B5 j' I) v6 G: o/ g
  2801. (defun c:ga7 (). a" `5 x$ k7 X+ M
  2802. (setq a (getpoint "\nChon diem: "))) w, c: V) j6 a
  2803. (setq b (getpoint a"\nChon diem: "))
    4 a% g7 s, J9 z  m$ h0 V
  2804. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))7 f! q5 @* [( k# J- x: v
  2805. (command ".circle" c a)! u9 ^  M4 @$ f7 `# g
  2806. (command ".line" a c "")
    - M3 x+ t6 a. p" X: d
  2807. (command ".array" "last" "" "p" c "7" "" "")
    . x3 A) x' l, q9 u5 R
  2808. (princ))& P/ k! A' L8 {& Q
  2809. ! U4 S. ^. \3 P" G- {7 P
  2810. (defun c:ga9 ()
    : G8 r4 F% }, C: m( K
  2811. (setq a (getpoint "\nChon diem: "))
    7 s9 H) v* d) G
  2812. (setq b (getpoint a"\nChon diem: "))5 e- t" h3 d, W. T& O+ n
  2813. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))( Q9 o! i$ G1 B7 l
  2814. (command ".circle" c a)
    " z! E4 U4 ]' _6 P, x7 [
  2815. (command ".line" a c "")1 J" s. a) n" M: c6 @4 q
  2816. (command ".array" "last" "" "p" c "9" "" "")
    5 j) x- h- J% I
  2817. (princ)): X3 ]# |2 j8 C# I% O

  2818. ; A- l7 j. Q) g
  2819. (defun c:ga11 ()7 k2 U7 }& p5 e4 |1 E
  2820. (setq a (getpoint "\nChon diem: "))* _; M7 {; j2 f- _, \  u5 S
  2821. (setq b (getpoint a"\nChon diem: "))1 d9 D$ B# N& C* C" N$ }% g
  2822. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))% Z2 q- z: [: M- @/ ^' ?7 d+ g
  2823. (command ".circle" c a)2 b3 M/ m0 e  u+ Q8 {+ y  h( l
  2824. (command ".line" a c "")& Q+ P. q6 O+ e9 `2 m
  2825. (command ".array" "last" "" "p" c "11" "" "")
    ' x/ f. Z/ Y% z
  2826. (princ)), V. ]4 c% o) e0 H$ G
  2827. . T' I6 N( ~5 g% s! D" s3 A
  2828. (defun c:ga13 ()
    ( e- {( N: e: s0 c9 \4 ?, O. Q1 O
  2829. (setq a (getpoint "\nChon diem: ")). h; f+ x' y5 S* S  }1 G7 o
  2830. (setq b (getpoint a"\nChon diem: "))1 U: x* R% o, c3 n! ^3 F
  2831. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
    5 c! Y- N" Y; ?: A+ p# q8 `
  2832. (command ".circle" c a)
    ; J2 c( x4 B* k# \+ M+ b3 H
  2833. (command ".line" a c "")" b3 C* w6 e) X
  2834. (command ".array" "last" "" "p" c "13" "" "")
    4 }' b0 s! m# o7 a: r( l9 J# _  I
  2835. (princ))
    1 R! l: u# s0 z9 M2 F/ ~. v+ K
  2836. 1 n$ V1 B1 y: J9 Y
  2837. (defun c:ga15 (): }1 D5 _& O) i# |
  2838. (setq a (getpoint "\nChon diem: "))
    2 W7 I, A( i7 x9 o8 E; l
  2839. (setq b (getpoint a"\nChon diem: "))
    9 k( p, k( Z% ^
  2840. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))4 ]! b1 v" }( M
  2841. (command ".circle" c a)
    7 G. `4 Z5 M( W
  2842. (command ".line" a c "")- ~2 e& _3 b7 \: ~
  2843. (command ".array" "last" "" "p" c "15" "" "")
    # a, _# O- R( u. U0 d
  2844. (princ))
    . b+ G- g: E6 Y5 O6 q

  2845. 1 u0 p  L# U6 |
  2846. (defun c:ga17 ()/ q1 S5 P/ _1 @* O
  2847. (setq a (getpoint "\nChon diem: "))
    % S+ F" i" A( }0 Q+ j9 I: \
  2848. (setq b (getpoint a"\nChon diem: "))
    9 ^$ T' I+ K0 E" E: Q2 {
  2849. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))3 ^$ e+ }8 p/ n0 K" b1 m; \
  2850. (command ".circle" c a)8 L3 g, \/ S- h9 b. A# v
  2851. (command ".line" a c "")
    7 {3 S5 h( b1 u7 _/ G) ^
  2852. (command ".array" "last" "" "p" c "17" "" "")
    ) K2 x4 w6 C! m: b0 n
  2853. (princ))4 i6 F: e; g5 M  E6 v; y# y( K

  2854. 7 e$ s) z& {7 C1 `1 a
  2855. (defun c:ga19 ()
    - K! c3 k9 L8 c0 j' v( [
  2856. (setq a (getpoint "\nChon diem: ")): _6 F5 {5 _! {3 Q6 ?! @7 ?. n+ ~
  2857. (setq b (getpoint a"\nChon diem: "))
    $ C; V, v& F) M. w$ u$ |
  2858. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
    ' n: a2 f& g9 V7 ]* ^, j' u* X
  2859. (command ".circle" c a)1 P3 {  T) Q( X  h; G2 J' F. }
  2860. (command ".line" a c "")
    / t# V% z2 Q( }# \! y: z
  2861. (command ".array" "last" "" "p" c "19" "" "")& ~2 n, O! m3 N' m4 {$ p: t
  2862. (princ))+ G& G& H. `. v+ K' P. |/ J: d
  2863. % L, X5 K8 z9 }5 b, p' E/ c
  2864. ;=====================================================================: K. s- d4 ^! F1 v
  2865. ;============== FUNCTIONS GA 2+4+6+8+10+12+14+16+18+20 ===============. I3 _0 Z: ]( p: I
  2866. ;=====================================================================
    5 t2 h) D# b# V/ W
  2867. (defun c:ga2 ()3 t: b% C( T+ {; x! k
  2868. (setq a (getpoint "\nChon diem: "))+ v2 ]  s  B! h- z  N3 I
  2869. (setq b (getpoint a"\nChon diem: "))
    ; W1 b- q( z; o( @
  2870. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
    8 F; k" @1 n# F- P. l$ B
  2871. (command ".line" a c "")
    $ z. a( v  P/ p5 E; f% r# b9 y
  2872. (command ".array" "last" "" "p" c "2" "" "")
    6 u- U/ U6 W- M: U* |
  2873. (command ".circle" c a)
    , q" P! D! q2 w6 j/ g! V# Y
  2874. (princ))8 q! [. M4 J' z

  2875. & o( o5 q, [9 o3 K
  2876. (defun c:ga4 ()* E- r6 k6 J1 k, `0 s, T; U' I
  2877. (setq a (getpoint "\nChon diem: "))& K' U, e0 d3 I. W6 U1 R& a
  2878. (setq b (getpoint a"\nChon diem: "))' Q) C0 ]  \# e
  2879. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
    # ~, {3 \: o7 e
  2880. (command ".line" a c "")
    / W6 H8 g% v. w) @3 J! M
  2881. (command ".array" "last" "" "p" c "4" "" "")
    * x- P% [' e: I% a2 M) y" B( e
  2882. (command ".circle" c a): h2 o2 S2 j3 E3 m8 s# o& P3 e, D
  2883. (princ))/ d' ?, m) l- I; |

  2884. * P- R5 C8 m, h, a$ T1 ~1 q
  2885. (defun c:ga6 ()
    / d( F" u0 b2 k5 P7 L% ?. E- W7 `& |8 c
  2886. (setq a (getpoint "\nChon diem: "))
    - W7 x. W( v% U+ C$ S, @4 _
  2887. (setq b (getpoint a"\nChon diem: "))( ~4 l$ b6 F4 V8 D
  2888. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))) z& O4 Z* v' w
  2889. (command ".line" a c "")
    / s8 i* J9 C9 X. F" l) [3 K0 g, C
  2890. (command ".array" "last" "" "p" c "6" "" "")
    $ R* r$ o+ l  K9 _0 c0 m
  2891. (command ".circle" c a)& M7 t: Y# [3 o3 o
  2892. (princ))' _  k' \9 d5 u, E7 i

  2893. # N, d: u1 Q5 l9 {- C2 Z% v9 t) Z
  2894. (defun c:ga8 ()
    9 ]* o, F7 }5 f! i5 K
  2895. (setq a (getpoint "\nChon diem: "))! W4 j% L7 o* {- N
  2896. (setq b (getpoint a"\nChon diem: "))
    - x7 T0 c0 N9 K9 t/ f6 p
  2897. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))1 b5 |0 F; `/ k2 U7 q
  2898. (command ".line" a c "")9 F2 q% Z5 X2 p; M
  2899. (command ".array" "last" "" "p" c "8" "" ""): c4 V5 k  s' l# ^# i" K$ s
  2900. (command ".circle" c a)! a) |1 Z# @' K" W) U" m( F, T5 a) V
  2901. (princ)): b9 E. S2 l0 v, Z% A0 N! Y2 {

  2902. & B1 q% N9 ]# q: C
  2903. (defun c:ga10 ()
      n/ k, C: b& X& ]! ~
  2904. (setq a (getpoint "\nChon diem: "))
    ; q# }4 v4 r: Q/ L; ~0 |1 ]
  2905. (setq b (getpoint a"\nChon diem: ")): H9 E# Q% @" ^- w1 k5 d* i
  2906. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
    , ^: L/ ]- E& a6 J
  2907. (command ".line" a c "")
    # b2 J+ L) ~# ~$ x
  2908. (command ".array" "last" "" "p" c "10" "" "")7 Z3 s. l. U& L% D5 ~  S) O- x* J
  2909. (command ".circle" c a): s6 ]( r, z0 I3 o& \
  2910. (princ))
    $ m4 E8 a, S* x
  2911. % T% j7 h' c9 C
  2912. (defun c:ga12 ()
    * x3 x' D# I( |' d$ K, Q- O) R
  2913. (setq a (getpoint "\nChon diem: "))
    ) N. \  P; @9 r' c
  2914. (setq b (getpoint a"\nChon diem: "))& p  x% h: Z! z1 t
  2915. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))+ X6 K7 L; o* p. [
  2916. (command ".line" a c "")% p6 I- x, T* x% d; I/ l- v
  2917. (command ".array" "last" "" "p" c "12" "" "")& m' c0 c, q* i6 T6 g
  2918. (command ".circle" c a)
    / X& c- T- y9 F! o' B- i5 I3 z
  2919. (princ))
    1 ^3 v& k: Z) R+ ^6 t( C* {6 N# @

  2920. 9 S; l4 A# E* w1 O/ u# S; t
  2921. (defun c:ga14 ()
    # {6 }9 r1 e7 ]5 b7 [
  2922. (setq a (getpoint "\nChon diem: "))2 C( v8 e3 f9 T& P$ U" j
  2923. (setq b (getpoint a"\nChon diem: ")), `# X% b. I1 c9 J5 s5 d& h6 p
  2924. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))2 H; I2 B5 e* c5 S' v; H
  2925. (command ".line" a c "")
    0 q: W7 x+ Q% b" D, p
  2926. (command ".array" "last" "" "p" c "14" "" "")
    8 B2 [5 K) _; c: C8 q; s" E
  2927. (command ".circle" c a)
    8 }5 S7 Q% `& k* D& H% z5 ~
  2928. (princ))1 c4 ^  F3 n/ {

  2929. 4 F4 w/ @8 j/ x  O8 K' W9 w3 e
  2930. (defun c:ga16 ()
    + s' y  I3 ]- E  p* l6 ^8 D7 n
  2931. (setq a (getpoint "\nChon diem: "))1 L2 z3 [  P% e; b! q# v
  2932. (setq b (getpoint a"\nChon diem: "))! t3 J4 _# S- t
  2933. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
    ! |' W! ]. Y9 x0 J# C
  2934. (command ".line" a c "")8 d/ y9 W5 M* C# c
  2935. (command ".array" "last" "" "p" c "16" "" ""): R' v" y$ V+ D  U
  2936. (command ".circle" c a)
    . k* C9 Z4 |; s& p
  2937. (princ))
    * E: F0 L. r2 p7 b4 h

  2938. * d% Y; U5 |: m0 \: N& |$ n. W# T8 l
  2939. (defun c:ga18 ()
      a7 f9 C5 K( D+ ]
  2940. (setq a (getpoint "\nChon diem: "))1 N3 x# i- ~" Q% t; e/ s
  2941. (setq b (getpoint a"\nChon diem: "))) C0 c* x' N7 l& W
  2942. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))* |- t. a1 G* O* v" w1 m- x
  2943. (command ".line" a c "")* y# D- D9 M+ ~5 a; t! F
  2944. (command ".array" "last" "" "p" c "18" "" "")
    & c, L  j2 f5 [4 V$ M% }7 ^7 e
  2945. (command ".circle" c a)3 b5 k5 e% c* t* Y1 D9 {
  2946. (princ))/ Z5 t( U% H. i0 e6 [% h

  2947. $ T! f/ e; {' e" z
  2948. (defun c:ga20 ()/ E5 ?, S/ s# o' A
  2949. (setq a (getpoint "\nChon diem: "))
    6 B- W- ?# a9 x  j. I- J' ]" w
  2950. (setq b (getpoint a"\nChon diem: ")): u+ C4 `9 J0 Y
  2951. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))6 x8 a6 C5 c' \. H
  2952. (command ".line" a c "")8 D- M; V1 S; A( z4 t# P
  2953. (command ".array" "last" "" "p" c "20" "" "")5 ?' A0 q; J8 L1 O% G3 v2 V
  2954. (command ".circle" c a), s/ @8 K, ^$ Q6 @
  2955. (princ))
    ! ]9 ~1 ]3 g8 g$ f, m$ L
  2956. 1 v; s- [$ a; q  I, _1 e" V
  2957. ;=====================================================================4 ^$ S4 p; l8 b
  2958. ;============== FUNCTIONS GA TUY THICH : EVERYTHING IF ===============/ v0 |) d' p1 l0 |$ L4 b
  2959. ;========================== 06-11-2016 ~ 18h00 =======================: W; j9 ?5 K# V# b4 Z5 ]* i3 E
  2960. ;=====================================================================
    " p; s. X; B( K/ h5 S, a' s
  2961. (defun c:ga ()
    : ]0 ^/ @' J/ j2 j
  2962. (setq a (getpoint "\nChon diem: "))
    3 t+ x- a# W) d& `5 K& Y" M
  2963. (setq b (getpoint a"\nChon diem: "))+ S' W8 u0 P7 |# }
  2964. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
    ' d; D/ I  {. w' V8 ^
  2965. (command ".circle" c a)
    # G6 t5 s; X5 k* V- Z/ K
  2966. (command ".line" a c "")$ M' l) h+ y7 m" Y5 N$ {, |
  2967. (command ".array" "last" "" "p" c "NUM" "" "")2 m; I0 ]. R# U1 n' z8 D5 d
  2968. (princ))
    , g( Z9 K) J0 T2 A" b/ o

  2969. ; {& r- B2 k* u' @; |
  2970. ;=====================================================================
    ; t9 B1 ~! z& M- [/ K1 M0 o
  2971. ;=========== FUNCTIONS HOA THI TUY THICH : EVERYTHING IF =============
    5 Y/ j$ ]$ k) J# l# @  z
  2972. ;========================== 06-11-2016 ~ 18h40 =======================  \3 M  S3 E: u5 e0 ^  F; R1 v
  2973. ;=====================================================================$ _+ g% e( ?  `- A

  2974. - N) U+ w$ x" v) n
  2975. (defun c:hoathi ()8 Y3 ^- g! z+ X6 a5 `' _( [
  2976. (setq a (getpoint "\nChon diem: "))$ W5 {- |$ H$ }+ n
  2977. (setq b (getpoint a"\nChon diem: "))
    ' `1 I$ J3 m6 p
  2978. (setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))! U" ]  v* Z8 f- x4 d" s
  2979. (command ".line" a c "")
    , K- O" g; |& I4 B
  2980. (command ".array" "last" "" "p" c "NUM" "" "")
      F- |6 C8 i: _8 @) z
  2981. (princ))
    " }- K# q6 ?; i' ]9 X0 P4 V

  2982. - j" y7 f. u9 m! z* F' W
  2983. ;=====================================================================
    1 K1 `( {% @( B# ?3 z8 A2 O& @% t
  2984. ;============= FUNCTIONS CUNG TUY THICH : EVERYTHING IF ==============
    6 B0 E0 q+ o9 K
  2985. ;========================== 03-11-2024 ~ 19h33 =======================/ B$ i" j0 L7 J8 j1 D
  2986. ;=====================================================================
    5 ]' @: `- p# z- _7 a4 r

  2987. , x: k! r3 w6 W. t- f. C( n) ]4 a: S
  2988. (defun c:cung ()
      I4 X6 y; L4 W4 ~9 g) Y& B  n# ]+ F
  2989. (setq a (getpoint "\nChon diem: "))
    $ R) x6 s. Q" y5 ^
  2990. (setq b (getpoint a"\nChon diem: "))
    ( s8 w( K% z) j1 p7 C
  2991. (setq c (getpoint a"\nChon diem: "))
    & w0 N9 k* X% d1 U7 V" X
  2992. (setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
    3 @' C! O; R/ B! D) w2 V8 r
  2993. (command ".arc" a b c "")( Z  W/ o2 K6 n" \; \
  2994. (command ".array" "last" "" "p" c "NUM" "" "")
    ) ]# H9 e9 I# X2 }. }$ P0 s
  2995. (princ))3 a( a- y4 i7 b# U2 h
  2996. - N/ f: b9 L. D9 x0 o1 M
  2997. ;=====================================================================% A7 w0 K! v: K1 [( o4 K/ u3 R% q2 j
  2998. ;============ FUNCTIONS HECLOIC TUY THICH : EVERYTHING IF ============* W% q/ P+ F+ _8 ]. \
  2999. ;========================== 03-11-2024 ~ 20h02 =======================
    2 i1 q- r. ~) w9 x$ B4 @- @
  3000. ;=====================================================================4 t+ }' C! f" A# k" W5 K& W, U8 ?
  3001. ! `4 C7 ~8 E( s% p' V6 J7 ^
  3002. (defun c:hecloic ()
    $ D& ?" B2 F: m  W) m- M: o; P4 \, W, C
  3003. (setq a (getpoint "\nChon diem: ")). v) J) f7 q3 ~
  3004. (setq b (getpoint a"\nChon diem: multi "))
    0 D% I+ l4 i: r0 x  |$ i, j3 k
  3005. (setq c (getpoint a"\nChon diem: "))(princ)
      O  I% h, X0 ?4 A( \: y4 }" l
  3006. (setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))0 U* o2 d/ d6 q# @% G6 n/ [3 p
  3007. (command ".arc" a b c "")) ]# z2 }; s- k, W# Y
  3008. (command ".array" "last" "" "p" c "NUM" "" ""), _5 S: R, w* F2 g- W
  3009. (princ))
    5 M+ t$ Z1 x7 c. r- D
  3010. # f+ N' w! p8 }' P# E
  3011. ;=====================================================================6 T, p$ [* l! C
  3012. ;============== FUNCTIONS GAY TUY THICH : EVERYTHING IF ==============* |! c& P- C, }$ {& m  ~3 S; i
  3013. ;========================== 03-11-2024 ~ 19h38 =======================
    6 C8 c" }2 t0 L* E% q/ Y# e: r
  3014. ;=====================================================================
    ! q) Y) @" ]1 o- |6 w' @% Z9 y

  3015. ) x; |6 y. i% {1 t/ v
  3016. (defun c:gay (), B) ]" ?! ]1 B- P
  3017. (setq a (getpoint "\nChon diem: "))4 I8 P: s  H2 `  x" l
  3018. (setq b (getpoint a"\nChon diem: ")); h7 ]- C# R6 m5 T' |
  3019. (setq c (getpoint a"\nChon diem: "))(princ)$ Z  E. R& D% R" a6 j
  3020. (setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))$ E( x8 }; ?4 s7 F8 U: p0 f1 o: u: |2 K6 H
  3021. (command ".pline" a b c "")# `/ c" J  P3 F* j7 F
  3022. (command ".array" "last" "" "p" c "NUM" "" "")/ C  }$ m+ L2 x( r# ~
  3023. (princ)): ~# N& l* z" {
  3024. / J1 Z3 o4 F4 o) K; f  U
  3025. ;=====================================================================( z! L/ k1 [) y  H" m4 x1 a8 u
  3026. ;============ FUNCTIONS HECLOIT TUY THICH : EVERYTHING IF ============
    5 r! H# q: `1 K
  3027. ;========================== 03-11-2024 ~ 20h02 =======================/ a5 \) }; h: Y3 u' \0 G
  3028. ;=====================================================================
    ( s( J$ e6 a2 {. l2 _

  3029. / O' }9 k- Y- A
  3030. (defun c:hecloit ()$ E* O4 c0 `; w9 ~
  3031. (setq a (getpoint "\nChon diem: "))1 g, e# s( g1 h; x# l  M8 V
  3032. (setq b (getpoint a"\nChon diem: multi "))$ ^* J2 q# i" P# D5 o. h
  3033. (setq c (getpoint a"\nChon diem: "))(princ)
    ; a1 ]# {4 o( m# X
  3034. (setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))1 Z$ e. v! J8 J8 d" Q0 I! ?
  3035. (command ".pline" a b c "")
    & r; J5 \! W8 n8 v! m( {0 R
  3036. (command ".array" "last" "" "p" c "NUM" "" "")" o6 a! y) M4 Z) M3 S! J
  3037. (princ))
    6 Y. E6 n2 `' s  y( K) S

  3038. ; Z- M: ?# }6 p9 N9 \5 Z" i
  3039. / ?! h6 A2 n4 m+ K! Q! L* H. A1 Y/ J
  3040. ;;; ============================ Merge Hatch =============================
    . Q6 W, n! a4 w- s+ |
  3041. & G7 c, a1 u9 g7 f" [& h
  3042. (defun c:mh (/ ss entht sl i dt dtht)
    & F: |& m( ^7 `* k2 ^

  3043. ) S+ U, Z- y$ t$ ?: a  a
  3044.   (princ "\nMerge Hatch - free lisp from CADViet.com")
    1 V1 l+ {! _/ o4 ]0 M5 t
  3045. ) V7 b9 V5 j( l/ S" i6 J* q" g/ I2 X
  3046.   (setq. Y) s% P( g" M8 ]- z2 h9 h- ?  ^
  3047.     ss (ssget '((0 . "HATCH")))
    , O' D+ O5 D0 y3 e: g
  3048.     sl (if ss+ A5 y. X3 a) `9 M! w" X
  3049.          (sslength ss)
    7 U8 ^" r5 |8 F4 `( H
  3050.          0
    1 v" Z  u4 Q. h- [. _
  3051.        )
    $ C: B, ~6 w& M! e% L8 A
  3052.     i  0* L& ]7 ~. ]# J0 U
  3053.     l  0+ X2 ?; J' W' s# K" B8 d2 U/ \' X
  3054.   )
    * R7 p( [# g. \7 d1 y9 N7 h

  3055. $ p( ?( m8 V7 `" f2 A  J% l
  3056.   (repeat sl
    + x$ J8 b. p# v6 M2 I8 D
  3057.     (setq
    # @! G$ r% `& M7 l
  3058.       entht (ssname ss i)# U# D7 p3 t- C
  3059.       dtht  (getbdata entht)" k  C- u% e) S2 U9 X/ o) C7 @
  3060.       dt    (append dt dtht)
    9 o$ `5 w  a; V7 @) z( x1 }
  3061.       l            (+ l (cdr (assoc 91 (entget entht))))
      `& V  L; n4 @  z9 H6 V: u
  3062.       i            (1+ i); b! r" i. \- d6 |5 |% P# l
  3063.     )
    0 W2 P+ b& P  x' d/ I) i
  3064.   )
    5 j$ z  G" c# s! F4 U

  3065. ' i- j* @& X7 d) o2 ~3 C' O
  3066.   (setq        ent  (ssname ss 0)
    1 e" ~6 H9 ~! ]+ B6 N+ i
  3067.         ss   (ssdel ent ss)
    - z( w3 s4 p* p) t. f. S
  3068.         tt   (entget ent)
    + n" d8 B9 {& [$ M0 g
  3069.         duoi (member (assoc 75 tt) tt)
    ( n8 t% c6 d  `
  3070.         dau  (reverse (member (assoc 91 tt) (reverse tt)))! n1 z1 }& i# H1 C, q$ q
  3071.         tt   (append dau dt duoi)
    3 M2 _. R( B+ C
  3072.         tt   (subst (cons 91 l) (assoc 91 tt) tt)
    , `, ^6 G/ R" l9 k( P* ]* ~+ K0 {1 P/ V
  3073.   )# J0 }2 M8 a- ?$ N( m
  3074.   (entmod tt)# x- u$ N" A" l) B% j3 o
  3075. 2 ?+ @* Z" b+ X. B
  3076.   (command ".erase" ss "")
    8 G% f* {1 [* ?' q5 _4 {1 n, W4 ]
  3077.   (princ)
    2 t7 s/ L* o" c7 g. M' \4 T+ b) Z* x
  3078. )' f1 t( G; H2 _. P7 P5 Z

  3079. * x6 W. G! o8 Q0 R  f8 f# s
  3080. (defun getbdata        (ent)+ j, J$ E5 a8 R
  3081.   (setq        tt (entget ent)8 D8 p1 c8 i$ b$ \& m
  3082.         tt (cdr (member (assoc 75 tt) (reverse tt)))
    1 `1 ?) _: c, y
  3083.         tt (cdr (member (assoc 91 tt) (reverse tt)))! a' \4 j+ b7 a/ k
  3084.   )' T2 V* l! b3 X- w
  3085. )4 K) C1 W6 I( g( X% N- A

  3086. 1 n" f* u' G2 T/ m! A" a: u
  3087. ) n: \+ Y/ R$ o9 W0 \
  3088. (princ)
    3 E; A2 |1 ^, A* b) F, T; K7 N/ A

  3089. ' M* U& ?% V1 Z3 t# |+ l
  3090. ;;; =========================== CAC LENH LAYER ==============================
    , o! F4 ~) F4 w/ O- }; U
  3091. ;;; =========================== Layer hien hanh =============================2 d$ ^6 d/ }* Y3 D9 P4 d

  3092. / c8 j4 W- M" i- L3 M! j4 m' v
  3093. (defun layset (/ LAY) (setvar "cmdecho" 0)
    , g/ w; K) O6 Q( z& W* D
  3094. (setq LAY (entsel "\nPick vao doi tuong muon Layer hien hanh la Layer cua doi tuong do : "))* a+ J* x  z. s: h  F5 O4 W
  3095. (if LAY     (progn     % D+ M  |  l) I: U% [! b: b  p( @% ?
  3096.   (setq LAY (cdr (assoc 8 (entget (car LAY)))))5 E- L0 {& `$ X- v4 ^- K
  3097.   (command "_.layer" "set" LAY "") (princ (strcat "\nLayer : " LAY " da la hien hanh."))  )1 j3 E# ]) h  n/ A) E! {, V  x  o
  3098.              (progn- F* X0 t7 C1 k5 f
  3099.       (if (not ddlop) (load "ddlop"))  (if (setq LAY (ddlop)) , a5 X% |! ~# [. m8 O. p
  3100.              (progn4 k: M# \% o5 q% F+ p( o
  3101.             (command "_.LAYER" "ON" LAY "THAW" LAY "SET" LAY "")  (princ (strcat "\nLayer : " LAY " da la hien hanh.")) ) ) ) )(princ) )) w, C$ {8 X' L4 d: E6 D; E
  3102. (defun c:LLL     () (layset))(defun c:LAYSET () (layset))
    * ?( g) L5 ^2 a: Q4 ?! {

  3103. ) N1 h9 q' Q& R) z
  3104. ;;; ================== Cap nhat doi tuong vao layer hien hanh ==================8 l/ D4 z2 ?9 z  f8 E
  3105. ' u7 `4 p5 C  o$ }2 w- w
  3106. (Defun LAYCUR (/ SS CNT LAY)  (setvar "cmdecho" 0)
    / E2 H' |% g6 G$ v* {# o
  3107.   (if (not (setq SS (ssget "i")))
    2 j9 `" f; n& I! J
  3108.     (progn (prompt "\nChon doi tuong cap nhat vao layer hien hanh: ")
    4 z* o1 C( E" \. J
  3109.       (setq SS (ssget))    )  )
    3 U% ^5 E0 h; `5 F+ }/ I/ w# V! V' o! b& N
  3110.   (if SS    (progn$ [0 P' Z1 |# T1 [
  3111.    (setq CNT (sslength SS)) (princ (strcat "\n" (itoa CNT) " doi tuong tim thay."))                  (command "_.move" SS "")                     
    9 O- [, i6 I- ]4 J
  3112.       (if (> (getvar "cmdactive") 0)                * d. t3 ?' d% d
  3113.         (progn
    9 a6 h7 s$ _0 C1 l  @
  3114.           (command "0,0" "0,0") (setq SS  (ssget "p") CNT (- CNT (sslength SS))    )   )% b: a0 r3 P& g7 c) _! C8 ]
  3115.           (setq SS nil)     )  (if (> CNT 0)                                 % ?1 {8 g! I7 U1 P! o& y
  3116.           (princ (strcat "\n" (itoa CNT) " doi tuong tren layer LOCK.")) ) ) )! {8 A5 p, ?3 D  I2 v; R
  3117.   (if SS    (progn- l; u4 c9 V! m8 I
  3118.       (setq LAY (getvar "CLAYER")) (command "_.chprop" SS "" "_la" LAY "")
    8 M! j4 N8 p& q- `
  3119.       (if (= (sslength SS) 1)
    0 J. W" w0 o5 ~! `" Y
  3120.         (prompt (strcat "\n1 doi tuong da cap nhat vao layer : " LAY " (layer hien hanh)."))
    " M4 o7 Y6 \) u4 Q: `( O6 }, U6 M. m
  3121.         (prompt (strcat "\n" (itoa (sslength SS)) " doi tuong da cap nhat vao layer : " LAY " (layer hien hanh).")) ) ))  (princ) );end7 K. E1 q3 v0 y' V1 d
  3122. (defun c:LAYCUR () (laycur)) (defun c:LHH    () (laycur)). o+ Y" r4 |7 T3 w
  3123. ) \" a  n6 _* n# @
  3124. ;;; =========================== Layer Iso ===================================! X$ j3 J: X3 _) V# h+ P. t

  3125. % ~2 k9 ^; Y9 K5 L2 ~
  3126. (Defun LAYISO (/ SS CNT LAY LAYLST VAL)  (setvar "cmdecho" 0)+ t4 L; G" I0 G6 @% y/ O$ O7 ~) {- w
  3127.   (if (not (setq SS (ssget "i")))    (progn
    8 b$ {3 Z8 q5 E% Z0 _
  3128.       (prompt "\nChon doi tuong tren layer(s) muon lam viec doc lap: ")% f  n- c' l- R) }
  3129.       (setq SS (ssget))    )  )- _4 I! x0 O1 W' p$ t* F4 B/ W3 l
  3130.   (if SS    (progn      (setq CNT 0)5 O2 @; O3 K8 ~$ E
  3131.       (while (setq LAY (ssname SS CNT))0 a0 s) ]3 \- M, ~; v7 Q, D
  3132.         (setq LAY (cdr (assoc 8 (entget LAY)))): ?: J' a5 z% l/ |) N* a! Z: p
  3133.         (if (not (member LAY LAYLST))+ |* W9 c+ z( z5 |; E
  3134.           (setq LAYLST (cons LAY LAYLST))        ); D6 v; r( |! g( J+ w) s
  3135.         (setq CNT (1+ CNT))      )
    # w! E2 U* y* M) e  p5 J7 S; B
  3136.       (if (member (getvar "CLAYER") LAYLST)
    . H, q9 K2 l( z
  3137.         (setq LAY (getvar "CLAYER"))2 S7 [5 p. }- M. y3 s7 X' o4 z7 @8 B6 I
  3138.         (setvar "CLAYER" (setq LAY (last LAYLST)))      )
    ! M$ b2 }9 r/ l! j) B4 ?
  3139.       (command "_.LAYER" "_OFF" "*" "_Y")& W( q  J2 I) f
  3140.       (foreach VAL LAYLST (command "_ON" VAL))% k. F5 t& S5 e9 |" G
  3141.       (command "")            (if (= (length LAYLST) 1)
    # ]2 }3 N4 C# h5 i9 O! W; ]
  3142.         (prompt (strcat "\nLayer " (car LAYLST) " da tach ra."))7 t& N2 _  M$ S2 l1 U5 T
  3143.         (prompt (strcat "\n" (itoa (length LAYLST)) " layers da tach ra. "
    - ^+ O/ L# ?7 n: E
  3144.                         "Layer " LAY " la hien hanh."   )  )  )  )  )  (princ) )
    + f% y( B3 v2 t0 c
  3145. (defun c:LAYISO () (layiso)) (defun c:LI () (layiso))
    # X% S* \4 y( c! h, Y# z

  3146. ' G4 P9 P; M& h) F+ J5 V  E: k
  3147. ;;; =========================  Layer Match ==================================
    3 z3 F9 y6 m  r- N0 ~7 o% Z) A0 n& d

  3148. % E4 w8 ~6 s8 i
  3149. (Defun LAYMCH (/ SS CNT LOOP LAY ANS)
    ) g& |) C0 F/ L# p
  3150.   (setvar "cmdecho" 0). }3 k* {7 d# A: F
  3151.   (if (not (setq SS (ssget "i")))    (progn- e1 N1 ~& {& K  o
  3152.       (prompt "\nChon doi tuong muon thay doi Layer : ")! ?# N+ a  I2 o( s
  3153.       (setq SS (ssget))    )  )1 N  [5 \% ?  s0 O
  3154.   (if SS    (progn* G& A; J; I( z- r
  3155.       (setq CNT (sslength SS))
    ) m% H# U  r- t8 ?' ?5 G/ W4 u
  3156.       (princ (strcat "\n" (itoa CNT) " found."))  (command "_.move" SS "")                        
    " p% a4 H% t& N5 N& g' F
  3157.       (if (> (getvar "cmdactive") 0)   (progn1 P  a) |/ j. Z% y# W) {. B. n$ _
  3158.           (command "0,0" "0,0")  (setq SS  (ssget "p")* y" [5 }6 T! x& G  {5 k% o
  3159.                 CNT (- CNT (sslength SS))    )    )% n( R' Q" g7 a. }
  3160.         (setq SS nil)      )  (if (> CNT 0)                                    + o( D; ~1 {) C8 y) X) S
  3161.           (princ (strcat "\n" (itoa CNT) " tren layer LOCK.")) ) )  )
    + y+ Z: k: U" e" u& w) S8 O! L9 r* ?
  3162.   (if SS    (progn4 g" E; c4 h3 E1 [3 n, Q
  3163.       (initget "Ten")  (setq LAY  (entsel "\nTen layer/<Pick doi tuong>: ")  LOOP T  ), c8 U1 M' G  W/ D- ]
  3164.     (while LOOP        (cond
    7 _3 ^* ]- L0 w+ `. o. L
  3165.           ((not LAY)% Z/ g: t8 B7 H8 ^- h" h
  3166.             (prompt "\nKhong chon doi tuong.")& w3 K% T1 r  p, b; N
  3167.             (prompt "\nSu dung layer hien hanh? <Y> ")
    0 ~! o# M: d: i! v
  3168.             (setq ANS (strcase (getstring)))+ z4 w! c) Y3 Q: ^6 F2 v; Z' z
  3169.             (if (or (= ANS "") (= ANS "Y") (= ANS "YES"))
    % q7 C: ~: Z1 e
  3170.               (setq LAY  (getvar "clayer")  LOOP nil )  )  )+ X% q# D: x$ ]% r
  3171.           ((listp LAY)  (setq LOOP nil) )) q2 E1 Y2 S3 {5 B, F7 Q% ?
  3172.           ((= LAY "Ten")
    , \  }, V0 a9 K* T9 c
  3173.             (setq LAY (getstring "\n>Nhap ten layer: "))
    # e& i# I) ?' m  {
  3174.             (cond
    2 P- Q5 l: I# q( r" n
  3175.               ((tblsearch "LAYER" LAY)  (setq LOOP nil)   )
    , ^% c8 v5 ^1 }* T% D
  3176.               ((/= LAY "")
    9 ^2 c9 v' M9 V/ a; i
  3177.                 (prompt "\nLayer chua co trong ban ve. Tao layer moi? <Y>: ")" A" b7 s! e) U. }7 T" I$ S4 i
  3178.                 (setq ANS (strcase (getstring)))
    & c! N( |3 O& Z/ @$ |3 t1 }' b
  3179.                 (if (or (= ANS "") (= ANS "Y") (= ANS "YES")); a# t3 k& C$ c) `) G( v
  3180.                     (progn- y0 W* ^" H+ X3 m0 q" i- E
  3181.                         (command "_.LAYER" "NEW" LAY "")
    5 C: p, U& ~! L/ F- i+ Q# c. y
  3182.                         (setq LOOP nil)   )7 e' _  S+ h. ~
  3183.                     (prompt "\nLoi ten layer.")   )   )  )  )   )9 Y6 Z8 p' U0 ]. T8 Y" K
  3184.         (if LOOP  (progn (initget "Ten")
    / `! _7 ]7 H' T, Z
  3185.             (setq LAY  (entsel "\nTen layer/<Pick doi tuong>: ")) ) ) ); while LOOP
    ( o( {- m, z) N( o. V/ p
  3186.         (if (listp LAY)1 y7 B# A: Z. p; {( \, ?4 m! E' [
  3187.         (setq LAY (cdr (assoc 8 (entget (car LAY)))))      )8 T! g% M- l& V- {* W
  3188.       (command "_.chprop" SS "" "_la" LAY "")$ q8 m- i7 ~5 d* Q7 V
  3189.       (if SS  (prompt (strcat "\n" (itoa (sslength SS)) " doi tuong thay doi toi layer " LAY )) )
    4 q. E0 E  T6 h# h
  3190.       (if (= LAY (getvar "clayer"))- Z; F. c9 N4 K  ^7 D( Y. K
  3191.         (prompt " (layer hien hanh).")  (prompt ".") ) ) )  (princ) )
    5 y  V" @5 E. F9 `/ s* d
  3192. (defun c:LAYMCH () (laymch)) (defun c:CLL    () (laymch))
    / ?2 X( f7 ]+ ]! J( [

  3193. - X$ R9 z: @2 `$ s  g6 U
  3194. ;;; ============================ Layer OFF =================================
    + k. F  {, U6 O- K# ~" V( c
  3195. # D# X2 z0 p9 `: }0 Z
  3196. (DEFUN C:LJ (/ SSET SSL ENT LAY I MODE)3 N5 o; _. O3 H+ d
  3197.    (SETQ SSET (SSGET))/ I* ~0 a7 F  p2 b, Q
  3198.    (IF (/= NIL SSET) 1 g; b( u+ q0 o' r! S7 e
  3199.     (PROGN- x1 h( ?$ J% z1 G/ @5 Y% r$ Z
  3200.      (SETQ SSL (SSLENGTH SSET))0 l% A" C/ }# z& {
  3201.      (SETQ LAY "")6 G  B. ^4 A4 R' K+ s2 m
  3202.      (SETQ I 0)* P7 C* W; c; S/ }2 C
  3203.      (SETQ MODE 0) 2 r) ]7 W2 g/ w- H
  3204.      (WHILE (< I SSL)
      ]5 B8 s6 A4 X9 x  I+ R8 @# d
  3205.                  (SETQ ENT (ENTGET (SSNAME SSET I)))/ ?0 A4 ?1 T! }" y% q* _) M7 ^
  3206.           (IF (= (CDR (ASSOC '8 ENT)) (GETVAR "CLAYER")) (SETQ MODE 1) )
    " [: \* w4 u( x  Z* a4 H
  3207.           (SETQ LAY (STRCAT LAY "," (CDR (ASSOC '8 ENT)) ))' b/ v/ D0 {3 z( u9 P
  3208.           (SETQ I (+ I 1))& u( ~4 C5 \! v
  3209.      )
    5 r" u) z+ c5 H' X
  3210.      (COMMAND "LAYER" "OFF" LAY "")2 j' H. s/ E2 A$ k
  3211.      (IF (= MODE 1) (COMMAND "") )& M8 C4 f; U7 @# o
  3212.     ), {. f3 l) G. b3 v
  3213.    )
    6 S& |7 w4 l; I9 K
  3214.    (PRINC)
    3 d" f5 c$ Q! {
  3215. )
      V, R2 C0 m2 s9 I1 i6 t. p1 B9 l
  3216. 5 D: F8 b! \, d! M1 A: \' H0 Q9 r# a
  3217. ;;; ================================ Layer ON ==============================
    # f. r, X! Y. F0 h

  3218. 7 @8 |6 g1 R8 E/ v% Y0 \
  3219. (Defun LAYON ()  (setvar "cmdecho" 0). o: u% ^5 g' b* S% Y# k! Q
  3220. (setq Lay loff1) (setq Loff1 Loff2) (setq Loff2 Loff3) (setq Loff3 Loff4) (setq Loff4 Loff5) (setq Loff5 Loff6) (setq Loff6 "0")8 k2 F3 m; L: Q* T
  3221.   (Command "LAYER" "ON" Lay "") (princ (strcat "\n      Layer : " LAY " da ON."))  (princ))
    : x( {5 ]1 Y$ K
  3222. (defun c:LAYON () (layon)) (defun c:LOO   () (layon))
    ! e& N9 J9 `0 a$ ]0 `+ e7 E* b& A
  3223. (Defun C:LO () (setvar "cmdecho" 0)  (Command "_.LAYER" "_ON" "*" "") (princ "\nDa ON toan bo cac Layer !") (princ))
    ( ]0 p9 ~2 y2 ~. ]7 V

  3224.   |4 }& W, H: v/ s
  3225. ;;; ============================== Layer Freeze ===========================
    * u5 T1 u1 [* W% [
  3226. ( L. Z4 }$ {" Q7 M
  3227. (Defun LAYFRZ (/ LAY TEMP)(setvar "cmdecho" 0)
    ; \+ g6 c$ |7 Q2 E
  3228. (prompt "\nChon doi tuong tren layer(s) muon FREEZE: ") (SETQ SSET (SSGET))
    . P! F0 T1 i' i% R1 g8 Z2 ~- \& ]; X
  3229. (IF (/= NIL SSET) (PROGN: |9 {. w; T6 R) _5 t
  3230.      (SETQ SSL (SSLENGTH SSET))  (SETQ LAY "") (SETQ I 0) (SETQ MODE 0) " P7 S6 T+ n0 J; a$ C: X) \
  3231.      (WHILE (< I SSL)
    ( }  z3 d( q3 g& J
  3232.        (SETQ ENT (ENTGET (SSNAME SSET I)))
    + |0 L1 Z' \6 k5 z0 j3 i. P+ s
  3233.        (IF (= (CDR (ASSOC '8 ENT)) (GETVAR "CLAYER")) (SETQ MODE 1) )
    2 V6 s" a9 Y8 ]* u, i% o
  3234.        (SETQ LAY (STRCAT LAY "," (CDR (ASSOC '8 ENT)) )) (SETQ I (+ I 1)))( N. l+ d, H# I+ [: K( u2 I+ `$ a
  3235.      (COMMAND "LAYER" "FREEZE" LAY "")) ?6 o' ]1 r! J5 H3 T- _7 Q% e9 E  @
  3236.      (IF (= MODE 1) (COMMAND "")))); |" `$ F0 M' {
  3237. (setq Lff6 Lff5) (setq Lff5 Lff4) (setq Lff4 Lff3) (setq Lff3 Lff2) (setq Lff2 Lff1) (setq Lff1 LAY)! K) _( }# W8 j4 C, I# x4 m
  3238. (princ (strcat "\n      Layer " LAY " da FREEZE."))(setvar "cmdecho" 1) (princ) )
    - q# w% h" E( l9 s) }0 y
  3239. (defun c:LAYFRZ () (layfrz)) (defun c:LF     () (layfrz))& p) ]8 S! h2 ~# L
  3240. # _: S! e  E8 P: W
  3241. ;;; ============================== Layer Thaw ===============================
    3 p* E: o" ], p1 J- k! C6 [
  3242. 5 d! ^# f; o5 c  p0 q
  3243. (Defun LAYTHW ()2 w) Y+ D4 s5 Q$ C
  3244.   (setvar "cmdecho" 0)
    + V$ K# t( S8 F$ ?* I. K! k
  3245. (setq Lay lff1) (setq Lff1 Lff2) (setq Lff2 Lff3) (setq Lff3 Lff4) (setq Lff4 Lff5) (setq Lff5 Lff6) (setq Lff6 "0")
    : L: L" b" x  Y0 ~2 Z& H1 Y" s, i! D
  3246.   (Command "_.LAYER" "_THAW" LAY "")
    / E% ~* c1 E# ^! D. t4 x
  3247.            (princ (strcat "\n     Layer : " LAY " da THAW."))
    / D& S6 `1 F6 K- s, V
  3248.            (princ) ), r% \& e! I! V7 @+ F/ w
  3249. (defun c:LAYTHW () (laythw)) (defun c:LW    () (laythw))
    6 u% P. n9 x0 N+ F
  3250. & o0 y+ n8 q6 V0 k( b3 T
  3251. ;;; ============================== Layer Lock ==============================& k; M; a4 o: o4 F) g, f6 D( N5 K" V

  3252. 7 Z7 c: a  N; X/ h! ^# A
  3253. (Defun LAYLCK (/ LAY)9 d' P+ ?8 a. i2 V* K4 n( E, M' k
  3254.   (setvar "cmdecho" 0)
    1 E3 m( k8 X: a( E  e$ }) y% I$ q
  3255.   (setq LAY (entsel "\n>Pick doi tuong tren layer muon LOCK: "))
    ' K5 t% L. N5 |  M6 e+ _! f
  3256.   (if LAY3 k# O+ {- w( @; [$ ^
  3257.     (progn
    1 @% s: B8 L4 i: Q" G2 f
  3258.       (setq LAY (cdr (assoc 8 (entget (car LAY))))): h. h: @8 D( y7 Y! a) ~, P
  3259.       (Command "_.LAYER" "_LOCK" LAY "")
    , s# W. n' N- z! N- v
  3260.       (princ (strcat "\nLayer " LAY " da LOCK."))    )  )  (princ) )
    6 s* T/ U5 w9 I2 i% z" j$ \
  3261. (defun c:LAYLCK () (laylck)) (defun c:LK     () (laylck)); U9 T6 h7 R; ~

  3262. 7 }7 \3 U! ^" L) D/ ?8 P
  3263. ;;; ============================== Layer UnLock ==============================- ^+ q. Z/ L  Q3 Z  X+ _$ c% C
  3264. * H* [5 q8 |" J$ k" I* B
  3265. (Defun LAYULK (/ LAY)
    7 `& Z1 A3 H; V6 K& }
  3266.   (setvar "cmdecho" 0), X8 S2 ~- Y. O( ?4 @  y7 C
  3267.   (setq LAY (entsel "\n>Pick doi tuong tren layer muon UNLOCK: "))
    + D1 g/ w! x0 t# i9 u
  3268.   (if LAY
    1 a' Z4 C; P8 k
  3269.     (progn
    6 T" x; j, z' `, R! a+ T4 ]  I
  3270.       (setq LAY (cdr (assoc 8 (entget (car LAY)))))
    9 T% w& m2 H9 B9 n# Z
  3271.       (Command "_.LAYER" "_UNLOCK" LAY "")
    : \8 A2 r+ M: g
  3272.       (princ (strcat "\nLayer " LAY " da UNLOCK."))    )  )  (princ) )1 o, u6 q& V6 {) L1 b
  3273. (defun c:LAYULK () (layulk)) (defun c:LU    () (layulk))
    $ h) {: r" J2 p2 j, N  L. D, N# [

  3274. 2 b- D0 f$ c3 S4 {7 X
  3275. ;;;===================== Delete all objects of Layer ========================
    ) q2 |/ t# \, s5 S: {
  3276. 0 Q) d7 G# U9 s5 A. k- [" Z
  3277. (defun DELAYER (/ ocmd L S)
    ( W( `, D$ s5 `. [
  3278.   (setq ocmd (getvar "CMDECHO"))4 }( B# d& U* ^! b' T) ?4 w, ~
  3279.   (setvar "CMDECHO" 0)
    ) e) k) X/ p- W( ~% G0 [3 F
  3280.   (setq L (strcase (getstring "\nLayer(s) to delete: ")))1 r8 b" x- \8 w0 E
  3281.   (setq S (ssget "X" (list (cons 8 L)))) $ }' P. J; Q+ n; x! v; T
  3282.   (if S
    ' @; |1 k) x) }9 [& D
  3283.     (command "ERASE" S "")            
    2 S1 {2 i8 W' p8 s/ \' n/ `& C0 {) N
  3284.     (princ "Layer empty or not a valid layer name.")  ) . k  G2 `) A# R
  3285.   (setq S nil)                        8 h5 W- V7 g0 r; E! s
  3286.   (setvar "CMDECHO" ocmd)            
    ( O- q# O+ r  [" ?  w
  3287.   (princ) ) $ J3 ~- L. t. ?+ P
  3288. (defun c:DELAYER  () (delayer)) (defun c:DELLAYER () (delayer)) (defun c:DEL      () (delayer))
    # r) S8 X3 j- U2 Y4 A
  3289. . y& h$ v, b# h0 _) ], y
  3290. ;;; ========================= HET CAC LENH LAYER ===========================+ |) p1 K, s. U3 }# E
  3291. . B# h1 a. f% N1 P0 z/ ^
  3292. ;;;====================== EXTEND NHIEU DOI TUONG ===========================
    ) ~7 k* X$ F5 `) Q! ^9 g

  3293. : t8 v+ @" N+ _9 ~
  3294. (Defun C:EET ()8 O- H( f/ c# f# Y- Q" ]& a# a
  3295.   (Setq CVAR (Getvar "CMDECHO"))  (Setvar "CMDECHO" 0)8 c) {* y# u. C) b$ |5 G5 G/ Y
  3296.   (Prompt "Chon doi tuong dich cua EXTEND :")  (Setq CUTEDG (Ssget))3 N  S' J' f2 p1 I6 V7 d6 v& Z
  3297.   (Prompt "Chon doi tuong de Extend :")  (Setq SS (SSget))  (Setq LEN (SSlength SS))
    ! P5 E9 e4 [- l! T
  3298.   (Setq I -1)9 L+ h( F2 t  J4 e
  3299.   (Setq SIDE (getpoint"Chon phia de EXTEND"))  (Command "EXTEND" CUTEDG ""). @/ g' r/ ?5 j6 g
  3300.   (Repeat LEN2 j( t' N! `1 |4 \5 D( R. q/ h
  3301.    (Setq I (1+ I))
    % e4 Z" H  b5 [4 G$ a
  3302.    (Command (List(SSname SS I) SIDE))  )  (Command "")
    8 u. C7 H4 J8 @! d: u
  3303.   (Setvar "CMDECHO" CVAR)  (Princ "Da Extend xong moi ban lam tiep")  (Princ) )
    " k1 d9 T1 F( n% [2 P

  3304. ) Y6 i) h  F! G  d
  3305. ;;; ===============  EXTEND 1 DOI TUONG THEO KHOANG CACH ===============. t. `. P- s2 g) |* r* b. p6 g5 m

  3306. 7 |8 k7 i8 N1 q! k; Y* ^& U
  3307. (defun c:ETT ()  (setq os (getvar "osmode"))  (setvar "osmode" 512)6 e% Z5 u! @" g& |$ h
  3308.   (setq pt1 (getpoint "\nKich vao 1 dau doan thang can EXTEND  "))" |7 V& H6 k4 f  Y) n; F2 a0 |
  3309.   (setvar "osmode" os)
    , A0 I) g& y( i/ _  e8 B
  3310.   (setq dis (getdist pt1 "\nKhoang cach can EXTEND :"))
    3 g5 z& y* m( q' T8 z5 @( c$ R! F
  3311.   (command "circle" "endpoint" pt1 dis)  (command "extend" "last" "" pt1 "")  (command "erase" "last" "") (princ))
    ) ]5 j% Y5 {  _0 L
  3312. # N2 @0 h# Q5 U6 v1 A  x' ^
  3313. ;; ================ Change width of polylines =========================' s% S# g- c( W3 `

  3314. 0 y) c) i7 o" u: b- v7 j7 d  D. o
  3315. (DEFUN wp (/ a b sophantu sodem list1 ha:wid): A! C8 o3 B- c, S* C9 U6 ]+ A
  3316. (PRINC "\n         Chon doi tuong can thay doi do day (Width) !")
    , q. w* M) O5 y  ^) T" `7 a2 |& E
  3317. (setq b (ssget)) ; A2 j% S+ C) l$ f: X2 G8 J0 E0 n) m  L7 R
  3318. (setq sophantu (sslength b))
    $ B( c8 `2 v- A5 K# ?8 w+ f
  3319. (if (null ha:wid) (setq ha:wid (getvar "tracewid")))
    ; U- x2 [) f, a2 o5 V8 t* a  j) ^! H0 Z
  3320. (princ "\nDo rong polyline <")
    9 s4 b& }: D! r: b7 {
  3321. (princ ha:wid)" F: _9 ^8 s- k) Z8 u
  3322. (princ ">: ")
    % R" j7 |$ W1 D0 N
  3323. (initget 4), |% Q5 Z7 f; B& x
  3324. (setq ha:wid (getdist))" j3 L8 q2 R. }' w/ ^( o
  3325. (if (null ha:wid) (setq ha:wid (getvar "tracewid"))). X( O! n5 c/ J- n6 J/ w) T
  3326. (setvar "tracewid" ha:wid)% P; \' t0 ^# D! B8 v7 w1 ~' I* ?
  3327. (setvar "cmdecho" 0)2 S! _  D) v7 q$ m
  3328. (setq sodem 0)
    " n& M5 q4 P1 m" F5 w, C+ V
  3329. (repeat sophantu
    * v8 x4 |" V, \
  3330.   (setq a (ssname b sodem))* F9 _: m9 I1 @. r# a! i0 K
  3331.   (setq list1 (assoc 0 (entget a)))
    + N; V" {) E3 u. y7 H& {9 j5 N; o
  3332.     (cond
    ; ^5 I$ Q8 k& e' W) V" c. I. M
  3333.      ((= (cdr list1) "POLYLINE") (command "_Pedit" a "w" ha:wid ""))
      \- g7 `" V) p; P0 h/ A
  3334.      (PROGN (command "_Pedit" a "" "w" ha:wid ""))    ) ( [8 u+ E3 Z" ~% P4 `+ H
  3335. (setq sodem (1+ sodem)) )(SETVAR "cmdecho" 1)(princ))! d/ |4 o7 ]+ @. j. {' `
  3336. (defun c:wp () (wp)) (defun c:pw () (wp))
    0 u2 L) b2 K* b9 e1 I. E

  3337. , {3 R" c/ I( [: S
  3338. ;; ================ Change radius of circles ==========================
    2 k$ M% [# m. n/ @
  3339. ; Q' d2 Y& D4 g/ t
  3340. (DEFUN C:CHR (/ SSET SSL M RD I)   (PRINC "\nSelect Circles :")   (SETQ SSET (SSGET))
    # W3 ?9 Z" K1 w
  3341.    (IF (/= NIL SSET) (PROGN  (SETQ SSL (SSLENGTH SSET))  (INITGET 4 "")  (SETQ RD (GETDIST "\nNew radius : "))
    " E0 S4 [# D% H) y# b+ |1 T+ ]! O" {
  3342.    (IF (/= RD NIL)  (PROGN (SETQ I 0)
    0 a8 \/ u3 `& X* ]( ?
  3343.    (WHILE (< I SSL) (SETQ M (ENTGET (SSNAME SSET I) ) )  t& s! Q. f/ ^/ o! P* ^0 a
  3344.    (IF (= (CDR (ASSOC '0 M)) "CIRCLE") (PROGN- g# ^9 N" U2 z0 g# m
  3345.   (SETQ M (SUBST (CONS 40 RD) (ASSOC 40 M) M))  (ENTMOD M) ) )  (SETQ I (+ I 1)) )      )   ))) (PRINC) ); S- ^7 D: I/ _0 w' P$ x# D

  3346. 3 e" X$ d3 c+ S& |9 i- y  m; o0 I
  3347. ;;; ============================== TEXT Hight ===============================
    * }/ F$ Y# }$ x% m, z* r" {) R8 h- r3 Y

  3348. + v' E1 J6 Y2 b6 G1 \9 Y
  3349. (defun texthght (/ ent hght)1 X/ U% _; D8 O- q8 A$ h
  3350.   (setvar "cmdecho" 1)2 J* q( x5 k9 p( v" o, ]: }
  3351.   (prompt (strcat"\nSelect text entity with required text height"))0 |; q0 w- {0 A! @( S
  3352.   (prompt (strcat"\n."))& I) R- a) O# r# T) l. q
  3353.   (setq ent (entget (car (entsel))))
    " ?: R9 w5 l- W( c7 V
  3354.   (setq hght (cdr (assoc 40 ent)))3 l2 Q: ?8 t2 {& {3 L! w
  3355.   (prompt (strcat"\nText height now set at "))(prin1 hght)
    ' ?* _$ D+ S) w7 q0 [) c
  3356.   (prompt (strcat"\n.")) 8 h% G' I" Z$ I6 @3 I% N1 ^4 e
  3357.     (setvar "cmdecho" 1)
    & H5 s. V8 h6 F* z
  3358.     (command "DTEXT" PAUSE hght "") ), o/ l$ z9 a7 D
  3359. (defun c:teh () (texthght))  (defun c:texthght () (texthght))& W0 b6 `9 P0 b5 f/ C  }8 `! H1 [( Z
  3360. & O$ O% P5 L. b+ ~; J/ ~$ H
  3361. ;;; ================ BAT -TAT CHE DO GACH CHAN TEXT =================! z& K3 M  b9 d2 C4 p
  3362. 2 p9 F4 x1 L' a. ]) K6 y$ F  M
  3363. (defun c:tuu ()  (setvar "cmdecho" 0)
    5 A7 w% V+ X1 r$ N; n) v
  3364.     (prompt "\nHay chon dong TEXT can gach chan ")* D$ t8 ~" H, Q
  3365.     (prompt "\nSelect objects: ")
    3 L, d0 }9 x2 C5 ?0 g# E
  3366.     (command "select" "au" pause)" p9 Z& C4 [3 ?: t2 W1 A5 ?  E
  3367.     (setq sstxt (ssget "p")
    / J. m* L& J2 ~# u4 p0 o
  3368.           sslen (sslength sstxt)
    / L0 M% n  |8 \& k0 |  I5 O
  3369.           ctr 0    )1 i! I* [! s& g7 q* L4 s8 e. R
  3370.     (command ".undo" "mark")! M8 g' ~. }/ [/ D6 S- @' g; U
  3371.     (while (< ctr sslen)
    ) r* o: ?% _! ^: N& g6 j
  3372.            (setq listxt (entget (ssname sstxt ctr)): A5 j- b( W. P8 z- `
  3373.                  txttxt (cdr (assoc 1 listxt))
    0 M# ^2 @" Z) a
  3374.                  enttxt (cdr (assoc 0 listxt))   )
    9 y( J7 w4 ~3 i5 ~3 ^3 u) o( r; Q
  3375.            (if (= enttxt "TEXT")5 w6 s9 K* g% D6 x4 M; m& g
  3376.                (progn  F. ~3 }9 `( q$ G/ f7 Z% p: ?
  3377.                    (setq testxt (substr txttxt 1 3))
    3 i+ K' a% G8 {$ `/ p
  3378.                    (if (or (= testxt "%%u") (= testxt "%%U"))
    1 B# Z6 q  k/ {) }: c2 b1 O8 D
  3379.                        (setq newtxt (substr txttxt 4))  A" r. \4 `( |+ P" T- u8 O
  3380.                        (setq newtxt (strcat "%%u" txttxt))    )
    * c6 s% [& N) K: F0 H. a
  3381.                    (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt)), {+ i* X8 x: n1 L1 W
  3382.                    (entmod listxt)                ) )
    1 J$ C$ C* A& P; ]4 F. y
  3383.             (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))
    ( [. J! Q9 n# R. l( A! Y  u
  3384. 4 {5 F8 T0 }& a% q, k
  3385. ;;; ================ BAT -TAT CHE DO GACH CHAN TEXT =================
    5 L) m4 P' b2 }/ t' S1 W9 A( W1 [
  3386.   ?9 Z7 V6 [% y3 I: Q
  3387. (defun c:tob ()  (setvar "cmdecho" 0)
    9 G) ?; r" n8 Q% O
  3388.     (prompt "\nHay chon dong TEXT can gach tren dau ")
    ; b- d6 _5 e( o& ~0 R
  3389.     (prompt "\nSelect objects: ")
    " g* }! h1 F8 A; c
  3390.     (command "select" "au" pause)' ~. _+ P" W2 N: f7 z  y) f
  3391.     (setq sstxt (ssget "p")  c! C+ v# t, P1 {& B: w* ]( h
  3392.           sslen (sslength sstxt)
    ' l, F# H# ?+ {: r1 w
  3393.           ctr 0    )
    , P1 d: k5 I" Q, S0 d( N5 x1 b/ L
  3394.     (command ".undo" "mark")0 |' G  g: H/ s; h1 ^  ^  h
  3395.     (while (< ctr sslen)
    1 I9 a& M1 F' N* M
  3396.            (setq listxt (entget (ssname sstxt ctr))
    " ^  g) R0 c+ R
  3397.                  txttxt (cdr (assoc 1 listxt))
    4 O* x' t( l8 ?' ~2 n6 c2 ~& \3 W
  3398.                  enttxt (cdr (assoc 0 listxt))   )
    * ^0 d: O2 v  k) l/ _' E1 O
  3399.            (if (= enttxt "TEXT")
    $ r3 J- l* A7 c0 o
  3400.                (progn
    % _9 @, a: m3 K
  3401.                    (setq testxt (substr txttxt 1 3))& n. _. j  d+ ]) L& p- `2 L# L: O
  3402.                    (if (or (= testxt "%%o") (= testxt "%%o")), T1 H9 Y) D6 g
  3403.                        (setq newtxt (substr txttxt 4))
    0 H: n9 ?& H" N7 w  T/ ~: O
  3404.                        (setq newtxt (strcat "%%o" txttxt))    )
    % i* y# o" J( s' y( \8 x: ^: G
  3405.                    (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))8 W5 |5 f. J. Q, s4 D
  3406.                    (entmod listxt)                ) )  [9 e6 H! ^& X1 Y( D
  3407.             (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))3 r4 u# \  [$ \, C) t2 F' L
  3408. # F" @# u- H& j/ E8 t/ T# a+ [5 m
  3409. ;;; ========================== Tim & thay the TEXT ==========================1 i- K+ K2 ~& A5 I% w! m& R

  3410. 6 |7 c2 z- N3 W
  3411. (defun frstring (str search replace / str1 str2 index find)& L3 p; M: G9 L$ X
  3412. (setq index 0) (while  (<= index (- (strlen str) (strlen search)))  (setq index (1+ index))1 Q0 C- |4 j9 x% d' ~' q
  3413. (setq find (substr str index (strlen search)))  (if (= find search) (progn    (setq str1 (substr str 1 (1- index)))) ?- A4 ~0 [% i$ G. Z
  3414. (setq str2 (substr str (+ index (strlen search))))  (setq str (strcat str1 replace str2)) )  ) ) (setq str str)), X& Y8 X9 ^* T% M  L$ S
  3415. (defun hai (/ dial)7 n" X: t2 O3 `* o/ E& Q7 `- |
  3416. (setq dial (load_dialog "hai.dcl"))       ;;goi dialog& b# x8 b8 h* L& e+ N" v8 p) n: t
  3417. (if (not (new_dialog "find" Dial)) (exit)) ;;1 p' R* i- {9 V" k+ X, [
  3418. (mode_tile "find" 2); Tao dau nhac tai hop thoai6 V8 R4 y+ l) w9 L- p/ h# q
  3419. (action_tile "find" "(hai1)")8 J! H& S. Q) ?
  3420. (action_tile "replace" "(hai2)")3 c" u2 p' L. l1 E/ s
  3421. (action_tile "cancel" "(done_dialog) (exit)")4 O5 ~: V1 ~- D5 v, |
  3422. (start_dialog)      8 M3 O& j! Y4 [  F, p% t
  3423. (unload_dialog dial))
    & x: L5 U/ V  ~! O! |; u6 y, e. W5 g1 x
  3424. (defun hai1 () (SETQ str1 (get_tile "find")))
    ( C0 C% ]2 K: o" |9 N8 |- l
  3425. (defun hai2 () (SETQ str2 (get_tile "replace")))
    8 m% O/ o0 s2 |7 V' h
  3426. 7 S' N  J& e+ t, `
  3427. (defun c:TTT (/ a str str1 str2 newstr taphop sodem)
      @5 s& \; R* ]3 t  O
  3428. (hai)
    5 B4 @! @6 B# ?7 x' N
  3429. (if (or (null str1) (null str2)) (princ "\nDu lieu khong hop le")
    . H5 {& F" h( G) P
  3430.   (progn' r0 j* A7 u6 j: [
  3431.    (setq taphop (ssget '((0 . "TEXT"))))
    / \% ]; m: u3 Q  ~1 ^( a
  3432.    (setq sodem 0)
    4 a# H8 t# j7 Y+ p
  3433.    (if taphop2 M# f+ R. O4 K$ n7 }9 g
  3434.     (progn  n# i4 K) _' d; F' @
  3435.      (Repeat (sslength taphop)! ~& i% L) O2 D
  3436.       (setq a (entget (ssname taphop sodem)))' U- H: D# N$ B7 J
  3437.       (setq str (cdr (assoc 1 a)))7 q+ t1 f1 \2 p$ n  v' T
  3438.       (setq newstr (frstring str str1 str2))
    % a& z$ R  Y0 ]: C( s( c( O
  3439.       (setq a (subst (cons 1 newstr) (assoc 1 a) a))) ]6 G! A* ]. f3 f. Q+ j! y
  3440.       (entmod a)
    4 g$ L/ S% m) r8 Y6 c
  3441.       (setq sodem (1+ sodem))     )    )( C0 k: z, r, |& L/ B" V6 {1 M. d
  3442.     (princ "\nNone "TEXT" selected")   )  ) ) (setq *error* olderr) (princ))
    3 y- A( F$ A" E6 n2 u: U
  3443. 4 j1 q3 K9 n) t) M, Y6 ~( h( B5 p
  3444. ;;;=============================  CHTEXSTY.LSP =============================# W- q  N1 C7 \
  3445. - k- a, R. L# t3 {' X) r7 T; O' X
  3446. (Defun C:TXS () (Setvar "Cmdecho" 0) (Initget 1 "SE ST ")
      q  ?) e$ `" F
  3447. (Setq G (Strcase (Substr (Getkword "STyle/<SElection>:")1 2)))
    / H7 B9 q5 b4 m6 Q
  3448. (Cond ((= G "SE") (Setq A (Ssget)) (Setq B (Sslength A))) `: |2 U, m- |$ v6 q
  3449. (Initget 1) (Setq C (Getstring "\nEnter new text style: "))
      D! `2 ?+ n: i2 d, [' I5 a
  3450. (Extang C) (While (> B 0) (Setq B (1- B)) (Setq D (Ssname A B))
    ( w0 W& c+ ?8 b: K; l; t
  3451. (Setq D (Entget D)) (Setq E (Assoc 7 D)) (Setq F (Cons 7 C))+ C! {; W5 V- y' `) k/ K
  3452. (Setq D (Subst F E D)) (Setq H (Assoc 51 D)) (Setq I (Cons 51 J)): R. D4 b2 N2 f. {& V! H# t: z
  3453. (Entmod (Subst I H D))) (Setq A nil)) ((Or (= G "ST") (= G ""))* E* O6 J. A( I/ @1 X
  3454. (Initget 1) (Setq A (Strcase (Getstring* C* j" s9 L9 f6 S- j, `& ^
  3455. "\nEnter text style to change: "))) (Initget 1)
    1 S8 o( c' b' ]. D' W) `. W
  3456. (Setq C (Getstring "\nEnter new text style: "))(Setq D (Entnext))
    / s: J/ B1 A: s! J  t0 H/ j( q
  3457. (Extang C) (While D (Princ ".") (Setq E (Entget D)) (If. T' F* j4 _" b# U8 ~
  3458. (And (= "TEXT" (Cdr (Assoc 0 E))) (= A (Cdr (Assoc 7 E))))7 r3 a: @. N3 s8 {
  3459. (Progn (Setq F (Assoc 7 E)) (Setq G (Cons 7 C))* x) k+ l! V  E. q5 M' G$ R
  3460. (Setq E (Subst G F E)) (Setq H (Assoc 51 E)) (Setq I (Cons 51 J))$ f9 C; O7 P6 c) g- x/ k
  3461. (Entmod (Subst I H E)))) (Setq D (Entnext D))))) (Princ))
    * N& S; P9 I9 V1 q% H
  3462. , G8 Q$ C$ \2 \$ l& Q( @
  3463. (Defun Extang (A) (Setq A (Tblsearch "STYLE" A))
    5 f9 {% \  S! k
  3464. (Setq J (Cdr (Assoc 50 A))))
    7 o9 _: {( H/ T% h

  3465. % F9 {9 U# T7 ?
  3466. ;;; ============================ DRAW CLOUD =============================/ J( l$ C$ S" m2 ?: ?

  3467. - x# T# m, Z8 R  Q5 Q) ]2 p; E, g
  3468. (defun CLOUD (/ pt1 pt2 arc1 cnt ss la)    (setvar "cmdecho" 0)
    ( S0 i5 f, t. M! u2 T+ q5 I' t
  3469.     (prompt "\nVe cloud (may) khong khep kin - Tu khep kin ve diem dau!")
    $ o. ~9 B3 v4 h( ~7 @2 R$ v* t
  3470.     (setq la (getvar "clayer"))9 F, f8 j+ `8 k1 F# f8 N3 M
  3471.     (command "layer" "m" "cloud" "c" "5" "" "")( Z  E. l0 V- S! ^5 z
  3472.     (setq pt1 (getpoint "\nEnter first point of Cloud: "))7 i) R( W. a) t4 w  X
  3473.     (if pt1 (prompt "\nProceed in a COUNTER-CLOCKWISE direction..."))
    $ S+ _+ \0 {2 Q  {! M/ o
  3474.     (setq cnt 1 ss (ssadd))+ ]/ }2 o3 N: e- \9 {
  3475.     (while pt1 (setq pt2 (getpoint "\nEnter next point - and close: "))4 i5 K2 ]$ j# r  p& {( W7 I
  3476.     (if pt2 (progn (command "arc" pt1 "e" pt2 "r" (/ (distance pt1 pt2) 1.75))7 d1 L2 m# e9 M) w; q# G
  3477.     (if (= cnt 1) (setq arc1 (entlast) cnt 2) (ssadd (entlast) ss)) ))3 h4 V) O* J+ \+ F9 Y
  3478.     (setq pt1 pt2) ) (setvar "highlight" 0) (if (> (sslength ss) 0)
    ! S! _" Q8 Y4 V* C+ \
  3479.     (command "pedit" arc1 "y" "j" ss "" "x"), x3 [( e- v' z7 j. D- S; P
  3480.     (if arc1 (command "pedit" arc1 "y" "x")) ) (setvar "highlight" 1)& S) t4 ^) Q/ i9 G
  3481.     (command "layer" "s" la "")    (setvar "cmdecho" 1)    (princ))  
    , F2 k& K; i( l9 [5 O! @
  3482. (DEFUN C:CLOUD () (CLOUD)) (DEFUN C:CLO () (CLOUD))
    " b7 Z; U0 e! r* I) x* q& Q0 U
  3483. 2 d$ R0 `/ F0 I! a. g+ D: ~( J. l
  3484. ;;; ================================ Funtion-Dulieu ========================/ j! {8 k5 ~* W1 F& k
  3485. ;;; ================================ Funtion-Dulieu ========================
    # E* j: s9 Q; x
  3486. ;;; ================================ Funtion-Dulieu ========================
    : L* q. w) F9 S1 i& ~$ m: l

  3487. ( r0 s0 H7 n$ J( h  j% h6 `
  3488. (defun ha:nhap (kytu thamso) (princ kytu) (princ thamso) (princ ">: ") (setq key (getint)) (if key (setq thamso key)) (princ thamso) )3 [' R9 J# W+ q
  3489. (defun ha:thoat () (reinit) (setq Temp "Da thoat khoi chuong trinh"))" h& r! ^: f5 g# g5 m; r
  3490. (defun khoangcach (kh khq11 khq12 / h0 h1) (setq h1 (polar kh (angle '(0 0) (vectophap khq11 khq12)) 500)) (setq h0 (inters khq11 khq12 kh h1 nil)) (distance kh h0))
    4 l% v- [9 a  L7 t* N% c: t
  3491. (defun hacat (hacat1 hacat2 / hacat3 chon) (if (and (/= hacat1 nil) (/= hacat2 nil)) (progn   (setq hacat3 (polar hacat1 (angle hacat1 hacat2) (/ (distance hacat1 hacat2) 2)))   (setq chon (ssget hacat3))   (command "break" chon hacat1 hacat2)  ) ) (princ) )
    * B1 Z8 v" _- M9 y, M0 r; f' Y
  3492. (defun hauon (hauon1 hauon2) (command "fillet" hauon1 hauon2))9 s6 k: g. l; N4 B$ {4 Q
  3493. (defun init () (setvar "blipmode" 0) (setvar "cmdecho" 0) (setvar "angbase" 0))
    2 ?( i% g0 n7 n6 J8 Q3 h2 J
  3494. (defun reinit () (setvar "cmdecho" 1) (setvar "osmode" 0)): N. D( H7 ^/ q3 @6 h- a3 v
  3495. (defun tichvecto (vecto1 vecto2) (apply '+ (mapcar '* vecto1 vecto2)))- B8 ]* m: S. y; y1 f, ?
  3496. (defun vectophap (v01 v02 / vectochiphuong) (setq vectochiphuong (mapcar '- v01 v02)) (list (cadr vectochiphuong) (* -1 (car vectochiphuong))))
    % J6 l5 ?% @; g% ~
  3497. (defun ha:giaodiem (dc1 p1 p2 / hc hc1 diem1) (setq diem1 (vectophap p1 p2)) (setq hc1 (polar dc1 (angle '(0.0 0.0) diem1) 100)) (setq hc (inters p1 p2 dc1 hc1 nil)))- t# }! D! P3 L4 j1 ?0 F* J
  3498. (defun dtr (dtr) (* pi (/ dtr 180.0)))
    ( y. z1 F6 U! ?/ z" M0 Q. w
  3499. (defun rtd (rtd) (* 180.0 (/ rtd pi)))2 c8 T% V# H7 a4 S1 E( D
  3500. , F" o% A6 o$ q/ O3 o* L
  3501. ;;;==============================PROGRAME===============================" Q; ]9 i; h& M- A' H
  3502. ;;;=====================EditDiM Hien Hop Thoai Dep======================3 ~% |  N- u2 ~: e4 J
  3503. ;;;==============================PROGRAME===============================* h2 R" o8 G' G9 r
  3504. 2 ]# W2 U$ U# c& C
  3505. ;;Dth Edit Text, Dimtex & Attributes(Chu Co Thuoc Tinh)
    5 g& f. w0 H! ?! i
  3506. ;;Chay Cung Du Lieu.Lsp & Hai.Dcl& k, G3 w, o# J# c5 \
  3507. (Defun Hai_Edim (Chon / Dial State Str Oldlis Dimdefault Pt10 Pt13 Pt14 St Ang Dis Pt Hc)! c8 b, q2 V) ?) X% A  {) K# e
  3508.   (Setq Oldlis (Entget (Car Chon))
    ; N. _5 A' W- ?: ]/ a
  3509.         Pt10 (Cdr (Assoc 10 Oldlis))$ r- a3 F, n7 [' @0 i- r
  3510.         Pt13 (Cdr (Assoc 13 Oldlis)); E# v0 o$ W) g" u
  3511.         Pt14 (Cdr (Assoc 14 Oldlis))
    " ~8 S0 }& |7 R9 J" y! ?% Y
  3512.         St  (Cdr (Assoc 70 Oldlis))/ X- \$ d5 P. L2 Q  p9 |1 v
  3513.         Dimdefault (Cdr (Assoc 1 Oldlis))
    , x- I% M2 a% V
  3514.         )9 P! t; `4 K( Q/ _" Y; o6 C6 C
  3515.   (Cond  o1 t5 z+ e8 _% }, [; ?; p; n
  3516.     ((Or (= 32 St)(= 0 St)(= 160 St))  I: G: a7 T7 t3 }+ p
  3517.      (Progn
    + u/ I) G4 R$ U. H3 Q
  3518.        (Setq Ang (Cdr (Assoc 50 Oldlis))
    ) X1 K7 {( j) B0 |: t9 G, b* Z
  3519.              Pt (Polar Pt13 Ang 500)
    7 o0 O% q  ^4 m. k
  3520.              Hc (Lay_Hinh_Chieu Pt10 Pt13 Pt)
    ' s/ R5 X4 o6 s
  3521.              Dis (Rtos (Distance Pt13 Hc))( Q! ^2 c/ X1 V7 Q+ \% ]8 i
  3522.              )
    # ?5 E% V! k% v" G
  3523.        )
      S  f" p& c; y! t
  3524.      )
    ( [  k' _& j! D) ]( A. ~3 ?
  3525.     ((Or (= 33 St)(= 1 St)), K1 K  L; E+ A; b9 ~3 H
  3526.      (Progn(Setq Dis (Rtos (Distance Pt13 Pt14)))))1 g+ \& p; ~0 N$ N6 V" t& q
  3527.     );;End Cond' b6 Z) a0 ?: e6 \! J  O( l
  3528.   (If (= Dimdefault "") (Setq Dimdefault "<>"))- z" F8 F$ n4 t  B7 N6 }, G8 P
  3529.   (Setq Dial (Load_Dialog "Hai.Dcl"))7 F' _8 G- ~1 Y8 M2 X2 }
  3530.   (If (Not (New_Dialog "eddim" Dial)) (Exit))8 Y6 X' ]: m) I) U
  3531.   (If (Or (= 32 St)(= 0 St)(= 160 St)(= 33 St)(= 1 St))4 I- o0 D/ ]9 {
  3532.     (Set_Tile "text" Dis))
      i; k5 O! y) h' M2 N
  3533.   (Set_Tile "ha:edim" Dimdefault)
    5 A5 Y: L% N4 s
  3534.   (Mode_Tile "ha:edim" 2); Tao Dau Nhac Tai Hop Thoai3 K' u7 I: e' L* ?2 V. O
  3535.   (Action_Tile "ha:edim" "(Setq Str (Get_Tile \"ha:edim\"))(Done_Dialog 3)")
    , r  c  R9 Q, @1 q4 L; B
  3536.   (Setq State (Start_Dialog))(Unload_Dialog Dial)1 S4 |( s1 Q% c( o
  3537.   (If (And Str (= 3 State))
      a0 c7 ?) w% U5 E" F) G
  3538.     (Progn
    : g" x: S" b9 X8 E* R1 Y( u8 @5 f
  3539.       (Setq Oldlis (Subst (Cons 1 Str) (Assoc 1 Oldlis) Oldlis))(Entmod Oldlis)))4 z  x5 [+ n. Z3 Z3 b( t
  3540.   )6 z2 g2 ^# f, P* s
  3541. (Defun C:EH (/ Chon Name )
    , v9 Y5 X$ E% M* M
  3542.   (Defun *Error* (Msg)
    9 e! P! G) S0 L9 N
  3543.     (Princ "\nerror: ")(Princ Msg)(Princ "  "), f& Q) p6 b8 O0 D  D. \: e* G* f! h
  3544.     (Start_Dialog)(Unload_Dialog Dial); _# r5 Z& A4 Q0 q% ]1 K
  3545.     (Setq *Error* Olderr)(Princ), V$ S6 Y  g+ P1 W
  3546.     )
    ; V: e/ @$ c& V
  3547.   (Setq Olderr *Error*)
      w  U. V! P; L' m. C0 M/ A2 F# P
  3548.   (Setq Chon T)" e' j+ q1 W8 g. d4 |4 h
  3549.   (While Chon  |6 F7 {7 ]1 P/ A$ d
  3550.     (Setq Chon (Entsel "\n\n\nSelect Text, Dimtext Or Attributes To Edit..."))
    $ x( t& d7 o, u
  3551.     (If Chon( D, i4 J/ U( N
  3552.       (Progn6 j9 p' m2 i! Y2 O8 ^' `' _
  3553.         (Setq Name (Cdr (Assoc 0 (Entget (Car Chon)))))
    7 ~1 n( w9 _  ]% f2 t1 E  ?
  3554.         (Cond
    7 Z7 j; v( z. D  B6 N2 b- X5 E
  3555.           ((= Name "INSERT")(Command "Ddatte" Chon))! t; o2 f. L5 K! Z  @
  3556.           ((Or (= Name "TEXT") (= Name "ATTDEF") (= Name "TOLERANCE") (= Name "MTEXT"))(Command "Ddedit" Chon ""))
    4 b7 o, Y" ^5 C, ~- m
  3557.           ((= Name "DIMENSION") (Hai_Edim Chon))
    / {) ~* f7 O: }( L$ d
  3558.           )
    ; {' m+ Z# u0 |+ D. Q# r
  3559.         );End Cond. A* `+ J/ }7 R0 y
  3560.       );End Progn
      X+ g, w, F+ R/ m
  3561.     );End While
    : Q  K' y7 u: t' Q; X7 I  P
  3562.   (Setq Olderr *Error*)(Princ)/ d5 T, Z9 X5 L  W4 K, ?
  3563.   );End Program( j* n6 ^( [2 U1 @
  3564. + t# O2 Y* e$ _0 l5 s. d8 U) e
  3565. ;;;====================DDeditDim=====================: m) G1 G$ r, t8 N$ L
  3566. ;;;=====================Hai.DCL======================/ a* f; ~; r7 ]. P6 t+ g# V+ D3 g
  3567. ;;;====================DDeditDim=====================
    - B. Q' t1 ]1 I, m. g4 X
  3568. 6 l' v( i; h% H- [2 L
  3569. ;;Dth Edit Text, Dimtex & Attributes(Chu Co Thuoc Tinh)
    2 Q7 ~( N( ]5 P8 P- Y3 h
  3570. ;;Chay Cung Du Lieu.Lsp & Hai.Dcl& A6 I( i+ `! U6 t/ q) b+ q
  3571. (Defun Hai_Edim (Chon / Dial State Str Oldlis Dimdefault Pt10 Pt13 Pt14 St Ang Dis Pt Hc)" ]% O6 M" p* m* J2 ^
  3572.   (Setq Oldlis (Entget (Car Chon))
    4 O2 Y6 I& a, o, H3 g, R
  3573.         Pt10 (Cdr (Assoc 10 Oldlis))
    9 s! _/ t7 j( H6 e) R# j3 c
  3574.         Pt13 (Cdr (Assoc 13 Oldlis))) r" A# s6 }9 Q& K9 q" q
  3575.         Pt14 (Cdr (Assoc 14 Oldlis))
    ) C' Y0 ~. m+ @; K7 [! e7 Y+ x
  3576.         St  (Cdr (Assoc 70 Oldlis))
    ( \- u& k9 B7 Y5 F
  3577.         Dimdefault (Cdr (Assoc 1 Oldlis))5 x2 p4 i$ p9 ~; M; ~0 ?' t
  3578.         )# ]( d0 P4 v- U- P
  3579.   (Cond
    : Y8 U$ p) ^) S. R' S
  3580.     ((Or (= 32 St)(= 0 St)(= 160 St))
    3 X# H! F& C! x- x4 W
  3581.      (Progn
    # A6 Y! T6 j9 N! |+ s- U
  3582.        (Setq Ang (Cdr (Assoc 50 Oldlis)), z- _) Y/ P, q: b3 f. t
  3583.              Pt (Polar Pt13 Ang 500)6 m7 P: p- i' R2 }/ A
  3584.              Hc (Lay_Hinh_Chieu Pt10 Pt13 Pt)& e6 m4 N+ {* }' J. o/ R3 S
  3585.              Dis (Rtos (Distance Pt13 Hc))
    $ Z! K3 L+ o: I4 D! F0 P
  3586.              )
    ) P$ p$ m" Y; G6 A( C
  3587.        )& X' h" `( s3 c
  3588.      )$ g2 l1 }& _5 |* ^, u2 M6 s
  3589.     ((Or (= 33 St)(= 1 St))9 [0 U8 x. _! \
  3590.      (Progn(Setq Dis (Rtos (Distance Pt13 Pt14)))))
    $ p( Z* O7 K5 U/ F
  3591.     );;End Cond
    6 U3 n% f( n1 m1 X0 }% @
  3592.   (If (= Dimdefault "") (Setq Dimdefault "<>"))
    % R2 g: o, C# a$ V
  3593.   (Setq Dial (Load_Dialog "Hai.Dcl"))2 n9 D  ]3 _+ Q; V1 _
  3594.   (If (Not (New_Dialog "eddim" Dial)) (Exit))5 H1 u# y, e5 t* y5 w) s
  3595.   (If (Or (= 32 St)(= 0 St)(= 160 St)(= 33 St)(= 1 St))4 T, j5 v2 f) {# @* @! h1 S
  3596.     (Set_Tile "text" Dis))
    ! Q, ^2 |1 ~$ U2 A7 ~0 |
  3597.   (Set_Tile "ha:edim" Dimdefault)! ]/ _: r' p; Y! z- [# U5 F
  3598.   (Mode_Tile "ha:edim" 2); Tao Dau Nhac Tai Hop Thoai
    . N! g) a. Q- A! j, V
  3599.   (Action_Tile "ha:edim" "(Setq Str (Get_Tile \"ha:edim\"))(Done_Dialog 3)")2 o3 e' c3 Y8 B/ i+ y% B
  3600.   (Setq State (Start_Dialog))(Unload_Dialog Dial)
    9 n/ E- e, N& k
  3601.   (If (And Str (= 3 State))1 }4 i7 ]4 W8 u& x; a/ n' Z% Z$ ~
  3602.     (Progn$ o# V2 i. q( r
  3603.       (Setq Oldlis (Subst (Cons 1 Str) (Assoc 1 Oldlis) Oldlis))(Entmod Oldlis)))4 G/ \% W' A6 ?/ q8 @$ w
  3604.   )% o; [% x1 q3 s5 g
  3605. (Defun C:EH (/ Chon Name )
    9 H) t7 `: @4 M8 l

  3606. ! L% V. s' j6 x/ N# u) t
  3607. ;;;********************Du Lieu********************
    8 v8 b8 S8 `3 P* V
  3608. ' W; M, V1 j' Q. N% l" G2 N& X8 i
  3609. (Defun Ha:Thoat () (Reinit) (Setq Temp "Da Thoat Khoi Chuong Trinh"))
    1 W! u# l: j4 N# t
  3610. (Defun Hacat (Hacat1 Hacat2 / Hacat3 Chon)
    9 }1 \8 N& O8 C! F. A/ O6 K5 I
  3611.   (If (And (/= Hacat1 Nil) (/= Hacat2 Nil))
    / E- ~. J" B# S  v* V- j# N2 Q
  3612.     (Progn$ z. U. D. @. l& p0 f/ m
  3613.       (Setq Hacat3 (Polar Hacat1 (Angle Hacat1 Hacat2) (/ (Distance Hacat1 Hacat2) 2)))/ n) X! g; d. q
  3614.       (Setq Chon (Ssget Hacat3))
    ) V3 s) B" S/ |5 D! R3 H9 h3 s
  3615.       (Command "Break" Chon Hacat1 Hacat2)" x0 Y) H5 o; ~3 I8 E, V+ N5 z2 i
  3616.       ): ^5 V: U- F1 R& k8 e" C" g0 z
  3617.     )
    5 y5 r0 u( ^+ N3 t  R1 g, }
  3618.   (Princ)
    4 k3 e: M+ A  J
  3619.   )! M/ Y* ~5 I$ K, r
  3620. ;;
    , W  _6 Z# D( X" k3 C. O! @% T
  3621. (Defun Hauon (Hauon1 Hauon2)(Command "Fillet" Hauon1 Hauon2))3 D% E7 k: m+ s: W9 |
  3622. ;;; X+ A+ H) R( _( n
  3623. (Defun Taolop (Mau Lop / A)(Setq A(Tblsearch "Layer" Lop))(If (Null A)(Command "Layer" "_N" Lop "_C" Mau Lop "")) (Setvar "Clayer" Lop))$ N8 D- U0 v+ ^) ~# Y
  3624. ;;. O2 D7 P: m4 o& ]& o& D& K0 o( r3 O
  3625. (Defun Init ()(Setvar "Blipmode" 0)(Setvar "Cmdecho" 0)(Setvar "Angbase" 0))
      ~3 y" c0 \' S+ F* J
  3626. ;;
    8 ?( o: a- g' s  S0 ?
  3627. (Defun Reinit ()(Setvar "Cmdecho" 1))
    3 z. C' C! G& p: k
  3628. ;;
    . N8 `3 j4 {! D5 ]( u& l5 t
  3629. (Defun Tichvecto (Vecto1 Vecto2)(Apply '+ (Mapcar '* Vecto1 Vecto2)))
    0 {0 ]# n5 X- A0 `
  3630. ;;
    ; U/ z/ V: F: `/ }" p
  3631. ;;Cho 2 Diem Tinh Ra Vec To Phap; U6 q+ }: A5 U& J- j; |% B
  3632. (Defun Vectophap (V01 V02 / Vectochiphuong)(Setq Vectochiphuong(Mapcar '- V01 V02)) (List (Cadr Vectochiphuong) (* -1 (Car Vectochiphuong))))
    + A- ~/ U2 h, J: N* @, Q) O1 k
  3633. ;;Xac Dinh Vi Tri Hinh Chieu 1 Diem Len 1 Duong Thang- G5 ?: B4 H/ d7 ]/ W4 s( d
  3634. ;;Da Biet 2 Diem Thuoc Duong Thang
      f+ F  ^. [, X4 H/ D/ p
  3635. (Defun Lay_Hinh_Chieu (Dc1 P1 P2 / Hc Dc2)
    4 R/ V! o) G6 P: X
  3636.   (Setq Dc2 (Polar Dc1 (+ (/ Pi 2) (Angle P1 P2)) 100)) t) u0 ~) W% T2 |9 v: |7 Z! |* P
  3637.         Hc (Inters P1 P2 Dc1 Dc2 Nil)))
    ; ?3 t! i0 y+ V  `# l6 B$ }
  3638. ;;Xac Dinh Khoang Cach Tu 1 Diem Len 1 Duong Thang- O& b8 {+ X5 J" G4 n) P" X- r# q
  3639. ;;Da Biet 2 Diem Thuoc Duong Thang* w+ V4 b8 t" l# K
  3640. (Defun Khoangcach (Dc1 P1 P2 / Dc2 Hc)
    3 N% ~2 @/ i' d: {
  3641.   (Setq Dc2 (Polar Dc1 (+ (/ Pi 2) (Angle P1 P2)) 100)5 w8 i5 X+ d" D, f
  3642.         Hc (Inters P1 P2 Dc1 Dc2 Nil))
    % c2 j- E8 m2 q8 O
  3643.   (Distance Dc1 Hc): r5 x. d, x5 z/ O& A
  3644.   )
    8 c( A' _, [! B1 V5 f
  3645. (load "nhapcua.lsp")
    1 m1 b! Z6 o& v  n, H
  3646.   (Defun *Error* (Msg)
    $ v3 N9 H* y# ^
  3647.     (Princ "\nerror: ")(Princ Msg)(Princ "  ")
    & Q" a+ Y. X) ]0 H# g
  3648.     (Start_Dialog)(Unload_Dialog Dial)& X- ~" N2 [6 c3 t7 @" E
  3649.     (Setq *Error* Olderr)(Princ)
    , B+ b4 K, T2 x5 [- o3 S' V
  3650.     )
    3 r3 ~! C3 N" Y* [' o
  3651.   (Setq Olderr *Error*)! {( @, l/ p1 L5 l5 K2 B1 J
  3652.   (Setq Chon T)" |# ]  \" j, D% ^: H" g
  3653.   (While Chon) @; k6 C) \) g
  3654.     (Setq Chon (Entsel "\n\n\nSelect Text, Dimtext Or Attributes To Edit...")), u! B/ [7 d9 z, C1 H8 [! N
  3655.     (If Chon
    . R0 u  S* @4 U
  3656.       (Progn
    1 U% O) K& f6 c  M1 _' b# Q
  3657.         (Setq Name (Cdr (Assoc 0 (Entget (Car Chon)))))
    5 Z! k6 k. {: f* g1 `
  3658.         (Cond2 c5 E) ?, A2 \; ]9 W/ @. v) h* Q  L
  3659.           ((= Name "INSERT")(Command "Ddatte" Chon))! X& J! L, o% ]4 `! ~* |  k
  3660.           ((Or (= Name "TEXT") (= Name "ATTDEF") (= Name "TOLERANCE") (= Name "MTEXT"))(Command "Ddedit" Chon ""))8 T3 y. W: M5 B4 e. ^
  3661.           ((= Name "DIMENSION") (Hai_Edim Chon))9 i# x+ w  |8 o
  3662.           )
    3 ^2 w2 X: c) V/ E' D$ t
  3663.         );End Cond: C4 P: u6 [0 k- [" a, r' l
  3664.       );End Progn
    * f8 u3 h( _& y: \5 {2 z
  3665.     );End While1 v5 R; o1 J( ^1 L) q+ `
  3666.   (Setq Olderr *Error*)(Princ)
    # w$ n4 s2 w# {4 c
  3667.   );End Program7 w# d1 J+ L1 W& U

  3668. - i$ u4 p5 q/ q
  3669. ;===================HAI DCL Nhapcua.LSP De chay Hop Thoai EditDiM===================$ P" u8 S' @# d9 O
  3670. ;====================================Nhapcua.LSP====================================9 X2 j: x5 ^* L7 E. ?: U
  3671. ;===================HAI DCL Nhapcua.LSP De chay Hop Thoai EditDiM===================
    2 B7 W% @$ [4 R- [: @4 `
  3672. : X9 m' j8 M3 `' G" x: y0 f

  3673. 4 D1 C$ ?' D+ U6 }# ^! n5 V
  3674. 0 m) m# n2 M: K" w: r/ _
  3675. ;*******************;*******************;*******************;*******************3 z1 f6 _7 B) R: e' `. h( Z* H/ S- E$ `
  3676. ;****K E T C A U****;****K E T C A U****;****K E T C A U****;****K E T C A U****
    : L6 j* t8 V  C/ i
  3677. ;*******************;*******************;*******************;*******************) ]  y+ k2 `' t" k2 b" w3 J( a: @5 i8 ?

  3678. # J: }9 A9 V, O+ l8 C; q
  3679. ;VE HINH BINH HANH3 b9 f. n9 _# j/ t9 m3 u+ ?
  3680. - ^' [6 Q0 u. h+ W3 O" E
  3681. (defun c:binhhanh (/ p1 p2 p3)
    * v7 g5 l1 G$ D4 u. g: T4 v& l+ p( ^
  3682. (setq p1 (getpoint "\n Nhap diem thu nhat:"))
    % T- L- @' G/ `: f  Q/ v
  3683. (setq p2 (getpoint p1 "\n Nhap diem thu hai:"))
    : s* T8 d- @% ~  K* E
  3684. (setq om (getvar "osmode"))6 D& v( X4 S! v+ g2 R3 g
  3685. (setvar "osmode" 0)
      y) Y& I4 X1 H. i* L1 ]7 Q% W: @
  3686. (command "line" p1 p2 "")( a% [$ B7 Q2 g8 `( y
  3687. (setvar "osmode" om)% G6 w+ [3 F4 A, a5 D: X8 j
  3688. (setq p3 (getpoint p2 "\n Nhap diem thu ba:"))5 F9 o' ~) l& \- b
  3689. (setq a (angle p2 p1))) P4 V+ t7 S  @
  3690. (setq d (distance p1 p2))5 V6 c* T1 {8 v. w, ^9 _# Q
  3691. (setq p4 (polar p3 a d))1 u  G6 |/ i$ S: f: x$ t& j7 ?
  3692. (command "OSNAP" "none")
    0 f% ~7 T5 ~) Y' l" o
  3693. (command "erase" "l" "")
    4 c' y9 D. u* a; u8 E" i  R
  3694. (command "pline" p1 p2 p3 p4 p1 "")8 S, e0 f% l; R$ q2 ]: `3 [# k
  3695. (setvar "osmode" om)
    ; y. `7 \' Y8 I& A
  3696. ), m5 q; H8 i! l( \; n( [' y8 M! S1 f2 T$ M
  3697.   ~2 ?( r& J5 a
  3698. ;VE LUOI COT
    1 R# n# n2 D3 a6 \5 V
  3699. ! [* l; @% p" x1 Q
  3700. (defun c:LuoiCot ()' D/ ^( L2 g  |5 _; Z! K9 [/ O
  3701. (setq om (getvar "osmode"))
    + \  J: l3 {* q, h7 ]8 T/ L
  3702. (setvar "osmode" 0)% f( D( S9 H" p* [7 `# z- M
  3703. (setq tile (getreal "\nCho biet Ti Le ve 1/x, x="))
    ( O1 Y. ~  R% Y4 F- Y5 H
  3704. (setq p0 (getpoint "\n Chon Basic Point:"))
    / z' F; y% w" ^! h! |7 D
  3705. (setq nc (getreal "\n Nhap chieu ngang cua cot : "))
    ( \$ [7 c2 \- ?) W9 z
  3706. (setq dc (getreal "\n Nhap chieu doc cua cot : "))! n% j4 L, p$ B3 ~
  3707. (setq p1         (polar         (polar p0 pi (/ (* nc hstl) 2 tile) )    (* pi 1.5)    (/ (* dc hstl) 2 tile)  )  )8 [% S! C9 E; {6 b% Y* y% U
  3708. (setq p2         (polar         (polar p0 0 (/ (* nc hstl) 2 tile) )    (* pi 0.5)    (/ (* dc hstl) 2 tile)  )  )# \& E7 {6 @: B  P# @
  3709. (command "rectang" p1 p2)
    " q. P# j- a; X- m
  3710. (command "hatch" "solid" "l" "")3 I# a3 p5 a  z+ v
  3711. (setq bcn (getreal "\n Buoc cot theo phuong ngang : "))
    7 f/ o1 }/ J3 _; c# C
  3712. (setq nn (getint "\n So buoc cot phuong ngang : "))
    , `- K/ c2 @# F  D7 Q
  3713. (setq w1         (polar         (polar p1 pi (/ (* nc hstl) 2 tile) )    (* pi 1.5)    (/ (* dc hstl) 2 tile)  )  )# z8 x7 m8 S8 J) d
  3714. (setq w2         (polar         (polar p2 0 (/ (* nc hstl) 2 tile) )    (* pi 0.5)    (/ (* dc hstl) 2 tile)  )  )/ P7 A7 w) U2 b$ M+ j2 |0 z
  3715. (command "select" "w" w1 w2 "")
    " ?9 P+ C4 H) p& L' J1 w5 V9 h9 y
  3716. (command "array" "p" "" "r" "1" (+ nn 1) (/ (* bcn hstl) tile) )5 q$ l6 c3 C; a! ], D- F
  3717. (command "line" (polar p0 pi (/ (* 1000 hstl) tile)) (polar p0 0 (/ (* (+ (* bcn nn) 1000) hstl) tile) ) "")
    * u8 k0 l. \- s0 l% M1 h
  3718. (setq w1 (polar (polar p0 pi (/ (* hstl 2000) tile)) (* pi 1.5)  (/ (* hstl 2000) tile) ))0 D  v; Y$ S& C" s8 P
  3719. (setq w2 (polar (polar p0 0 (/ (* (+ (* bcn nn) 2000) hstl) tile) ) (* pi 0.5)  (/ (* hstl 2000) tile) ))' K- c3 A! f4 |" R: P# S
  3720. (command "zoom" "w" w1 w2)
    0 U, E/ [) f5 ^) ~8 `' q6 M/ X
  3721. (command "select" "w" w1 w2 "")
    5 [. O+ X( N2 U& a% k
  3722. (setq bcd (getreal "\n Buoc cot theo phuong doc : "))
      D/ n; g: H4 \& y
  3723. (setq nd (getint "\n So buoc cot phuong doc : "))
    $ L& ?1 r% E" K4 `
  3724. (command "array" "p" "" "r" (+ nd 1) "1" (/ (* hstl bcd) tile) )
    ! x3 |" c9 J9 g3 z% M! h
  3725. (command "line" (polar p0 (* pi 1.5) (/ (* hstl 1000) tile))  (polar p0 (* pi 0.5)  (/ (* (+ (* bcd nd) 1000) hstl) tile))  "")2 G' i! A* h( t: Z5 b
  3726. (command "array" "l" "" "r" "1" (+ nn 1) (/ (* hstl bcn) tile) )% m" @$ z4 M; ?6 ]
  3727. (setq w2 (polar w2 (* pi 0.5) (/ (* (+ (* bcd nd) 2000) hstl) tile))  )  6 k9 ]8 a# @4 G4 `+ z
  3728. (command "zoom" "w" w1 w2)
    " R1 @& ^3 `) q4 @7 t
  3729. (setvar "osmode" om)
    - T/ p* S3 f( x$ v4 _4 b
  3730. )+ t' i6 b$ B3 L  Y# ]+ U
  3731. 9 s0 ]7 X+ N7 O2 Q. o$ W0 A
  3732. ;VE CUA DI
    : C2 X# F0 H7 z) H( @6 m5 {- ^# O
  3733. / P6 T5 M& R! Y% X
  3734. (defun c:cuadi ()3 |/ z" H" Q5 |
  3735. (setq om (getvar "osmode"))" x! o0 h& ?2 D# j; d+ X* |9 e
  3736. (setvar "osmode" 0)9 E3 k) g8 R" G; ]; U7 G
  3737. $ D) l1 C$ ^, |8 Y; V; R' I
  3738. (setq tile (getreal "\nCho biet Ti Le ve 1/x, x="))
    5 g1 ?/ S- W. @7 {( ^; j
  3739. (setq b (getreal "\n Nhap be rong cua : "))
    + C2 y6 D( Z5 n$ C  e( @+ S& K
  3740. (setvar "osmode" om)5 t0 x) l8 n  Z2 B* N) c
  3741. (while (< 0 1)6 C6 V& s5 A2 N! i$ k( M2 l& h; m
  3742. (progn
    + H; c* O" d' h9 u) J+ `( H0 M
  3743. (setq p0 (getpoint "\n Chon Basic Point:"))- ?/ m. w) K$ E; \
  3744. (setq p1 (getpoint p0 "\n Chon diem de xac dinh huong cua cua:"))4 n6 q% a* {6 d- h/ I# ^
  3745. (command "osnap" "none")
    ( E+ x2 a3 E( g6 s8 `
  3746. (setq p2 (getpoint p0 "\n Chon diem de xac dinh huong mo cua:"))! c( _* G" u  N# f, [. V# U
  3747. (setq a1 (angle p0 p1))
    0 D. J  e  f- n9 q
  3748. (setq p1 (polar p0 a1 (/ (* hstl b) tile)))
    ( e: q3 A# a& p- E. D& h; J
  3749. (setq a2 (angle p0 p2))
    4 A4 s) v0 l5 Y& \0 Q* M8 f
  3750. (if (< (- a2 a1) pi) (setq a3 (+ (/ pi 2) a1)) (setq a3 (- a1 (/ pi 2))) )
    1 a7 l1 I, ^' m$ I6 @0 Y; r2 j
  3751. (command "pline" p0 "w" "0" "0" p1 (polar p1 a3 (/ (* hstl 40) tile)) (polar p0 a3 (/ (* hstl 40) tile)) p0 "")
    ' V7 ?* i/ \' e
  3752. (command "rotate" "l" "" p0 (/ (* (- a3 a1) 180) pi))2 J0 M5 T2 n- d1 {6 M
  3753. (command "arc" "ce" p0 p1 "a" (/ (* (- a3 a1) 180) pi)) ) P6 S$ f' I* V" V& h8 y" a4 F
  3754. (setvar "osmode" om)* f% Q4 N0 d( t, n, M- Q, X
  3755. ))
    2 u$ k" {: ~1 w* b# q* l% g, r9 T
  3756. )0 g+ v6 u3 Z2 ~

  3757. / C, T+ e0 }/ w+ D+ J. I8 b  H
  3758. ;VE CUA SO
    ) R2 R- i7 m& M5 B

  3759. / f7 E9 P/ _5 H. H, t9 ?
  3760. (defun c:cuaso ()/ @3 M/ w7 I: F% C- K
  3761. (setq om (getvar "osmode"))% W" r% P/ |) t$ L3 u1 ^
  3762. (setvar "osmode" 0)
    ; \6 @4 X8 V  a1 V- Y% o
  3763. ; {0 ~6 O) L, z& l& a
  3764. (setq tile (getreal "\nCho biet Ti Le ve 1/x, x="))
    % H$ N( I- C! z: }
  3765. (setvar "osmode" om)4 n1 n3 d& F' o1 M
  3766. (while (< 0 1); C# D' z# K0 @
  3767. (progn
    " Q& t) y+ G3 M9 k
  3768. (setq p0 (getpoint "\n Chon Basic Point:"))
    % B+ c; ]6 |' c" i7 N
  3769. (setq p1 (getpoint p0 "\n Chon diem de xac dinh be rong cua:"))
      t/ {8 m( C6 B: s! |9 G; h
  3770. (command "osnap" "none")
    1 X1 J" t6 r# q$ r
  3771. (setq p2 (getpoint p1 "\n Chon 1 diem o trong nha de xac dinh huong cua so:"))/ R# X2 n% n# _4 T1 j- U
  3772. (setq b (distance p0 p1))( \. G9 b- j; l  K
  3773. (if (< b  (/ (* hstl 600) tile)) (setq du 50))
    5 P; U% p% L! I/ ^( C; w
  3774. (if (> b  (/ (* hstl 600) tile)) (setq du 150))! Y, `4 q8 h; Z/ q4 ~4 M& s
  3775. (if (> b (/ (* hstl 1800) tile)) (setq du 200))
    % d/ J9 i" ?+ N' h  e, w
  3776. (setq a1 (angle p0 p1))4 w  q4 }) |, Q8 V7 _3 b
  3777. (setq a2 (angle p0 p2))
    + l; u8 ~3 D; H* R# \3 A5 v0 j; Q
  3778. (if (> a2 pi) (setq a2 (- a2 (* pi 2)) )  ); g! @0 e1 Z/ V& F/ j% q
  3779. (if (> (- a2 a1) 0) (setq a3 (+ (/ pi 2) a1))  )1 p$ y* K! D$ g
  3780. (if (> (- a1 a2) 0) (setq a3 (- a1 (/ pi 2)))  )4 \6 c% i2 c, ?% R
  3781. (command "pline" p0 "w" "0" "0" p1 "")
    , I6 e: ?+ c, K* D, f" P8 D
  3782. (command "pline" (polar p0 a3 (/ (* hstl 50) tile)) (polar p1 a3 (/ (* hstl 50) tile)) "")
    : ?7 i  D8 |* d! \8 R
  3783. (command "pline" (polar p0 a3 (/ (* hstl 100) tile)) (polar p1 a3 (/ (* hstl 100) tile)) "")
    9 U$ {1 M: B" P( C: f' D
  3784. (command "pline" (polar p0 a1 (* (- du) (/ hstl tile))) (polar (polar p0 a1 (* (- du) (/ hstl tile))) a3 (* -100 (/ hstl tile))) 2 v* D  `: B* d# u# u; l
  3785.                 (polar (polar p1 a1 (* du (/ hstl tile))) a3 (* -100 (/ hstl tile))) (polar p1 a1 (* du (/ hstl tile))) "")
    + T8 D0 w5 D2 I  M
  3786. (setvar "osmode" om)% K2 N* h) @$ M* F# z4 ]! s
  3787. ))  l6 m7 M, s7 z) l0 J+ j1 v( v! x
  3788. )% L9 B9 \' S& F; [# T* Q' R. K

  3789. # L' f; V, ?1 K4 J1 D) \
  3790. ;;;=== General Utility Functions ===, @$ [9 U6 f$ ?# B- F9 y
  3791. 9 r& r  \; e) z. Z- }
  3792. ;   R12 compatibility - In R12 (acad_helpdlg) was an externally-defined
    * W' r9 O6 S+ {  D+ e2 k1 V) Z
  3793. ;   ADS function.  Now it's a simple AutoLISP function that calls the
    - Y8 [1 N4 J1 z
  3794. ;   built-in function (help).  It's only purpose is R12 compatibility.  
    & r# D9 K" h- s- F# s, K& ^8 v+ @
  3795. ;   If you are calling it for anything else, you should almost certainly
    # l3 V7 V2 h! @) n" i2 f' ~
  3796. ;   be calling (help) instead. ' U- m- i2 Y; J( [+ D

  3797. ) q; x; b+ ^7 n% c
  3798. (defun acad_helpdlg (helpfile topic)
    , F5 h. `- O7 w8 }3 ?
  3799.   (help helpfile topic)$ h( W" g: P3 h9 @% w2 f  Q  T
  3800. )
    + {' G0 m  ]% }

  3801. & I, t; o  e0 ]1 i
  3802. 4 u- B1 u* Z3 L4 t. i% v1 ~
  3803. (defun *merr* (msg)
    + ~: p  ?; M; f) j6 Z7 a6 k/ E
  3804.   (setq *error* m:err m:err nil)
    . ]9 ^  c( @3 Z$ f4 \) T+ Y
  3805.   (princ)1 J  g: ]# j: i5 Z$ M
  3806. )! N) F  ^: V9 \4 ]. Z7 P2 O/ d

  3807. 6 V, o  N  b( g% W
  3808. (defun *merrmsg* (msg)( Q# o  \) F8 R3 b
  3809.   (princ msg)/ I+ i, Z3 r% G: s  }& K
  3810.   (setq *error* m:err m:err nil), j/ H" `1 G+ a+ S. A( u
  3811.   (princ)' Q, A* _+ V! j1 D4 L
  3812. )
    2 W5 I! D' `; o- o* W2 D  Y

  3813. 1 u. r5 e( Y; y7 V3 s
  3814. ;; Loads the indicated ARX app if it isn't already loaded8 Q) q: A1 b6 g% U
  3815. ;; returns nil if no load was necessary, else returns the
    % L$ n; v+ ~4 B- d! F8 m
  3816. ;; app name if a load occurred.
    , J8 c" c4 {. A: x
  3817. (defun verify_arxapp_loaded (app) ' z" g$ ?, J+ ?
  3818.   (if (not (loadedp app (arx)))
    2 \/ Q/ w9 {3 ^( w1 a! |) K
  3819.       (arxload app f)
    ) d9 i# @  X6 |
  3820.   )
    ) m' y- M4 i% K) l( P3 R
  3821. )
    $ e2 q; {+ ?2 Z

  3822. " N6 |' J" G9 v& Y: r* c8 q0 o4 G
  3823. ;; determines if a given application is loaded...
    4 s/ b7 H7 L  A+ k8 a; w
  3824. ;; general purpose: can ostensibly be used for appsets (arx) or (ads) or....# M& W! n& s+ ]% N+ l7 x$ s
  3825. ;;
    + ]+ h% |) w0 `/ I9 f
  3826. ;; app is the filename of the application to check (extension is required)
    # u9 r6 u1 j, i0 O% }
  3827. ;; appset is a list of applications, (such as (arx) or (ads)
    , a+ ?2 M+ v1 M. ^7 @+ D5 g
  3828. ;;
    + e! ~; h8 c" l7 n$ d
  3829. ;; returns T or nil, depending on whether app is present in the appset7 S. M+ O( O- H. o9 s( a% d
  3830. ;; indicated.  Case is ignored in comparison, so "foo.arx" matches "FOO.ARX"
    8 o3 P7 M$ _, S4 N0 m- d) Z
  3831. ;; Also, if appset contains members that contain paths, app will right-match
    3 |# K) w8 C* X+ {# S
  3832. ;; against these members, so "bar.arx" matches "c:\\path\\bar.arx"; note that
    3 r$ r$ m; {! m5 q  s9 F8 P9 T
  3833. ;; "bar.arx" will *not* match "c:\\path\\foobar.arx."7 H& K) C  D! o4 q
  3834. (defun loadedp (app appset)
    1 H6 S8 O! S( Z0 v* U/ j2 c9 b
  3835.   (cond (appset  (or
    ' `2 \1 A8 J& f7 H$ p, F
  3836.                      ;; exactly equal? (ignoring case)" T' M. \  [( U- Z# A* K. I2 I' ]2 T
  3837.                      (= (strcase (car appset))# i0 V# c: w, x
  3838.                         (strcase app))  w: j3 _) V6 u8 |3 k
  3839.                      ;; right-matching? (ignoring case, but assuming that/ U+ @0 D- B% |! [
  3840.                      ;; it's a complete filename (with a backslash before it)/ K% ]: E8 ^  O5 {. q1 O3 p
  3841.                                          (and
    + e1 W, f# @4 ~/ i7 k
  3842.                                              (> (strlen (car appset)) (strlen app))
    2 x* q, [, O; W8 I3 W( X, `
  3843.                              (= (strcase (substr (car appset) 8 I+ u2 r& ~* `6 x& f% G
  3844.                                                  (- (strlen (car appset)) ' [' G" y6 P6 ^* g  o0 J
  3845.                                                     (strlen app)
    0 O: p+ ?4 \3 w& q/ k
  3846.                                                  )
    / D, C' @2 Z: X; d" i; i
  3847.                                          )
    - h5 h$ P9 ~$ Q5 w2 m% d
  3848.                                 )
    / E8 J' f1 }1 v/ G, h, S
  3849.                                 (strcase (strcat "\\" app))
    : B) x6 `0 b, p1 C8 T
  3850.                              )
    $ z3 k8 a3 D" q; x. f# q
  3851.                                      )
    0 l/ U" z, N7 s6 R0 K
  3852.                      ;; no match for this entry in appset, try next one....3 [2 W; b' [1 F, d
  3853.                      (loadedp app (cdr appset)) )))) D. y* V) c6 O, N2 M. n+ ?
  3854. )
    0 I& [& H# h& T- T+ J' {: S! ]0 W; R
  3855.   O6 ]  f& M' w# b$ u
  3856. & C% J* S$ i; [9 n
  3857. ;;; ===== Single-line MText editor =====
    " q# h) j" X! u6 u! _. \6 {
  3858. (defun LispEd (contents / fname dcl state)
    ) L: i) O3 v8 t4 i
  3859.   (if (not (setq fname (getvar "program")))
    2 D% j, V8 q  N
  3860.      (setq fname "acad")9 J, a- F- E8 Z8 h
  3861.   )5 N( M; t# @2 s3 X
  3862.   (strcat fname ".dcl")
    - \4 x3 e+ w! s, z& e2 T9 H1 q2 f; P
  3863.   (setq dcl (load_dialog fname))8 C% E* D) E3 v( \" F4 i1 x
  3864.   (if (not (new_dialog "LispEd" dcl)) (exit)): G! s# q1 Y+ T
  3865.   (set_tile "contents" contents)" ]. g/ _. y, O3 t& m
  3866.   (mode_tile "contents" 2)& O* P, M2 _+ }' g
  3867.   (action_tile "contents" "(setq contents $value)")
    9 e3 ]) ^  c+ O3 O
  3868.   (action_tile "accept" "(done_dialog 1)")
    7 w. f; K$ O) v8 h: A  ]9 _* \
  3869.   (action_tile "mtexted" "(done_dialog 2)" )
    , g. w4 y: }/ f- z* F% Y. P
  3870.   (setq state (start_dialog))
    / H) [( s$ Y2 G6 ?# ^& a
  3871.   (unload_dialog dcl)4 |- s# O( H" F; |
  3872.   (cond. q# _0 A( m; y5 i
  3873.     ((= state 1) contents)3 n6 j8 C$ w& M% a
  3874.     ((= state 2) -1)
    ) @8 w/ t! e; B
  3875.     (t 0), n4 e3 S' ^  N: Q# F4 _% M4 N
  3876.   )1 ~" p; J$ X6 j5 t6 s
  3877. )
    2 G6 k) q  g+ |% C% h

  3878. 9 V% [4 W% y/ @  s& A) L
  3879. ;;; ===== Discontinued commands =====7 Y/ C8 \  P2 t5 L
  3880. (defun c:ddselect(/ cmdecho-save)
    ) P  E! M: o/ D5 r& F
  3881.   (setq cmdecho-save (getvar "CMDECHO"))
    4 ?9 w% a: p+ R/ n- N
  3882.   (setvar "CMDECHO" 0)$ \- B  o2 y! v
  3883.   (command "._+options" 7)1 |( S; I- w: J
  3884.   (setvar "CMDECHO" cmdecho-save)
    ) s& K/ _  u- L" t2 |
  3885.   (princ), r7 O- S7 @$ G) `' W# u
  3886. )8 i8 C. A7 A* g3 x

  3887. 8 e8 q: e3 D7 r) n! P+ v
  3888. (defun c:ddgrips(/ cmdecho-save)
    - n9 `( v+ n; {3 Z
  3889.   (setq cmdecho-save (getvar "CMDECHO"))
    3 i! V9 H; n  g  G5 K
  3890.   (setvar "CMDECHO" 0): K3 u, Z8 T) @& J9 P# u( b
  3891.   (command "._+options" 7)
    * K4 s9 K5 t: ~( @+ [8 a
  3892.   (setvar "CMDECHO" cmdecho-save)0 U, [  X0 C! r: J5 w9 ~
  3893.   (princ)
    / l/ g. z/ I; ~# s8 S) D! o# l
  3894. )
    / z/ l3 U  s& ^' D
  3895. 5 ]) ~& I* ], D* n6 b1 m# f- p
  3896. (defun c:gifin ()
    $ C" U" @( c+ E+ I) M
  3897.   (alert "\nThe GIFIN command is no longer supported.\nUse the IMAGE command to attach raster image files.\n"): K* U/ B7 k7 m/ ?+ B
  3898.   (princ)
    0 y6 y! j8 `! Q
  3899. ). m* Z+ j# n) t/ P5 r) o# i

  3900. 6 L' y* P2 V, s0 z% U8 `
  3901. (defun c:pcxin (). t3 ?0 P* p7 m& P3 V6 k8 Z
  3902.   (alert "\nThe PCXIN command is no longer supported.\nUse the IMAGE command to attach raster image files.\n")" ~( D! q/ J$ l( O/ m
  3903.   (princ)+ c; W9 x- ]  [
  3904. )
    * C1 D* w. ~6 D- ^6 g) T( b# B
  3905. ( J6 |& q* W1 j8 @) X
  3906. (defun c:tiffin ()0 O* k$ V- M4 S- T. ^" V
  3907.   (alert "\nThe TIFFIN command is no longer supported.\nUse the IMAGE command to attach raster image files.\n")$ i2 {* I5 x' e: c- H5 a+ G
  3908.   (princ)
    3 ]. a5 B; n5 W5 p  I
  3909. )
    ' c; s( a  l6 _- H5 k* F9 ^, Z# `4 O
  3910. * |$ |# n! p3 z; |! r
  3911. (defun c:ddemodes()* l7 I* O, V9 V8 q$ }0 A
  3912.   (alert "The Object Properties toolbar incorporates DDEMODES functionality.  \nDDEMODES has been discontinued.  \n\nFor more information, select \"Object Properties toolbar\" from the AutoCAD Help Index tab.")
    ( ]) g1 u2 X; L! \& w* ]
  3913.   (princ)
    : q/ H! a# r0 Q* U1 H
  3914. )' f( m! `3 Z; Q
  3915. " j" n% |: T' D5 c+ v: ]
  3916. (defun c:ddrmodes(/ cmdecho-save)8 Z8 K  J  V( g7 ?5 Z8 E
  3917.   (setq cmdecho-save (getvar "CMDECHO"))' {& l. q" r9 Y& c" j
  3918.   (setvar "CMDECHO" 0)' \4 ~1 C2 A5 D3 o, k- A; [
  3919.   (command "._+dsettings" 0)
      ]! a6 v/ z0 j* M! p. W1 V$ |
  3920.   (setvar "CMDECHO" cmdecho-save)6 {- W6 g5 \2 H9 |+ \
  3921.   (princ)
      S+ j* D9 I; Q+ {! Y: E/ e
  3922. )
    - d* u: N' R; o4 x- b( {! i

  3923. " z# U, F! a/ s! ?
  3924. ;; HPCONFIG; Z6 G# x2 E: X9 c' w# ]
  3925. (defun c:hpconfig (/ hlppath)
    ; r$ `# h$ \3 L  Y3 F! Q) B
  3926.   (if (not (setq hlppath (findfile "acad.hlp")))! E: @# ~5 }  j. d! E% u$ |# }
  3927.     (setq hlppath ""))4 N3 s( w. F* w4 c5 ~
  3928.   (help hlppath "hpconfig")
    4 E; ~& v* x9 O2 Q( \" q+ v$ G
  3929.   (princ)
    0 |, q! r& T. @( O1 y* Z
  3930. )' i$ U: A5 j6 Y% S3 s9 S7 `

  3931. + M( ?2 z+ d0 S+ K
  3932. ;; OCECONFIG
    ' p) b" t4 y% M) y" @: B
  3933. (defun c:oceconfig (/ hlppath)
    7 ]% Y* v, E% k$ ^7 a1 q7 S0 C
  3934.   (if (not (setq hlppath (findfile "acad.hlp")))
    6 q3 D) U; A5 i( X0 N. w- `
  3935.     (setq hlppath ""))' q5 G; l# r' V0 ~+ T: E; Q
  3936.   (help hlppath "oceconfig")0 j9 `. X/ h' ]! k( _
  3937.   (princ)0 v5 a- R- D1 X7 q* d+ }+ ?6 `% x) _9 o$ X
  3938. )
    ; R$ C7 Z  X* G0 }2 `, p

  3939. & K6 S+ b+ ~. G) ]. k
  3940. ;; CCONFIG
    . _- q4 j9 d& u
  3941. (defun c:cconfig (/ hlppath)
    * g! C: N- r% }8 s' V+ M+ Q+ ~4 L
  3942.   (if (not (setq hlppath (findfile "acad.hlp")))
    # {) g4 E4 m9 x; Y+ U/ T0 d/ v
  3943.     (setq hlppath ""))
    ! ?" W% Q! k. y8 ~% ?$ u; ]! z
  3944.   (help hlppath "cconfig")9 |+ S! @' V+ q8 a
  3945.   (princ)
    7 C; m/ K% Z& K
  3946. )% M; ?5 G8 O; u+ O* A5 I

  3947. 3 G, b! B% W& n2 \
  3948. ;;; ===== AutoLoad =====
    7 r8 G* ~% u- G& A

  3949. . b- m; n( `" y
  3950. ;;; Check list of loaded <apptype> applications ("ads" or "arx")2 ^* D1 G+ L# I6 [) p* ^4 C5 E) I
  3951. ;;; for the name of a certain appplication <appname>.
    + v$ T3 L/ u  g: B
  3952. ;;; Returns T if <appname> is loaded.
    4 V6 x/ Q% e+ d# K7 h5 r9 a- N

  3953. , A( h( x# B* w. q. c
  3954. (defun ai_AppLoaded (appname apptype)2 @' @) n) h$ m8 S1 f; F
  3955.    (apply 'or
    ; W2 O: T; E  o( ~$ F) f) n
  3956.       (mapcar
    4 N* u6 {- |* ?. L; n/ b' L* r
  3957.         '(lambda (j); m8 K$ l3 I& v
  3958.             (wcmatch
    . K' _; z; ^& j! ]/ }$ @! d
  3959.                (strcase j T)' j; q+ R" |3 h  h
  3960.                (strcase (strcat "*" appname "*") T)5 x% T, ?) g' \0 M) A  x
  3961.             )   . O8 e8 u% J$ r, Y
  3962.          )
    + j4 u% k: X' Q" N- B- [- `
  3963.          (eval (list (read apptype)))) u' [6 {. g" k8 n" C1 b. R* A" {
  3964.       )+ L0 T* Z4 Y- r" b
  3965.    )
    3 z+ H% `4 W5 C' X3 Z1 ~
  3966. )
    1 k  v* ]# W! z
  3967. % d1 J" r( z, P6 `0 E
  3968. ;;  : x, D5 v( ^# d) M
  3969. ;;  Native Rx commands cannot be called with the "C:" syntax.  They must ; i: d% u3 }) k# N7 a
  3970. ;;  be called via (command).  Therefore they require their own autoload
    ( t8 [8 v# n$ z7 ]$ U& o
  3971. ;;  command.
    ' C3 q+ A% n7 K8 G

  3972. ; H( p2 v8 l! `: S1 N4 S
  3973. (defun autonativeload (app cmdliste / qapp)" I- j. m! k4 ?
  3974.   (setq qapp (strcat "\"" app "\""))
    3 T; q2 V) {) A0 Y) G/ f: I  H
  3975.   (setq initstring "\nInitializing...")* ~% B( O; X* i
  3976.   (mapcar
    2 B, K/ t! T$ R' `9 Y( ?. [
  3977.    '(lambda (cmd / nom_cmd native_cmd)
    2 m  l, T& ^* Q4 X8 |4 C: h
  3978.       (progn
    ( A3 K) }9 a1 R& s4 W
  3979.         (setq nom_cmd (strcat "C:" cmd))
    ! C& h4 c& z7 G, \0 a
  3980.         (setq native_cmd (strcat "\"_" cmd "\""))1 I! V$ ^" l' `: P5 M% I0 E
  3981.         (if (not (eval (read nom_cmd)))
    7 h4 N' G( w' l9 M2 a
  3982.             (eval
    7 |0 q: t5 i$ K" ^/ @
  3983.              (read (strcat
    2 |" D# n- _) s  }5 V2 V5 t
  3984.                     "(defun " nom_cmd "()"
    ) v& x8 s, o; h# s3 _- }" \; o) c
  3985.                     "(setq m:err *error* *error* *merrmsg*)"! g* M1 ~( ?5 i
  3986.                     "(if (ai_ffile " qapp ")"* k6 s% i% k; Y/ o! y; f, ?* w
  3987.                     "(progn (princ initstring)"0 K! A; c# p' Q6 s4 v5 v  A/ U
  3988.                     "(_autoarxload " qapp ") (command " native_cmd "))"
    9 k7 t; [* e1 `( D
  3989.                     "(ai_nofile " qapp "))"
    % s( K) y5 j5 `8 q' L* v
  3990.                     "(setq *error* m:err m:err nil))"$ j  s9 {: N- G( \1 k
  3991.                     ))))))5 D; c1 Y8 P3 x
  3992.    cmdliste)
    . }& Q/ b9 |/ m. N4 Y. ^5 O
  3993.   nil. U( U- }0 H( T- B
  3994. ): _. ^, c. @3 {5 y0 ?; r2 X
  3995. " b- d; {) D: n# m* ~& _* @
  3996. (defun _autoqload (quoi app cmdliste / qapp symnam)
    8 I  _& Y& d* ?  W* a2 {
  3997.   (setq qapp (strcat "\"" app "\""))& X# A5 i# |' y0 w
  3998.   (setq initstring "\nInitializing...")& ~5 m. D) ~" n2 L5 |
  3999.   (mapcar
    6 S" @& A- @* \3 Z
  4000.    '(lambda (cmd / nom_cmd)* r+ N# v* j' {: \
  4001.       (progn
      r! H# l& Q: v0 D, ^5 d. j5 z
  4002.         (setq nom_cmd (strcat "C:" cmd))! W0 c1 N: M5 n& m
  4003.         (if (not (eval (read nom_cmd)))) q( V1 n/ k9 _
  4004.             (eval2 x7 C1 T, s$ n. U5 K( n: x  }- k7 W
  4005.              (read (strcat7 a! {" O: V7 @% X/ j
  4006.                     "(defun " nom_cmd "( / rtn)"
      q& n& q5 K1 h) y! m0 q
  4007.                     "(setq m:err *error* *error* *merrmsg*)") m$ Q. X( q# `5 K
  4008.                     "(if (ai_ffile " qapp ")"
    4 B' N9 s3 H6 B2 n$ D( C4 H
  4009.                     "(progn (princ initstring)"* _) v, s1 d3 q2 p4 |
  4010.                     "(_auto" quoi "load " qapp ") (setq rtn (" nom_cmd ")))"
      o: r0 c% v% ?
  4011.                     "(ai_nofile " qapp "))", P$ s) @$ f  \/ ?$ ~! }% S0 a
  4012.                     "(setq *error* m:err m:err nil)"
    ) ^! G8 c- J3 U* [
  4013.                     "rtn)"
    " [6 M8 }" B2 a: H$ @
  4014.                     ))))))" k4 C/ l$ Q3 b
  4015.    cmdliste)7 }- I; I* P. [4 o: y" m
  4016.   nil
    $ I- G, A" c4 R7 Z3 U- i
  4017. )
    1 [8 P0 {. q7 E5 Q

  4018. 7 m6 P7 A( K: L
  4019. (defun autoload (app cmdliste)
    7 r) X3 v9 l. g- V( P) L+ ~: I$ b
  4020.   (_autoqload "" app cmdliste)
    6 |" p; R1 U% b6 V0 h2 r2 d
  4021. )4 H9 A2 G$ H+ ~7 ^- M8 v

  4022. 0 V; k+ F1 R/ b. V1 q8 `+ _
  4023. (defun autoarxload (app cmdliste)
    ( O. f) i4 l' s9 h, h
  4024.   (_autoqload "arx" app cmdliste)
      p7 @7 s$ {, a: n- W
  4025. )
    / |2 L  g+ K) O, V
  4026. % w, g- v4 A' p2 \" _
  4027. (defun autoarxacedload (app cmdliste / qapp symnam)
    , l; K0 P+ \; j7 V' E5 d- o* Z
  4028.   (setq qapp (strcat "\"" app "\""))
    0 K* z3 a+ ]& ~+ t
  4029.   (setq initstring "\nInitializing...")
    , Y$ l1 M2 ]: y- }3 |7 _
  4030.   (mapcar
    + E6 z0 A: w+ {$ b! Y8 C3 M" }* z; S
  4031.    '(lambda (cmd / nom_cmd); o# C5 R# D: }- p
  4032.       (progn
    0 e" {# ?1 a5 \5 M5 e
  4033.         (setq nom_cmd (strcat "C:" cmd))
    - o9 L8 s1 a5 M' j8 ]$ a, V+ w' w7 |
  4034.         (if (not (eval (read nom_cmd)))
    # Y  L" G. n. ^; q4 v+ ]8 c
  4035.             (eval
    1 }5 I: A( U$ l; ]
  4036.              (read (strcat
    ! @% e+ j; a- c! B0 C
  4037.                     "(defun " nom_cmd "( / oldcmdecho)"2 P/ }0 u* c6 Q5 T0 [$ E
  4038.                     "(setq m:err *error* *error* *merrmsg*)"
    ' X- Q) ?6 ~& S+ c
  4039.                     "(if (ai_ffile " qapp ")"4 l7 J; |1 b/ x
  4040.                     "(progn (princ initstring)"
    9 _& l6 J6 f; ~- G$ V0 I
  4041.                     "(_autoarxload " qapp ")"
    , P8 X, N+ k; X. f  |. l5 ^" {- _
  4042.                     "(setq oldcmdecho (getvar \"CMDECHO\"))"+ e, J( L* l- C. ?. L3 Z
  4043.                     "(setvar \"CMDECHO\" 0)"
    % v6 R' `( _3 e* C1 o* \
  4044.                     "(command " "\"_" cmd "\"" ")"
    1 ^, j, i0 J: l, T
  4045.                     "(setvar \"CMDECHO\" oldcmdecho))"6 d9 I9 t9 s0 R* A5 I4 s
  4046.                     "(ai_nofile " qapp "))"' l% a1 m* B3 O# W9 H8 K' a# i
  4047.                     "(setq *error* m:err m:err nil)"6 D- {( B: ]- h
  4048.                     "(princ))"
    4 ^  M& H4 s1 L, ]
  4049.                     ))))))
    " U& P/ o7 a8 j- X8 @, r& Q) s& j
  4050.    cmdliste)
    4 L3 r! m3 F2 ~$ y5 v4 [) y
  4051.   nil
    + Y9 z; ?- `, b" q: s& Z  e
  4052. )
    ' F, \% T. Z6 p2 I: a
  4053. % W3 ~6 P8 h  \( R; H. J
  4054. (defun _autoload (app)% t  T$ R, e8 `1 j; K# A. Z5 v2 q
  4055. ; (princ "Auto:(load ") (princ app) (princ ")") (terpri)1 Y8 L9 L5 g- F* ~# N; [; |( \4 J. ?
  4056.   (load app)" g% }# ~% }0 Q# ]: ]7 [' C
  4057. ), ]0 L, Z+ v. h8 I  D
  4058. ! W- s0 F* Y, }! \) j2 l
  4059. (defun _autoarxload (app)
    $ l6 s/ f8 j+ U
  4060. ; (princ "Auto:(arxload ") (princ app) (princ ")") (terpri)
    9 u: a- _) L, r, H% F+ H8 @
  4061.   (arxload app)
    8 V, @4 B5 u4 |. c0 H/ }
  4062. )9 e! ?! t" b. w8 K$ P, i
  4063. ; r8 g; i' g" {  Q
  4064. (defun ai_ffile (app)
    4 X' ]. y$ m5 |# o+ v8 [2 r1 J$ L
  4065.   (or (findfile (strcat app ".lsp"))
    1 j4 {! M! g& |& |* x
  4066.       (findfile (strcat app ".exp"))* j! J- q) E) ^; Q+ @- r4 z, V
  4067.       (findfile (strcat app ".exe"))* T( `9 q; C: [0 `7 c1 V
  4068.       (findfile (strcat app ".arx"))
    * S+ B( i  K: s1 W( ~
  4069.       (findfile app), x; S! x4 k( m5 `; \9 A( `
  4070.   )) D8 {! X' K$ K
  4071. )( {1 ?9 Y( R5 l# _

  4072. 7 v% [5 _* e! N6 r) z( l& Z8 [
  4073. (defun ai_nofile (filename)
    - l, h' D5 X) b
  4074.   (princ
    * w( U  ?7 A8 N- V: U9 K3 S
  4075.     (strcat "\nThe file "
    / T0 H" e' |2 C  L' P3 x
  4076.             filename
    : J% [# Q" o( h. u9 T
  4077.             "(.lsp/.exe/.arx) was not found in your search path folders.". V$ W# @) _: K" E4 R% o* O
  4078.     )- j" D' c8 o. p6 [% d/ y  n% D
  4079.   )
    " M& S" J  x  E/ J2 @7 G7 Y
  4080.   (princ "\nCheck the installation of the support files and try again.")+ @3 E) n8 ?( Y; Z' _! b
  4081.   (princ)
    : R- U! J0 R' K  ^
  4082. )
    & U. x( m0 j  D% d, }
  4083.   d: g" ~  f/ N0 `+ {- J; ^8 L7 {
  4084. & ?2 O& F  O6 u
  4085. ;;;===== AutoLoad LISP Applications =====+ J- R( N& p0 h: V2 t
  4086. ;  Set help for those apps with a command line interface# ], ~3 y1 r+ o! O; i# I
  4087. ' A* Y. ?3 @2 \% q5 m0 Y: @
  4088. (autoload "edge"  '("edge"))& }9 M* I2 X  x6 @& h, z9 ~
  4089. (setfunhelp "C:edge" "" "edge")! X3 `2 E1 M' q5 C2 r( I- z
  4090. 9 X- i7 [2 z7 J8 A/ [* G
  4091. (autoload "filter" '("filter " "filter"))
    ' n0 E( u" u1 [/ n7 X' A
  4092. 4 q9 s, ^4 G. O2 V( f9 D
  4093. (autoload "3d" '("3d" "3d" "ai_box" "ai_pyramid" "ai_wedge" "ai_dome"8 f$ d! d6 ]% A" h) w3 |
  4094.                  "ai_mesh" "ai_sphere" "ai_cone" "ai_torus" "ai_dish")
    0 x+ Z0 R1 }* l. J2 Y' E! w
  4095. )4 x3 B) x. d! S
  4096. (setfunhelp "C:3d" "" "3d")
    1 a' L. ?- y$ z( n7 J, M; k
  4097. (setfunhelp "C:ai_box" "" "3d_box")
      @8 R# a) |, x0 u' i* L
  4098. (setfunhelp "C:ai_pyramid" "" "3d_pyramid")3 H# T. F! h3 }8 R" O
  4099. (setfunhelp "C:ai__wedge" "" "3d_wedge")4 u2 A" C1 s! q/ l4 b. S; x3 ?
  4100. (setfunhelp "C:ai_dome" "" "3d_dome")
    5 e, D* ~9 f6 @0 t
  4101. (setfunhelp "C:ai_mesh" "" "3d_mesh")
    1 N2 j* }( y" D$ H
  4102. (setfunhelp "C:ai_sphere" "" "3d_sphere")4 m: U% b( N9 X; p8 ?; _( w
  4103. (setfunhelp "C:ai_cone" "" "3d_cone")+ k2 T! Z6 R* Y4 f# {* W
  4104. (setfunhelp "C:ai_torus" "" "3d_torus")
    ) _2 w& i( W% F. @( U
  4105. (setfunhelp "C:ai_dish" "" "3d_dish")
    9 ?. u5 H& Q1 G9 Q8 H( j
  4106.   `7 v6 A6 I" q8 {2 m7 e
  4107. (autoload "3darray" '("3darray"))
    ; I) [( @4 Y# u; F. W5 C& h
  4108. (setfunhelp "C:3darray" "" "3darray")
    ) Q/ _8 Q+ i: W1 M# ]' U3 h

  4109. 3 U: X% @$ {. O* c9 U3 L$ {: r
  4110. (autoload "ddvpoint" '("ddvpoint"))
    1 ?4 A4 s. K, X( c: d1 Z

  4111. ( p, p  L) e/ z# Z( L3 }2 p; }
  4112. (autoload "mvsetup" '("mvsetup"))
    9 f" b: p/ o0 m0 o; D) u: b2 u
  4113. (setfunhelp "C:mvsetup" "" "mvsetup")
    ( k! s# p8 `, ^7 o3 o0 @
  4114. 1 t) E( s/ [) j, m
  4115. (autoload "ddptype" '("ddptype"))
    ) ~. h$ A! m) B" _( }- t
  4116. $ i. C- V: U% P  u- P2 M
  4117. (autoload "attredef" '("attredef")), `, I5 j" ^4 |1 Q- b
  4118. (setfunhelp "C:attredef" "" "attredef")
    + u/ I' Y3 r6 _, N$ Y
  4119. 4 x9 Y- {+ k$ S  |* Z" S
  4120. (autoload "xplode" '("xp" "xplode"))
    5 P" Z) F! k5 e% J# z% Q* [
  4121. (setfunhelp "C:xplode" "" "xplode")4 K, }& n  S6 n" b
  4122. 9 F9 ]. B4 g' c1 g7 {: i
  4123. (autoload "tutorial" '("tutdemo" "tutclear"
      v7 V9 ?9 n  X9 E& [
  4124.                                        "tutdemo" $ `' B+ C. X$ o. C
  4125.                                        "tutclear"))
    0 y, I; h8 r/ g" I8 g) N
  4126. 7 H: ?! G8 G+ z; x. t8 K; n! u
  4127. ;;;===== AutoArxLoad Arx Applications =====
    & x4 \: R8 Y& Q5 ]: C
  4128. 8 r1 _! @6 c. U7 s# y4 n; [
  4129. (autoarxload "geomcal" '("cal" "cal"))
    : F% [6 @! p1 w4 @$ A
  4130. 2 q: n% Q# S3 m% t- i  s
  4131. (autoarxload "geom3d" '("mirror3d" "rotate3d" "align": p0 Y& K1 D* e# j+ H0 i, A
  4132.                       "mirror3d" "rotate3d" ( q& j5 t4 |0 o* [$ y, K
  4133.                                  "align"))( I) D) j' B0 ~: N9 P
  4134. " E9 V  X2 Q' V( b( Z: |" C

  4135. / z6 R! R  O5 x+ z7 Q! s2 h6 A
  4136. ;;; ===== Double byte character handling functions =====) f, t( K$ \4 `, i  j

  4137. & x$ F2 c& g% e' U  J8 |
  4138. (defun is_lead_byte(code)  [  r0 _+ I$ j: y+ f' Y, O
  4139.     (setq asia_cd (getvar "dwgcodepage"))* Y, D6 z" C( d& X: ]$ c9 v
  4140.     (cond
      F! d; s# @2 ]! O. U
  4141.         ( (or (= asia_cd "dos932")7 i' ?  Y& D$ T$ v! Z
  4142.               (= asia_cd "ANSI_932"), i& B8 i1 f/ w& S9 o9 p
  4143.           )
    8 s% a9 o6 Q# e* \6 {- z& j$ H
  4144.           (or (and (<= 129 code) (<= code 159))
    + i' d2 R0 ~( n! N3 o6 t' K( R  J
  4145.               (and (<= 224 code) (<= code 252))
    4 p8 b$ d. K1 {0 h6 m
  4146.           )
    , q. {  `+ {6 P1 ^6 @
  4147.         )
    ; {! ~7 ?  d, E% S+ d* f' h7 n* s- ]$ R/ F
  4148.         ( (or (= asia_cd "big5")
    ; W2 c$ J  A# l# T* f
  4149.               (= asia_cd "ANSI_950")* u% d5 E* ~2 S$ H9 m
  4150.           )
    ' f3 q1 b9 f4 I" y' E% U4 g
  4151.           (and (<= 129 code) (<= code 254))
    8 @% h) T& h* j* t& {+ c
  4152.         )
    9 D& U1 w+ r" _* z8 i* i3 `
  4153.         ( (or (= asia_cd "gb2312")5 C( |5 Z- p/ ]" G+ `$ t6 x/ s
  4154.               (= asia_cd "ANSI_936"). A2 O3 I7 `1 q3 W( T6 U3 S5 V
  4155.           )
    1 @4 U/ c9 y! K8 A
  4156.           (and (<= 161 code) (<= code 254))
    + ?, K  n$ g! C1 E9 k
  4157.         )
    8 ]" l. }. u% `! D
  4158.         ( (or (= asia_cd "johab")& D' ]  @$ t* `" r6 \  Q0 e( N
  4159.               (= asia_cd "ANSI_1361")6 B1 Z$ ^1 {, [1 a' t' d
  4160.           )
    6 a  N1 H5 L' C  d+ Z7 z  x6 [
  4161.           (and (<= 132 code) (<= code 211))
    6 ~- U" N' T. H/ j. z' Y: A. q
  4162.         )
    0 m6 [9 ]: l) P  w( U
  4163.         ( (or (= asia_cd "ksc5601")9 b1 p1 v$ D% H1 N  n6 N/ J
  4164.               (= asia_cd "ANSI_949")% z! }5 [! C) y$ a" b1 T9 t
  4165.           )
    7 @& B/ u, P# T/ m4 ^
  4166.           (and (<= 129 code) (<= code 254))4 {: |- r/ b, J, j, I. G
  4167.         )
    ) X: A! {* \5 V1 z* q3 `
  4168.     )
    4 R, m2 s7 f9 d8 x7 x, k
  4169. )
    8 M2 X9 C3 x5 i5 X4 W% O  h
  4170. - k  g6 J+ Z! F% E! U6 H2 ?9 t
  4171. ;;; ====================================================  F. q. G1 K$ N1 R9 ?

  4172. . @# p7 A) X$ A4 Y8 [. r

  4173. - D- X/ h# u) ?2 C
  4174. ;;;
    & T9 y3 M7 o+ O( S$ {
  4175. ;;;  FITSTR2LEN
    5 p6 \9 o1 s- k- G
  4176. ;;;
    ( u! V4 P) e$ }' H. P5 @
  4177. ;;;  Truncates the given string to the given length.
    2 f# q3 g4 G$ E: m
  4178. ;;;  This function should be used to fit symbol table names, that  a5 P8 \! c2 V. X+ i) @) M
  4179. ;;;  may turn into \U+ sequences into a given size to be displayed
    ; V2 N4 r# R7 g# s" w' V
  4180. ;;;  inside a dialog box.
    6 C) _- h  q% Z  ?# c- o
  4181. ;;;
    $ {1 r  f. X5 k) b" |) W, f: g0 i
  4182. ;;;  Ex: the following string: 2 S, g6 e: t  j- t& d
  4183. ;;;! P" ]/ ?' L' I0 L" Q
  4184. ;;;      "This is a long string that will not fit into a 32 character static text box."
    4 D2 F& j5 k/ X0 K& c! F: Q$ v/ ~
  4185. ;;;
    + t( z# F& G6 x" p
  4186. ;;;      would display as a 32 character long string as follows:' I0 o' }# r$ g/ n
  4187. ;;;/ _  L' x  q- y3 `# K, L; d
  4188. ;;;      "This is a long...tatic text box."+ L/ a$ s- |7 ]8 G. m
  4189. ;;;
    0 }4 f( b) \. Y3 J5 }
  4190. - U& G2 y) u, Y! u8 D
  4191. (defun fitstr2len (str1 maxlen)# d% u0 R, D9 C- [5 H" }

  4192. 2 j3 W( G8 p5 t. o
  4193.     ;;; initialize internals) \( U8 J4 z: [' b- K
  4194.     (setq tmpstr str1); M* E) s4 W4 P( x* H$ R
  4195.     (setq len (strlen tmpstr))
    + n5 C# y' {  Z6 @

  4196. 5 a3 V4 ~; s. r0 C' x+ r- D; k
  4197.     (if (> len maxlen)
    # z  h1 ~% Y3 ?# v* n! n1 Y. O
  4198.          (progn
    9 P! O2 i8 s1 X# i# N
  4199.             (setq maxlen2 (/ maxlen 2))
    4 A  e% |8 i6 Z( i& u) p' W- S8 W
  4200.             (if (> maxlen (* maxlen2 2))0 U% I$ h8 m" q5 _
  4201.                  (setq maxlen2 (- maxlen2 1))
    ' r5 f" u5 g% b. \% |) x
  4202.             )8 n4 C# O3 ?1 f* `8 I
  4203.             (if (is_lead_byte (substr tmpstr (- maxlen2 2) 1))/ l7 a! e0 T1 x( i; d& _
  4204.                  (setq tmpstr1 (substr tmpstr 1 (- maxlen2 3)))  o5 e( _+ ^5 y2 U( `
  4205.                  (setq tmpstr1 (substr tmpstr 1 (- maxlen2 2)))
    . I7 X. M1 |; ?: ?3 U
  4206.             )
    2 ?! w' @6 I, Z" H$ @: L6 O
  4207.             (if (is_lead_byte (substr tmpstr (- len (- maxlen2 1)) 1))
    2 C! u8 h! z0 j( |/ Y4 L6 Y% m
  4208.                  (setq tmpstr2 (substr tmpstr (- len (- maxlen2 3))))( V3 i: u- S' _/ }5 g
  4209.                  (setq tmpstr2 (substr tmpstr (- len (- maxlen2 2))))
    ' K( c0 r2 A: Z/ @
  4210.             )4 m6 e) F- J6 g3 {
  4211.             (setq str2 (strcat tmpstr1 "..." tmpstr2))$ l, n( X7 ~' J; q, m* Z0 t9 }
  4212.          ) ;;; progn, J. S2 I8 o$ c7 z) m
  4213.          (setq str2 (strcat tmpstr))( Y/ Z" ?/ ~2 v4 q5 v5 L: q0 ^
  4214.     ) ;;; if' ?4 g0 n6 g" R  t: Y
  4215. ) ;;; defun
    ) j0 _. s/ t# E9 S' N' z0 o! L
  4216. 1 @9 S& H$ Y* z' K- \" ]

  4217. - l! d! A0 }( d3 ^0 o1 y% |
  4218. ;;;
    * C0 ?' q1 T- S3 v. f
  4219. ;;;  If the first object in a selection set has an attached URL7 D4 `* Y* R/ D# v" I, }2 K5 P' k1 j
  4220. ;;;  Then launch browser and point to the URL.4 I6 ^+ ^/ q1 T- i; y' R; n. p
  4221. ;;;  Called by the Grips Cursor Menu( i6 Y1 c, n8 |( I$ f
  4222. ;;;/ w* t6 W5 p8 T, o; w3 Q6 P
  4223. ! X1 i6 Z" J- M$ ^
  4224. (defun C:gotourl ( / ssurl url i)' V. Y  i- W) U( P, g8 z- X0 W+ x
  4225.    (setq m:err *error* *error* *merrmsg* i 0)
    $ I' k) Y# ~" G! C" e

  4226. 1 ~2 n' z' f& F! {
  4227. ; if some objects are not already pickfirst selected, ) F& V0 F: S3 }" T' D
  4228. ; then allow objects to be selected
    & W7 @* h# }7 V- n  Q' O  E
  4229. 6 X( Q. L: B6 ?
  4230.   (if (not (setq ssurl (ssget "_I")))
    ( z' Y" w# H6 D' v" ?6 Q/ i
  4231.       (setq ssurl (ssget))- ^: l9 c6 u9 w4 w+ c
  4232.   )
    6 r0 i7 I! Y+ _  y* J: F
  4233. & `+ Y: ]8 F% s. q  n% B9 v
  4234. ; if geturl LISP command not found then load arx application
    9 X; ^4 T3 i4 v

  4235. " E* @% E  m% H# m3 G; V2 ]! i  Y
  4236.   (if (/= (type geturl) 'EXRXSUBR)2 }+ j; n+ b) ~: ?$ k: D
  4237.     (arxload "dwfout")3 i: _. r' N! c  {
  4238.   )- g" s7 W! J0 c
  4239.   % ]$ ^9 _% J/ D0 M6 s) I' U- }
  4240. ;  Search list for first object with an URL
    $ N& v% {3 c3 Y$ c2 \8 C5 D4 ]5 {
  4241.   (while (and (= url nil) (< i (sslength ssurl)))8 j! {5 m& J/ ?& e6 r  m- B  ^
  4242.     (setq url (geturl (ssname ssurl i))
    . T% c2 e! u9 {* b. d! R
  4243.           i (1+ i))
      f% ]2 q  [/ ?
  4244.   )  X. U" U0 O8 t( D. L3 w9 X# @
  4245. $ }0 p* F4 B# F: n
  4246. ; If an URL has be found, open browser and point to URL
    + e8 a) q5 w" l( {
  4247.   (if (= url nil)
    4 F5 ^7 k3 k9 }( s* q
  4248.     (alert "No Universal Resource Locator associated with the object.")+ ?4 n" X" Z- d% d( i) N6 \0 Q* c
  4249.     (command "_.browser" url)2 \6 f' m& c5 X* c9 a1 K& p: H1 ?
  4250.   )
      S- ~' s( p: i; e

  4251. ( \% b/ z  ^$ f# ^1 Z8 k
  4252.   (setq *error* m:err m:err nil)4 M% ^! Z* \( O0 a
  4253.   (princ)6 w; |/ w% ~. L

  4254. / ?# u# \+ ]8 C: `9 K
  4255. )& H0 }- f) b5 y" N# x1 v

  4256. % c& ?  Y& F0 m7 l
  4257. ;; Used by the import dialog to silently load a 3ds file
    ! M" U: U. v0 g; r/ M. L$ M
  4258. (defun import3ds (filename / filedia_old render)( ?) d$ v, f6 v) G) O* a/ t( q
  4259.   ;; Load Render if not loaded
    ! D0 Q; H7 Y6 @; p. I' m
  4260.   (setq render (findfile "acRender.arx"))" [+ X2 B) F  u( ?, ]7 L- N) Q! @
  4261.   (if render) N6 [2 e3 ]$ j/ M! G
  4262.     (verify_arxapp_loaded render) ) M5 Y/ a3 i3 _* A( D
  4263.     (quit)
      c1 I- P! c7 `( d; I% I6 _
  4264.   )$ _3 L( V' E: ]
  4265. ( [0 J) K) Z1 x3 K: p4 ^
  4266.   ;; Save current filedia & cmdecho setting.- f" u! w: v2 s7 r& i& j
  4267.   (setq filedia-save (getvar "FILEDIA"))
    . [# x& V7 F$ u& k
  4268.   (setq cmdecho-save (getvar "CMDECHO"))" u7 [' d2 U. N: W' }
  4269.   (setvar "FILEDIA" 0)/ ], O* k3 }$ ]
  4270.   (setvar "CMDECHO" 0)+ s4 Q5 |9 {3 |: T
  4271. ( S& g3 W' b& o
  4272.   ;; Call 3DSIN and pass in filename.
    5 v, I- F6 b" ]! m3 C; Y. s
  4273.   (c:3dsin 1 filename)
    * H4 p' @8 [; a9 z* }
  4274. & Y: l* ]* M% t/ N# R
  4275.   ;; Reset filedia & cmdecho
    # X3 U* Z3 G; _  g: S( g& R
  4276.   (setvar "FILEDIA" filedia-save)( r3 S* D+ \* _0 \; p) i4 U" h1 l
  4277.   (setvar "CMDECHO" cmdecho-save)6 S6 R7 E+ {4 ]7 z  E1 I/ X6 c9 {
  4278.   (princ)
    6 l+ b  ?- z# l8 N& P
  4279. )
    3 \# T$ Q- G5 V8 ^( Y; L' Z
  4280. 1 O( x3 _5 x- N3 K
  4281. - |( i; \# l% U+ P# `# J" e& w, k
  4282. ;;;=== Menu Functions ======================================  f, `, t* `9 ~* }( V& R

  4283. + f9 n+ S; c/ U; v  ^/ t# f% ~
  4284. (defun ai_rootmenus (), o# c( M# d; J( ^6 o# `+ q
  4285.   (setq T_MENU 0)
    % J, c4 c0 E6 a: x
  4286.   (menucmd "S=S")
    ' V$ G+ E2 \% E  `
  4287.   (menucmd "S=ACAD.S"). ?1 L2 k0 D. s+ ?0 i6 @& X
  4288.   (princ)2 ^9 |5 N- f. [
  4289. )+ \/ j3 O& k5 }% F5 B0 L2 A

  4290. % K) T: U9 r$ e& e0 J
  4291. (defun c:ai_fms ( / fmsa fmsb)
    % A/ q0 @. `' `' ^9 y8 I4 m$ `. v$ p& V
  4292.   (setq m:err *error* *error* *merr*): g& a6 j0 J& z' g
  4293.   (ai_undo_push)" m' U( u$ c* t: r
  4294.   (if (getvar "TILEMODE") (setvar "TILEMODE" 0))
    + u( m9 V. n" w9 B
  4295.   (setq fmsa (vports) fmsb (nth 0 fmsa))
    : U7 L0 b1 D6 a2 V4 N
  4296.   (if (member 1 fmsb)7 A& x: {! v  w  U
  4297.     (if (> (length fmsa) 1)& n6 i2 W) G# I- G+ X
  4298.       (command "_.mspace")0 b2 |$ ]) t& c) m6 ?% ?
  4299.       (progn
    3 R9 N8 o: T' ]0 q4 @( {& S" H5 x
  4300.         (ai_sysvar '("cmdecho" . 1))
    + S9 U' S$ _1 n4 C! F
  4301.         (command "_.mview")$ F) h4 i1 q2 o  o
  4302.         (while (eq 1 (logand 1 (getvar "CMDACTIVE")))5 f3 C6 U# k6 |+ B! y& V+ G3 o
  4303.           (command pause)8 z: d! ]; L. J' z0 _2 W" R' R7 m' I2 X
  4304.         )
    6 ^! k6 Z2 M0 a# J& V8 f
  4305.         (ai_sysvar NIL)
    1 l6 @9 a4 F  Z; X2 [; m$ o
  4306.         (command "_.mspace")! Z# c' g* z( |2 O1 Z
  4307.       )
    ( }! Y- i* x7 C( N4 `+ {
  4308.     )5 l( m- \( f% W
  4309.   )  \0 D/ `4 g! b$ Y
  4310.   (ai_undo_pop)
    ( b% x" u8 V8 }4 n! L
  4311.   (setq *error* m:err m:err nil)
    6 X/ Q2 `2 t* S0 J5 k& `
  4312.   (princ)3 U8 A4 `: Z3 k9 }! f
  4313. )
    3 e* |6 |9 z7 \! O, W

  4314. 5 b5 Q2 J- N* f- K- v
  4315. (defun ai_onoff (var)
    0 [5 I1 [2 E9 |0 p5 l
  4316.   (setvar var (abs (1- (getvar var))))
    9 \+ T+ u# D5 P. P& G2 Q2 U
  4317.   (princ)
    / i5 f  |3 a' Y( F. O
  4318. )7 Q. X6 s' m, O0 Y0 p

  4319. ' w1 h. o: c0 b
  4320. ;;; go to paper space- f5 g, O+ c+ D% {5 r7 W
  4321. (defun c:ai_pspace ()7 o# k( b& T/ y/ k
  4322.   (ai_undo_push)$ A, |  l6 P1 V" r
  4323.   (if (/= 0 (getvar "tilemode"))" E6 f$ X9 \1 [9 T& x
  4324.     (command "_.tilemode" 0)
    . y3 d  l4 Q5 S0 h& `4 z& B9 S- U
  4325.   )
    ) A( J! O# G$ e- W
  4326.   (if (/= 1 (getvar "cvport"))
    # Y  g" m3 D* V7 x3 F  _
  4327.     (command "_.pspace")
    + f# W  U8 i8 `" C2 ^9 f
  4328.   )
      H. M1 L5 i- F0 }' L) ^4 Y
  4329.   (ai_undo_pop)
    , G0 [1 _0 A# V/ k
  4330.   (princ)8 h6 ?& H% A7 y3 i
  4331. )
    ( ^& q6 E$ t. ]. E2 w2 e4 j; g
  4332. 6 b2 |( r9 w* N
  4333. ;;; go to tilemode 1
    $ Z9 a2 U" ~5 q' o
  4334. (defun c:ai_tilemode1 ()
    - x* H* K7 t2 X
  4335.   (ai_undo_push)
    7 \# `2 \! f% |. \
  4336.   (if (/= 1 (getvar "tilemode"))+ N, t: l7 J+ n1 e8 e
  4337.     (command "_.tilemode" 1)
    ( x* \6 b  c/ K# b% h
  4338.   ); K6 h, A2 G" Y$ `: B
  4339.   (ai_undo_pop)
    ) ~& z# w( e2 x) c! t* Z1 V
  4340.   (princ)
    $ V- m. b6 d! g9 w2 J4 E1 U
  4341. )
    * Q) g% K3 [8 X4 ?4 k& E0 @
  4342. $ e: j1 \' ?, D6 D
  4343. ;;; Pop menu Draw/ Dim/ Align Text/ Centered
    1 t% S) P% T+ v& d6 ~5 V
  4344. ;;; Toolbar Dimensions/ Align Text/ Centered, X3 o# L1 k# s) y9 S
  4345. 2 J$ A5 G) B' h% J
  4346. (defun ai_dim_cen (/ ai_sysvar ai_dim_ss)$ W! z0 [1 K4 t, ]5 U
  4347.   (setq ai_sysvar (getvar "cmdecho"))
    ( s3 ], d. ?8 G' h, F' d
  4348.   (setvar "cmdecho" 0)
      |& q7 P2 \8 W( f8 i! ^- x$ l& s! n
  4349.   (cond
    + k) m+ X6 b# x! Q; j1 t
  4350.     ((setq ai_dim_ss (ssget  "_P" '((0 . "DIMENSION"))))
    ; Q8 g+ F, R+ T, s  B& l3 W
  4351.       (command "_.dimoverride" "_dimjust" 0 "" ai_dim_ss "" 4 W9 ?6 I$ `4 D" L" o) [$ f
  4352.                "_.dimtedit" ai_dim_ss "_h")7 H. g3 }. k7 g# u+ o5 |9 r$ w2 M
  4353.     )1 _  s* V1 O: I) x/ H6 K( ?1 L+ N
  4354.     (T nil)5 B1 |' [' \& n: e
  4355.   )- K: l5 C( c# _( E5 X. b, Y" R
  4356.   (setvar "cmdecho" ai_sysvar)
    8 m# I4 s/ s" V8 E1 a
  4357.   (princ): x- y9 A" ?) `+ {+ Y; x. e; Z
  4358. )
      V6 f$ J6 X+ |3 |" n; d' ]1 g4 ~

  4359. % A. l9 V; z/ o5 a, g, v, m; y
  4360. ;;; Shortcut menu for Dimension Text Above . r0 w0 k' n3 ?+ ^9 m
  4361. - ?# B4 s" ]4 i  ?) s$ s
  4362. (defun c:ai_dim_textabove (/ ss)
    / @  _0 p3 b- C6 N5 }$ c
  4363.   (ai_sysvar '("cmdecho" . 0))$ |! h( f4 Q: N7 U
  4364.   (if (setq ss (ssget "_I"))5 z7 ?, Z* g0 \* N
  4365.     (command "_.dimoverride" "_dimtad" 3 "" ss "")
    $ T! G1 L) t; h) K9 \7 k- S
  4366.     (if (setq ss (ssget))  |2 U( S; f- A! [2 h
  4367.       (command "_.dimoverride" "_dimtad" 3 "" ss "")
    & I1 H! d) b7 M
  4368.     )+ G$ L& |, f- J/ S" T3 c/ n
  4369.   )
    7 j+ b$ w4 X  b' ~9 _7 K) q0 G
  4370.   (ai_sysvar NIL)
    9 b6 _! I* x6 S2 d4 ~# ^1 X1 _; O
  4371.   (princ)
      x8 W! M3 |7 Y% t! m6 R7 i* [
  4372. )
    ! H$ ?/ K; G7 e
  4373. 0 I+ }2 l* R4 Q: ^1 p1 o
  4374. ;;; Shortcut menu for Dimension Text Center
    ; s- f) X- D$ \. Q7 _; T
  4375. 4 _: n- ^& y( v/ E! d# M' Z
  4376. (defun c:ai_dim_textcenter (/ ss)
    + J5 b! D& E: D4 F  X; w$ Y
  4377.   (ai_sysvar '("cmdecho" . 0)): K  n; O& I$ b- j* m' @
  4378.   (if (setq ss (ssget "_I"))
    ' c9 b; ?- n7 S, Y5 k
  4379.     (command "_.dimoverride" "_dimtad" 0 "" ss "")- N, u0 p- i# Y; C- q
  4380.     (if (setq ss (ssget))
    6 I7 C* s% u% i* J
  4381.       (command "_.dimoverride" "_dimtad" 0 "" ss "")
    2 n8 n0 E) A! f8 h, l
  4382.     )
    ) u4 `7 i) ?6 n$ L
  4383.   )7 _! X1 `! I& B8 G
  4384.   (ai_sysvar NIL)
    4 c' W" {* ~/ B( W  [
  4385.   (princ). I! Q+ ^# u$ ~! n
  4386. )
    : Y7 K- S$ u9 m, p  i
  4387. - ^: @# \7 H( E* U9 k' p6 T
  4388. ;;; Shortcut menu for Dimension Text Home
    7 [5 V% Y0 V) t% A& i

  4389. 6 F6 Y0 |0 _: N$ _' [0 z1 A6 g  n5 x0 Y
  4390. (defun c:ai_dim_texthome (/ ss)( ]0 x8 q" h3 ^( ]
  4391.   (ai_sysvar '("cmdecho" . 0))
    ; U7 M7 W. ^- X0 K3 U1 j2 x
  4392.   (if (setq ss (ssget "_I"))
    ! k  t$ x& T3 V7 b( _; T
  4393.     (command "_.dimedit" "_h")
    6 J0 H/ D9 Y6 d# e2 \2 |$ ]2 Z5 q
  4394.     (if (setq ss (ssget))8 N% Q9 A8 {# l0 ^6 a* T
  4395.       (command "_.dimedit" "_h" ss)* v# a7 I6 L5 _3 u$ I/ s1 N: |
  4396.     )
    . ]3 K4 y# q/ ^  ?  n2 ?) l  m
  4397.   )% f3 s* F4 _1 V* l2 b) X
  4398.   (ai_sysvar NIL)% Q( \& I* l* i5 `3 c& K
  4399.   (princ)! q- N7 m# E' {. F  z
  4400. )3 K) w- x- {5 J! E# ~+ r4 d
  4401. 2 @# O4 w  X6 `
  4402. , H  A! E6 b* ~- }3 f
  4403. ;;; Screen menu item for CIRCLE TaTaTan option.2 a" d& M+ [4 Q6 Q% R
  4404. ;;;     first, get points on entities
    % A5 u* o  `6 o0 s
  4405. (defun ai_circtanstart(): F( t' N! M0 O9 I+ ^
  4406.    (setq m:err *error* *error* *merr*). ~. q" w( P' g! e: V7 K7 ~$ p
  4407.    (ai_sysvar
    5 l+ _; R) ?9 V. G% m, g% H! H
  4408.       (list '("cmdecho" . 0)( T3 P# x# I" X( X( ~% M
  4409.          ;; make sure _tan pick for CIRCLE gets same entity; s  C+ q3 u* G6 o3 v3 X
  4410.          (cons "aperture"  (getvar "pickbox"))
    7 q7 {% S% {; h3 l, q7 q
  4411.           )
    ) R. S& L' ^' a
  4412.    )
    4 i7 O" \! w+ T% x" G$ Z5 ^
  4413.    ;; prompts are the same as CIRCLE/TTR command option
    / U% Z# O4 l7 E9 e4 C7 s
  4414.    (setq pt1 (ai_entsnap "\nEnter Tangent spec: "  nil))! q$ I' T/ ]5 ?- y+ N3 D6 R
  4415.    (setq pt2 (ai_entsnap "\nEnter second Tangent spec: " nil))
    & w+ {: Q2 ]8 H) F# V- U
  4416.    (setq pt3 (ai_entsnap "\nEnter third Tangent spec: "  nil))
    : U0 ^* q8 y( N$ q4 x$ J9 R, ~4 H4 o
  4417. )
    1 F8 c7 k9 ?+ z3 U- t  ?. p7 |
  4418. ;;; Command-line version
      g+ m% G) u0 a! z
  4419. (defun c:ai_circtan (/ pt1 pt2 pt3)
    # P3 B3 s0 y: I7 u
  4420.    (ai_circtanstart)2 Y8 h& y* I  y4 l! q
  4421. 8 _4 x( ?7 B4 k+ p+ z! x
  4422.    (ai_sysvar '("osmode" . 256))
    ( s8 F! @8 E: F* A
  4423.    (command "_.circle" "_3p" "_tan" pt1 "_tan" pt2 "_tan" pt3)
    1 ^, w7 L, `& G# D( s2 c
  4424.    4 D# H3 P# x! d7 Y0 l5 c, H- A; o
  4425.    (ai_sysvar nil)/ G! R) p, I+ k$ o  i; d
  4426.    (setq *error* m:err m:err nil)
    : m3 ?5 e3 N) M% ~; T) l' {& V6 s0 P
  4427.    (princ)* }' p* C; y- [# {: S
  4428. )! t: i9 n" |4 q
  4429. ;;; Use this if CMDNAMES == CIRCLE
    ) f8 {/ X5 y$ x+ n. a- I
  4430. (defun ai_circtan (/ pt1 pt2 pt3)- o  f& i0 P! [! |1 [  R2 Z8 U
  4431.    (ai_circtanstart)6 X: \: `3 @1 K& h

  4432. 2 d* u( r% C2 w) }
  4433.    (ai_sysvar '("osmode" . 256))
    * |- M9 z  ]$ }7 U. p0 @+ P
  4434.    (command "_3p" pt1  pt2  pt3). n0 z- V1 |1 [/ \. O) t9 |1 k; ~
  4435.    
    % _( g# Q, c+ z7 K9 c; ]$ H/ Y
  4436.    (ai_sysvar nil)8 `' h8 Q# y8 H! [  @+ Y- P
  4437.    (setq *error* m:err m:err nil)
    . G1 F$ z9 j, Z
  4438.    (princ)
    ; A8 P2 U9 e, B; q9 P* C0 q, B
  4439. )
    6 B4 p0 }! T! g' z/ Q' U7 \
  4440. + N7 z( D( b7 A" t. ]
  4441. & u8 R/ G' M" J( t, F* [

  4442.   W  Z% B; M2 b6 w
  4443. ;;; Shortcut menu Deselect All item.: d: }4 j, k: g1 }( {7 q

  4444. " J$ ]9 x5 c- ]
  4445. (defun ai_deselect ()# }' a; V3 v3 g; |9 I) E* c
  4446.    (if (= (getvar "cmdecho") 0)                        ;start if
    . [5 K9 v; J0 \- t5 a# N3 M1 B
  4447.        (command "_.select" "_r" "_all" "")( a/ j$ o  f( n) s- Q( a6 D
  4448.        (progn                                        ;start progn for cmdecho 1
    ) j8 |& d; A. a) a& L4 B. A' }! G
  4449.            (setvar "cmdecho" 0): q! o5 t/ e$ m  t! \
  4450.            (command "_.select" "_r" "_all" "")
    ; A. l" B, i5 w& L7 e
  4451.            (setvar "cmdecho" 1)
    3 h* o) b1 Y2 Y( x; @5 J9 k
  4452.        )                                        ;end progn for cmdecho 1
    ! w/ J3 C0 k% y" b9 t8 I
  4453.    )                                                ;end if: y8 B# i* ]( J
  4454.    (terpri)7 i' ?+ E( ?- y) {5 y9 }" s
  4455.    (prompt "Everything has been deselected")
      z+ ^- S. j( M0 x
  4456.    (princ). ~& w4 E  ~* q2 [
  4457. )) ~* C$ Z+ r; v* o* u

  4458. % Y& P0 [( k9 C4 ~; ?
  4459. ;;; Command version of ai_deselect to be called from the CUI2 D2 F: ?6 p8 v8 c* d
  4460. ;;; so it gets properly recorded by the Action Recorder
    8 B$ U. G6 v8 p! g4 t
  4461. ;;;
    9 B( a: M0 R! [% I5 s2 h7 l, }
  4462. (defun c:ai_deselect ()! H) f- D& [" u) V
  4463.   (ai_deselect)
    % w) f' N6 P% Z7 f
  4464.   (princ)- M0 O5 z9 I- A% o8 m
  4465. )
    8 B8 e5 l' b) b0 @: M& S. y
  4466. + _& Z6 W* x4 X9 y; q. W. N
  4467. ;;;
    8 ~; |" m+ V% E9 Z
  4468. ;;; Enable Draworder to be called from a menu3 Q+ q! L7 V( n( h" |: y
  4469. ;;; Checks for Pickfirst selected objects3 e# L- B  H+ X/ t% W1 H
  4470. ;;;, X: i' g7 a5 T: C( T5 A
  4471. 6 j7 w7 K! ]* k0 x
  4472. (defun ai_draworder (option / ss )) r) [9 V3 d! s* W4 H2 P) @' v8 R
  4473. 5 ?: Y6 m$ e3 b7 I
  4474.   (setq m:err *error* *error* *merr*)7 T1 a* T, i: U# e4 ]
  4475.   (ai_sysvar '("cmdecho" . 0))
    7 m) a$ I( E5 y% O; e2 x
  4476. + k1 T' f/ j) p5 @* G7 a9 ]9 t
  4477.   (if (setq ss (ssget "_I"))
    6 A; v) w8 S5 K) R4 e
  4478.     (command "_.draworder" option)
    : T( l! l& P. _
  4479.     (if (setq ss (ssget))
    . w. F# a$ {0 e% Q0 h
  4480.       (command "_.draworder" ss "" option)
    3 T4 l( [. ^, ~6 J, o
  4481.     )
    8 X( o. w. w/ i2 n+ R  h
  4482.   )8 W/ }' e8 q( H3 s, C
  4483.   (ai_sysvar NIL)+ K0 p- N. O/ L9 P  k- u9 [& a& U$ z
  4484.   (setq *error* m:err m:err nil)
    - k8 _  o- V1 j3 U  Z: _

  4485. " @& [( M  M% u; ~
  4486.   (princ)6 [7 a) p! C; a, h
  4487. )
    - G3 R2 L$ r, j/ r4 C4 y

  4488. 2 ^4 |0 F! k! k
  4489. ;;; Command version of ai_draworder to be called from the CUI
    9 H- J, H  V7 h
  4490. ;;; so it gets properly recorded by the Action Recorder
    / R; t5 n3 |+ ^/ Z9 T4 j$ `, |
  4491. ;;;1 y5 B# o& _! Z2 d( I
  4492. (defun c:ai_draworder ()
    . _" o( W% F8 A* N5 k) l2 {
  4493.   (initget "Above Under Front Back")
    ( N) Q% F! q4 w: K% z- I4 {
  4494.   (ai_draworder (strcat "_" (getkword)))2 p( I* ^3 G, Y6 Z
  4495.   (princ); g2 i& [$ j- V/ ?
  4496. )
    2 v; ~2 E; x# B- Q7 ]
  4497. * y. ]% W; L! H
  4498. (defun c:vlisp ()  Y  Z+ B0 ~* j( ~( V/ Z- O
  4499.   (if (/= nil c:vlide) (c:vlide))
    6 e9 e( W% l  l4 `
  4500. )0 k% z( e7 J4 N' g! H

  4501. 8 {5 U% T0 \" Z* {$ {5 e9 Y
  4502. (princ "loaded.")
    ; G  s/ N! ~6 l) [; P

  4503. ( ?! r; Z2 m7 b
  4504. ;; Silent load.1 l1 ]. o2 I9 I0 Z, j; k3 C' L) r
  4505. (princ)
    , j/ |. y, H) H1 @% h7 G5 O

  4506. ) t5 p7 ~6 ^- Z' ?. J
  4507. ;;;----------------------------------------------------------------------------* M% @$ i) B3 s/ k; u& n, p( x! U) L
  4508. ;;;
    1 o% c% d- b; B( V% g  z
  4509. ;;;   DDCHPROP.LSP   Version 0.55 d- C% G" r- `8 D$ G* o0 H
  4510. ;;;$ W* r2 T4 @  a
  4511. ;;;   Copyright (C) 1991-1993 by Autodesk, Inc.+ c: u) Y1 W0 T$ V  Y
  4512. ;;;
    , i+ u4 q8 J$ [( A# m5 `1 ]
  4513. ;;;   Permission to use, copy, modify, and distribute this software( g9 k; r- x- ^: ?; v
  4514. ;;;   for any purpose and without fee is hereby granted, provided) x& J3 o! E( a5 }
  4515. ;;;   that the above copyright notice appears in all copies and that
    % {* l9 F4 G: j! I* F
  4516. ;;;   both that copyright notice and this permission notice appear in
    & J1 M. a1 Y. U" `# l
  4517. ;;;   all supporting documentation.
    / }$ j: I% K) z6 E. ~7 E
  4518. ;;;7 N  W  l: [4 ]3 ?$ k* [5 w
  4519. ;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED$ E. z* C. C5 y0 E; i1 v
  4520. ;;;   WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
    ! c$ y+ H* H0 w/ N) T4 m2 g
  4521. ;;;   PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
    # Y7 l& F, t+ f
  4522. ;;;
    * t; P* {! \1 d
  4523. ;;;   2 February 1992( J  ~' ?- o9 u3 E9 F! y
  4524. ;;;   9 N( h, b, }0 d' w- s
  4525. ;;;----------------------------------------------------------------------------3 X% d) m  H7 a2 F7 n5 g6 E
  4526. ;;;   DESCRIPTION
    / V7 [) ^4 p1 J4 B3 h& K* Z2 C2 y" O( S
  4527. ;;;----------------------------------------------------------------------------' G7 n$ Q2 J. _# P0 Z' q
  4528. ;;;   C:DDCHPROP is a dialogue interface for the CHPROP command.! P/ x, f& K+ z( ^( \
  4529. ;;;) ~7 |: A9 a0 `& z! s# E
  4530. ;;;   The command looks similar to DDEMODES.  The main dialogue has an image
    3 w6 `6 ]) I9 O- V
  4531. ;;;   tile, 3 buttons (layer, color, linetype), and an editbox (thickness).   
    . d$ H& b1 E2 ?! M: P
  4532. ;;;   The 3 buttons each launch a sub-dialogue containing a list and edit box.  
    # n6 s, H" d$ m6 p: B
  4533. ;;;   The dialogues are all defined in the DDCHPROP.DCL file.6 i, [/ V6 F/ y& L- z% n; N$ E
  4534. ;;;
    " [% x6 |9 M0 |! k0 y
  4535. ;;;
    $ K; W4 s0 U! Z5 C; y9 H; c
  4536. ;;;----------------------------------------------------------------------------: g' _! f* W7 O& D3 t
  4537. ;;;----------------------------------------------------------------------------# [  B1 @+ e4 l& j$ K) K5 \
  4538. ;;;   Prefixes in command and keyword strings:
    : ~  P: S+ S0 s8 V; s5 Q% D1 j
  4539. ;;;      "."  specifies the built-in AutoCAD command in case it has been        ) u8 |5 g8 f( R! v, F8 A
  4540. ;;;           redefined.) G+ C1 C; z. Z9 y4 e
  4541. ;;;      "_"  denotes an AutoCAD command or keyword in the native language
    : v7 _: X# r! @0 c
  4542. ;;;           version, English.2 f+ p- g( }: d* @9 s
  4543. ;;;----------------------------------------------------------------------------
    5 Q5 K; x/ F" O; P
  4544. ;;;, q: `5 d5 z- i6 _7 O! |2 r
  4545. ;;;
    ; C3 [2 Y( \! r$ i
  4546. ;;; ===========================================================================
    6 @) S" E. W) D' f& K" [# X# A* @% W" r) {
  4547. ;;; ===================== load-time error checking ============================, H* K6 u1 X2 |$ H
  4548. ;;;4 W# F9 g( ~0 S- A- ?  x

  4549. 4 A  G* Y) G. X( E0 m
  4550.   (defun ai_abort (app msg)
    2 }6 ^9 M- V" E" e/ w7 ?4 G
  4551.      (defun *error* (s)& g- J5 t! d2 y
  4552.         (if old_error (setq *error* old_error))1 H4 b: ]5 m( Q# m9 L
  4553.         (princ)  A- ]& t: e: K6 c/ }# l
  4554.      )) P) B8 n% O+ Z0 ~
  4555.      (if msg
    + E" ?1 {" ?  x/ C
  4556.        (alert (strcat " Application error: "
    - Z+ Z! Y5 b( ^& ~5 a/ A8 R
  4557.                       app) ~  J6 d# a) B$ Q
  4558.                       " \n\n  "
    ) G( b5 S( c8 N# ~, h6 P2 p
  4559.                       msg
    * e8 Y* R3 k, y
  4560.                       "  \n") |, [. N# I" G7 s2 z" L# ~; W
  4561.               )2 P* ]( A9 n+ d4 D0 X( N8 Y* C
  4562.        )  B, b/ ~7 {, E  c- d8 _
  4563.      )5 I9 G. y3 t2 z1 V! R
  4564.      (exit)
    ! O" ~. S/ r& |" f
  4565.   )8 |! y$ C& J6 u# i4 J& k# u

  4566. 5 V7 U9 u, b/ p- }4 s0 Q0 p
  4567. ;;; Check to see if AI_UTILS is loaded, If not, try to find it,, ~0 s# U: U+ E
  4568. ;;; and then try to load it.
    ; g% z( R3 e% S
  4569. ;;;
    / K& B1 n& H. S  K
  4570. ;;; If it can't be found or it can't be loaded, then abort the
    ; B3 }$ b5 K, X. P
  4571. ;;; loading of this file immediately, preserving the (autoload)5 C6 V( Q0 r- t) u
  4572. ;;; stub function.
    2 t7 z1 x% w9 J5 i

  4573. ( H2 ?0 M3 H$ }% B
  4574.   (cond- C7 s% ?+ g- B/ O9 i
  4575.      (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.! r* L' H% ?: ]1 s3 e7 u

  4576.   P/ u* |% b$ P
  4577.      (  (not (findfile "ai_utils.lsp"))                     ; find it1 ?# \. s+ t9 `/ T+ w* A# n
  4578.         (ai_abort "DDCHPROP"
    $ e; a( x$ V4 V  ^
  4579.                   (strcat "Can't locate file AI_UTILS.LSP."9 N! ^) d8 \6 }- o7 s$ f9 H
  4580.                           "\n Check support directory."))): l. H$ O/ C3 p+ y+ E
  4581. ; I5 }; C9 t1 f5 N. i, W' ]. b
  4582.      (  (eq "failed" (load "ai_utils" "failed"))            ; load it6 P% H! c3 M0 o! w6 z5 e  _: V
  4583.         (ai_abort "DDCHPROP" "Can't load file AI_UTILS.LSP"))" a+ o6 E$ Q2 U. e
  4584.   )
    ; b8 N2 X5 V( Q' a: O7 ]# k

  4585. ) ]* v6 Y7 g( G0 o9 |4 k6 C6 [
  4586.   (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
    & f$ `( e8 g4 ^5 |
  4587.       (ai_abort "DDCHPROP" nil)        ; a Nil <msg> supresses
    . ?, X& d, B* N2 `/ o1 M: j
  4588.   )                                    ; ai_abort's alert box dialog.  ]/ p9 a' Q4 ?& |1 `9 k, Y

  4589. 0 x4 ^/ a* v& @: V4 v
  4590. ;;; ==================== end load-time operations ===========================+ r+ h) P! }9 c" t; O* X" {. ~# o3 {
  4591. 6 {8 K8 A/ d" o! M! o
  4592. ;;; Initialize program subroutines and variables., z( m9 L+ ~! x) n! @
  4593. - |& i! J. e  s5 V
  4594. (defun ddchprop_init ()
    & @" k& [5 _7 ?4 U: z& _

  4595. 3 \9 X8 l# b9 U! S$ Q
  4596.   ;;: \6 g* w% l8 w. c6 E" B; i
  4597.   ;; Define buttons and set values in CHPROP dialogue box 9 h/ M' r9 ~) b3 B3 o. j$ A/ p
  4598.   ;;
    2 \9 t; P" Z1 I2 e
  4599.   (defun call_chp ()
    ' V1 o) B: V7 `4 Q9 @( C  l- {3 m3 h
  4600.     (if (not (new_dialog "ch_prop" dcl_id)) (exit))
    ( x6 @1 a9 J5 h8 i1 ^. e5 F
  4601.     (set_tile "error" "")
    , S( `8 }8 S5 u
  4602.     ;; Set initial dialogue tile values2 l) h. d# a" [- W
  4603.     (set_col_tile). u  N4 L8 Y9 X1 J% ^1 K! \$ }
  4604.     (if (= lay-idx nil)
    ! P! @9 q$ h3 \9 ~( ^- @
  4605.       (set_tile "t_layer" "Varies")
    # K9 c0 E# p4 _; r! C, r; @
  4606.       (set_tile "t_layer" (nth lay-idx laynmlst))5 g' J: x9 r& w# w
  4607.     )& D/ N% O0 c! r
  4608.     (cond - f8 A4 y  S, o) ?
  4609.       ((= lt-idx nil)0 N& x' ~, ~4 r" K7 q4 D, r
  4610.         (set_tile "t_ltype" "Varies")
    1 _6 O  s( ~5 E, V+ [
  4611.       )
    " w2 m' _9 i4 I
  4612.       ((= lt-idx 0) ; set tile "By layer & layer linetype": _3 J6 k0 ?# `6 u
  4613.         (set_tile "t_ltype" (bylayer_lt))
    6 X: Q2 z$ _4 n$ O- F; K$ t9 k
  4614.       )
    . T6 J, d! _% `
  4615.       (T
    6 T& V1 {) {# t" {6 z  d
  4616.         (set_tile "t_ltype" (nth lt-idx ltnmlst))2 @" h+ K) V# ~
  4617.       )$ I& W! P) q! c* `1 U) M
  4618.     )" Z9 W- I8 a# j
  4619.     (if (or (= ethickness nil) (= ethickness "Varies"))  Z! H; _4 x) X3 {. x8 h5 s; A
  4620.       (set_tile "eb_thickness" "Varies"), v( t, J) [- D  _! d& J# T
  4621.       (set_tile "eb_thickness" (rtos ethickness))8 q) ]0 e, o  j+ G5 H5 G. E* i
  4622.     )
    ' U4 G# o6 _. w( ]3 J
  4623.     ;; Define action for tiles; s. z2 T" w) \8 ^* y( ^, l$ S" d
  4624.     (action_tile "b_color" "(setq ecolor (getcolor))")) P- h7 c: B: e. F- ~' H. g
  4625.     (action_tile "show_image" "(setq ecolor (getcolor))")
    * P& t8 l2 U- }, N: I5 {
  4626.     (action_tile "b_name" "(setq elayer (getlayer))"). Y) l, g; w( t+ s7 \: p
  4627.     (action_tile "b_line" "(setq eltype (getltype))")
    & N) u1 {1 m( \
  4628.     (action_tile "eb_thickness"  "(getthickness $value)")
    7 s6 ]% B+ o, J0 x8 Z
  4629.     (action_tile "help" "(acad_helpdlg \"acad.hlp\"  \"ddchprop\")"): O% D2 W& _8 g: k- g
  4630.     (action_tile "accept" "(test-ok)")
    2 M% G; w: T* o* q
  4631.     (if (= (start_dialog) 1)
    # O% M0 ^7 H/ @  e, X
  4632.       (progn8 Q$ P  h' ?4 ^! S& P
  4633.         (command "_.chprop" ss "")$ A$ S3 I% B8 n3 Z$ f$ g9 r" c
  4634.         (if ecolor
    0 {8 [9 X% {: C+ H& x5 z
  4635.           (progn
    2 A% Y& z( J# D7 ?& ?6 E
  4636.             (if (= 0 ecolor )   (setq ecolor "BYBLOCK"))1 a2 b% K; S& E; W( H( G1 O( x9 e$ u
  4637.             (if (= 256 ecolor ) (setq ecolor "BYLAYER"))
    # s. y6 {/ E' ?$ g- a
  4638.             (command "_c" ecolor)
    $ i8 O; b7 l. |* _8 w
  4639.           )5 E3 t0 c& D! a
  4640.         )
    9 a" C/ J7 V/ [. t( ^. \  V
  4641.         (if (and (/= eltype "Varies") lt-idx)
    ; N6 V: P2 h9 J
  4642.           (command "_lt" eltype)
    1 C% {# o9 c8 ~& B+ R- A6 C
  4643.         ); @; H; H/ z5 ]
  4644.         (if (and (/= elayer "Varies") lay-idx)$ e$ Q. {' J! W, x
  4645.           (command "_la" elayer)
    $ d/ \& V6 r; q* u+ v0 v
  4646.         )
    ; w9 x, a6 g6 ?0 ]& p0 N
  4647.         (if (and (/= ethickness "Varies") ethickness)( E5 Q, D8 a$ l1 h) r& N& y
  4648.           (command "_t" ethickness)
    2 W! r# z0 R7 J0 _8 u
  4649.         )
    . p4 j- {" ~$ w+ R7 L7 Q1 H
  4650.         (command "")* d( `+ |* Z- F2 s. _! _, c% U
  4651.       )2 u8 F* c  t5 {, k9 o- @
  4652.       (princ "\nProperties unchanged")1 A5 |0 u6 N! d' {4 |( H& Z
  4653.     )
    + l/ X$ j/ Q# S+ d  A* Y
  4654.     (princ)
    " C. D0 U6 v. Q* [
  4655.   )
      h1 h- l1 W6 u$ s; |+ N9 j% l" M2 H
  4656.   ;;
    5 \/ M& J, o" I9 z, P' F0 d
  4657.   ;; Function to set the Color text tile and swab to the current color value.
    2 D! }' V4 B. h" X4 y" E
  4658.   ;;
    . A' k# l" q; x1 d+ q. F
  4659.   (defun set_col_tile()6 [" J2 C% q. E. q- F. i
  4660.     (cond + U3 `* z( E! z% g# {7 M* _
  4661.       ((= ecolor nil)% ~. N% T, ~  F9 ]& u+ P
  4662.         (set_tile "t_color" "Varies")9 [/ v8 c, c' v  u+ U& P8 ~* m
  4663.         (col_tile "show_image" 0 nil)
    0 F, Z. o. h( W; q& @+ f' }, H
  4664.       )) L( n. l$ K3 I, M" O. s, H7 O
  4665.       ((= ecolor 0)
    7 A' v6 V0 F6 }1 [' X9 a
  4666.         (set_tile "t_color" "BYBLOCK")- f8 q' h* D& O2 G
  4667.         (col_tile "show_image" 0 nil)
    3 ^0 \! w, C5 h. E
  4668.       )
    8 t9 ~7 A$ P$ v" r" B5 q4 ^2 [
  4669.       ((= ecolor 1)& }6 h) _. ]! m" B% \( H: r
  4670.         (set_tile "t_color" "1 red")
    - v0 h" K! n0 t
  4671.         (col_tile "show_image" 1 nil)
    , T) U' u: f+ R3 Y
  4672.       )6 ?# @- F9 r/ K; g1 [! o) j
  4673.       ((= ecolor 2)7 ^1 |5 [- A, X. s; M  z, \$ ~" O" K
  4674.         (set_tile "t_color" "2 yellow"); T# B' G) ]5 n  N1 u& [
  4675.         (col_tile "show_image" 2 nil)
    / s/ h0 o, f% {1 f8 b" v# b# O5 i
  4676.       )
    ! \2 k. D& f  {  Y5 k+ L
  4677.       ((= ecolor 3)
    5 Y3 r: `) }. {$ A& j, K' \+ v
  4678.         (set_tile "t_color" "3 green")
    3 Z4 ^/ g) C; y, q' O
  4679.         (col_tile "show_image" 3 nil)9 j  w& z$ w/ R$ d8 o5 u) h9 z
  4680.       )
    + A+ r1 _+ M1 B- I6 w5 ?
  4681.       ((= ecolor 4); c, q7 y) X6 B7 S1 q- @+ ~
  4682.         (set_tile "t_color" "4 cyan"), ?& o: K) N- Y! p  B3 z
  4683.         (col_tile "show_image" 4 nil)
    * {* X. _. b9 H0 ^: F, Y3 R
  4684.       )$ k  R( j9 N' D0 |1 J* M9 Q
  4685.       ((= ecolor 5)
    : L* V" ^6 i: [: s2 W+ Y: Y1 H
  4686.         (set_tile "t_color" "5 blue"). ]* Y- h* }2 @9 U
  4687.         (col_tile "show_image" 5 nil)
    ! @$ X+ b8 {8 R. Y8 Z* s
  4688.       )  e# F6 x+ u7 J& U
  4689.       ((= ecolor 6)
    3 F, _# e) c/ y* l: X, o
  4690.         (set_tile "t_color" "6 magenta")2 W0 N, b' w$ U+ Z3 }" t2 Y
  4691.         (col_tile "show_image" 6 nil)( z4 K- {5 b3 u/ h; |5 R
  4692.       )$ s# [: `* X8 v8 x7 G  h. t
  4693.       ((= ecolor 7)
    % G# S/ A1 p* ]$ x2 {! C. [4 j# l
  4694.         (set_tile "t_color" "7 white")
    4 D) d; h7 e8 ^# I/ _$ Y
  4695.         (col_tile "show_image" 7 nil)
    ) k- y. ]6 U) W- L( m* V7 K) W+ T
  4696.       )6 D' C4 h# ~& _/ B; i
  4697.       ;; If the color is "BYLAYER", then set the tile to; C5 v( E: g& K! V
  4698.       ;; show it's set By layer, but also indicate the
    . {8 p1 X6 @- d/ n5 [% c
  4699.       ;; color of the layer - i.e. By layer (red)
    & U7 E$ `, D! `6 _& k
  4700.       ((= ecolor 256)
    - O4 J! J$ @: |- A& \
  4701.         (set_tile "t_color" (bylayer_col))" @! d+ `, `4 B, X. }
  4702.         (col_tile "show_image" cn nil)" v* P; \: j- `! r  k/ x$ z
  4703.       )
    7 R" H) O9 {( ^4 j! O, ?  m
  4704.       (T
    - o2 I- m; Z5 u# k
  4705.         (set_tile "t_color" (itoa ecolor))- u6 z7 z  p/ N" y: L
  4706.         (col_tile "show_image" ecolor nil)" e: f6 ^5 `0 c+ w9 r8 P5 y) l
  4707.       )
    ' z) H) w( W1 G( Q& J& C/ s
  4708.     )* H& T; p$ o0 c% N, K# e; f
  4709.   )! G0 E6 B- b, [" Y% Y* Q+ Z5 o/ y
  4710.   ;;+ |# }1 }! V0 E2 \$ M/ t/ `- X
  4711.   ;;  Function to put up the standard color dialogue.* P- E. y7 ?+ i7 L- }2 T/ Z+ _* A
  4712.   ;;9 H! x, h) L! `6 O0 m
  4713.   (defun getcolor(/ col_def lay_clr temp_color). w% ?  ^) R, w; N
  4714.     ;; col_def is the default color used when rq_color is called.  If ecolor
    4 D' t7 ^; t( w$ I9 @# L" }
  4715.     ;; is nil (varies) then set it to 1, else use the value of ecolor.
    2 D  l) |  v/ f3 c1 z
  4716.     (if ecolor2 [. [2 O' w/ I7 V2 Q, d/ ]9 x5 d
  4717.       (setq col_def ecolor)
      P8 p$ L8 e4 h( t' x0 L( E% h
  4718.       (setq col_def 1)9 v6 M; y- M2 J1 U; E" ?5 D* |
  4719.     )
    % x' e8 P0 R# |1 Q& l. w8 Y
  4720.        + t, E# d8 i+ Z! Q% N
  4721.     ;; If we're working with a single layer, get its color! s+ E. P" |. ]4 d
  4722.     ;; for use in the color swatch if the user selects color BYLAYER.
      N- F$ e6 E$ B6 Z% K$ p
  4723.     (if (/= elayer "Varies")
    $ i, f! c. {" Y. j- g% `, H% t3 i
  4724.       (setq lay_clr (cdr (assoc 62 (tblsearch "layer" elayer))))
    . C7 Z; W5 h- x3 b" O* _
  4725.       (setq lay_clr 0). z- A0 k8 h: s, R- `9 i; v
  4726.     )$ r$ ?5 w# `# e( R1 N
  4727.     (if (numberp (setq temp_color (acad_colordlg col_def T lay_clr)))
    . w& ?* g/ J* k4 Z2 m* `# v
  4728.       (progn
    3 O! Y% U( v- X9 O9 y
  4729.         (setq ecolor temp_color)) V4 u1 ?$ D6 y. F; d4 D1 j/ V
  4730.         (set_col_tile)* e0 A$ r* ~; N/ ?9 v6 K
  4731.         ecolor2 M4 D7 T+ u) a: A
  4732.       )
    : Q( E/ z1 v) U# E8 h* s- Z$ O( @; \& b
  4733.       ecolor, L% L0 h: H0 ]$ E
  4734.     )  " E' ?4 S& U  n* h0 M+ F
  4735.   )
    $ ^3 k, A. u! Z3 w: |5 y" v
  4736.   ;;% |8 C2 E1 t# H& ~) b/ F, X
  4737.   ;; This function pops a dialogue box consisting of a list box, image tile,
    ; T- M( \$ D: z1 ~" N
  4738.   ;; and edit box to allow the user to select or type a linetype.  It returns " |9 s3 M( z+ c6 u  |/ @5 I6 r
  4739.   ;; the linetype selected., ?3 a2 E0 b; P! K; C' @
  4740.   ;;
    ( L* Z; r, y7 a/ H
  4741.   (defun getltype (/ old-idx ltname)
    4 _% b- F& l6 e* }* R
  4742.     ;; Initialize a dialogue from dialogue file
    * S5 d8 I" i, _5 G) R4 \6 U
  4743.     (if (not (new_dialog "setltype" dcl_id)) (exit))
    * l! Z9 N" B- I( C9 o
  4744.     (start_list "list_lt"): X  k) K4 k) J( g, Z
  4745.     (mapcar 'add_list ltnmlst)         ; initialize list box
    & z) A/ o; A7 K6 r7 V9 i8 Y
  4746.     (end_list)
    ( \1 q5 }! Q! ~+ N& L2 h9 _
  4747.     (setq old-idx lt-idx)
    ' t5 w" b( G' ~5 M
  4748.     ;; Show initial ltype in image tile, list box, and edit box
    ; k% G$ ?$ K; l( H. K
  4749.     (if (/= lt-idx nil)6 D$ b% \6 G7 J; R" f9 v8 H
  4750.       (ltlist_act (itoa lt-idx))
    5 f$ Y+ N: P! A; r' R
  4751.       (progn
    , e$ m1 M3 G0 F- y( }, V# n
  4752.         (set_tile "edit_lt" "Varies")) _: W; B: ]( j! x& x0 t% t2 L9 C
  4753.         (col_tile "show_image" 0 nil)
    8 P/ Y) K1 g2 i) `
  4754.       )
      g5 U) O- @, ], z7 e
  4755.     )  f) P# Y1 |4 d& t- w- n
  4756.     (action_tile "list_lt" "(ltlist_act $value)")% T7 U: u, Q9 n0 v9 p3 N. L$ M
  4757.     (action_tile "edit_lt" "(ltedit_act $value)"): `# Z4 N/ \( j3 s6 r" R( b  E6 _
  4758.     (action_tile "accept" "(test-ok)")
    - }' w5 q- ~  w
  4759.     (action_tile "cancel" "(reset-lt)")7 G' U# }" Z. n3 N  {
  4760.     (if (= (start_dialog) 1)           ; User pressed OK
    ' z1 P0 f' r, ~
  4761.       (cond 7 i* Q3 j' m2 @7 z8 A
  4762.         ((= lt-idx nil)- A& B: v1 S9 ^; M- D& B
  4763.           (set_tile "t_ltype" "Varies")
    8 _3 ^3 R5 z+ Y; F6 \" Z
  4764.           "Varies"
    8 O  l+ D# G' ~% K
  4765.         )
    / `; @( [7 R  b) b" ?9 k' X
  4766.         ((= lt-idx 0)5 \, a2 _; }) v& M' U# g
  4767.           (set_tile "t_ltype" (bylayer_lt)), m1 r' ?: D4 z8 p7 J
  4768.           "BYLAYER"( q! m. w$ j- s4 W; c
  4769.         )
    # i" Z4 z( u! P# z6 d: y5 u
  4770.         ((= lt-idx 1)
    + h  h2 M) [5 k6 X
  4771.           (set_tile "t_ltype" "BYBLOCK")+ o# Y" T0 V2 u" d6 E0 \# s
  4772.           "BYBLOCK") m5 z: ]4 F$ b: _+ b" q
  4773.         )
    . Q. ^1 E3 M- ?/ X
  4774.         (T  
    8 {) G: |3 R) o8 n
  4775.           (set_tile "t_ltype" ltname) ( \8 S& U& c$ J6 u, _
  4776.           ltname. i# U7 o4 Z  n, G: ]
  4777.         )* L; S" s: i5 k# q# E1 _
  4778.       )( b. V* K, C- @' D% ^6 ?
  4779.       eltype
    ! ?/ I- t! i, e9 k; q+ b) D% R
  4780.     )
    * F" d: p1 F6 [4 n4 h8 \0 H6 X) j
  4781.   )# ?& d* }! D, G2 @: l3 r. S9 |
  4782.   ;;- \2 J% v: L. S. N+ p% V
  4783.   ;; Edit box entries end up here7 W' N& w' T# }) w
  4784.   ;;
    % R& T. ~6 G' I1 J, g9 l8 q
  4785.   (defun ltedit_act (ltvalue)6 _' j8 u# [8 _5 N
  4786.     ;; If linetype name,is valid, then clear error string,
    ! _; s, s7 S- P! D( O$ m
  4787.     ;; call ltlist_act function, and change focus to list box.0 e- W7 G, M3 H" w/ a
  4788.     ;; Else print error message.+ W. O. n/ e) M8 J) X0 k- M4 B+ Q8 t- W
  4789.     (setq ltvalue (strcase ltvalue))4 l7 j2 M" i2 ?
  4790.     (if (or (= ltvalue "BYLAYER") (= ltvalue "BY LAYER"))
    % H% G/ d! F) s2 n! w3 S
  4791.       (setq ltvalue "BYLAYER")8 _+ L0 _! g( `$ v$ S  W
  4792.     )4 N( _  R4 W# m0 }3 ?6 _: {
  4793.     (if (or (= ltvalue "BYBLOCK") (= ltvalue "BY BLOCK"))" J# g+ `* R, I3 n
  4794.       (setq ltvalue "BYBLOCK")& n" X/ n7 j( d4 H2 n3 c/ y0 M
  4795.     )
    4 C% e' S% y/ N9 i! K1 v  g# l
  4796.     (if (setq lt-idx (getindex ltvalue ltnmlst))
    ; q: f5 i$ x7 I( P8 y. c
  4797.       (progn! f7 r' `+ K. W2 N) G
  4798.         (set_tile "error" "")' w8 D0 S" d" `1 h  n  V/ d! s
  4799.         (ltlist_act (itoa lt-idx)), F+ e8 p/ }5 B
  4800.         (mode_tile "list_lt" 2)
    7 O0 t. t' I5 P' b
  4801.       )) S' b3 ^# T/ K$ J1 t
  4802.       (progn
    8 V" P; G* j/ N( z  N, _5 J& U6 h
  4803.         (if (/= ltvalue "VARIES")
    $ ^4 K6 [8 j! I/ Z3 ]7 H* |5 ^3 }$ p
  4804.           (set_tile "error" "Invalid linetype.")
    6 A, L( ^" s, @  I4 X8 j/ Z) G7 W9 O
  4805.         )
    ( x8 a% D. y' |  l' V7 e* c
  4806.         (setq lt-idx old-idx)
    4 ^( H) _* _# W( k
  4807.       ) 1 ^) |% s) L3 \; w
  4808.     )' }& \$ l: O0 A5 ]
  4809.   )
    + d  u& n+ J+ w& [4 D  v
  4810.   ;;2 Q2 e- l1 S" W: T, J2 {* a
  4811.   ;; List selections end up here
    ( i; c  C9 O8 \+ A
  4812.   ;;3 h1 G/ n/ @% e1 k
  4813.   (defun ltlist_act (index / dashdata)' r8 i7 f5 t) m8 R* o6 K6 O8 w
  4814.     ;; Update the list box, edit box, and color tile" b6 O# A7 K! ^
  4815.     (set_tile "error" "")
    6 L. n. g, p# t5 Q. B; }
  4816.     (setq lt-idx (atoi index))
    , ]  H0 W3 j  Z; i9 h, i
  4817.     (setq ltname (nth lt-idx ltnmlst))) q& @* m& z8 Y
  4818.     (setq dashdata (nth lt-idx mdashlist))! A9 P- W6 H' W; v$ w
  4819.     (col_tile "show_image" 0 dashdata)7 N7 z& H0 z6 A3 ?- R3 K
  4820.     (set_tile "list_lt" (itoa lt-idx))
    & }  Q% p( H' c7 B. \  a$ Z
  4821.     (set_tile "edit_lt" ltname)
    + [1 o& ^$ w" l- L$ s# \
  4822.   )
    4 e7 O3 i7 V6 l4 S
  4823.   ;;# {) G4 F% n& N/ w! q2 C, ~0 x+ q  A
  4824.   ;; Reset to original linetype when cancel it selected& o& e/ H; O( S& e, d9 W' S
  4825.   ;;
    : x- d% a" p3 E+ d0 {/ Y0 Y
  4826.   (defun reset-lt ()1 J) K- a) x" x9 M; G+ Z' ]
  4827.     (setq lt-idx old-idx): I6 s6 q. C$ q  l* |
  4828.     (done_dialog 0)0 g2 H. ^0 J3 V2 A% x4 J% M" i
  4829.   )) P' Z; M. \! Q5 S/ T- \
  4830.   ;;7 b$ ]5 R5 \+ g( r, Z5 h
  4831.   ;; This function pops a dialogue box consisting of a list box and edit box to
    1 n" t1 B) ]: n% |; c: i2 j
  4832.   ;; allow the user to select or type a layer name.  It returns the layer name
    4 [% R* A2 ]7 P* M& J
  4833.   ;; selected.  It also the status (On, Off, Frozen, etc.) of all layer in the
    2 d' K9 I3 w2 q
  4834.   ;; drawing.1 o' R- {  y% l: i* A$ E$ u0 b
  4835.   ;;
    7 h* v+ u2 K# @# h
  4836.   (defun getlayer (/ old-idx layname on off frozth linetype colname)
    ) ?/ A# ^! t* e7 g3 P
  4837.     ;; Load a dialogue from dialogue file- {0 J; r- I3 L, j+ p: k' L
  4838.     (if (not (new_dialog "setlayer" dcl_id)) (exit))
      j& `. `. V- Z* R, \
  4839.     (start_list "list_lay")
    7 J0 w7 L; P  z" ^, E: H5 z* }6 ?& \
  4840.     (mapcar 'add_list longlist)        ; initialize list box* f9 N+ Q, }) t9 X, R$ R+ M. M
  4841.     (end_list)
    3 A/ f6 C8 n7 H! |! P) A
  4842.     ;; Display current layer, show initial layer name in edit
    $ A8 K% s, e7 Q' I4 O; h
  4843.     ;; box, and highlight list box.: w$ e: O% `, q% m* }5 }
  4844.     (setq old-idx lay-idx)
    ( M' G2 J# b1 S# R2 d+ a. [/ s
  4845.     (if (/= lay-idx nil) (laylist_act (itoa lay-idx)))5 v+ K4 r8 H9 e! j) T5 u3 @
  4846.     (set_tile "cur_layer" (getvar "clayer"))" R: K! M+ s8 j; |0 F( Z
  4847.     (action_tile "list_lay" "(laylist_act $value)")# h; p1 s; R, C+ X
  4848.     (action_tile "edit_lay" "(layedit_act $value)")* L& a! E, E# F6 E' h
  4849.     (action_tile "accept" "(test-ok)")
    1 t; T/ U7 O2 K% M/ s
  4850.     (action_tile "cancel" "(reset-lay)")
    ; Q% M' a0 @1 s0 M7 c/ {
  4851.     (if (= (start_dialog) 1)           ; User pressed OK
    ( J% ?3 L6 b9 }8 X
  4852.       (progn! C5 Z% d' F# _7 p! z
  4853.         (if (= lay-idx nil) (setq layname "Varies"))
    2 n9 p9 D. _8 O: x7 r
  4854.         (set_tile "t_layer" layname)
    + p& s  S4 d) b: ]  m. m
  4855.         ; If layer or ltype equals bylayer reset their tiles
    ! |- w3 A, X' }+ c( ~/ H2 @
  4856.         (if (= lt-idx 0)  {0 T3 S( K9 [+ f  t) {! Z/ T. [& J
  4857.           (set_tile "t_ltype" (bylayer_lt))4 E9 Z+ V2 m' y( U2 t6 I
  4858.         )
    " d0 d# N) b7 A. M9 C
  4859.         (if (= ecolor 256)
    $ h4 g3 [9 v9 C8 t- O
  4860.           (progn( ~" n) H0 u; F0 L7 q& W4 e6 B
  4861.             (set_tile "t_color" (bylayer_col))
    , L9 M) p6 o3 m4 k0 m% ]/ F
  4862.             (col_tile "show_image" cn nil): @4 a2 }1 Q/ v5 d6 Y
  4863.           )
    % s9 ?& c5 \+ `, e. s  E, T
  4864.         )
    * i7 {/ j& l1 P7 `
  4865.         layname
    + {" m9 e2 U6 M* B, H  v
  4866.       )
    $ K! I: `; m$ t' s
  4867.       elayer
    / y9 u& m# r- n6 }! {
  4868.     )3 B) ^& b) B) _5 U
  4869.   )
    6 @6 q. j; S- H: N2 o
  4870.   ;;0 G2 M1 M' q. o8 N. l$ U
  4871.   ;; Edit box selections end up here* E7 P- d/ l, l
  4872.   ;;
    , t  J9 G3 n" N) _9 ~7 ?
  4873.   (defun layedit_act (layvalue)) S- R; m, E5 t" G  O* Y! M
  4874.     ;; Convert layer entry to upper case.  If layer name is: n2 J& u3 f: p! Y% t
  4875.     ;; valid, clear error string, call (laylist_act) function,0 `- A4 ^' r7 C
  4876.     ;; and change focus to list box.  Else print error message.9 R; S3 C5 }) X) L4 b+ y
  4877.     (setq layvalue (strcase layvalue))" N* g7 I' J3 [# I& p  G" p
  4878.     (if (setq lay-idx (getindex layvalue laynmlst))7 G. n" V2 H: `- q% g
  4879.       (progn
    $ T8 c+ d8 Z* z, I0 k9 j! C' |5 i
  4880.         (set_tile "error" ""), |' z, b: C4 r6 O
  4881.         (laylist_act (itoa lay-idx))
    3 S2 x: o) \/ D. S5 n+ m5 n1 a/ O
  4882.       )$ N* \& J7 U; f9 M  ]
  4883.       (progn
    5 |7 p, z9 h6 A0 ~- E* \
  4884.         (set_tile "error" "Invalid layer name.")
    8 i6 k. k3 B! N5 Q6 v
  4885.         (setq lay-idx old-idx)8 l2 T+ Q- N* u+ w+ j2 U- L& e
  4886.       )
    & O9 R& m3 N* \4 t. K) w  Q* M
  4887.     )# w, G( {1 h3 o. O& c
  4888.   )
    3 Z/ W, e" w0 Q" J. x" w
  4889.   ;;
    / W9 |5 m4 e- U+ j% \
  4890.   ;; List entry selections end up here
    3 f3 m$ r0 F6 r5 c
  4891.   ;;0 q+ `3 B2 e. O: r9 k! |
  4892.   (defun laylist_act (index / layinfo color dashdata)
    8 {2 i6 ?% p" L8 E. o+ Y) Y* Z
  4893.     ;; Update the list box, edit box, and color tile
    # p7 W- g6 E0 f2 ~) m
  4894.     (set_tile "error" ""), z/ R1 h% C# A; A
  4895.     (setq lay-idx (atoi index))
    / {& D: H3 c- u/ ~& U- g) N7 ?" H
  4896.     (setq layname (nth lay-idx laynmlst))
    * o, x  E, W) j5 |' d
  4897.     (setq layinfo (tblsearch "layer" layname)): D. {! j6 B3 ~# [! J2 P6 ]/ f; J; `
  4898.     (if (= (logand (cdr (assoc 70 layinfo)) 4) 4)* Q5 C1 c* N! \6 k4 s* L
  4899.       (set_tile "error" "Cannot change entity to locked layer.")) q) \! v, H! c, R
  4900.       (progn& x% U* q, D) [: f+ \% a( ]; O
  4901.         (setq color (cdr (assoc 62 layinfo)))
    - S% M2 z- j. `: V. A
  4902.         (setq color (abs color))2 I2 u  ?1 W. L6 n% h! L6 J
  4903.         (setq colname (colorname color))3 s' j6 [9 P! N7 K( J* s5 Y7 u
  4904.         (set_tile "list_lay" (itoa lay-idx))
    ; n, ^8 `9 W9 I' d
  4905.         (set_tile "edit_lay" layname)
    # A. \6 w5 h- Z, k, M
  4906.         (mode_tile "list_lay" 2)) i0 A  N( D7 c$ a7 c" W
  4907.       )
    : d, v* E' N8 ?. Z) N- e. P
  4908.     )
    ) O- z4 |- q; O
  4909.   )8 [, S- t! u- M2 Q$ M% |
  4910.   ;;
    . B+ V3 d% R. ^( M" `
  4911.   ;; Reset to original layer when cancel is selected
    * O, L7 A. H+ r; u1 i% s4 [  O# u
  4912.   ;;
      y& M8 p% ~5 F. q  j
  4913.   (defun reset-lay ()
    / N. k3 _4 N- M& n, s
  4914.     (setq lay-idx old-idx)
    # G; J3 x" o2 I" E, a/ W3 N
  4915.     (done_dialog 0)
    4 l* i+ j- T% z! W
  4916.   )
    ) J0 R" X; _( F# m0 J
  4917.   ;;
    1 j7 M. n5 i7 n0 M" G
  4918.   ;; Checks validity of thickness from edit box. Since (atof) returns 0 when a
    $ Q0 \- z7 z1 U% y) x. |
  4919.   ;; string can't be converted to a real, this routine checks if the first
    9 i6 x+ y9 a+ D; r% y$ `) s: @
  4920.   ;; character is "0".  It also checks to see if the value equals "Varies".$ a8 T8 M  b% X; {- V' Z$ ]
  4921.   ;;
    : g# j# {4 h# H) z! d
  4922.   (defun getthickness (value)
    " n! v1 W- n5 K7 Z* l' F/ q
  4923.     (setq value (strcase value))$ @: N4 D- {: v0 p6 S% z' V
  4924.     (if (or (= value "VARIES")' d% N! u% t; l% q) o$ ]4 @
  4925.             (distof value)& `- o4 D9 X& X, v$ C0 X
  4926.         )
    , T$ I& N" H  z" s1 B
  4927.       (progn8 g2 v5 Q$ X! u
  4928.         (set_tile "error" "")
    & ]8 M9 V3 {, }% ^) J3 m+ B/ Q% E
  4929.         (if (= value "VARIES")1 m; C/ t" P& R! u( F, p7 A9 c
  4930.           (progn+ A& c. q# l- S8 u; R: V* ^8 l
  4931.             (set_tile "eb_thickness" "Varies"). V# \* }) F" J7 @6 ^7 {
  4932.             (setq ethickness nil)9 ]9 q; M: N4 e2 C' h8 U+ L
  4933.           )
    1 z9 O! R% T' w
  4934.           (progn1 ]# V* [4 b3 {3 z$ O/ ~& m
  4935.             (setq ethickness (distof value))
    2 `) P) z4 z) i' c/ D) m0 x( o
  4936.             (set_tile "eb_thickness" (rtos ethickness)): Z2 b# b5 M- j6 d( i- w
  4937.             ethickness
    + N. M' G  n# K: ?9 w$ W9 e
  4938.           )
    ) Z$ y7 }5 K& q: ^' K4 ~! T
  4939.         ). \5 B* P. \) E' Z
  4940.       )7 p# b# w$ X8 I4 u
  4941.       (progn/ ?* M* ^% {" o
  4942.         (set_tile "error" "Invalid thickness.")
    : ^9 V8 {3 y* |
  4943.         nil
    * R; C2 V; ~% A/ x/ i
  4944.       )
    2 l6 r: ]) r: d5 l4 M* x% C
  4945.     )( X+ R1 L& f# i- V
  4946.   ). q6 I4 a! g( g, H
  4947.   ;;
    & _2 G- S9 Q3 T" @% h+ f& g& [5 ]) G
  4948.   ;; This function make a list called laynmlst which consists of all the layer 2 t7 U$ J9 O* [
  4949.   ;; names in the drawing.  It also creates a list called longlist which ! w8 D6 K- {5 n; Q- w4 S
  4950.   ;; consists of strings which contain the layer name, color, linetype, etc.  
    * n7 h4 F1 C* g) V- H' V: G$ p/ Q" y
  4951.   ;; Longlist is later mapped into the layer listbox.  Both are ordered the
    8 [/ B2 V2 d+ v
  4952.   ;; same." v0 a- B9 i9 a+ q
  4953.   ;;2 _( N: I. x' Y3 b: }% {
  4954.   (defun makelaylists (/ layname onoff frozth color linetype vpf vpn ss cvpname
    ! Q  p& {1 B  ?3 A! C& l
  4955.                          xdlist vpldata sortlist name templist bit-70
    * |7 ~6 s4 |1 b& m# o( }
  4956.                       )
    * T: k2 M5 j2 n: k" t: g) f1 A
  4957.     (if (= (setq tilemode (getvar "tilemode")) 0)5 V, R* t. [- M: {/ q1 {! x* z
  4958.       (progn2 {1 C, N6 i4 K& N: c9 ~0 _- V$ a# H
  4959.         (setq ss (ssget "x" (list (cons 0 "VIEWPORT")
    , S% V/ I: z$ \  x5 f5 q9 c
  4960.                                   (cons 69 (getvar "CVPORT")). D) M% x9 l1 X( F7 T( N+ i# f: S
  4961.                             )6 S# L4 C! w: B7 |; V
  4962.                  )
    ' k; R+ }) E8 B4 S5 p9 ?0 ^: O
  4963.         )     
    ; I, O/ J5 `* E: G0 V) g# O
  4964.         (setq cvpname (ssname ss 0))
    / @8 P) N9 f; |$ @4 b1 D
  4965.         (setq xdlist (assoc -3 (entget cvpname '("acad"))))
    8 l5 b/ A: o2 I+ x) B
  4966.         (setq vpldata (cdadr xdlist))" P! Z4 S3 w/ |! I( k) ^* \
  4967.       )
    ) F7 }  D  o5 t0 p' M: q2 ]* p
  4968.     )
    8 y6 R0 ~0 L! x+ c( k
  4969.     (setq sortlist nil); ~, `. l3 [4 T% w. h2 W* t! a
  4970.     (setq templist (tblnext "LAYER" T))
    - S/ l# x$ _  y
  4971.     (while templist; ^% G; P$ V' z
  4972.       (setq name (cdr (assoc 2 templist)))
    ( e9 c% f$ F) ~
  4973.       (setq sortlist (cons name sortlist))
    5 x% a& G! m$ g" v' B
  4974.       (setq templist (tblnext "LAYER"))
    ) Y+ F# L: f2 G; ?- L* I% N
  4975.     ) % n9 n: g# {' x6 P4 U
  4976.     (if (>= (getvar "maxsort") (length sortlist))
    . _+ }) w4 j; V3 T+ b! w% z5 W  @2 P
  4977.       (setq sortlist (acad_strlsort sortlist))( J- P0 V/ j; Q$ A8 C
  4978.       (setq sortlist (reverse sortlist))4 j+ w$ W/ l) l  S- a( l2 d
  4979.     )
    : g& K6 h& R- i( B# N
  4980.     (setq laynmlst sortlist)
    7 P- C. S- E& u
  4981.     (setq longlist nil)
    + I0 s% [: q. o( }+ m
  4982.     (setq layname (car sortlist))
      ^/ h& R$ [' v' ^
  4983.     (while layname. d0 e8 h4 u6 m( i0 _
  4984.       (setq laylist (tblsearch "LAYER" layname))/ I1 i$ G( _" }: ~# ?( H
  4985.       (setq color (cdr (assoc 62 laylist)))* g0 _5 j1 a9 D! P0 I
  4986.       (if (minusp color)* i6 k& v! i! [+ g5 u6 v
  4987.         (setq onoff ".")5 A7 i1 E+ F! X
  4988.         (setq onoff "On")4 r; V  N: r3 @; P' {9 A
  4989.       )- ]- F& x5 m. c' R. K6 R7 D: G
  4990.       (setq color (abs color))4 F& j1 R; a3 B; g& z! M
  4991.       (setq colname (colorname color))
    9 s) D1 J, F# y3 x8 P1 ]/ a* _5 j% G
  4992.       (setq bit-70 (cdr (assoc 70 laylist)))1 U- |: O& W9 F! _
  4993.       (if (= (logand bit-70 1) 1)
    : y6 ]9 P: O; Z
  4994.         (setq frozth "F" fchk laylist)( d+ m* n% G- [
  4995.         (setq frozth ".")
    ' Z" _) F% _, }( l) x
  4996.       )3 y8 _  f! I+ i: @9 |, W5 P; g
  4997.       (if (= (logand bit-70 2) 2)
    0 Q4 J% f" R4 b+ Y8 b
  4998.         (setq vpn "N")) N7 N- X) |+ ^+ B" L0 W
  4999.         (setq vpn ".")/ a, T3 F6 d+ @2 E
  5000.       )' ?2 R9 j. s1 q: i7 ]  q4 ?/ l  e! S7 N
  5001.       (if (= (logand bit-70 4) 4)7 _7 r' b1 x/ G
  5002.         (setq lock "L")* n2 x7 A2 I; p+ [- ^
  5003.         (setq lock ".")
    8 t3 g; ^! Z  H1 L+ f* n4 b2 W4 r1 p8 M$ `
  5004.       )# D6 `" T! o# ]+ _3 u
  5005.       (setq linetype (cdr (assoc 6 laylist)))
      ?9 n" ^4 ?/ I, z! `. A4 A
  5006.       (setq layname (substr layname 1 31))2 V, p, r+ A- t9 ?3 n
  5007.       (if (= tilemode 0)( S4 [! O: \6 I5 \2 F& u
  5008.         (progn
    + X, F' C  B( S
  5009.           (if (member (cons 1003 layname) vpldata)
    / S% d, z$ m9 }) C1 g3 @
  5010.             (setq vpf "C")
    ' g  g1 @; `. G; N+ e& |! `) d
  5011.             (setq vpf ".")
    + [) @! b& c9 A- J
  5012.           )! O" I5 X. Y0 ~4 q: K9 E8 }
  5013.         )
    + h6 b+ V  J. H' x, V2 L
  5014.         (setq vpf ".")' ?7 }; y7 K/ ~3 k' h7 Q4 L7 I
  5015.       )) k' ?6 Z2 d8 w, E
  5016.       (setq ltabstr (strcat layname "\t", r4 h, P4 |6 G7 s, ^
  5017.                               onoff "\t"8 M+ @& ]& U% S0 }- e* b6 `1 E
  5018.                              frozth "\t"
    7 B+ W. s. V! [9 }
  5019.                                lock "\t"" T$ N; V2 \+ A  `- J; j, F
  5020.                                 vpf "\t"8 ]- T9 v! w5 b1 A" _0 s* m
  5021.                                 vpn "\t"
    ; b6 s) p7 \: L, Z5 |, ~5 r& G. d
  5022.                             colname "\t"
    ! ?/ a# {$ x& F% p8 Y" E
  5023.                            linetype
    " m: [, n4 |+ R: [; y
  5024.                     )
    . N: j0 W5 k2 [. V
  5025.       )4 K/ Q8 F" w5 F
  5026.       (setq longlist (append longlist (list ltabstr)))9 E6 X. z" Z% U! h
  5027.       (setq sortlist (cdr sortlist))
    " I) _9 Q. x: e
  5028.       (setq layname (car sortlist))$ S* W5 h3 v- ]7 G3 r$ z
  5029.     )
    8 m! w5 w. W3 m. @7 a2 q
  5030.   )
    ) T! A7 B4 d: W& Y+ K: f
  5031.   ;;
    8 c  W5 n1 h# R2 n: c
  5032.   ;; This function makes 2 lists - ltnmlst & mdashlist.  Ltnmlst is a list of : p! F$ b3 a/ {* V' I
  5033.   ;; linetype names read from the symbol table.  Mdashlist is list consisting + w! F( v0 a0 j
  5034.   ;; of lists which define the linetype pattern - numbers that indicate dots,
    & y! x. w% U, \! k
  5035.   ;; dashes, and spaces taken from group code 49.  The list corresponds to the ; S# T; k' T+ ~- w
  5036.   ;; order of names in ltnmlst.! C  d9 @" D0 I3 P7 ?
  5037.   ;;
    : H( b% I8 V( t$ _+ i
  5038.   (defun makeltlists (/ ltlist ltname)' B# Y* J3 ^  F
  5039.     (setq mdashlist nil); w( \5 @" T) C  w; L
  5040.     (setq ltlist (tblnext "LTYPE" T))& }* Q9 }5 u% U7 |" Q
  5041.     (setq ltname (cdr (assoc 2 ltlist)))% V" d8 B6 s+ {8 f
  5042.     (setq ltnmlst (list ltname))
    " w3 A% V3 \& w* ]& h: `! _$ c% D

  5043. & \& e; ^# a) D( d" V* v
  5044.     (if (= ltname "CONTINUOUS")0 m+ d# R4 h! P( Q& _" n; n% J
  5045.       (setq mdashlist (list "CONT")), j# {: N! F' x4 e) Q& e
  5046.       (setq mdashlist 9 C$ R2 A$ X0 C4 z) _" |6 c
  5047.             (append mdashlist (list (add-mdash ltlist)))
    3 y& k0 E: N$ R& V2 }! ?
  5048.       )9 u: ^: K( m( M: x6 Y1 N- R" P
  5049.     )5 V% z% C- f# v" ?# O9 ~
  5050.     (while (setq ltlist (tblnext "LTYPE"))
    5 A: N& i5 b: ]6 |" r: z  c! p1 r
  5051.            (setq ltname (cdr (assoc 2 ltlist)))
    . \/ N/ u$ T9 A, f0 ~
  5052.            (setq ltnmlst (append ltnmlst (list ltname)))5 L/ ?) k1 B) y% \6 c% f( S
  5053.            (setq mdashlist 0 }2 ^- e2 p9 g6 q$ K6 N
  5054.                 (append mdashlist (list (add-mdash ltlist)))
    8 Y& Q7 C5 R2 d# ?  ]" b4 N8 t
  5055.            )
    * \( U  |) T% k0 L) ~1 J
  5056.     )9 l: z6 D' K! U9 }9 z- d/ K
  5057.     (setq ltnmlst (cons "BYBLOCK" ltnmlst))) G# M1 |  r# E- @( w! C+ S, u  q
  5058.     (setq mdashlist  (cons nil mdashlist))
    * u% O8 m1 h  @/ h; m& t* z4 s
  5059.     (setq ltnmlst (cons "BYLAYER" ltnmlst))
    * E3 K! D+ ]1 e% [
  5060.     (setq mdashlist  (cons nil mdashlist))
    + W" t# |+ U" @4 z- a. B/ G
  5061.   )
      ^' D! x. p0 v* @$ D$ Q3 S
  5062.   ;;- D* G" p: y1 G7 l
  5063.   ;; Get all the group code 49 values for a linetype and put them in a list
    8 Y9 {: y4 Y/ q3 N' f8 I8 n
  5064.   ;; (pen-up, pen-down info)/ f7 [8 Z; v+ B" ~8 P
  5065.   ;;
    - W7 q' s* g: X" N8 U8 e
  5066.   (defun add-mdash (ltlist1 / dashlist assoclist dashsize)4 o( e  N+ r% ~# }4 R5 h, u. S. X
  5067.     (setq dashlist nil)
    ! r0 P6 x7 ]. m2 m) e/ P# ?6 F
  5068.     (while (setq assoclist (car ltlist1))
    / D+ c% _* A7 L0 ~$ }& @
  5069.       (if (= (car assoclist) 49)" n# f/ O8 P1 A
  5070.         (progn
    2 ^1 q4 i  o6 o/ T: }" r
  5071.           (setq dashsize (cdr assoclist))
      n% ]0 R1 D. `- @, P5 T8 ]
  5072.           (setq dashlist (cons dashsize dashlist))" O9 Y% l7 D- ^' l0 \, y2 h6 X
  5073.         )
    6 c( g! ^1 Q7 e5 u: ~+ F5 n* d
  5074.       )
    . h3 H5 L- q1 V; l( F  Z. B
  5075.       (setq ltlist1 (cdr ltlist1))# S+ {! W( N& d9 j# g, P
  5076.     )
    6 [5 B, a2 q% o  J; W% ]! t
  5077.     (setq dashlist (reverse dashlist))
    6 B0 M5 N! W6 c0 W9 S" @1 d' Y1 ?
  5078.   )2 u) A& z- Z0 V9 Z/ F2 o4 b
  5079.   ;;5 J- K7 ^$ u" x4 q9 i% n
  5080.   ;; Color a tile, draw linetype, and draw a border around it
    : S* _, o* K% J+ ?$ \( n* q" ], T
  5081.   ;;
    ) v, X# g$ S2 O* d2 U: d
  5082.   (defun col_tile (tile color patlist / x y)
    ; |4 N7 \1 ^' n$ F9 p4 ~8 j
  5083.     (setq x (dimx_tile tile))
    9 j, ]+ @: c! W
  5084.     (setq y (dimy_tile tile))
    9 `. f( k- y  V# D
  5085.     (start_image tile); p8 ^, h$ J, |
  5086.     (fill_image 0 0 x y color)8 t/ J6 o4 m/ x; t0 I
  5087.     (if (= color 7)# v0 G& E5 ?) I: D3 R
  5088.       (progn4 \/ |$ j3 e+ ?, c1 e
  5089.         (if patlist (drawpattern x (/ y 2) patlist 0))
    . H" {( K; s8 _9 x# ~8 r/ F
  5090.         (tile_rect 0 0 x y 0)
    9 _2 `' o& X# ]" {+ ^" q! P+ k) y! w
  5091.       )
    % T0 L0 i# o& D2 {5 R
  5092.       (progn2 l: Y: S6 t( `: m. X' d2 q
  5093.         (if patlist (drawpattern x (/ y 2) patlist 7))
    9 e2 f2 a5 B1 G( |8 a6 ^$ j% u: I- b- B: c
  5094.         (tile_rect 0 0 x y 7)
    + g! K7 {/ N2 s
  5095.       ); H% O" [7 Z* Z8 ?$ Z! `# y4 i- m
  5096.     )
    0 I& {5 d) [. F, r
  5097.     (end_image)& J3 Y' M# B5 f' t
  5098.   )4 }$ t/ q" x" t9 d, B
  5099.   ;;
    4 V; r& f. k! h; _! k3 J# d
  5100.   ;; Draw a border around a tile% M2 r  j9 E$ _' a
  5101.   ;;
    - N/ V6 d* K2 F  [8 F5 p
  5102.   (defun tile_rect (x1 y1 x2 y2 color)
    , _+ e" ~% r+ }5 }/ n+ Q
  5103.     (setq x2 (- x2 1))
    , X! L+ w. X/ @& l" x6 s
  5104.     (setq y2 (- y2 1)). Q5 O( J$ R6 P) ?% k
  5105.     (vector_image x1 y1 x2 y1 color)
    ( R- y5 t; g$ ]1 I) H) D
  5106.     (vector_image x2 y1 x2 y2 color)
    " X' v4 N+ N& _
  5107.     (vector_image x2 y2 x1 y2 color)2 @3 b/ M5 o3 j6 i' ~; P) p3 y
  5108.     (vector_image x1 y2 x1 y1 color)* l+ Y. n; n8 k/ x4 U" j. F7 ~# C
  5109.   )7 z: A# f) m. r1 s
  5110.   ;;
    ! g$ Z& }; K- V
  5111.   ;; Draw the linetype pattern in a tile.  Boxlength is the length of the image
    - [! y) s2 a( q# f/ y
  5112.   ;; tile, y2 is the midpoint of the height of the image tile, pattern is a 6 @& H6 H* G+ h- h5 o
  5113.   ;; list of numbers that define the linetype, and color is the color of the
    $ l6 ^5 |; D5 j$ r+ g# l. r. }
  5114.   ;; tile.0 ^) U  W  e5 I1 {; R/ m! R  x
  5115.   ;;
    , R7 o/ q/ K/ J9 {( {
  5116.   (defun drawpattern (boxlength y2 pattern color / x1 x2
    / V" P! V5 C) T% s+ x& X/ j
  5117.                       patlist dash). q) R1 A& d3 o  a7 ]# }
  5118.     (setq x1 0 x2 0)
    * H% Z4 }1 r9 {8 U
  5119.     (setq patlist pattern)
    ' O. K. b* E# b, D0 A2 f
  5120.     (if (= patlist "CONT")
    0 X2 L. H/ a4 l2 @- j
  5121.       (progn - X7 V  g! B0 B4 z; {
  5122.         (setq dash boxlength)
    ! {- [7 L3 x2 K+ R* `
  5123.         (vi)
    * d& B4 i/ m9 T" T7 X3 L) w
  5124.         (setq x1 boxlength)7 d# p- C* t, Z  D5 J
  5125.       )
    ' s4 R/ X4 S6 h' l' ^# c7 z
  5126.     )/ e& A7 S/ ~) ?, I+ g1 E
  5127.     (while (< x1 boxlength)$ O5 e, t4 w4 u& P
  5128.       (if (setq dash (car patlist))1 @$ ?' i0 Y9 P) G6 j) X3 S5 S2 E
  5129.         (progn1 [! Q9 {0 S5 n, o1 N
  5130.           (setq dash (fix (* 30 dash))). |1 v3 _3 E  ]( l% T% U
  5131.           (cond
    / l- o4 Y& L! r( L. Z' C
  5132.             ((= dash 0) ) u1 l  B6 {; m) w" H
  5133.               (setq dash 1)
    2 U; R; y* R3 J+ }8 F8 d+ S
  5134.               (vi)
    7 O( o( W3 o( f5 t! X5 V! l7 h! a
  5135.             )* n' A% z) G* J5 }
  5136.             ((> dash 0)
    ! c5 e  C1 d& ~8 s/ _2 Z
  5137.               (vi)1 y0 U! m9 r/ U
  5138.             )
    9 p) u7 H0 ?* N% j; {8 N
  5139.             (T * P2 |2 Z' o( d; K
  5140.               (if (< (abs dash) 2) (setq dash 2))
    8 W$ L/ p- U5 w* k0 h. v9 m
  5141.               (setq x2 (+ x2 (abs dash)))
    & E* J/ M( N, |  G
  5142.             )8 B! M& E0 c- s9 m
  5143.           )
      N" z! G% _- y2 I0 x; X2 v) n
  5144.           (setq patlist (cdr patlist))( G2 M0 t4 w6 W. f# ^
  5145.           (setq x1 x2)
    , V; h/ b* ^* X3 p, ~+ Y+ L
  5146.         )
    5 v! M- D, C0 h% e  s+ g* T
  5147.         (setq patlist pattern)" F' z- f  a" M* D+ q$ G
  5148.       )
    / h4 U$ r# P# @) X0 p! _
  5149.     )
    ! S3 c; a9 ?/ z! M2 \; _7 n
  5150.   )
    ' t2 U  ?& d  Y( H
  5151.   ;;. F* q9 G4 [, {3 ]7 }% K9 d* U
  5152.   ;; Draw a dash or dot in image tile2 u0 M% A+ H. C" `7 J' b/ x- z
  5153.   ;;0 `8 n% [, i, Q* v; H# w
  5154.   (defun vi ()) g, C: t3 H& W4 Q' J( p  T
  5155.     (setq x2 (+ x2 dash))
    - ~& V& D3 h4 F
  5156.     (vector_image x1 y2 x2 y2 color)
    ) X& H: @) \7 t: V6 p2 Z, ]
  5157.   )
    0 n2 i# p5 Q" k: |' `4 C
  5158.   ;;
    . g! V, \1 x$ ]5 ~2 Q
  5159.   ;; This function takes a selection and returns a list of the color, linetype, % F! j5 s% D/ H+ p& B! @
  5160.   ;; layer, and thickness properties that are common to every entities in the4 R3 M% _; ?4 h+ c- n# [2 r
  5161.   ;; selection set - (color linetype layer thickness).  If all entities do not
    1 k7 I$ y3 k6 P) h. ?- ]/ h% A3 T
  5162.   ;; share the same property value it returns "Varies" in place of the 2 e* y) c: @1 J* D: Z! o4 F5 Q
  5163.   ;; property value.  i.e. ("BYLAYER" "DASHED" "Varies" 0)# d3 _( Z" }7 J  a2 m3 }  y
  5164.   ;;
    : B0 t# V% e" |- u$ U3 q
  5165.   (defun getprops (selset / sslen elist color ltype layer! c4 }! a, C4 s+ r4 S* t8 K# Z3 t" q
  5166.                             thickness go chk-col chk-lt chk-lay chk-th ctr)
    3 {" k; r5 a& ~
  5167.     (setq sslen (sslength selset))% d" a9 Z$ @* o1 t
  5168.     (setq elist (entget (ssname selset 0)))
    ' F/ \; v7 F% s6 O
  5169.     (setq color (cdr (assoc 62 elist)))6 P( F4 s# I1 c0 x* k# o4 ~
  5170.     (if (not color) (setq color 256))2 c, Q" ~1 u& y
  5171.     (setq ltype (cdr (assoc 6 elist)))
    " R+ y- W: H. W- w& G/ ~
  5172.     (if (not ltype) (setq ltype "BYLAYER"))6 r8 R/ a2 m2 H# L) N6 ^6 n
  5173.     (setq layer (cdr (assoc 8 elist)))
    1 L* _+ a% a3 ]
  5174.     (setq thickness (cdr (assoc 39 elist)))0 S% E" E% y2 h/ {) i; y- C
  5175.     (if (not thickness) (setq thickness 0))
    4 M! _: D- U9 Z2 S. U: q
  5176.     (setq go T chk-col T chk-lt T chk-lay T chk-th T ctr 1)
    ) x% t9 M* b+ H  O) u
  5177. , v; v' I% z, e  H, k% O( ]; {
  5178.     ;; Page through the selection set.  When a property5 ?0 j5 u  u3 p1 ]9 D$ m
  5179.     ;; does not match, stop checking for that property.4 }+ t$ J$ j. E1 u7 w- N* O4 q
  5180.     ;; If all properties vary, stop paging.
    ! J/ d' H6 ~" |7 Z. u0 E3 m! }, g, R, O

  5181. 6 Q. Q0 b- `- }4 [: q& r
  5182.     (while (and (> sslen ctr) go)
    4 u  U. _: J; I, p
  5183.       (setq elist (entget (setq en (ssname selset ctr))))
    8 E: m/ W2 q+ @9 r
  5184.       (if chk-col (match-col))
    ' g3 Z; C9 e$ Q$ N1 o7 |' G
  5185.       (if chk-lt (match-lt))
    * ]$ E! i, ~5 b" F) u" {/ _# Y
  5186.       (if chk-lay (match-lay))
    + g/ ^6 M# b0 @! _; O* V: ^; Z' D
  5187.       (if chk-th (match-th))
    6 F; W  T4 T+ l, Y& t
  5188.       (setq ctr (1+ ctr))8 l: J; y. C/ |1 D# e8 a# P$ {
  5189.       (if (and (not chk-col) (not chk-lt) (not chk-lay) (not chk-th))* T/ R( `. B$ P7 _: D6 m  g
  5190.         (setq go nil)
    * F  z$ g: V& W# k: m" I4 I7 G
  5191.       )5 a& m' ]" Z# O
  5192.     )
    ( [2 G9 U2 X7 d
  5193.     (list color ltype layer thickness)
    & ]( \3 Z6 h; o, @5 c, L( ^
  5194.   )
    3 X* M' W# d+ J+ Q& \: J- _& q8 G4 `* w' u

  5195. ; B1 S5 f* l* ?3 j# t, s2 E+ i
  5196.   (defun match-col (/ ncolor)
    * V2 P  V5 d9 B8 y/ O, |
  5197.     (setq ncolor (cdr (assoc 62 elist)))3 Q; d) p: w% d4 Q! y7 x1 b. w3 [
  5198.     (if (not ncolor) (setq ncolor 256)): y3 R2 o' S0 z: k9 h1 i
  5199.     (if (/= color ncolor)" p3 p& A; v- M3 K; S& R/ D$ d
  5200.       (progn
    ) o+ H, \+ n0 R6 ^3 e
  5201.         (setq chk-col nil)! W: I9 ]  E5 Z, X# |- l
  5202.         (setq color nil)2 c3 q& t! e4 [) A/ {8 Z
  5203.       )
    ) w1 ~1 A% U! a( ^6 b- W1 Y: g+ G' w
  5204.     )- k* Q6 }6 l8 W9 m
  5205.   )
    9 q' l% i+ U  [0 k( H" L
  5206. 8 k8 L, x' C7 f7 N, |  v
  5207.   (defun match-lt (/ nltype)
    8 `0 G- R* _) x. t9 i3 l8 f
  5208.     (setq nltype (cdr (assoc 6 elist)))0 W2 P3 o. O2 R! M# m0 A
  5209.     (if (not nltype) (setq nltype "BYLAYER"))
    + K" L2 Q. V- r' `- S3 w( t4 L
  5210.     (if (/= ltype nltype)* u  Q3 {7 D" |" m  D  w+ t
  5211.       (progn
    6 P% O: |! G0 ]6 `, t7 G
  5212.         (setq chk-lt nil)
    0 j2 V  @3 H, J' z
  5213.         (setq ltype "Varies")
    ( s2 J7 s4 x4 A0 O, U- e9 S
  5214.       )
    ( D. Q. c/ b/ F: E2 h) G# E- @0 x
  5215.     )
    6 r* ?) m1 y( v# T1 z7 h- r
  5216.   )
    4 {4 ]0 \. E5 |& n- P

  5217. , B( z, \! o& X: P" v! E2 G9 T- P
  5218.   (defun match-lay (/ nlayer); s, u+ S, {0 t
  5219.     (setq nlayer (cdr (assoc 8 elist)))3 |2 N4 k3 l2 b! y  i; d9 |7 O
  5220.     (if (/= layer nlayer)" j! S# K$ g! o/ s7 m: M# _
  5221.       (progn
    , ?5 f1 W3 {/ a6 {
  5222.         (setq chk-lay nil)5 p4 s8 x- X& ~+ z2 X' R
  5223.         (setq layer "Varies"); r8 g, x' u4 S+ _6 ?0 d2 q
  5224.       ), @, ?' E+ Y8 G# S  S- t& s: [6 Q
  5225.     )
    , p0 A7 G: J  Y* y
  5226.   )2 E, g( X  |) H. C" y& c

  5227. " Y# d) P2 _" d+ V1 r) o8 V; B7 X
  5228.   (defun match-th (/ nthickness)) h0 C2 }. r, P3 K) b# q. V, I
  5229.     (setq nthickness (cdr (assoc 39 elist)))
    ( h' w/ J( B- B! y& M6 H+ l6 H
  5230.     (if (not nthickness) (setq nthickness 0))  |, a6 I3 i- S: }( [
  5231.     (if (/= thickness nthickness)
    % Y" a3 `7 ~5 t- }2 R5 d9 G3 i
  5232.       (progn
    ! U7 K8 x$ R7 z7 K
  5233.         (setq chk-th nil)
    2 g. a' C6 M7 \) \* h9 N
  5234.         (setq thickness "Varies")% [4 i, O; c+ R5 h$ c( A1 Q
  5235.       )' r- D) S8 k3 l& }# s
  5236.     )
    3 ?$ n$ A, v  }: Z
  5237.   )
      J+ N6 Y- R' o

  5238. / B1 A* H3 a  J3 c! k# v
  5239.   ;;" s2 M; C1 J4 z; `
  5240.   ;; If an item is a member of the list, then return its index number, else
    / g5 x) A0 N6 z; S" y& p, o
  5241.   ;; return nil.
      P8 Z) n8 Y' e
  5242.   ;;- [* S2 m, |) t( _: l
  5243.   (defun getindex (item itemlist / m n), `6 E: j6 H9 p$ \8 s
  5244.     (setq n (length itemlist))5 h# D: h& `- ~1 M5 G- A
  5245.     (if (> (setq m (length (member item itemlist))) 0)
    ) O! O1 A" ?: G0 V% C
  5246.         (- n m)
    / W- Q6 l8 E6 K+ p
  5247.         nil
    , @0 g$ ]6 V: e+ i$ J8 T! A
  5248.     )
    2 s5 M4 s! I6 T6 _! a
  5249.   )
    4 m) o) r* Q0 a% T$ H* y
  5250.   ;;3 t( R0 ~  o8 x; F
  5251.   ;; This function is called if the linetype is set "BYLAYER". It finds the $ C4 E% w. R' Z0 b# ?6 b' S
  5252.   ;; ltype of the layer so it can be displayed beside the linetype button.( b$ i4 b! d, a- d& c! l* ^, I
  5253.   ;;2 L9 q# M4 k) D
  5254.   (defun bylayer_lt (/ layname layinfo ltype)
    " k, Q9 b6 o& ]
  5255.     (if lay-idx
    2 J) f3 ?" T0 x  e/ u: V& {* o/ B
  5256.       (progn
    # W1 v, S+ J- ^5 b3 [( a
  5257.         (setq layname (nth lay-idx laynmlst))/ J+ N6 t$ {1 L2 E
  5258.         (setq layinfo (tblsearch "layer" layname))5 M0 e( Z# i* ]* v
  5259.         (setq ltype (cdr (assoc 6 layinfo)))
    3 r, q" G5 p) Y3 d+ m
  5260.         (strcat "BYLAYER (" ltype ")")9 |2 k1 k1 K& p" q% Z
  5261.       )5 l' y3 B( O/ O  B! O; ^
  5262.       "BYLAYER", \% Y$ ?- d3 q$ {! Y
  5263.     )
      V1 c6 d/ Y# s- R9 b
  5264.   ), ~1 W5 P# i$ w- i# ]1 k) |/ U' i: h
  5265.   ;;
    4 ?& _5 ~& Y- j4 O6 `" a! V+ ^6 J
  5266.   ;; This function is called if the color is set "BYLAYER".  It finds the . Y& ^. _& [5 @" I- K* E$ h  W
  5267.   ;; color of the layer so it can be displayed  beside the color button.
    5 H" O3 v. X2 [' I5 d
  5268.   ;;( ]: \+ A. ?0 g- t/ i7 \
  5269.   (defun bylayer_col (/ layname layinfo color)% a, Q3 m0 K2 l
  5270.     (if lay-idx
    ) L/ i+ I3 i6 b; U
  5271.       (progn
    ( M9 p& @- R# S+ ]& Q
  5272.         (setq layname (nth lay-idx laynmlst))
      b; A* _0 Z8 t2 Z: W) F
  5273.         (setq layinfo (tblsearch "layer" layname))
    5 p' L/ U( @* l/ Y) ]
  5274.         (setq color (abs (cdr (assoc 62 layinfo))))# I4 [: t' \' o1 R5 v
  5275.         (setq cn color)/ @4 [5 p& r: {6 J
  5276.         (strcat "BYLAYER (" (colorname color) ")")
    8 \3 i$ S* P5 m5 p9 Z# |
  5277.       )
    % x. s9 h5 P) X
  5278.       (progn- k: b4 g! D) |
  5279.         (setq cn 0)
    - J' i( q, C& s& @! t
  5280.         "BYLAYER") X" O0 d' Y4 t& E3 N: @: ?/ n
  5281.       )
    , w6 ?6 \! Q( k* B7 Q7 ]2 w2 |
  5282.     )4 ~: B2 }. Z1 W% h7 F
  5283.   )
    , x! g5 F& [5 M& {. ?5 ~
  5284.   ;;, D6 c7 h4 _' l5 X
  5285.   ;; If there is no error message, then close the dialogue
    & J+ P- v8 U+ b, P) v8 G
  5286.   ;;
    ! q5 t3 K$ L+ R) L, k4 f
  5287.   ;; If there is an error message, then set focus to the tile
      z$ b7 t4 w* \. v
  5288.   ;; that's associated with the error message./ q8 b5 o+ b* q( N1 W. V
  5289.   ;;
    ( V1 O; [! _6 n2 o+ }( w
  5290.   (defun test-ok ( / errtile)
    % c4 O, h- K7 m, z: Y
  5291.     (setq errtile (get_tile "error"))+ D* v  ?& ^+ q
  5292.     (cond1 n- M4 j8 R9 K& h9 G* w
  5293.       (  (= errtile "")
    + a3 i- ^8 z+ }  Z
  5294.          (done_dialog 1))
    " `' s# E) ?: T- u* M) \# m
  5295.       (  (= errtile "Invalid thickness.")8 g- ?& o+ Q6 L; q
  5296.          (mode_tile "eb_thickness" 2))
      T7 p7 h) `4 o9 j( [/ }% U3 K
  5297.     )& H1 U% k+ \/ }$ X" R0 t3 u
  5298.   ); E) F9 |, R4 _5 Y
  5299.   ;;. h2 a( t8 k8 z* V( |$ R  e
  5300.   ;; A color function used by getlayer.
    1 I" w, F3 ]4 q2 \7 r9 S9 S
  5301.   ;;
    ; Q+ _7 j3 `* z
  5302.   (defun colorname (colnum)
    6 K9 y  K4 m) o  i7 |: _+ z
  5303.     (setq cn (abs colnum))
    4 n. O8 `) }, f+ _$ J
  5304.     (cond ((= cn 1) "red")
    ( i4 k8 j5 L* G: u; X4 u3 o6 w5 C
  5305.           ((= cn 2) "yellow")# O  K; M( B0 A
  5306.           ((= cn 3) "green")
    9 D7 R1 L) H4 R1 s! b
  5307.           ((= cn 4) "cyan")+ U, \- C; O, F- g! a; U# r4 u
  5308.           ((= cn 5) "blue")
    9 Y4 E* ^/ k0 X" E4 y: J
  5309.           ((= cn 6) "magenta")
    - E+ ~' i: Y- ^, \* e% x0 a
  5310.           ((= cn 7) "white")$ D7 J* e( P  `4 L
  5311.           (T (itoa cn))5 _$ {3 b4 `! ?; B+ x4 _
  5312.     )
    * l/ v* |, v! x5 X3 g( A6 b" ?
  5313.   )
    ( o) Y1 s6 K, D: G

  5314. 7 S% d. F: h- d1 v; a
  5315. ;;; Construct layer and ltype lists and initialize all
    8 G& D) l3 J9 N: N( U
  5316. ;;; program variables:) F0 n, Q9 ?  t5 v3 W5 X5 p
  5317. 6 I8 j: j' Y7 D- ^' x
  5318.   (makelaylists)                     ; layer list - laynmlst  C6 h9 F7 h6 |3 }+ x
  5319.   (makeltlists)                      ; linetype lists - ltnmlst, mdashlist
    * }& }2 _* e* b. i) Z6 ^; ]
  5320.   ;; Find the property values of the selection set.
    ) z. B1 B& j1 d, v
  5321.   ;; (getprops ss) returns a list of properties from' B6 Z1 ?2 k  L2 z. ~. p
  5322.   ;; a selection set - (color ltype layer thickness).
    : @/ O  R. D4 W% @5 g' e2 C
  5323.   (setq proplist (getprops ss))
      _4 T- k0 ~/ m5 J- J6 B
  5324.   (setq ecolor (car proplist))
    - h4 @) K' g# P' u
  5325.   (setq eltype (cadr proplist))
    . K7 R5 m. l3 @8 Q# p; M
  5326.   (setq elayer (caddr proplist))2 S# O% w( J2 \/ r+ u( N! B
  5327.   (setq ethickness (cadddr proplist)): B, }: {: W2 |4 f0 Y% l# b
  5328.   ;; Find index of linetype, and layer lists9 g- d, s# m: m9 r
  5329.   (cond( y, `" g6 \) ]3 J; F- a
  5330.     ((= eltype "Varies") (setq lt-idx nil)): L2 r( K' n  G  K
  5331. ;   ((= eltype "BYLAYER") (setq lt-idx (getindex "BYLAYER" ltnmlst)))
    8 T* i* u6 K. {0 L2 [
  5332. ;   ((= eltype "BYBLOCK") (setq lt-idx (getindex "BYBLOCK" ltnmlst)))
    2 X# A$ H0 a. [1 O
  5333.     (T (setq lt-idx (getindex eltype ltnmlst)))- T# |- Q  c; P6 [$ o
  5334.   )" g$ y: X- ?: M% c! `, B. r; |
  5335.   (if (= elayer "Varies")' r' V+ g& q. p/ J9 y
  5336.       (setq lay-idx nil)
    5 w) T" [9 ^2 `% h( r
  5337.       (setq lay-idx (getindex elayer laynmlst))
    8 E. {8 e1 h# s$ {" P/ K3 U) x0 G1 w
  5338.   )
    8 W" c3 Y4 j& D& N9 z  A) P! Y) m
  5339.   (if (= ethickness "Varies")% D: ?2 D2 B8 Q
  5340.       (setq ethickness nil)" r+ b7 N& Y+ R& Y8 B. F% f4 Q  h
  5341.   )
    % l+ o  O& e  x: l/ o

  5342. . j4 d, |2 K/ t3 }
  5343. )   ; end (ddchprop_init)+ m& R2 Q" q; e6 S9 s% b
  5344. 2 I- D1 D3 u3 W$ ~6 Q, D* B
  5345. ;;; (ddchprop_select)
    2 o! H% A7 Z% D' f; X' ~
  5346. ;;;
    + E' F0 n& T9 o# Z' o7 e
  5347. ;;; Aquires selection set for DDCHPROP, in one of three ways:) X- }8 Y( I: @
  5348. ;;;; Y' ?1 o& F$ ], f3 v1 N  L
  5349. ;;;   1 - Autoselected.3 p3 ]* g, S4 M: C
  5350. ;;;   2 - Prompted for.
      f6 B% Y7 C. B; l  ?9 S
  5351. ;;;   3 - Passed as an argument in a call to (ddchprop <ss> )4 t, F* \' ?& e: v3 E: \: e
  5352. ;;;
    % N: I' Q5 p4 K8 }( {
  5353. ;;; The (ddchprop_select) function also sets the value of the; S) Q& `" B. m! a3 s
  5354. ;;; global symbol AI_SELTYPE to one of the above three values to
    1 g8 E  }4 l# Q9 K2 w3 i
  5355. ;;; indicate the method thru which the entity was aquired.
    ' e1 d5 m% h. J5 v
  5356. 1 t2 n. D" f$ q# ]% G
  5357. " v+ ]6 R1 T# [3 I- D' J
  5358. (defun ddchprop_select ()& R( Y8 c& H% A) J
  5359.    (cond
    8 y0 S( [& A2 w! s- v) G
  5360.       (  (and ss (eq (type ss) 'pickset))        ; selection set passed to; F& l" b' u! a7 T3 b- T
  5361.          (cond                                   ; (ddchprop) as argument
    + \3 \7 ^- T* g. j. D. n2 D; |
  5362.             (  (not (zerop (sslength ss)))       ;   If not empty, then1 v, S: f8 Y* e# P1 m
  5363.                (setq ai_seltype 3)               ;   then return pickset.  p1 l4 ^& z9 ^) K) a
  5364.                (ai_return ss))))+ H* G( B2 Z. z$ W  X

  5365. 5 Q5 m9 ~1 ?! M4 E6 o5 a8 X' j
  5366.       (  (ai_aselect))                          ; Use current selection9 `: r+ q2 ^5 P  A1 A* j; v  K. l
  5367.                                                 ; set or prompt for objects
    0 m) `+ @3 n; G! b: a
  5368. 6 D! b% V" Q  B
  5369.       (t (princ "\nNothing selected."): g- c9 l) u( J; H5 [
  5370.          (ai_return nil))# J9 F: G0 q0 ^# W. A$ E
  5371.    )
    " \  v/ d/ k1 ]
  5372. )$ r+ d: j$ R% R2 G

  5373. % J7 x- K( P: R/ U4 D1 R
  5374. ;;; Define command function.$ d, L  K. M. q  d1 X

  5375. - W6 @4 ~; ?3 z- i1 P8 t1 o
  5376. (defun C:CH ()
    * k, g, y2 W8 R( U
  5377.    (ddchprop nil)
    6 v  j/ P' G" H' D
  5378.    (princ)
    * s$ T, N! C! Z) u4 `0 d
  5379. )4 B8 U- ^$ `) \( ^$ }6 E! C: K, V1 E/ s

  5380. 0 c- m  i* O0 u3 b+ @8 t1 y
  5381. , y; p8 L( h( @+ _  ^& [
  5382. ;;; Main program function - callable as a subroutine.
    5 ]9 _/ r; E. H( X2 c* B
  5383. ;;;
    1 l9 i+ t' |/ o* G: I4 |7 f
  5384. ;;; (ddchprop <pickset> )
    " D2 V1 {" e; Q4 e
  5385. ;;;
    $ u/ F) [# j" R% _# A
  5386. ;;; <pickset> is the selection set of objects to be changed.( f# _( _; d) X8 v! b
  5387. ;;;
    $ y" P. f7 e2 [& {# t$ [7 Q7 F
  5388. ;;; If <pickset> is nil, then the current selection set is6 [8 f' t' J+ `' q% U* ?0 N
  5389. ;;; aquired, if one exists.  Otherwise, the user is prompted
    ) |: E; j! g7 \$ u4 q
  5390. ;;; to select the objects to be changed.: e5 N& P8 \0 Q  k. K
  5391. ;;;
    4 ]$ c$ O( u4 [& A* w2 z3 j7 M8 K: p0 [
  5392. ;;; Before (ddchprop) can be called as a subroutine, it must
    , e- l8 Q9 [' v# t0 F; u
  5393. ;;; be loaded first.  It is up to the calling application to
    # {6 K; m8 J) c( i) r
  5394. ;;; first determine this, and load it if necessary.& W, x/ C$ l3 e! y1 y2 P) @( g

  5395. 1 C. K& v/ [, [' C4 {- |! C) v
  5396. (defun ddchprop (ss  /
      T- p& u# n' \  r' x
  5397.   S, M' V! _% t$ m% s; i# e% l2 y8 g
  5398.                   add-mdash      ecolor          ltedit_act      s
    ( Z) p  h; p. S6 L! U, N
  5399.                   assoclist      elayer          ltidx           selset; r  c: \3 ~; n* n  l* N
  5400.                   bit-70         elist           ltlist          set_col_tile
    ( ^; N; U/ P7 K: H8 h( C
  5401.                   boxlength      eltype          ltlist1
    6 M( [( r6 W; C
  5402.                   bylayer-lt     en              ltlist_act      sortlist# f$ F8 J8 h8 x( F. p
  5403.                   bylayer_col    ethickness      ltname8 [% E6 o! S, F8 S. U
  5404.                   bylayer_lt     fchk            ltnmlst         sslen
    ! @% H9 l! v! R" T
  5405.                   call_chp       frozth          ltvalue         templist- Y. U2 |( i- P  c9 M, P+ N
  5406.                   chk-col        getcolor        ltype           temp_color  i3 g& G0 V% P( o( u* s  r
  5407.                   chk-lay        getindex        m               test-ok
    + w5 Q3 V4 N+ x8 E5 K% F
  5408.                   chk-lt         getlayer        makelaylists    testidx4 C  r5 r$ {* m4 a( N) J4 v, }/ v
  5409.                   chk-th         getltype        makeltlists     testlay/ y5 d1 s2 S; T. X9 Q9 ~
  5410.                   cmd            getprops        match-col       th-value
    3 m8 @& i$ c* k& n, e/ x3 O
  5411.                   cmdecho        getthickness    match-in        thickness( R9 Y; I( p; ]; ?
  5412.                   cn             globals         match-lay       tile
    & M% R; A9 Z2 s3 \" |( m
  5413.                   cnum           go              match-lt        tilemode
    7 H8 A- \/ h) [8 [- Q
  5414.                   col-idx        index           match-th        tile_rect
    7 T0 n! ]6 p# B' S; x8 R, I  ?
  5415.                   colname        item            match_col       vi$ z! W. g  t0 w
  5416.                   colnum         item1           mdashlist       vpf
    . ~4 m' ^$ r; M) B# [- o8 D
  5417.                   color          item2           n               vpldata
    . v0 R0 G, n4 X1 Q8 t4 M& R
  5418.                   colorname      itemlist        name            vpn- Y9 M2 e' g% S1 b
  5419.                   col_def        lay-idx         ncolor          x; J. ?1 O/ r/ ]" M. @  ~7 o
  5420.                   col_tile       layedit_act     nlayer          x1
    , H- u6 l: S$ q4 e' q6 E
  5421.                   ctr            layer           nltype          x2) e- d6 P( Z; c6 W- c0 ^  k2 U5 _4 k# x; T
  5422.                   cvpname        layinfo         nthickness      xdlist4 i/ H: T* l: y! h9 r9 X$ H1 k% m
  5423.                   dash           laylist         off             y- d! x% n) [3 G, x6 G
  5424.                   dashdata       laylist_act     old-idx         y1
    - U4 S: ?% e- I2 A' G+ V
  5425.                   dashlist       layname         olderr          y23 s9 `- O- w8 q, e; @( Z
  5426.                   dashsize       laynmlst        on              undo_init8 O% m; y* K& O/ N9 Z* @. @# i9 p
  5427.                   dcl_id         layvalue        onoff% I9 a! H3 b% a7 q6 e+ t7 ^
  5428.                                  linetype        patlist- z3 R% V' |' C0 o+ S' Z8 t% R8 S
  5429.                   ddchprop-err   list1           pattern: ~/ O! v( R/ Z( U7 i' s
  5430.                   longlist       proplist$ k$ i1 B( D" x  _+ O  [% S+ z, k( h
  5431.                   lt-idx         reset-lay
    $ g4 Z) A% T0 @
  5432.                   drawpattern    ltabstr         reset-lt
    + i, z1 ]6 P1 C/ B( h; M5 F: K
  5433.                 )
    3 e4 l$ d( P) i8 g1 Z9 q
  5434. ( f3 f& M5 e) A1 y
  5435.   (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho
    # T# u  X4 l8 k4 L
  5436.         old_error  *error*            ; save current error function
    6 N$ |; }8 F$ m# O
  5437.         *error* ai_error              ; new error function
    " x' W' V4 a" A! @3 F
  5438.   )
    $ n; |! I1 K' p$ t* l, x

  5439. ( e; u: o8 o  \3 Z8 a/ k0 c
  5440.   (setvar "cmdecho" 0)5 Q$ `/ H. t- l, p! `

  5441. ; T" L$ l3 y8 `# r' J
  5442.   (cond1 L" a7 o5 H/ |3 B, M6 ]" i' ]. Z% a
  5443.      (  (not (ai_notrans)))                      ; Not transparent?
    9 c7 B3 H# d& k# @# [1 a0 x
  5444.      (  (not (ai_acadapp)))                      ; ACADAPP.EXP xloaded?& L$ y: T5 f7 P1 D% _
  5445.      (  (not (setq dcl_id (ai_dcl "ddchprop")))) ; is .DCL file loaded?
    3 m! D0 s9 x" f, F
  5446.      (  (not (setq ss (ddchprop_select))))       ; objects to modify?! B: h) q1 e+ v. |2 v) U: `6 z: Q
  5447. , T2 J' r, t% Q; \/ N, b. O: e3 N
  5448.      (t (ai_undo_push)
    / v: z3 ?# A6 c8 W5 @1 {
  5449.         (ddchprop_init)                          ; Everything's cool,, ]; f# t6 B1 L; L* m
  5450.         (call_chp)                               ; so proceed!
    1 ~  [2 }3 n+ [0 p" `
  5451.         (ai_undo_pop)
    ! _" Y7 M2 y7 d8 g% `* k5 a
  5452.      )2 }) ]- x7 u: p# H( B7 I% e
  5453.   )6 j$ K) x' {; b! H6 H% h
  5454.   9 _: i# ^/ y, c& c, E% F! i
  5455.   (setq *error* old_error) " i7 @: ?2 Z% F: c% Y
  5456.   (setvar "cmdecho" old_cmd)
    $ D' V$ R1 w( l  p+ [9 I  e
  5457.   (princ). I* T4 J3 p" n) @) m
  5458. )
    7 a* w" V. j/ f$ p5 G

  5459. 6 L& y; a. S0 ^( l+ P
  5460. ;;;----------------------------------------------------------------------------
    - F- r7 `! `) Q$ m

  5461. ' c* }* I) Q1 T# p7 `- B
  5462. (princ "   DDCHPROP loaded.")
    7 |) M3 {0 u) M) y) F* j1 N# l
  5463. (princ)/ R2 p/ |8 z2 K2 I0 O# r# p: c( l
  5464. - M- V# t' a# |0 a+ U
  5465. ;;;----------------------------------------------------------------------------
    6 T$ `% G) J  X6 r. z) ]* |# c) A
  5466. % H8 {3 |% M* @  P: L1 x
  5467. ;--------------------------------ddmodify.lsp----------------------------------
    6 p) |: T/ v& N5 a
  5468. ; Next available MSG number is    1114 O$ U) s. m+ ~- q" q: @
  5469. ; MODULE_ID DDMODIFY_LSP_. n; E% s+ T' w+ i% H
  5470. ;;;----------------------------------------------------------------------------
    # p, a1 \9 v' B8 b2 t# m
  5471. ;;;    DDMODIFY.LSP
    4 |/ w3 _& p$ Q( \2 [" w
  5472. ;;;
    : L% k" E, g4 W6 |$ @
  5473. ;;;    Copyright 1997 by Autodesk, Inc.& Z" V9 W9 ?9 e+ M
  5474. ;;;
    1 D$ f8 g! B( y; C: L5 ]" G
  5475. ;;;    Permission to use, copy, modify, and distribute this software
    $ c0 S0 I7 |: k- t6 X# C
  5476. ;;;    for any purpose and without fee is hereby granted, provided
      ^& ?/ {& y9 Q% D* m
  5477. ;;;    that the above copyright notice appears in all copies and
    - B% P. c5 r: I2 a' x
  5478. ;;;    that both that copyright notice and the limited warranty and
    4 W/ p  d9 W2 `+ ]1 _+ Q# e
  5479. ;;;    restricted rights notice below appear in all supporting
    8 d$ F- T6 J" Q6 b' G! c" Y: |
  5480. ;;;    documentation.8 \. @3 A& [, W
  5481. ;;;4 o4 r+ s" @& }8 W7 ^
  5482. ;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.3 J" c7 N6 f# \. X7 B2 R
  5483. ;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF) O: e% B6 N: M$ a
  5484. ;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
    & l" g) U# S' g* c; B) r8 ?7 w
  5485. ;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
    2 F6 _( y# _3 L1 K) D$ o4 `
  5486. ;;;    UNINTERRUPTED OR ERROR FREE." y+ a$ ]. N$ |1 l# N! M
  5487. ;;;( C6 W# K# F# X3 L5 L" L) {
  5488. ;;;    Use, duplication, or disclosure by the U.S. Government is subject to
    $ |* _, f5 Z7 Q; c
  5489. ;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer7 M5 N( I3 A$ [" R9 I
  5490. ;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)! s) U; n9 Z5 ?; h
  5491. ;;;    (Rights in Technical Data and Computer Software), as applicable.
    ( n) J9 L1 L( m2 c) V6 Q, |
  5492. ;;;
    " K' P9 U, M7 B; ~
  5493. ;;;.
    6 E$ `9 v; t9 m0 w+ Y
  5494. ;;;
    1 j5 u; M( M; v8 G/ j
  5495. ;;;----------------------------------------------------------------------------" _& }  z" w# @( S% K( V
  5496. ;;;   DESCRIPTION/ m' O- P' F. `% d
  5497. ;;;
    * |% o- ]/ P9 W) |( U
  5498. ;;;   This function allows the user to get a listing comparable to the LIST
    3 V0 q  v& n; _: ~
  5499. ;;;   command for most objects.  In addition, most object fields in the, h* r9 S4 X, k4 Q8 N
  5500. ;;;   dialogue box are editable.  Points can be specified dynamically by: s# w/ k/ L! P0 ^- y- j
  5501. ;;;   temporarily dismissing the dialogue box.  Each object has a unique6 A/ n! \5 Y, U3 B7 p
  5502. ;;;   dialogue.
    2 b8 i5 G( d8 E5 G' n8 H  Q! ?) g
  5503. ;;;
    " X3 x; B8 y8 S9 r. r$ d7 u
  5504. ;;;   Naming conventions
    , m- }) X  P% _. O9 r, s
  5505. ;;;   Long function and widget names may use an underscore "_"
    * N2 N  t3 @7 s3 s
  5506. ;;;   in their names to make them easier to read, long variable: p& w* \- A$ x8 E4 B! `
  5507. ;;;   names use a dash "-".
    ! Z3 R; X7 e& d1 h( u8 q# A5 j% M
  5508. ;;;----------------------------------------------------------------------------
    7 f: H( P" E2 P# W3 G1 F
  5509. ;;;----------------------------------------------------------------------------
    2 \8 M8 O1 ^! I* s. X5 W+ h
  5510. ;;;   Prefixes in command and keyword strings:4 p3 F. T# m1 t; I
  5511. ;;;      "."  specifies the built-in AutoCAD command in case it has been
    ! m$ _% [5 M) t4 f2 V4 C2 ?
  5512. ;;;           redefined.2 {- e* H$ b* D
  5513. ;;;      "_"  denotes an AutoCAD command or keyword in the native language
    9 ]: m! L$ i/ U! h3 m& T
  5514. ;;;           version, English.6 X8 b+ `$ S& h
  5515. ;;;----------------------------------------------------------------------------
    3 X+ I3 }* Y' k0 X
  5516. ;;;
    4 ]/ G7 Y0 `# D% U4 \
  5517. ;;; Avoid (gc)s on load to improve load time.- v& T" r) V" |
  5518. ;;;
    7 a) |2 _% l: [8 x
  5519. (defun do_alloc (/ old_allod new_alloc)# t) J# D$ }- T7 U5 f( x0 c( A7 m
  5520.   (setq old_alloc (alloc 2000) new_alloc (alloc 2000))5 d7 F& o) d; L2 E( h* Z
  5521.   (expand (1+ (/ 17000 new_alloc)))' z2 C; u4 O$ v$ Y4 t* ?3 g
  5522.   (alloc old_alloc)7 ?2 I1 ]' V) ^3 h& n/ M2 s
  5523. )6 r4 C/ q) a- I6 n: Q  O
  5524. (do_alloc): d5 C: s) ]8 a2 k' X! I8 I2 y
  5525. (setq do_alloc nil)
    / A! R3 U" s8 g. Y8 U

  5526. 4 l" R. z, J$ a3 B1 D, x
  5527. ;;;, ~4 W% b5 S- s3 z
  5528. ;;;
    & k8 p  ?2 n) Q: N$ W' z9 ~( S# B- n
  5529. ;;; ===========================================================================3 `+ h7 R! h  b
  5530. ;;; ===================== load-time error checking ============================
    6 l! a7 V9 f- n; K2 p# s- Y0 n
  5531. 3 {9 H& O, f3 @3 H7 p
  5532.   (defun ai_abort (app msg)
    ) L3 K  `+ m5 v+ s& Y& {
  5533.      (defun *error* (s)
    9 I. |( m0 D6 L; v* n. V" z
  5534.         (if old_error (setq *error* old_error))
    4 w: a6 Z+ H* [4 I  C; O+ F7 @9 A% G
  5535.         (princ)
    2 b  G# i, q3 P: l6 g& A
  5536.      )
      W8 b+ u0 F: U( l! ]
  5537.      (if msg+ O/ B) G% J3 e
  5538.        (alert (strcat " Application error: "8 |9 M# x/ G1 ?3 |2 N% P
  5539.                       app/ f2 _* I" m* ~
  5540.                       " \n\n  "6 a5 @7 p8 ~1 L
  5541.                       msg
      k, Q! A' \3 F$ g& n4 `
  5542.                       "  \n"
      @9 G& M9 P! d4 p: g
  5543.               )
    2 R1 d7 q$ d+ G
  5544.        )
    * N  Q/ W3 S! G% h* z
  5545.      )
    0 y: G. F0 `' J7 y5 k0 E5 M
  5546.      (exit)
    8 {6 r! U% |5 [% ]5 |: S' S
  5547.   )
    ( n6 B7 \* J+ @9 G

  5548. 1 p5 y; g" ~& Y: M, e* t0 c
  5549. ;;; Check to see if AI_UTILS is loaded, If not, try to find it,& I7 s8 F$ h, ~  e& `
  5550. ;;; and then try to load it.  If it can't be found or can't be
    . ~2 P  L& ~: p# w
  5551. ;;; loaded, then abort the loading of this file immediately.* H( w4 H9 T( l4 J: o

  5552. / J/ ?7 L: p% g4 u4 w
  5553.   (cond+ @, N# k3 G. S# n; |
  5554.      (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.
    % {! g' U$ ~) w' c) H8 V
  5555. * |. p" R. _% j# k" d* }
  5556.      (  (not (findfile "ai_utils.lsp"))                     ; find it
    # s" S8 R' x6 X
  5557.         (ai_abort "DDMODIFY": I/ J  x. {. m& ]
  5558.                   (strcat "Can't locate file AI_UTILS.LSP."5 @/ A  Q% L) G* A* B- {9 l' N
  5559.                           "\n Check support directory.")))5 b0 w# e: R1 W0 w4 c% h/ G
  5560. 1 c$ p$ j7 U6 o
  5561.      (  (eq "failed" (load "ai_utils" "failed"))            ; load it5 Q9 b0 ]& p& q' h
  5562.         (ai_abort "DDMODIFY" "Can't load file AI_UTILS.LSP"))
    5 A$ [# k2 |/ C1 k! `
  5563.   )1 U2 X; O* Q5 s& x) A% Z) q: h" P+ S

  5564. 5 W! o0 v* N8 U+ Q1 p7 x6 b9 l
  5565. ;;; If we get this far, then AI_UTILS.LSP is loaded and it can
    # v, e/ W( a4 y* }4 a. K
  5566. ;;; be assumed that all functions defined therein are available.: N6 Y3 Z/ Z4 ^: ^8 |

  5567. 7 N! r& x/ J# x7 I# Q3 Z' s4 x5 f! R
  5568. ;;; Next, check to see if ACADAPP.EXP has been xloaded, and abort  l/ q" ^# ?0 o1 J2 y; _: o6 v
  5569. ;;; if the file can't be found or xloaded.  Note that AI_ACADAPP
    % E/ F; ^; k4 g  J
  5570. ;;; does not abort the running application itself (so that it can
    3 j( p% @# L/ L1 y/ T
  5571. ;;; also be called from within the command without also stopping+ M" S1 H$ B) L
  5572. ;;; an AutoCAD command currently in progress).4 A7 f' v( s/ Z' P, V
  5573. / c) [  m# t; w% f7 u) D; C) }
  5574.   (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP# y4 V3 q4 l/ @9 V6 ~
  5575.       (ai_abort "DDMODIFY" nil)        ; a Nil <msg> supresses
    - W! d$ k* P4 u" A9 ~
  5576.   )                                    ; ai_abort's alert box dialog.( h6 a9 \* s, k/ A3 Y

  5577. 5 Y6 Q# O3 N2 c9 f# [" C; p
  5578. ;;; ==================== end load-time operations ===========================
    ( v3 y5 Z% e" P6 b# S. X7 S
  5579. ' o* r8 x& p: o9 ]
  5580. ;;; global variables
    7 _9 x$ \; q2 ~1 W5 \  v) @
  5581. + S. o0 `3 t! a" \$ ^  W$ V. C
  5582. (setq hatch-elist nil)
    : K/ J8 o( Y4 \* [6 y0 X
  5583. & a9 f7 b1 E7 x( S  w
  5584. ;;; If we get this far, both ai_utils.lsp and acadapp.exp are5 X' s3 B& B& }2 {/ Q) |- K% G
  5585. ;;; assumed to be available.7 x* N1 \( g8 Q. X  t
  5586. 2 n9 ~3 ^; O* M* E) c3 [0 n
  5587. ;;; Define and encapsulate all subroutines that are declared) W9 R# ?4 W. ~
  5588. ;;; locals of the (ddmodify) function.
    : s; M5 b# W! M2 C: M

  5589. - e, V+ F1 Z' `5 E; p) A; w- C
  5590. (defun ddmodify_init ()( Z) L) g; I2 z, b
  5591.   ;;, G; }% [) h, E# w
  5592.   ;; These three functions modify the enitity list for common properties.  Since
    2 {* I; I* K  \9 \8 I
  5593.   ;; color, ltype, and thickness are absent from the object list when they are
    0 a$ _5 C$ T7 _+ H/ [4 `' l2 H
  5594.   ;; set to their defaults (i.e. color = bylayer), a simple substitution using
    - @2 f( ?4 z; D8 h6 Q, Q- ?1 C
  5595.   ;; SUBST is not possible.
    % ^$ ~; g6 _3 u; N
  5596.   ;;; R9 K0 c& H  L
  5597.   (defun modify_properties ()0 q* c7 F: d: ]6 h- l9 e
  5598.     (emod ecolor 62)6 `# B. q: T/ h; z2 ~
  5599.     (emod eltype 6)
    8 ?3 @( g3 A( i; p. X( _
  5600.     (emod ethickness 39)
    , b& n5 i* f+ a9 A# L& z
  5601.     (emod eltscale 48)
    1 R5 ?! j5 Y8 h! O; O* @2 ^
  5602.     (tempmod elayer 8 nil)8 k9 l) n  i; b
  5603.   )# d& \! q1 v8 [% u; R( k
  5604.   ;;* Q# c8 U/ Z* m, J% {  y% p
  5605.   ;; This function is used for modifying common properties of the ACIS
    % o8 }" }3 f1 Y1 D: _5 d( L
  5606.   ;; based geometry objects. Thickness is not valid for these objects1 \- t/ z  H# g  c! o! i
  5607.   ;; so it is left out.6 u) z& q  w: o5 {( E$ L
  5608.   ;;
    4 [' E/ E; h8 Q0 H: \2 a
  5609.   (defun modify_prop_geom ()8 h0 x. _& \7 i" k, S7 G; _
  5610.     (emod ecolor 62)" n6 ^" i7 h6 E0 _
  5611.     (emod eltype 6)2 z! E; M4 d/ H$ [0 j
  5612.     (emod eltscale 48)
    " I: M: x2 x, r9 x6 X0 k& g9 H
  5613.     (tempmod elayer 8 nil)
    9 y  E2 k" l; ~8 |) p* W
  5614.   )
    1 @: ]; H; Y/ b9 L
  5615. - f3 s3 F% Y% r! p( Y
  5616.   (defun emod (value bit)% w" c6 U5 T6 R8 x
  5617.     (if (= bit 62)
    7 R# W% ?" p! R" y
  5618.       (progn
    9 d; r7 k. V) K0 ~/ v/ {7 e
  5619.         (if (or (= value "BYLAYER")+ O  X% T' a& p
  5620.                 (= value "BYLAYER")) (setq value 256))
    8 q* B- b3 x- q/ s% ]' c: d
  5621.         (if (or (= value "BYBLOCK")
    * n# ]2 W) `1 Q4 h
  5622.                 (= value "BYBLOCK")) (setq value 0))/ O; ?2 m( @4 y$ k2 c) E
  5623.       )9 ?$ Q. N5 x0 p
  5624.     )
    7 ~/ m- d( V2 j( H' O9 H& J
  5625.     (if (setq oldlist (cdr (assoc bit elist)))
    0 \6 i; N# ?/ x& w0 a- ^& h
  5626.       (tempmod value bit nil)3 z0 Y9 B5 }% D! ~5 D2 |8 M; F
  5627.       (setq elist (append elist (list (cons bit value))))
    3 e1 v  ?5 B/ C) T: l" _3 A
  5628.     )
    - Z  m" r% V0 g; Z
  5629.   )
    # r3 l8 e) e; o0 |& z5 n. i
  5630.   ;;
    2 J' o  Z$ I+ H2 ^( H2 z' J
  5631.   ;; Resets object list to original values.  Called when the dialogue or
    ( C9 M: B+ ]/ r
  5632.   ;; function is cancelled.
    + q( T- K" M- F4 a( A4 s; j
  5633.   ;;
    ( ^2 u8 P) w- R' r, o5 q9 x
  5634.   (defun reset ()
    7 J! j5 ]  L& a( u# S  t8 s
  5635.     (setq elist  old-elist. l' Q" s  y& F: r
  5636.           ecolor (cdr (assoc 62 old-elist))& R: o* g# L1 u/ ?4 F/ o% Y  l+ `
  5637.           ethickness (cdr (assoc 39 old-elist))1 J' R, k5 ]  V% e! }
  5638.           eltype (cdr (assoc 6 old-elist))
    2 c( @/ y' M2 g  p
  5639.           elayer (cdr (assoc 8 old-elist))" t5 t& c0 y! G" e; l+ f+ j/ t9 r: y
  5640.           eltscale (cdr (assoc 48 old-elist))9 O  n! m: L$ O& e, }
  5641.     )' U) a5 b, ]) a. u: ?
  5642.     (if (not ecolor) (setq ecolor "BYLAYER"))
    / V1 T" ~  m$ s  j4 E
  5643.     (if (not eltype) (setq eltype "BYLAYER"))
    9 @' v% |1 v/ F1 W
  5644.     (if (not ethickness) (setq ethickness 0))
    7 Z1 ~* J2 F# x5 @6 s
  5645.     (if (not eltscale) (setq eltscale 1))
    & f, K& M& P9 P+ W
  5646.     (modify_properties). F( q8 x/ \  ^7 @$ `7 A
  5647.     (setq reset_flag t)
    + v" }$ v* L0 C0 P8 D- V
  5648.     (entmod elist); s6 _5 }/ {6 u9 _
  5649.   )- S9 k; T! }& V% B
  5650.   ;;& f% s0 l* z4 u3 j0 t5 l* p2 H
  5651.   ;; Modify object when dialogue is temporarily dismissed to reflect latest
    , v* _* T! G: \  w( u; K
  5652.   ;; settings of dialogue.  It converts the point from current UCS coordinates to( H" A0 h7 w3 j! E
  5653.   ;; the proper object coordinates (world or object).
    0 b; S- o! U4 d+ M
  5654.   ;;1 T1 y' }- P2 K
  5655.   ;; Arguments: value - in current UCS coordinates
    8 b, Z# S# p& O6 ]7 L. _
  5656.   ;;            bit   - object code (i.e. 10 for start point)
    / m0 n$ {+ A; _
  5657.   ;;            ptype - point type  0=world 1=planar
    ) q3 m. [6 A7 O5 u# y! X6 y
  5658.   ;;  g  U0 k0 X+ f5 |  x, q% d" I- u
  5659.   (defun tempmod (value bit ptype / newpoint): P8 F& [0 s( p' v
  5660.     (cond
    ' J; g) f$ }+ F) {: h) n3 o
  5661.       ((= ptype 1) (setq value (trans value 1 ename)))( s9 `  G7 Y4 M" g( U
  5662.       ((= ptype 0) (setq value (trans value 1 0)))
    & {$ `) [# y, n% G; W' K( l3 W
  5663.     )
    3 Z' F$ D1 D2 i4 }
  5664.     (setq elist (subst (cons bit value)
    - _& K" h8 A, I  V% O
  5665.                        (assoc bit elist)4 V9 P) @4 z2 Y* C  U. B- r, _
  5666.                        elist0 E4 Y/ e2 a4 b; k' ]
  5667.                 )! o5 X& e; C% W" z- F+ \
  5668.     )
    * i3 z2 E1 ]  p
  5669.   )  l3 P4 n7 @) s' U2 b
  5670.   ;;- a9 I% ^6 L" H& x' e3 I, x
  5671.   ;; The following functions are called after a dialogue has been temporarily: N6 Y# _+ V9 S
  5672.   ;; dismissed and the user is selecting a point.  If a point is selected the' T; E3 K7 A. W
  5673.   ;; object list is modified and new X,Y,Z values set.  If no point is selected
    ; O  t+ \0 o0 N! c, x
  5674.   ;; (null response), then the point is reset back to its previous values.
    * |8 G6 T4 b- ^/ r
  5675.   ;;
    , R4 ^9 R) Y8 \4 Y2 x6 G1 p7 l# s' Z3 `
  5676.   (defun ver_pt1 (ptype)! U, \* X) S4 l0 ^  f0 @; E
  5677.     (if pt1
    6 \# b* K$ j' T2 d! O' a/ q
  5678.       (progn
    # l+ ^  Z  C! F6 m5 Z! f: \0 S! q
  5679.         (tempmod pt1 10 ptype)
    $ d2 ~6 K7 J$ k: j* P3 \3 f
  5680.         (entmod elist)0 p! M! {5 R$ I, T
  5681.       ); \# ~, H0 c$ N5 y& T
  5682.       (setq pt1 (list x1 y1 z1))
      I4 a' [7 s" D$ g
  5683.     )" ]  s3 J5 D% I6 D
  5684.   )( }/ Y% y' T  ?

  5685. 0 R! u0 a% g. E
  5686.   ; (move_pt1 <ptype> )
    0 G+ _$ O* C7 D; g, k1 s: U
  5687.   ;1 B; T0 V5 e+ C- a
  5688.   ; Called in liew of (ver_pt1) to translate block insertions which( Z# [$ s$ J7 v- \' x4 s
  5689.   ; might have variable attributes attached to them.  If the distance0 M$ G. s: \' ]4 o% b+ E
  5690.   ; the block is to be moved is < 1e-6, the move is deferred.  ~1 x0 u1 q; s5 K
  5691. " L: C# m7 m+ J: p4 x4 X
  5692.   (defun move_pt1 (ptype / basept hi)
    # I, Y) }! C7 `# U2 V
  5693.     (setq basept (trans (cdr (assoc 10 (entget ename))) ename 1))
    / B/ Q" Q& ]  l9 @5 D$ k
  5694.     (cond8 R. `0 ?. C* ?9 u  m
  5695.        (  (not pt1)
    2 c1 b5 ?( E; X5 {$ O' i4 b( q
  5696.           (setq pt1 (list x1 y1 z1)))3 V) [6 p4 c; O
  5697.   u7 B+ t" M* D. ]  D
  5698.        (  (> 1e-6 (distance pt1 basept)))
    : k' e( n, Z1 L0 u
  5699. 3 l$ \8 M0 |% }* a7 Q3 c
  5700.        (t (tempmod pt1 10 ptype)
    7 }7 w6 g8 Z5 g- ]$ X' @" A# Z
  5701.           (setq hi (getvar "highlight"))
    : k/ n6 v- e5 @( q7 K" c
  5702.           (setvar "highlight" 0)
    5 y6 z, t6 {6 t
  5703.           (command "._move" ename "" basept pt1)% t( C0 Q! j" h# I0 c( [3 i1 b
  5704.           (setvar "highlight" hi))
    ( `$ a( n/ I$ L. ]& D5 h  h: r. o
  5705.     )7 p3 N6 y7 {$ o5 t( u/ f
  5706.   )9 r3 D0 f# x6 G, Z0 i
  5707. 2 \/ T. C# P# ~: S
  5708.   (defun ver_pt2 (ptype)
    : I9 \2 T, T! m, C: R. _
  5709.     (if pt2. z) B0 A$ d! M& z
  5710.       (progn0 ]: p0 d0 ]/ w
  5711.         (tempmod pt2 11 ptype); b# T& Q2 ?* n/ I
  5712.         (entmod elist)
    3 e3 P& q, `8 w$ M3 w  C
  5713.       )
    # L, z. r0 A' F, r2 H8 d
  5714.       (setq pt2 (list x2 y2 z2))2 c: A1 i. j# F% i9 i- h
  5715.     )
    + W+ L. d6 K5 |7 J2 }
  5716.   )
    % n1 C6 R& I8 o+ u  R2 R; H
  5717. 4 N( d/ S. [5 z: @' X; V! M
  5718.   (defun ver_pt3 (ptype); T& T# [$ F1 P" [
  5719.     (if pt3: ^" m. _. {% Z" Q: [- m
  5720.       (progn
    2 k- }9 M2 P, A7 X8 M% `8 _; {
  5721.         (tempmod pt3 12 ptype)- z5 Q& V# j/ U( m) b6 R
  5722.         (entmod elist)
    ( O; L& F% o5 U4 ~
  5723.       )2 |6 t8 c+ a4 j7 k
  5724.       (setq pt3 (list x3 y3 z3))
    7 N# t1 ~4 b/ x
  5725.     )6 y+ i: l( A6 N
  5726.   ), k5 v. I/ @6 X
  5727. 6 {  c- s( u1 X, @" S: G7 w4 g
  5728.   (defun ver_pt4 (ptype)
    # ]. P) O3 Y' w! U3 j4 R
  5729.     (if pt4) k) h/ s% z6 B
  5730.       (progn; f; C' i" Z& e
  5731.         (tempmod pt4 13 ptype)
    ) e3 z6 b1 i: q) _8 K
  5732.         (entmod elist)% V; f% T( i, @
  5733.       )* V( r. r' o( K/ q0 E/ o
  5734.       (setq pt4 (list x4 y4 z4))4 e8 C" u1 K3 {$ A$ O# q* e
  5735.     )" `2 g: Q- _- _7 D
  5736.   )
    & S1 x8 w" W: {& w, b+ U; L5 u/ M
  5737.   ;; Xline/Ray% i* Q# b4 Q0 ?) W& T( D
  5738.   (defun ver_xline_pt1()3 [& J' V1 S2 ?1 s& C( v  Q+ f
  5739.     (if xline_pt1( x5 L/ H4 a8 G  u
  5740.       (progn
    + [$ D" ]3 d) W. z1 `
  5741.         ;; convert to WCS.; Z. J3 C9 a6 s, v" l
  5742.         (setq value (trans xline_pt1 1 0))
    + h) I* U& r9 \, [* v1 [: @6 ~# Z
  5743.         (setq elist (subst (cons 10 value)7 \0 k, Q" p6 }: a( m
  5744.                           (assoc 10 elist)2 Z: s+ ~3 N: e6 M2 j8 R
  5745.                            elist5 z% Z; A9 ~$ b9 Z0 c" U6 g* Y
  5746.                     )3 c* Y+ o$ `; c' s. W# a% ?
  5747.         ): {, U# X8 ]( l0 w* Z# F
  5748.       )
    3 {: _, j9 i  K* Q* q3 }
  5749.       (setq xline_pt1 (list xline_x1 xline_y1 xline_z1))7 u# `3 ]5 P; w
  5750.     )+ L7 F) `3 X; d3 I  Z
  5751.   )
    : t& @; W* {/ ^+ S1 v/ x
  5752. ' z9 b, t& L* J0 {
  5753.   (defun ver_xline_pt2()
    7 Z7 H. @+ Q$ B: G$ {8 Y
  5754.     (if xline_pt2
    * [! Z8 F' u! V' t
  5755.       (progn
    " F9 d# w0 R: N2 V, m( n
  5756.     ;;* ]6 x, o  x& @1 g
  5757.     ;; Calculate new Direction Vector WCS$ R+ m  ^/ q7 z8 I, T
  5758.     ;; x / (sqrt ( (x**2) + (y**2) + (z**2)     ))& d3 t- l% }3 C
  5759.     (setq temp_dir (trans xline_pt2 1 0))
    6 V# |, i& @2 J; O
  5760.     (setq temp_dir_x (car temp_dir))
    2 ~! L) x; h* Q9 \
  5761.     (setq temp_dir_y (cadr temp_dir))
    , D* z( c$ u% C* _: l3 r( H
  5762.     (setq temp_dir_z (caddr temp_dir))% y& z  i" f% F9 V9 ~

  5763. 7 s& J- B1 L) b6 o! a% S
  5764.     (setq temp_xline_pt1 (trans xline_pt1 1 0))
    - p. v) {  p% v( x: Q6 M+ R% c
  5765.     (setq temp_xline_x1 (car temp_xline_pt1))4 Q* Y( H0 k3 [+ P# v; M
  5766.     (setq temp_xline_y1 (cadr temp_xline_pt1)); w; h+ E; N% A, W
  5767.     (setq temp_xline_z1 (caddr temp_xline_pt1)), _/ W  L2 e( c/ r8 t. X
  5768. 9 d5 ^3 ?- L1 c1 X8 V
  5769.     (setq denom (sqrt (+ (expt (- temp_dir_x temp_xline_x1) 2)
    $ m9 h1 V& W2 ]1 F2 s5 L0 ]& G: z
  5770.                          (expt (- temp_dir_y temp_xline_y1) 2)
    ) q2 Y! g9 Z- a4 @
  5771.                          (expt (- temp_dir_z temp_xline_z1) 2)
    & b5 F! {) l. f3 p
  5772.     )))2 d: T2 \$ D2 `! T5 M' t
  5773.     (setq temp_dir_x (/ (- temp_dir_x temp_xline_x1) denom))
    5 ?* u8 R$ K) d2 Q0 ]
  5774.     (setq temp_dir_y (/ (- temp_dir_y temp_xline_y1) denom))
    : i7 [+ f. u2 U4 F/ T
  5775.     (setq temp_dir_z (/ (- temp_dir_z temp_xline_z1) denom))
    # e1 \' u6 O8 K  l- g% w! h
  5776.     (setq elist (subst (cons 11 (list temp_dir_x temp_dir_y temp_dir_z)), H( @" l/ w" V3 z: y+ Z& a
  5777.                        (assoc 11 elist)( a6 K) r% t! O
  5778.                        elist
    . U! d# m( ^) Q( [( S" e& P. ], |9 P
  5779.                 ). A7 k6 W1 d/ X3 {2 R# Z
  5780.     )3 S" P5 C( O4 C' j4 P3 \0 T
  5781.     (entmod elist)
    + Z% o/ n' m( U+ t: i: e
  5782.         (setq xline_x2 (car xline_pt2))$ C, z1 ?3 b. S% I* D8 z
  5783.         (setq xline_y2 (cadr xline_pt2))6 o, h9 M5 a- \8 r
  5784.         (setq xline_z2 (caddr xline_pt2))- i$ `/ d1 T4 ^5 p+ A8 D

  5785. : ^& Z" A) I( `% D. Z' ^( b( v, T

  5786. ) `1 g% s8 B& O
  5787.       )
    9 H  _( K7 s; @  F: v" E
  5788.       (setq xline_pt2 (list xline_x2 xline_y2 xline_z2))
    # L1 i5 D; h3 _
  5789.     )
    - T% `+ P; D2 V7 K/ `
  5790.   ): k9 O' R- I( F: {5 S

  5791. , x5 N1 @, m$ C( K
  5792.   ;;
    + p1 e/ [8 b; `0 X/ Y. U
  5793.   ;; Common properties for all objects
    # h+ w* p5 @. B1 ^) D0 i- _6 _
  5794.   ;;) ?- P4 z$ G1 T' v# B  d
  5795.   (defun set_tile_props ()
    ! U$ w( o& Q& c/ K9 ^+ \5 l
  5796.     (set_tile "error" "")
    # t+ G0 }: v# Q1 D9 R( ~
  5797.     (setcolor)
    * j) w6 Y' h; s$ i3 o( n- `  N7 c, N  L
  5798.     (cond
    # z* D0 v: c, g; ^
  5799.       ((= eltype "BYLAYER")
    * S& }$ g8 I6 r5 @" T
  5800.          (set_tile "t_ltype" (bylayer_lt)))1 U8 D6 [% y4 v4 W6 p
  5801.       ((= eltype "BYBLOCK")/ e0 i3 s: U7 o9 R, S/ K; }: D1 M
  5802.          (set_tile "t_ltype" "BYBLOCK"))
      L( S6 A) H3 x7 t# Y
  5803.       (T (set_tile "t_ltype" eltype))
      u4 y) J& O, \4 j' f; |  p
  5804.     )
    ; p- {" z0 t0 m# s4 @* e
  5805.     (set_tile "t_layer" elayer)
    ! v$ N) \- k7 z# M8 A+ l
  5806.     (set_tile "eb_thickness" (ai_rtos ethickness))1 S4 p# G- b6 |+ S8 e2 @
  5807.     (set_tile "eb_ltscale" (ai_rtos eltscale))
    / l- P/ O$ q- `9 O/ g8 A
  5808.     (setq which_tiles (ai_common_state etype))
    3 ~8 H) ^. M# L7 G
  5809.     ;; Disable tiles if need be...0 P" \7 y" v% y5 \7 I
  5810. 1 H; R' }: o9 U0 F- D& [, v
  5811.     ;; Layer Button and Text Field
      B" B" y3 n2 n5 |5 U
  5812.     (if (/= 1 (logand 1 which_tiles))
    6 [4 r4 F0 e) |" h4 A. i
  5813.       (progn
    1 z; j$ u% E- m" ^* |
  5814.         (mode_tile "t_layer" 1)" c! z- o3 ~; I+ t+ v, y6 e
  5815.         (mode_tile "b_name" 1)5 z8 Q" _' m: s3 X* E1 X  k
  5816.       )
    ! F; j' C: g) N7 v
  5817.     )) ]( W/ s3 e& x3 |% r; u' K0 u" N
  5818.     ;; Color Button and Text Field
    2 C  q- B, A. ]8 o0 h( G: i
  5819.     (if (/= 2 (logand 2 which_tiles))8 ]/ O: J' Z8 I0 M4 ?1 ~
  5820.       (progn2 ^: s* @+ \' C
  5821.         (mode_tile "t_color" 1)
    6 W& m# q+ W7 f% @7 U1 w
  5822.         (mode_tile "b_color" 1)0 G: s+ A9 n; \1 x
  5823.         (mode_tile "show_image" 1)
    % q7 Q1 k8 \' s9 a$ S7 L; ^  O2 U' R
  5824.       )
    % v: D! K* V1 ^8 _5 o* ~" K0 q0 E
  5825.     )* {' C$ X" h7 l5 C/ u: M' n, i
  5826.     ;; Linetype Button and Text Field
    ' x( w7 b7 l) {6 W9 h- g" k7 \4 ^/ o
  5827.     (if (/= 4 (logand 4 which_tiles))( ?7 L2 a" Q" b2 {* x( G
  5828.       (progn! l/ h" y7 ]# L
  5829.         (mode_tile "t_ltype" 1)+ v; B7 X) S4 S$ Z9 R( o
  5830.         (mode_tile "b_line" 1)
      i# S0 i: {$ l3 t: N$ _8 C$ {0 }. }
  5831.       ): G/ A; U( J! ]% j9 ~9 F2 Q$ {
  5832.     )
    $ B: x* B7 x  A- \/ Z6 z' Z
  5833.     ;; Linetype Scale Edit Field
    / u; b3 ~/ s, Y4 u
  5834.     (if (/= 8 (logand 8 which_tiles))7 @6 X, y+ V/ j' x# P0 K
  5835.       (progn0 R& P2 o6 b# z; J# P
  5836.         (mode_tile "eb_ltscale" 1)
    " D: S9 V  L4 N+ I* x0 N
  5837.       )
    : u! |3 o0 f) a5 F! i# C7 Y
  5838.     )
    ( B" O. w) A5 r* y+ Q: U
  5839.     ;; Thickness Edit Field.) b- H4 T) D5 d, q( ]' c
  5840.     (if (/= 16 (logand 16 which_tiles))9 e0 m8 J* N" H' d3 x8 c
  5841.       (progn+ M( O' j( Z5 c! |4 s$ {0 C3 E+ W
  5842.         (mode_tile "eb_thickness" 1)
    $ m! ~: g/ c/ W$ \
  5843.       )
    " Q5 v/ }* @) R- x7 o6 F
  5844.     )1 Z" x0 i3 S. K: J2 ~; [5 a7 c$ }
  5845.   )2 t- [6 u% A4 y1 M. D9 _" G( n, q
  5846.   ;;
    ) v' Z$ T! y. ?" J
  5847.   ;; XYZ Point values for all enitites
    0 o- B9 ^; I2 x. z. ?0 J
  5848.   ;;
      _- [$ ]# R' ~4 C5 y
  5849.   (defun set_tile_pt1 (ptype)
    : z5 G9 Y* |/ e( {! f
  5850.     (if (= ptype 0)- T1 G$ {, s8 y' E7 I( B; j2 N
  5851.       (setq pt1 (trans (cdr (assoc 10 elist)) 0 1))! H" m; b0 R5 I- C6 F* ]
  5852.       (setq pt1 (trans (cdr (assoc 10 elist)) ename 1))/ H! ]! o7 f$ X, H7 Z
  5853.     )1 X4 W9 c/ G% {! ^( _5 l6 S
  5854.     (set_tile "x1_pt" (ai_rtos (setq x1 (car pt1))))
    7 c, \! u& w' f4 D- q5 j
  5855.     (set_tile "y1_pt" (ai_rtos (setq y1 (cadr pt1))))
    1 m5 C( c: U5 O$ n  x
  5856.     (set_tile "z1_pt" (ai_rtos (setq z1 (caddr pt1))))- p2 Z& `  O: n. B4 }: |5 K$ H
  5857.   )
    1 |0 ~# z, }  [
  5858.   (defun set_tile_pt2 (ptype)7 ^* _0 B) s8 [) I6 _
  5859.     (if (= ptype 0)
    + s: @2 b& ?% p' p& h. `
  5860.       (setq pt2 (trans (cdr (assoc 11 elist)) 0 1))
    ! m0 D& W1 p7 r
  5861.       (setq pt2 (trans (cdr (assoc 11 elist)) ename 1))) q1 p8 ^8 l) y$ N
  5862.     )0 P( _0 C+ A  M1 m" k
  5863.     (set_tile "x2_pt" (ai_rtos (setq x2 (car pt2))))
    , b8 Q4 E9 \, D/ W/ K7 m  ~. |
  5864.     (set_tile "y2_pt" (ai_rtos (setq y2 (cadr pt2))))* B) A) u: i7 s4 d0 R3 k5 k
  5865.     (set_tile "z2_pt" (ai_rtos (setq z2 (caddr pt2)))). v3 k* J/ R, A1 G% O
  5866.   )
    ( V& n- i1 k" p0 t7 O' W$ d2 ~
  5867.   (defun set_tile_pt3 (ptype)4 D# \  H2 b  ]3 {; W( Q! i- E
  5868.     (if (= ptype 0)& ^% q. ?( c3 `2 d$ C+ A
  5869.       (setq pt3 (trans (cdr (assoc 12 elist)) 0 1))6 N  u6 _' B8 p& N7 }) x" h
  5870.       (setq pt3 (trans (cdr (assoc 12 elist)) ename 1))& t! N7 L' B6 Z" Y7 v
  5871.     ); p8 T, x1 X. E& r  |
  5872.     (set_tile "x3_pt" (ai_rtos (setq x3 (car pt3))))
    , j3 h/ X3 u& j% K
  5873.     (set_tile "y3_pt" (ai_rtos (setq y3 (cadr pt3))))8 s6 k4 h; c) W; J& K( c: T* z- R
  5874.     (set_tile "z3_pt" (ai_rtos (setq z3 (caddr pt3))))) `; W* R7 F3 U. D, S' N
  5875.   ): i0 k& ~& V0 T
  5876.   (defun set_tile_pt4 (ptype)
    . ?8 H5 Z4 ]3 G$ j3 W
  5877.     (if (= ptype 0)6 X/ l; x2 ?0 W' Q
  5878.       (setq pt4 (trans (cdr (assoc 13 elist)) 0 1))% X7 k+ Z, G; I; W
  5879.       (setq pt4 (trans (cdr (assoc 13 elist)) ename 1))
    , i. h0 D8 u" H0 w+ f2 F0 |
  5880.     )
    0 Z0 j+ o$ r# i. U0 W* i: N% E
  5881.     (set_tile "x4_pt" (ai_rtos (setq x4 (car pt4))))
    3 t- W) s" O( A
  5882.     (set_tile "y4_pt" (ai_rtos (setq y4 (cadr pt4))))# v* K6 U$ y7 ?- @; t. z
  5883.     (set_tile "z4_pt" (ai_rtos (setq z4 (caddr pt4))))
    0 C: m- B* e) N( A1 R  A! H" ~
  5884.   )
    ( u$ P& S$ P# O' N* T0 B' _
  5885.   ;;3 X# y' y$ d: z! _: _3 F
  5886.   ;; Xline/Ray. H( _8 a; E; ?# C) g2 D+ M. a
  5887.   ;;
    2 y* }" W5 v2 n2 x# L6 ~0 C! M
  5888.   (defun set_tile_xline_pt1 ()
    6 j! T2 @1 h7 ?1 v; B
  5889. 3 n; n& O3 H0 j( H# ^
  5890.     (setq xline_pt1 (trans (cdr (assoc 10 elist)) 0 1))
    + l- D7 c3 E0 u2 c
  5891. / h( [( G6 z, v- d& z1 B/ }
  5892.     (set_tile "xline_x1" (ai_rtos (setq xline_x1 (car xline_pt1))))
    + m! |' k2 y- Q# Y/ O+ e7 n
  5893.     (set_tile "xline_y1" (ai_rtos (setq xline_y1 (cadr xline_pt1))))
    ( b5 p" R) }) _3 [
  5894.     (set_tile "xline_z1" (ai_rtos (setq xline_z1 (caddr xline_pt1))))
    : j' m- O! P+ }+ z: u
  5895.   )
    / s7 u4 ^' H5 k8 Y0 ~. L" j
  5896.   (defun set_tile_dirv ()
    7 z$ b; r$ K2 }
  5897.         ;; Convert 11 group to local UCS (displacement)
    + }6 f. k' n* g# O
  5898.     (setq dir_pt (trans (cdr (assoc 11 elist)) 0 1 1))
    5 I: k/ R  g0 S0 J; k/ Y3 \
  5899. / ?. W; @' N2 D" F) E9 h# }1 a1 A
  5900.     (set_tile "dir_x" (rtos (setq dir_ptx (car dir_pt))))
    / j0 }5 I2 Z0 d
  5901.     (set_tile "dir_y" (rtos (setq dir_pty (cadr dir_pt))))
    0 f3 V# I! c0 S# s2 z
  5902.     (set_tile "dir_z" (rtos (setq dir_ptz (caddr dir_pt))))' L# N; I( x# J' H) k8 L
  5903.   )7 _5 \! {) e; P  Z( z$ U# @
  5904.   (defun set_tile_xline_pt2 ()
    6 y6 u6 T3 t) `- O. O: f5 a# ]
  5905.     (if (not xline_pt2)
    ! K0 B9 y& D" \. P
  5906.       ;; Initial second point is Root Point + Direction Vector
    + E5 }& @, H$ L. f
  5907.       (setq xline_pt2 (mapcar '+ xline_pt1 dir_pt))
    ( I* w( }" r1 z
  5908.     )9 H6 C& d1 q, G7 R! y
  5909.     (set_tile "xline_x2" (ai_rtos (setq xline_x2 (car xline_pt2)))); ~* U# N' z' i# n. v$ f+ a
  5910.     (set_tile "xline_y2" (ai_rtos (setq xline_y2 (cadr xline_pt2))))( x! `5 q, l& ^$ g! s
  5911.     (set_tile "xline_z2" (ai_rtos (setq xline_z2 (caddr xline_pt2))))  M! x9 ?. T' B
  5912.   )& y* r+ D0 g2 M3 Y/ K* ]* Z
  5913. 5 q  w& w0 M/ B2 ?
  5914.   ;;3 I5 k# d8 U  M# @
  5915.   ;; Handle for all objects
    / q8 E; `' I4 B
  5916.   ;;( _5 ~6 ]/ K, Y. A: Z# W" @
  5917.   (defun set_tile_handle ()
    / J, N3 `4 w) ?: E4 l3 `  f
  5918.     (if (setq hand (cdr (assoc 5 elist)))
    ; X% W$ u- x, ?4 P
  5919.       (set_tile "Handle" hand)( k- i5 H- ^: y8 O1 q
  5920.       (set_tile "Handle" "None"). i: l  H. N5 p0 K! C6 F2 L$ f3 d
  5921.     )
    ' w  e6 S, D+ I. ]
  5922.   )
    9 B6 Q7 J  K8 c5 z/ E- R
  5923.   ;;" ]% r8 r! ^, a& I* d& X
  5924.   ;; Radius for ARC and CIRCLE
    7 B2 o8 o3 Q, }
  5925.   ;;
      k  z9 m( ^) ?) H
  5926.   (defun set_tile_rad ()1 V0 F1 g6 V/ M6 v5 \! m4 I
  5927.     (setq radius (cdr (assoc 40 elist)))
    + Q& U, B# ~5 [# N; x9 w
  5928.     (set_tile "radius" (ai_rtos radius)). Z, X& N9 {" }, }" N: \- w: Y
  5929.   )
    # R! M# Y, ~: f+ o& u
  5930.   ;;8 u2 ?- p- O7 X: T& f1 N
  5931.   ;; Start angle for ARC
    # L8 \2 u) `- ]) B
  5932.   ;;
    ) C0 l; u4 X7 }; O
  5933.   (defun set_tile_stang ()3 d% M+ @# m7 b+ @
  5934.     (setq st_ang (cdr (assoc 50 elist)))+ t. y/ W; U/ M! @" d$ l: p, U0 z
  5935.     (set_tile "st_ang" (ai_angtos st_ang))" d% v2 [; f$ ~( I" j% b
  5936.   )
    1 x; I& \- j8 |; V6 `# o
  5937.   ;;8 l8 U; Q2 Y9 P; `+ Y
  5938.   ;; End angle for ARC% _- A2 }- W) v) q" N. m
  5939.   ;;7 L1 v7 ^! A7 [( r7 u* e
  5940.   (defun set_tile_endang ()
    * v2 @! f1 n- M9 j. W: ]  t
  5941.     (setq end_ang (cdr (assoc 51 elist))): v! Y& p' m4 T1 s% D, u+ _
  5942.     (set_tile "end_ang" (ai_angtos end_ang))5 z% u4 s- u- U4 u. Y
  5943.   )! D" l0 t8 e  c
  5944.   ;;
    * d* Y! J* F" r$ d9 r/ J! j. F
  5945.   ;; Rotation Angle - Text, Attributes, Block insertions and Shapes
    ; u& g$ p1 e% K. x& }
  5946.   ;;
    - x* b4 E2 o! v  F4 ?  d  A+ q
  5947.   (defun set_tile_rot ()' b+ k6 `4 S6 ?6 f# `
  5948.     (setq rot (cdr (assoc 50 elist)))- k8 }6 h, O! z; \' v
  5949.     (set_tile "rot" (ai_angtos rot))
    ( W  h4 z! f2 x% P0 h3 T
  5950.   )
    2 _$ G4 J8 b, z2 o
  5951.   ;;* r' U4 E/ h! M$ ?0 S$ y6 F
  5952.   ;; Height - Text, Attributes and Shapes
    - ]+ t/ C6 Q8 \& I
  5953.   ;;/ s9 K8 k$ k* O9 \5 x7 F5 g
  5954.   (defun set_tile_hght ()
    $ {- s$ R# _* N( q/ t# z
  5955.     (setq hght (cdr (assoc 40 elist)))
    % _; j0 e  \8 }4 P! o: E
  5956.     (set_tile "hght" (ai_rtos hght))
    ' f) |, O+ X6 M8 D
  5957.   )% b7 b- H8 q, i
  5958.   ;;
    : w# h$ b' s5 A
  5959.   ;; Width Factor - Text, Attributes and Shapes
    : j- D0 R/ k- A$ Y
  5960.   ;;
    8 |+ M% F# a  i, b8 d3 g# b9 Y
  5961.   (defun set_tile_wid ()# a7 p1 _& ?7 l
  5962.     (setq wid (cdr (assoc 41 elist)))
    , @8 v6 \0 n: E8 N4 G6 \; w' H- ?
  5963.     (set_tile "wid" (ai_rtos wid))
      i9 b' G' y# |8 B4 g
  5964.   )
    7 K+ K9 r7 \$ K; k0 W: ~& v) Y4 b6 j7 \
  5965.   ;;+ {3 n# Z1 l* D9 I% B
  5966.   ;; Obliquing Angle - Text, Attributes and Shapes% o  o& s$ L9 S  Y( V' D
  5967.   ;;
    & M/ ]1 A& y( w$ x: {
  5968.   (defun set_tile_obl ()4 C4 K$ ]6 ]0 D* J& r  w
  5969.     (setq obl (cdr (assoc 51 elist)))
    4 Y+ R% I5 W- W, J2 W) `2 q1 P
  5970.     (set_tile "obl" (ai_angtos obl))& v3 O/ F' `, T! Y) x
  5971.   )
    8 P# N1 T* p# S% H) _+ B
  5972.   ;;% `7 k1 B+ p9 {3 F1 o+ I
  5973.   ;; Text string
      m; W) z% S1 b! X9 Y& @1 P( u+ R
  5974.   ;;& }2 F, o) O% Q# g2 Q
  5975.   (defun set_tile_text ()# g3 a0 i& `, E& C5 ?9 }( u- ?4 |
  5976.     (setq text (cdr (assoc 1 elist)))+ c+ i7 R* |( q3 ^0 x
  5977.     (set_tile "t_string" text)
    5 z8 m! Q: ?/ M3 {( g7 W' u
  5978.   )
    & i7 ]8 c, Q7 x8 w8 Z/ N- f
  5979.   ;;
    5 k! S2 U1 Q4 S6 h
  5980.   ;; Attribute Tag/ O$ w1 ]! D9 ]3 W
  5981.   ;;
    * W  t" B% u9 i0 \1 [% P6 R* a$ E
  5982.   (defun set_tile_tag ()8 a# |) n/ O. v7 B' d; s
  5983.     (if (= etype "ATTDEF")9 A* y6 R, \" y% w
  5984.       (progn& t. T' Z- |# T3 O( c" b
  5985.         (setq attag (cdr (assoc 2 elist)))
    4 \  U4 {# x+ A$ C6 Z$ w
  5986.         (set_tile "tag" attag)
      M) R' J7 G  G& v9 r; |
  5987.       )
    & F& P# c2 D% q! y% G
  5988.     )3 R+ u/ o6 \) p- y' X: g
  5989.   )
      l4 [4 w+ y& A7 r
  5990.   ;;1 c+ a/ N; O0 [4 U3 h+ C1 k" G, d
  5991.   ;; Attribute Definition& C" o+ @; o* }9 M
  5992.   ;;8 F7 m2 b" P/ d
  5993.   (defun set_tile_prompt ()" G# W; h2 y: n3 q/ L  F
  5994.     (if (= etype "ATTDEF")
    & O' T2 `* n3 t. k3 {6 I0 s) f
  5995.       (progn
    9 ?5 I9 f. O/ }7 v% {+ G' j! s
  5996.         (setq atprompt (cdr (assoc 3 elist)))
    0 d7 V) }0 k9 C( y/ {
  5997.         (set_tile "prompt" atprompt)( I* I8 A4 J* S) x8 M, s$ Y* v% Z
  5998.       )
    5 {" ~$ l3 O2 X" U& C
  5999.     )
    0 h$ B( ]# ?6 j2 V
  6000.   )# \8 X; j6 n+ u- k7 n- i5 i+ ]) q# y
  6001.   ;;4 c- A9 A- U* T$ Q7 y8 C: I0 @# ]7 a
  6002.   ;; Justification setting for Attributes and Text.  Initializes. h2 `& a; i: N5 r' X3 b+ E9 h
  6003.   ;; popup list box! b$ R& i, o: t, Y, Y& P# ~  Z: z
  6004.   ;;
    0 z; U8 p: {+ `$ M
  6005.   (defun set_tile_just ()
    7 q5 y$ h! i4 l5 I, d
  6006.     (setq ha (cdr (assoc 72 elist)))  ; horizontal alignment4 V6 [! H" v" h- q2 I
  6007.     (setq va (cdr (assoc 73 elist)))  ; vertical alignment3 p9 n) a% f- }$ _+ B1 V
  6008.     (setq ha-prev ha)
    / S& `2 s* o0 f- T3 `' Y
  6009.     (if (= etype "ATTDEF")8 p4 T7 `0 a6 o9 j1 [& \- A
  6010.         (setq va (cdr (assoc 74 elist)))  ; vertical alignment( H) U- p2 H( X
  6011.     )9 j3 s( r( A1 \1 d$ ], Q
  6012.     (setq jlist
    9 ^4 l1 a1 U7 ?1 _! T7 C3 x
  6013.           (list "Left"        "Center"        "Right"
    - k, }! U! X  c& i7 [+ ?
  6014.                 "Aligned"     "Middle"        "Fit"
    , `! J$ C, q% A1 i
  6015.                 "Top left"    "Top center"    "Top right"* A6 C" N9 _9 z. V5 o' p! S/ _
  6016.                 "Middle left" "Middle center" "Middle right"
    - U+ @" Q2 t/ |& X+ y+ N: C
  6017.                 "Bottom left" "Bottom center" "Bottom right"& q3 i, G* i* k; Z2 V9 L1 e/ h
  6018.           )
    ( S* _. t' |7 i2 |) h
  6019.     )* R4 {, H1 h! M' ~" w
  6020.     (start_list "popup_just")0 C; C, v  c; ?9 U3 ^" J
  6021.     (mapcar 'add_list jlist)! o, u# b8 V" L4 T' ?1 q
  6022.     (end_list)' x% c" y. d8 b- f& S2 j7 r- u3 c
  6023.     (set_just_idx)
    $ X. Y9 n4 A0 K2 z
  6024.     (set_tile "popup_just" (jlist_act just-idx))1 f7 R) o5 Y3 q& t1 t; e- I
  6025.   )
    6 j3 r. O" q# `+ \8 W7 c
  6026.   ;;% C( V6 `% B9 M- x) Q! b
  6027.   ;; Style setting for Attributes and Text.  Reads symbol table for popup list
    ( I6 ~6 q" H1 D4 v! |+ m6 _
  6028.   ;; box.# E( X6 B1 _7 r1 j2 v
  6029.   ;;+ v8 L1 E) T$ E* X4 F0 a! B  T
  6030.   (defun set_tile_style (/ sname style-idx tlist)
    # O  f) X% `% H0 M" \2 L: p5 }/ D
  6031.     (setq tlist (tblnext "STYLE" T)/ c; F; K8 C' m
  6032.           slist nil)
    ) q4 x; u1 Y2 u$ U$ ?
  6033.     (while tlist8 c& k& @$ s+ I' R# ~3 L# \! U
  6034.       (setq sname (cdr (assoc 2 tlist)))
    . a2 G* n; \% g
  6035.       (if (and (/= sname "")2 ?  Z1 `7 s% v5 C7 B, [5 C  h
  6036.                (/= (logand 16 (cdr (assoc 70 tlist))) 16))
    " X0 b5 f/ O8 P9 i: @! V8 ^, Q
  6037.           (setq slist (cons sname slist)))8 x/ \) g$ p8 B. F  `  n
  6038.       (setq tlist (tblnext "STYLE")))
    5 |% K! x+ l( d" E
  6039.     (if (>= (getvar "maxsort") (length slist))- c1 w/ G/ i( [- h
  6040.         (setq slist (acad_strlsort slist)) ; alphabetize style list. w4 k6 h/ Q- H' H
  6041.       (setq slist (reverse slist)))     ; or reverse it to put it in DB order3 m) P6 \5 ]8 `

  6042. " j- X* b3 @( @, y  J; R  p
  6043.     (start_list "style")
    ! z' C$ S* Y1 j( J' `% V8 c& d
  6044.     (mapcar 'add_list slist)
    : {7 D" ^- C7 P* Z7 W( A; l4 C( b
  6045.     (end_list)
    ) T/ S9 `3 Y/ p$ p1 n; q/ H
  6046.     (setq tstyle (cdr (assoc 7 elist)))
    4 m! p0 ]' m5 k) F* v
  6047.     (setq style-idx (getindex tstyle slist))
    , Q, |% o9 d0 j6 e" U# C$ w$ O6 Z
  6048.     (set_tile "style" (itoa style-idx))$ N" H; j2 m9 j& U
  6049.   )
      d" m4 ^6 N! M# N
  6050.   ;;
    " @( H5 O" f8 w3 R/ }
  6051.   ;; Text and Attribute setting - upside-down, backwards, K" Z- G- ^  X4 |/ r% r2 z
  6052.   ;;* Q3 R5 `$ q4 \& n
  6053.   (defun set_tile_bk-up ()
    ) Z; J1 N5 ~; H  l2 ^# b
  6054.     (setq bk-up (cdr (assoc 71 elist)))0 K' Y/ C9 G" S$ [9 D
  6055.     (if (= (logand bk-up 2) 2)% C, j: n  T; @
  6056.       (set_tile "bkwd" (itoa (setq bkwd 1))): ~& x; k: f$ m) Y' K0 |
  6057.       (set_tile "bkwd" (itoa (setq bkwd 0)))
    ; K. D2 V: v7 k$ ?) I, F
  6058.     )
    7 E4 _' A& L/ h) S
  6059.     (if (= (logand bk-up 4) 4)
    0 P. D3 m9 _, o+ _7 y8 q  S( ^
  6060.       (set_tile "upsd" (itoa (setq upsd 1)))
    0 Z; K( I' v) T2 O3 T
  6061.       (set_tile "upsd" (itoa (setq upsd 0)))
    5 w6 z% K5 v) s* M
  6062.     )
    1 g7 t2 x" k/ p! o% M1 x
  6063.   )9 D$ `. c) `: G7 u6 A$ r% S' j
  6064.   ;;% `) |  }4 l2 _/ ?/ |+ G$ |
  6065.   ;; Attribute setting - invisible, constant, verify, preset) w& z% M) O4 `+ Q: y9 O
  6066.   ;;
    / c/ C. f: H: l! I% U5 V( g
  6067.   (defun set_tile_icvp ()
      O; `8 T/ n) D! _& s! K. J* u
  6068.     (if (not (setq icvp (cdr (assoc 70 elist)))): g/ G( X: O8 Y4 ]4 G
  6069.       (setq icvp 0)
    ! W6 C5 ]% A  v+ I& {
  6070.     )
    0 {- x) h+ y; q. {! d
  6071.     (if (= (logand icvp 1) 1). P4 v) L. h3 d" L
  6072.       (set_tile "inv" (itoa (setq inv 1)))) K( {5 k/ |; K- e
  6073.       (set_tile "inv" (itoa (setq inv 0)))
    * l& u) U, u/ ~4 W  Z/ V
  6074.     )
    2 {6 I) t( C/ }
  6075.     (if (= (logand icvp 2) 2)
    $ n0 N/ J1 |+ p; G7 q6 F) j$ X
  6076.       (set_tile "con" (itoa (setq con 1)))  ~- |) ?! {* e" F9 `
  6077.       (set_tile "con" (itoa (setq con 0)))% E8 l0 K9 g4 [
  6078.     )
    4 T. I/ G* X4 Q6 U
  6079.     (if (= (logand icvp 4) 4)
    - ]+ q" E- ~7 S  n9 f$ Y
  6080.       (set_tile "ver" (itoa (setq vfy 1)))
    # ]1 i2 t# [+ a4 R( H
  6081.       (set_tile "ver" (itoa (setq vfy 0)))& L9 {! T4 G5 ^7 _" r: _8 U
  6082.     ); _! j- Q1 E* o  O; i
  6083.     (if (= (logand icvp 8) 8)
    % d3 `, d5 o3 w5 ^, r7 D  u
  6084.       (set_tile "pre" (itoa (setq pre 1)))7 V9 g. N9 ]- ~: x% E" _2 l/ Q0 g
  6085.       (set_tile "pre" (itoa (setq pre 0)))" J* _9 ]" I% N2 P( B. s3 S8 }
  6086.     )1 t9 A+ J+ j0 W& \
  6087.   )
    4 e: E6 `9 v8 j2 m9 x! R9 L
  6088.   ;;
    ) x3 S/ K0 Q; ^. ?
  6089.   ;; Scale factors for block insertions
    * \" O2 ^3 D) a8 V5 {7 N  s
  6090.   ;;
    - M  X1 h& m: B: J3 [% C
  6091.   (defun set_tile_scale (/ temp)) e0 t4 H% M; u/ I4 U$ J1 W! H
  6092.     (setq temp (getvar "LUNITS"))
    % a9 Q9 U" J" b$ j8 f
  6093.     (setvar "LUNITS" 2)
    5 S) K0 ]# M3 L, d! C/ b* T
  6094.     (setq xscale (cdr (assoc 41 elist))), @" [2 m: q% N0 Z; P8 K9 Q6 Z
  6095.     (set_tile "xscale" (ai_rtos xscale))) p0 q) a2 B3 ?' F! f
  6096.     (setq yscale (cdr (assoc 42 elist)))
    6 d% ]2 o) T) _4 G
  6097.     (set_tile "yscale" (ai_rtos yscale))1 [, o/ c6 [, \) [- g, g2 `5 G3 E
  6098.     (setq zscale (cdr (assoc 43 elist)))0 q1 ^  c: t$ Z
  6099.     (set_tile "zscale" (ai_rtos zscale))2 g0 N( ]3 H/ l  c0 ~2 `. O
  6100.     (setvar "LUNITS" temp)6 r* w  L* ~; p: m# a" K
  6101.   )$ E5 l! y9 }2 ?% F6 X
  6102.   ;;
    + N: r! \8 {5 w* ?, R3 u2 F: q
  6103.   ;; Rows and columns for block insertions
    7 f6 q& R9 T7 W& ?. m
  6104.   ;;0 _  ^. j, R: v+ A" h6 u) }3 r
  6105.   (defun set_tile_rc ()$ J7 J0 [% b: ~* x" C0 G8 R- p
  6106.     (setq columns (cdr (assoc 70 elist)))
    . }$ R( u9 ?4 {5 N( C$ b* I
  6107.     (set_tile "columns" (itoa columns ))
    4 U6 @% R; G5 p" v' y
  6108.     (setq rows (cdr (assoc 71 elist)))' J4 a& j, X  ^3 f
  6109.     (set_tile "rows" (itoa rows))
    - s3 m! e) t8 m4 I
  6110.     (setq col-sp (cdr (assoc 44 elist)))3 g, [' d: A3 Q3 _5 Z' s$ k
  6111.     (set_tile "col_sp" (ai_rtos col-sp))0 P+ Z- `8 q& Q% y: J
  6112.     (setq row-sp (cdr (assoc 45 elist)))- [$ H& y$ \5 d' D
  6113.     (set_tile "row_sp" (ai_rtos row-sp))
    7 @0 y! Y0 \+ p" u# E6 q6 g
  6114.         (if (/= hasclip T)# H2 v$ C5 k9 s& W4 V* c- d9 b
  6115.                 (mode_tile "xcliponoff" 1)
    4 e( f# q3 c7 F) W
  6116.                 (set_tile "xcliponoff" (itoa xcliponoff))
    ( t3 s8 Y/ Y; n! Q0 l, o, A
  6117.         )* ^+ R& I7 i2 z' ?' H# K: [$ L
  6118.   )
    2 a/ h% f2 I7 U. H5 |* q
  6119.   ;;) q: I9 I0 K) X) k/ ]
  6120.   ;; Invisible edges for 3DFACE/ G# ?9 i( _% _$ r3 J9 T- ]6 R$ n/ T
  6121.   ;;" C7 L, B. O0 F+ z: }7 c- M* K7 P, f' x
  6122.   (defun set_tile_edges ()9 ^, e  @2 K- n5 e2 E% k* K
  6123.     (setq f-vis (cdr (assoc 70 elist)))( x1 n* I- H. w% S- h! M0 |
  6124.     (if (= (logand f-vis 1) 1)$ S, X3 \0 K; w# Z
  6125.       (set_tile "edge_1" (setq edge1 "0"))9 z. `% B+ ^6 i! w8 ]3 ^0 z; c
  6126.       (set_tile "edge_1" (setq edge1 "1"))
    1 e& D0 {( G  q& z$ m
  6127.     )
    % f+ M0 u/ F  |; |8 E
  6128.     (if (= (logand f-vis 2) 2)- ^9 T+ V, `3 Q% h2 \
  6129.       (set_tile "edge_2" (setq edge2 "0"))  ^3 ]& t+ I- i
  6130.       (set_tile "edge_2" (setq edge2 "1"))
    3 N+ e7 `$ G, r6 @9 z2 m4 A5 }
  6131.     )
    6 C. \/ K7 M% C! ~1 e6 O0 f+ |& h( q
  6132.     (if (= (logand f-vis 4) 4)
    , R4 |! s, D1 }' H1 B9 d2 e
  6133.       (set_tile "edge_3" (setq edge3 "0"))
    . s: F6 z- ?/ k. ~5 L
  6134.       (set_tile "edge_3" (setq edge3 "1"))& g6 g  F+ c- U4 j: R. b
  6135.     ); m% e8 [: y5 a- s8 ]4 f+ r+ M
  6136.     (if (= (logand f-vis 8) 8)* x5 N3 |; [- y( H7 p6 O
  6137.       (set_tile "edge_4" (setq edge4 "0"))
    + N+ [1 n% [; O1 J* H6 `  Y
  6138.       (set_tile "edge_4" (setq edge4 "1"))
    9 k& Q8 w+ n6 f$ u1 V) a
  6139.     )5 a5 J. ~. Z2 }3 G' \7 _4 I! h
  6140.   )3 J& k6 O# N5 _  }; K$ _
  6141.   ;;7 s( c+ w8 D6 g  A8 }1 A- E7 t( b) y. j% G
  6142.   ;; XYZ Point values for polyline vertex* L, f# \- t# [' S
  6143.   ;;
    : w8 u5 x. @, |0 C# j( E3 D; B
  6144.   (defun set_tile_vpt (ptype)
    % ^3 U+ G% J% m9 h" B0 \  N
  6145.     (if (= (cdr (assoc 0 vlist)) "LWPOLYLINE")
    ) k; F1 t2 I# f0 _
  6146.         (progn/ ^# _' `2 V3 O
  6147.             ;; ctr is 1 based, vertices are zero based.
    ( c$ U* a! i6 R: ?3 U
  6148.             (setq vpt (cdr (getLwVert (- ctr 1))))2 \2 r- O7 p: C0 U: D: |
  6149.             (set_tile "xtext" (rtos (setq x1 (car vpt))))
    5 M- N9 X) }- W9 P7 E$ }& ^
  6150.             (set_tile "ytext" (rtos (setq y1 (cadr vpt))))
    4 y! a( l8 S  K7 _$ N: ^4 b5 W
  6151.             (set_tile "ztext" (rtos (setq z1 (caddr vpt))))& Z8 {4 O2 N& i' |* E* x0 l
  6152.         )
    2 z+ A9 X1 f1 a! f+ F
  6153.         (progn4 ?1 ?2 g: W7 J
  6154.             (if (= ptype 0)& a( O$ x1 X* \' m
  6155.                 (setq vpt (trans (cdr (assoc 10 vlist)) 0 1))0 ]  n8 A; i% Q* e
  6156.                 (setq vpt (trans (cdr (assoc 10 vlist)) ename 1))
    % k8 V, D4 u, x' g0 t
  6157.             )) A/ C& F# Z, J( ~1 h
  6158. ! p9 J; J0 \; W2 k
  6159.             (set_tile "xtext" (rtos (setq x1 (car vpt))))3 h0 D; d: Y" I9 h! {
  6160.             (set_tile "ytext" (rtos (setq y1 (cadr vpt))))
    2 g9 j: Y% b4 e) {
  6161.             (set_tile "ztext" (rtos (setq z1 (caddr vpt))))4 k. }# Z/ B! M9 B! p5 b3 f0 O
  6162.         )( @. ^, X% g! ?
  6163.     )8 s  C, z6 ^- i, v& v' A
  6164. 1 b, }" x3 d% e1 J9 G
  6165.   )8 S& L' m: |& j0 ]0 J, W
  6166.   ;; This is the equivalent to doing an entnext on the heavy weight
    " _) D& i9 E6 v
  6167.   ;; polylines. The hard coded '4' below allow stepping over the0 g4 `3 Y5 _! i: u, d+ ^1 d& A
  6168.   ;; 40 41 and 42 group code information. The while loop finds the
    - F# B( V% g+ h
  6169.   ;; first vertex which will be used as the starting assoc in the- s2 o1 ~0 t6 r1 T
  6170.   ;; call to nth.
    3 F5 H- y  g8 s$ i( {* |
  6171.   ;;$ V- x' ?& D& V) D" H/ j% x7 g: D  ], @
  6172.   (defun getLwVert (tmpctr / count tmp)
    7 R, a" e# K2 j
  6173.     (setq count 0)
    3 S8 B; A: b4 k3 d
  6174.     (while (/= (car (nth count vlist)) 10)
    - J  [$ [: R- b( ~% O
  6175.         (setq count (+ count 1))
    * f% b! n, ]0 ?
  6176.     )% M+ H; t! }* i* f, G
  6177.     ;; If the counter reaches the number of vertices,
    ' {/ j* F$ v$ B- _4 f
  6178.     ;; reset ctr and tmpctr to zero again.
    0 A3 E$ x/ g8 V5 D: G
  6179.     (if (= tmpctr (cdr (assoc 90 vlist)))* O" ?4 ?- X$ b9 q4 [
  6180.         (progn
    0 R, P3 z! r, u* P
  6181.         (setq ctr 0)
    / x# z: y$ j4 ^. Z' \; g
  6182.         (setq tmpctr 0)
    ( L. U% M) z" _- e: S: v1 p
  6183.         )
    % r" R7 y  F# B# d5 F3 m7 z7 N
  6184.     )
    9 Y* x3 L. ^& F  m5 s. ?
  6185.     (setq tmp (nth (+ count (* tmpctr 4)) vlist))
    ; B' e1 f: w4 |9 _6 K8 ^# V8 A
  6186.     (setq tmp (append tmp (list(cdr (assoc 38 vlist)))))
    # M* \7 [' z1 G# U! A$ W2 a
  6187.     (setq pt1 (trans (cdr tmp) (cdr (assoc -1 vlist)) 1))! ?6 ^  B% i+ e- c. l0 x
  6188.     (setq tmp (cons 10 pt1))
    - _& {3 Z9 g* g4 k+ S4 J
  6189.     (setq tmp tmp)
    1 y/ m; X5 w/ B$ W+ t
  6190.   )
    9 {& M4 l* h- Y7 c; K- J
  6191.   ;;
      e% T2 ?  _1 y: [4 U/ O4 U
  6192.   ;; Set tiles for Spline properties. If the spline is rational then we
    8 _0 ]7 [" J2 \- ?1 z
  6193.   ;; need to display the weight values of the control points, so set! I# ^( v( E: T5 h1 L+ ?& u2 s
  6194.   ;; flag to 1.
    & k  a& l. r; h7 j3 T; t8 M
  6195.   ;; 1 = rational spline
    $ q$ A+ W2 X. P+ a( k
  6196.   ;; 0 = non-rational spline
    9 k( J& A; B  i) T. F2 C# a/ i
  6197.   ;;
    / N: G! D8 k7 h' K
  6198.   (defun set_tile_spline_props ()+ z& G6 G. o- J% M
  6199.     (setq rational_spl_flag 0)      ;; initialize rational spline flag
    ' @' J  z! c5 W; X  k2 B* B$ Y
  6200.     (set_tile "Degree" (itoa (cdr (assoc 71 elist))))( A# U9 F* `6 p
  6201.     (setq bit70 (cdr (assoc 70 elist)))7 k5 V$ D' J( l
  6202.     (if (= (logand bit70 1) 1)
    & v7 ?+ V5 f# @, R( F. l: \
  6203.         (set_tile "SpProp4" "Closed")$ [! ^- D3 @/ |6 p+ c! g
  6204.         (set_tile "SpProp4" "      ")
    / y/ e( `( A  @, C' u* N
  6205.     )
    4 N) `5 U6 J- w) `. r
  6206.     (if (= (logand bit70 2) 2)- u( F% t  p" y2 N1 y6 W2 p8 Y
  6207.         (set_tile "SpProp3" "Periodic")/ L% A* }1 m5 D
  6208.         (set_tile "SpProp3" "Non-Periodic")6 q) Y5 f/ z$ v  W
  6209.     )/ ~. z) Z- p, `! V( j* T' d
  6210.     (if (= (logand bit70 4) 4)
    ( F( u$ p1 J% B( a/ p& u3 B* ^
  6211.       (progn0 z' ^& I  j+ y8 ~' X8 `
  6212.         (set_tile "SpProp2" "Rational")
    ' A* V7 ]! y0 q7 T1 C
  6213.         (setq rational_spl_flag 1)      ;; this is a rational spline  b1 |& f6 B3 f8 A* R
  6214.       )$ v4 P  E7 v- c$ `+ l6 H: M+ B
  6215.         (set_tile "SpProp2" "Non-Rational")& S2 \( ]  Q& K) g) @
  6216.     )
    " |: a3 _/ r$ N5 D; G8 T) J6 ^2 z7 L! M
  6217.     (if (= (logand bit70 8) 8)0 d; G5 K# Q5 n
  6218.         (set_tile "SpProp1" "Planar")/ C. p5 n2 V2 y) _! t  p
  6219.         (set_tile "SpProp1" "Non-Planar")
    . d) h* g; m* \5 q1 o8 y  h
  6220.     )
    0 j2 ~$ y) S# l1 ]2 g. U5 N) S, g
  6221.     (if (= (logand bit70 16) 16)9 D8 A! _0 }: [, B5 V+ p; \
  6222.         (set_tile "SpProp5" "Linear")6 S) l. f2 D# H/ W- z! z
  6223.         (set_tile "SpProp5" "      ")
    7 [( N% B0 x4 F1 J8 v, ]' K
  6224.     )
    7 B  ?! q3 H$ p/ X2 k
  6225.   )
    " R! \; z" D6 ^4 w" t" v
  6226.   ;;) |8 ~3 `6 `1 T; i+ D
  6227.   ;; XYZ Point values for spline points
    - Z' Y! _: m9 d+ b5 Y( X
  6228.   ;; Need to account for WCS/UCS
    / T! \  Z% j* H5 N/ M3 S) d! y# V) _& u
  6229.   ;;- T. ^. S) H4 z0 `( k- l" x
  6230.   (defun set_tile_cntl_pt ()9 S; h' h. F5 V' h: I
  6231.     (setq cntl-pt (cdr (assoc 10  elist)))
    * g: F/ ?3 u" V2 m- I
  6232.     (set_tile "xtext" (rtos (setq x1 (car cntl-pt))))2 F/ u+ x3 Z" y& Z5 f
  6233.     (set_tile "ytext" (rtos (setq y1 (cadr cntl-pt))))2 E9 e2 H  r% O, D' U# h+ a  ^& d
  6234.     (set_tile "ztext" (rtos (setq z1 (caddr cntl-pt))))/ G& z# z4 _; N2 `# c
  6235.     (if (= rational_spl_flag 1)      ;; if rational spline6 L7 U7 h5 r5 w( a
  6236.       (progn                         ;; show weight
    ! q4 o) `* b' I9 e1 g
  6237.         (setq weight (cdr (assoc 41 elist)))) ^3 D) f7 O- K; d
  6238.         (set_tile "weight" (rtos weight))% V' j3 H- f& V( B  R  i& y2 z
  6239.       )                              ;; else* n8 Y+ R' Q, Y0 c7 t( ~
  6240.         (mode_tile "weight_text" 1)  ;; disable weight field4 H. ]! R2 _: T1 y$ E$ K
  6241.     ); q7 Z  k7 `+ f% ?- l" G2 I4 S( `- g
  6242.   )+ @" d" c7 M* x
  6243.   ;;, |" [4 I2 u7 z" C" r
  6244.   ;; XYZ Point values for spline points
    - a3 N8 J7 E  S* Z/ ]; ^( `9 E
  6245.   ;; Need to account for WCS/UCS
    ; s( g; I$ @3 @7 s
  6246.   ;;
    ' F& A4 I7 e  {  Q& H* E
  6247.   (defun set_tile_data_pt ()
    + d! I" @+ C2 {, h- Q3 j
  6248.     (if (not (assoc 11 elist))* Q1 @) o. C+ [
  6249.       (mode_tile "data_pts" 1)  x# N% N+ P. i4 L: X. {* H2 z
  6250.       (progn
    6 U0 }6 N: S, p9 A
  6251.          (setq data-pt (cdr (assoc 11  elist)))4 d8 _' P  M$ T! Q$ l: C
  6252.          ;; display points with current precision.
    / I7 b2 K7 m# c- C5 Q8 b
  6253.          (set_tile "dxtext" (rtos (setq x1 (car data-pt))))% {' U3 S+ r8 G6 }
  6254.          (set_tile "dytext" (rtos (setq y1 (cadr data-pt))))
    4 ]+ J& K3 \8 f" W
  6255.          (set_tile "dztext" (rtos (setq z1 (caddr data-pt))))
    6 ?  O$ N: X1 u: H0 _8 ?
  6256.       )6 }4 _1 C( S: x0 ]+ h
  6257.     )" c4 o3 P- K* w( Z' p& v$ _2 X
  6258.   )% t0 _* B' {/ X+ r# q
  6259.   ;;# S, \  S8 G' E2 p1 A
  6260.   ;; Fit curve, fit spline, or smooth spline surface setting
    ' W- _$ t# _' {
  6261.   ;;& [* Y1 Y. C2 \: n+ q6 B' G' C
  6262.   (defun set_tile_fitsmooth ()9 H/ N' D& A" h" T3 b- i
  6263.     (cond
    * W; T( f8 B( f
  6264.       ((= (cdr (assoc 0 elist)) "LWPOLYLINE")
    ( q, T$ q) \" A( [
  6265.         (set_tile "none" "1")
    & V) B; L. Z1 n' \
  6266.       )( j: b1 M! s& v
  6267.       ((= (logand bit70 4) 4)* I0 U  X. ~" D' i2 W, h+ O3 \
  6268.        (cond( u  L  u7 x6 n, N( l* H
  6269.          ((= bit75 0): }8 R" h0 Z/ Q3 A
  6270.            (set_tile "none" "1")4 y% j9 u5 h! i0 }( R' |
  6271.            (setq spltype 0)
    ' p4 ]0 A* C0 _* r
  6272.          )9 y" [% ]- i2 S
  6273.          ((= bit75 5)
    1 j( P! {4 r* y0 |; \
  6274.            (set_tile "quad" "1"): ~  x, v% b  ?5 _4 f
  6275.            (setq spltype 5)
    $ `( N9 J$ ]. u$ j
  6276.          )
    5 D3 s  Z# Q* E0 g
  6277.          ((= bit75 6): g8 r+ M: w5 x" D
  6278.            (set_tile "cubic" "1")& G, y& e9 @& k* ?2 k
  6279.            (setq spltype 6)
    / v  F7 {# K4 d# t
  6280.          ), U) g! r( y1 ]5 m4 \, j8 }
  6281.          ((= bit75 8)* |4 v+ X' f: {- ?2 C
  6282.            (set_tile "bezier" "1")
    $ e: \2 T: I9 A6 G; N, U4 |
  6283.            (setq spltype 8), R7 H% z/ W4 A$ z; F- V% U3 s
  6284.          )7 U3 s" \, u; @6 G* x7 U
  6285.        )
    % G1 g$ A2 L$ ^- i
  6286.       )+ z% [) G6 o6 R4 K( G
  6287.       ((= (logand bit70 2) 2)
    % I; ]; U1 ]" s( u
  6288.         (set_tile "fit" "1")
    * ]3 Z) S" b  e# C
  6289.         (setq spltype 1)( j5 b3 ~* b& _# P$ ]. K) ~. S
  6290.       )
    0 e0 H& v: i' q; t$ Z2 Z% u5 v) _5 X
  6291.       (T (set_tile "none" "1"))4 k, a8 y8 {5 }
  6292.     )* \8 n  P: C+ ^/ l2 A+ Z/ \
  6293.   )5 @" u2 ^+ h3 r& Z- ^
  6294.   ;;
    $ }' M& U3 k" ?4 l) B9 c7 G4 V
  6295.   ;; Closed or Open mesh and polyline setting
    % I9 f& {& O9 _" N" I; P# y3 o+ y  w
  6296.   ;;: K' m8 x. X% d2 a- y
  6297.   (defun set_tile_closed ()
    4 R3 f3 o; W3 M- L- ?" J
  6298.       (if (= pltype "3D mesh")
    0 P7 ^) l, b* D5 `3 y
  6299.         (progn
    / B" |, S. i! S6 W5 R1 K1 Z1 K* n7 x
  6300.           (if (= (logand bit70 32) 32)
    ' k7 _: H  Q* x0 \* ^
  6301.             (set_tile "closedn" (setq closedn "1"))
    % L6 Z5 ]) W$ B; w( H
  6302.             (set_tile "closedn" (setq closedn "0"))9 }9 @8 k$ m. \! g- t, m& P
  6303.           )
    + D: ~$ K! {3 i4 H+ H& {2 ?! v
  6304.           (if (= (logand bit70 1) 1)
    ' Q. O" Y; X- s" c& U8 Q
  6305.             (set_tile "closedm" (setq closed "1"))
    , l# r9 h  ?" O+ L! ~- ^, o8 d& ^
  6306.             (set_tile "closedm" (setq closed "0"))
    ! A! d- n# n/ ]0 w# h# ^
  6307.           )1 z& D8 f4 w! q6 L6 C! Z
  6308.           (setq old-closedm closedm old-closedn closedn)
      y3 \- I# B! `& Q7 D+ R$ u
  6309.         )# Y2 Z) {$ i9 r6 M0 x& n! ^& X% b
  6310.       )
    6 W* [# T! W7 l* |) n/ X) Z# H! C- D# x
  6311.       (if (or (= pltype "2D polyline")
    7 ^1 F! ]: x4 T, s( G4 s8 R
  6312.               (= pltype "3D polyline")
    + ], N4 @9 S  X( K
  6313.           ); N/ p- K% Y' v% j! f+ m, u0 Y7 u
  6314.         (progn+ x' \1 W( n6 ]% B2 a9 U- }5 c7 w$ g
  6315.           (if (= (logand bit70 1) 1)
    9 ~" o% Q5 H! b$ Y
  6316.             (set_tile "closed" (setq closed "1")): z- a& h7 \, Z3 M; g+ d
  6317.             (set_tile "closed" (setq closed "0"))
    3 ^" |# r9 O; r/ {' h/ `
  6318.           )# k" \$ h3 n, Y( |' ?* \7 p5 [
  6319.           (setq old-closed closed)
    , j, f# ]* }/ e1 E9 x) }# ^9 Z/ `( s
  6320.         ), l" s6 @. X& b
  6321.       )2 U: V& U; H2 D# m0 r3 H% V
  6322.   ): U0 t( p9 x& f& ]' x8 g
  6323.   ;; Set common action tiles
    % u) z- m5 P  T) H
  6324.   ;;3 {+ E7 U4 r. `7 t$ U9 r
  6325.   ;; Defines action to be taken when pressing various widgets.  It is called
    ; {' [0 [' j. V) s' T
  6326.   ;; for every object dialogue.  Not all widgets exist for each object dialogue,
    4 Z- k) b/ m' ^( Q- d  u- ]7 V/ c
  6327.   ;; but defining an action for a non-existent widget does no harm.
    ' g; e; Q  W: g; I/ }
  6328.   (defun set_action_tiles ()2 S; l. Z! f6 p6 ~# S% V, [# s
  6329.     (action_tile "cancel"       "(dismiss_dialog 0)")
    " ]& ]7 `- m- c. @3 n
  6330.     (action_tile "accept"       "(dismiss_dialog 1)")+ }6 b% _$ O: y( p! X
  6331.     (action_tile "help"         "(help \"\" help_entry)"): o4 K/ e0 V2 A  e
  6332.     (action_tile "b_color"      "(getcolor)")7 h0 c5 U1 m; m! Z
  6333.     (action_tile "show_image"   "(getcolor)")
    $ D/ G' W( ?9 z
  6334.     (action_tile "b_name"       "(setq elayer (getlayer))")! c5 c" }; {4 ?
  6335.     (action_tile "b_line"       "(setq eltype (getltype))"), r; |# V7 k" h
  6336.     (action_tile "eb_thickness" "(getthickness $value)"); k& G$ W9 L4 W0 S1 K; {3 s
  6337.     (action_tile "eb_ltscale"   "(getltscale $value)")4 z' t1 \5 f( U0 L" @

  6338. * ?+ f6 |3 f4 h" f
  6339.     (action_tile "pick_1"       "(dismiss_dialog 3)")  h* S$ |4 C, q9 l8 `% @
  6340.     (action_tile "pick_2"       "(dismiss_dialog 4)")
    2 k& P: ?. R0 z. Y! N' k. V
  6341.     (action_tile "pick_3"       "(dismiss_dialog 5)")
    * e% d/ E+ w- P  R
  6342.     (action_tile "pick_4"       "(dismiss_dialog 6)"): J  e1 @/ X, r
  6343.     (action_tile "x1_pt"        "(ver_x1 $value)")/ x& R* a; d( u2 H( I; [" I! ~( ~2 ^8 Q! V
  6344.     (action_tile "y1_pt"        "(ver_y1 $value)")
    9 ~$ P) @6 d( v8 w. [
  6345.     (action_tile "z1_pt"        "(ver_z1 $value)")
    3 s2 O9 F6 M2 a& u
  6346.     (action_tile "x2_pt"        "(ver_x2 $value)")
    9 r- o: Z. p8 ^# \: L) x
  6347.     (action_tile "y2_pt"        "(ver_y2 $value)")
    7 d! x2 ]# v7 `; |
  6348.     (action_tile "z2_pt"        "(ver_z2 $value)")
    & d7 M3 R: n- k+ U. k; U7 V
  6349.     (action_tile "x3_pt"        "(ver_x3 $value)")
    " `) T3 @+ P' I3 l; P: I
  6350.     (action_tile "y3_pt"        "(ver_y3 $value)")3 B1 i( R0 w$ F: B/ V
  6351.     (action_tile "z3_pt"        "(ver_z3 $value)")1 A7 G2 i/ H& m4 v
  6352.     (action_tile "x4_pt"        "(ver_x4 $value)")
    , [# t2 Y; J2 G9 S% P6 d
  6353.     (action_tile "y4_pt"        "(ver_y4 $value)")
    & N7 C5 Y* X6 u+ [/ t
  6354.     (action_tile "z4_pt"        "(ver_4 $value)")$ _/ ~+ ~, e3 B# q( n7 q& x% z
  6355. 0 K: g/ P) e. F3 o+ F+ \8 ]3 ?
  6356.     ;; Action tiles for Xline & Ray) x5 j* @1 [" q' ?- n. ?  D5 a
  6357.     (action_tile "xline_x1" "(ver_xline_x1 $value)")3 C% _& H9 Y; a
  6358.     (action_tile "xline_y1" "(ver_xline_y1 $value)")
    5 W, e- ]) g$ Q
  6359.     (action_tile "xline_z1" "(ver_xline_z1 $value)")
    $ o% g: a. u, m- b0 t
  6360.     (action_tile "xline_x2" "(ver_xline_x2 $value)")
    # H  y: F5 i, Y# n' M' T
  6361.     (action_tile "xline_y2" "(ver_xline_y2 $value)")/ `: A* i" _) p/ v
  6362.     (action_tile "xline_z2" "(ver_xline_z2 $value)")+ ]. v2 k3 w2 \. H4 T9 r! V4 R
  6363. 8 m% G" S  C, G/ t# ?( S1 h  f
  6364.     (action_tile "edge_1"       "(setq edge1 $value)")
    9 \- t. \/ E3 Y2 O/ m3 y" D
  6365.     (action_tile "edge_2"       "(setq edge2 $value)"). |/ k: w: A% W
  6366.     (action_tile "edge_3"       "(setq edge3 $value)")
    / }) W" T4 u, k5 a4 }0 J
  6367.     (action_tile "edge_4"       "(setq edge4 $value)")' Q1 h1 d$ F8 c# H9 D, P
  6368. 7 s1 \+ o: j7 [. C& v- f
  6369.     (action_tile "radius"       "(ver_rad $value)")/ Z- p! z3 D8 {/ ~4 [& b, ^2 {$ r
  6370.     (action_tile "st_ang"       "(ver_ang1 $value)")& A4 C$ \( V% F* {
  6371.     (action_tile "end_ang"      "(ver_ang2 $value)")+ T: y! J4 e" w) }
  6372.     (action_tile "end_eang"     "(ver_eang $value)"): I% Z& v- A- _) t
  6373.     (action_tile "minrad"       "(ver_minrad $value)")0 V7 s# ^3 M) [
  6374.     (action_tile "majrad"       "(ver_majrad $value)")8 l. M8 @7 `+ [, z

  6375. - I, ?1 _( D6 f+ h1 F/ H
  6376.     (action_tile "xscale"       "(ver_xscl $value)")+ Y- p! F  s% x. }' v( h3 X2 A$ B& {- M
  6377.     (action_tile "yscale"       "(ver_yscl $value)")) f3 I  E2 W7 g/ L, O+ }
  6378.     (action_tile "zscale"       "(ver_zscl $value)")
    % u$ `1 F: |; X1 D% D! I
  6379.     (action_tile "rot"          "(ver_rot $value)")2 F9 K; L; ?- q
  6380.     (action_tile "columns"      "(ver_col $value)")2 M9 G8 q  T4 x6 N2 e
  6381.     (action_tile "rows"         "(ver_row $value)")
    7 v; Q+ C  M2 w) }: d
  6382.     (action_tile "col_sp"       "(ver_colsp $value)")& \" A! E" _0 A# S% E$ a
  6383.     (action_tile "row_sp"       "(ver_rowsp $value)")4 ?) H( g! r- S( z: _) o
  6384. 8 W5 N  B/ d) m: p0 z/ j
  6385.     (action_tile "hght"         "(ver_hght $value)")/ E! z+ i, @+ z" n: x  f
  6386.     (action_tile "wid"          "(ver_wid $value)")2 M! u. f( [0 z. a) V
  6387.     (action_tile "obl"          "(ver_obl $value)")) B! w0 q6 [. A, J7 V2 P
  6388.     (action_tile "style"        "(style_act $value)")9 ~6 @- @! r. \! A: f/ W2 M. x
  6389. / X/ y' I. Y9 n/ m& v
  6390.     (action_tile "t_string"     "(ddgettext)")1 b  B/ x& B0 b& I1 D! i. u6 C
  6391.     (action_tile "tag"          "(ver_tag)")
    2 h1 _" X+ x% w$ k2 c' I
  6392.     (action_tile "prompt"       "(ddgetprompt)")4 B4 L  L2 P4 q. n1 D  I2 ~
  6393.     (action_tile "bkwd"         "(setq bkwd (atoi $value))")6 T3 {  V* v7 S8 j. p+ F
  6394.     (action_tile "upsd"         "(setq upsd (atoi $value))")
    ; w( M, {. \4 L1 I- b5 e5 P/ h6 u
  6395.     (action_tile "inv"          "(setq inv (atoi $value))")( H0 _% u; D$ A6 k( `$ Y
  6396.     (action_tile "con"          "(setq con (atoi $value))")
    6 u7 F+ {; j( P3 R4 t- c/ N4 o0 O
  6397.     (action_tile "ver"          "(setq vfy (atoi $value))")
    ; m* g4 ^7 o- r" Q9 e8 O
  6398.     (action_tile "pre"          "(setq pre (atoi $value))")
    % A1 Q/ a) {# C4 U
  6399.     (action_tile "popup_just"   "(jlist_act $value)")% R5 ~' r$ P! }4 G, _
  6400. 0 W& r7 [' P* M+ q
  6401.     (action_tile "closed"       "(setq closed $value)")( Q9 f8 R2 p/ W# z  R9 V: j, B
  6402.     (action_tile "ltgen"        "(setq ltgen $value)")
    & b+ o' c2 e$ T
  6403.     (action_tile "closedm"      "(setq closedm $value)"): U7 w( N" k% N+ P( n% }
  6404.     (action_tile "closedn"      "(setq closedn $value)")
    9 V( ]; s5 D& n  R7 x% q
  6405.     (action_tile "next_v"       "(next_vertex)")" }( |3 i" L+ y; V' T3 D( W7 T
  6406.     (action_tile "xcliponoff"   "(setq xcliponoff $value)")
    - r6 Z8 b3 d$ R

  6407. 7 u( z' Y4 M. F9 E; F! J, j
  6408.     (action_tile "next_cntlpt"  "(next_cntl_pt)")
      y8 f2 ^- W; {, Q3 \9 S" _
  6409.     (action_tile "next_datapt"  "(next_data_pt)")
    - Q; v; D/ ~7 _' W' ]8 r% L
  6410. ' _) o8 K/ y( V% v6 h
  6411.     (action_tile "none"         "(if (radio_gaga \"none\")(set_uv 0))")0 f5 N) V/ O/ ~5 e" ]! W
  6412.     (action_tile "fit"          "(if (radio_gaga \"fit\")(set_uv 1))")
    $ R5 M9 ?- ?+ c& J5 N
  6413.     (action_tile "quad"         "(if (radio_gaga \"quad\")(set_uv 5))")( ~, O& ?: i2 C# S
  6414.     (action_tile "cubic"        "(if (radio_gaga \"cubic\")(set_uv 6))")
    8 T' K3 r. @, |, U! _* ~. z
  6415.     (action_tile "bezier"       "(if (radio_gaga \"bezier\")(set_uv 8))")
    ' |+ o9 `; I8 T% G6 b' U$ W

  6416. - u' b' F9 t; Q: q. O8 Q
  6417.     (action_tile "u"            "(ver_u $value)")
    5 D/ P( K( S; _7 X/ e+ {
  6418.     (action_tile "v"            "(ver_v $value)")/ W2 Z0 f  \/ q, v: Z( D' {
  6419.   )
    6 U! u/ z. D, x; D

  6420. 5 u; E* p, \3 k! @
  6421.   (defun ddgettext()9 l  u6 R9 R/ u! f7 H
  6422.     (setq text (get_tile "t_string"))) |4 e0 Y- V  J+ A
  6423.   )4 \3 O4 ^7 ^6 D+ s' V

  6424. # R7 d, e* d0 ^. t$ c$ {
  6425.   (defun ddgetprompt()
    . t+ x3 K0 \9 Z9 Z1 A1 ]
  6426.     (setq atprompt (get_tile "prompt"))
    0 a$ z# l) q4 f0 I. X; ^* a  n
  6427.   )
    / {# P6 T' S6 J/ q+ n' Z5 C
  6428. " J0 V8 v; ?' ^% ~7 x
  6429.   ;; As OW doesn't support disabling of individual radio buttons within- j, X! H* B* r& g  T8 I
  6430.   ;; clusters, a check must be performed as to the legitimacy of the
    : j+ ^& L' p+ H/ C1 S7 ~2 ~8 g9 e
  6431.   ;; button pushed and reset if necessary./ T, r6 {1 k  b2 P
  6432.   (defun radio_gaga (pushed)
    5 S: f. U/ S( ^& P3 V6 C
  6433.     (cond0 v) Y8 z' o7 y8 G" {0 }
  6434.       ((and (= pltype "3D polyline")
    8 f3 B( r% w$ N
  6435.             (or (= pushed "fit")1 Y! c3 A' E" e5 B+ Z
  6436.                 (= pushed "bezier")
    4 R7 g& e; U: y
  6437.             )
    2 |( S  |! e' k1 Z
  6438.        )
    3 q1 d& n2 a: `2 k! r5 p% y
  6439.         (set_tile "none" "1")
      Y3 T4 {5 l1 e  `
  6440.         nil5 N! h# x' z: L5 _- A0 r
  6441.       )
    1 \' O' j# l# _3 G) l
  6442.       ((and (= pltype "3D mesh")
    ' Q, V- E9 y+ X- p& q! ~
  6443.             (= "fit" pushed)7 k9 f; a9 J8 e2 K" C- b
  6444.        )
    / D- D/ l$ z) s) W
  6445.         (set_tile "none" "1")
    & d/ `' M; \: {2 t, G6 I8 h
  6446.         nil5 j, `* [' J  |* |3 z) ^3 c" T9 F
  6447.       )
    ' i. ]( {% c- t# O+ M. d
  6448.       ((= pltype "Polyface mesh")
    . R! I6 P2 A! T) [2 C6 O" r, }
  6449.         (set_tile "none" "1")9 I- C- Q  H5 a+ x0 r5 _7 E/ C% I6 X
  6450.         nil
    , W. d; l( G/ x8 q! g
  6451.       )& w& y& ^1 h- ~! }$ _
  6452.       ((and (= pltype "2D polyline")
    " T) X, _1 y" d& O) s+ p; m0 X
  6453.             (= "bezier" pushed)
    1 f, d. b. b6 V* W
  6454.        )4 K6 S+ w6 V- T. A$ X# `* d" V
  6455.         (set_tile "none" "1")
    9 g, o" Y7 Y- k4 ~
  6456.         nil
    + t/ F, t3 T0 S% s1 F' }
  6457.       )
    8 D- b4 G. U3 |' V3 y+ z
  6458.       (T)
      w, G1 L* z* f0 P/ t
  6459.     )7 ^: g' ]$ q2 o
  6460.   )
    : q9 w. d5 C9 I' |/ y
  6461.   ;;. H: Y9 i3 K$ i$ y6 x" g5 @
  6462.   (defun set_uv (type_n)  Q% n- ~1 q* {" F
  6463.     (setq spltype type_n)
    9 s9 X2 j2 S4 W4 f' m! {
  6464.     (if (= pltype "3D mesh")% S2 u( P. E& A) ^# q& v6 U9 Z
  6465.       (if (= spltype 0)
    . K% x4 j. `) m1 z
  6466.         (progn
    8 E" w5 l9 S; M2 V. x. N
  6467.           (set_tile "u" (itoa (setq u 0)))- n; a+ Y% X9 r1 \. ?* p& G
  6468.           (set_tile "v" (itoa (setq v 0)))
    1 }1 i( Q8 D/ w' ]
  6469.         )
    ' x+ c0 O6 s9 ], t" M0 x
  6470.         (progn) c# x$ t. V) i' A
  6471.           (if (= u 0)
    : ?) `& s% j/ V* \) ^( G) l/ E2 ^
  6472.             (set_tile "u" (itoa (setq u (getvar "surfu"))))) y0 T, N7 P4 ^# E% H
  6473.           )
    6 a! V/ [+ [6 @0 p
  6474.           (if (= v 0)/ K+ x, @- B, n6 D
  6475.             (set_tile "v" (itoa (setq v (getvar "surfv")))); E9 u; `* \4 G3 [" T# d5 N* [9 _9 ?! a; v
  6476.           )
    5 r" g, `' B& g
  6477.         )0 F( N5 B# R: w, B# Y
  6478.       )* E% }' I; N0 Q' h
  6479.     )' G! S" q  h; G- m2 G1 X2 u
  6480.   )
    8 S5 B/ S+ O# L8 }& x4 l# N' R$ w$ U
  6481. ! w  T7 o; ]+ {$ n: p
  6482. 6 y* y, i0 {" `5 W: d7 H5 V
  6483.   ;;
    . C$ M. v+ E% @' v# W
  6484.   ;; Verification functions
    9 ^  ^6 w* I! f8 `. Y: ?2 C
  6485.   ;;
    . t" E9 v: |9 k! t3 e
  6486.   ;; Verify distance function.  This takes a new X, Y, or Z coordinate or6 Q. z3 a1 A$ q, T5 ]6 l; t% ]) o
  6487.   ;; distance value, the tile name, and the previous value as arguments.5 \4 a& P6 b6 s5 o
  6488.   ;; If the distance is valid, it returns the distance and resets the tile.
    . ^9 K: C" X' w1 V, |
  6489.   ;; Otherwise, it returns the previous value, sets the error tile and keeps
    2 I3 t+ f2 d: O  q; R8 s, O
  6490.   ;; focus on the tile.  Shifting focus to the tile with invalid value can
    , w2 W! L& z5 E
  6491.   ;; trigger a callback from another tile whose value is valid.  In order
    - x) f; K9 N: i) v" {8 g
  6492.   ;; to keep the error message from being cleared by this secondary callback,/ e# g: N; g, [: C9 D
  6493.   ;; the variable errchk is set and checked.  The last-tile variable is set1 k8 P7 t1 T8 g  J4 l3 @
  6494.   ;; and checked to ensure the error message is properly cleared when the/ I% W' Q* E+ N1 s# `
  6495.   ;; user corrects the value and hits return.
    " |  Y' v0 r0 A2 N* x, J! O. u
  6496.   ;;
    1 P) Y1 ^: C0 M- F4 q% X
  6497.   (defun verify_d (tile value old-value / coord valid errmsg)( S9 f( X' e  S7 e% I' M
  6498.     (setq valid nil errmsg "Invalid input value.")( T& D$ F" _% e7 W! M( V
  6499.     (if (setq coord (distof value))
    3 ~+ J! U8 o; L) x
  6500.       (progn% n) J# C+ o, G" Y) k  w
  6501.         (cond) [4 Y0 k& g+ u8 V
  6502.           ((or (= tile "radius")1 x0 f, c* C- N; s& P. \
  6503.                (= tile "hght")9 V' w7 @9 t* b1 c; @& V
  6504.                (= tile "wid")
    , i' Q# p; f6 a+ u4 e9 C# e( K7 s+ j
  6505.                (= tile "majrad")! h6 \9 t. T5 Z3 ?# c/ K
  6506.                (= tile "minrad")
    8 w! S% K- ]% j
  6507.                (= tile "eb_ltscale")
    & G5 w! g# J" M7 @9 S  g1 A: P" u4 E
  6508.            )! F7 i2 x+ G% p; H: b& t, g
  6509.            (if (> coord 0)6 B/ w4 Y$ A7 c0 \* B/ ~, b
  6510.              (setq valid T)  d# J/ G+ t4 I/ N% c) c; o
  6511.              (setq errmsg "Value must be positive and nonzero.")+ D  o2 a+ h' s
  6512.            )( g) T1 v3 M" `# ?; ^* O
  6513.           ); U8 T2 o" M1 i: M5 M1 N! Q: K/ |8 R9 [
  6514.           ((or (= tile "xscale")
    . Q) w7 z) p3 s% P) e$ A
  6515.                (= tile "yscale"); G& b7 M, e# l$ V( F: U
  6516.                (= tile "zscale"): X7 B0 H' I  K
  6517.            )
    , A; Q  ~1 l6 K$ ]3 ^1 b8 i' j
  6518.            (if (/= coord 0)
    2 |) z/ V. \- w
  6519.              (setq valid T)
    + R( v4 T, |* D4 Z0 l) q; b
  6520.              (setq errmsg "Value must be nonzero."), [. f: {4 L# H/ \! z3 X
  6521.            )
    & @: B7 p; L2 d( @) K
  6522.           )
    . `# A7 J5 e+ V( T, j7 F4 p
  6523.           (T (setq valid T))4 {) b' v, X) @
  6524.         )
    * e3 o  X; U6 k. w
  6525.       ); `: ^5 t; q4 I9 `
  6526.       (setq valid nil)
    ! e0 J! Q$ \% |6 ]" o6 T
  6527.     )4 D$ E! q7 @) }9 \
  6528.     (if valid
    ( }8 N' j6 M4 E" c+ g' \" i
  6529.       (progn
    3 T8 `, [( @% C' l2 K1 X5 j
  6530.         (if (or (= errchk 0) (= tile last-tile))( m. D  Z9 k  E! F; w8 v- \
  6531.           (set_tile "error" ""), [/ g( I) l" |1 o% ]1 x
  6532.         )
    4 x& X- q0 g9 f& H4 F( C# w
  6533.         (set_tile tile (ai_rtos coord))
    1 R3 B+ ?5 @6 P0 ^1 v2 C
  6534.         (setq errchk 0)
    + c! \6 }0 k: x4 X# h
  6535.         (setq last-tile tile)9 b- f5 B2 h' A2 w% _3 _2 @7 k
  6536.         coord
    & X3 E5 C8 s* @3 B9 j
  6537.       )" g( `& \, ]4 V) W# ]
  6538.       (progn
    + A- V; ^3 g9 \0 p" A/ |/ Y& k1 ?
  6539.         (mode_tile tile 2)            ; Move focus to offending field
    3 e4 X+ I; k# ^" U" D0 c
  6540.         (mode_tile tile 3)            ; Select offending text
    $ p) z. f9 f4 {
  6541.         (set_tile "error" errmsg)! Y/ v, G2 Y7 s1 Z8 A( k; s, S8 T. a
  6542.         (setq errchk 1)
    / X/ v6 A4 R* u$ I5 I
  6543.         (setq last-tile tile)
    4 o+ g1 X  b  ]5 h2 y" V( B
  6544.         old-value
      m* c" |$ r8 L$ Y3 }, i
  6545.       )% ^. v6 v1 m2 c% u  x' |5 p5 f
  6546.     )
    ( {. `! A: R2 n; }
  6547.   )* e/ S% R6 o, v5 Z5 q; }  N
  6548.   ;; Function for Xline coord edit box checking.
    " J+ \4 n9 Y/ X
  6549.   (defun verify_xline (tile value old-value / coord valid errmsg)) W' x+ o+ W7 @; X
  6550.     (setq valid nil errmsg "Invalid input value.")
    + B- h  w# o: @% v$ _( S
  6551.     (if (setq coord (distof value))
    , H$ h) o7 Y9 j' H: k" W
  6552.       (setq valid T)
    # [- O  V/ U) I# z# {: ]+ q9 f5 t! A
  6553.       (setq valid nil)
    7 W7 z7 ~7 P6 ^) b4 M
  6554.     )
    2 Z( l, C% `# S: A4 w! X' w
  6555.     (if (and coord7 D; f/ Q% }4 e! T9 F" I
  6556.           (and (= (atof (get_tile "xline_x1")) (atof (get_tile "xline_x2")) )
    3 T- j; [  D8 i. p
  6557.                (= (atof (get_tile "xline_y1")) (atof (get_tile "xline_y2")) )/ d+ w) k( y5 @- o8 k7 @! u
  6558.                (= (atof (get_tile "xline_z1")) (atof (get_tile "xline_z2")) )
    3 t6 P- G5 u5 b7 C+ q: R# f
  6559.           )9 W+ d+ Y3 U( h0 c. e
  6560.         )4 X9 z, O# p% K4 |2 a, A
  6561.        (progn
    7 o" A8 l8 |2 E4 c  N+ R
  6562.          (setq errmsg1 H* F3 U3 L. r. |4 t4 D
  6563.                   "The Root point and the Second point cannot be equal."). q$ N! m& T+ C; N
  6564.          (setq valid nil)
    5 L: y; h, f' t, g' h6 q' w
  6565.        )6 M4 u4 `  E7 S, i" T; c! I
  6566.     )3 c2 [0 q5 Q# L! a! [
  6567.     (if valid
    # ^" L* {# R" f) G: l# M
  6568.       (progn5 i! |! Q* u% f2 \, I" ]
  6569.         (if (or (= errchk 0) (= tile last-tile))
    1 h. C5 i  `$ i# L/ C
  6570.           (set_tile "error" "")0 V' J  G" _4 C
  6571.         )
    ; `" [+ A7 e: i. U
  6572.         (set_tile tile (ai_rtos coord))
    # F; n2 u7 ], r3 q& D
  6573.         (setq errchk 0). d& f: ^+ W* j% F$ |* b
  6574.         (setq last-tile tile), Z1 a" B  b; w
  6575.         coord2 v$ _* ]+ p7 x4 U
  6576.       )+ L# \: }, h7 }. T4 j
  6577.       (progn
    # @# f6 Q2 j. V, J2 a$ \; D
  6578.         (mode_tile tile 2)            ; Move focus to offending field3 G5 b0 ^, O/ \  v: I
  6579.         (mode_tile tile 3)            ; Select offending text
    4 ?3 {0 v" p0 V6 A
  6580.         (set_tile "error" errmsg)+ x# x7 F; _' U
  6581.         (setq errchk 1)- c1 W' Z) G2 E
  6582.         (setq last-tile tile)1 k* @  k8 C) N
  6583.         old-value, ]# p4 a  G% ]5 A4 r/ E7 Y; p
  6584.       )& O+ t! Z3 z  n+ O6 @& k' Q" ~% \
  6585.     )! J7 l$ O% y. ]/ Y2 i" ~, n9 a
  6586.   )8 a' B: u" X4 {5 U& [' d- ^, F
  6587. 4 w# S+ y  i; v8 H/ \! ~6 W
  6588.   ;;
    / {* a6 ~/ n* [8 ~2 b# t
  6589.   ;; Verify angle function.  This takes an angle and a tile name as arguments.
    & N2 _& l3 a  J; Q' }
  6590.   ;; If the angle is valid, it returns the angle and resets the tile.
    5 {2 z/ E1 k1 f: r% c# y" f
  6591.   ;; Otherwise, it sets the error tile and keeps focus on the tile.! c3 L8 Z6 d! n' o; h' Y
  6592.   ;;7 y7 D9 ?' `. @. n7 [
  6593.   (defun verify_a (tile value old-value / ang valid errmsg oblqmax)
    # V9 O8 L' ]. B$ S, f" m. ?( y
  6594.     (setq valid  nil) A9 ?* k2 y# h1 d- y, d
  6595.           errmsg "Illegal input value."' _9 |' ?5 F; M; m# B7 L
  6596.     )
    7 s$ A( j) n" ]! e8 ]' T1 `: |
  6597.     (if (setq ang (angtof value))
    8 e, b4 {6 t9 R. _$ U# B+ X5 _
  6598.       (cond3 X5 J/ A5 i0 U" L8 `9 b! I
  6599.         ((= tile "obl")               ; Restrict obliquing angle% y( K* h+ U8 H* _7 p0 J8 j
  6600.          (setq oblqmax (+ (* (/ PI 2.0) (/ 85.0 90.0)) 0.000001))
    4 G- x: \% }, v2 y
  6601.          (if (or (<= ang oblqmax)+ x! [- V) b- X- a
  6602.                  (>= ang (- (* 2.0 PI) oblqmax))
    ; i$ O9 Q; Z1 d3 z  K/ m% `2 Q! M1 p; c
  6603.              )
    0 J$ ~: F6 |+ G8 t
  6604.            (setq valid T)
    " k# E3 d; \9 R% E
  6605.            (setq errmsg
    8 ^, M# ^1 [3 p8 f$ f, z, E% w
  6606.                  "Value must be between -85 and +85 degrees.")
    , R9 [- z( N# h% j
  6607.          )
    % _% x/ J' c& x+ x% V8 v+ n) x4 o8 W
  6608.         )
    0 ^+ X- R# Q$ _( l
  6609.         (T (setq valid T))            ; Other angles not restricted, d8 C0 y; V/ ^4 q/ W  g
  6610.       )
    6 @# K  w0 O" E2 z' y
  6611.       (setq valid nil)                ; Invalid angle input1 J9 Q3 c4 |$ u$ a
  6612.     )9 y1 d/ s0 V( I. U$ U2 y! W
  6613.     (if valid, G: x" f) A/ y8 x& @
  6614.       (progn: {. \! @3 I% o% O- S
  6615.         (if (or (= errchk 0) (= tile last-tile))
    7 X. n8 \  s# d# T
  6616.           (set_tile "error" "")$ b, ^, P/ S1 f8 z7 r$ r
  6617.         )! o$ H( [. }0 b) l. \/ v' j- U3 O
  6618.         (set_tile tile (ai_angtos ang))
    8 G3 i9 o/ ]/ T9 U/ V
  6619.         (setq errchk 0)! G1 M; e& h7 k3 S+ \3 G3 w% s
  6620.         (setq last-tile tile)
    9 A7 X9 M: h3 K3 I; u
  6621.         ang: _" \* S& h/ k5 U
  6622.       )
    - \4 N& A  d( b& s/ c5 P* V
  6623.       (progn
    $ a% E' q( L$ v; z
  6624.         (mode_tile tile 2)            ; Move focus to offending field
    " ~7 q' t7 g; @7 C2 W
  6625.         (mode_tile tile 3)            ; Select offending text
    + t' A: @0 O$ |2 [" C0 D
  6626.         (setq last-tile tile)& @2 J. I0 _1 m& |2 x
  6627.         (setq errchk 1)
    , X: q+ f! v2 p' X1 X7 t, N
  6628.         (set_tile "error" errmsg)
    4 [/ G4 m( U5 e' J
  6629.         old-value- a; }7 O  A% t7 A4 S9 E
  6630.       )" o$ m5 T5 O+ w$ q& {9 q
  6631.     )
    3 G0 [* _6 R, `8 G
  6632.   )
    ) n3 W9 j" u" F+ _( l$ d( t
  6633.   ;;0 i/ }: {) @4 {6 i( L4 F* l
  6634.   ;; Verify angle function.  This takes an angle and a tile name as arguments.1 M& _8 f6 _2 U5 Z
  6635.   ;; If the angle is valid, it returns the angle and resets the tile.
    8 t$ S8 d( h  F4 Q
  6636.   ;; Otherwise, it sets the error tile and keeps focus on the tile.( W: {, h9 p5 i6 l8 g: N
  6637.   ;; This function is specifically for the end angle of the ellipse object. If
    ' X' V# C' X5 C0 ]
  6638.   ;; the end angle resolves to zero then we want to display it as 360.4 }5 q2 b. Y, J+ @' R
  6639.   ;;
    6 n$ G& r. C5 i9 I+ Z- q( F
  6640.   (defun verify_ae (tile value old-value / ang tempend)9 L( z/ v( \# H$ G5 w+ n$ r: u& M- B- b
  6641.     (if (setq ang (angtof value))$ z; _+ @7 |, e$ U  x: J
  6642.       (progn
    ; h3 F% ~) k6 ~8 `% m. ?4 W& ~% v
  6643.         (if (or (= errchk 0) (= tile last-tile))
    * X+ _: \1 X- G4 J
  6644.           (set_tile "error" "")) h2 W; u0 b3 p. K
  6645.         )6 V6 _* ~$ U# q5 m9 L
  6646.         (setq tempend (ai_angtos ang))4 l; k$ W7 H- b7 V0 f* v
  6647.         (if (= tempend "0")' p: E! S; I8 m7 r2 {0 @6 a
  6648.            (set_tile tile "360")2 f) K1 r; O$ o+ M% y5 j- q
  6649.            (set_tile tile tempend), Z8 ~+ H0 {2 u8 Z9 W3 w3 \
  6650.         )/ K( c9 [( \( n- q6 ]
  6651.         (setq errchk 0)! L0 y& y$ @, n7 u  v4 G. R3 f
  6652.         (setq last-tile tile)7 H+ F9 T$ X# U2 C! d* u
  6653.         ang. V- g! z$ Z8 M, _7 x0 S" Y
  6654.       )( d1 s9 q& k9 f
  6655.       (progn
    2 ^% q$ n/ C3 j: r3 o5 d
  6656.         (mode_tile tile 2)            ; Move focus to offending field
    - H9 E: |/ t( n. k/ \, w
  6657.         (mode_tile tile 3)            ; Select offending text. v4 T9 x; y0 b: o
  6658.         (setq last-tile tile)/ A: n: {! N% d. G5 q2 f3 ^+ x* w" a9 H
  6659.         (setq errchk 1)
    7 m6 p* h( a% M( `1 v' a
  6660.         (set_tile "error" "Illegal input value.")' v) s- r: p5 }) l
  6661.         old-value& I* b+ B  l8 B# r) ]* ]2 f3 ^# h% ?) @
  6662.       )1 f! s  N# o7 {) t; w
  6663.     )4 G* z, P7 N4 |3 S. |, L
  6664.   )" ^  b5 \) D. x' d6 W, x
  6665.   ;;
    + m; Q" L& o4 ~% Q0 O) s
  6666.   ;; Verify integer function.  This takes an integer and a tile name as
    ( A. q+ S9 M- w, g
  6667.   ;; arguments.  If the integer is valid, it returns the integer and resets the6 p# E# @+ K) u) l
  6668.   ;; tile.  Otherwise, it sets the error tile and keeps focus on the tile.
    6 [9 k- v7 ~7 L
  6669.   ;;& F+ c# ~6 ^# K- n9 k) B3 D
  6670.   (defun verify_i (tile value old-value / int valid errmsg)
    3 L6 x4 n' X" i) k
  6671.     (setq valid nil)
    ; {/ h3 I) v% c8 q+ f
  6672.     (setq errmsg "Value must be an integer.")
    : n4 n9 q+ t+ c7 |: O
  6673.     (setq int (atoi value)); s% u9 K) x4 h% \8 v2 y  L
  6674.     (if (setq intchk (distof value))
    1 Z/ V1 A8 l. A( T2 q. ?
  6675.       (cond
    * `1 @9 y( O1 T8 [) [4 A5 P- s
  6676.         ((or (= tile "columns") (= tile "rows"))5 P1 a) ?0 F* s1 v! j( x
  6677.          (if (and (= int intchk)+ b2 q* p; a& a
  6678.                   (>= int 0)
    4 s' X' a8 i# `0 q7 |3 P
  6679.                   (<= int 32767)
    3 {. b: A* W7 U3 f( w, s- P4 m
  6680.              )
    4 U2 ^* @. ~" o5 P$ B
  6681.            (setq valid T)
    1 y8 B+ f5 @9 }
  6682.            (setq errmsg "Value must be an integer between 0 and 32767.")
    / Y7 g9 V: B: @! E5 A% @; T
  6683.          )
    ; k  }. u% F# K/ z5 B$ D( F
  6684.         )
    : k1 O/ Y' P. q6 H4 e7 ?3 a. ~1 f
  6685.         ((and (or (= tile "u") (= tile "v")))
    $ z; ?1 E/ Q! Z# V2 z7 {
  6686.          (if (and (= int intchk)
    6 {0 z; U  o5 I; }1 w- u1 Y+ h
  6687.                   (>= int 0)
    * k  E9 W2 M9 @; L/ d
  6688.                   (< int 201)
    : q3 `, {" y' V- }4 C
  6689.              )4 P, \0 X& J9 A9 y2 E- S
  6690.            (setq valid T)$ G0 K5 f$ l6 c) X" K; ~
  6691.            (setq errmsg "Value must be an integer between 0 and 200.")/ v5 d$ [* Q: U2 s9 e
  6692.          )9 T& q1 E0 J+ B0 N! w
  6693.         )5 A6 R' Z9 Q: {
  6694.       )
    5 @) g3 _9 y' ?
  6695.     )" L, ^% n. u6 e6 I* q
  6696.     (if valid" E9 o: q; o' d! k. \9 V$ M7 }8 l, M
  6697.       (progn( v& A% k! O7 J7 G" }) u
  6698.         (if (or (= errchk 0) (= tile last-tile))
    ! l* y& B9 j, q/ N
  6699.             (set_tile "error" "")8 T9 j; e; h! M, _
  6700.         )  L4 u9 _- z8 P! P; U/ x- `
  6701.         (set_tile tile (itoa int))$ y. W, d3 z! x9 p
  6702.         (setq errchk 0)! s/ o/ ]# S( _8 k9 A( T
  6703.         (setq last-tile tile)
    6 l: o0 ^5 m& m" F6 ]* q
  6704.         int
    + Y: H, U* H" A& h  d2 _3 G( @
  6705.       ): Y8 d) k$ A5 l; y; B3 g3 V/ L
  6706.       (progn! r$ @' A+ c% f1 l- H3 a$ K
  6707.         (mode_tile tile 2)            ; Move focus to offending field
    , a6 J0 e+ @/ v" u: f
  6708.         (mode_tile tile 3)            ; Select offending text( \' [2 Q$ s0 b( R  G% E7 e4 b
  6709.         (set_tile "error" errmsg)3 ?! W3 C/ ^3 C  T) f. E" @0 m
  6710.         (setq errchk 1)3 F& t* ~- w* p6 h% w4 W  k9 ?6 z
  6711.         (setq last-tile tile)& n* d0 z0 o" ]6 F! y, @4 [* z
  6712.         old-value
    , |/ O- z" b9 ~( P! t
  6713.       )& Z: m: d& [2 M9 p+ S
  6714.     )
    * d, p6 j+ a" M$ O
  6715.   )
    9 X) @+ X' N% v; P! b5 n& f3 l
  6716.   ;;2 V: f6 `- w, b1 H1 M
  6717.   ;; Functions that verify tile values for integers/ J4 x+ S8 k' ?" N# ~
  6718.   ;;- E3 _, R3 x7 n. k. Q
  6719.   (defun ver_col (value)
    $ N: p; O: J8 c( I2 }
  6720.     (setq columns (verify_i "columns" value columns))
    ( H0 Q- ~+ J2 `* i) J
  6721.   )
    # Z& T' u) _& v( O. a
  6722.   (defun ver_row (value)& W' d. L: F0 G) `5 c) N
  6723.     (setq rows (verify_i "rows" value rows))- f2 ]0 q& p" D7 p/ \3 T
  6724.   )/ c8 F. L+ {; v1 ~5 k$ Z
  6725.   (defun ver_u (value)
    4 ^, T) W- j  e8 I  \, `5 D9 |
  6726.     (setq u (verify_i "u" value u))% k# {2 T1 u6 U1 ^1 T( V
  6727.   )* p' U0 j$ J% {7 U* Y
  6728.   (defun ver_v (value)1 K! Q# w% v$ G* R. G7 V6 l; C
  6729.     (setq v (verify_i "v" value v))* u1 }* o7 _- M* |1 s2 }0 u/ r
  6730.   )
    ! v5 K. S& G, K6 ^3 k
  6731.   ;;
    0 b# Z8 D; x- F7 l
  6732.   ;; Functions that verify tile values for reals) _# m5 ^( h& K6 j5 ~
  6733.   ;;! r% l; Z( g$ J8 T
  6734.   (defun ver_x1 (value)
    6 v3 |$ }) y! f0 e% v$ z+ E0 n
  6735.     (if (setq x1 (verify_d "x1_pt" value x1)) (calc))0 o7 e8 ~: }. N$ ~" y! U, u
  6736.   )4 F& l( q% q1 c8 F/ @- ?0 n
  6737.   (defun ver_y1 (value)
    7 T/ x$ e' o7 w( l% |, B
  6738.     (if (setq y1 (verify_d "y1_pt" value y1)) (calc))+ a5 n: ?8 b: e( X# [% U* D" ]7 W
  6739.   )
    ; @: S+ F$ V9 x9 e: l
  6740.   (defun ver_z1 (value)
    , `0 a0 N  r& E8 R: f
  6741.     (if (setq z1 (verify_d "z1_pt" value z1)) (calc))  G  {/ T( w8 ^+ e5 q
  6742.   ): N5 A7 r2 d* i  B* Y& ]3 k) ^. Z. T( `( m
  6743.   (defun ver_x2 (value)
    4 ^+ m3 j2 s, a2 A8 {
  6744.     (if (setq x2 (verify_d "x2_pt" value x2)) (calc))" e* E. y1 Q: R/ ~/ m
  6745.   )
    & b6 C7 `; Y% {: ~" o- N
  6746.   (defun ver_y2 (value)4 p6 E) H. q) w# x$ m& p
  6747.     (if (setq y2 (verify_d "y2_pt" value y2)) (calc))
    6 X: E# P% a1 h1 y% @5 y
  6748.   )7 r. [5 p3 V3 k- \* U: G& b( @% @
  6749.   (defun ver_z2 (value)
    5 C( i) D7 D) d  M! N7 a9 ~7 a% i( z$ W
  6750.     (if (setq z2 (verify_d "z2_pt" value z2)) (calc)); c& q' y# g8 T3 X+ ]. |
  6751.   )
    0 x* B- p& l# Q* U
  6752.   (defun ver_x3 (value)6 G3 [; n# A# O2 v: h% f
  6753.     (setq x3 (verify_d "x3_pt" value x3))2 u2 |& x. t) m2 F' c* @* ?; @% B
  6754.   )
    " W5 @, O, u( U! L8 V
  6755.   (defun ver_y3 (value)
    $ s* O4 n7 J% o' o. C. s
  6756.     (setq y3 (verify_d "y3_pt" value y3))% r8 S' J; J) u6 c
  6757.   ). \0 q$ M( ^5 [
  6758.   (defun ver_z3 (value)
    . W2 v6 a7 h/ T! {- e) x
  6759.     (setq z3 (verify_d "z3_pt" value z3))
    * _! }4 M. {% T: ?  K; F5 p
  6760.   )
    7 T& k( x- j5 [5 }! e
  6761.   (defun ver_x4 (value)
    $ E& ^5 I) W. U/ Y1 j8 s# b7 j
  6762.     (setq x4 (verify_d "x4_pt" value x4))4 \5 i! n) g& E- B8 x
  6763.   )% B+ b8 |3 H8 |  }, @% ]
  6764.   (defun ver_y4 (value); C, L& q8 F+ `
  6765.     (setq y4 (verify_d "y4_pt" value y4))
    0 [! S7 M- `: u, i9 [. @* H
  6766.   )8 \# z4 B! p% s/ f( D0 Z) N
  6767.   (defun ver_4 (value)
      I- s. J4 V* Q9 @. J/ u
  6768.     (setq z4 (verify_d "z4_pt" value z4))( n, x3 b8 p6 o8 c- t% _+ n
  6769.   )
    - [$ t' _  \$ H3 I6 k' Y( f, H
  6770.   (defun ver_xscl (value)% r. e+ |5 f% s5 H: h3 s
  6771.     (setq xscale (verify_d "xscale" value xscale))) @+ [: R- f$ L5 E0 e
  6772.   )
    1 l$ S1 N' @# _3 B" M
  6773.   (defun ver_yscl (value)
    6 h0 v. f) L3 h" v
  6774.     (setq yscale (verify_d "yscale" value yscale))
    , A4 n1 K3 t( g" q1 A3 N& W
  6775.   ), U! K6 m9 u: a0 w1 o
  6776.   (defun ver_zscl (value)1 Q! `9 t/ x9 t6 ?+ R- R
  6777.     (setq zscale (verify_d "zscale" value zscale))
      _; P7 o, r1 }- |0 ]
  6778.   )/ v5 z3 Q' b' u( G2 J8 w
  6779.   (defun ver_colsp (value)
    / N: l1 |3 g! u* y
  6780.     (setq col-sp (verify_d "col_sp" value col-sp))
    7 @" i3 `, i% o4 z* R$ r" }
  6781.   )1 h5 D0 c" Q1 N" W
  6782.   (defun ver_rowsp (value)( O# H) F4 e7 n. r6 S
  6783.     (setq row-sp (verify_d "row_sp" value row-sp))+ C6 q: X4 f0 h* u* q& T% F
  6784.   )
    : m" l4 K. M1 H% l$ Q% |& `! b. X2 |
  6785.   (defun xclip ()4 Z. T' s9 ~  T. s
  6786.     (setq xclipmode t)8 Y7 o* ~5 H9 A& r! _; d
  6787.     (if (= xcliponoff "1")
    9 T5 T4 D1 N9 c% y1 x. N6 I
  6788.       (command "_.xclip" (cdr(assoc -1 elist)) "" "_on")
    2 I8 t4 ^; L$ d/ H
  6789.       (command "_.xclip" (cdr(assoc -1 elist)) "" "_off")
    7 ?. E8 ?! T4 |# F: r% G9 K
  6790.     ): P, B; N2 J$ n3 R  q
  6791.   )
    7 P# ?7 K7 Y' o+ N
  6792.   (defun ver_rad (value)" e) w+ c" j- e; v% v( ~& j7 O
  6793.     (if (setq radius (verify_d "radius" value radius))
    0 S8 i/ L$ A# F" k' n
  6794.       (calc)3 i& O* X  ?6 ~% d
  6795.     )* J7 U4 W  J% N; h
  6796.   )
    6 @9 J; Z+ U% w/ x) d
  6797.   (defun ver_majrad (value)7 ~! u9 E3 n" P* \. D  l  l: |
  6798.     (if (setq majrad (verify_d "majrad" value majrad))9 R& ]4 J) J7 K4 R
  6799.       (ell_calc_newval "majrad")# Z+ ]( [# u" P) ~& e
  6800.     )+ I/ X$ S( M. E3 Q) Q2 \
  6801.   )
    9 ~! M# V! s  `1 T" L
  6802.   (defun ver_minrad (value)
    . m( @3 d$ t( K% p- W9 S! @2 e
  6803.     (if (setq minrad (verify_d "minrad" value minrad))
    + D, r6 ]0 u/ T: U+ E  G4 o& O
  6804.       (ell_calc_newval "minrad")
    3 m3 a  i$ b1 |, ?! O
  6805.     )5 y; b& L4 F0 g. X! b5 Y+ \- z
  6806.   )( K9 i& T+ q: m. h9 q
  6807.   (defun ver_hght (value)
      W3 H4 z; D2 k/ u% q
  6808.     (setq hght (verify_d "hght" value hght))
    4 x. a7 `. J1 d( b7 U
  6809.   )1 R3 s1 _+ v* w" G6 y! A
  6810.   (defun ver_wid (value)8 ?% }& ?7 O7 n  Z
  6811.     (setq wid (verify_d "wid" value wid))
    4 y+ x  R1 N/ X' t* q
  6812.   )
    / n/ l2 p: F6 m( ~5 k  |
  6813.   (defun ver_xline_x1 (value / temp)( A2 i7 ]$ w, \% L
  6814.     (setq temp xline_x1)
    5 R9 k5 }4 o& O7 r' v; {  @! b* t
  6815.     (setq xline_x1 (verify_xline "xline_x1" value xline_x1))5 f6 Q. z* G$ O; k
  6816.     (if (/= temp xline_x1)
    6 D" u$ r3 Q) u5 ~! q; T+ e9 q
  6817.       (progn (modify_xline 0) (set_tile_dirv) )' C7 z$ s5 e; l$ W1 C' j2 d* S
  6818.     )
    / [* {8 k6 i& y/ J/ k$ ]$ j
  6819.   )$ p7 O- {" V5 [/ J2 D. @
  6820.   (defun ver_xline_y1 (value / temp)6 E2 L! ~* ]# t' h2 W0 g
  6821.     (setq temp xline_y1)2 {, d4 K! o% I  {' t  w
  6822.     (setq xline_y1 (verify_xline "xline_y1" value xline_y1))) }0 `' Q( s/ E# N
  6823.     (if (/= temp xline_y1)3 p: R" W! D( F
  6824.       (progn (modify_xline 0) (set_tile_dirv) )0 t9 j+ F& s) z+ V# R9 W
  6825.     )
    ' |6 H& x; y/ v5 }9 u  i, d
  6826.   )
    ' }- L% U- ]% h8 y3 k# d
  6827.   (defun ver_xline_z1 (value / temp)
    / O* A0 S1 J  r
  6828.     (setq temp xline_z1)+ K: x$ o: w! k7 t! ?9 S
  6829.     (setq xline_z1 (verify_xline "xline_z1" value xline_z1)), a" [& y) m4 Z+ W7 M
  6830.     (if (/= temp xline_z1)
    - W4 g4 w; }/ f4 a2 y# G3 b
  6831.       (progn (modify_xline 0) (set_tile_dirv) )/ r% ?( o8 r( u3 U/ P2 m, K
  6832.     )/ F" ]5 k! K0 u
  6833.   )
    0 f/ ?: D, T9 c2 V6 [8 K
  6834.   (defun ver_xline_x2 (value / temp)
    0 J6 H% }0 ~  ]* g6 Q
  6835.     (setq temp xline_x2)
    . t, y* K; h6 A, v* r
  6836.     (setq xline_x2 (verify_xline "xline_x2" value xline_x2)), G) J/ Q' G% x" l
  6837.     (if (/= temp xline_x2)
    + S; E" t9 A! l! r, T$ a
  6838.       (progn (modify_xline 0) (set_tile_dirv))9 L9 y4 Q* p$ [" [7 I
  6839.     )& P: D4 j1 S1 O% h# x
  6840.   )
    1 y+ q3 m) ]/ g6 ~+ V; f* ?8 _( t! P. l
  6841.   (defun ver_xline_y2 (value / temp)
    # C3 Y  t' E4 w% s, X0 R( P, M+ ~% D
  6842.     (setq temp xline_y2)
    6 C* G( g& W% h
  6843.     (setq xline_y2 (verify_xline "xline_y2" value xline_y2))' i" J3 G, k  P- B! O$ A# K+ B
  6844.     (if (/= temp xline_y2)
    ) ]0 k: v" j* S; E/ O& d- X8 z! N
  6845.       (progn (modify_xline 0) (set_tile_dirv) )
    * t! M% \, w5 I1 e
  6846.     )$ ?4 s+ P6 o) ]/ z; G+ ~
  6847.   )6 a' K7 \( t6 A5 o/ }  s5 r
  6848.   (defun ver_xline_z2 (value / temp)
    / C% z8 C1 r5 I* ^7 y. D
  6849.     (setq temp xline_z2)
    9 j$ K& ^" C5 k( X1 |! F/ l
  6850.     (setq xline_z2 (verify_xline "xline_z2" value xline_z2))
    3 E( j# ?' L- W9 q- l
  6851.     (if (/= temp xline_z2)
    9 q- ~) K1 g: k! J$ a
  6852.       (progn (modify_xline 0) (set_tile_dirv) )
    4 t! b* R; O8 E9 p3 Z, ~+ f
  6853.     )
    ; [7 F" p! G$ _; t' C
  6854.   )2 O3 b( `$ u$ i# v' m+ ]% |
  6855.   ;;" ?, p' Z3 U' G/ |- x
  6856.   ;; Functions that verify tile values for angles
    7 B* n$ n* a7 T( l
  6857.   ;;7 u" u$ Y7 ^3 }+ J* s% _' t; B
  6858.   (defun ver_ang1 (value)6 P# W( i1 D7 h  c& Z* A
  6859.     (if (setq st_ang (verify_a "st_ang" value st_ang))
    ! _5 d3 L' V$ V6 Q! z4 r
  6860.       (calc)
    7 r# d) ^- ]  E" z4 w. x
  6861.     )
    + c. v2 f- O7 F
  6862.   )) s! P8 N& J  o* B& b
  6863.   (defun ver_ang2 (value)# t; X6 r, c6 H1 F9 {; W  x
  6864.     (if (setq end_ang (verify_a "end_ang" value end_ang))
      \% N3 U2 C$ s7 X" U: }* Q* r
  6865.       (calc)
    " G( c  R/ r4 U" S  |
  6866.     )
    % A  _* c- \* f& W
  6867.   )! E8 l- _7 G7 C4 {. r( }  X: `
  6868.   ;;4 |3 P. k% ?, ~0 g( O3 f" a
  6869.   ;; Verify tile value for ellipse end angle. Handled slightly
    " d3 q) D9 _* I8 h" ~
  6870.   ;; differently than the other angles.# t- P8 h& d& \8 |. ~1 y5 d
  6871.   ;;8 y% y) m* o$ P# I9 ]7 x
  6872.   (defun ver_eang (value)
    / m; U& h8 ^3 F' W
  6873.     (setq end_eang (verify_ae "end_eang" value end_eang))' n, ]& Y, Y' }2 A9 `
  6874.   )
    8 U2 i6 \5 c3 _$ A+ P& n+ o  P% n
  6875.   (defun ver_rot (value)$ M# K* [* _$ t. T4 X
  6876.     (setq rot (verify_a "rot" value rot))
    6 A5 i4 v9 f3 K5 H. _2 [- U
  6877.   )
    7 `8 g  B9 K0 ]* v  S
  6878.   (defun ver_obl (value)
    % T9 r% z5 T7 D9 V* V, r/ t
  6879.     (setq obl (verify_a "obl" value obl))/ ]' a7 ~# U- b- {" g
  6880.   ); A: M( S+ R# o; z) D2 q1 `
  6881.   ;;1 N' q3 h5 M5 l3 Q4 }
  6882.   ;; Function that verifies attribute tag field for null string,- i# U2 q. W8 Y9 t/ i6 i3 N- X
  6883.   ;; or a string that contains one or more spaces.  Tile value
    % _2 a1 v% e: |
  6884.   ;; is also converted to upper-case as well.. p7 I# x/ f8 n- `( {$ |+ s  f5 ^1 ]# T
  6885.   ;;
    , S- P/ F4 T- v) @6 i  ^
  6886.   ;;
    " a5 B# E1 r# x: W, r
  6887.   (defun ver_tag ( / tval)
    7 y* n, d& n- p9 a. w- T3 g
  6888.      (setq tagval (get_tile "tag"))8 l# \' W* O2 c5 s2 d* f
  6889.      (set_tile "error" "")
    0 C  a$ x% S* Q! s- z
  6890.      (cond
    8 E# p, m  N( k6 ~& q
  6891.         (  (or (eq "" (setq tval (strcase (ai_strtrim tagval))))
    3 F. ]8 n$ y# c- V; m
  6892.                (wcmatch tval "* *"))3 ]5 J% \) ^# a: l4 j1 M9 ]4 G' g
  6893.            (set_tile "error" "Invalid attribute tag.")
    2 n* D9 s" M* F: Z: C& W' f  P
  6894.            (mode_tile "tag" 2)
    4 C! N1 x: B  g8 o, {2 O+ h- V0 \+ ~
  6895.            (mode_tile "tag" 3)). [" b( a1 i9 w
  6896.         (t (set_tile "error" "")$ P: m. e: F  M% w
  6897.            (set_tile "tag" tval)5 X9 e+ W& L) P: p8 z  ]
  6898.            (setq attag tval)))
    9 e0 y% H9 _9 j9 G
  6899.   )2 ~. }, ~! e  _% N( `0 c, t
  6900.   ;;
    9 _( G& W% n$ w4 ~- B5 B
  6901.   ;; Calculation functions8 @2 `$ c6 o9 v9 l7 D8 M
  6902.   ;;$ G2 p. w2 f: w  l
  6903.   (defun calc (); v% Y. f, ^* p0 f0 H7 K
  6904.     (if (= etype "LINE") (line_calc))
    5 k1 ^- k. E: B4 l7 h
  6905.     (if (= etype "ARC") (arc_calc))
    # Q) z. r# I' W* p
  6906.     (if (= etype "CIRCLE") (cir_calc))
    ! B5 C5 L  S7 o
  6907.   )
    - {0 L* g0 O2 e$ }: c
  6908.   ;;
    8 E$ e) x0 ?' J% y# @0 p
  6909.   ;; Calculation functions for lines, arcs, and circles7 W' l; X" ~6 a% s% v% K2 p5 x
  6910.   ;;) ^$ p0 o# u7 H& T+ |' D# e6 S1 ], {
  6911.   (defun line_calc ()8 [7 k& Y% K! c: U% \, y/ q7 H
  6912.     (setq stpt  (list x1 y1 z1))
    0 M* P; E0 z( T9 n2 U. C
  6913.     (setq endpt (list x2 y2 z2))
    , h( [, }) y/ d  l9 l% B& \
  6914.     (set_tile "delta_x" (rtos (- x2 x1)))
    - ?" y" F$ i, Z, S( t, @0 F+ J
  6915.     (set_tile "delta_y" (rtos (- y2 y1)))
    9 s% L5 g; L" v' e7 N/ D0 j; L1 i
  6916.     (set_tile "delta_z" (rtos (- z2 z1)))1 U1 m5 [* e+ X( J% \+ a9 ]" C- O% e
  6917.     (set_tile "l_length" (rtos (distance stpt endpt)))3 W/ \- S1 K/ Z6 ]2 k  @, R  j( j
  6918.     (set_tile "l_angle" (angtos (angle stpt endpt)))
    : }, I$ V2 J0 W  T
  6919.   )
    ) `/ l# E1 x+ n

  6920. . J; v2 {/ z! M6 ?- r
  6921.   (defun cir_calc ( / area units)
    % r0 C* h; M+ m* n
  6922.         (setq radtest radius)
    ! U# L: O/ W/ N* z9 Q
  6923.         (set_tile "Dia" (rtos (* 2 radius)))
    1 P& n! }: P5 P5 y& M" u, q% ~
  6924.         (set_tile "Circum" (rtos (* 2 pi radius)))9 }' e2 J1 G7 v% @" Z
  6925.         (setq area  (* pi (* radius radius))); m3 I9 M$ d; Z
  6926.         (setq units (getvar "LUNITS"))$ O% b. D; h& _% Y
  6927.         (if (or (= units 3) (= units 4))( N: w. w' s! r% Z( s
  6928.             (progn
    7 n4 D1 G4 U4 ~+ d/ L& q
  6929.                (setq area (/ area 144.0))
    2 a0 E# f: `( z, g, a8 y
  6930.                (set_tile "Area" (strcat (rtos area 2) " square ft"))& d  Z# u/ U& }- m! n
  6931.             )
    - C/ V* l+ _# r; ^! D& M% D  u
  6932.             (set_tile "Area" (rtos area)), c1 Z) a/ P( R* W' c; M4 J- g
  6933.         )
    . ^8 P$ {+ t- o. i0 p  Z1 u
  6934.   )- @2 Z, K" m+ W8 N

  6935. + b3 C2 `' Z1 L8 f0 D
  6936.   (defun arc_calc ()
    ) j% d9 \# V' B! w& U6 j- [0 ]
  6937.     (setq totang (- end_ang st_ang))
    & M( G9 p- o" M1 O# T+ l6 Y
  6938.     (while (< totang 0)) f2 A, ]9 o& g. H+ ]
  6939.       (setq totang (+ totang (* 2 pi)))1 a& r" a. G5 B
  6940.     )
    + _6 m( z1 K& V
  6941.     (while (> totang (* 2 pi))
    + P- r% v$ |4 R6 R
  6942.       (setq totang (- totang (* 2 pi)))
    + P1 d* v4 \8 P: o0 j& V- E9 H
  6943.     )
      x+ z  N- \6 [( `/ u1 @% V& j
  6944.     (set_tile "tot_angle" (angtos totang))' g; ?  G6 Z3 `% q: U
  6945.     (setq arclen (* (* 2 pi radius) (/ totang (* 2 pi))))3 L* f2 h' B3 p, o* P8 x
  6946.     (set_tile "arclen" (rtos arclen))7 {# u1 s6 C5 A) T) v3 r1 S
  6947.   )
    # ~8 s9 C' }! o* z
  6948.   ;;! O2 T( |- X& P
  6949.   ;; Calculate the major radius, minor radius, major axis direction.0 M& T* u& Y0 x% K
  6950.   ;; Get radius ratio. Convert Start, end parameters to start and end
    1 P4 G1 S9 W/ S8 o* i
  6951.   ;; angles. Save Major Radius value in "old_majrad" in case the user
    4 [7 s3 o( A! R# g+ f
  6952.   ;; chooses to input a new Major Radius value later. It's needed to
    ! w' U% c, k! c4 d: T5 q& W
  6953.   ;; calculate a new Major Axis Vector value.
    3 C2 s5 {# ^: }+ c8 O% I, E: B
  6954.   ;;, v3 `8 X9 _1 @9 E3 }8 N
  6955.   (defun ell_calc ()  n' m# }1 y) @: g0 c; J
  6956.         ;; Get major radius from the major axis vector.
    6 F1 ^& f+ A4 {' O' l
  6957.         (setq majaxis (cdr (assoc 11 elist)))8 b/ V9 {, J2 D( `
  6958.         (setq xx (car majaxis))
    . @1 b- m1 Y# f
  6959.         (setq yy (cadr majaxis))
    / W6 ]6 }' ^2 f+ z
  6960.         (setq zz (caddr majaxis))$ J4 R) V/ t- A1 f/ s- K
  6961.         (setq majrad (sqrt (+ (* xx xx) (* yy yy) (* zz zz) )))- N# Y: t* E$ V* Q. ?, {! ~
  6962.         (set_tile "majrad" (ai_rtos majrad))% ?. s' p' l% ^7 U2 g/ W
  6963.         (setq old_majrad majrad)
      e$ h$ m4 M' |% F# X8 S2 b
  6964.         ;; Get radius ratio) w% Q$ h& t" b* w- Q# i
  6965.         (setq rrat (cdr (assoc 40 elist)))
    - t# ^2 q  O; y. }
  6966.         (set_tile "rratio" (rtos rrat))) a# t: V5 t1 F2 x; O7 {
  6967.         ;; Calculate minor radius
    # f7 E4 v* I4 h4 X  ~# d' ~* ]" l6 Q+ o
  6968.         (setq minrad (* majrad rrat))! f3 _) \1 `% P  o6 S7 r& m
  6969.         (set_tile "minrad" (ai_rtos minrad))
    9 p3 L1 k4 U# m& b
  6970.         ;; display major axis vector: V, c  _" b) u7 V# R* d2 O
  6971.         (set_tile "Majraddirx" (rtos xx))
    0 L8 G4 }' @: P
  6972.         (set_tile "Majraddiry" (rtos yy))3 C1 ?/ ]2 G% Z
  6973.         (set_tile "Majraddirz" (rtos zz))7 ~! r$ ~' f) y  Q8 I# T

  6974. 6 k" Y, }1 D" C6 _, Z
  6975.         ;; Convert start parm to start angle1 j. I8 Z3 }  e
  6976.         (setq stparm (cdr (assoc 41 elist)))
    % X. y: N' Q8 L  c9 E2 L, H1 d7 Q$ S
  6977.         (setq vecx (cos stparm))
    , S+ S+ r5 r; u, V, M! o4 o
  6978.         (setq vecy (sin stparm))
    0 b  a' d5 [2 n/ z1 W
  6979.         (setq st_ang (atan (* rrat vecy) vecx))  \7 c, ?  ?' Q$ i# {
  6980.         (setq tempst_ang (ai_angtos st_ang))
    1 e. V0 @  S4 v" V# z
  6981.         (set_tile "st_ang" tempst_ang)
    0 |) h7 V4 Q9 d$ C* K' n
  6982.         ;; Convert end parm to end angle. If end angle evaluates to 0
    7 E( J' o3 Z4 K! Z" M! b' f
  6983.         ;; degrees then display it as 360 degrees.
    $ M- g6 R+ x0 H5 b0 e- z, F5 k
  6984.         (setq endparm (cdr (assoc 42 elist)))
      m3 H% k" Y: I. D* h- j; D
  6985.         (setq evecx (cos endparm))( Q" W6 b* w3 @' Q  f8 m0 ?& `# ]
  6986.         (setq evecy (sin endparm))
    6 r: T% R7 x" i( s+ M3 a3 u3 j
  6987.         (setq end_eang (atan (* rrat evecy) evecx))
    2 ?2 g2 k+ Q# g9 w5 ]
  6988.         (setq tempend_eang (ai_angtos end_eang))5 @5 O7 D! H) ?% M* d
  6989.         (if (= tempend_eang "0")# X! K* }6 o) d! `% J/ H7 }9 \; Q, B
  6990.             (set_tile "end_eang" "360")
    " D) ~8 W/ B- l1 L* u6 L
  6991.             (set_tile "end_eang" tempend_eang)
    ! {) j# o$ n7 T7 N- }
  6992.         )
    / F1 K* h- {: g( M! S
  6993.         ;; Get area of the ellipse.
    2 ?' g* e4 t( O( p
  6994.         (ell_calc_area)
    ! _$ I( v# {) W* m5 o6 n
  6995.   )
    + k5 H1 d' V6 ?: f- m% L1 m
  6996.   ;; Calculate area of ellipse. If it is an arc then
    ) G5 L+ X! \" M0 o/ O5 a4 D2 ?/ E
  6997.   ;; grey out area display.
    . g) l" _( @7 \. F7 [
  6998.   ;;
    ' q( L1 W0 R* A' v- v
  6999.   (defun ell_calc_area ( / area units)
    7 Z5 ~' f5 H8 x- C
  7000.      (if (and (= tempst_ang "0") (= tempend_eang "0"))
    ) F# R6 p; Y! C1 \  A
  7001.          (progn
    2 ?- H5 B: _3 z* G' B8 X- T
  7002.              (setq area  (* pi majrad minrad))8 ~! Y* j, X* L0 r/ }. z
  7003.              (setq units (getvar "LUNITS"))
    , G6 [9 J: A7 l! r! U
  7004.              (if (or (= units 3) (= units 4))
      F# I6 i+ @3 j, J" W% |1 O
  7005.                  (progn
    - c  v; R$ i' A! [
  7006.                      (setq area (/ area 144.0))
    ( `0 F6 K& l) }/ d% v9 x" L
  7007.                      (set_tile "Area" (strcat (rtos area 2)" square ft"))# h4 ^9 x' n$ F1 p, e( v2 l
  7008.                  )
    ) t9 e6 k7 [0 ?" q' ]
  7009.                  (set_tile "Area" (rtos area))
    4 H% [, ]# k0 Q% ?
  7010.              )
    6 Z! I( }! O0 _4 v
  7011.          )( y4 f* n6 f( @7 k+ u
  7012.         (mode_tile "Area_text" 1)8 r- E* U, l- j0 w0 U
  7013.      )
    9 r& Y, Y  l  n+ ]% w" ^
  7014.   )2 ^- B, e/ U8 ?/ M4 Q; y
  7015.   ;;& V5 C# J6 X& p! j
  7016.   ;; Calculate new values for ELLIPSE
    ' V* ?% ~$ X5 z. s5 J+ P4 o
  7017.   ;; Minor Radius, Area
      }9 e6 t3 K6 E0 R: P- X9 E
  7018.   ;;( b% i2 G0 ^+ J4 P
  7019.   (defun ell_calc_newval (ell_tile)
    ! K6 F3 H' b3 t( M1 O$ I
  7020.     (if (= ell_tile "majrad")
    1 Z4 X! p" }2 A* n% p* F
  7021.       (progn
    ; F8 y% l) q* C  q
  7022.          (setq rrat (/ minrad majrad))
    5 r. b3 o' g5 `/ o8 L( i- h( J
  7023.          (set_tile "rratio" (rtos rrat))3 I2 f( T3 {% X( f2 H
  7024.          (ell_calc_area)
    , J) E) x1 V9 P
  7025.       )
    4 J) V4 d8 U5 P7 J  t- e3 t
  7026.     )
    9 W' ?% w! |  G# b
  7027.     (if (= ell_tile "minrad")
    ! D0 Q5 B' V& X- \
  7028.       (progn4 t) R' c# C7 `6 z$ s: q8 {
  7029.          (setq rrat (/ minrad majrad))
    0 ~) l2 _: ]/ o( o: q- D
  7030.          (set_tile "rratio" (rtos rrat)), B) a4 m7 k8 F* N! p
  7031.          (ell_calc_area)) s& ?, I% W3 G( S
  7032.       )
    . q8 H- E: u3 O7 ~8 ~9 ^( v4 v
  7033.     )
    ' O/ [) [, w7 {  n
  7034.   )
    + s4 I5 u# j2 H6 f+ h1 O
  7035. % @( X  h) Z7 ~( e
  7036.   (defun set_dimen_props (/ loop a stl txstyname)
    2 x% G% t# \2 H% |, I6 X
  7037. $ O' ^9 T# s$ N* F: X4 b; }+ P
  7038.     (setq stname (cdr (assoc 3 elist)) ; get style name
    ' s9 ]# `: O/ Z' C
  7039.           stl (tblnext "DIMSTYLE" T)" l. f4 Y5 c/ G, B$ e' m
  7040.           stlist nil)' O" X8 r4 I" E  G8 y
  7041.     ;; Get all style names and list them in alphabetical order
    $ o, z1 p* `: g8 |' U. j
  7042.     (while stl9 m8 F5 V8 a+ @0 B6 Y1 L
  7043.       (setq sname (cdr (assoc 2 stl)))  n& H7 Y3 u2 C" }/ }  y
  7044.       (if (/= (logand 16 (cdr (assoc 70 stl))) 16)
    0 P! q  K7 o2 H7 N
  7045.            (setq stlist (cons sname stlist))), j+ S' J2 Q! n' Z! p
  7046.       (setq stl (tblnext "DIMSTYLE"))): x" S: G7 p( k9 z% d) U: ~
  7047. 3 T" m( I5 d1 @6 T0 I  {5 F
  7048.     (setq len    (length stlist)
    0 l% S, O. d! _) F7 [: l1 D
  7049.           loop   0, x! k4 Y: k2 O2 K
  7050.           dimsty stname
    % R# N: x: E* r0 A- j  G
  7051.     )
    2 n' O/ O5 E5 s1 J
  7052. 2 e# o% |5 E2 Q& _
  7053.     ;; alphabetize style list, depending on maxsort# ~1 ^4 i. _6 }+ ^# a' f
  7054.     (if (>= (getvar "maxsort") len)9 ]; Q6 _* m* Z! z7 w% I/ \# d: a4 S
  7055.         (setq stlist (acad_strlsort stlist))
    / X5 l" k2 s/ m/ i
  7056.       (setq stlist (reverse stlist)))
    $ u7 x- w& c6 x' ?
  7057. 6 V9 y5 t5 Y5 ?% a' J' N# m9 e
  7058.     ; *UNNAMED style (dimsty = nil at this point) is replaced with
      _7 M0 q( y4 y. @1 k& u$ Q
  7059.     ; the current style.  After R13, we require dimensiosn to have a
      C6 B- |1 n. }
  7060.     ; dimstyle, so we plug any holes where we find them.
    / G0 E# }4 M' `9 N/ l  ?6 Y
  7061.     (if (null dimsty)5 R  g; N9 @% [$ K3 D
  7062.       (setq dimsty (getvar "dimstyle"))$ Z8 [* c& U2 G4 V& A9 N# r
  7063.     )+ X! c$ S8 p2 V
  7064.     ; Show the styles in combo box4 n2 u7 `6 m; e$ }! P" b
  7065.     (start_list "mod_style" 2)- o3 Z( s0 P( M
  7066.     (while (< loop len)1 N; `8 {# J( M* v) {
  7067.       (add_list (nth loop stlist)), x, f& F  t0 L0 f
  7068.       (setq loop (1+ loop))
    8 b* L6 u  K6 o9 i4 m# o/ R
  7069.     )
    " Z9 f' A7 _, l& `$ G+ o

  7070. 6 `, q9 Q8 V8 x% D* D+ E# I
  7071.     (end_list)
    2 Q1 d/ Q; d( S
  7072. ) G) `' f5 H* h7 l& n! [- d+ h1 \7 [
  7073.     ; Hilight the style name of the selected entity  W  Y/ y. i: d/ N) s1 H' e8 n( u+ n
  7074.     (while (and (< 0 loop) (/= dimsty (nth loop stlist)))
    / W  Q. p' `& x( i7 p1 r+ d( b
  7075.       (setq loop (1- loop))
    ( e( D" c9 V# \; e
  7076.     )
    % z$ f2 C6 Q6 r1 T! _
  7077.     (set_tile "mod_style" (itoa loop))
    0 n+ w" t" h3 J  K

  7078. ) x& x( a: k0 P5 t0 [) v
  7079.     ; The following is the list dimvars. It must be sorted in the same9 s: d! I/ x% \
  7080.     ; order as the resfub returned from DDIM (ADS module)./ y" U8 e! J+ g1 i

  7081. 7 D* C$ S" m* o: V0 O" h
  7082.     (setq dimtbl (list "DIMSTYLE"  "Style name"  "Standard flag values"4 r" o; c) f! g( f
  7083.         "dimpost"   "dimapost"    "dimblk"    "dimblk1"    "dimblk2") R  m% i& `* e8 |2 Q! _' C
  7084.         "dimscale"  "dimasz"      "dimexo"    "dimdli"     "dimexe"
    - H% s% V  J" G+ D6 [* h
  7085.         "dimrnd"    "dimdle"      "dimtp"     "dimtm"      "dimtxt"
    : \4 {/ o+ T& a( ~
  7086.         "dimcen"    "dimtsz"      "dimaltf"   "dimlfac"    "dimtvp"2 K' x8 _6 ^! I2 X0 _
  7087.         "dimtfac"   "dimgap"      "dimtol"    "dimlim"     "dimtih"8 I4 J+ m& m/ F/ ]! z9 B- S) G1 F
  7088.         "dimtoh"    "dimse1"      "dimse2"    "dimtad"     "dimzin": P7 k4 u1 [" R& e3 m& |* e' f9 i
  7089.         "dimalt"    "dimaltd"     "dimtofl"   "dimsah"     "dimtix"
    - k3 d/ a. e8 A- |. ?. y
  7090.         "dimsoxd"   "dimclrd"     "dimclre"   "dimclrt"    "dimunit", B7 c" Q8 b6 G; a! c
  7091.         "dimdec"    "dimtdec"     "dimaltu"   "dimalttd"
    7 h/ D. P1 u4 }  q. N! i
  7092.         "dimaunit"  "dimjust"     "dimsd1"    "dimsd2"     "dimtolj"
    6 c/ V' ^2 r- C' Z4 A
  7093.         "dimtzin"   "dimaltz"     "dimalttz"  "dimfit"     "dimupt"
    & G& U) X6 h: v' s$ W+ V7 ]% T
  7094.         "dimtxsty"
    4 K5 z3 X$ x8 ?; ~* O$ `6 I# ?
  7095.     ))8 X5 Q+ O7 Q! p7 l- S* L4 I
  7096.     (progn" M7 z* c  }# }1 |, T7 e
  7097.         (setq sv_dvlist (ddimen_getostate dimsty)
    ! P! b& H8 r& k0 \8 D4 N
  7098.               txstyname (assoc 340 sv_dvlist)% h5 c8 i' ^* p7 U; a# c
  7099.               sv_dvlist (subst (cons 340 (tblobjname "STYLE" (cdr txstyname)))
    ; C$ r8 P8 v$ L6 L- s. A
  7100.                                 txstyname sv_dvlist), ~* v$ m. d5 e5 c
  7101.               dimlist sv_dvlist! V9 \3 L7 a- i% L; l
  7102.         )) O* d7 A% `  Y/ T2 A- [) m
  7103.     ). n3 C0 ?; i1 {; c2 c9 u
  7104.     (if (= dimtype "DDLEADER")
    " ~/ N9 U9 q3 a. K' b( A
  7105.       (mode_tile "mod_format" 1)
    & k- y/ z. A( m7 {
  7106.     )8 W' l( K: j, p7 s4 e% ?
  7107.     (action_tile "mod_style" "(setq dimsty (ddimen_style))")4 F/ V; z7 s" {- H' }
  7108.     (action_tile "mod_text"  "(done_dialog 4)")" o" v) T# o+ \) j- P( `/ |) s
  7109.     (action_tile "mod_geom" "(setq dimlist (ddimen_dlg dimtype 11 dimsty dimlist))")
    - t. N, X) q: }* A
  7110.     (action_tile "mod_format" "(setq dimlist (ddimen_dlg dimtype 12 dimsty dimlist))")! p: p/ J5 z# d: K  b! w, H
  7111.     (action_tile "mod_annot" "(setq dimlist (ddimen_dlg dimtype 13 dimsty dimlist))")6 y5 j  N" M" x6 M; M. N& _# R
  7112.     (action_tile "accept" "(done_dialog 1)")* m& |  r/ G8 v% E; b8 w. C& ~  M. _3 y
  7113.   )
    4 S1 E  I1 Z8 n, d. t2 }
  7114.   ;;8 x$ _! j. i: C2 Q4 T5 p
  7115.   ;; Get dimvars that have been restored.3 U$ ?& b, [+ @8 L7 ?4 f5 g
  7116.   ;;" \- t% T! J/ {# a4 f( _' B$ S% e
  7117.   (defun ddimen_getvars (/ elm dvlist dv i)
    - @& o1 j8 c/ }; @' u# J. W8 M
  7118.     (setq i 3( m$ i$ X" U( ~' p7 C/ c; V9 A  P
  7119.           dvlist (list (cons 0 "DIMSTYLE")) K1 I- I) a  n% t
  7120.                   (cons 2 (getvar "dimstyle")) (cons 70 0)): R; c4 f; g& H5 a9 R
  7121.     )
    8 k+ C0 O* f) o1 H7 v
  7122.     (while (setq dv (nth i dimtbl))
    8 b' G0 |9 h, G0 d- e
  7123.       (setq elm (getvar dv)
    6 m) S3 k/ _" f$ I$ W. |
  7124.             dvlist (append dvlist (list (cons dv elm))): ~; B% ^) o: L! h7 [3 \
  7125.             i (1+ i)7 r/ W, p- U7 u0 |! a: H
  7126.       )8 i- @. J4 G" M$ {. f
  7127.     )( H7 G) ^( f1 u
  7128.     dvlist4 |* K9 l  b2 o8 I
  7129.   )
    2 b8 p3 T* |+ K. `" d1 o4 l

  7130. 2 g% M  l) o  k3 ?' t5 t% T
  7131.   ;;$ P9 L* W# f- m% W; x6 U
  7132.   ;; Get the original states of dimvars. This is for DIMENSION entities.
    + S) C4 U7 V6 \* D/ y2 x# `
  7133.   ;;
    , @; |% u$ S" x- y$ V
  7134.   (defun ddimen_getostate (dimsty / dvlist elm i dvvars)
    2 G4 J3 @' A' \0 y' ]
  7135.     (setq dvlist (tblnext "dimstyle" T) ; Get a skelton list
    & ?. O! H; z3 A3 D! a! W- \" [/ [  ~
  7136.           dvvars (ddimen_getvars)       ; Get dimvars for that entity# J9 M* r7 E7 {4 m' G5 \
  7137.           i 1* F+ f/ S- O1 E4 p" x
  7138.     )
    ) t, q( Z$ Q9 C" @+ [
  7139. 0 ~; p& k' u: ?
  7140.     ; Create a list that contains values of the selected entity.# |4 q# U/ q" V5 Z' A% T" K

  7141. % E$ |# l/ z& C2 W
  7142.     (while (setq elm (nth i dvlist))
    1 Y& f5 d: q* {
  7143.       (setq dvlist (subst (cons (car elm) (cdr (nth i dvvars))) elm dvlist)' ^+ q9 F) y% o9 Y0 a3 T  t0 q* L
  7144.             i (1+ i)
    7 {% b0 @4 J. ~) l: S4 K* V1 f
  7145.       )' d3 r4 q0 p2 C( j4 D
  7146.     )
    - I3 O' p0 l5 F5 j( j0 m
  7147.     dvlist
    $ V) Y  G4 I6 B2 \( V: b# I
  7148.   )6 L; i9 B* t% I* ]
  7149. 4 Y" Q+ t' J9 ?( s& U1 m
  7150.   ;;
    3 L9 F( R0 Z* }
  7151.   ;; Restores dimvars of the selected enity.
    7 c% b' {# m# c8 K: t$ L
  7152.   ;;; I* K( ~& w! y: z7 w
  7153.   (defun ddimen_dimsty_restore(/ dimtbl dimsvcurset en)7 U/ r" U8 }. W. X" Z) M% O
  7154.     (setq dimtbl (list "DIMSTYLE"  "Style name"  "Standard flag values"0 t: A; z" [+ K% ^4 w+ M
  7155.         "dimpost"   "dimapost"    "dimblk"    "dimblk1"    "dimblk2"3 q# ~& C' T, a5 R
  7156.         "dimscale"  "dimasz"      "dimexo"    "dimdli"     "dimexe"
    ) p4 `: o* z- W( u- Z
  7157.         "dimrnd"    "dimdle"      "dimtp"     "dimtm"      "dimtxt"
    # ~& ]3 |$ e8 i/ I& q7 S
  7158.         "dimcen"    "dimtsz"      "dimaltf"   "dimlfac"    "dimtvp"+ Y2 }! i5 ^$ `- n# \. F8 J
  7159.         "dimtfac"   "dimgap"      "dimtol"    "dimlim"     "dimtih"7 a9 W! `, `8 T: [* n3 F8 n2 N
  7160.         "dimtoh"    "dimse1"      "dimse2"    "dimtad"     "dimzin"
    $ a0 Q4 `, e$ T* u6 x+ b% K
  7161.         "dimalt"    "dimaltd"     "dimtofl"   "dimsah"     "dimtix") {0 N0 N/ e+ H* |
  7162.         "dimsoxd"   "dimclrd"     "dimclre"   "dimclrt"    "dimunit"  ]  ^1 U5 }$ V5 p
  7163.         "dimdec"    "dimtdec"     "dimaltu"   "dimalttd"
      D* q9 m( F' _1 O% t
  7164.         "dimaunit"  "dimjust"     "dimsd1"    "dimsd2"     "dimtolj"
    ( b; p/ M% F8 C2 q2 T* V% S+ g# m
  7165.         "dimtzin"   "dimaltz"     "dimalttz"  "dimfit"     "dimupt"4 {7 S4 }% G) E) \% M1 F, y: v
  7166.         "dimtxsty"
    ) u1 u( O7 d4 u' {
  7167.     ))
    % L$ v3 L# h% p: z8 d! K, N
  7168.     (setq dimsvcurset (ddimen_getvars))  ; Save current variable settings8 v% b6 ?4 v$ ]% w: K5 }
  7169.     (progn
    0 [( z) x4 w7 Y; ]
  7170.         (setq en (cdr (assoc -1 elist)))
    . m3 a7 t. x$ z% m5 I
  7171.         (command "_.dimstyle" "" "" en)
    4 W; W4 \6 Z3 N: b- G8 m3 P
  7172.     )
    & P! [* j4 w1 e6 ^- m
  7173.     dimsvcurset
    " F$ j1 G' ^! p8 E) L$ J
  7174.   )  x# Q" J" _7 A  Y) x! @2 O* G7 U% w$ P% D
  7175.   ;;
    7 Z5 W/ ]. d! I6 [8 S' W, t
  7176.   ;; Modify Leader
    ! v4 t# Q& w- _) ~3 e
  7177.   ;;. E. _3 F8 e3 f  J6 l& x
  7178.   (defun ddleader (/ dtypebit blkname bename sublist a  stname n dimtbl
    - e( q, p% g7 L# L: k# v9 N( z
  7179.                    dimsty dimlist dimtext svtext dimovr sv_dvlist stlist/ g6 Q0 b$ H- F% F4 I9 K
  7180.                    dimtype dimsvcurset)
    0 s9 X% G0 }4 I, V& K6 l, j8 S6 j5 g
  7181.     (setq dimtype "DDLEADER"
    ! f. D7 h3 G* E/ J2 t- Z) z
  7182.           dimsvcurset (ddimen_dimsty_restore)
    / e; L! [/ j: D. c# _
  7183.     )5 t6 }8 Y7 l+ S4 b8 b$ j
  7184.     (if (not (new_dialog "ddleader" dcl_id)) (exit)). w5 k" Y4 k2 d$ p4 p$ H( k
  7185.     ;; Set initial tile values, w" @; g& S" s& B0 w% W
  7186.     (set_tile_props)
    " W9 t+ s0 A! m; y, x
  7187.     (set_dimen_props)# n; ]4 w  L/ ~
  7188.     (set_tile_handle)* U+ ~1 n$ v. t
  7189.     ;; Define action for tiles
      w; D1 B6 p9 ?. w# ~) h
  7190.     (set_action_tiles)' v2 h% b/ y- D7 g& H9 O$ h. H
  7191.     (mode_tile "mod_text" 1)" n( }+ {  F' g
  7192. - T  J1 L) c  j; @- |0 w) u
  7193.     (action_tile "mod_style" "(setq dimsty (ddimen_style))")
    : X. \: n( H* r2 a8 U4 z! T
  7194.     (action_tile "accept" "(setq leadtype (get_tile \"s-s\"))(setq arrow (get_tile \"arrow\"))(done_dialog 1)")
    ' m' E: s$ k5 ^% q
  7195.     ;; Get ARROW and TYPE.
    ( M( d1 G- x5 F: j% u9 T
  7196.     (if (= 1 (logand (cdr (assoc '71 elist)))) (set_tile "arrow" "1"))/ Q2 v& J8 i5 S* M
  7197.     (if (= 1 (logand (cdr (assoc '72 elist)))); e: o. ]7 v9 d/ T( x9 s# g) @" n
  7198.       (set_tile "s-s" "spline")# S0 s3 [! o& z1 `3 T9 b
  7199.       (set_tile "s-s" "straight")
    ; P/ ^/ X' E0 p1 t2 V0 a5 d6 {
  7200.     )  u! l6 [; v, B% y
  7201.     ;; Start the dialogue.! {$ _5 n: A6 L3 R7 g9 o1 i
  7202.     (setq dialog-state (start_dialog))1 E7 p4 J( ?2 Y: y2 a& B
  7203.     (if (= dialog-state 1)
    0 B, O. T" h7 ?9 ]
  7204.       (progn
    - k3 w9 D6 M. ?- t" `
  7205.         ;; update the style
    ( W5 [0 M- j! |) v( k& Q2 h
  7206.         (if (/= dimsty stname)7 k0 t0 p9 A( s5 Q
  7207.           (progn
    7 s2 N4 h6 {# A% w8 k
  7208.             ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case
    & F  \4 V7 U, X7 y4 ^* B, z
  7209.             ; doesn't have it.
    / t6 B. T8 f5 q6 L
  7210.             (if (null (assoc 3 elist))
      e. R) q) b: M! j
  7211.               (setq elist (append elist (list (cons 3 dimsty))))
    & s( X1 M& U; S" u
  7212.               ; else just replace it.
    5 I+ s7 J# V1 A" H, R' r+ [
  7213.               (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))
    $ w$ [4 U: c1 c* F0 l
  7214.             )4 B' o: S, Q3 n7 W
  7215.             ; refresh sv_dvlist with new dimstyle.# e. u0 l1 A2 v! q
  7216.             (setq sv_dvlist (tblsearch "dimstyle" dimsty))* Z, `# Z, f: Y9 ?8 H& k' k6 {8 Z, _
  7217.           )
    6 w% Y9 m+ Y% B7 Y( y: ^; o
  7218.         )3 s0 m5 m0 ?/ A4 e- G
  7219.         (if (not (null dimlist))   ; attempted to change dimvars1 E" e; h6 ~5 N& }' N  b/ ^+ M
  7220.           (ddimen_complist sv_dvlist dimlist dimtbl)
    8 u4 b% Q) t' J! j2 Q2 @2 r" V
  7221.         )0 ^7 s% D/ u: H% C, ^$ {2 N; o
  7222.         ;; update for ARROW.
    / J  `* c; {3 ?9 B8 n0 n, ]
  7223.         (if (= "1" arrow)8 G* [" ~( {. S; w, E" F
  7224.           (setq elist (subst (cons 71 (logior 1 (cdr (assoc 71 elist)))) (assoc 71 elist) elist)): }6 x. z' h( \" B- S+ ?# U- W- X
  7225.           (setq elist (subst (cons 71 (logand (~ 1) (cdr (assoc 71 elist)))) (assoc 71 elist) elist))  d; P: G9 ^+ Z1 z5 l
  7226.         )
    * `: [- H+ \$ @  a# r8 d0 K( v
  7227.         ;; update the TYPE.9 K  t& v4 r8 u9 O7 i9 v/ a" u
  7228.         (if (= "spline" leadtype)% `) [" g- {$ X  B, W9 j6 H6 p2 \  l
  7229.           (setq elist (subst (cons 72 (logior 1 (cdr (assoc 72 elist)))) (assoc 72 elist) elist))
    / h2 y/ e( M3 T, u1 P
  7230.           (setq elist (subst (cons 72 (logand (~ 1) (cdr (assoc 72 elist)))) (assoc 72 elist) elist))7 s; v! c/ z" m" [* [
  7231.         )$ K1 p. y$ M9 j  h$ o
  7232.         (modify_prop_geom)
    : p3 a1 p/ b( \
  7233.         ;; update the Color3 m  ?9 L  j) E* }4 e3 W
  7234.         (setq elist (subst (cons 77 ecolor) (assoc 77 elist) elist))
    ! X" e7 s6 E' X5 w
  7235.         (entmod elist)! H; }' f7 D( R8 w4 [
  7236.       )" K9 m) L. k5 w, j( A
  7237.     )/ T" K+ a6 t  j1 C: G
  7238.     (ddimen_setvars dimsvcurset)      ; Prepare to exit
    0 Z* N+ `' @0 ]/ J8 ?6 `# j
  7239.   ): i# ^- `) {1 Q+ e4 B
  7240. ) a: J: k( S3 r3 H; z, O1 c% z
  7241.   ;;
    3 r" {* ^4 v5 h+ j5 e5 l
  7242.   ;; Get dimvars of a dimstyle with overrides.
    6 f5 G& c! v3 K5 _! E
  7243.   ;;) h4 H0 e% s% {! O( o, d

  7244. 7 \( I7 h( G+ s
  7245.   (defun ddimen_getdimvars (dimsty / dimovr dvlist elm i)
    1 R; S& d9 f+ j6 v, }9 w% B
  7246. 5 b6 {, F. p+ Z; r$ `
  7247.     ;; Get override information for the specified entity.
    9 k4 w$ j- l& u+ I  E. U7 t- w
  7248.     ;; Leader/Tolerance cannot be restored by DIMSTYLE command, so we6 _6 e* g# n. E% J+ ]- h& b+ N
  7249.     ;; must obtain override information through this tedious operation." @, a- H' U  l+ P. H" C8 F
  7250.     (setq dimovr (car (cdr (assoc -3 (entget (cdr (assoc -1 elist)) (list "*")))))
    0 V. a; D* G" x" ?! l) k; N
  7251.           dvlist (tblsearch "dimstyle" dimsty)
    $ `  G$ K: m  g/ t
  7252.           i 29 K: V4 q' P( M0 K5 h5 R* @
  7253.     )$ C4 F1 o: \/ |8 r8 G- T3 }

  7254. + u( p% q2 L2 X  @* f
  7255.     ; Update the list with overrides if overrides exist.: e' M6 P: \- o4 Y* u3 z* s

  7256. # U  A$ u* Z1 p3 y, g
  7257.     (if (and dimovr (= "DSTYLE" (cdr (nth 1 dimovr))))6 V, l+ o( L. t3 U0 C$ {7 b# d
  7258.       (progn8 p4 Q5 _  j% D0 `  ^9 R
  7259.         (while (setq elm (cdr (nth i dimovr)))1 ^: H& F* I8 W8 T: F& ?
  7260.           (progn
    8 W  \% m8 `+ g4 n/ p0 A/ g
  7261.             (if (or (= elm "{") (= elm "}"))
    ' @" w. Y+ l9 O' I
  7262.               (setq i (1+ i))
    " z, h! `, m( t7 q& A
  7263.               (progn1 G% H* b* u  |2 O* ~
  7264.                 (if (or (and (< 180 elm)0 N. K2 z' \+ N0 }) R
  7265.                              (< elm 190)6 R2 ?4 ?# |9 J
  7266.                         )* }; r4 r1 g. i7 q, X4 p% N
  7267.                         (and (< 80 elm)1 E1 @1 O& g# j( c
  7268.                              (< elm 90)
      |9 A% d. @1 ~
  7269.                         )% ^3 X. F. D8 Z- ^) F9 |4 L! K
  7270.                     )
    8 S4 W7 ~9 V: n. @' k
  7271.                   (setq elm (- elm 10))
    / c2 ^6 j, H1 ~
  7272.                 )
    . i7 g3 k- `& W5 J
  7273.                 (setq i (1+ i)  A. r0 O/ S! Y
  7274.                       elm (cons elm (cdr (nth i dimovr)))7 b4 Q; X, ~- V2 w
  7275.                       dvlist (subst elm (assoc (car elm) dvlist) dvlist)  U/ j% f. f% l+ a
  7276.                       i (1+ i)
    , O. o( X  H4 N
  7277.                 )
    * d* ^0 J0 h* r9 @+ _) q7 D
  7278.               )  b- I, q6 Y1 e6 h- \4 c+ G
  7279.             )3 H& E7 c! ?7 q* A% E
  7280.           )
    ) }8 s, D4 P* f7 D0 {) B, N0 l9 I: x
  7281.         )
    " B0 Q2 w" v3 s' d: E
  7282.       )( X7 r( y- h( a1 f3 H/ P
  7283.     )  r$ s) f1 V7 o$ u5 j
  7284.     dvlist
    1 Q8 W: M" m/ e
  7285.   )! {0 k- ]/ ?1 f' w" ~

  7286. 9 g1 T2 L  `# K* f: _
  7287.   ;;( Q3 N5 |( T9 J- d  ?( o( X
  7288.   ;; Modify POINT
    5 x& s4 U: R7 S
  7289.   ;;
    ) ~2 _% d) s$ U
  7290.   (defun modify_point ()
    : t- ^' Z. ]5 F7 ^3 C
  7291.     (modify_properties)
    ' W0 ~0 u& _* P1 q/ u
  7292.     (setq pt1 (list x1 y1 z1))/ ]! X* q9 c: p7 M; B& d
  7293.     (tempmod pt1 10 0)5 B4 R: V4 x3 Z+ A9 m
  7294.     (entmod elist)+ A/ V7 o1 G1 z8 V
  7295.   )2 @6 S7 d  d# T: r  E4 N. q

  7296. ! U# g& M& |7 q, Y5 p$ v
  7297.   (defun ddpoint ()
    ' L# [4 f9 G2 H- {4 P& ?& M
  7298.     (if (not (new_dialog "ddpoint" dcl_id)) (exit))* v' o" k. z: Q& b: h4 F
  7299.     ;; Set initial tile values
    + C. z$ M7 m3 X4 l, P$ G- U
  7300.     (set_tile_props)
    ) D/ t" q! D( ~9 P
  7301.     (set_tile_handle)
    9 v( _# p2 q9 t' A/ H6 I
  7302.     (set_tile_pt1 0)
    & y" T. F4 I3 G( @9 v
  7303.     ;; Define action for tiles
    ! n: B- K, M1 r( j
  7304.     (set_action_tiles)
    ! [& c3 S; o' `/ q( n! j) o
  7305.     (setq dialog-state (start_dialog))
    ) `& j! G+ Q& I% c; {$ ?( \
  7306.     (if (= dialog-state 0)
    7 \0 U6 ^/ w7 G" P7 i  i
  7307.       (reset)6 S' A3 ^5 A$ {' K- l
  7308.     )- v( h+ j1 d7 C
  7309.     (if (= dialog-state 3)  M0 x- s$ [8 m7 j1 m+ i
  7310.       (progn3 Z5 v; K) u7 ~- X5 {2 [
  7311.         (modify_point)
    0 I! h* H& c" Y
  7312.         (setq pt1 (getpoint (list x1 y1 z1)  "\nPoint: "))
    ; a+ N; f7 u- r) a  _+ j' R3 u# ?$ A
  7313.         (ver_pt1 0)
    + A# S5 w# V& W- H- x# ]
  7314.         (ddpoint)
    2 f  X+ a) g. [/ {6 P1 z  d3 F
  7315.       )
    : c+ c4 v! ~' ?' n+ x. f# w. A
  7316.     )% G6 F! [# d% T# f
  7317.     (if (= dialog-state 1)' a+ X2 r% ?9 ]: Y. ~
  7318.       (modify_point)
    0 W+ X7 P7 l2 K
  7319.     )
    ! v( A+ ]% w2 K- M* \
  7320.   )
    & ^/ s9 v% K) n; B' x) Z: L5 Q, \
  7321.   ;;5 f: a2 I# ?) n$ ^4 W
  7322.   ;; Modify LINE
    ; L) I6 F& z" D0 H* D' S! w+ L
  7323.   ;;
    3 l4 D8 I! t/ R! F9 @3 F& I
  7324.   (defun modify_line ()) z# x/ p% H% p% ^
  7325.     (modify_properties)* p- D6 ]/ B) p# v3 y" E
  7326.     (setq pt1 (list x1 y1 z1))
    & A8 g( W# s1 b- g  e7 O  H
  7327.     (setq pt2 (list x2 y2 z2))
    9 e' o* z5 W% e/ C/ s8 E
  7328.     (tempmod pt1 10 0)7 }7 R- p3 b, y) o1 `! q
  7329.     (tempmod pt2 11 0)% r: S( v, ^) z: L$ p+ j6 O- N7 @
  7330.     (entmod elist)* n, [8 h0 `- I- V4 v  t
  7331.   )
    " F  _4 Q8 S: U2 V
  7332.   (defun ddline ()
    # z. l; C) ]/ q; p
  7333.     (if (not (new_dialog "ddline" dcl_id)) (exit))
    7 H* G- g  ?% y8 H: t' v* ?3 o
  7334.     ;; Set initial tile values- g: y3 u& x4 ~: s/ O# z" ?$ G1 V
  7335.     (set_tile_props)
    8 x/ G$ w+ u4 `0 ^1 g* ~# P( @3 c) D
  7336.     (set_tile_handle)
    ' Y0 Q7 j1 ~9 X; K4 [
  7337.     (set_tile_pt1 0)0 a  {- S  C- _5 q5 ?
  7338.     (set_tile_pt2 0)
    , x) V. [& z6 {
  7339.     (line_calc)
    1 l" E- F% z: T0 s. m
  7340.     ;; Define action for tiles
    % z; i* U! Y7 c- M* z, d& ?
  7341.     (set_action_tiles)$ h) Q, p* l' W' R
  7342.     (setq dialog-state (start_dialog))3 C8 {, }% h8 x. ~6 V
  7343.     (if (= dialog-state 0)! S. x, ~! {) D4 z5 O: ]% X. G: f
  7344.       (reset)
    7 l& y, V1 s9 \8 c9 F- c; x; t  x
  7345.     )& j: i5 \+ l9 _, x3 T6 ^6 P  R
  7346.     (if (= dialog-state 3)
    ) r$ X+ i2 v9 a8 X- w! s
  7347.       (progn2 X* T+ H$ S3 S6 O. I
  7348.         (modify_line). n: U9 W& j7 J; g; v
  7349.         (setq pt1 (getpoint (list x2 y2 z2)  "\nFrom point: "))1 ]8 l  ?0 l2 D+ C  x; E
  7350.         (ver_pt1 0)
    * w& b; Z) P/ _
  7351.         (ddline)  ^3 \* F. f  p
  7352.       )
    $ n* Y  W4 u, w7 m6 ^
  7353.     )
    + u$ d6 w2 O5 N: i4 R* `$ [
  7354.     (if (= dialog-state 4)9 m. ^  v: e" z3 M. v# t6 @
  7355.       (progn8 B# i8 e0 l  t; n3 V  G2 k  F/ K
  7356.         (modify_line)3 ?( V6 _& X  D: ~' b! M$ \
  7357.         (setq pt2 (getpoint (list x1 y1 z1) "\nTo point: "))
    ! l" G4 E; r4 L4 \$ Y
  7358.         (ver_pt2 0)7 S# k1 F) t1 n" B
  7359.         (ddline)
      F' G* i6 G6 D2 l2 U( Q+ d
  7360.       )
    1 G! x$ y3 u+ }
  7361.     )8 N' }  {% R5 y4 ?/ @
  7362.     (if (= dialog-state 1)
    0 Z9 W: J! K* v$ M  m8 ?* t  z
  7363.       (modify_line)
    9 @# _- q, @$ U. \' d
  7364.     )
    7 I+ i) D  c& t
  7365.   )# \' \# t$ D; e4 b3 f, O4 b
  7366.   ;;
    4 b: g- q/ `* h5 o' ^+ s2 L3 }
  7367.   ;; Modify MLine
    3 U+ Q+ W9 p2 i! A1 [
  7368.   ;;
    9 [3 r8 }4 _8 \( E1 k
  7369.   (defun modify_mline ()- l, J$ ~# E) w
  7370.     (modify_properties)2 J3 h. z6 @6 W% ]+ D* y0 n; \
  7371.     (entmod elist)3 U8 @* i3 }* r. Z' l2 K
  7372.   )
    : g+ z2 G# _# R% d
  7373.   (defun ddmline ()8 C; L# v& C9 c
  7374.     (if (not (new_dialog "ddmline" dcl_id)) (exit))6 E9 e, X9 A% s1 F* z, i+ |4 L
  7375.     ;; Set initial tile values
    * F+ `6 v9 l$ A- K
  7376.     (set_tile_props)) v  |# ~% g  R+ o) ^7 o' Q/ G
  7377.     (set_tile_handle)% r# I0 ~# @6 Z& k. G
  7378.     ;; Set mline style text field.
    8 ], u4 S% e* k9 F  S# M
  7379.     (set_tile "ml_style" (cdr (assoc '2 elist)))3 L! P# _/ {" e  B; d5 ^

  7380. ! v7 c+ r9 `* b9 [3 J6 `
  7381.     ;; Define action for tiles4 p. j' c$ S8 u  p" {
  7382.     (set_action_tiles)* J8 }  h/ W! f: F! y( ]
  7383.     (action_tile "ml_edit" "(done_dialog 3)")5 h; R1 i: m4 A4 P( X$ S
  7384.     (setq dialog-state (start_dialog))
    * [! W3 r$ T$ Q" c& j
  7385.     ;; Dialog cancelled, reset to original values.0 F- A: V7 Y$ u0 E  C9 n
  7386.     (if (= dialog-state 0)* I2 G. w0 |* n; }- S4 c
  7387.       (reset)7 x- z7 C, i- Y4 R
  7388.     )
    4 M6 ?! l. ^7 ~0 R# Y8 r
  7389.     ;; Dialog OKed, update the mline.3 q7 n4 _6 Z6 g" L- z; ?1 I
  7390.     (if (= dialog-state 1)
    # B% L& M3 X) b5 R. l
  7391.       (modify_mline)5 E) S* o- y, j( l+ N+ Q2 B
  7392.     )7 R! |6 K9 U( V2 D5 X1 f. q  p
  7393.     ;; Edit Mline, call MLEDIT.
    & e8 M4 v6 T5 `5 N: P! b4 r: y
  7394.     (if (= dialog-state 3)
    " k! x) o! t% T' u( g6 @/ _- p8 E: r
  7395.       (progn
    / g0 m; M/ Y; o* F4 x/ \6 h) d, w
  7396.         (modify_mline)
    : q; V+ [$ G5 V1 z! G! |1 g2 c
  7397.         (command "_mledit")
    4 j3 [; J' }- p0 ?$ P8 r
  7398.         (ddmline); v; m; P# {) E4 X
  7399.       )
    6 g  x  U, I# |" i0 _8 B
  7400.     )8 h6 F) f% s- m# S' i' q" J
  7401.   )# Q4 D" `( z4 ]6 C3 T& u
  7402.   ;;
    6 X% r. n1 R4 N8 H% |% v$ ]
  7403.   ;; Modify Xline
    9 d- m% b. ^1 ?# X& W
  7404.   ;;
    $ h7 o4 ^" c6 w6 P
  7405.   (defun modify_xline (flag)
    ' U: [. A9 r% u. u7 P' B6 ^
  7406.     (modify_prop_geom)
    3 ~- m9 ^! @1 k, ^
  7407.     (setq xline_pt1 (list xline_x1 xline_y1 xline_z1))
    6 {2 d$ I! e5 P; D, t8 }! s
  7408.     (setq xline_pt2 (list xline_x2 xline_y2 xline_z2))- w1 b" I% l) H  e% y
  7409.     ;; Update the Root point.
    ! h2 h& N9 K# w" H: K
  7410.     (setq elist (subst (cons 10 (trans xline_pt1 1 0))
    + L* |& [, |) i& [2 |; y5 b
  7411.                        (assoc 10 elist)
    : P  ]$ K8 Y" |/ z4 E! B$ h, n
  7412.                        elist" [$ P! r9 N5 Z
  7413.                 )9 {0 H4 b9 l) n9 Q* A1 w( E
  7414.     )) U8 i- ?  E% ]
  7415.     ;;8 f# R, z! p$ z; G
  7416.     ;; Calculate new Direction Vector WCS
    9 o  [3 N- C9 q+ U6 Y# J' b
  7417.     ;; x / (sqrt ( (x**2) + (y**2) + (z**2)     ))
    ; L# ~  y7 F6 W

  7418. # x# R  h( L7 u$ M1 X
  7419.     (setq temp_dir (trans xline_pt2 1 0))
    8 R$ Y& A2 n! p( [6 s/ q+ W
  7420.     (setq temp_dir_x (car temp_dir))
    ' A- ~6 b1 u( D2 h, }! p2 m' z; y
  7421.     (setq temp_dir_y (cadr temp_dir))) _7 N3 T! G; F! i, z: W
  7422.     (setq temp_dir_z (caddr temp_dir))2 ~/ t3 w/ f2 y* `/ H4 g& {1 _
  7423. ! X7 @% \2 |1 k1 Z/ ?5 s  I3 h' Y3 E
  7424.     (setq temp_xline_pt1 (trans xline_pt1 1 0))+ C7 ?1 P3 j- ], B+ ^8 i: p- g
  7425.     (setq temp_xline_x1 (car temp_xline_pt1))& \2 `  ]) O4 M5 S7 d& L
  7426.     (setq temp_xline_y1 (cadr temp_xline_pt1))2 D( w: f7 y. T; a
  7427.     (setq temp_xline_z1 (caddr temp_xline_pt1))
    / u' g7 b- n+ }7 k# n2 O% N; e

  7428. * Y' @- M2 V( _- }# ?5 \
  7429.     (setq denom (sqrt (+ (expt (- temp_dir_x temp_xline_x1) 2)  M! d+ n3 N$ c) |$ y$ m0 R. }
  7430.                          (expt (- temp_dir_y temp_xline_y1) 2)
    , M4 D  l& t5 a# l
  7431.                          (expt (- temp_dir_z temp_xline_z1) 2)
    " p5 U2 M+ _( x+ @9 ^2 `; q" _9 D
  7432.     )))
    8 T3 `, T. L) Y3 U3 P4 \. N0 [
  7433.     (setq temp_dir_x (/ (- temp_dir_x temp_xline_x1) denom))# v% f/ G5 W; Q6 x, s- x( }# A1 ~% A
  7434.     (setq temp_dir_y (/ (- temp_dir_y temp_xline_y1) denom))7 y! V% b% d- }- ~9 J5 J% s
  7435.     (setq temp_dir_z (/ (- temp_dir_z temp_xline_z1) denom))* j% Y5 e, f% T4 B+ y. _
  7436.     (setq elist (subst (cons 11 (list temp_dir_x temp_dir_y temp_dir_z))
    * q0 h6 ]& _5 U% @% `) Y
  7437.                        (assoc 11 elist)
    % J1 H( q, v- j3 N& K4 q/ G$ X' b
  7438.                        elist
    * C( l2 m7 h8 N
  7439.                 )
    ; A& [" o; M' K' S5 s7 a( e7 ]5 F
  7440.     )  a4 Q# u7 [  X; D# o4 h  ^: _
  7441.     (if (= 1 flag)5 ?9 E5 i1 K; y( P
  7442.       (entmod elist)# r5 j' g: P9 j* V+ |
  7443.     )
    ( v1 W* H. v& T0 B9 y- {) @* m
  7444.   )
    * f3 n$ f8 _  P" }: p

  7445. " W8 j- w3 l- {
  7446.   (defun ddxline ()- m0 @, a2 }- m) d4 k
  7447.     (if (= etype "XLINE")
    7 o7 s& t. h+ \+ Z& a6 a9 B
  7448.       (if (not (new_dialog "ddxline" dcl_id)) (exit))* P6 K/ P1 j* |) y" t* V) w
  7449.       (if (not (new_dialog "ddray" dcl_id)) (exit))
    - l4 s5 ~$ b1 W2 d" T9 r6 Z
  7450.     )6 a# O- c& s* Y$ q. x! j5 [
  7451.     ;; Set initial tile values
    4 T) F  I: C1 B! a7 v4 M0 Y
  7452.     (set_tile_props)
    . _3 G6 X4 F3 D
  7453.     (set_tile_handle)( ~  z3 N8 t2 }, T- ?# |
  7454.     (set_tile_xline_pt1)- C0 \- v+ p# |* m. N5 j' X
  7455.     ;; Convert to UCS and post Direction vector.$ j- x5 R; K; s4 e0 g/ u% m
  7456.     (set_tile_dirv)1 k. U# E" D( r$ u, _3 e& Q
  7457.     ;; Calculate second point by adding Root Point + Direction Vector.0 z) [$ G7 J0 l9 y
  7458.     (set_tile_xline_pt2), f+ c# r5 {9 E8 {
  7459.     ;; Define action for tiles
    5 Y9 P/ @  O% N8 ]7 W, d2 R8 T- k
  7460.     (set_action_tiles)
    $ W& S/ k1 v5 j4 Q
  7461.     (setq dialog-state (start_dialog))' ~  `+ ]! W( h+ o( c
  7462.     (if (= dialog-state 0)
    ; h% Y- p* v1 I
  7463.       (reset)
    5 d. c) B3 V0 G2 y) G6 F7 V' C$ [9 I
  7464.     )" U0 d' U3 `+ t, }
  7465.     (if (= dialog-state 3)
    - m2 K! H! N1 ^- J( k8 u
  7466.       (progn
    , J) Y. ]1 z/ i% n) ^  S
  7467.         (modify_xline 1): X2 P( W6 N+ z+ F' K9 I( h6 W
  7468.         (while (equal xline_pt2/ b8 t8 B3 r7 E4 y
  7469.           (setq xline_pt1 (getpoint xline_pt2 "\nRoot point: ")) 0.000001)
      M: n: r# l% M9 F  j$ n
  7470.           (princ "The Root point cannot equal the Second point.")" M* a8 Q. j/ M; v# {$ l
  7471.         ). W- S# |/ j$ ?9 o$ e; r
  7472.         (ver_xline_pt1)% K/ l) r- P  C8 P% H- J. I5 y
  7473.         (ver_xline_pt2)3 t9 A- T0 g1 |+ X, Y: s7 p
  7474. (princ)
    % l6 E/ \  `7 D! W1 ^
  7475.         (ddxline)
    : o8 O* y. X& L
  7476.       )0 r$ l' k" ]4 b$ b! t7 b8 T! x
  7477.     )
    4 T' a8 M% e( ]6 P
  7478.     (if (= dialog-state 4)
    . w* x" B; o. _) S
  7479.       (progn' C4 G: s. ~$ p  I
  7480.         (modify_xline 1)
    ; I# `3 f/ S& ?8 w7 M2 R4 p
  7481.         (while (equal xline_pt1
    ( V+ K5 |( l4 F7 B8 o4 z* i
  7482.           (setq xline_pt2 (getpoint xline_pt1 "\nSecond point: ")) 0.000001)6 `$ r4 x+ v4 h/ w2 k
  7483.           (princ "The Second point cannot equal the Root point.")
    " t" [7 ?% j7 I+ h/ H; w
  7484.         )
    : J. q& q6 G* |2 J2 R
  7485.         (ver_xline_pt2)
    5 j& f. c# g' t
  7486. (princ)
    2 `. h; m+ s& I8 J3 c
  7487.         (ddxline)) a$ E0 U+ i) s* F
  7488.       )) B3 `0 T' I3 X/ U$ q
  7489.     )
    ( J) f! a* ?2 e. B% h. u! P
  7490.     (if (= dialog-state 1). K2 w: R! L, w* L) X
  7491.       (modify_xline 1)
    / H. ^0 T3 ^! Q% i
  7492.     )) _" {4 c" A1 N, X
  7493.   )* o) P1 Q' u: Z' `; [9 W
  7494.   ;;" ?- k, V* u( `5 M' g
  7495.   ;; Modify ELLIPSE
    3 L1 y6 X- H* b
  7496.   ;;# w4 A- i; c, t
  7497.   (defun modify_ellipse ()+ ?3 F" a4 n% |
  7498.     (modify_prop_geom)
    5 L$ k  x2 J# y9 m( j6 u4 ~
  7499.     ;; Update Ellipse Center Point value.; y. l! d, B' w- l
  7500.     (setq pt1 (list x1 y1 z1))
    6 Q& c/ e# M. i' F0 r% ^5 m5 H' s
  7501.     (tempmod pt1 10 1)4 o: M: f- k" z2 E: a: _7 e
  7502.     ;; Update Start Parameter value.
    + N) W) W8 r: X6 H3 }2 n
  7503.     (setq y_val (sin st_ang))" J' |" u" i& S) L$ [# p7 p( ?
  7504.     (setq x_val (* rrat (cos st_ang)))5 u8 ]+ m+ r* J7 e
  7505.     (setq stparm (atan y_val x_val))1 i$ n9 P. Y) C4 B7 r. w- V7 s
  7506.     (setq elist (subst (cons 41 stparm) (assoc 41 elist) elist ))
    4 \' n  t8 k6 O9 ?+ P
  7507.     ;; Update End Parameter value. Normalize it, if it's less than2 t; X! w. ]- s& z4 }
  7508.     ;; the start parameter.
    ( e( ]/ a" I4 l$ P6 D4 d# @3 G
  7509.     (setq y_eval (sin end_eang))' |& A- D3 \& @% n8 p6 K% b
  7510.     (setq x_eval (* rrat (cos end_eang)))
    ( w4 y' t* G. o: Y, O
  7511.     (setq endparm (atan y_eval x_eval))
    6 ^/ h2 O/ h" ^& Q" E
  7512.     (setq diffparm (- endparm stparm))0 v/ Z5 c4 b( {' i6 j: K/ A
  7513.     ;; Epsilon of 1.0e-6 radians for checking a zero length arc.
    2 j- Q- p5 h- ~$ u# Q. X/ e, T* ]& z
  7514.     ;; Since zero length arcs are not allowed - construct the full
    ' C+ H, ]# B1 n0 A
  7515.     ;; ellipse in this case.
    " ?2 X! \5 g6 t1 ?  o0 l
  7516.     (if (<= (* diffparm diffparm) 1.0e-12)3 C: h5 N3 c) M9 I3 b% P
  7517.         (setq endparm (+ stparm (* 2 pi)))  y" S. h5 u; v3 C6 h. R; f
  7518.     )
    2 f) V" {/ v% N. T
  7519.     (if (<= endparm stparm)
    ; m: k( r+ O! {4 K6 d& I. k
  7520.         (setq endparm (+ endparm (* 2 pi)))
    0 y9 z7 `' a, x" G( h( j  ?
  7521.     )
    : D- p+ V5 b7 q% N( e& Y. _
  7522.     (setq elist (subst (cons 42 endparm) (assoc 42 elist) elist ))
    / G2 f+ h/ g( l+ E  X
  7523.     ;; Calculate the Major Axis Vector by first calculating7 ^7 J" ~3 P; b2 i+ D
  7524.     ;; a unit vector using the old Major Radius value. Then
    + X% t' M# Y" K
  7525.     ;; Multiplying that by the (possibly) new Major Radius
    & X# m  \/ ?3 I5 z
  7526.     ;; value to get the new Major Axis Vector value.
    ' J  R8 v& k8 f  }/ V
  7527.     (setq unitxx (/ xx old_majrad))
    - ^. ~* z4 P1 M8 T
  7528.     (setq unityy (/ yy old_majrad))( T- @- I% \% D
  7529.     (setq unitzz (/ zz old_majrad))
    ' s) ?3 K1 G. U$ y6 R9 y3 b
  7530.     (setq newvecxx (* unitxx majrad))
      }" h" ^2 J) W  S4 e3 m
  7531.     (setq newvecyy (* unityy majrad))% }2 N2 c3 O; T
  7532.     (setq newveczz (* unitzz majrad))8 Y1 z6 C- ~( p" c; ?
  7533.     (setq newmajaxis (list newvecxx newvecyy newveczz))
    0 d9 L2 E- R- u+ R" \
  7534.     ;; Update Major Axis Vector value% G8 X) p; p, W6 m( c) C3 K; X
  7535.     (setq elist (subst (cons 11 newmajaxis) (assoc 11 elist) elist ))
    ) L/ \& `! X$ @1 Z2 E  M
  7536.     ;; Update Radius Ratio value+ Z4 }4 }2 G3 {& q# }7 Q
  7537.     (setq elist (subst (cons 40 rrat) (assoc 40 elist) elist ))
    $ r1 N# i! N( z# ?+ g* d
  7538.     (entmod elist)
    1 q0 z- ~3 t4 X# C& r3 P# I  G  L
  7539.   )
    $ t/ o" f. @  Y) x

  7540. 0 i+ {" }- @1 f0 p( N' |3 A
  7541.   (defun ddellipse ()8 M! ^6 }' d; g4 _
  7542.     (if (not (new_dialog "ddellipse" dcl_id)) (exit))
    1 n8 R. k" c; ^0 r) q
  7543.     ;; Set initial tile values
    1 d7 i* s2 E  \8 a' P/ [1 _& x
  7544.     (set_tile_props)
    " X) V4 ~# \4 F! }  m
  7545.     (set_tile_handle)
    4 H6 G# C& P1 W! h6 |/ M
  7546.     (set_tile_pt1 1)
    6 _$ Z" w# |; ~1 X% ^3 P2 O$ ^
  7547.     (ell_calc)
    " \! ?1 d* x* ?5 \/ x- D+ \; V& l
  7548.     ;; Define action for tiles( A2 u2 T1 i/ v
  7549.     (set_action_tiles)
    7 h0 |* h# c. s) ]5 Z- T* _
  7550.     (setq dialog-state (start_dialog))& o8 Y6 X5 _9 u: ]! q7 ~& u
  7551.     (if (= dialog-state 0)
    + O# X1 f9 P, z; X" \0 ~. n6 |0 q
  7552.       (reset)" a2 v/ `, M) n+ M1 i- u
  7553.     )
    4 a2 X: J& {" k( [' P
  7554.     (if (= dialog-state 1)% i  L6 p# E( r5 V
  7555.       (modify_ellipse)0 ]' L9 Y5 P$ Q
  7556.     )5 n  C! Z2 V7 f0 P+ V( j# T
  7557.     (if (= dialog-state 3), B: e; ]2 k6 U+ x( R9 v* ?
  7558.       (progn. U6 o6 e, y$ d% y& r( F
  7559.         (modify_ellipse)5 x8 K, W6 J2 u- v% R
  7560.         (setq pt1 (getpoint (list x1 y1 z1)  "\nCenter point: "))5 B8 Q9 d; `% Y+ z$ A
  7561.         (ver_pt1 1)" z) W6 n/ }  m' H
  7562.         (ddellipse)" R( g- Y9 z4 ^8 g2 d
  7563.       )
    . X  U, h4 O) b% Q: P
  7564.     )
    + [/ N, K+ J/ t/ p
  7565.   )
    5 c6 o0 p+ U2 {: M- @0 e
  7566.   ;;
    5 ~( n8 j1 |# b! u% y' S
  7567.   ;; Modify REGION0 w% X4 e) H0 G0 I# R: L) q
  7568.   ;;  P+ @; j$ h4 N# j2 l) u. @  g
  7569.   (defun modify_region ()
    5 ^1 h& I' |+ M/ g2 W1 I( ]
  7570.     (modify_prop_geom)
    8 t, e7 J- Q  ?  H
  7571.     (entmod elist)) G4 Q8 K& J4 e0 K* p9 p! ]
  7572.   )
    8 E  q" s0 n2 e1 Q& Q$ B  [

  7573. 8 P: ^! O7 F7 [
  7574.   (defun ddregion ()5 g7 x$ G2 Q; Y* W7 @+ G+ S! v
  7575.     (if (not (new_dialog "ddregion" dcl_id)) (exit))& D$ p2 x, t2 E# H
  7576.     ;; Set initial tile values  a; F& l: |  Q1 L
  7577.     (set_tile_props)& m: T5 W) k) H. W( w4 c, S
  7578.     (set_tile_handle)
    6 [. o" d* P& E* ~2 e, ~
  7579.     ;; Define action for tiles) J8 b9 o/ D% S8 j8 E
  7580.     (set_action_tiles)
    + x; n" p, M* K, _9 S, i
  7581.     (setq dialog-state (start_dialog))
    1 \! ~4 {! W* s& u
  7582.     (if (= dialog-state 0)
    ; I" r) O! h2 Z& M$ l* g
  7583.       (reset)% l' ~: m2 y" H
  7584.     )
      @& b- u$ N! j1 I) A4 v% D
  7585.     (if (= dialog-state 1)
    0 N% s0 Z% P! Q' l/ V5 V* V# w: c
  7586.       (modify_region)
    3 r# u% \( M" y+ d+ U1 d9 j& c
  7587.     )" H1 O- K4 \, v# F
  7588.   )2 G* `( f; ^3 P* b" P# X
  7589.   ;;
    - x  H( c2 u) m+ s; F
  7590.   ;; Modify 3DSOLID; E/ M7 V+ W* J: X5 T
  7591.   ;;. o. O; I4 j5 a4 ?) u2 m. F, _
  7592.   (defun modify_3dsolid ()# v' {! X- [7 d. c) d4 ^; c7 h
  7593.     (modify_prop_geom); I/ f2 ^' @, P- A% Y
  7594.     (entmod elist)
    & n( v! f0 o) w# y/ |& [4 t* o$ s
  7595.   )* ~$ t8 |- _) L7 O) r" k. j' v
  7596. 2 F3 l' [, A1 ]# s' `1 u3 r+ [
  7597.   (defun dd3dsolid ()
    9 m5 p( G$ c' N) g% l
  7598.     (if (not (new_dialog "dd3dsolid" dcl_id)) (exit))# Z7 J& f# Z0 H3 F
  7599.     ;; Set initial tile values  C5 M. \9 [' ]; B/ r: G5 M  ~3 b
  7600.     (set_tile_props)
    - j% b% N+ }9 P
  7601.     (set_tile_handle)0 D* p$ w0 D/ x# c( [9 j; w8 {
  7602.     ;; Define action for tiles3 i: J$ \: I. B' C5 m, W9 P" t
  7603.     (set_action_tiles)# t. l1 {' i0 t& Q2 a
  7604.     (setq dialog-state (start_dialog))
    " T5 h% h3 X, A
  7605.     (if (= dialog-state 0)
    % G5 N' ]& ^% C, }4 i" M; g
  7606.       (reset)
    8 R6 W; P) w# l: y' @2 O: T, j6 ?
  7607.     )
    ) K0 |7 n" j! m9 n
  7608.     (if (= dialog-state 1)1 H4 A  }2 A9 Q; i+ d! z1 @
  7609.       (modify_3dsolid)
    ! u* q: A; B9 _5 f0 k
  7610.     ). x7 V& M$ J; }2 S+ m1 M& _; p8 z& {
  7611.   )
    5 ^6 |# z7 S. A( t2 C4 V( a9 }
  7612.   ;;/ ^$ T+ W9 ?9 i8 h8 e
  7613.   ;; Modify AcDbHatch
    / f9 N1 ]6 e' U$ S3 p9 \* J9 B
  7614.   ;;
    " H' B% p6 y# z
  7615.   (defun modify_hatch ()$ M  Z9 k* T- ~( g: m* \
  7616.     (modify_prop_geom)
    1 Z, x, r. D. n; q3 P7 P, W+ R
  7617.     (entmod elist)2 I5 Q5 ?: [6 k( ?
  7618.   )
    , H* }1 s3 s3 f5 n( @( L2 \

  7619. ' _! O( q" F; A9 D2 k
  7620.   (defun ddnewhatch ()3 i& z+ f' h5 Q
  7621.     (if (equal hatch-elist nil)
    0 x- Q) x& v2 f) o6 ~
  7622.          (setq hatch-elist old-elist)7 x0 O* L" G/ s1 K
  7623.     )! ]' d7 ~' @# L; E- T
  7624. : f, a+ |  A8 s! o3 ^' `
  7625.     (if (not (new_dialog "ddnewhatch" dcl_id)) (exit))
    * U3 }/ l) ^* w% x5 m* `8 C* k

  7626. $ Y$ [/ c5 I4 T; H9 Y
  7627.     ;; disable the thickness tile. m9 t$ w5 G+ |7 C
  7628.     (mode_tile "eb_thickness" 1)
    5 \) F0 H* l' ?- c" N- h0 h
  7629.     (mode_tile "e_thickness" 1)) G6 I( T1 `4 O; @2 @

  7630. & S" l5 i" i) @6 s% G! S
  7631.     (setq help_entry "modify_associative_hatch_dialog"). q1 o) {1 v& l, H! f. w' k% |7 Y. Z
  7632.     (set_tile_props)' g* p$ n( L& @5 M/ i& G
  7633.     (set_tile_handle)1 ]0 Z3 `: F7 N7 z( }$ m
  7634. 3 k5 y9 X, Q, f
  7635.     ;; Define action for tiles
    3 Q( v9 N% p2 r
  7636.     (set_action_tiles)
    : g: L/ J- g: q( h
  7637.     (action_tile "b_hatch" "(done_dialog 2)"), R* C5 C* g# X6 k
  7638.     (setq dialog-state (start_dialog))
      l8 I# ?4 V: U' ]( D6 Q* \4 J
  7639.     (cond
    4 C% w  b' A/ S- N, @; }& K
  7640.        (  (eq dialog-state 0)0 q9 o# s: J( A3 g# O
  7641.           (setq old-elist hatch-elist)  g! {& R; t5 \7 {/ V
  7642.           (setq hatch-elist nil)" W2 c: W3 e' j# W/ X8 P- G
  7643.           (if (= (checkforlockedlayer ename) nil)
    ; z& _8 U9 j- ?9 _* ]/ t9 `
  7644.              (reset)3 R9 d( `6 K6 E* Q( f" F# Q7 d# p
  7645.              (progn         ;;; special handling for locked layer reset
    ' D  z" R% N, _) n3 r5 l# L5 @- e
  7646.                 ;; unlock the layer
    * f: p* T3 V! a1 e8 \( T) a. F/ r
  7647.                 (setq layername (cdr (assoc 8 (cdr (entget ename))))); n+ Q. J) S- X/ W6 ]
  7648.                 (command "_.-LAYER" "_Unlock" layername "")
    6 o, J1 S8 P- X4 \# C& ], b
  7649.                 ;; reset modifiction
    & `2 X4 u( b" }; K& K( `
  7650.                 (reset)
    & Q5 s5 {& `7 a; y  H, L8 D9 F
  7651.                 ;; lock the layer again  h6 ?, j0 G) U5 ~; g6 u7 E- F# D
  7652.                 (command "_.-LAYER" "_Lock" layername "")
    8 b( f. v* f: }% H
  7653.             )
    1 j; i8 O2 i  u7 W
  7654.           )
    5 ~" O! b2 U7 @3 }5 A7 M: N2 N
  7655.           nil       ;;; makes (ddnewhatch) return nil for Cancel3 P8 e3 f0 v! G5 i
  7656.        )
    ( Y4 L2 s; q7 W  @% t
  7657.        (  (eq dialog-state 1)
    . V& G  ]4 H4 F+ ]* U9 l
  7658.           (setq hatch-elist nil)0 `2 b; {0 r8 z8 W) l$ m* c
  7659.           (modify_hatch)
    - y  M( T% O+ w
  7660.           T         ;;; makes (ddnewhatch) return T for Ok
    # l% U' R: ~5 t0 J
  7661.        )
    3 I& Z0 d& f5 [, W; j( n
  7662.        (  (eq dialog-state 2), B. x1 }: g" Q, s  c
  7663. 9 j6 u  C/ l; t  D
  7664.           (if (= (cdr (assoc 70 (tblsearch "LAYER" elayer)))
    0 q) Z5 c& H4 H+ S
  7665.                  4, S9 b" O) l5 ?
  7666.               )             # m, f8 Q& B/ Y. n
  7667.               ;;; new selected layer is on a locked layer
    1 P* _( ^% {! C
  7668.               ;;; we can simply modify the hatch properties
    1 _9 r' _1 n8 s& x: m! a- u
  7669.               (modify_hatch)
    * d' U; \" w' l* |- G& f0 ~
  7670.               (progn8 n* W9 J/ l' \/ ]. O
  7671.                     (if (= (cdr (assoc 70 (tblsearch "LAYER" (cdr (assoc 8 (cdr elist))))))
    + h5 ~$ b1 F2 D6 ?- z5 w8 ?. Z$ O( N
  7672.                             4
    ; @: b7 w" b2 R4 `
  7673.                         )           & v+ g, ?% [. u7 X9 @  |0 L/ H/ v
  7674.                         ;;; We changed the layer previously and now the hatch lies on a locked layer.
    . m3 [2 J- b! U" j  D
  7675.                         ;;; We have to unlock the layer forethat we can update the hatch properties.$ l6 w; `9 O# B
  7676.                         ;;; If we don't do that (entmod) fails to update to the new layer.8 A  _3 W2 ~; T
  7677.                         (progn
    ( k% i+ f4 z; x+ u1 O# m3 G
  7678.                             (setq layername (cdr (assoc 8 (cdr elist))))
    8 E7 ^  |. X  v( }( O" Y9 t2 `; Z
  7679.                             (command "_.-LAYER" "_Unlock" layername "")     ;;; unlock the layer5 |# k+ X1 \6 Z: r+ p
  7680.                             (modify_hatch)                                  ;;; update the properties6 ]; N4 {0 ~$ ^8 y
  7681.                             (command "_.-LAYER" "_Lock" layername "")       ;;; lock the layer again
    - ~# T; b- W% d9 p# d9 O
  7682.                         )6 m' X: J/ R' @, e, \' t9 z8 X+ N+ e- s
  7683.                         ;;;  All other cases we simply update the properties; ?2 z% G0 J' I2 T- c* `) K
  7684.                         (modify_hatch)4 F% E# U3 e5 D; V
  7685.                     )
    - [" m, K- i9 O; m3 p8 G
  7686.               ); A2 d( `7 h  }9 l. k* }. [3 f7 f
  7687.           )
    + p& I* e: h) R
  7688.           (if (= (checkforlockedlayer ename) nil)
    , K1 d. j! X/ N
  7689.               (command "_hatchedit" ename)
    8 b) S7 _! x0 Y$ @  F
  7690.               (alert ;|MSG111|;"The hatch object is on a locked layer.")3 Q+ p4 h/ ^4 q/ F
  7691.           )9 |- o) _- c) l: o
  7692.           (ddmodify ename)
    * u! N8 X& G1 _4 D$ y4 d/ U
  7693.        )0 \  v. m% z* ^& ?9 d1 r4 r
  7694.     )% B; u% }, @0 U! m9 L% b) a, l$ T
  7695.   )' g* v+ i- h* {' U7 G
  7696.   ;;. u& T* ~' @8 w  L
  7697.   ;; Modify BODY
    ( }; T- A1 t5 \) t1 M7 J
  7698.   ;;) S+ L7 Q- l; `: c! g, q
  7699.   (defun modify_body ()* O/ ]1 H; h( _
  7700.     (modify_prop_geom)
    : _  p2 l0 w: M8 l( w; i
  7701.     (entmod elist)
    : k* G& Y6 y& y1 b. V
  7702.   )$ q4 `  h# B# {

  7703. * {6 d# S/ E) U3 _
  7704.   (defun ddbody ()
    . D5 E4 d; |+ s! ]$ j: ~
  7705.     (if (not (new_dialog "ddbody" dcl_id)) (exit))
    # B0 {) y8 E6 g, _2 Z2 |
  7706.     ;; Set initial tile values
    7 |* X$ r9 c6 `4 G4 m- z
  7707.     (set_tile_props)( H) {3 K# u/ l/ m" f& W
  7708.     (set_tile_handle)
    6 E( \; `9 m, C1 f3 ?5 f' U
  7709.     ;; Define action for tiles% _  e1 |6 R, b- Q  d/ L
  7710.     (set_action_tiles)
    % U& P% _  o' A4 Z/ ~. s6 z
  7711.     (setq dialog-state (start_dialog))/ N# J  x% F0 V; x0 w& f
  7712.     (if (= dialog-state 0)
    6 R6 L: @; n8 u6 m) X
  7713.       (reset)
    5 Q# B: x6 I- q  |' G+ w
  7714.     )! G! K/ }# W- C% P! N" _
  7715.     (if (= dialog-state 1)
    3 t7 Z6 f9 [! W! ]. p
  7716.       (modify_body)' R2 F+ K( [4 Q4 M
  7717.     )
    + d) v. g# b$ ]! e0 l+ s5 t! E* Z
  7718.   )/ _* \4 A- d( ^- z
  7719.   ;;
    3 B6 c7 x; H$ h+ `, }4 a' J; F, z7 W
  7720.   ;; Modify CIRCLE
    6 G8 h/ ~" ^) ]0 [4 Z( |
  7721.   ;;
    ' C4 `3 ~3 e" ?# ~3 I8 ]
  7722.   (defun modify_circle ()  t7 J8 c' t3 X& {- |' _. [
  7723.     (modify_properties)
    % |7 l5 q+ r3 [; q4 j
  7724.     (setq pt1 (list x1 y1 z1))
    ! ~, P# I/ ]% w
  7725.     (tempmod pt1 10 1)! n& n  c: `& U$ P" i+ o5 n: D
  7726.     (tempmod radius 40 nil)
    - d: |- J9 T' `7 I- a
  7727.     (entmod elist)
    . m0 _& l, T/ \3 X8 l+ }
  7728.   ). X" |# [/ E& h& r9 m$ G1 H+ u
  7729. # U: L7 b/ J1 {9 W
  7730.   (defun ddcircle ()
    ' a* }, }9 C3 R; E5 f, c
  7731.     (if (not (new_dialog "ddcircle" dcl_id)) (exit))
    & k) I8 ^* r, A. L# f
  7732.     ;; Set initial tile values
    " [/ A9 K% O) `0 Y# K
  7733.     (set_tile_props)
    ; c$ C# P* q8 c# O7 @" V6 T
  7734.     (set_tile_handle)
    4 y% n/ `4 |5 E# ^7 s* U  q4 G
  7735.     (set_tile_pt1 1)/ Q! C# P  _! M) Z7 D; Q
  7736.     (set_tile_rad)' }) |4 B# P$ }! N2 H! `7 {- v/ [$ C
  7737.     (cir_calc)
    5 d0 R( `0 ^4 u% z/ n5 ~  E% E
  7738.     ;; Define action for tiles
    : x6 ~( N" s$ n2 I! O% Y" ^
  7739.     (set_action_tiles)
    . H( y3 j# k) n
  7740.     (set_tile_pt1 1)
    8 s8 c. E! ^" v8 X
  7741.     (setq dialog-state (start_dialog))9 U' ^7 {7 t8 \$ e5 Q1 n4 c& `
  7742.     (if (= dialog-state 0)& |( ^) C, h) e" x7 s9 @3 V
  7743.       (reset)( I1 ?- I" V  b9 A2 ]; Y
  7744.     )" F% M2 V+ E) C% x6 o
  7745.     (if (= dialog-state 1)" D9 t7 I& J4 m. u
  7746.       (modify_circle)
    ! V  D+ ?0 k4 K* H2 ~9 O
  7747.     )
    2 Q" {7 m4 ]4 U$ L  ^! O: x
  7748.     (if (= dialog-state 3)
      x/ E8 S8 v. Y- H0 v3 p& [
  7749.       (progn7 a* O" o7 @; q! o3 \( c, \; C
  7750.         (modify_circle)
    ) |' i" r+ t: J6 H, w: H
  7751.         (setq pt1 (getpoint (list x1 y1 z1)  "\nCenter point: "))* c+ g9 I4 r& T" F% w) B: I7 G
  7752.         (ver_pt1 1)
    7 x9 l, e5 k0 [. R
  7753.         (ddcircle)
    % }1 s; _' @) t9 ?1 H5 Z
  7754.       )+ c; h& H) ^, H- f. [% t# P
  7755.     )4 S2 f- k# n7 @
  7756.   )
    : B! A+ q' U* v' G+ \
  7757.   ;;
    . N: b  E8 s( x6 [& f0 c! k4 X
  7758.   ;; Modify ARC' o$ c9 A7 S% y8 q* v" F2 V; n
  7759.   ;;
    ; h6 v$ U3 A0 w5 w. p/ P0 D
  7760.   (defun modify_arc ()
    " `' D1 n. r% l! E& w
  7761.     (modify_properties)! Q  S& F' ]& }$ P# T
  7762.     (setq pt1 (list x1 y1 z1))
    ! P; N& S5 R. \
  7763.     (tempmod pt1 10 1)
    # a$ |; y8 _- T+ `9 u" W* Y
  7764.     (tempmod radius 40 nil). M1 {! {  z! m2 H! m6 ?
  7765.     (tempmod st_ang 50 nil)2 s0 L7 E2 _3 T6 F
  7766.     (tempmod end_ang 51 nil)
    $ u$ t5 b# j7 V, l8 e" \
  7767.     (entmod elist)
    7 K# ]0 V0 w. `: h
  7768.   )
    ; z, i# Z2 X! A* j
  7769.   (defun ddarc ()
    . [2 [4 Q6 D$ h. b) S" Y
  7770.     (if (not (new_dialog "ddarc" dcl_id)) (exit)), A* t5 c, R8 ~/ ?# m
  7771.     ;; Set initial tile values) X& r8 A' P/ d" `. W- ?& F
  7772.     (set_tile_props)
    5 T2 v9 y* h3 K! K9 T9 s
  7773.     (set_tile_handle)' _* s" Q* j/ m+ M! E6 w
  7774.     (set_tile_pt1 1); W) ?, d# C$ ^
  7775.     (set_tile_rad)& v+ l3 U% R0 k6 W  F: N
  7776.     (set_tile_stang)
    + N3 j$ e7 X% c
  7777.     (set_tile_endang), @0 ?' J; O( X: C  ^& c# z% U
  7778.     (arc_calc)3 z. }% P# h$ M2 r7 ~
  7779.     ;; Define action for tiles: n9 L) X+ v( R/ _/ Y# |; B
  7780.     (set_action_tiles). C- i  e$ [  k; c9 D" c. Y
  7781.     (setq dialog-state (start_dialog))
    % |# m, q. S* R
  7782.     (if (= dialog-state 0)- ]8 u6 G6 L; c0 b" o' U5 r
  7783.       (reset)
    " j  W$ M" t( k( R/ @  ?
  7784.     )$ U4 a! _5 B9 _- d* A3 J
  7785.     (if (= dialog-state 1)
    $ C+ L7 f) Y. f  @! T9 y2 P
  7786.       (modify_arc)' K$ W) J! @5 s, T0 n+ p. }
  7787.     )
    0 m" h8 b- c( {+ }1 C$ w
  7788.     (if (= dialog-state 3)
    * \6 c4 E% L' v: Z' @
  7789.       (progn
    $ t* c1 M9 Z2 N1 T" N
  7790.         (modify_arc)
    ; l5 I( E  w3 V3 R" L- i  E) a
  7791.         (setq pt1 (getpoint (list x1 y1 z1) "\nCenter point: "))) k: R0 i8 f1 D7 t$ E" B0 e
  7792.         (ver_pt1 1)% R- {+ i: X- R# ]0 t0 R
  7793.         (ddarc); g, ~1 J3 _: F7 t; Q) z
  7794.       )
    5 `8 F4 |( w2 H3 h3 H& O
  7795.     )- u; }- e: v" }; ?! E* F! C" v
  7796.   )7 {/ B2 }: V3 i. P4 r& f# e
  7797.   ;;
    6 B+ S, d+ @9 P! I
  7798.   ;; Modify SOLID or TRACE* Z$ i0 U$ M7 D' K4 @, z
  7799.   ;; Note the Z value of the object is determined by the Z value of the fourth
    4 O* i# C# e9 i/ _* k+ ~' Z& `: _/ J0 S
  7800.   ;; point - code 13.  Changing the point values of a solid or trace from a UCS
    - ^. @/ [8 c* s6 p
  7801.   ;; that is nonplanar to the UCS the object was created may confuse the user.& L- |' M) _+ L7 m& m
  7802.   (defun modify_solid ()
    & ~) D* ?0 d5 E4 l  z$ q( I
  7803.     (modify_properties)
    4 M; v* K! N* w: g; c9 s/ L( n
  7804.     (setq pt1 (list x1 y1 z4))
    ) L3 j; \. _6 `# Q$ u
  7805.     (setq pt2 (list x2 y2 z4))) D) |0 p  j* e6 M/ P1 Q& F
  7806.     (setq pt3 (list x3 y3 z4))
    ( V; |2 V6 U& D& r9 r2 P' X  z
  7807.     (setq pt4 (list x4 y4 z4))
    ( @6 p" E' j1 ?* ]# X+ i
  7808.     (tempmod pt1 10 1)
    * q6 d6 W1 V2 n. t+ g1 G% i( ^4 j
  7809.     (tempmod pt2 11 1)* h! D" e+ \1 ~1 o( z) G
  7810.     (tempmod pt3 12 1)* Z& i$ E6 z5 S  B& u- U
  7811.     (tempmod pt4 13 1)
    % y" G3 O( u% g
  7812.     (entmod elist)
    0 G4 o5 M7 j" @! I% j, S3 `. [
  7813.   )+ A. ?# y/ k. j/ S: W4 m6 t+ O

  7814. " p% p  ~* i" q8 _1 v
  7815.   (defun ddsolid ()+ o/ X. P7 R% G8 b" t
  7816.     (if (= etype "SOLID")9 S) S, T* |5 K: Y, ^/ `( {
  7817.         (if (not (new_dialog "ddsolid" dcl_id)) (exit))
    4 b0 T2 e, Y' \  o" y: o+ v
  7818.         (if (not (new_dialog "ddtrace" dcl_id)) (exit))- u! k0 a# M% z+ D
  7819.     )
    0 t6 p, n$ Z+ z2 T! O
  7820.     ;; Set initial tile values
    & J: R5 q4 T9 j! F9 |2 e
  7821.     (set_tile_props)
    7 `, y) F- C& h+ |0 O
  7822.     (set_tile_handle)
      S# P, e$ v) W! t
  7823.     (set_tile_pt1 1)
    & O6 v! d. H. R9 T, y
  7824.     (set_tile_pt2 1)
    ) y: }$ Q3 h2 b$ W4 R4 F
  7825.     (set_tile_pt3 1)
    8 ~' U+ @/ z# @) r6 u0 A% [
  7826.     (set_tile_pt4 1)
    * h. p0 I1 e- ^
  7827.     ;; Define action for tiles
    , g- g! Z" U6 q& w6 G
  7828.     (set_action_tiles)! q! b: G7 N# `+ G7 H
  7829.     (setq dialog-state (start_dialog))
    # a+ e. l/ y- o  X& N& R4 c5 L0 A
  7830.     (if (= dialog-state 0)$ A' t# l+ _- s# o5 ~% Y! j: s& ~
  7831.       (reset)
      N! c* @) X- f2 x$ U
  7832.     )+ C9 e( i( R, ^$ L. {2 u5 x9 N" i- Q! d2 i
  7833.     (if (= dialog-state 1)5 Y1 V% c7 j8 k' N& g5 e
  7834.       (modify_solid)$ ^4 p( q; {9 i6 R) p& U7 x" K# l, p
  7835.     )
    # g6 {8 o) M! E' N- X& K/ E
  7836.     (if (= dialog-state 3)
    , X% M, _( g3 G2 r6 h6 A
  7837.       (progn" b8 j' r; _' y0 w6 n/ t8 ^
  7838.         (modify_solid)$ F3 f; n% t' |- Y  R' s, o
  7839.         (setq pt1 (getpoint (list x1 y1 z1) "\nFirst point: "))+ a  J" ?0 |" U
  7840.         (ver_pt1 1)( |! J/ `8 ]( ^* `4 z/ O
  7841.         (ddsolid)
    1 |% T9 @, L4 w4 v- U
  7842.       )8 ]  O* X2 W4 t9 c8 F$ W
  7843.     )& |2 B. \1 E0 U! |6 S7 x8 R0 o
  7844.     (if (= dialog-state 4)
    3 P( {6 }/ X2 n. W2 q
  7845.       (progn
    . x* J# ?  l3 s% ]. C
  7846.         (modify_solid)
    $ {% J7 D, v, ]! z& i
  7847.         (entmod elist)" u4 Z. |4 v! j  z
  7848.         (setq pt2 (getpoint (list x2 y2 z2) "\nSecond point: "))
    % K9 J- A; }% P# e! Q" m
  7849.         (ver_pt2 1)
    2 a: ]0 F1 z$ B6 E
  7850.         (ddsolid)
    ( x4 N$ E! l" x
  7851.       )" f4 ~% O$ d0 e# p
  7852.     )
    ! f6 {  B1 q9 k( d+ l" z% A
  7853.     (if (= dialog-state 5)
    5 U5 ^3 x; L" G
  7854.       (progn7 Q7 Q7 a, [# [" a! N
  7855.         (modify_solid)/ U+ L2 e* ]+ u' @
  7856.         (setq pt3 (getpoint (list x3 y3 z3) "\nThird point: "))3 V# `/ ?$ z. t+ A. j: r
  7857.         (ver_pt3 1)2 l  z; T) {/ j
  7858.         (ddsolid)
    7 Z% L# d- u6 d$ B1 q* o7 J
  7859.       )
    3 I3 ]. C' V$ j4 p0 k+ {& L
  7860.     ); Y# M( F/ y9 N0 X6 D! Z
  7861.     (if (= dialog-state 6); x3 Z$ s+ {' O8 R
  7862.       (progn3 ~5 T; J, N/ W1 a) A) q# S) c
  7863.         (modify_solid)
    7 q$ H6 w& K- K5 v; a6 m7 {- s2 b
  7864.         (setq pt4 (getpoint (list x4 y4 z4) "\nFourth point: "))$ H# M# c9 q  X0 t8 a
  7865.         (ver_pt4 1)# G7 @1 Q6 Y7 ~- V4 n' T
  7866.         (ddsolid)
    9 m0 c! ?, X! q2 j
  7867.       ). I/ y- E/ N) m
  7868.     )
    % L+ T6 W6 I7 e
  7869.   )
    ' o7 w% ~. p  n6 K' n8 t( w* V
  7870.   ;;
    4 ]! \8 K' X7 F
  7871.   ;; Modify 3DFACE: w7 x* Z% e% L/ U
  7872.   ;;0 R+ Q8 m5 F  {/ x1 D+ ~! @" y
  7873.   ;; Check visibility of edges, L( R$ ?% m0 F2 @6 ]* S
  7874.   ;;1 M# p/ a' r: W4 T
  7875.   (defun edgetest (/ bit1 bit2 bit3 bit4)8 E+ i3 k4 f0 j, e
  7876.     (if (= edge1 "1") (setq bit1 0) (setq bit1 1))
    9 Y/ T( c) a* n1 T- |
  7877.     (if (= edge2 "1") (setq bit2 0) (setq bit2 2))
    . R+ `+ G' C7 u" Z5 S2 j3 z! X
  7878.     (if (= edge3 "1") (setq bit3 0) (setq bit3 4)); M9 ?$ i! P! l$ D
  7879.     (if (= edge4 "1") (setq bit4 0) (setq bit4 8))
      ?7 t" x. ]5 v8 w
  7880.     (+ bit1 bit2 bit3 bit4)' Z& A, l" A" K$ o6 `1 C7 e
  7881.   )
    * q  z7 H$ C/ o" N$ W
  7882. % ?; ^$ ~5 ?" A* M
  7883.   (defun modify_3dface ()+ ]  N% @; Y8 }8 W
  7884.     (modify_properties). I. _- v6 H- b! y. l9 |
  7885.     (setq pt1 (list x1 y1 z1))
    ! N0 i4 y' Z# I
  7886.     (setq pt2 (list x2 y2 z2))
    - j/ I9 G; q5 v. I% ~
  7887.     (setq pt3 (list x3 y3 z3))
    3 D6 @/ T3 S9 N7 J; C* D' i
  7888.     (setq pt4 (list x4 y4 z4))
    7 v- Z% Y5 h9 |4 `2 L* A
  7889.     (tempmod pt1 10 0). S% O; c8 i8 f
  7890.     (tempmod pt2 11 0)0 h, @) U4 x$ K
  7891.     (tempmod pt3 12 0)9 w3 ]' x9 S. c# i) x
  7892.     (tempmod pt4 13 0)
    7 {! F; p; Z0 a3 M8 n" c
  7893.     (tempmod (edgetest) 70 nil)
    4 U5 _$ g$ R; P8 D6 F8 Q* H
  7894.     (entmod elist)5 E  T, m2 e0 S7 _
  7895.   )6 T- n% J5 v5 n3 G& y, C

  7896. 8 n1 a: A# J4 v
  7897.   (defun dd3dface ()
    3 x1 o2 q$ Q+ f9 k, g
  7898.     (if (not (new_dialog "dd3dface" dcl_id)) (exit))/ h+ ?/ ?5 i6 U+ v$ ]
  7899.     (set_tile_props). E7 g- W) ]+ [9 t' g" @
  7900.     (set_tile_handle)+ I, R: @! Z* o6 {- J
  7901.     (set_tile_pt1 0)& v- k7 a2 Q6 o) S. `' a; o
  7902.     (set_tile_pt2 0)8 Z% q/ x) q8 F$ d9 p
  7903.     (set_tile_pt3 0)3 o2 {! A' ]2 C- e
  7904.     (set_tile_pt4 0)
    8 W; H" v& b1 z& A2 Q
  7905.     (set_tile_edges)5 \! M" d3 ]/ C$ [6 C) M8 @
  7906.     ;; Define action for tiles
    9 }  j$ b* j) Y4 H  C7 _4 d( R: N) p" S
  7907.     (set_action_tiles)$ S) K9 k5 X5 Q1 J; k% Z
  7908.     (setq dialog-state (start_dialog))
    ' J3 D7 P- K& }" e
  7909.     (if (= dialog-state 0)
    9 ?' q& Y* m* c% `
  7910.       (reset)
    % |# X# B2 Q6 ^
  7911.     )0 C% j% ]: j& L7 f! h
  7912.     (if (= dialog-state 1)7 ]7 ~4 U) j0 X: j0 Y
  7913.       (modify_3dface)
    9 r8 L9 ~$ ]' j  h. c1 r, @
  7914.     )+ H4 N. v  Z, E5 `9 a
  7915.     (if (= dialog-state 3), g' \5 d& `$ k* W  m. E
  7916.       (progn
    8 w7 T' j8 f7 H9 ^
  7917.         (modify_3dface)
    5 Y" j3 X. O# ~/ y6 O  {% b0 `
  7918.         (setq pt1 (getpoint (list x1 y1 z1) "\nFirst pt: "))
    . e+ y5 S! Q6 \
  7919.         (ver_pt1 0)
    / Q- m! i% G; Q/ M
  7920.         (dd3dface)/ i# w: }1 \: l! I
  7921.       )$ d4 s' _0 s# N
  7922.     )
      S) ~; H4 A! I: [/ _7 A* \
  7923.     (if (= dialog-state 4)4 {8 V# s: I6 ~2 G( U' ~
  7924.       (progn/ ~. ?: y; [, P! z, x
  7925.         (modify_3dface)3 @, [: g" A8 h/ {6 Z
  7926.         (setq pt2 (getpoint (list x2 y2 z2) "\nSecond point: "))4 e1 K$ C4 ~' G! T* A: S; y
  7927.         (ver_pt2 0)
    4 ~, n2 Y' M# v
  7928.         (dd3dface)/ l0 v- t5 h, Q4 W  ]) q: P# [1 F
  7929.       )1 W4 S4 \' A1 D8 O' A5 T
  7930.     )
    ' C2 z# ~8 E1 n; t# E# }
  7931.     (if (= dialog-state 5)1 W- i' N  o# {+ q5 Q5 v
  7932.       (progn
    % a" m( f3 C" v9 v: R: l
  7933.         (modify_3dface)
    + J! J0 b( q% ^+ X
  7934.         (setq pt3 (getpoint (list x3 y3 z3) "\nThird point: "))
    . }3 B7 I  m: m6 A# E
  7935.         (ver_pt3 0)5 v0 O5 T+ y3 b& a/ A& ^
  7936.         (dd3dface)
    , ^4 m4 M; z. r+ j6 _% U
  7937.       )
    1 n5 S' T6 I/ B1 V
  7938.     )2 i! Z1 Q% H! p7 G( o' {+ @5 H
  7939.     (if (= dialog-state 6)
    0 w: ]  M  ?; v) G6 Y8 L$ k
  7940.       (progn
    % M4 l3 I* T$ ]" j  P" t
  7941.         (modify_3dface)
    . d$ v3 B4 }5 N+ n* d- a# q
  7942.         (setq pt4 (getpoint (list x4 y4 z4) "\nFourth point: "))4 f$ P9 U2 H% ^7 k% }8 K5 j& O( h+ B" R
  7943.         (ver_pt4 0)
    # {) G5 }: _4 L8 ^- Z
  7944.         (dd3dface)
    # F5 a& k8 T1 p& @* c) V* e
  7945.       )
    3 N& u5 _# |4 ~. |
  7946.     )* e5 E  _: J! i/ ~* W7 b# M
  7947.   )
    ) ~0 T1 F: e9 t! V/ e8 J
  7948. , c# X- g6 v. t4 i7 q5 d
  7949.   ;;& }$ u! T( K: o5 `5 ~9 h
  7950.   ;; Image functions
    . Y. m; r2 b6 z$ u
  7951.   ;;
    " v" ]" m" F7 w
  7952.   (defun image_scale (/ upixel en n userscale temp)6 k  z) c+ l1 o5 j* G3 Z9 M6 [6 P
  7953.     ;; Calculate the size of an image pixel in AutoCAD units& e& X" K1 ~+ T  Q' r) \
  7954.     (setq upixel (distance '(0 0 0) (cdr (assoc 11 elist))))3 M9 x) U3 r5 }4 x5 g
  7955. / _7 v% A! T/ c: P
  7956.     ;; Retrieve the user scale0 s7 W3 L) A7 C) |
  7957.     (setq en (dictsearch (namedobjdict) "ACAD_IMAGE_VARS"))
    7 L4 O& ~* B, @8 U+ n

  7958. & V5 P" A! Z  J* C! b7 _! M8 w
  7959.     ;; Next, extract the image units and pixel resolution
    3 g$ T6 M6 J* P( z
  7960.     (if (or (= 0 (cdr (assoc 281 image:olist))) (= 0 (cdr (assoc 72 en))))
    1 J1 P3 }1 j- Z  s
  7961.       (setq image:scale (* (cadr (assoc 13 elist)) upixel))
    / `) Z: o) W# @4 A; p
  7962.       (progn
    * B: w, c4 m% P' R
  7963.         ;; Convert the user scale to the proper word( Z8 x4 y. Z- R6 n# P
  7964.         (setq n (cdr (assoc 72 en)))
    1 L$ s8 A+ u7 l  }& Z
  7965.         (setq temp (getvar "LUNITS"))9 t+ r( j; Z& R4 c7 P. A1 @+ n
  7966.         (if (and (/= n 0) (or (= temp 3) (= temp 4))) (setq n 5))
    2 z3 n+ ^/ y0 a4 ~* k  Z7 t+ n; R5 E( Y
  7967.         (if (= n 1) (setq userscale "Millimeter"))
    + }" K' V$ y0 [: H5 b
  7968.         (if (= n 2) (setq userscale "Centimeter"))' P1 C* q% r" a. [6 k
  7969.         (if (= n 3) (setq userscale "Meter"))1 ]) m& a% Z% c$ Z
  7970.         (if (= n 4) (setq userscale "Kilometer"))9 N) U# V, M$ h6 w3 }: ?/ F8 S
  7971.         (if (= n 5) (setq userscale "Inch"))! j' d1 S  u: l. C8 q
  7972.         (if (= n 6) (setq userscale "Foot"))
    & _- u/ Y7 h/ h, m
  7973.         (if (= n 7) (setq userscale "Yard")); T" d; _" a/ k$ K' W
  7974.         (if (= n 8) (setq userscale "Mile"))
      e% X/ x7 c0 M' @
  7975.         (setq image:scale (/ upixel (cvunit 1 "Millimeter" userscale) (cadr (assoc 11 image:olist)))); E) ~, L1 @# X' G, w- [8 r8 T' O
  7976.       )
    # f# l" u! i9 B
  7977.     )! _, G% |) r1 b# u8 B
  7978.   )
    / x% c9 [9 l2 J& W6 J
  7979. 1 W' M6 _# i( \/ Z+ A9 X
  7980.   ;;) p: A) v  {; c2 O7 a
  7981.   ;; Scale factors for block insertions
    8 t5 S1 C$ s0 Y# b7 o* d2 A2 U/ l
  7982.   ;;
    8 A4 X/ u& G; r4 j
  7983.   (defun image_set_tile_scale (/ temp)
    * H% T6 O  l# _: F* f
  7984.     (setq temp (getvar "LUNITS"))
    ' P  t( e6 K( z1 \7 ^
  7985.     (setvar "LUNITS" 2)
    8 s8 q7 q7 L2 @9 [  D
  7986.     (set_tile "xscale" (ai_rtos (* image:scale image:mult)))/ L# l' P) Y( I3 N# }1 h7 m1 O4 ]( ]
  7987.     (set_tile "wid" (ai_rtos (* image:width image:mult))). ~0 D4 n0 D0 V* Q+ q+ j
  7988.     (set_tile "hght" (ai_rtos (* image:height image:mult)))
    5 ^& Q8 g5 G) T+ H# V6 P
  7989.     (setvar "LUNITS" temp)
    ' X0 a- h9 Z4 ?, w$ y
  7990.   )
    + H$ M% J4 l, |$ w

  7991. # m3 W% w- S( @1 C  ~% g, _% ~3 F
  7992.   ;;# @  A% h2 W) O3 e3 m
  7993.   ;; Set the scale, width and height values appropriately.
    . Q& O" I4 ?: ?; p
  7994.   ;;% y8 }0 H3 e. W9 X1 i
  7995.   (defun image_update (field value / orig_value new_value mult)/ I7 V$ w# S, u& w% z% t2 _' D- x
  7996.     (if (= field "xscale")
    4 K/ R& i" V' H
  7997.         (setq orig_value image:scale)
    1 ^# U. H/ Z' c2 x& }7 V
  7998.     )& N/ [2 N9 B7 N. Z3 j+ g# p0 z
  7999.     (if (= field "wid")- T3 D/ B' r2 _7 ~6 v! @+ U- `
  8000.         (setq orig_value image:width)
    6 u! x9 Y& U( F, ?
  8001.     )
    + p, i! F) ~$ h8 i
  8002.     (if (= field "hght")! T3 j1 F& Y) |$ c$ v: n
  8003.         (setq orig_value image:height)
    ; w4 @% d. {6 _" `5 ^9 i) n
  8004.     )
    * L2 A! E" v& G" \' g- `, P
  8005.     (setq new_value (verify_d field value (* image:mult orig_value)))
    , ]! @1 R6 s8 i9 R# g% y
  8006.     (if (/= new_value old_value)
    / F# l4 ]4 W0 x8 ~: e6 |- K! S
  8007.       ;; Make sure the user has entered a sufficiently large value
    6 j- u+ }4 Z% F
  8008.       (if new_value
    4 l& M* i6 L9 b
  8009.         (progn
    5 n) t6 Z) G' e5 E
  8010.           (if (< new_value 1e-8)
    # A& p, o' d; Y
  8011.             (setq mult image:mult)
    9 {: z+ B$ v. @- z
  8012.             (setq mult (/ new_value orig_value))
    4 Y: Q( x9 a9 I( V; ]
  8013.           )( b: X& u6 A8 U/ Z
  8014.           (setq image:mult mult)8 q' y. D3 R; E# \
  8015.           (image_set_tile_scale)4 S( |$ Q7 H9 d: c0 \
  8016.         )
    7 H! n. l: s, }
  8017.       )
    ( O. k" e' b2 u% W$ \( H
  8018.     )
    ( F4 Z  N' i4 ^4 _$ X" O1 d* n" S
  8019.   )  Y: \$ D! s6 [# a4 L  B1 x! d6 K
  8020. 4 E: u3 x$ a- S' D) [, O
  8021.   (defun image_disp_opt (bit)- w: f4 M1 h* s+ Y
  8022.     (setq image:options (Boole 6 image:options bit))
    ' p, w) }0 E% g& B& M1 a
  8023.   )
    9 p+ k) C/ L  h9 A% h6 g

  8024. ( C) I2 l' K# Z" V3 T1 d9 T
  8025.   (defun image_modify ()  V- o( z4 m3 X9 b) z( j
  8026.     (modify_properties)
    * F! l' x  m! ~5 m  f/ k/ Y
  8027.     (setq pt1 (list x1 y1 z1))
    7 B$ _, U1 M" O; x% V
  8028.     (tempmod pt1 10 0)6 G# x, m8 A! h$ p8 E* M: ^
  8029.     (entmod elist)
    + M  ~; a, a% t/ x  C
  8030.   )
    & j1 O! l, g& }/ t) O4 `
  8031. 9 S. Y1 k$ J2 b7 a  u" ?7 N
  8032.   (defun image_clean_variables ()
    & C; z4 a1 ?2 }$ @# y2 Z8 T
  8033.     ;; Clean up global variables used here7 ?, r5 W/ e/ D3 c4 k
  8034.     (setq image:scale nil)
    ; A- B/ B! H, b8 F. \0 x
  8035.     (setq image:angle nil)0 }+ K& M/ W& T( s1 C* z. ^! w
  8036.     (setq image:width nil)
    9 X- E+ {7 _! \) h
  8037.     (setq image:height nil)
    $ @& w5 ~2 o% `) x; v" l. |
  8038.     (setq image:options nil)
    # `1 ~% a, @, j5 S
  8039.     (setq image:oname nil)
    ( E$ y7 |+ `" N3 a+ K) ^- x4 H
  8040.     (setq image:olist nil)
    ( J) ^' H) D4 _
  8041.     (setq image:mult nil)+ n2 V7 i% D9 d: C1 O
  8042.     (setq st_ang nil)
    8 G; s, o1 N' B; L
  8043.   )/ Z7 J% x! c9 J& a; k0 S6 ?
  8044. 2 }" x5 M+ U9 H5 H9 _
  8045.   (defun image_scale_vector (v1 value)3 L1 ?6 N+ e  g, a7 ~. _
  8046.     (list (* (car v1) value) (* (cadr v1) value) (* (last v1) value))
    * u; c, v/ o+ w& q, }# n! J* I+ g
  8047.   )2 q0 T- B" [$ _. J& `" A; B) e2 }

  8048. ' i: J% Y- H5 ?, S
  8049.   (defun image_cross_product (v1 v2 / vx vy vz)
    0 r2 X# N! g0 `
  8050.     (setq vx (- (* (cadr v1) (last v2)) (* (cadr v2) (last v1))))
    2 G# p0 H5 s. Z1 ^$ h6 G+ P4 @
  8051.     (setq vy (- (* (car v2) (last v1)) (* (car v1) (last v2))))
    ) O2 I; b3 w( l3 m, W
  8052.     (setq vz (- (* (car v1) (cadr v2)) (* (car v2) (cadr v1))))
    0 @5 a+ @6 ~/ d* V6 ?* b2 Z
  8053.     (list vx vy vz)
    3 Z0 e, i. Y5 L+ I6 \- x
  8054.   )% {4 N- ]- ~- M8 X  X, p
  8055. 2 L# z' `7 d* @" E9 p4 K
  8056.   (defun image_dot_product (v1 v2)1 o8 l2 T# E2 B& N# O+ A" w) X- C  B
  8057.     (+ (* (car v1) (car v2)) (* (cadr v1) (cadr v2)) (* (last v1) (last v2)))6 N/ I+ y9 p0 I  k
  8058.   )
    , H1 `" f2 m$ \; ~* ^7 z1 N5 E  X

  8059. / m9 Q; h0 g7 g
  8060.   (defun image_add_vector (v1 v2)7 E( H9 S6 v! K8 b* Y
  8061.     (list (+ (car v1) (car v2)) (+ (cadr v1) (cadr v2)) (+ (last v1) (last v2)))1 Z# `4 j, k; z- x
  8062.   )3 d/ u6 `4 |6 a

  8063. ) \1 k) s* W! u" j/ ?: _3 g
  8064.   (defun image_subtract_vector (v1 v2)
    9 \* ~+ c" l* q0 Y
  8065.     (list (- (car v1) (car v2)) (- (cadr v1) (cadr v2)) (- (last v1) (last v2)))
    7 W: C( z/ T) U" O
  8066.   )
    ) z: P& N; E3 r. u6 m4 \% W5 c

  8067. - s1 P1 }, a( w/ A: u
  8068.   (defun image_normalize_vector (v1)) u( p) M# p9 \. f7 F7 P
  8069.     (image_scale_vector v1 (/ 1. (sqrt (image_dot_product v1 v1))))
    : h! D; J/ G" M( F0 U+ ?
  8070.   )1 G% j0 i) }% i% l1 D# B! i
  8071. $ N5 c% {7 C% X
  8072.   (defun image_rotate_vector (vector angle axis / along_axis axis_x_in_rot_plane axis_y_in_rot_plane in_rot_plane)
    : y! r: ?% U6 E% \
  8073.     ;; Normalize the axis
    ( N9 B) }- N* u
  8074.     (setq axis (image_normalize_vector axis))
    ; a* p. X! f5 M! o# t* F
  8075.     (setq along_axis (image_scale_vector axis (image_dot_product vector axis)))* I8 Y$ F" ~6 x& i% ]5 [/ Q9 g
  8076.     (setq axis_x_in_rot_plane (image_subtract_vector vector along_axis))* c' I% t$ v* g" M9 e) K
  8077.     (setq axis_y_in_rot_plane (image_cross_product axis axis_x_in_rot_plane))
    % w; x1 z5 U. [- _: }4 P2 W8 r
  8078.     (setq in_rot_plane- R0 a; r+ Y6 Z0 j" M  u* i  Z- b- I
  8079.       (image_add_vector1 c" t; J; Q# L0 o6 z
  8080.         (image_scale_vector axis_x_in_rot_plane (cos angle))
    ) H7 p8 P3 {. p. V
  8081.         (image_scale_vector axis_y_in_rot_plane (sin angle))
    . D! R1 V* R' K0 `. _% c
  8082.       ). ^" e" q4 i' R8 f: @
  8083.     )
    ( f9 C  [* p6 f* s
  8084.     (image_add_vector along_axis in_rot_plane)0 D0 |4 F) J+ H5 a! y7 K* Y- Y
  8085.   )* H. `: N1 `# W
  8086. 3 y  i0 {! J  P' X/ l" ^" q$ j9 \
  8087.   ;;6 Q2 _  ^1 h' _2 q7 t
  8088.   ;; Calculate current rotation angle if appropriate.
    4 n; C& ]. Q, T8 V3 K- i; \' g$ s
  8089.   ;; If not, grey out the rotation field.% k! n! U- i. L+ Q9 e
  8090.   ;;
    ; K0 N8 W# B0 ~4 d9 @9 m! I; w+ s
  8091.   (defun image_rotation (/ normal rlength zlength sqrt_tolerance)
    ; z0 H/ }( a# P
  8092.     ;; Determine if image normal is codirectional with* L8 f+ g3 s3 E( N6 E6 K1 l
  8093.     ;; the current UCS Z-vector.2 g+ [: g( m0 {7 @* \8 {! Y
  8094.     ;;/ W- L( V. ~  g* ^' Q' ?
  8095.     (setq normal (trans (image_normalize_vector (image_cross_product (cdr (assoc 11 elist)) (cdr (assoc 12 elist)))) 0 1 1))
    8 P; ?* P6 c0 t# z9 m+ b) l  H# ^
  8096.     (setq rlength (+ (* (car normal) (car normal)) (* (cadr normal) (cadr normal))))
    9 v4 C. H# d2 N6 D
  8097.     (setq zlength (* (last normal) (last normal)))) f$ k+ @4 O3 f* j
  8098.     ;; Note that the value .0001 in the radians is approximately 0.0057 degrees.2 C  [2 F  R* P8 Y* Y
  8099.     ;;( }" n/ j) l5 T. N7 K
  8100.     ;;                cos(.0001)^2
    & }  K! L+ v; I, @4 k
  8101.     ;;   Tolerance = --------------
      R+ ]' l& W3 Y  I# H$ v
  8102.     ;;                sin(.0001)^2
    ; I( A. S! S/ n' K; n
  8103.     ;;8 p0 o3 }' e3 d1 w; L- O
  8104.     (setq sqrt_tolerance (/ (cos 0.0001) (sin 0.0001)))3 c- j2 \* P# w! \# I1 `6 l; ], i0 y
  8105.     (if (and (< (* rlength sqrt_tolerance sqrt_tolerance) zlength) (> (last normal) 0))
    + d/ ^+ @1 P8 g
  8106.       (setq image:angle (angle '(0 0 0) (trans (cdr (assoc 11 elist)) 0 1 1)))& [) p1 C0 L. N
  8107.       (progn; G/ ~$ [* h$ O5 E
  8108.         (mode_tile "st_ang" 1)
    / ~) X: k8 U0 F# o' [: }$ J
  8109.         (setq image:angle 0)6 z, a$ H8 V, x; G. A7 [0 G
  8110.       )
    1 f9 n  x# e9 z
  8111.     )
    " }% {6 z" N5 P+ g1 R
  8112.   )
    % G' [8 x  W. R1 b  H, ?! z

  8113. ( L6 u! I* y7 w
  8114.   ;;
    6 T6 E0 A" v1 s* s: Z4 D
  8115.   ;; Modify Image
    - E5 `) M  r2 s% M, ?$ F$ \
  8116.   ;;
    # X/ y3 ^& G9 n
  8117.   (defun modify_image (/ u_vector v_vector z_vector)
    : h0 G$ O8 S  R5 t5 [
  8118.     (modify_properties)
    ; s. b* }$ e- K) N% g
  8119.     (setq pt1 (list x1 y1 z1))6 v% N3 R4 L8 k4 S$ Q5 v
  8120.     (tempmod pt1 10 0)
    ! R& n* ~) n1 u3 Z/ T
  8121.     ;; Make display option changes to image! }( x7 N( k( x( _
  8122.     (emod image:options 70)/ Q+ D2 g$ Z- i1 Z! Y
  8123.     ;; Get the u and v vectors2 m# H* q- w9 O$ V# o2 t
  8124.     (setq u_vector (cdr (assoc 11 elist)))
    ( ?( u6 P/ A. i0 C
  8125.     (setq v_vector (cdr (assoc 12 elist))); f& ~- n  s8 S" D5 K/ @

  8126. 4 R9 y5 ^6 u$ I
  8127.     ;; Make scale changes to the vectors
    # q- Z" [9 O: g9 x
  8128.     (if (/= image:mult 1)
    6 p' n9 Q6 ?. \: O2 ]. N
  8129.       (progn
    % ?5 F! Q$ P- N% x
  8130.         (setq u_vector (image_scale_vector u_vector image:mult))/ L' s) @+ }2 {0 X8 c# W
  8131.         (setq v_vector (image_scale_vector v_vector image:mult)): F6 t7 e4 ?* r. |3 v
  8132.       )
    $ I! l/ \& g3 n8 R$ [( G
  8133.     )7 j- j6 e5 S) V% A
  8134.     ;; Rotate the vectors/ P0 ]4 K& o* z% u4 ^
  8135.     (setq st_ang (- st_ang image:angle)): Q1 j# p* g- u6 R3 v
  8136.     (if (/= st_ang 0)
    # N+ }3 m, ~, H, C* f' U1 G7 @
  8137.       (progn7 S$ D4 x( O: ]/ H# n! j
  8138.         (setq z_vector
    + x1 @9 \- w1 b8 m! Y5 [- d! X
  8139.           (image_cross_product
    & C% V% O- F5 ~9 {; R. w! v) M
  8140.             (image_normalize_vector u_vector)- a' k) |; p5 s) E
  8141.             (image_normalize_vector v_vector)/ ~$ n- d! }' j
  8142.           )
    6 l$ c( ^0 I* V' B! Y# y& s
  8143.         )7 K" x$ p4 V! [4 n! S( @
  8144.         (setq u_vector (image_rotate_vector u_vector st_ang z_vector))
    % x- [& }9 Q7 u, t. b
  8145.         (setq v_vector (image_rotate_vector v_vector st_ang z_vector))
    - P& k( h0 s5 v& b
  8146.       )8 n# W! t; ]. z, a9 D/ B$ y
  8147.     ). w: s! x) ?+ g& \" {6 F
  8148.     (emod u_vector 11)  K3 O% A$ }/ V
  8149.     (emod v_vector 12)
    1 [' a' ~  f! ^$ a! ]; Y$ Q
  8150.     (entmod elist)7 X  z2 |  I. m- P5 a1 K5 @! A
  8151.   )
    6 X& E  P: o7 {5 N2 X% u6 k& I
  8152.   r% A6 L5 t6 j# v1 z  p; c) ~
  8153.   ;;8 `- W* s; T( {1 n9 j" n
  8154.   ;; Run imageadjust on given entity, working around possible
    0 i: f8 F% M/ |; S% b+ Y1 m
  8155.   ;; re-entrancy problems
    ( J3 v$ c: e5 B1 r
  8156.   ;;
    ! g1 q2 `* I& X; T! M! L6 {
  8157.   (defun image_adjust (ename)& J( `% _8 m1 j9 m) C0 [
  8158.     (verify_arxapp_loaded "ism.arx") ;; make sure it's loaded...
    4 h! }6 ~  e  _% v, G( _. a
  8159.     (imageadjust ename)
    - [& w) U$ G0 H
  8160.   )
    ! Z  e8 y+ B& O7 f* C! U# q* J
  8161. " H2 K2 b# Q: i3 k3 j( o7 j& I6 ~
  8162.   (defun ddimage (); g! K6 C, i: K2 j7 t
  8163.     (if (not (new_dialog "ddimage" dcl_id)) (exit))
    # J" P2 v4 {* L, C& [- [3 l
  8164. ) T7 }2 ~$ L2 J, o
  8165.     ;; Grey out the thickness field.3 M! m$ Y4 w9 V% l9 Q2 f+ d
  8166.     (mode_tile "b_thickness" 1)
    # C) O1 t" p0 M+ d* E, _9 h. y
  8167.     (mode_tile "eb_thickness" 1)
      W( P1 t2 R2 c6 c* T
  8168. 5 {" {6 o7 G# ^! G
  8169.     ;; Get the associated def object.4 I; G6 L/ @) F. i) ^3 j  x
  8170.     (setq image:oname (cdr (assoc 340 elist)))
    ) c6 X$ D5 \+ K" H* _! u5 K- A
  8171.     (setq image:olist (entget image:oname))
    7 ^* v  A# p. o0 s/ b

  8172. # d+ h, K, L) b, a
  8173.     ;; Set initial tile values" Z( h. r6 R6 x6 W, S8 u: U& Z; Y& u7 v
  8174.     (set_tile_props)
    : m* ~( ~, {. s, }8 g
  8175.     (set_tile_handle)7 N& \, W: \4 b5 q0 U) O
  8176.     (set_tile_pt1 0)
    3 B+ B- _: g0 [7 x) k
  8177.     (setq image:scale (image_scale))9 c, O& N" y& h& g* L
  8178.     (setq st_ang (image_rotation))
      ^/ p+ P. b+ U: H
  8179.     (setq image:width (* (distance '(0 0 0) (cdr (assoc 11 elist))) (cadr (assoc 13 elist))))
    . l" R1 A* j, q
  8180.     (setq image:height (* (distance '(0 0 0) (cdr (assoc 12 elist))) (caddr (assoc 13 elist)))), H9 l- g/ u6 i
  8181.     (setq image:options (cdr (assoc 70 elist)))
    1 f9 n# B% G/ Y  F

  8182. 1 e( Q% N; E% b6 T
  8183.     ;; Record the last multiplier for use in image_update function8 }2 `5 j0 p% {, n& B% p( B/ M5 R9 o7 n
  8184.     (setq image:mult 1)
    ( I5 |# p4 _- B% w5 N' R- l7 [

  8185. ( R7 v! \8 H" r- o* o
  8186.     ;; Retrieve the image name1 \1 a3 R, y1 R
  8187.     (setq fn (reverse (dictsearch (namedobjdict) "ACAD_IMAGE_DICT")))
    ' K( G8 B7 Z2 f9 }' `' I+ N$ z
  8188.     (setq flag 0)
    / D9 s5 G) L( J4 v
  8189.     (foreach n fn; O$ Z: A) h& Y4 Y; t, O) b8 [
  8190.       (if (= flag 1)
    0 d1 _4 d! M8 n9 C1 ]
  8191.         (progn
    ' {5 H4 d( H2 h- O+ O
  8192.           ;; Display the image name
    + Q1 o7 d. `3 H" w0 y8 |
  8193.           (set_tile "image_name" (cdr n))
    / n* }3 Y9 T& W$ B( G' W: H
  8194.           (setq flag 2)0 o/ ?5 C9 s1 U& j  S. c
  8195.         )
    ( p3 O8 z- p1 ~& o
  8196.       )/ T9 U' `0 [+ Z6 o9 c6 k
  8197.       (if (= flag 0)5 [! Q* m0 U: e$ l  U# i
  8198.         (if (equal (cdr n) image:oname) (setq flag 1))' W* m* T9 c! B. `' ]) S
  8199.       )6 L" H8 x& S4 T
  8200.     )9 `! j6 @; `0 o) i( m6 I& f
  8201. , B3 y& H9 u2 N
  8202.     (set_tile "image_path" (cdr (assoc 1 image:olist)))% V- o  e5 d% A$ o
  8203.     (set_tile "st_ang" (ai_angtos image:angle))
    : U9 L* Y. X5 o0 b1 A$ |6 f7 W: W5 }
  8204.     (image_set_tile_scale)
    ; v( p8 c) q4 ~; d7 L  B. N

  8205. ! Q7 |) _: O+ V5 Y
  8206.     ;; Check the appropriate boxes6 j& w, b# {3 Z5 J4 ~+ t, {, {
  8207.     (if (/= (Boole 1 image:options 1) 0) (set_tile "image_show" "1"))8 h. v3 w3 c) |' |9 ~
  8208.     (if (/= (Boole 1 image:options 2) 0) (set_tile "image_non_ortho" "1"))
    $ {5 ?4 ^+ e# Q: j- _5 p  U
  8209.     (if (/= (Boole 1 image:options 4) 0) (set_tile "image_clipped" "1"))% ^% v; i- m4 D# L5 s
  8210.     (if (/= (Boole 1 image:options 8) 0) (set_tile "image_transparency" "1"))/ j$ f3 t3 N4 Z: j" J( H" k
  8211. : q! t1 M, N/ T
  8212.     ;; Define action for tiles1 W+ [0 b! ]3 o5 F  O
  8213.     (set_action_tiles)" y% u% ~7 d8 k
  8214.     (action_tile "xscale" "(image_update \"xscale\" $value)"), `. z  N8 U: O) }7 L% e3 z
  8215.     (action_tile "st_ang" "(ver_ang1 $value)")
    9 [8 F7 V% Z! F0 V. h. p* m
  8216.     (action_tile "wid" "(image_update \"wid\" $value)")
    ! F  z& V% _8 z: J. m, b/ {5 Z0 s* h3 |
  8217.     (action_tile "hght" "(image_update \"hght\" $value)")8 G0 w) n7 T) y$ t' d
  8218.     (action_tile "image_show" "(image_disp_opt 1)")4 O2 @' K# l3 N, O
  8219.     (action_tile "image_non_ortho" "(image_disp_opt 2)")6 [* L, f& m/ j+ z; L  ^( J
  8220.     (action_tile "image_clipped" "(image_disp_opt 4)")
    # X' G5 W8 c5 Y7 l+ o/ x2 j
  8221.     (action_tile "image_transparency" "(image_disp_opt 8)")
    - r7 r# L; m. d+ z$ y( s
  8222.     (action_tile "image_adjust" "(done_dialog 4)")
    $ Y  U  j2 g" G$ e- f: w
  8223. " N' U' ]( A" S& F# D; J. ~2 {2 u* a) K
  8224.     (setq dialog-state (start_dialog))
    0 D+ X( P" S' _3 e# E3 A/ h- O* K/ F4 ~
  8225.     (if (= dialog-state 0)
    * D7 o$ r+ e& M# T' F0 m
  8226.       (progn
    7 N3 E5 V  A/ z6 `$ Q# x- Z
  8227.         (reset)4 i, W: L# S, C
  8228.         (image_clean_variables)* x" y' s& R( U- r- A
  8229.       )7 V: s7 `6 X7 G* p+ X
  8230.     ); ~/ Z7 F" K" ^5 b, H6 f
  8231.     (if (= dialog-state 1)
    . b6 n, O7 E7 f2 k
  8232.       (progn
    8 S, g3 {6 U+ q4 }
  8233.         (modify_image)& h2 f; P2 Q5 C! |2 _
  8234.         (image_clean_variables)
    0 }7 Y# E$ T& C7 h& L
  8235.       )
    - T; `' ~4 z; h9 L( ~' Y# y) S
  8236.     ), E9 ^- M+ `! @# b; l4 [8 y4 g
  8237.     (if (= dialog-state 3)
    7 f# T8 ]3 \: \) \
  8238.       (progn8 q% w* f1 `3 T9 j1 ]
  8239.         (modify_image)4 a+ P& z; G6 [1 O' F; A- H
  8240.         (image_clean_variables)3 L  M1 @' x$ t% f, e6 T. p& `
  8241.         (setq pt1 (getpoint (list x1 y1 z1) "\nNew Insertion Point: "))
    $ y+ ^, B( {. k1 c
  8242.         (ver_pt1 0)9 B" P- L; U+ k' M4 Q) |. W' U! `
  8243.         (ddimage)
    9 ^6 f3 u1 ~2 O5 F5 Z  _
  8244.       )
    ( _, n6 F- B. r- W6 j# U6 C5 }
  8245.     )
    ! O  l/ r8 J  G2 o
  8246.     (if (= dialog-state 4)/ I" M- l! o. k3 q. Z
  8247.       (progn
      i' ?! v7 ]$ A
  8248.         (modify_image)
    # j" u7 m( u0 g" u6 W/ W# S
  8249.         (image_adjust ename)
    & P) P0 E: ~9 U! E& {
  8250.         (setq elist (entget ename))# ?. a: A9 G! K7 X3 t) l! I
  8251.         (ddimage)! o: ~8 u: Y' V3 M
  8252.       )8 q( A- G$ H2 @3 r5 U7 Y
  8253.     )
    : S9 `4 A# Q% y  {$ @! ?9 Q
  8254.   ): l& Y/ z" q4 j! ?& Y: Z2 J
  8255. ) C3 U5 a4 [/ B4 c% W4 P8 g
  8256.   ;;
    / y( \3 y7 e1 Z" O
  8257.   ;; Modify BLOCK (and its Attributes, if any)% e( v. l) @) Z- m, r7 J5 g
  8258.   ;;4 ~5 C( `. c# U. V& d* R# f
  8259.   (defun modify_block ( / el en2 p1 p2 oldp1 oldp2 new_hgt old_hgt attr' X9 l, f) t/ r  \" ]: r
  8260.                           new_wid old_wid old_rot scaling old_scale& C3 f$ F0 R- }) R
  8261.                           xdelta ydelta zdelta xbase ybase zbase ipos)
    # b: q+ p3 s& o$ Y# s: j' y
  8262.     (modify_properties)
    / L+ v" |8 q8 h* R1 _! H5 _+ V& A

  8263. ( F# z6 U% N' v0 @6 t
  8264.     ;; First, translate and scale the Attributes, if there are any.
    6 F& _8 U9 r  A; ~
  8265.     (setq old_rot   (cdr (assoc 50 elist))0 W: f3 x$ H% R  w
  8266.           old_scale (list (cdr (assoc 41 elist))
    7 e' [( `4 y0 P; z
  8267.                           (cdr (assoc 42 elist))
    4 r- E" X0 P5 a5 L0 f" G" T
  8268.                           (cdr (assoc 43 elist))
      K4 t" D) L/ Q
  8269.                     )
    ( w6 {( P! \5 [& m! z
  8270.           scaling   (or (/= xscale (car   old_scale))
    1 l. _5 p3 s0 j' m7 R# G2 ?  k
  8271.                         (/= yscale (cadr  old_scale))
    / c% Q. _" N. u9 ~
  8272.                         (/= zscale (caddr old_scale))3 [* F. h* k9 T( C! w* A1 m
  8273.                     ), U+ v8 \4 f; s# t) z
  8274.           attr      nil               ; No Attributes modified yet
    8 x& g1 Q; H6 h( V& C
  8275.     )
    " A7 A" W2 l/ r+ _# x
  8276.     (if scaling
    ! `$ f! d  h4 Z3 b
  8277.       (progn- @, R& ]8 [* E* Y) J
  8278.         (setq xdelta (/ xscale (car   old_scale))' k8 H2 z8 y7 t/ k: W% w
  8279.               ydelta (/ yscale (cadr  old_scale))
    * ]# \9 M# k+ x2 u* j1 w- K
  8280.               zdelta (/ zscale (caddr old_scale))' M# D  z8 c1 y
  8281.               ipos   (cdr (assoc 10 elist))2 l" H2 [; x8 ?* P. ]* T7 b
  8282.               xbase  (car   ipos)/ i& k4 c4 `% y  i4 y# g+ W- x  ]  r
  8283.               ybase  (cadr  ipos)6 |: P2 `. ^$ {4 ]
  8284.               zbase  (caddr ipos)0 g1 M+ V, F' L! h  I+ O
  8285.               en2    (entnext ename)  ; First Attribute
    " M% M& [3 `2 v- G+ m
  8286.         )
    1 J( Z: }% H8 Q# d8 x

  8287. & H3 N/ c. ?/ h/ a
  8288.         ; If the Block is rotated, temporarily un-rotate it, along& [% [) D) W* |  Q
  8289.         ; with all its Attributes, so the scaling/translation of the# M' L) f0 ]' v$ e& @2 m& x
  8290.         ; Attributes won't have to take the Block rotation into account.
    . L) }+ h7 a3 B0 M
  8291.         (if (/= old_rot 0.0)
    , g' F) A  o4 h3 D
  8292.           (progn
    ; K8 _1 x6 K' Y0 C  m# I0 V
  8293.             (command "_rotate" ename "" pt1 (ai_angtos (- old_rot)))
    , @; j& a9 `1 Z% n8 @0 Z0 a  X
  8294.             (setq old_rot 0.00 h$ c) S/ E# n6 L+ s4 G
  8295.                   elist   (subst (cons 50 0.0) (assoc 50 elist) elist)7 P' L* X" }5 [
  8296.             )  j& s2 j; h2 N- X4 ^7 G# F6 H9 h
  8297.           )
    # M: U. f) b2 a- `# I8 p$ V* k
  8298.         )
    4 j! U( p" c/ o8 P8 D& D
  8299. 6 X0 A# n1 J% u" ^. ^4 g
  8300.         (while en2/ z: ~. V" l1 [# r  o
  8301.           (setq el (entget en2))" M4 E% S+ C3 T- |& P: G
  8302.           (if (= (cdr (assoc 0 el)) "ATTRIB")
    7 ~  t; D7 }, c+ s# N0 f
  8303.             (progn
    $ d. `' E3 E! F  t
  8304.               (setq old_hgt (cdr (assoc 40 el))  ; Height
    2 X# J. E' R- H7 n  P
  8305.                     old_wid (cdr (assoc 41 el))  ; Width-factor
    * `  P- Y- [8 O$ E0 B. w5 `
  8306.                     oldp1 (cdr (assoc 10 el))  ; Generation start point* {+ D& R. ?" x7 a# ?4 R+ G
  8307.                     oldp2 (cdr (assoc 11 el))  ; Optional alignment pt, d  }5 u* _8 [, `7 ^0 r) C
  8308.                     ha    (cdr (assoc 72 el))  ; Horizontal alignment
      h; |( F! E& a) g5 y( S
  8309.                     va    (cdr (assoc 74 el))  ; Vertical alignment
    : P8 S2 j1 z: f' O' I
  8310. 3 x  g  `3 V& r: D* O7 H
  8311.                     ; Translate gen. start point& K5 {  M( u( X6 N* [2 i+ a+ z
  8312.                     p1    (list (+ xbase (* xdelta (- (car   oldp1) xbase)))9 a  S7 }6 @% s' J' b+ t5 {  `
  8313.                                 (+ ybase (* ydelta (- (cadr  oldp1) ybase)))* ?$ h, B0 }) @
  8314.                                 (+ zbase (* zdelta (- (caddr oldp1) zbase)))$ I& U& [. q$ C# x! m! _
  8315.                           )
    5 i0 C+ B4 }! ^. [( @  b
  8316.                     el    (subst (cons 10 p1) (assoc 10 el) el)7 M/ `( f) g1 W( \. T5 y; v
  8317.               )
    / k; M- v* k4 I' I, X6 I! c) K

  8318. : ~  H7 X& a5 m7 r* v4 m6 x6 X0 X
  8319.               ; Translate alignment pt similarly, if present and applicable
    6 e1 P" r* \: n3 Q7 b" E7 Y# {
  8320.               (if (and oldp2 (or (/= ha 0)
    # @6 ?: E- @& p
  8321.                                  (/= va 0)5 |( b+ z. O6 |5 [6 Y# w
  8322.                              )0 [. M$ F! d7 w" U1 m
  8323.                   )
    6 _$ F+ V2 r' v& h( I4 {7 d4 w! h( W; J
  8324.                 (setq p2 (list (+ xbase (* xdelta (- (car   oldp2) xbase)))
    % J% H3 T. I/ C
  8325.                                (+ ybase (* ydelta (- (cadr  oldp2) ybase)))
    % z5 |( `# N1 F2 T
  8326.                                (+ zbase (* zdelta (- (caddr oldp2) zbase)))
    * l6 {1 m) {4 W2 b* d1 t0 B5 I
  8327.                          )
    ! m1 F# a  N- e' k, j! p, H
  8328.                       el (subst (cons 11 p2) (assoc 11 el) el)$ U, P4 N/ s( e
  8329.                 )2 I. `# D9 n8 J
  8330.               )  S3 v) E8 G; ^
  8331. % c  e  h" Q0 W; o% S: u! d
  8332.               ; Each Attribute's height and width-factor were computed
    8 y% f: Q* n! i( Z& X( Y) s
  8333.               ; based on the Block's scale factors.  Adjust them now,
      {, e8 f1 X1 `- [8 g
  8334.               ; by first reducing to values for 1x1 scale...
    2 ]! i# }9 w* H% V
  8335.               (setq new_hgt (/ old_hgt (cadr old_scale))$ h- q0 @1 W: `: W" ^
  8336.                     new_wid (/ old_wid (/ (car old_scale) (cadr old_scale)))' u& h6 D6 T0 h, q
  8337.               )+ t  F, \1 w) ^7 C2 L
  8338.               ; ...and then rescaling.% ~9 A" U* F4 R& ^6 H
  8339.               (setq new_hgt (* new_hgt yscale)% U3 @' N# l5 N
  8340.                     new_wid (* new_wid (/ xscale yscale))! ?. f8 L; X$ P# M) w
  8341.               )
    0 V3 Y. k9 P  u; @- h2 W) c
  8342.               (if (/= new_hgt old_hgt)0 w2 U8 E* Q, u/ c( H/ k3 g
  8343.                 (setq el (subst (cons 40 new_hgt) (assoc 40 el) el))
    8 |, z( K! ~  V2 r) `% t/ p1 V+ _6 Y
  8344.               )7 r8 a6 Z9 w! p4 |& f0 D9 Z) f( R
  8345.               (if (/= new_wid old_wid)" X8 z  E. _# L0 Z
  8346.                 (setq el (subst (cons 41 new_wid) (assoc 41 el) el))
    3 J+ k# v& D! ^. w9 {
  8347.               )1 P2 I. ]) D- E! R2 }
  8348.               (entmod el)3 U8 b& P7 e+ s5 _; I) H! x
  8349.               (setq attr T             ; At least one Attribute modified7 `5 E# k+ U8 K
  8350.                     en2  (entnext en2) ; Next Attribute
    0 B% ~( \/ Y1 f& X: p, K
  8351.               )
    5 F0 _: x) c! ]% _( n7 J1 j- H* b; q
  8352.             )
    , |2 G5 b+ ~+ V& f
  8353.             (setq en2 nil)          ; No more attributes
      S  v8 B5 ?4 s. H1 O5 q" `. L2 x
  8354.           )
    * g- [2 g9 G+ J; M) r
  8355.         )) n% d# c' u' `6 V5 {8 j6 w7 r" u
  8356.       )
    ; G( C7 p9 H6 R6 V( F) D
  8357.     )
    * w! e7 x8 z0 J: k! X

  8358. 6 j. A- v5 o% h. C) c/ ~, z# ^0 O
  8359.     (setq pt1 (list x1 y1 z1))) T- F/ f' l# ?8 V! w0 u3 @3 c
  8360.     (tempmod xscale 41 nil)$ n3 b8 x9 E/ X! G) e5 v
  8361.     (tempmod yscale 42 nil)
    * t- ?% G0 z( v  Y
  8362.     (tempmod zscale 43 nil)
    : @# ], U" J3 G. T' g( y+ ?5 P
  8363.     (tempmod col-sp 44 nil)
    7 ~) b7 t. ~/ C" v& z, ^; @
  8364.     (tempmod row-sp 45 nil)
    % m2 G; @; e2 l( S/ @8 }% B
  8365.     (tempmod columns 70 nil)/ H8 L6 y2 d& C0 {3 m7 B
  8366.     (tempmod rows 71 nil)
    . k+ F8 F1 ?: V0 m8 m0 e" i1 d) k
  8367.     (if (= xclipmode nil)
    2 J  f4 Q) x$ a, c: w% i( |/ f  S$ }
  8368.        (entmod elist)- N- p3 Q1 H& `9 J1 M
  8369.        (setq xclipmode nil)
    ( L0 K0 r/ J8 V5 x
  8370.     )& t6 v1 I; j5 S- a4 i
  8371.     (move_pt1 1)4 s$ @; U) J( H3 o) a: E

  8372. 6 Q/ a' w3 |; z% {4 l
  8373.     ;; Now do the rotation with the ROTATE command.
    1 Z9 e. Z1 s  g' j  Z; u, r
  8374.     (if (/= old_rot rot)
    5 n9 X; u' y( ]2 a9 d# M, ^
  8375.       (command "_rotate" ename "" pt1 (ai_angtos (- rot old_rot)))( u0 U' J: w- _, U
  8376.       (if attr                          ; Else, if attributes were modified,
    ) G; N5 d4 p5 L  ^$ I0 e
  8377.         (entupd ename)                  ;   just regen to force attrib display
      c; y2 a2 K$ E* G. s& B
  8378.       )
    1 `  [. d: r: l# Q( @3 `
  8379.     )
    + y5 i6 b, v, u& k
  8380.     (setq elist (entget ename))
    . }  o' g4 Y; ?3 W% D, ~
  8381.   )
    9 G$ ~4 d. P/ w3 Q; Y
  8382.   (defun ddblock (/ temp temp_xclip newhatch blkname blklist blktype program xrefpath)
    * u+ j- N) W& D
  8383.     (setq newhatch 0)
    8 V0 E/ L, n+ R4 P% C5 j
  8384.     (setq blkname (cdr (assoc 2 elist)))( w6 J  d. N) s3 Z2 y
  8385.     (setq blklist (tblsearch "block" blkname))
    ! R, k" a/ w$ C, Z9 ]  |: |) `
  8386.     (setq blktype (cdr (assoc 70 blklist)))5 `  W" ~4 `& P$ D- f
  8387.     (setq xcliponoff 0)5 i1 U0 m% _. {8 |0 k2 t% U1 v
  8388.     (if (or (= blktype 0)(= blktype 36))
    : R8 n1 C8 c& F6 e0 a. X
  8389.             (progn
    ' [2 [! i6 ]* M3 t
  8390.               (setq xcliponoff (xclipon elist))
    5 H- O6 ?0 Q4 t( R% [$ ?7 @
  8391.           (setq temp_xclip xcliponoff). c5 z1 \" Z" g8 i
  8392.         )8 f! c  Y# r  m+ h
  8393.     )" S3 t4 I3 n2 i. F' d, p
  8394.     (if (= (logand blktype 4) 4)
    # J8 A9 F' [) \7 P# P1 s) O8 f2 P$ _
  8395.       (progn- a: i" e7 E6 l+ J+ k
  8396.         (setq xrefpath (cdr (assoc 1 blklist)))
    6 K3 R9 `7 ^& X* D3 u
  8397.         (setq help_entry "modify_External_Reference_dialog")& L8 f# |  a! v1 @6 _
  8398.         (if (not (new_dialog "ddxref" dcl_id)) (exit))
    / g% [- V7 H. ~
  8399.         (set_tile "Bl_name" blkname)
    & ?3 B8 I, w9 O
  8400.         (set_tile "path" xrefpath)
    ; H4 H- z) S, q3 T" n! t0 J
  8401.       )3 x8 {( @$ p# v# L
  8402.       (progn1 R' D+ R, B( i) \7 r
  8403.         ;; Get program name for use as Xdata app name
    ( u# |6 E* Z, z4 k' K6 Z
  8404.         (if (not (setq program (getvar "program")))
    4 e& H/ W; o" ~
  8405.            (setq program "acad")9 C1 ?# `# W+ K) J4 V! m
  8406.         )
    . p: I9 b0 ?8 a2 B" y8 H
  8407.         (if (and (setq temp (assoc -3 (entget ename (list program))))
    + `5 T( w9 j" p9 D  [" z
  8408.                  (= (cdr (assoc 1000 (cdadr temp))) "HATCH")
    3 X0 |" ]/ I. i6 r9 g( Y# v+ \
  8409.                  (assoc 1005 (cdadr temp)); t. K7 `% Y' E3 O: O4 P
  8410.             )
    4 V" g) f1 G  ?
  8411.           (progn
    6 u3 H' g; R% M. Z* w: O5 C
  8412.               (setq newhatch 1)" }1 Y, H) t( O2 `+ `/ G
  8413.               (setq help_entry  "modify_Hatch_dialog")6 k6 |- B1 x0 }( A9 `$ N/ r
  8414.               ;;; convert the object into a new hatch
    - K# G9 [7 q1 a
  8415.               (ai_undo_on) ;; enable undo
    9 {' H4 y6 x: {2 Z2 w* U% H
  8416.               (COMMAND "_.UNDO" "_Mark")
    1 l$ \8 {1 n! M. |% l/ D9 t' d
  8417.               (COMMAND "_.CONVERT" "_Hatch" "_Select" (cdr (assoc -1 elist)) "")5 {  T3 u1 p7 L7 u; B
  8418.               ;;; suppress nasty message from convert command
    ; O& }4 A" D1 r6 _& ~9 x5 p
  8419.               (princ "\r                                                                      \r")
    . i% F/ Y3 }$ |8 k
  8420.               (setq elist (entget (setq ename (cdr (assoc -1 elist)))))! m6 ?3 o7 W% @: J% n* t
  8421.               (setq old-elist elist)
    " E& i, X; N, u3 k7 L
  8422.               ;;; If we have cancelled ddmodify7 G6 P( W1 X, F6 u1 G7 f, h: m7 f
  8423.               (if (not (ddnewhatch))      ;;; (ddnewhatch) returns nil for Cancel or T for Ok6 J4 G& @. Z1 r* p5 @7 T' n( f: F# o
  8424.                    (command "_.UNDO" "_Back"): ^/ h" v* V- D. [; i6 H
  8425.               )- M" E( X% y: t
  8426.               (ai_undo_off) ;; restore undo state" m* _( G5 p* s) e
  8427.           )
    ( g1 E0 R0 `  Z
  8428.           (progn
    2 U9 [8 D( Y- M. T" H, G
  8429.             (if (not (new_dialog "ddblock" dcl_id)) (exit))- K9 W8 C6 M+ y0 ?: `% H" r
  8430.             (if ( = "*" (substr blkname 1 1))
    8 A# v3 }. o8 v3 p; T7 R6 P! @  {
  8431.               (set_tile "Bl_name" (strcat blkname " - Anonymous block"))
    $ @* `9 O) N0 h) p# h. v
  8432.               (set_tile "Bl_name" blkname)8 T: g: p8 l& ^# X6 N$ \
  8433.             )  N) ^* P, `, t
  8434.             (setq help_entry  "modify_Block_Insertion_dialog")& j0 q; r! W, m% @+ z
  8435.           )
    . Z! K. v) m. e8 ?5 M9 x
  8436.         )3 p( E5 A7 ^+ D
  8437.       )7 x6 o) N' q  G5 J
  8438.     )$ k1 ^- w. D) F* }/ n
  8439.     (if (= newhatch 0)
      v$ X$ j& u) u  T
  8440.       (progn
    % T0 ~6 e! V+ x! @; i
  8441.         (set_tile_props)4 L9 J6 Z; [: N( K; q4 J
  8442.         (set_tile_handle)
    1 G, H; F& L2 N/ l8 k  L
  8443.         (set_tile_pt1 1)
    4 |# F5 g' w/ b9 Z' f4 I2 H. L
  8444.         (set_tile_rot)
    4 P$ ]  S0 S' O; H
  8445.         (set_tile_scale)
    . c0 W, w2 L9 j# K5 d4 e
  8446.         (set_tile_rc)' s3 T" i6 p* [
  8447.         (if (= (logand blktype 1) 1): l7 \# ^! g+ `% i. d
  8448.           (progn
    6 S& E. g7 n6 N0 j# C7 S) J
  8449.             (mode_tile "xscale" 1)# e, W: k- ]. C$ z' u# H" s
  8450.             (mode_tile "yscale" 1)7 F6 W$ O0 z& F5 _4 v4 }! ]
  8451.             (mode_tile "zscale" 1)8 c* U6 R! u$ P% X* P) U5 p
  8452.             (mode_tile "rot" 1)
    ; s* `4 J( o3 _- ?# f" x5 Q/ ~% y
  8453.             (mode_tile "columns" 1)
    - L4 F3 w; _- F' }
  8454.             (mode_tile "rows" 1)) H! T$ G# s/ d, x
  8455.             (mode_tile "col_sp" 1)
    , S/ {7 j8 a6 \: f$ d& V) T" }, `) v" [
  8456.             (mode_tile "row_sp" 1)7 b/ h8 |3 W' [* L$ l
  8457.           ), @+ J- f9 m  _4 `" [
  8458.         )% P/ F2 y& @+ |/ {4 B# f
  8459.         ;; Define action for tiles
    9 z3 {8 y8 M# W8 |4 b
  8460.         (set_action_tiles)
    : a$ q, D! J$ x$ ^1 h( Z3 S8 }0 b
  8461.         (setq dialog-state (start_dialog))
    + w# M8 G1 A; E2 Z! Y& v: b
  8462.         (cond4 Z4 [- S4 d: X7 C
  8463.            (  (eq dialog-state 0)5 W& m! B( @1 v% k+ I$ o
  8464.               (setq pt1 (trans (cdr (assoc 10 old-elist)) ename 1))- {6 J; }7 u" {
  8465.               (move_pt1 1)4 ^: u' y5 F2 m- ~8 b! T
  8466.               (reset))
    - Q4 M, q$ D+ |( z4 f
  8467.            (  (eq dialog-state 1)6 g8 M$ V' \! v6 ^4 l
  8468.               (if (and (/= temp_xclip xcliponoff) (or (= blktype 0)(= blktype 36)))
    3 `; g# G0 \2 A' ?" M, q, f5 t
  8469.                 (xclip)
    ! u- s! `3 e0 {
  8470.               )
    $ C, S" m  L# }$ i
  8471.               (modify_block)); G# I3 M  i: Q4 `# X& X6 d' x5 f
  8472.            (  (eq dialog-state 3)
    : P; U* B8 B) U& w
  8473.               (modify_block)% p' i! n5 A3 {2 g1 F, g
  8474.               (setq pt1 (getpoint (list x1 y1 z1)  "\nInsertion point: "))
    4 M# Y% C" k  H, z/ T! p1 }
  8475.               (move_pt1 1), X5 x! H& R( k/ J6 S5 Q8 u$ t' b
  8476.               (ddblock))
    ( H4 t" q# E: O) I1 ~
  8477.            (  (eq dialog-state 4)5 a. q) ~. _* e, i- F  Q. _; d
  8478.               (modify_block)2 g) ?7 d% d2 Z5 `. e+ S/ s
  8479.               ;; Get current handle.0 t: F# \( m9 n) M  Q
  8480.               (setq hand (cdr (assoc 5 elist)))
    * A  i3 M4 M1 R! ?& ?+ U
  8481.               (command "_hatchedit" ename)! |/ w/ W3 h6 [* X
  8482.               ;; If OK in hatchedit, a *new* entity is created and the old one
    1 e0 a( N9 ~* r3 K  C5 i- b1 V
  8483.               ;; is deleted.  So if the old one exists, it must have been a
    * ]' v+ D# _2 P7 F+ z" Z
  8484.               ;; so rest the entity.4 x$ h8 T7 i5 Y. J
  8485.               (if (entget (handent hand)) (reset))6 D5 z$ x' d) S- K
  8486.            )' x  W. _0 S6 B8 I
  8487.         )
    . d0 F7 ~0 r0 k
  8488.       )
    & S2 d. I- |% Z9 a* D$ Z
  8489.     ). @6 s8 ^7 J2 c' v
  8490.   )
    " o% ]8 ]8 K+ V, ?9 V, H
  8491.   ;;4 x) W. |& m; B+ D  T
  8492.   ;; Modify SHAPE' U$ u: X* N( G8 y2 g
  8493.   ;;
    " ]: @, g9 `" o$ Z4 {
  8494.   (defun modify_shape ()
    / h" ^5 a! j% \& m5 c# {* m
  8495.     (modify_properties)8 J5 O3 w) f0 v3 F
  8496.     (setq pt1 (list x1 y1 z1))
    ) G+ j, f' [% r' f
  8497.     (tempmod pt1 10 1)
    1 w3 q( h# D! c2 M  }+ n/ r5 |- l
  8498.     (tempmod hght 40 nil)
    % e. o; l; p1 }4 g2 v
  8499.     (tempmod wid 41 nil)
    " ^' |0 p" p0 O: `
  8500.     (tempmod rot 50 nil)
    ; v3 Z, K# R8 _
  8501.     (tempmod obl 51 nil)
    2 F4 G7 f$ W, H4 d
  8502.     (entmod elist)
    ( l: l  [& a6 O6 h/ l
  8503.   )9 H2 C/ E% W- e# T( m
  8504. & a; C6 i9 F' g6 E
  8505.   (defun ddshape ()7 k$ U4 }$ m* c- M+ z- i1 n: m
  8506.     (if (not (new_dialog "ddshape" dcl_id)) (exit))( i8 S# y* k9 }+ |
  8507.     (set_tile_props)2 o# V% v5 g  R+ k- ?
  8508.     (set_tile_handle)
    % I4 s8 p0 p4 g" m% i
  8509.     (set_tile_pt1 1); K$ V9 r5 |& @5 f% I1 D
  8510.     (set_tile_rot)
    + U$ ~- l; D2 o% n+ j* R
  8511.     (set_tile_hght)
    % A$ O) h0 p) ^8 q. C1 t
  8512.     (set_tile_wid)
    * j0 E  f& ]  _1 u: W
  8513.     (set_tile_obl)7 Q* ~+ p- \; {; i4 i* ?
  8514.     (set_tile "sh_name" (cdr (assoc 2 elist)))4 p4 B6 ~/ s; W3 l/ Y, M
  8515.     ;; Define action for tiles3 t5 `: a* F9 T: Y$ N4 h& f) _
  8516.     (set_action_tiles)' D7 t* B5 H. j& |+ R# m
  8517.     (setq dialog-state (start_dialog))) K& d+ a0 E$ E3 s4 F
  8518.     (if (= dialog-state 0)
    ( J: T; F" c2 a$ H
  8519.       (reset)
    ' w; X6 h; _" e# n
  8520.     )
    $ N3 ^. L6 b& @- Z1 O- e1 G2 R
  8521.     (if (= dialog-state 1)& p$ ]5 l* p: @+ b2 z* l, v
  8522.       (modify_shape)/ G4 A, M5 C: W: }1 k0 F
  8523.     )
    0 y( k4 E# I$ G5 j* e
  8524.     (if (= dialog-state 3)
    6 S+ z1 W) W6 Y# x
  8525.       (progn
    + y4 d+ I% I7 V& i
  8526.         (modify_shape)3 V* v+ K7 k' _* u$ m3 L  P
  8527.         (setq pt1 (getpoint (list x1 y1 z1)  "\nInsertion point: "))
    , C* ~2 }7 t' E) T% j5 H  R
  8528.         (ver_pt1 1); [6 \4 D# K3 j* M. @
  8529.         (ddshape)
    . ], K! s7 l1 L1 U- K" n$ R
  8530.       )
      }0 A/ _- z1 [, R* A% x
  8531.     )! F( i% w- w7 E/ e( h
  8532.   )
    9 {  M* Z+ y' G" y- \
  8533.   ;;) I* c* O4 S% m( _8 `4 w
  8534.   ;; Modify TEXT or ATTDEF) J$ C0 H" N: D7 I+ X6 U$ X3 P8 S
  8535.   ;;
    " `# z$ P  t4 w& t$ K/ G
  8536.   ;; Set bit code for upside-down and backwards setting
    ' b2 r: Y! u" {3 q0 Y/ L
  8537.   ;;7 {- e" Y, R. Z. p
  8538.   (defun code_71 ()1 ^3 [- g: `$ r$ C
  8539.     (cond ((and (= bkwd "0") (= upsd "0")) 0)4 |& k6 w( \% x- H: i9 z' b& O
  8540.           ((and (= bkwd "1") (= upsd "0")) 2)
    $ {) M* Y/ I6 f' B( x! B3 m! |
  8541.           ((and (= bkwd "0") (= upsd "1")) 4)
    # F: B! h9 l. b% E, N: G1 J; J. Y, C
  8542.           ((and (= bkwd "1") (= upsd "1")) 6)
    4 O# g5 o# o# O( k; s8 {! G
  8543.     )
    1 ?% O9 h5 X) c; ?5 P
  8544.   )
    ' \- O% i- f- P1 O0 d% m
  8545.   ;;
    , y* h) L( }- T1 y9 K4 E9 n
  8546.   ;; Style action.  Reset widget values to style defaults% E4 r# O- t5 b. Q& i" q  J
  8547.   ;;# ~% r/ M* S  M' b, t- y: r
  8548.   (defun style_act (index / style-list)9 @/ Y. x  X+ _% |
  8549.     (setq style-idx (atoi index))1 l: F# h) r$ b) s  j
  8550.     (setq tstyle (nth style-idx slist))
    ; ?) T/ I; V( K- U% A
  8551.     (setq style-idx (itoa style-idx))5 ]6 D- O9 a- ]
  8552.     (set_tile "style" style-idx)0 u' G  J% v  O$ r" D
  8553.     (setq style-list (tblsearch "style" tstyle))' N' Q! _! j( a$ @+ S
  8554.     (setq shght (cdr (assoc 40 style-list)))
      }! x2 B& m" D' g  T
  8555.     (if (/= shght 0)
    9 l+ u9 X' ~: @6 q9 \0 v
  8556.       (progn
    8 x* `+ S9 V0 L' |$ I9 X4 \* q
  8557.         (setq hght shght)
    + D9 J7 c/ l# R! N0 T5 m/ o
  8558.         (set_tile "hght" (ai_rtos hght))
    ; A) U. n. D+ m. n" P  u7 I
  8559.       )
    9 Z2 S! H1 L( e8 ^& y2 q4 z
  8560.     )
    5 z4 T; }4 _- _9 I
  8561.     (setq wid (cdr (assoc 41 style-list)))
    3 C/ @2 l; G6 e/ ^" G4 Y4 F
  8562.     (set_tile "wid" (ai_rtos wid))
    6 ^- f! N6 t" \! j9 ?) _7 X- w4 D
  8563.     (setq obl (cdr (assoc 50 style-list)))
    # {, P9 A# k/ H% ~
  8564.     (set_tile "obl" (ai_angtos obl))
    : ]$ J' o2 }8 T
  8565.     (setq bk-up (cdr (assoc 71 style-list)))
    * j7 ^6 D/ t) ^+ M
  8566.     (if (= (logand bk-up 2) 2)( M* x: Z6 k$ b5 Q! l! o# j0 V
  8567.       (set_tile "bkwd" (itoa (setq bkwd 1))); ^1 @8 B9 J: C, ^7 j
  8568.       (set_tile "bkwd" (itoa (setq bkwd 0)))2 q; I5 j7 v9 Z/ W6 o  R, T8 W+ P
  8569.     )" z# q2 N; G9 E6 v
  8570.     (if (= (logand bk-up 4) 4)
    # h  Y: v0 C  Z& I" T' @: ^
  8571.       (set_tile "upsd" (itoa (setq upsd 1)))$ u( g2 i  o. Y5 k. p
  8572.       (set_tile "upsd" (itoa (setq upsd 0)))
    : U2 D5 A/ T: c
  8573.     )
      c+ a+ W* L" Q" F% C- i' Q5 k2 @
  8574.   )
      h% q' t! P1 m; K) w
  8575.   ;;9 K/ v- C7 [% r7 K
  8576.   ;; Justification action.  Set vertical and horizontal alignment variables,- i# S5 W! [6 |7 {, ]
  8577.   ;; grey out rotation and height if alignment = "aligned", grey out rotation- |- a4 W- w. \: r& L5 w
  8578.   ;; if alignment = "fit"." Q/ Y  Z4 m& h" s! S, @
  8579.   ;;; y7 |1 Y0 @, J, q& ^
  8580.   (defun jlist_act (index / templist)
    & }- F9 k1 E: h
  8581.     (setq just-idx (atoi index))( q" L  `9 H9 |4 \, V
  8582.     (cond
    3 Q, V3 M' |6 p2 y
  8583.       ((= just-idx 0) (setq va 0 ha 0))
    / m4 Y/ \$ f( D! _6 s% V3 m4 @* @
  8584.       ((= just-idx 1) (setq va 0 ha 1))
    , ^! h: q$ m: m( J1 ^! ]8 m6 h
  8585.       ((= just-idx 2) (setq va 0 ha 2))! y6 a+ h8 R( }  p
  8586.       ((= just-idx 3) (setq va 0 ha 3))
    / ]9 z/ J0 d1 Q
  8587.       ((= just-idx 4) (setq va 0 ha 4))
    & X) n( b  m+ g7 U% P
  8588.       ((= just-idx 5) (setq va 0 ha 5))
    " ?+ v' H3 B* d' I8 H9 R* t
  8589.       ((= just-idx 6) (setq va 3 ha 0))3 R9 v9 `7 `9 J8 O
  8590.       ((= just-idx 7) (setq va 3 ha 1))3 M8 L7 y% P3 q. {1 ?
  8591.       ((= just-idx 8) (setq va 3 ha 2)). y/ b: E$ a& i
  8592.       ((= just-idx 9) (setq va 2 ha 0))
    9 ^# P! M3 ]: x6 L
  8593.       ((= just-idx 10) (setq va 2 ha 1))
    0 D) S/ n) s- {6 x6 w7 q3 C+ e$ l( U
  8594.       ((= just-idx 11) (setq va 2 ha 2))
    5 }( O7 {4 z2 N' x: W) G; s0 |
  8595.       ((= just-idx 12) (setq va 1 ha 0))
    3 W/ B; y+ T1 A: m- q, o
  8596.       ((= just-idx 13) (setq va 1 ha 1))
    7 }6 |" u, j2 D3 W$ t1 ~0 W
  8597.       ((= just-idx 14) (setq va 1 ha 2))% y0 v) L! k: O( G9 |, u
  8598.     )0 Y: e& T) _9 \1 k# }1 M
  8599.     (if (or (= ha 3) (= ha 5))  ; If Aligned or Fit text: Z& }3 C7 a: w3 X. ]: H0 d/ u
  8600.       (mode_tile "rot" 1)* \$ z" G3 l5 s5 i
  8601.       (mode_tile "rot" 0)
    & E$ r: v! T6 t
  8602.     )
    5 Q# r- ?; j4 P! n
  8603.     (if (= ha 3)                ; If Aligned text
    0 m. j8 m& V. Q  I0 _9 S
  8604.       (mode_tile "hght" 1)5 ~- {; m, S' y1 p+ v# G- V
  8605.       (mode_tile "hght" 0)
    ) v" Y/ a+ i; \2 H* \
  8606.     )  N4 R, k7 R$ m  x. E& [. c
  8607.     (if (= ha 5)                ; If Fit text
    ; ?) C' R0 }* s; n9 c
  8608.       (mode_tile "wid" 1)
    2 q, @* _. H6 ^3 r3 z- f% z3 b6 g
  8609.       (mode_tile "wid" 0)# O% g+ n8 K; e. G$ I7 L+ v. X; ?
  8610.     )
    ( G& ?6 |2 Z4 \8 r/ D: }
  8611.     ;; Reset rotation and height if changing from aligned.
    4 t8 ?3 ^; K; _
  8612.     (if (and (= ha-prev 3)  (/= ha 3))
    + Q4 K/ w5 B6 x) E& j4 o7 v
  8613.       (progn
    . E- Q9 ~) d; D! ]; P9 `
  8614.         (set_tile "rot"  (ai_angtos (setq rot 0.0)))3 j" y' O' ^: ~" b
  8615.         (set_tile "hght" (ai_rtos (setq hght 1.0)))& A: e; `1 ~% p7 y  v
  8616.       )
    9 @4 n+ b1 ?6 i$ W3 d$ A
  8617.     )
    ! }& y5 g" H! s1 [
  8618. . c9 \( ^. H0 i9 S
  8619.     ;; Reset rotation and width if changing from fit.
    $ D; v* I4 c# y
  8620.     (if (and (= ha-prev 5) (/= ha 5))
    / H) p' m# u( x  _" P8 m; b
  8621.       (progn
    5 N0 ?) ^, Q6 Z
  8622.         (set_tile "rot" (ai_angtos (setq rot 0.0))); C" ?( d' R3 r
  8623.         (set_tile "wid" (ai_rtos (setq wid 1.0)))1 j/ {8 _4 B# V) d
  8624.       )
    / l) k/ a. y  v5 ^- l
  8625.     )
    0 X9 A0 r- P( |& \7 p

  8626. " I: I' B+ ^1 Z
  8627.     (setq ha-prev ha)           ; update ha-prev for next time# J1 q+ B3 ^* S  H6 u+ ~, L% j  A
  8628.     (setq just-idx (itoa just-idx))
    0 Y& T( c8 i! I
  8629.   )& f) }* U9 U4 H, ?7 R0 L+ D* A4 S
  8630.   ;;; P0 e! f: I3 \3 k
  8631.   ;; Set intitial alignment setting based on vertical and horizontal alignment
    3 {& L) q6 y0 m- z; H
  8632.   ;; bit codes.+ L7 z: _4 m$ S6 b/ a# N+ Y% Q* i/ X  @
  8633.   ;;
    7 s8 b4 t# L4 _8 Q4 v/ r# y* L
  8634.   (defun set_just_idx ()
    1 i9 y/ J! \- Z% L
  8635.     (cond
    ( x( I. I. u" ^" y9 z0 L6 m
  8636.       ((= ha 0)             ; Horiz alignment = Left
    : S! x1 S* H0 v+ W# m2 \8 K$ x
  8637.         (cond
    ( e+ `9 b3 i: w6 T- b! w2 I8 \
  8638.           ((= va 0) (setq just-idx "0"))
    + q% x# Y, r. c5 @, m/ f2 G" _: _
  8639.           ((= va 1) (setq just-idx "12"))
    / L$ t( [1 O+ ?
  8640.           ((= va 2) (setq just-idx "9"))
    + \9 E8 ~, N, g
  8641.           ((= va 3) (setq just-idx "6"))$ X; f9 v7 i4 f3 N8 Z! M& T2 }* D
  8642.         )
    7 Q9 i; O+ X8 G# H4 I
  8643.       )
    2 }$ u4 ^$ }5 A% D- ]
  8644.       ((= ha 1)             ; Horiz alignment = Center+ n  Y& Q( L( E& q; ?' Q% A
  8645.         (cond, T" c9 d3 T$ K) B) A/ X) G
  8646.           ((= va 0) (setq just-idx "1"))
    ( s7 O( @2 E# H% d4 A
  8647.           ((= va 1) (setq just-idx "13"))- L9 i9 ]  B  q' [7 r; T
  8648.           ((= va 2) (setq just-idx "10"))6 _8 t1 B; T% _- b! r+ d/ M
  8649.           ((= va 3) (setq just-idx "7"))
    4 O' V+ G0 {& _( X* C. y/ N
  8650.         )
    2 z# F* x" w, k% z6 Q' e6 T4 ~& P* f
  8651.       ); ~* U+ W& ]4 B+ f/ H5 n: Y$ Y
  8652.       ((= ha 2)             ; Horiz alignment = Right
    , j" u; M+ z0 J
  8653.         (cond- i/ y2 A; C9 o. f7 O5 s4 G
  8654.           ((= va 0) (setq just-idx "2"))+ [; g- L3 U2 Y( ?  j0 g% d1 E
  8655.           ((= va 1) (setq just-idx "14"))
    4 }, \2 L4 |6 b1 ]# S/ Z9 }
  8656.           ((= va 2) (setq just-idx "11"))* R$ P; J, [( g% x  S4 W
  8657.           ((= va 3) (setq just-idx "8"))
    $ q. R' o- Z( J( B& H: b
  8658.         )5 [6 V, z( t# V1 V- G2 ?: l% v
  8659.       )
    ) I0 E& m) v" ^* V
  8660.       ((= ha 3) (setq just-idx "3"))   ; Aligned4 w4 F) r: s+ r; C- ?
  8661.       ((= ha 4) (setq just-idx "4"))   ; Middle+ G9 V5 N, z) a7 @2 [: i
  8662.       ((= ha 5) (setq just-idx "5"))   ; Fit! f/ K' b# X: q
  8663.       (T (setq just-idx "0"))' v6 x% S1 m" @/ g7 h1 V% Z
  8664.     )( C' P/ {9 g0 W9 ^$ V, F' Q9 m
  8665.     just-idx
    / g) Y" D: _& T, X0 k/ J
  8666.   )
    7 t  e; H' c# t+ G3 \
  8667. . Q) Q7 _9 ~& Z4 t
  8668.   (defun modify_text ()
    , x1 H) u9 H3 M1 j* b
  8669.     ;;  insertion point) M+ C" u- p, g+ s
  8670.     (setq showpt (list x1 y1 z1))1 i9 @) S. ?2 ^0 t; j/ M( f
  8671.     (setq bit-10 (trans showpt 1 ename))8 e* W- ~8 S$ }
  8672.     ;;  alignment point9 l( v9 V* s; w" e
  8673.     ;;  for 'Aligned' or 'Fit', alignment point must be different8 C) v, h) g7 Y9 X3 k8 ~
  8674.     ;;  for all others, use insertion point+ R( h; f% R. g+ z; d6 v1 l& F
  8675.     ;;  (ACAD will recompute insertion point); q4 W+ k( q; Y
  8676.     (if (or (= ha 3) (= ha 5))* b3 O# S& ^. F+ x' l9 c% G
  8677.       (progn
    , ?: l  d& |6 t/ `/ k4 X2 d
  8678.         ;;  if no alignment point, fabricate one
    + M( ~  @8 J- o5 p3 t4 {2 H$ ^
  8679.         (if (not alipt)$ A" A, e0 G6 M; ^3 w
  8680.           ;;  add text width to insertion point9 _" o4 m' s  b( `- r" S1 v$ C
  8681.           (setq alipt
    ! D! J" x9 r1 i) N
  8682.             (list (+ (car showpt) (car (cadr (textbox elist))))9 J% G) K  E7 s% y% j0 H6 F
  8683.                   (cadr showpt)# G: s) c' M9 R; t9 x: C' C8 A
  8684.                   (caddr showpt)- s8 l) h# X- D* B
  8685.             )
    : ^1 x6 B4 S. n* p
  8686.           )
    & L. Q% c3 D: }  W
  8687.         )- u2 t% p! ~8 x9 H
  8688.         (setq bit-11 (trans alipt 1 ename))4 P4 T( O, I# e# D" [. o
  8689.       ). c9 A( g. L9 t9 a
  8690.       (setq bit-11 bit-10)
    & c! z9 ^: I7 z2 w- {" N
  8691.     )! j* X0 d7 V& e
  8692.     (modify_properties)
    : Q. q3 g7 E/ K: t" L, ~
  8693.     (tempmod tstyle 7 nil)* v+ h" n3 J6 [; j5 [! I; u
  8694.     (tempmod bit-10 10 nil)% t( M2 T0 {. t$ J; A
  8695.     (tempmod bit-11 11 nil)+ }* n  K: ~8 H
  8696.     (tempmod text 1 nil)) E: z" H+ Y1 j, }. ^: L  k
  8697.     (tempmod hght 40 nil)) T8 ]0 O" Y; t9 x
  8698.     (tempmod wid 41 nil)
    ( V4 j' n+ \9 h2 F- u
  8699.     (tempmod rot 50 nil)
    6 X+ Z/ g  d6 E: p! E5 D! r
  8700.     (tempmod obl 51 nil)
    % `& j" Q1 w2 [7 }% `, L
  8701.     (setq bk-up (+ (* bkwd 2) (* upsd 4)))+ b& T) r5 T+ `2 W( u: V
  8702.     (tempmod bk-up 71 nil)) X. C; O8 I- S# R5 W8 l
  8703.     (tempmod ha 72 nil)) e% o6 @4 l' L- c1 T5 j. m
  8704.     ;; Attdefs use 74, text 73# f2 u8 r* q) b5 \/ ~' b
  8705.     (if (= etype "ATTDEF")& n+ t- [1 Q4 ?
  8706.       (progn
    6 b, v7 F' a8 N8 I" E1 Y
  8707.         (tempmod attag 2 nil)3 B1 h( G: b5 W7 d" K
  8708.         (tempmod atprompt 3 nil): V! P. l9 E2 J8 Q
  8709.         (setq icvp (+ inv (* 2 con) (* 4 vfy) (* 8 pre)))
    / O/ i7 j2 C, v# ^- s
  8710.         (tempmod icvp 70 nil)
    2 E. D+ Z$ X' w( F2 s
  8711.         (tempmod va 74 nil)
    : @+ X" s; i5 ^' `. v! J) M
  8712.       )' Y4 J: O3 T$ m
  8713.       (tempmod va 73 nil)1 p* }1 `( o& }8 z1 S
  8714.     )2 I0 v" U; j; _* Z& D- ?+ G
  8715.     (entmod elist)
    * |& z4 C% z; W4 d% l: a. T
  8716.   )
    # c5 t8 {! J# {0 y" W
  8717. 4 {/ h( k7 e7 z3 ^! X' ]8 f
  8718.   (defun ddtext (/ 2ndpt slist i)
    ) a2 C" O5 D4 }! P+ Q7 _& Q
  8719.     (if (= etype "TEXT")
    + l' c) L* X" l8 V, I$ m2 u. V
  8720.       (if (not (new_dialog "ddtext" dcl_id)) (exit))$ k- n5 ]7 J' T! w) G: D  K8 F
  8721.       (if (not (new_dialog "ddattdef" dcl_id)) (exit))
    ( y1 i" J* |/ ^6 `- T/ s7 r& V
  8722.     ). p4 c) _, |9 H; }9 U0 ]
  8723.     (set_tile_props)
    7 Q. o7 N0 I( A  [
  8724.     (set_tile_handle)
    9 ^; i; T) t; ]3 L) `
  8725.     (set_tile_text)1 T8 a! s* x7 M  Y/ H% ?
  8726.     (set_tile_tag)
    # q7 G5 t, ^6 q
  8727.     (set_tile_prompt)
    ; L4 P/ B, p$ \5 r
  8728.     (set_tile_hght)" q) Y! d( Q: w8 ?
  8729.     (set_tile_wid)5 x) R& `# a9 S! g! ^( e
  8730.     (set_tile_rot)
    $ _: g7 u4 j/ I
  8731.     (set_tile_obl)& K7 d( o8 a% J' m" |# o
  8732.     (set_tile_bk-up)4 Q: ~, ?4 o' w( L# l' Y
  8733.     (set_tile_icvp)6 S. E0 p) ?4 i/ j  I  \5 K
  8734.     (set_tile_style)) {* K: w1 s! _6 m1 W4 H& e1 ^
  8735.     (set_tile_just)- C8 A& `& [- t' B% S9 K* ]
  8736.     (setq pt1 (trans (cdr (assoc 10 elist)) ename 1))
    1 t7 r8 B1 p+ h. K7 u4 x$ f3 \
  8737.     (if (not (assoc 11 elist))
    ! g2 a  |/ r% W, H
  8738.       (progn (setq pt2 pt1)
    ; G* h$ J# @" u& h/ X8 W; s
  8739.         (setq elist (cons (cons '11 (cdr (assoc 10 elist))) elist ))) `% u( P" V0 [
  8740.       )
    3 h3 n3 C/ O" P, k8 p6 @& ~0 P! ^1 ^  ]
  8741. ;;(trans '(0.0 0.0 0.0) ename 1))) U" W" [) I6 b+ r7 [6 z
  8742.       (setq pt2 (trans (cdr (assoc 11 elist)) ename 1))2 y3 Z0 o0 p1 `% _6 @9 Z* l3 K
  8743.     )
    " L- G0 W( C1 j0 ~
  8744.     (if (or (and (= ha 0) (= va 0))1 f) B5 ?0 l9 j; I
  8745.             (= ha 3)
    * C! ?) i( b6 m2 Q
  8746.             (= ha 5). U% s* n) v& W
  8747.         )  S" w- O& f" A, Q9 M
  8748.       (setq showpt pt1)
    . _7 C% L' d: O! v, x" U0 v2 }
  8749.       (setq showpt pt2)# ~* p( f" _1 E: L8 `* k, Y% X0 J, E
  8750.     )) Q  Y6 C. Q! Z1 C2 p5 J
  8751.     (if (or (= ha 3) (= ha 5))
    3 U4 I$ w/ X' x0 ?2 H
  8752.       (setq alipt pt2). B' f: p$ p: X5 ]% }: w  |  S
  8753.       (setq alipt nil). t  K& [0 X( [8 b) z! S- K; r! q
  8754.     )
    + \2 v; i8 @; ^$ z

  8755. / \  l( f9 ^" s1 O; o; y. V
  8756.     (set_tile "x1_pt" (ai_rtos (setq x1 (car showpt))))
    # ~8 {9 _5 }; n$ k
  8757.     (set_tile "y1_pt" (ai_rtos (setq y1 (cadr showpt))))# W- n9 \/ n* x
  8758.     (set_tile "z1_pt" (ai_rtos (setq z1 (caddr showpt))))9 Q- r! T, [# K9 w# T, `

  8759. : `  h9 |$ o' Z/ I( m5 W
  8760.     ;; Define action for tiles* J! ?* s- N! C, B
  8761.     (set_action_tiles)9 l! }  B4 k0 s  \9 T2 R3 \
  8762.     ;; Set focus initially to the text edit box.
      c. q! E+ N, v/ i. G0 [( x4 G0 O( E
  8763.     (if (not i) (progn (mode_tile "t_string" 2)(setq i 1)))
    ( F. ]& Q8 W8 \9 Q
  8764.     (setq dialog-state (start_dialog))6 S* x" Z2 l- Y7 u2 h; O- O
  8765.     (if (= dialog-state 0)
    3 l1 L: ?: n# ~- d5 R/ J( E
  8766.       (reset)
    + @) q4 t% j2 G6 j9 V, c
  8767.     )- e1 k+ N. d* ]3 ^" N
  8768.     (if (= dialog-state 1)
    4 B1 c, v* T2 ]- {
  8769.       (modify_text)" W  X, E, ]+ A' g
  8770.     )
    . d6 Z( x" v; J8 T9 s4 b; c
  8771.     (if (= dialog-state 3)
    ; f- T$ t7 n, F4 D3 a4 |; i
  8772.       (progn  o. x3 W9 C5 R/ F' h' Q4 q' G  A* O
  8773.         (modify_text)
    : }6 K* r* q* x% g! O: j' M
  8774.         (if (or (= ha 3) (= ha 5)), @, \; \, O' J. L0 ]7 [( T, E
  8775.           (progn
    ! Q& s$ [$ G$ |
  8776.             (setq showpt (getpoint (list x1 y1 z1) "\nFirst point: "))
    0 n  b7 @* Y. w5 x0 C
  8777.             (if (not showpt)5 Y' }/ o: i8 R5 j/ a" o. ^% A
  8778.               (setq showpt (list x1 y1 z1))
    7 \2 x* [5 s$ D
  8779.             )
    ! C  {. F* p. H3 m, i% r
  8780.             (setq 2ndpt (getpoint showpt "\nSecond point: "))7 U: N! C7 B4 o! k. Z* |% |" ~2 H
  8781.             (if 2ndpt
    % Z, e; W8 W, |5 j7 U( k# @
  8782.               (progn1 F! \8 P* x! U+ L1 `* e
  8783.                 (setq alipt 2ndpt)
    $ c5 z9 r- ?/ m/ C
  8784.                 (tempmod showpt 10 1)
    / t# k* L! ?3 i5 e/ D
  8785.                 (tempmod alipt 11 1)3 ^0 _) d  Z% M% v/ v' ~
  8786.                 (entmod elist)
    * A! f! Q6 ~9 F9 k' N6 }
  8787.               )% `5 z1 C. R* |5 u( x  v
  8788.             )/ K9 F2 J  N' Y# }
  8789.             (setq elist (entget ename))( v0 n& f5 U* c7 t: C8 R
  8790.           )  w0 q  C! |" C7 l# w
  8791.           (progn
    ! n8 \. T& w$ o
  8792.             (setq showpt (getpoint (list x1 y1 z1) "\nInsertion point: "))
    . L  A" y0 S, Q" ~6 p
  8793.             (if showpt
    ; ^, t: |, L4 N$ V- y
  8794.               (progn! O3 {1 q; H" E, @
  8795.                 (if (and (= ha 0) (= va 0)): Q8 Y3 X& L1 A+ y3 n9 a8 I
  8796.                   (tempmod showpt 10 1)
    . T) b/ t( J3 }
  8797.                   (tempmod showpt 11 1)
    ! T8 t8 m2 a( I6 R. n+ w
  8798.                 )7 }8 Q# P7 _& b" Y2 U
  8799.                 (entmod elist)
    ; `3 b, W9 W$ K2 [  o9 z! M
  8800.               )! i, w9 [) Z* n% L- m
  8801.               (setq showpt (list x1 y1 z1))
    8 Y  S+ s$ u( |7 @
  8802.             )/ I7 F+ }1 ^# J( z- P0 g+ i8 v) M
  8803.           )
    2 m# [  r9 F. w1 I: m6 }* d2 ~) O+ R% l
  8804.         ), H/ C6 n6 D( h  O% s. W
  8805.         (ddtext)1 ?; q$ b" E2 v/ R0 h% w5 h
  8806.       ), o& r: w, i; J, A& D
  8807.     )
      l; D% O9 m5 k( m  O
  8808.   )0 O" P5 ~% l7 p0 `4 h; L" Q( X

  8809. 7 e4 r& Y. S- E& K- U0 U$ r+ ^
  8810.   ;;  F( b, H; i  I
  8811.   ;; Modify MTEXT2 e2 P# P& k$ w
  8812.   ;;
    2 ~1 g; x, Z" a) w
  8813.   (defun modify_mtext ()
    9 @/ W; w9 b3 D; [
  8814.     (modify_properties)
    ) `3 c9 K4 v1 C' U) {
  8815.     (setq pt1 (list x1 y1 z1))
      n. [* Y( l, h
  8816.     (tempmod pt1 10 0): G6 D* ?) T8 U- z2 f$ D2 c
  8817.     (tempmod text 1 nil)
    9 B2 N* |6 e, h. t; G0 U
  8818.     (tempmod tstyle 7 nil)8 V" T! X* C+ h9 P" ]4 w% R
  8819.     (tempmod just-idx 71 nil)
    - u  ^$ v8 D5 n5 Y6 J
  8820.     (cond
    , v, P4 }3 Q8 l5 R4 U6 ?* Y  `' I
  8821.       ((= dir-idx 0) (setq dir-idx 1))
    0 O$ l3 `/ V5 \3 `
  8822.       ((= dir-idx 1) (setq dir-idx 3))
    1 t' A- j) h. M. q' q3 Q
  8823.       ((= dir-idx 2) (setq dir-idx 5))
    : m) q% D! R9 ]  g0 P2 F1 L/ j* B
  8824.       (T (setq dir-idx 1))4 s2 d% Y& {6 p; a0 a' `( N4 {
  8825.     )
    # r; u1 D/ m/ k- U! c, R% T
  8826.     (tempmod dir-idx 72 nil)3 Q7 A$ _8 \5 ]% x& S; D6 S
  8827.     (tempmod hght 40 nil)& L+ y" X5 ~5 S  Y7 U$ i! f5 u( n
  8828.     (tempmod wid 41 nil)! g" {1 `, @3 i) d& b
  8829.     (tempmod rot 50 nil)
    4 b( c* }8 N- e/ W6 q
  8830.     (entmod elist)
    # g! e6 }/ Y' p, w  k; s
  8831.   ), h! j& _7 D: i9 i) o% }  c
  8832. : d8 e8 K' f) ?2 w. V' Z8 ^
  8833.   ;; Set MText text style
    ; s% o" I- u5 R  X
  8834.   (defun MText_style (index / style-list)
      d/ c9 ^) B& O
  8835.     (setq style-idx (atoi index))7 D; Y2 _. @2 E1 n: H
  8836.     (setq tstyle (nth style-idx slist))4 q! m" d7 t) T) _4 T2 L
  8837.     (setq style-idx (itoa style-idx))
    / b, S( v5 b% |: l7 u6 n) Z( S
  8838.     (set_tile "style" style-idx); O1 F' w; u1 C  t/ F4 C
  8839.     (setq style-list (tblsearch "style" tstyle)); w9 Y+ t2 ^' d  \- a' K& {6 y
  8840.     (setq shght (cdr (assoc 40 style-list)))* U& N5 i* L& E5 Y  u4 y
  8841.     (if (/= shght 0)8 ?8 }7 a3 K! G1 G; f' B) a
  8842.       (progn, \8 l+ W3 e7 T4 y: a& q
  8843.         (setq hght shght)
    5 g* Z3 e: N" Y" E; G) n
  8844.         (set_tile "hght" (ai_rtos hght)); U7 }  S/ u7 B3 P1 W3 t
  8845.       )
    3 R! `, I  O5 b8 ]- `6 |, y6 T# r8 C
  8846.     )
    7 b6 {1 ~: N% E8 b+ K& c, o
  8847.   )
    & }6 y$ {1 i- c
  8848. - B& k8 U- L9 }: ^. Z7 F4 ]$ m
  8849.   ;; Run DDEDIT on given entity, working around possible re-entrancy, [) I0 ?+ j' F  ?, p
  8850.   ;; problems with MTEXTED$ ]; ~8 c5 z8 u9 i: b& \9 p8 x. m
  8851.   (defun safe_ddedit (ename / orgMTextEd work)
    & L/ {, O* a4 S' i
  8852.     (setq orgMTextEd (getvar "MTEXTED"))7 o7 X3 {- T; ^' X& r: t& ?) P# o% ?7 t6 ?
  8853.     (setq work orgMTextEd)' ~$ o7 O+ N' W/ Q9 ~6 T
  8854.     (if (= ":" (substr work 1 1))
    ! @7 @/ n# h/ c& r8 g3 A  s; i
  8855.       (progn
    4 W5 f7 m; c. u% E& o; H$ |: ?1 A
  8856.         (while (and (< 0 (strlen work)) (/= "#" (substr work 1 1)))
    * I$ @/ D7 q2 r7 x9 ^$ y7 s
  8857.           (setq work (substr work 2))
    - O0 ^+ R/ N$ x4 x0 I
  8858.         )
    5 ?: `% o) x; q+ [
  8859.         (if (= "#" (substr work 1 1))
    / f. B: W) x6 X: p. p2 U- ?' ~% S
  8860.           (setq work (substr work 2))
    - p7 c% [; \; ]1 L6 @
  8861.         )
    8 |/ N- w, z3 n; b! l# i
  8862.         (setvar "MTEXTED" work)
    ! `4 a1 l1 K( Y: E0 w6 w& T
  8863.       )0 p3 w" v/ V9 o* G
  8864.     )
      Y$ j* q3 V( o9 h1 j3 e" Z" o9 J- w
  8865.     (verify_arxapp_loaded "acmted.arx") ;; make sure it's loaded...: f8 g/ y. U* G7 l( b
  8866.     (command "_DDEDIT" ename "")1 Q* v, e# }0 z
  8867.     (setvar "MTEXTED" orgMTextEd)
    0 [6 ?! I3 \2 n
  8868.   )2 f& v$ b4 N7 Z  ]$ L" N
  8869. % ?; S9 j2 _1 W/ ]7 D1 `
  8870.   ;; Verify MText object width
    : D8 N. R( I8 I* T9 o
  8871.   (defun ver_MtextWidth (value): }5 E5 Q: B/ ]; X& M
  8872.     (setq value (distof value))9 q0 s3 |6 z1 u) h6 D5 [# U$ Y6 m
  8873.     (set_tile "MTextWidth" (ai_rtos value))
      Z# [1 K  K. j  ^0 K
  8874.     (set_tile "error" "")
    6 t0 T( U! n2 |2 f5 H7 t9 d
  8875.     (if (< value 0.0)7 n  ]) K% q& c* k& h2 M2 ]
  8876.       (set_tile "error" "Value must be zero or positive.")
    % ^0 E3 |9 s9 d
  8877.       (setq wid value)6 B: Y3 K+ z* T( T& r; z
  8878.     )4 F; `' V! O/ |( m' Y2 O
  8879.   )9 _" ?" p+ q6 a# S1 }& ^9 W2 Y: S6 R

  8880. * A4 f) Z5 k2 S  m  F9 M
  8881.   (defun ddmtext ( / gc3)
    $ W8 S+ }. Y6 W/ r5 H
  8882.     ;; Get dialog  t; g# k1 ]) C7 S1 [5 o6 ]
  8883.     (if (not (new_dialog "ddmtext" dcl_id)) (exit))
    3 R3 U( }# n) A, h
  8884. 8 F  i( i5 m* R5 S  {% v$ u
  8885.     ;; Load list boxes1 |3 C" H. w* {* D: N
  8886.     (start_list "MTextJustify")
    - x# m: ~) F/ M% t( w4 y
  8887.     (mapcar 'add_list '(. h; Q! `% q: w% l; _4 I. A
  8888.                         "Top Left"
    ' A+ i; S$ r* Z8 J7 o) m
  8889.                         "Top Center"! }+ o1 Z8 @) ?; f
  8890.                         "Top Right"$ t9 |( V* R; z+ W: K* S5 U* B
  8891.                         "Middle Left"3 \# \1 q- \* w4 I0 I
  8892.                         "Middle Center") K; D+ u  ^1 Z) Z" X
  8893.                         "Middle Right"  O' p( @2 x) R
  8894.                         "Bottom Left"
    % d: a$ C& w( ^6 f+ l
  8895.                         "Bottom Center"- G" x, Q  D' U( ^) r6 o! G
  8896.                         "Bottom Right") J  o6 _/ t9 M  g) Y& `
  8897.                        )
    3 ^* @* j# f7 C
  8898.     ): }- t( a! Q& t
  8899.     (end_list)
    7 {: ], e4 Z4 |4 s$ W+ v+ z2 d9 P

  8900. " k( F1 o  ~2 |9 ^: n: R* t! A1 A
  8901.     (start_list "MTextDirection")
    . P8 U0 F4 g3 e6 |' B! E0 i
  8902.     (mapcar 'add_list '(2 k: I, G) Z5 n- f: h# J
  8903.                         "Horizontal"
    8 ~; J) I6 D: |& _* d& h0 U/ |9 N/ Z* F
  8904.                         "Vertical"8 `, x7 U7 [6 `7 W9 @2 r: M) Z4 |
  8905.                         "By Style"/ k6 [5 @* i! t0 @
  8906.                        )
    + a# }* c! Q% R
  8907.     )9 L/ ~9 b' ]' V3 Y  t
  8908.     (end_list)
    # o7 L" g4 q6 v& k4 @* j: p
  8909. 4 O  q7 u( T# m
  8910.     ;; Set initial tile values# i( h1 X( x1 u* E
  8911.     (set_tile_props)
    # \9 \3 G  n1 V! a% p2 m
  8912.     (set_tile_handle)1 T; p, G' s+ Y/ r) e- X
  8913.     (set_tile_pt1 0)% S4 w5 A# N/ E1 d6 o+ ^1 c
  8914.     (set_tile_style)# _- x. a; ?/ q' z% |, _% ?, v
  8915.     (setq just-idx (cdr (assoc 71 elist))), g4 m+ q+ e# s, t0 @8 i9 u
  8916.     (set_tile "MTextJustify" (itoa (1- just-idx)))1 d5 q9 t1 A5 I
  8917.     (setq dir-idx (cdr (assoc 72 elist)))
    ! h' _" t8 ~9 Z0 a+ G/ ~
  8918.     (cond7 U# a  P" P  z- r( b" H+ o% A- R6 A& h
  8919.       ((= dir-idx 1) (setq dir-idx 0))$ `7 R( A, v7 ^+ X, i$ c) i
  8920.       ((= dir-idx 2) (setq dir-idx 0))4 _4 n/ p- E+ G
  8921.       ((= dir-idx 3) (setq dir-idx 1))2 B. u4 Z& p: B0 |3 D; e2 Y" V# ]
  8922.       ((= dir-idx 4) (setq dir-idx 1))) D. [7 i7 G+ @: w3 _2 D
  8923.       ((= dir-idx 5) (setq dir-idx 2))* E0 w0 ?8 r6 H' k
  8924.       (T (setq dir-idx 0))+ L* b  |1 [0 M  f( k: S* J
  8925.     )) ?9 z9 l0 a1 }; l3 J# {  f. ~$ a
  8926.     (set_tile "MTextDirection" (itoa dir-idx))' p) W( ~! G8 T( W; ^
  8927.     (set_tile "MTextWidth" (ai_rtos (setq wid (cdr (assoc 41 elist)))))
    " B8 _/ v6 _/ h6 x+ M
  8928.     (set_tile_hght)& p# s# m* ~2 k  L# [, L
  8929.     (set_tile_rot)
    , b: n6 b4 B5 b; H: K8 p6 F

  8930. 1 {2 i2 I0 b, K7 A8 H9 I: a
  8931.     ;; Set edit box, disable if too long
    $ y8 I2 }6 v* O# W8 b0 l. U
  8932.     (setq gc3 (cdr (assoc 3 elist))3 q& {' F9 S$ F' Y
  8933.           text (cdr (assoc 1 elist)))
    - ^# ?( Y- o& W- L( b2 j' |( X
  8934.     (if gc3) P/ @1 g6 Z: ?. t$ d* k
  8935.       (progn  ;; Text is over 250 chars, disable edit tile
    % H8 t: w6 d- i- `* D$ z( I
  8936.         (set_tile "t_string" (strcat (substr gc3 1 25) " ..."))
    * e2 Q$ Q, A( c$ @/ E6 h
  8937.         (mode_tile "t_string" 1)& e1 B1 Y7 ~1 o7 [' }! B1 r- |3 x
  8938.       )
    " t' g* Q3 R7 N6 r2 a5 s- r+ g
  8939.       (if (> (strlen text) 80)
    8 G0 U- m. J6 I! t5 ?' l, V
  8940.         (progn  ;; Still too big' ^9 R# X! @; }( F
  8941.           (set_tile "t_string" (strcat (substr text 1 25) " ..."))3 J' O$ B9 T( u3 b
  8942.           (mode_tile "t_string" 1); N% F+ r7 b& V' e1 g$ x) y1 Q
  8943.         )/ P  J& n5 }! M; }( b4 o
  8944.         (set_tile "t_string" text)
    3 N' @4 A9 `: S  A% z
  8945.       )
    3 [! `, x4 K% E$ K% H
  8946.     )$ _$ W$ K$ c) J2 b
  8947. 3 K! _3 H) L/ W1 r# u5 {0 |7 F
  8948.     ;; Define action for tiles( r9 m  G/ E- Q' i& @# {
  8949.     (set_action_tiles)
    0 ?+ l- U# h! y5 A7 E8 `( r
  8950.     (action_tile "style" "(MText_style $value)")% V# V0 J) D9 H8 m" D
  8951.     (action_tile "MTextWidth" "(ver_MtextWidth $value)")( x7 G& l  B( A
  8952.     (action_tile "MTextEdit" "(done_dialog 4)")2 E. R6 C3 E; k# q- S
  8953.     (action_tile "MTextJustify" "(setq just-idx (1+ (atoi $value)))")
    7 U7 W0 b6 I% [5 P& k0 n% y
  8954.     (action_tile "MTextDirection" "(setq dir-idx (atoi $value))")
    6 N# z6 U& Z) W* @
  8955. 4 [/ }8 ?( N# _) ?! m( D# b
  8956.     ;; Set initial focus to text edit box.
    + w8 J) g0 H, K6 Y  a" A
  8957.     (mode_tile "t_string" 2)
      F( X( e. A, \% s

  8958. # |$ G) Q  V+ O+ W8 w! C" e' N
  8959.     ;; Run the dialog
    5 \* @8 J9 G7 x: @
  8960.     (setq dialog-state (start_dialog))
    ; M" K, [; M, H) m* Y
  8961.     (cond
    / O) C0 ~, K7 F* T: z  [
  8962.       ;; Cancelled - restore saved data1 y2 n) K4 z( W; w: @
  8963.       ((= dialog-state 0) (reset))! i, m) j4 S$ u4 \. W+ Z
  8964.       ;; OK - save new data
    9 `( f+ s8 s: n% q+ @! D
  8965.       ((= dialog-state 1) (modify_mtext))5 _/ X9 k& _1 ], C
  8966.       ;; Pick new insertion point' `+ i' B4 ~8 g7 c! |7 n3 u/ h
  8967.       ((= dialog-state 3)
    1 m7 [% s$ [" J5 ~  g. ^
  8968.         (modify_mtext)) E3 ]! T; s+ ^) ]/ P3 ]
  8969.         (setq pt1 (getpoint (list x1 y1 z1)  "\nNew Insertion Point: "))
    7 Y' C, H9 B1 J& b8 q
  8970.         (ver_pt1 0)
    : T  g0 l' {4 x1 q7 {. W
  8971.         (ddmtext)2 Z- ?1 p  T2 ?+ A& h( m. t
  8972.       )
    0 k$ t: [: [! Q& q8 ]
  8973.       ;; Run full editor7 c( h5 L6 k1 h  c) ]
  8974.       ((= dialog-state 4)! C4 _3 t, O- p- }3 k
  8975.         (modify_mtext)& v  d; w0 p, @
  8976.         (safe_ddedit ename). C" |2 c- U- I- {7 B
  8977.         (setq elist (entget ename))
    & W2 F. Z" F' g& n1 e( l- o
  8978.         (ddmtext)4 ^  p# k# Y* m& ]- x8 }3 u, E
  8979.       )
    1 q. G9 E' i, z) p" f8 i, B
  8980.       (T nil)
    9 ]! F; o* ?: A% L. A- g0 v* q
  8981.     )# P$ W/ Y1 H7 E% L
  8982.   )
    + U9 u( |2 e* V: r' Z1 f/ A
  8983. + ?7 C4 t2 j* a$ C3 d+ a
  8984.   ;;
    : I' R1 y; p  J$ O: P
  8985.   ;; Modify VIEWPORT, ~5 R0 b: w' z& b
  8986.   ;;
    # u+ {" @1 }6 o' M& o

  8987. 5 E# D3 }7 o' w. I8 B8 Q+ I( j$ T
  8988.   (defun ddvport ()- Y+ g+ M/ s- e& m  A+ s
  8989.     (if (not (new_dialog "ddvport" dcl_id)) (exit))6 K# }% I. A  o0 m- t  a2 c2 \
  8990.     (set_tile_props)9 B: L# O1 ~! `
  8991.     (set_tile_handle)
    , S; K! o1 J! B! d" D! ^* C; U
  8992.     (setq vpt (cdr (assoc 10 elist)))
    3 A+ p- C  T7 t( @* g  P
  8993.     (set_tile "xtext" (rtos (setq x1 (car vpt))))2 N0 K" `4 A. \! y% m: i
  8994.     (set_tile "ytext" (rtos (setq y1 (cadr vpt))))
    $ f: `9 v- ]( g, d7 q
  8995.     (set_tile "ztext" (rtos (setq z1 (caddr vpt))))
    $ U! \5 Z* _) R) J
  8996.     (setq wid (cdr (assoc 40 elist)))" k( E4 n) {4 w0 i& r* e+ K
  8997.     (set_tile "wid" (rtos wid))3 C$ X( ^  S/ V- r4 e8 I( K
  8998.     (setq hght (cdr (assoc 41 elist)))
      n# N) ~* _% ^; c' Z, P, o1 {- N
  8999.     (set_tile "hght" (rtos hght))
    ) ~& \3 N' O9 G$ x: d
  9000.     (setq vpid (cdr (assoc 69 elist)))! ]& D& u- |- ^( G" ?2 Z. O7 ~& q, z
  9001.     (set_tile "vpid" (itoa vpid))
    : ?. B9 x! ?; J: ]6 P
  9002.     (setq on-off (cdr (assoc 68 elist)))" F- x+ Z4 ?$ ]  R* ~7 |6 v
  9003.     (cond7 P, e! w5 C! h# R9 ~+ ^4 i
  9004.       ((= on-off 0) (set_tile "on-off" "OFF"))4 C0 B7 q, c4 L
  9005.       ((> on-off 0) (set_tile "on-off" "ON and Active"))
    + Q6 r. p9 n6 o! \" c. w* q
  9006.       (T (set_tile "on-off" "ON and Inactive"))
    ( B8 \2 o, [7 G
  9007.     )
    * _. {% Y; F0 O) w( L, g
  9008. 8 f5 G- p, Q0 X# X# h$ I% k* c
  9009.     ;; Define action for tiles4 K" P! O5 m5 p- V* o) @% e
  9010.     (set_action_tiles)- }. w9 a' R( `% H( x

  9011. # P: N$ h" B& f1 \
  9012.     (setq dialog-state (start_dialog))
    ) d+ e4 E6 D. |& y0 }/ q3 A" h
  9013.     (if (= dialog-state 0)' R; \$ a3 \% k' u
  9014.       (reset)* p6 o2 @2 [2 w! Q/ u' ^
  9015.     )
    7 H1 i2 `" T4 W" O
  9016.     (if (= dialog-state 1)
    ! ?; T  M1 |- p9 Q) p4 r3 e& P8 E
  9017.       (progn
    # b9 A/ ]  `) q9 H+ O6 k/ ?* H" R
  9018.         (if (= ecolor   0) (setq ecolor "BYBLOCK"))1 o5 B) `$ M: u/ W# o; _
  9019.         (if (= ecolor 256) (setq ecolor "BYLAYER"))3 d& }7 i- p3 K# u9 B  n
  9020.         (command "_.chprop" ename ""  x4 p% J0 j9 S& l
  9021.                  "_la" elayer
    3 E/ K1 y! s1 Z0 Z
  9022.                  "_c" ecolor ""% E5 \; s, g& _: f0 O& M" J
  9023.         )
    8 g. J6 C$ X* f! r4 k# ^
  9024.       )( m1 X6 T' }- j% O$ T
  9025.     )
    5 C6 c7 R+ ?# t! L$ a5 x5 b4 w
  9026.   )/ `3 o1 C5 `+ m6 Q4 \5 s2 m
  9027.   ;;! K, r" K, ^1 R3 B
  9028.   ;; Modify POLYLINE4 z& h* q" X/ g& E
  9029.   ;;
    & i6 V# o# z7 v" W8 X  M: @- S
  9030.   (defun modify_polyline ()
    / }' q' t, V; z' b
  9031.     (modify_properties)2 t% p' }' C$ |( D
  9032.     (if (= ltgen "1")
    ( _+ N* E1 C: L, C& a8 s
  9033.         (if (/= (logand bit70 128) 128)
    9 }) M5 q; h8 v- a" u; z
  9034.             (setq bit70 (+ bit70 128))
    4 ]2 V& i1 {! X$ B* M5 @
  9035.         )
    3 \$ j# _+ H/ \
  9036.     )
    + ~, W/ Q' V9 x; i: y/ I
  9037.     (if (= ltgen "0")1 q6 {& X/ q3 m
  9038.         (if (= (logand bit70 128) 128)+ [/ o/ C$ e$ ?; Y, x
  9039.             (setq bit70 (- bit70 128))7 n& {/ j* D% v' V! V
  9040.         )1 b1 Q4 C5 ]- Y2 l
  9041.     )! }# V! K5 P8 c. \, R/ k
  9042.     (setq elist (subst (cons 70 bit70) (assoc 70 elist) elist))3 j. R  d. y& X; g; K7 D0 a4 k
  9043.     (entmod elist)1 a  [! Q7 {- ]$ B! ?0 C' |
  9044.     ;; Added to take care of updating Vertex information for color
    9 T$ T9 U' w7 y
  9045.     ;; and linetype./ ~3 N$ L- h* A1 W1 z
  9046.     (setq save-ename ename save-elist elist)
    ( u  N# m4 b& `+ S. z
  9047.     (if (= (cdr (assoc 0 elist)) "LWPOLYLINE")
    5 F/ |! W' ^) {4 u: l% |
  9048.         (progn* j6 ~) A* l7 {/ J) r
  9049.             (emod ecolor 62); T. I2 @1 t& v4 S
  9050.             (emod eltype 6)
    * h- V& l! c" {$ n! n, E
  9051.             (emod eltscale 48)
    ! B! a% Y' W  ?, I6 W# L( Z6 q! V
  9052.             (entmod elist)
    - w2 u! A$ q. w& y6 ~1 Z% f) R
  9053.         )
    - V* A' {# m/ `; y+ T: ~* ^$ j  h( n
  9054.         (progn3 Z$ r# r$ S; f# E
  9055.             (setq ename (entnext save-ename))1 ?% l  F0 v# `( d8 l' K" \# t2 ~
  9056.             (setq elist (entget ename))
    7 h- d# X) f4 f' R2 F

  9057. ) S# i. {+ u$ o9 c
  9058.             (while (not (= (cdr (assoc 0 elist)) "SEQEND"))9 y  b& N1 Z* Z1 O, }
  9059.                 (emod ecolor 62)
    ; _/ O6 G/ D% t/ \7 l
  9060.                 (emod eltype 6)* N. R! `' W) v8 N
  9061.                 (emod eltscale 48)5 x3 m* n4 b1 I3 [
  9062.                 (entmod elist)' V& d4 P6 A& D# \
  9063.                 (setq ename (entnext ename))+ [  j# d6 a% s5 e
  9064.                 (setq elist (entget ename))
    ' h( L7 G1 b9 h# V4 ?; Q9 f
  9065.             )
    . C4 N/ f/ G" r  b* U
  9066.         )
    & Z5 A( `% ~; E
  9067.     )' g) i8 t& G) _% C
  9068.     ;; Update the SEQEND3 [4 x0 K/ Z. Q
  9069.     (if (= (cdr (assoc 0 elist)) "SEQEND")0 Q, A& Q; b' Z/ c. i# T
  9070.       (progn6 y7 u: u' W' Z! i0 K2 o. @4 N' e
  9071.         (emod ecolor 62)
    ( W# p  P0 ?4 V% E
  9072.         (emod eltype 6)
    5 P" h/ h- {9 L0 I- ?; q) l' F
  9073.         (emod eltscale 48)
    7 W+ w$ E9 E* P" s
  9074.         (entmod elist)
    3 Y+ M3 H5 W8 A& D2 w. t! C
  9075.       )7 f# g6 `% ^- b6 `: |! s
  9076.     )( `* r* F. m% h! ^2 V- L1 f
  9077.     ;; Go back to header.
    # V* j- p. v" `5 ^" d* T/ n
  9078.     (setq ename save-ename elist save-elist)$ L& l* m6 V; b/ X- \: [' ~) R

  9079. , D( `) j# `: h
  9080.     (entupd ename)7 l  O" T0 W$ `; h0 \/ R
  9081.   )9 w) p6 }! e" Z) F
  9082. , |5 i8 E2 a# i$ G
  9083.   ;; Increment vertex.  Set tile values to next vertex
    & f# ^; w+ E. E
  9084.   ;;
    ( D- `8 b$ @" d2 u
  9085.   (defun next_vertex ()2 T- @8 I0 Y* i8 O0 E
  9086.     (if (= (cdr (assoc 0 vlist)) "LWPOLYLINE")& g' M, ?8 N# ~7 h2 }
  9087.         (progn
    ( L" H/ U" K! u4 b5 P: V1 R  F
  9088.             ;; If the counter reaches the number of vertices,
    2 K5 A. ?( i5 l4 n) y- u
  9089.             ;; roll it over to zero again.
    . @; e  P/ B9 D" e
  9090.             (if (= ctr (cdr (assoc 90 vlist)))
    4 b& ?6 _. s  q
  9091.                 (setq ctr 0)
    4 s( n2 s* |# z& O0 k9 C# ]
  9092.             )7 ]) b! T) _1 w
  9093.                 (set_tile "ctr" (itoa (setq ctr (+ 1 ctr))))1 U; g1 `) b9 O9 j
  9094.             (set_tile_vpt pointype); s! p, _7 J$ [8 ]
  9095.         )* ]( T, Z0 V/ ^& v
  9096.         (progn
    . L$ B: d! b2 d8 \. F( g$ B. B
  9097.             (setq vname (entnext vname))  M2 C$ C9 _6 z9 X& x
  9098.             (setq vlist (entget vname))
    3 O2 E  _: @/ M' U2 E
  9099.             (if (= (cdr (assoc 0 vlist)) "VERTEX")
    & a' E  M* ]% t* J, k8 `8 j/ N) }! y
  9100.                 (progn( l  G; P/ f$ a
  9101.                     (set_tile "ctr" (itoa (setq ctr (+ 1 ctr))))
    2 f( s; Q5 {+ b9 i0 n4 B9 T% ^
  9102.                     (set_tile_vpt pointype)
    $ g$ C% n$ Y: k/ z. e
  9103.                 )5 m/ e1 Z; C( l4 e/ u/ p
  9104.                 (progn" i* r3 g: i* q: ^9 p  @
  9105.                     (setq vname (entnext ename))
    3 w! J+ m' G4 c6 v  e
  9106.                     (setq vlist (entget vname))0 j2 r( T$ k, ]6 `# i  g7 u
  9107.                     (set_tile_vpt pointype)% n& ?, r, G" Q( K  r& W4 C
  9108.                     (set_tile "ctr" (itoa (setq ctr 1)))
    ( }$ f* K$ e/ Z. @& O1 S
  9109.                 )/ n! l! m# }+ k
  9110.             )
    9 J; l# s6 x  v; A3 p( ]
  9111.         )
    $ \: s7 S9 }  s. t& I; F9 @; M
  9112.     )1 @. q; a) d& u
  9113.   )
    % v& `2 S8 L* [8 ?. c6 a  ?

  9114. ; ]/ D  G0 F& J/ T6 C
  9115.   (defun ddpline (/ oldecho)
    ( L/ a/ \  o6 N6 ~" S. n
  9116.     (if (not (new_dialog "ddpline" dcl_id)) (exit))
    6 _8 d. z8 `4 \5 B# Z+ A8 o
  9117.     (set_tile_props)* D7 n7 V: X- U+ e" a: @1 l2 v) {$ @
  9118.     (set_tile_handle)
    # ~  j2 {8 h; o' g6 d; {- L: T
  9119.     (setq bit70 (cdr (assoc 70 elist)))3 n: T6 G6 B) E- |5 N  k3 Y3 Y
  9120.     (setq bit75 (cdr (assoc 75 elist)))
    / W8 I+ ]2 s- K# w
  9121.     (cond
    : R1 z' m2 L% a% C1 |1 ]( l) m
  9122.       ((= (logand bit70 8) 8)   ; 3DPOLY6 z. G7 j7 g8 \+ d
  9123.         (set_tile "ptype" (setq pltype "3D polyline"))6 d- k( s  i4 e, z
  9124.         (setq pointype 0)       ; WCS or ECS point values/ h, {5 k" o0 ?; T! r; C( t
  9125.         (mode_tile "fit" 1)
    4 B8 J8 q( H4 X. A" v8 a
  9126.         (mode_tile "mesh" 1)* r1 y: e# |% B9 ], J' S9 [5 B6 S
  9127.         (mode_tile "bezier" 1)# J! p9 e% `1 W
  9128.         (mode_tile "ltgen" 1)
    . f1 K9 b* w$ x2 E3 T
  9129.         (set_tile "none" "1"): g1 d9 }: c1 ~3 [- W8 ?6 i
  9130.         (set_tile_closed)
    ) w" P5 w) l; z" ^& R
  9131.         (set_tile_fitsmooth)
    # f1 \( y3 O/ `% O" C
  9132.       )
    - k% x2 N: p4 W, @& c9 g, i
  9133.       ((= (logand bit70 16) 16) ; 3DMESH
    1 ?* c4 u4 }6 U" R4 Y
  9134.         (set_tile "ptype" (setq pltype "3D mesh"))
    $ A  A) ?$ ^1 h' p/ Z: @
  9135.         (setq pointype 0)% G+ U) s) ~; ]7 q, N
  9136.         (mode_tile "pline" 1)$ E7 w# R: v; i. d5 x1 R
  9137.         (mode_tile "fit" 1)- Z" S) d  I& }5 w
  9138.         (mode_tile "ltgen" 1)
    ; a& h5 [' M3 i1 X- Z/ U, \
  9139.         (setq m (1- (cdr (assoc 71 elist))))6 F+ G- ^4 s" R- m$ x
  9140.         (setq n (1-(cdr (assoc 72 elist))))
    ) ~/ T4 e( q/ I3 i
  9141.         (setq u (1- (cdr (assoc 73 elist))))+ J' e- q7 Y# F8 r
  9142.         (if (< u 0) (setq u 0))
    $ _' s$ y5 e/ D  }! f% T# w
  9143.         (setq v (1- (cdr (assoc 74 elist))))
    + B7 e) C  ]6 P* k- ^* t$ r3 K: u
  9144.         (if (< v 0) (setq v 0))
    0 t8 v/ W$ H& c3 D2 d5 d' J7 X
  9145.         (set_tile "m" (itoa m))5 f, W, d6 |2 P) j
  9146.         (set_tile "n" (itoa n))
    , R( z- E$ ^3 i* Y) L7 R  b
  9147.         (set_tile "u" (itoa u))
    + h9 h( N5 ^. W1 Q/ H. u* d
  9148.         (set_tile "v" (itoa v))3 Y/ ^" w3 N" e/ k' I
  9149.         (set_tile_closed)
    / D) a3 O' a+ G0 j6 _6 L
  9150.         (set_tile_fitsmooth)' G4 s& m% v$ d' @; `
  9151.       )0 i' ?8 j" @2 v  U6 I
  9152.       ((= (logand bit70 64) 64) ; POLYFACE MESH$ e% t& m; ^4 z# B( L
  9153.         (set_tile "ptype" (setq pltype "Polyface mesh"))
    , f& w$ K8 E. W
  9154.         (setq pointype 0)
    - A$ P( [+ ]# x
  9155.         (mode_tile "f-s" 1)* z) B' m7 T. c. \; H! M
  9156.         (mode_tile "mesh" 1)$ p# h! W/ N0 {9 z
  9157.         (mode_tile "pline" 1)4 t- L1 u: N: k/ l2 E
  9158.       )
    ; s% @) |* Q* G1 Y" ]1 y9 ^
  9159.       (T                        ; 2D POLYLINE
    / L- A( @, b3 J* B
  9160.         (set_tile "ptype" (setq pltype "2D polyline"))
    8 ~2 D/ t) {7 y4 \8 A
  9161.         (setq pointype 1)
    & Q# c% o8 k' T8 L. E- {
  9162.         (mode_tile "bezier" 1)
    2 T2 I& Y  e) _6 c
  9163.         (mode_tile "mesh" 1)  q  q0 f& [8 r5 h5 s+ R3 E+ o  w/ R8 t
  9164.         (if (= (logand bit70 128) 128)7 R4 V4 V+ \, N3 T8 [
  9165.             (set_tile "ltgen" (setq ltgen "1"))
    8 O: w; R* e& d( i. O% c
  9166.         )) \* r2 ]+ l( t7 t9 L
  9167.         (set_tile_closed)
    & r( Z* |& o+ ^$ C
  9168.         (set_tile_fitsmooth)
    % M1 Q7 A/ g8 s# n
  9169.       )8 |' T; ~0 L7 ~$ H+ H
  9170.     )
    % a. [5 D4 ^" C& l# _' {

  9171. 1 c7 m; b; T2 X/ l8 M3 [
  9172.     (if (= (cdr (assoc 0 elist)) "LWPOLYLINE")* G5 G6 X6 E; e' f: w1 i
  9173.         (progn
    2 ?( T1 A0 _$ O3 F/ Y9 K; S! F
  9174.             (if (not next) (setq vname ename))
    " T2 {& d1 ?! `8 Q& k$ |8 J
  9175.             (setq next T)
    % w" ^6 ^" X6 |  {. C5 w; j, @
  9176.             (set_tile "ctr" (itoa (setq ctr 1)))8 M- s8 |5 k, }  I# n
  9177.             (setq vlist (entget ename))( b& S3 c- ~0 T5 s
  9178.         )% j$ A$ |0 d% {! _- D
  9179.         (progn9 P. e6 f( ?. R- x; ~" w$ Q7 G
  9180.             (if (not next) (setq vname (entnext ename)))* ?0 B3 J; v* w) m$ F% O6 g
  9181.             (setq next T)- \- A7 `" H# e/ j3 c
  9182.             (set_tile "ctr" (itoa (setq ctr 1)))
    ; M# N7 U8 B5 Z) V- a# {
  9183.             (setq vlist (entget vname))
    ( A8 A: h1 o/ ?4 D& X3 T
  9184.         )2 N0 U' ?2 k* Q- g+ @
  9185.     )* r) i: j) a0 ]; X: k
  9186.     (set_tile_vpt pointype)
    / _7 _$ R6 \1 v2 \* H! e
  9187.     ;; Define action for tiles6 b3 A8 d- f! c& J) y  W! F+ A
  9188.     (set_action_tiles)
    , F/ x# s$ P' S( z5 v
  9189.     (setq dialog-state (start_dialog)): J; F9 x7 F& c' _8 S! O1 C
  9190. + L. Q8 S% n+ K' v% M3 Q
  9191.     (if (= dialog-state 0)( @3 c2 v5 N- F6 P, {. P3 K
  9192.       (reset)" q1 n5 G' V8 v! k' N
  9193.     )
    # n9 ^: W7 [3 O' v' f' y
  9194.     (if (= dialog-state 1)' p+ v6 ~( y8 @. i
  9195.       (progn
    4 H+ b! q: q, E) k2 f1 k3 Y4 @
  9196.         (modify_polyline)" G2 p+ t' ]- Q) J7 z3 E
  9197.         (if (or (= pltype "2D polyline")6 f3 z1 F9 c/ k6 b! M* n8 a
  9198.                 (= pltype "3D polyline")
    : D0 V$ R/ L3 u: ~* d
  9199.             )9 b3 b$ N3 D" V$ j; G/ i
  9200.           (progn$ I# L7 S7 {# N+ F! g
  9201.             (command "_.pedit" ename)
    ) A' I# a* g9 `# I
  9202.             (if (= spltype 0) (command "_d"))
    9 G9 `1 h7 {8 s  s  Y' J) M
  9203.             (if (= spltype 1) (command "_f"))5 `% W0 Y# w- H( _* r0 X
  9204.             (if (or (= spltype 5)" O- [0 l* N4 @2 u) y; v$ N  o
  9205.                     (= spltype 6)
    ( I7 |4 r8 }5 m% o/ |
  9206.                 )( U# e5 H/ `2 T7 D7 }: C( T, b
  9207.               (progn# w6 T. z! L6 q! @" Z# C1 y( d3 H! x
  9208.                 (setvar "splinetype" spltype)% C; R2 Z" ^$ N" `* l+ _
  9209.                 (command "_s")( a4 Y8 z  u6 J1 R4 N& W5 i" d
  9210.               )) m+ t3 q5 R( T
  9211.             )
    3 |" c7 B: K- a  c; K% b8 v
  9212.             (if (= closed "0")
    ' a$ C; e* Y# j  [* f
  9213.               (command "_o")/ x; M# D5 n' Z
  9214.               (command "_c")+ O) u0 Y  d* _& R8 ^
  9215.             )
    8 k3 Q, H) p6 D; n
  9216.             (command "")
    / Q* y% Y3 C! c8 Y  a' i$ m% F% _

  9217. ) w- ^6 G# q# W4 R, b, s7 K
  9218.             (if (= spltype 0)8 [5 M- o6 W: M
  9219.                 (progn1 Z4 @" U* I1 q" D( g2 N5 R
  9220.                     (setq oldecho (getvar "cmdecho"))
    8 n0 \$ i' C  J- ]  e8 I& P2 z
  9221.                     (command "_cmdecho" 0)
    * j7 S5 @; v7 M# a. a1 k! q* Z- t1 M9 D5 r
  9222.                     (command "_convertpoly" "_light" ename "")( \4 Z; J0 p% Z9 {, d# S2 V
  9223.                     (command "_cmdecho" oldecho)( o* n3 H* G6 x* e' v; w- k$ {
  9224.                 )+ t7 f; I5 P' J6 q  I  [
  9225.             )
    5 r: i- M2 @6 h% \) |8 j
  9226.           )
    ( u# c* Y$ ?6 t8 z& t& y: t7 g! f: X
  9227.         )
    ( W; `( f: Y3 g+ x# l
  9228.         (if (= pltype "3D mesh")
    9 R( y/ G! Z" p* `8 s9 ?" Y3 ~8 }
  9229.           (progn! u6 m: q; r2 A0 g
  9230.             (command "_.pedit" ename)4 Q9 t- [& O/ r. L! z
  9231.             (if (= spltype 0) (command "_d"))
    ' l) @+ G1 U! j3 p' A
  9232.             (if (or (= spltype 5)
    $ V9 n3 j6 A! e* p* _* C
  9233.                     (= spltype 6)9 w6 C2 b1 E: B
  9234.                     (= spltype 8); e  C2 q/ E, H) a! i6 i
  9235.                 )! p7 h. ^  v- T) g. J
  9236.               (progn! J  K, m$ @- ~! b0 r; e
  9237.                 (setvar "surftype" spltype)
    ! C! y9 C* ]! N% U$ i, q2 b' v
  9238.                 (setvar "surfu" u), I1 D- g7 n# P/ J/ T. i
  9239.                 (setvar "surfv" v)
    3 \' Y' F3 U* a: A- f6 M. T! I
  9240.                 (command "_s")/ [+ h  g2 U+ R
  9241.               )
    ) c9 L2 t* C3 C
  9242.             )4 D' [- p9 z6 @% ]" R! @+ R4 s4 c
  9243.             (if (/= closedm old-closedm)
    3 A0 G$ q* c. x1 w8 \  l" E
  9244.               (command "_m")
    ) l8 _- C9 @5 ~
  9245.             )2 ~* W7 v8 ~6 ]7 ^2 J
  9246.             (if (/= closedn old-closedn)4 P4 k% \( T' G5 o& [- `- N0 s
  9247.               (command "_n")
    . w; M4 q# A7 s/ y# ~. o) L2 |
  9248.             )
    / S! t2 k6 J$ v9 q; c- ?
  9249.             (command "")
    7 F5 X/ K/ t. p$ o
  9250.           )
    ) |3 F! O; Y  F6 Z
  9251.         )5 T8 _6 u& Z  U) G" A
  9252.       )
    / R1 T7 L1 T/ b+ [0 K1 P
  9253.     )5 d( @3 l. }3 z9 X
  9254.   )2 w; v* D6 a5 V. Q, L! p0 A
  9255.   ;;
    2 \1 q4 p7 g+ w" \8 f
  9256.   ;; All the spline data is contained in a single elist. We must do some
    ( D1 e5 y5 @0 q) a/ M7 ^! z) {* Q) V
  9257.   ;; tricky list processing to loop through the elist in order to display
    & i4 H' t, v6 U) Q* q" P2 t) ]
  9258.   ;; all of the control points./ |% q, W3 o- m& F* D& B
  9259.   ;;
    % B* F  a! m; A' ^7 h# P8 k0 q# Q
  9260.   ;; The structure of the elist is different for rational and non-rational
    " R- R  `7 P" y% ~' G
  9261.   ;; splines. Therefore, we check the rational spline flag.
    5 s+ ?+ ?8 Y$ T8 f) C
  9262.   ;;
    2 u9 f, `9 i3 H4 i0 v  E" K/ m" e0 O
  9263.   (defun next_cntl_pt ()
    9 Y2 G; K4 I! Q! S* z0 C
  9264.     (setq elem-no 0)               ;; elem-no = element counter
    ' q/ l0 I6 Q' ]8 n# k, @0 }
  9265.     (if (= first-10-time 1)        ;; If first time, find location of first
    " P! H" X8 {( f( t( E
  9266.         (foreach list_item elist   ;; cntl point element in elist. z9 [8 m% [( D' G' K) F! i
  9267.            (progn
    ) F% }* |" x: \  P, r3 V& N
  9268.                (setq elem-no (+ 1 elem-no))  B/ g: |7 G% K6 r3 U: o- |' N
  9269.                (if (= (car list_item) 10)
    4 N+ {9 c# p4 K6 J% S& U
  9270.                    (progn
    5 M! @$ `2 [+ U9 I# d( Y
  9271.                        (if (= first-10-time 1)9 F: J; \( M! `
  9272.                            (progn* V, x8 t* o+ l* \& M
  9273.                               (setq first-10-rec (- elem-no 1))
    $ K* N' t/ z/ q  m; V- i2 |
  9274.                               (setq first-10-time 0)
    1 ~7 J0 K9 ~8 I2 r) p  o5 {! w
  9275.                               (if (= rational_spl_flag 1) ;; if rational
    : U- ^2 h: C. Y% s# D
  9276.                                   (setq cur-10-rec (+ elem-no 1))4 ?- g& K7 S' N5 {
  9277.                                   (setq cur-10-rec elem-no)  F$ s! _$ }5 I* E3 o5 ^
  9278.                               )
    % B& c) Y0 L9 E, \" y4 t8 c1 l
  9279.                            )
    ! M5 [7 o4 _/ j2 e; I! @
  9280.                        )  z1 F4 b1 O. T( [4 {
  9281.                    )7 B0 h& [7 G0 l1 B% w3 d
  9282.                )  b4 q9 D& b6 J6 q7 X
  9283.            )$ ]( R7 p6 H) L1 R
  9284.         )
    ; u. S) T2 n& P: v3 Q  p
  9285.     )7 N* A0 ?' u* `* F
  9286.     ;; Now we know the location of the first "10" record; it's stored  ^+ B) b- W9 f6 L
  9287.     ;; in first-10-rec. The first 10 record was already displayed when1 `$ @7 h3 Z0 h3 a3 ^$ Y
  9288.     ;; the dialog first came up so let's display the second one when
    ; B7 a+ z! t( v
  9289.     ;; the user presses the "next" button (the first time through).
    * R( a5 n6 E2 [' \
  9290.     ;;6 y# J5 \/ D& E3 t& b* m, [' E
  9291.     (setq temprec (nth cur-10-rec elist))
    : t7 Q% `5 U! E  N' \- v* y
  9292.     ;;
    & e5 n4 o6 B# }1 h+ E# W3 v" p% v. j
  9293.     (if (= (car temprec) 10)   ;; if 10 record
    * x' G; |* F' n# l3 J+ ?- l2 k
  9294.       (progn
    9 E3 a3 |( F# K/ g* W6 [4 x
  9295.         (if (= rational_spl_flag 1)    ;; if rational spline
    / a4 P) p+ I0 J+ s1 x
  9296.           (progn
    - {" x0 P8 @! H- n
  9297.             (setq tempweight (nth (+ cur-10-rec 1) elist))
    1 n- E) {# A. ?
  9298.             (setq cur-10-rec (+ 2 cur-10-rec)): C. d0 y$ V$ H6 N# Q" L. Q# O- f% L
  9299.           )
    1 e  s6 t  k, F
  9300.           (progn                       ;; else
    + |1 R7 u7 X, b6 A$ I& I
  9301.             (setq cur-10-rec (+ 1 cur-10-rec))+ Y% u- n; `& y6 k6 b
  9302.           )+ Y2 r  \+ X( @3 u2 X- N+ G
  9303.         )* m: H/ k, Z% k) e! e* x0 U0 k
  9304.       )                                ;; end if rational spline3 o1 F% |" n; y' @
  9305.       (progn                   ;; else reset counters, T6 Z  C, h3 j0 l) A( E1 R/ i3 u1 `$ U
  9306.         (setq temprec (nth first-10-rec elist))  ;; get 1st 10 rec' c6 }7 ^% Q8 l, ]
  9307.         (setq tempweight (nth (+ first-10-rec 1) elist))
    , B. U( a- L" b; B! l8 f# |3 U
  9308.         (setq cntl-pt-indicator 0)
    : T& p- g/ C( v6 c# |9 v3 E
  9309.         (if (= rational_spl_flag 1)             ;; if rational
    4 r2 I3 x$ }( m* u% D- C% ?
  9310.             (setq cur-10-rec (+ first-10-rec 2)) ;; point to 2nd 10 rec- |, k% `& y& m  d3 v" v* p
  9311.             (setq cur-10-rec (+ first-10-rec 1)) ;; point to 2nd 10 rec
    4 d; B1 _  [9 e7 a& r
  9312.         )/ C6 D( E8 n$ N, p# N  H7 ~/ L% A
  9313.       )$ o( ~: r4 Y% v) y5 P
  9314.     )                          ;; end if 10 record. V4 \; ~  w& p. Y5 _0 \6 X/ u

  9315. 2 g8 J4 B/ h; T/ U. ^  v( Q
  9316.     ;; Display cntl point, weight and ctr. Increment ctr.  v3 \6 O' M2 [' W/ @( |6 @1 |2 D
  9317.     (setq cntl-pt (cdr temprec))
    & H- _) f( b5 ?" v, q
  9318.     (set_tile "xtext" (rtos (setq x1 (car cntl-pt))))- |9 H$ ~- E+ e
  9319.     (set_tile "ytext" (rtos (setq y1 (cadr cntl-pt))))
    & Y3 m1 g* c6 R9 A5 F: f8 M
  9320.     (set_tile "ztext" (rtos (setq z1 (caddr cntl-pt))))
    2 s3 g$ `" n7 E# u2 H
  9321.     (setq cntl-pt-indicator (+ 1 cntl-pt-indicator))4 J5 Z  k" R5 d6 U' w4 M
  9322.     (set_tile "cntl_ctr" (itoa cntl-pt-indicator)), p- J( z- c  \; R' p! |. l3 y# f9 z
  9323.     (if (= rational_spl_flag 1)                     ;; if rational- G. r8 ?0 ^+ i% S2 j) h& l; b
  9324.         (set_tile "weight" (rtos (cdr tempweight))) ;; disp wght
      w! G7 S1 t) X/ V
  9325.         (mode_tile "weight_text" 1)                 ;; disable wght" H2 j# o( z9 e' V7 I& l4 Q
  9326.     )/ F/ w( y) ~2 e0 J7 R+ ^( R
  9327.   )
    5 f" r7 ?  Z; I0 i) v* m' h0 @
  9328.   ;;2 @; E. \, e( I) L( D
  9329.   ;; All the spline info is contained in a single elist. We must do some" d- Y- i+ @9 f" x( ^
  9330.   ;; tricky list processing to loop through the elist in order to display
    1 b9 l" [+ z: m2 Y5 c. m
  9331.   ;; all of the user data points.
    1 [3 n+ U5 ]8 r4 h
  9332.   ;;
    , W9 l7 {  j! n" x2 R
  9333.   (defun next_data_pt ()
    & ]0 \9 T; p8 K7 ]5 A. w
  9334.     (setq elem-no 0)               ;; elem-no = element counter
    . B7 a. A! S" v' b( ]  i
  9335.     (if (= first-11-time 1)        ;; If first time, find location of first
    ! I& F) D/ t6 H5 V5 w
  9336.         (foreach list_item elist   ;; data point element in elist
    9 E. |  H1 z, z1 i2 }
  9337.            (progn# j1 L5 V5 A% l
  9338.                (setq elem-no (+ 1 elem-no))" e, v! P$ x% ^- \
  9339.                (if (= (car list_item) 11)# Y1 B4 B1 k2 V2 h; y3 \, ~: S9 b& O
  9340.                    (progn
    & r3 Z# k) K5 ~+ w  D4 Y* O6 s
  9341.                        (if (= first-11-time 1)/ }- A# ~4 W( ], v0 A, P
  9342.                            (progn
    % G" `6 x. V# q$ H- b! l
  9343.                               (setq first-11-rec (- elem-no 1))
    * r6 v0 p" y8 ~3 |* _
  9344.                               (setq cur-11-rec elem-no)6 v( S* P6 ?7 ~0 H7 f" m
  9345.                               (setq first-11-time 0)2 R9 S8 ?1 n) Z( N$ o
  9346.                            ). s1 w; E1 I; X
  9347.                        )9 Y( ]! I( [% g" |+ m0 A  t
  9348.                    )5 y5 y6 r" z0 A' l: B1 h0 `
  9349.                )4 P; \2 R1 ~' A% r9 S( L
  9350.            )
    0 |; N( T2 J, v- m) p
  9351.         )
    9 V) T0 V) K! U+ r8 s
  9352.     )5 l+ ]) A. n* k1 e# \3 _
  9353.     (setq temprec (nth cur-11-rec elist))
    & s& s! R4 E  [. e
  9354.     ;; If it's not a DXF "11" element then we've gone past the last' l% r" V7 P& a+ u
  9355.     ;; "11" element. Go back to first "11" element. Reset counters.+ _1 p0 {% R. h8 L! c
  9356.     (if (= (car temprec) 11)
    & L4 S% k0 ]/ g- |4 Y
  9357.         (setq data-pt (cdr temprec))1 x" L6 U- o6 L& C. ^
  9358.         (progn                           ;; else/ w- M0 H5 d1 _+ ^
  9359.            (setq data-pt (cdr (nth first-11-rec elist)))
    , X4 L' e; d  s8 D- T  s
  9360.            (setq cur-11-rec first-11-rec)
    2 T: E" [: _0 \1 j  U4 x
  9361.            (setq data-pt-indicator 0)6 [' e8 \+ j7 b# c% [& u
  9362.         ), ?8 _8 ^. E5 |+ M2 x
  9363.     )
    + P) D' n3 z* U5 H6 X' m
  9364.     ;; Display data point and ctr. Increment counters.% m( A: b: H& Z6 ^; I( W6 y
  9365.     (set_tile "dxtext" (rtos (setq x1 (car data-pt))))
    8 {( S$ E! ~- i% \- u
  9366.     (set_tile "dytext" (rtos (setq y1 (cadr data-pt))))! L# N' ?" ~* p5 ^( k; F2 q
  9367.     (set_tile "dztext" (rtos (setq z1 (caddr data-pt))))
    2 `9 I! u: A' y5 p- F9 b  X% y
  9368.     (setq data-pt-indicator (+ 1 data-pt-indicator))) O  a6 }3 l, n3 }  K! V
  9369.     (set_tile "data_ctr" (itoa data-pt-indicator))
    8 U' o8 V. p! o, ]8 W
  9370.     (setq cur-11-rec (+ 1 cur-11-rec))  P: g$ b8 {2 O4 ?) b
  9371.   )) j3 ~* u6 Q& l6 N) }
  9372.   ;;
    * ^" R& F$ e5 M
  9373.   ;; Modify SPLINE$ v% r: O0 {# o0 \# J8 L  y
  9374.   ;;
    3 N. I, B8 \  A0 O. F- z
  9375.   (defun modify_spline ()
    2 N  i6 C- K6 c% g( u0 R/ d" X9 F
  9376.     (modify_prop_geom)
    1 F9 j, h3 t+ G" `5 w7 a) q2 H
  9377.     (entmod elist)  g7 U- K6 c2 J; p
  9378.   )
    - x" R$ G$ }2 S

  9379. ) [% w2 h. x* c9 g
  9380.   (defun ddspline ()
    ) p" y# o7 j  A$ e# p4 s# O
  9381.     (if (not (new_dialog "ddspline" dcl_id)) (exit))
    * K$ {, O0 @2 o) j/ _( }
  9382.     (set_tile_props)
      M$ R* E5 |- }) s' Q6 B
  9383.     (set_tile_handle). o  }3 Q; H2 U
  9384.     (set_tile_spline_props)
    9 V* V9 T: j, u8 a
  9385.     ;; Display first control point
    * X' ?! A: F! R6 \
  9386.     (set_tile_cntl_pt)# D- K2 F1 X6 b" m+ R6 X
  9387.     ;; Display first data point  u* B2 k9 e, u
  9388.     (set_tile_data_pt)+ A0 m' f1 R  i$ J
  9389. 3 i4 o" y$ P. ^9 O6 Y. L5 ~3 X1 U
  9390.     ;; Initialize flags to indicate first time through the dialog.( p' Z2 T8 f/ F# }
  9391.     ;; For control points and user data points the "next" buttons1 Q4 m' @1 [, K# P* f2 ]1 T1 @% S
  9392.     ;; in the dialog call the appropriate functions.# W; ]4 U% x' P; X  h. E
  9393.     (setq first-10-time 1)
    6 z: G+ I' L" Q7 f4 l. _
  9394.     (setq first-11-time 1)
    " d/ R: s5 |# z4 X: F, O' Z1 B
  9395.     ;; initialize control point number counter! I0 _& F- `" k8 `) i* s/ W
  9396.     (setq cntl-pt-indicator 1)
    ' ^" g( S( ^8 r- L( g. m9 }
  9397.     (setq data-pt-indicator 1)( A5 z/ s3 R% ]# `; K
  9398.     (set_tile "cntl_ctr" (itoa cntl-pt-indicator))
    ! W. [3 p% A1 K' ?: {4 M2 q
  9399.     (set_tile "data_ctr" (itoa data-pt-indicator))
    / }0 c, `  y5 a
  9400.     (set_action_tiles): J; E. ]9 R: b& p/ J0 @% w0 }
  9401.     (setq dialog-state (start_dialog))2 f6 D( }' w# ^

  9402. 7 W8 d7 H8 u$ p$ K2 `5 M
  9403.     (if (= dialog-state 0)' C" G2 `7 s% l4 @0 ^5 q) W
  9404.       (reset)
    . `7 \; N' J0 H* H; N4 h
  9405.     )
    / T0 r# S; |; A1 }+ i
  9406.     (if (= dialog-state 1)/ x/ n8 |3 g% ]$ d( ^; [; ?
  9407.       (modify_spline)
    4 ]& C+ E8 a3 k$ S3 k1 E) [* N
  9408.     )
    . ?$ L& Q+ J( l6 M
  9409.   )  `$ H; N+ l9 V# C

  9410. + E& ^9 Y0 Q( ^( q* k3 @  M% f3 m
  9411.   ;;2 A( `2 y' g3 @
  9412.   ;; Modify DIMENSION5 f( o. m% J% u7 N6 [; k: Q+ F
  9413.   ;;3 M9 U! B! d7 D) f+ p* q. b
  9414.   (defun ddimen (/ dtypebit blkname bename sublist a stname n dimtbl  e/ f  J, S- M& P0 t
  9415.                    dimsty dimlist dimtext svtext dimovr sv_dvlist stlist& ^. |/ i$ x( C7 ?3 d6 l
  9416.                    dimtype dimsvcurset): N+ R1 e8 n' d/ ]  ?& |
  9417.    (setq dimtype "DDIMEN"3 I% p- y# j/ U3 T
  9418.           dimsvcurset (ddimen_dimsty_restore)
    7 j! Y- U0 @& {
  9419.     )
    ' R# V* S5 r7 e. c9 n- B$ n
  9420.     (if (not (new_dialog "ddimen" dcl_id)) (exit))
      _: D+ G" @0 f+ Q1 v% e9 f/ B+ e0 T
  9421.     (set_tile_props)7 Z( z+ ~; q. Q- W- D# v+ E
  9422.     (set_dimen_props)
    3 e  R0 d$ q% N
  9423.     (setq dimtext (cdr (assoc 1 elist))); P0 {$ N) i& X9 x! [' ^- e
  9424.     (set_tile "t_string" (if (= "" dimtext) "<>" dimtext))
    ) A2 _& a. a7 J( _7 s3 n' m
  9425.     (set_tile_handle)5 ?" l1 E$ Z9 T& a( _! K+ @2 z& N0 q
  9426.     ;; Define action for tiles
    6 u# {" I! A8 z, ?7 J5 g
  9427.     (set_action_tiles)
    8 {' v; Z# n8 i' Z& U$ T
  9428. , B2 V8 ~9 w% U7 P/ E( v
  9429.     ;; Set initial focus to text edit box.1 A: @7 V: b* q: d
  9430.     (mode_tile "t_string" 2)
    " G  }+ I. l3 x9 {) i8 H/ [
  9431. : b; A* l& h8 @0 Q7 O7 B
  9432.     (setq dialog-state (start_dialog)). M; @) ?  F8 b4 d/ {" c9 u, U
  9433.     (if (= dialog-state 0): [3 {$ M+ y" @, v8 a
  9434.       (if (= ddimmt 1)5 d, R8 W7 z& q% Q9 c) g+ m' Q
  9435.         (reset): k, Z. k7 D9 N3 H6 s1 Z3 e
  9436.       )0 d7 L& T, I$ [
  9437.     )
    7 Z7 T( q6 U" Z* b
  9438.     (if (= dialog-state 1); _/ B4 e& H, }' R( V: D
  9439.       (progn
    , h4 h3 g+ H; }1 j( J0 Q8 k, m. C
  9440.         (if (/= dimsty stname)3 y; Q5 a+ F8 w2 C; V
  9441.           (progn- x4 ^* n- M+ P  M
  9442.             ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case8 R9 D6 w( m# X6 u+ \+ c9 P1 x
  9443.             ; doesn't have it.
    ) n$ r2 Y# Z8 ]. x' J$ z# o
  9444.             (if (null (assoc 3 elist))% I! b# u0 [" t' D
  9445.               (setq elist (append elist (list (cons 3 dimsty))))3 [; G7 n1 |$ r( _- `) O
  9446.               ; else just replace it.$ ^: k2 J& I7 P! L
  9447.               (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))7 q" i* g$ k- U6 `- A" D- S
  9448.             )3 e( |  x: G# ^$ Y; A/ g& T
  9449.             ; refresh sv_dvlist with new dimstyle.. f: _9 a0 @, f8 }) [9 y9 O" c
  9450.             (setq sv_dvlist (tblsearch "dimstyle" dimsty))9 C' {! H2 ^4 ^
  9451.           )0 v1 G: {  }. B
  9452.         )# v; J- x" j5 i. l) O5 ]2 C- w
  9453.         (if (not (null dimlist))   ; attempted to change dimvars+ o4 U$ H5 `# i/ |- @
  9454.           (ddimen_complist sv_dvlist dimlist dimtbl)
    + c# ]# g; T  G$ |, m( q  h
  9455.         ), c" }$ I- t, P5 H4 J4 D8 [
  9456.         ; Modify dimension text5 r* p3 U5 O6 v: ?/ F
  9457.         (if (/= dimtext text)4 Z+ h4 c$ X( O0 G) J; t& j6 j
  9458.           (progn+ f( m: U  A8 J2 F8 b3 P% b
  9459.             (setq dimtext (if (= text "<>") "" text))* ?. C& N6 t1 {- o& E5 I) H  m
  9460.             (setq elist (subst (cons 1 dimtext) (assoc 1 elist) elist))2 R' r' \. m" \1 O
  9461.           )0 p- ]5 y( R4 y+ e! ]
  9462.         )
    " F: z1 W* u' ]5 o  c
  9463.         (modify_properties)
    # [% l4 r/ K; H8 B% x4 W  u
  9464.         (entmod elist)
    3 h# R* O* U+ T7 K, v! K
  9465.       )
    0 _9 J! a2 ]' C, A3 I. x0 l
  9466.     )6 B3 Y8 I6 D1 r! v+ [- R
  9467.     (if (= dialog-state 4)
    8 K9 k; n+ ]4 `; W$ \" D1 d9 t2 D5 K: h
  9468.       (progn
    6 n8 x& n1 B/ J7 l
  9469.         (setq ddimmt 1)2 U3 C) B$ t) m
  9470.         (if (/= dimsty stname)$ p# R4 Y; @" s7 i( J( s2 d
  9471.           (progn
    + R& b' C' y# |$ x! a
  9472.             ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case
    0 `1 T2 q7 o3 O" Q$ }- J' S
  9473.             ; doesn't have it.
    * `5 A" P, ]' Z- |  t
  9474.             (if (null (assoc 3 elist))
    - Q" I5 O9 M2 o4 @& j
  9475.               (setq elist (append elist (list (cons 3 dimsty))))
    ; q. D, h) B+ @
  9476.               ; else just replace it.) T, {& F0 {* b8 U1 B; C& z
  9477.               (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))
    6 p" G% t. h' U/ _2 g
  9478.             )4 i- u+ i! i+ m4 w% B0 F" D
  9479.             ; refresh sv_dvlist with new dimstyle.; n1 h% R1 f& x$ b6 Q
  9480.             (setq sv_dvlist (tblsearch "dimstyle" dimsty))
    - ~" t' U; ]! l% T
  9481.           )
    % R" t* D5 X5 ?: \2 T  n
  9482.         )
    $ W  I& l; p4 t. [2 @3 r0 q( P& Q
  9483.         (if (not (null dimlist))   ; attempted to change dimvars
    ; [: N3 @2 T& x
  9484.           (ddimen_complist sv_dvlist dimlist dimtbl)9 Y' s' q$ p, u- A2 Q3 _) [2 m* f
  9485.         )& V- M, |5 d: S# A' w  ^6 V! S
  9486.         ; Modify dimension text
    8 E% D$ j" Y3 W6 L6 g- w
  9487.         (if (/= dimtext text)
    - l6 N: C! m, W' X; M+ F+ g# c
  9488.           (progn
    ' ]( ~- r5 @% k- t
  9489.             (setq dimtext (if (= text "<>") "" text))
    " C$ i0 {9 m7 b5 Q$ j2 S
  9490.             (setq elist (subst (cons 1 dimtext) (assoc 1 elist) elist)), x/ g) |4 \/ y# w# P
  9491.           )5 n4 x! O' F" @& b% {* b
  9492.         )/ K, x) P& }! e3 y8 s
  9493.         (modify_properties)
    ; B6 M& T* w5 B" l: a4 U
  9494.         (entmod elist): j+ i2 p/ w& J: W9 j" T
  9495.         (safe_ddedit ename)- A+ A( R* F7 g
  9496.         (setq elist (entget ename))/ F8 b6 V, b; i% V- ]0 m  @& e9 p/ z
  9497.         (ddimen)
    5 m" A3 H. G% Q+ b  B
  9498.       )
    3 m: {$ E6 n1 [; m6 e/ V6 t9 [  A2 b
  9499.     )# D5 Q1 G/ W+ n" ^. i3 X) s
  9500.     (ddimen_setvars dimsvcurset)      ; Prepare to exit7 {% j9 D0 M, t( s7 Z' D/ f7 e
  9501.   )0 m8 }% D  v7 p0 u# b( g

  9502. ! _' V' D; k- Z5 N+ ^" B0 C) Z; ?
  9503.   ;;& @9 J# t0 ^% @' d
  9504.   ;; Modify TOLERANCE
    8 P5 S. b5 d5 @
  9505.   ;;# }. B1 @2 U/ ~' ?  Y
  9506.   (defun ddtolerance (/ a stname n dimtbl4 A0 Z8 x, l$ ]; }5 `
  9507.                    dimsty dimlist dimovr sv_dvlist stlist dimtype, `1 D" m3 ^0 U/ {4 }
  9508.                    dimsvcurset)
    ' D! N& {1 ~. J' D
  9509.     (setq dimtype "DDTOLERANCE"! }) s) @0 l! l! H  O7 K/ S' ]3 O
  9510.           dimsvcurset (ddimen_dimsty_restore)# B: \5 }; Z) q) U  ~  |
  9511.     )8 z1 }  |  w9 o; Z
  9512.     (if (not (new_dialog "ddtolerance" dcl_id)) (exit))
    % h5 ~! n! S7 M" d  x, `& B
  9513.     (set_tile_props)
    $ `% k9 Z8 G' P; J
  9514.     (set_dimen_props)# n1 e& {# l+ n  k$ e9 E+ ~
  9515.     (set_tile_handle)
    # u: P1 z2 b) z$ r* Q
  9516.     (set_action_tiles). k. x; ?* g" N& {- y$ I
  9517.     (setq dialog-state (start_dialog))2 P9 n1 i( b8 M& I! d
  9518.     (if (= dialog-state 0)6 O1 {: b& `+ D
  9519.       (if (= ddimmt 1)
    / J( i2 P& E+ m3 M- o
  9520.         (reset)
    ( t* F7 j# i& T  J  D
  9521.       )
    ! k0 @# f. \; p( _/ \7 }4 z5 z( N
  9522.     )
    ( O7 }9 [$ c- t) M
  9523.     (if (= dialog-state 1)  B  a' b! U! x- {7 F
  9524.       (progn' i0 R# \4 s& G5 r8 F6 ^8 O8 s
  9525.         (if (/= dimsty stname)
    9 u2 ]0 _# A! v3 U; |9 B
  9526.           (progn
    2 W2 ^: [  @) Q5 \8 g/ D
  9527.             ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case
    & K2 g- w( s. x4 v' ~
  9528.             ; doesn't have it.% s% z- d5 Z& e. c2 `+ U
  9529.             (if (null (assoc 3 elist))
    4 S: R2 ^: G* }' ]0 x! S
  9530.               (setq elist (append elist (list (cons 3 dimsty))))6 N% Z9 \$ h' w: K# {( Q( c/ I
  9531.               ; else just replace it.! ~0 w4 z; G# O! E  A* a0 n+ N
  9532.               (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))! ?! i9 _, H0 {2 J7 u0 _
  9533.             )* j1 Q' b; s1 H/ L3 ~0 O1 ~
  9534.             ; refresh sv_dvlist with new dimstyle.
    * M. j4 ~" z" S* F+ e& P& t5 D) i
  9535.             (setq sv_dvlist (tblsearch "dimstyle" dimsty))
    0 s1 _$ g$ T; D7 N9 r2 u
  9536.           )
    % b# I3 I1 k, y- f6 H
  9537.         )
    & V! r+ L- v  }4 o$ Y, P$ G! @
  9538.         (if (not (null dimlist))   ; attempted to change dimvars5 p3 P9 l9 x6 B( @% U& K1 |; {
  9539.           (ddimen_complist sv_dvlist dimlist dimtbl)
    . ]  Y+ ^: s' @1 a4 I& c
  9540.         )! |6 {. g+ ~' B# f) q) Q8 C
  9541.         (modify_prop_geom). l) p2 S" ~. r& |, |
  9542.         (entmod elist)
    % S$ v" T3 p0 H, b: n% m; L6 S
  9543.       )
    6 |6 ?, `: `( {7 e2 e/ E0 m
  9544.     )5 B$ \  K" t& f
  9545.     (if (= dialog-state 4)+ Z/ x# W: `- Q' F4 e: X  n
  9546.       (progn5 A! f7 |2 W$ F$ }+ @2 l
  9547.         (setq ddimmt 1)
    : h. w- B* |* ?7 y4 v7 D8 H! q
  9548.         (if (/= dimsty stname)
    8 d4 y. G7 e3 z0 d7 u6 x$ T% v& U' l
  9549.           (progn
    5 U) H! d! s# ~; P! ~; h5 q- E: g5 q
  9550.             ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case
    6 G( X+ {+ K- |; E/ L
  9551.             ; doesn't have it.
    , h$ _3 `5 `, f5 t% N% k
  9552.             (if (null (assoc 3 elist))( p2 @: d! A8 Y0 m; k* P4 _
  9553.               (setq elist (append elist (list (cons 3 dimsty))))
    9 J, M8 E7 X+ B
  9554.               ; else just replace it./ _. ~1 v( x1 _) A
  9555.               (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))0 l$ D1 h- O& y8 X, o
  9556.             )! X5 M0 s" e& _! l, h
  9557.             ; refresh sv_dvlist with new dimstyle.- I& q9 i# [9 P- B! I+ s0 _
  9558.             (setq sv_dvlist (tblsearch "dimstyle" dimsty))/ M# Z- s8 q! q2 s( m1 ^
  9559.           )1 @) O1 y( Q* O0 t! @; T, b* }' T
  9560.         )
    ; o4 Y$ ?6 Y5 ?4 `
  9561.         (if (not (null dimlist))   ; attempted to change dimvars
    + ?# g3 @  N' V  J$ i
  9562.           (ddimen_complist sv_dvlist dimlist dimtbl)- i( x. Z5 Q5 @
  9563.         ), j) |/ }+ `0 P. a1 B# Q1 ]
  9564.         (modify_properties); q; }, [' I+ ]9 b
  9565.         (entmod elist)2 N, {6 k) F6 ]9 Y
  9566.         (safe_ddedit ename)# A2 m3 ]- l4 H9 w  C+ F1 i
  9567.         (setq elist (entget ename))) s# Y* {- T7 f$ `5 L# B" u, U4 Z3 d3 ~
  9568.         (ddtolerance)7 D+ G! a1 v# O. m" L9 [
  9569.       )
    ( R& ]8 _7 v1 \( A9 E
  9570.     )* L3 D( N% W/ }( P1 b1 D3 n( V
  9571.     (ddimen_setvars dimsvcurset)      ; Prepare to exit
    2 _6 c+ n* P" B$ \6 ~! |
  9572. )6 n3 i# @$ U- H& |  ]$ C
  9573. + U- Q; c, Y& O8 T% i% G
  9574.   ;;3 Z& ]4 p* C# m9 L# z/ Z& V5 {; M
  9575.   ;; ddimen_dlg - jump to ADS ddim module( f) j  y% q% K3 N! Y1 Q* Y
  9576.   ;;
    $ Z) L3 F: ?: h7 }6 g0 G; v
  9577. ' G/ m! d6 J2 `5 v
  9578.   (defun ddimen_dlg (dimtype tile dimsty dvlist / dimlist)
    4 y( P9 W0 c" x5 j
  9579. / [6 ]( K/ Y  y8 V- M$ a6 B) i
  9580.     ; Jump to DDIM with overrides if any.
    ! H3 C2 j( Y( q# l; l8 `( ?
  9581.     (cond ((= tile 11) (setq dimlist (c:ddim "DDMODIFY" dimtype tile dimsty dvlist))) ; Geometry
    0 |# k; m1 S: M4 b# C
  9582.           ((= tile 12) (setq dimlist (c:ddim "DDMODIFY" dimtype tile dimsty dvlist))) ; Format
    ' l3 |' v4 D, s: W
  9583.           ((= tile 13) (setq dimlist (c:ddim "DDMODIFY" dimtype tile dimsty dvlist))) ; Annotation% J8 _$ J7 u" n9 Y& I$ l0 L
  9584.     )
    7 G% a$ w8 p4 K( j8 B
  9585.   )* h2 p8 y; Z, ~* r
  9586. ) B- u$ r0 y& M2 E) G! P! v5 `
  9587.   ;;
    9 G" w# Z7 H; I7 E, `) J( C% M
  9588.   ;; Dimension variables updated are stored as overrides.8 E  E' f4 h+ @/ r# L
  9589.   ;;/ ]6 b, m- Q; r( J

  9590. 9 v3 L9 Y) |& f$ S) ^( @7 A3 C7 U
  9591.   (defun ddimen_complist (dimolist dimnlist dimtbl / i odvar ndvar
    ( }4 Y5 |( o7 M* Q" ^
  9592.                           dv dime commandIssued)
    1 a0 Y  t$ p! q& T3 R0 G
  9593.   o; V9 i: B! i/ d, g
  9594.     ; Here we skip the following first three items:
    7 L& i) a1 h8 g, n. ?: j8 `  T
  9595.     ;   (0 . "DIMSTYLE") (2 . sylename) (70 . 0)! M% u8 f% F; v0 ~6 i/ ~: S, h1 x
  9596.     ;& {& N- J: G, L( |1 W
  9597.     ; The list comparison immediately begins with dimvar.) B2 B4 J2 x, H" h
  9598.     ;$ f4 }5 j( S  I9 a+ p1 P* B
  9599.     ;  dimolist - original states of dimvars# {! T) x3 g/ O; q/ V  W1 n+ e& V
  9600.     ;  dimnlist - new dimvar list which is of the resbuf's
    8 n/ Y, k. ?* O# n# r1 W
  9601.     ;  dime - entity name for the dimension  Z* Y, Z7 a+ x# a4 [
  9602.     ;  odvar - value of dimvar for the dimolist
    ! w- U* Q* ~& X; U; T
  9603.     ;  ndvar - value of dimvar for the dimnlist
    * U6 @+ f* {0 K  a( L4 ]- n

  9604. + n( o9 d5 o: q4 Q2 F& Q2 N, \
  9605.     (setq i 3  E! P5 Q, T" x  h/ x8 q0 f7 j$ S
  9606.           dime (cdr (assoc -1 elist))
      m/ v0 ]) x6 j# I5 [
  9607.     )
    : ^( m( l5 e! P, E
  9608.     (while (setq odvar (cdr (nth i dimolist)))
    5 B0 l6 w( G- p( r* R$ `! ]( l
  9609.       (progn8 y( ?) I$ m4 K& F& h" S8 |
  9610.         (setq ndvar (cdr (nth i dimnlist)))  y1 n" E0 A* u5 c6 z( F7 R& p. H
  9611.         (setq dv (nth i dimtbl))1 x# l& B; |, i! ]" X3 h- u4 S
  9612.         (if (eq dv "dimtxsty")
    + l; [5 B8 a4 @& x' W3 I: p
  9613.             (setq odvar (cdr (assoc 2 (entget odvar)))
    5 N0 g& F& F0 J8 P9 T
  9614.                   ndvar (cdr (assoc 2 (entget ndvar))), y* o$ \2 |/ @* X
  9615.             )
    - t; `# u, S* z# e
  9616.         )
    . |7 S6 [2 W# C. D- ]9 z

  9617. 7 {# n9 C: v/ z/ O
  9618.                 ;8 s! e! o" n: l9 Z* n/ W3 S
  9619.                 ; In order for DIMOVERRRIDE to operate correctly with string
    ) t3 F  H/ l3 x+ \3 E+ I& l
  9620.                 ; based dimvars, we must pass "." versus NULL strings.$ O, P; C6 L5 M$ ^
  9621.                 ; In this case ndvar is the new dimvar value the user wishes
    $ H( i2 o. F& m: e* k$ ]7 k! a
  9622.                 ; to update on selected dimensions.
    8 }2 f% g4 f5 K7 d$ t
  9623.                 ;
    0 v1 s* s8 u) A# u6 ^. ~
  9624.             (if (/= ndvar odvar)
    - c2 x0 B" }# Y; [
  9625.               (if (= 'STR (type ndvar))
    ( c/ A8 c4 K. t/ X4 n
  9626.                 (if (= ndvar "")
    ( Y7 K9 q* z# D& i# s. X
  9627.                       (setq ndvar "."))))3 m( z& e' @! c3 }2 P) G  X

  9628. ) A) @, W6 ^7 N) S; m! u
  9629.         (if (/= ndvar odvar)! M- q0 B. M4 o, j* P' b  g
  9630.           (progn7 ?7 Y% N5 X' i" g1 t1 \3 \# D
  9631.             (setq dv (strcat "_" dv))  N' a! g5 s" F% b: u
  9632.             ;
    8 v: z2 _& B+ f: e- p7 O
  9633.             ; Start the dimoverride command
    & ?& M, R, d8 y, t
  9634.             ;" l- `) C' |. ~# j' s
  9635.             (if (not commandIssued)2 {% f! {. t7 U8 k( u; ?! e& I
  9636.                (progn
    - @# [5 T$ i" m! g6 e& f; Z, a
  9637.                  (command "_.dimoverride")9 d' p* [3 E( P" m- ^$ g
  9638.                  (setq commandIssued "T")* A) a5 h/ v$ \
  9639.                ): R* Q$ X# w5 Y& |* o5 Z
  9640.             )
    0 m5 ~# y1 l* r2 {6 ^
  9641.             ;, I6 U7 j# j/ }8 U$ S; M( e& ]0 o
  9642.             ; Issue dim overrides, U: ?8 u9 _2 r( q6 L9 P5 H, @
  9643.             ;
    2 r! r9 ?- r7 H( @* {* t" d
  9644.             (if (and (or (= dv "_dimclrd") (= dv "_dimclrt") (= dv "_dimclre"))
    ) h) }3 @0 `2 q% C6 H
  9645.                      (or (= ndvar 0) (= ndvar 256))0 h3 [% ?5 Q1 H. D; B8 l/ i1 z! L
  9646.                 ); x8 m0 u/ m7 ?
  9647.               (progn
    : \, U" Z6 [6 c6 I6 c
  9648.                 (if (= 0 ndvar) (command dv "BYBLOCK"))
    + t) ]8 v2 V- U" H
  9649.                 (if (= 256 ndvar) (command dv "BYLAYER"))
    4 B" X5 i& |/ t& N9 N- x4 N$ |
  9650.               )# Q% ^/ H5 J; B  k+ c
  9651.               (command dv ndvar)
    ( M. x3 h: l1 V7 R
  9652.             )
    ' j, {& c5 _- e6 U, b
  9653.           )
    + o. {0 a5 ?0 ]; i6 D/ e8 E6 S
  9654.         )9 m/ a% B1 u* K. d: f
  9655.         (setq i (1+ i))
    2 o9 D" z& u$ b8 l$ {* H9 z
  9656.       )+ }9 E. `6 k' ]0 m
  9657.     )
    % S% a3 X/ V* m0 H# r
  9658.     ;
    8 q5 Q7 o+ F% ^
  9659.     ; Select Entity and terminate command! [  m7 ~6 [8 K" T& z
  9660.     ;! c- j  f( W" I- K& f. A7 F9 F# @
  9661.     (if commandIssued
    8 a" ?4 B4 l; K3 i2 U
  9662.         (command "" dime "")9 j" C/ S  a7 F
  9663.     ). r. q9 [0 E0 |; _! [
  9664.   )4 {/ X; P1 T- d# N: F# k
  9665. * Y$ e9 R; O: e2 j1 \
  9666.   ;;2 I! m/ w9 \8 C7 E+ `5 J
  9667.   ;; Get style name currently selected style name./ Z. Y* \6 T* u5 P! d) S4 s
  9668.   ;;1 i. |' [1 c( d/ L9 P& d' w
  9669. " S2 e/ U; p) x0 A: f4 U  `
  9670.   (defun ddimen_style (/ dimsty). D) Z  T1 m& @
  9671.     (setq dimsty (nth (atoi (get_tile "mod_style")) stlist)
    3 x- y: [/ t' f7 v& V4 O
  9672.           dimlist (ddimen_getdimvars dimsty)
    7 n, `. S! @* _: p  ?- o
  9673.     )
    8 ~3 e9 x! V2 u$ n0 L8 E
  9674.     dimsty
    ) C7 Q& V  @/ G9 Q+ }# N8 y
  9675.   )$ G# B& T" P) O# r4 [
  9676. ) }- t) p  Z, V8 Z, g- T+ n/ [
  9677.   ;;3 X+ L; L0 n( }: u' J
  9678.   ;; Set dimvars; j0 N1 \) i4 r& i
  9679.   ;;% i- X- Y, I9 m0 d
  9680.   (defun ddimen_setvars (dimsvcurset / dv i)" b0 ^. M! {' G& a8 u
  9681.     (setq dv (cdr (nth 1 dimsvcurset)))
    $ z" I; {0 y* n
  9682.     (command "_.dimstyle" "" dv)
    ; |! U3 c9 U/ B
  9683.     (setq i 3)+ Y2 E, ~. B0 H6 G& r9 S5 ~) Y# H
  9684.     (while (setq dv (nth i dimsvcurset))
    ) r: [) s3 p7 i7 B9 ^) M
  9685.       (progn6 g# l4 ]: H8 l+ }
  9686.         (setvar (car dv) (cdr dv))
    8 T6 C2 G, N1 P' J
  9687.         (setq i (1+ i))5 d* U2 Q3 ~  B: |1 b
  9688.       )
    % P. ~1 g$ {- Y- q
  9689.     )0 @0 m$ s& d2 h8 P4 I- G& v$ L! E
  9690.   )
    6 _$ e2 P' z: ~
  9691.   ;;
    ( ^: k5 u3 S' u' s* V, y
  9692.   ;;  End-of-dimension- a8 A, \" r* I' |# j0 A/ U
  9693.   ;; ==================
    " n& P- U* B7 y8 W6 y
  9694. * i9 b) A  L* ^% V* F! \8 H
  9695.   ;;8 n( o+ ]3 V/ c: R5 \: g7 t
  9696.   ;; Sub-dialogues for properties.  Common to all object dialogues
      y+ ]$ e- \" i' C# c$ E. m
  9697.   ;;
    4 T8 g% k' a# }- n; |( l
  9698.   ;; This function pops a dialogue box consisting of a list box,image tile, and3 v* w) Y4 i- `8 V
  9699.   ;; edit box to allow the user to select or type a color number.  It returns
    7 a( [6 n* ?) ?9 |9 E) v. e
  9700.   ;; the color number selected.
      d& [; C' e) j& S% S
  9701.   (defun getcolor (/ old-idx colorno cname lay_clr)8 \: }% f9 T$ @0 o
  9702.     (if (= (get_tile "error") "")0 [$ X8 u6 ]1 [) x4 O5 g
  9703.       (progn' _6 _% c. K1 D7 I: Q2 X
  9704.         ;; Get the color associated with this object's layer, for use7 B# E7 [/ D+ o; f2 \6 v
  9705.         ;; in the color swatch if the user selects color BYLAYER." q( o! ~4 _6 i  x1 T" B
  9706.         (setq lay_clr (cdr (assoc 62 (tblsearch "layer" elayer))))7 k& |, p6 `; x! t! q8 ~) w
  9707.         (if (numberp (setq temp_color (acad_colordlg ecolor T lay_clr)))
    / y- u# B# o$ R6 U
  9708.           (progn
    + `1 o$ T4 v( P
  9709.             (setq ecolor temp_color)7 A3 K9 k. j& `+ m
  9710.             (setcolor), h9 K! }, Y5 s6 h$ F
  9711.           )
    5 e5 b( p* i6 w& H2 ?  W
  9712.           (setq testcolor temp_color)
    6 A) q/ W6 m/ R: f1 s
  9713.         )
    : y6 h7 E% \0 h/ @; B8 v9 u* b
  9714.       )
    " |4 a. r1 _" [2 ^" C6 j- N
  9715.     )
    2 {7 x  |5 _. S
  9716.     ecolor7 g" |1 x" e$ i4 J. b7 S& w, x' l
  9717.   )0 y; D+ ^$ {0 k. h+ F! h; c  ~+ E' U  y
  9718.   ;;
    9 m( N$ @7 I' ?9 ]
  9719.   ;; Function to set the color tiles.
    ! h8 q1 s% N7 S5 r2 ]0 h! W7 H
  9720.   (defun setcolor()7 p* r  @% L3 M
  9721.     (cond2 e3 c  o+ u$ w+ N2 [
  9722.       ((= 0 ecolor)$ h- T3 h- E! Z( d# ]
  9723.         (set_tile "t_color" "BYBLOCK")/ M6 {- s3 C: y; J7 H9 }( z
  9724.         (col_tile "show_image" 7 nil)    ; show BYBLOCK as white
    7 q- N- X  E! c# F
  9725.       )
    1 x' \  l' }5 a
  9726.       ((= 1 ecolor)
    $ J' N9 Z% w" U! e4 Z% B
  9727.         (set_tile "t_color" "1 red")* v) d6 s5 n% r6 V) w
  9728.         (col_tile "show_image" 1 nil), b5 l7 J6 p- P- s2 X, _
  9729.       )
    / X% W2 c- `* v2 W
  9730.       ((= 2 ecolor)
    9 E6 P7 x8 Y* J, j' v5 l! a
  9731.         (set_tile "t_color" "2 yellow")
    ) P+ L$ E0 t8 B. E; h* u- l
  9732.         (col_tile "show_image" 2 nil)
    + \+ B' R! U1 \1 X1 [
  9733.       )4 o, X9 j3 e7 V! Y" |- p0 }/ M
  9734.       ((= 3 ecolor)% A. N( @$ s6 c! w
  9735.         (set_tile "t_color" "3 green")
    : b4 O+ i. s. a* |, u
  9736.         (col_tile "show_image" 3 nil)
    + Q: j5 _: ^6 o5 U
  9737.       )
    0 R' e& U  _$ ~5 k2 `# q# L
  9738.       ((= 4 ecolor)
    ' c/ [5 T+ l$ _2 s5 ]5 q7 J
  9739.         (set_tile "t_color" "4 cyan")
    8 ]2 _9 ]9 @- t* D
  9740.         (col_tile "show_image" 4 nil)1 |3 k9 c! N" Z/ p8 \1 Q7 u( S
  9741.       )
    7 R/ Q5 D1 S( D1 L0 {! f
  9742.       ((= 5 ecolor)8 m# A. G/ i6 w% }
  9743.         (set_tile "t_color" "5 blue")
    # `1 p  R, @4 D2 `4 M! E/ S. c) \
  9744.         (col_tile "show_image" 5 nil)1 j( }: K" S4 T1 r6 T
  9745.       )
    . E$ Q8 V3 K/ |8 k/ E5 z
  9746.       ((= 6 ecolor)5 h! ~" k. v6 }, c) w( C+ V! _# A0 B
  9747.         (set_tile "t_color" "6 magenta")
    + x3 s5 D3 M; ?: o% e
  9748.         (col_tile "show_image" 6 nil)1 b1 P! h7 }$ Q0 [  h4 l+ [+ }5 _6 {
  9749.       ). O- k+ P- D0 W  r
  9750.       ((= 7 ecolor): T. @/ M5 z# L1 V
  9751.         (set_tile "t_color" "7 white")
    5 K9 R+ i  m$ e/ Z' E/ r% Y
  9752.         (col_tile "show_image" 7 nil)" O' S7 b; C8 K, Z9 Q8 }1 P0 l
  9753.       )
    3 `# C; [6 |( C* A3 t" Z
  9754.       ((= 256 ecolor)2 f5 N2 f% M* Z4 ?  O* P' u
  9755.         (set_tile "t_color" "BYLAYER")
    9 u! q) ?0 {* c! W% ]
  9756.         (col_tile "show_image" (bylayer_col) nil). n' q0 H6 i. p* \
  9757.       )( b$ o* u0 x% x* [" t- R
  9758.       (T
    8 D( t) O+ x, p/ W7 o  _
  9759.         (set_tile "t_color" (itoa ecolor))
    1 S  j8 b& l; D9 y: q, z
  9760.         (col_tile "show_image" ecolor nil)
    ; |( G1 v# r' B6 ?
  9761.       ): s% s) `9 B# Z. ]  ^  l3 S
  9762.     )6 [/ x2 o: }9 ^+ c8 I
  9763.   )3 ^$ x5 e% n: V1 y% l
  9764.   ;;% H0 Z( P2 U6 s/ D
  9765.   ;; This function pops a dialogue box consisting of a list box, image tile, and
    ; a3 D0 r- c  j. W+ t+ z) A
  9766.   ;; edit box to allow the user to select or  type a linetype.  It returns the
    & v. `( o" R+ M8 r9 L$ i' Y
  9767.   ;; linetype selected.- ^4 E) N; B( O  v  a0 E
  9768.   ;;# p, `6 a  P' b# a
  9769.   (defun getltype (/ old-idx ltname)
    $ G4 I& X5 ~& U- y
  9770.     (if (not lt-idx)0 T4 W9 G( z( \4 P# t: {
  9771.       (progn6 f& h1 z+ c, n
  9772.         (make_lt_lists)             ; linetype lists - ltnmlst, mdashlist% J- }1 e  \  X/ b3 H# a' z
  9773.         (cond. s! W" X4 A& T2 C7 t
  9774.           ((= eltype "BYLAYER")
    ( Z: J6 Q: S, A- ^5 K  y! @" @
  9775.              (setq lt-idx (getindex "BYLAYER" ltnmlst)))
    0 O" [; t0 T' x  X
  9776.           ((= eltype "BYBLOCK")
    & C" ?6 j! h. o
  9777.              (setq lt-idx (getindex "BYBLOCK" ltnmlst)))+ T, E- p; M5 }0 ?8 K
  9778.           (T (setq lt-idx (getindex eltype ltnmlst)))/ C8 o8 h6 U) u; V3 }+ s( i& g  C  k, b
  9779.         )
    / P) f; Z$ R& `
  9780.       )* A' @4 P2 x6 }3 C4 ?1 b# H% P$ m- s
  9781.     )! H: r; j7 F" j! c! J! S8 v( }% H

  9782. 0 Y1 D( O3 l0 O9 i3 k: v$ f+ P
  9783.     (if (= (get_tile "error") "")
    9 y( [! T8 _; _  _) u% Y
  9784.      (progn& Y7 {( U9 Q9 _
  9785.       (if (not (new_dialog "setltype" dcl_id)) (exit))6 Y1 j; H7 U- O( |/ c% O
  9786.       (start_list "list_lt")" V7 Q7 V, @( n( T
  9787.       (mapcar 'add_list ltnmlst)  ; initialize list box
      ^5 Z! p  F5 x& v. i* n
  9788.       (end_list)/ W7 P" j6 j( X. J6 N
  9789.       (setq old-idx lt-idx)9 |8 ?3 J/ X+ g0 e
  9790.       (ltlist_act (itoa lt-idx))' |. ^3 A5 m0 {% e, t( F) n  |

  9791. 6 y4 n3 ?6 `4 K6 b
  9792.       (action_tile "list_lt" "(ltlist_act $value)")
    : P& R4 _9 g5 O, Y8 L1 C, g$ j
  9793.       (action_tile "edit_lt" "(ltedit_act $value)")
    - ~4 s/ G; j5 n$ O* I9 x  B
  9794.       (action_tile "accept" "(test_ok)")8 ^7 U" K9 h! g( p( f
  9795.       (action_tile "cancel" "(reset_lt)")
    " M" V( Y& v# e

  9796. ' S# t2 p. P. g+ N/ P( R
  9797.       (if (= (start_dialog) 1) ; User pressed OK0 f3 ^0 H3 x4 ?+ Q) n  w2 N  H
  9798.         (cond0 z' f1 P7 W- H1 T0 z5 t; L
  9799.           ((= lt-idx 0)" f; [+ G) z% v/ z* K% g
  9800.             (set_tile "t_ltype" (bylayer_lt))/ P1 z% S0 c: C0 r1 j) E; P
  9801.             "BYLAYER"4 y1 v4 ]: Q8 e4 C
  9802.           )& B4 y5 B9 k& F+ I, e5 |  l6 x
  9803.           ((= lt-idx 1)
    ' W' J# c% g; |7 w, b
  9804.             (set_tile "t_ltype" "BYBLOCK")
    9 K7 ]% x: c. z$ \! r; R  G: r4 a
  9805.             "BYBLOCK"5 p/ a+ K; y. @( T) `3 C, k1 z
  9806.           )
    & h+ x" Y$ x1 @. l
  9807.           (T  (set_tile "t_ltype" ltname) ltname)
    # f/ A! I3 e6 P0 s# g, ?
  9808.         )( O! ]2 u: C/ F8 E& Q
  9809.         eltype$ `! E+ Z9 {! q; x
  9810.       )
    4 v, u6 D8 f. j: ?2 N% ~+ u/ D% v
  9811.      )" Z* o+ f, C4 |4 o1 X# z) c/ j
  9812.      eltype
    " E' x2 D- c% A4 e, s; Q
  9813.     )* s+ \# ~; B( r1 m( M
  9814.   )* U- a! v3 {! E* D7 ~
  9815.   ;;
    $ O# z  ~3 {( ?- U& X& b
  9816.   ;; Edit box entries end up here, k* b: [4 U+ ]% d3 r
  9817.   (defun ltedit_act (ltvalue)
    5 Z# K1 s7 u' _0 U
  9818.     (setq ltvalue (xstrcase ltvalue))& n. i4 f4 d6 k7 H0 Q! D8 O
  9819.     (if (or (= ltvalue "BYLAYER")
    ! _" `% D1 d" I- ]5 Z
  9820.             (= ltvalue "BY LAYER"))
    / T7 Z  [6 y7 J, F- U
  9821.       (setq ltvalue "BYLAYER")
      N# E  b8 z! Y
  9822.     )! w( O* k' [$ ^: a& z9 b
  9823.     (if (or (= ltvalue "BYBLOCK")5 g4 G' G2 `/ D* |3 ~
  9824.             (= ltvalue "BY BLOCK"))) C9 o; e1 j* \( a: `5 J4 D$ ~
  9825.       (setq ltvalue "BYBLOCK")
    - ?$ _" }0 ?6 q
  9826.     )& Z4 I+ Y" Q7 q) k) [2 u/ \
  9827.     (if (setq lt-idx (getindex ltvalue ltnmlst))
    ( P7 K. O* p7 U' y& b
  9828.       (progn! \; w. Q# ~" Z. q' w
  9829.         (set_tile "error" "")
    1 m3 H: A  k) _5 k1 a2 G
  9830.         (ltlist_act (itoa lt-idx))% z' u/ S& N2 I+ Y/ A6 x
  9831.       )
    7 z! K4 f+ h2 E; _6 t
  9832.       (progn
    0 h9 C; `4 H; s
  9833.         (set_tile "error" "Invalid linetype.")
    9 ]# ~8 r6 m* p3 T" I! A# ?
  9834.         (setq lt-idx old-idx)9 b( d0 O$ Z4 X9 b: |+ G
  9835. ;;        (mode_tile "edit_lt" 2)3 [7 |, ~& D; E4 {
  9836. ;;        (mode_tile "edit_lt" 3)' D$ P& ~+ {6 [' u
  9837.       )
    6 s6 ^( g( N/ o6 u# U, s+ ?
  9838.     )
    . R$ O8 x  r( X
  9839.   )
    1 K8 Y; |& e9 `- |7 \. f7 d
  9840.   ;;# {7 q7 A- t7 |4 R# U/ b0 b
  9841.   ;; List selections end up here.  Update the list box, edit box, and color
    , x, m' g7 P( l6 }4 j
  9842.   ;; tile.
    * Q) y. [; }8 a8 v
  9843.   ;;0 \% J2 M  W# `! U; k" G
  9844.   (defun ltlist_act (index / dashdata)( L3 y' M0 I: s/ r& k. b
  9845.     (set_tile "error" "")
    0 B$ a! S; V' i% S! A/ J, N
  9846.     (setq lt-idx (atoi index))3 v8 W" J$ s/ w3 l- q
  9847.     (setq ltname (nth lt-idx ltnmlst))$ e5 P" @" T9 d6 @9 H" A' D
  9848.     (setq dashdata (nth lt-idx mdashlist))4 |2 U$ H3 u$ r+ l0 i6 ~
  9849.     (col_tile "show_image" 0 dashdata)% U1 o% x9 |, n9 `/ J( y
  9850.     (set_tile "list_lt" (itoa lt-idx))8 U' _( C% a! q( w, N" j/ H
  9851.     (set_tile "edit_lt" ltname)
    0 q. S9 Y) {% P
  9852.   )9 E2 N% u9 p  \+ P; h* m  ?
  9853.   ;;
    - S8 ]3 N* @  D5 K. M
  9854.   ;; Reset to original linetype when cancel it selected
    : e1 ~$ ^3 ~7 F8 K0 _7 L& a
  9855.   ;;. g8 {, a# U, ^4 }
  9856.   (defun reset_lt ()/ i' I9 R5 n5 B
  9857.     (setq lt-idx old-idx)
    $ [1 h& T5 X# v& v* ?4 ?
  9858.     (done_dialog 0)  V9 l3 `* `% k/ l/ o% @$ ^; y
  9859.   )
    / T% w; p$ l2 u- w4 w
  9860.   ;;
    # J* h' l) B, C
  9861.   ;; This function pops a dialogue box consisting of a list box,image tile, and
    # q, l9 Q3 s# A9 \0 k. C
  9862.   ;; edit box to allow the user to select or type a layer name.  It returns the
    0 L$ t2 t3 n/ q1 r; ]- ]
  9863.   ;; layer name selected.  It also has a button to find the status (On, Off,
    . a4 u: }6 s9 \
  9864.   ;; Frozen, etc.) of any layer selected.6 v% m: R$ |/ Q5 _* S+ d, o
  9865.   ;;
    " j2 ]9 A) M. R4 w, j
  9866.   (defun getlayer (/ old-idx layname on off frozth linetype)
    # v! l. G# L9 Q$ l1 @
  9867.     ;; Create layer list the first time the layer2 H" O- ^+ s7 y0 s" ?4 `+ R
  9868.     ;; dialogue is called.
    7 q, }0 R7 S# a& [
  9869.     (if (not lay-idx)
    8 Y: q& s  a* I8 Y9 e
  9870.       (progn
    5 ~6 v+ Y# ~# J' A* R
  9871.         (make_lay_lists)
    % L) Z9 L' G+ b3 S9 R; ^
  9872.         (setq lay-idx (getindex elayer laynmlst))- Q9 Q5 f5 z, f( U1 V
  9873.       )
    $ E% L% @5 ~2 Y. Q, S' p" P- A' z) U
  9874.     )" T3 f. G% e1 P- C( s  r+ m
  9875. 4 o+ |& h% x) d; F, w- N
  9876.     (if (= (get_tile "error") "")
    3 S1 g* _8 @: n* g# s3 O
  9877.      (progn
    ' \4 _: P8 o: [' O. x
  9878.       (if (not (new_dialog "setlayer" dcl_id)) (exit))
    4 `9 p: C$ h  A
  9879.       (set_tile "cur_layer" (getvar "clayer"))
    5 w0 m7 e: I- v4 F) m6 b3 J2 j
  9880.       (start_list "list_lay")6 Q, F, H! ]  |0 S8 y( d2 I
  9881.       (mapcar 'add_list laynmlst)  ; initialize list box& V' R4 f( i; i, p
  9882.       (end_list)6 a6 u4 T1 g* Q7 N- x
  9883.       (setq old-idx lay-idx)
    ' G& N! b0 ]5 R7 D8 |) K
  9884.       (laylist_act (itoa lay-idx))
    / ~5 G% D1 x& h0 Y, t  G2 }1 K) L
  9885.       (action_tile "list_lay" "(laylist_act $value)")
    0 t: H4 ^7 A8 |" r$ j& a- m
  9886.       (action_tile "edit_lay" "(layedit_act $value)")
    5 I% @6 f0 q, U4 R7 r8 Z8 A
  9887.       (action_tile "accept" "(test_ok)")2 _* z5 g. @6 ^, Q) }& }; x4 e
  9888.       (action_tile "cancel" "(reset_lay)")
    # K7 R* f; X- o" f% w" K3 g! ~
  9889.       (if (= (start_dialog) 1) ; User pressed OK- j" \" k3 r7 g+ v
  9890.         (progn" g$ h, f/ o( P2 n" j; b
  9891.           (set_tile "t_layer" layname), A$ b1 \2 G* n6 b! F
  9892.           (setq elayer layname)
    # m' @& D! b: F, T
  9893.           ;; If layer equals bylayer reset color tile3 N& e4 b0 _1 U) e4 q
  9894.           (if (= ecolor 256)
    , K6 d8 N: }8 l  s( ~% R
  9895.             (col_tile "show_image" (bylayer_col) nil)/ i$ i$ u1 c2 X1 M+ u2 Y
  9896.           )
    ) w* R" l9 S+ t: {6 q; ?' G9 a' A
  9897.           layname
    5 U6 D& L2 |$ C6 |9 p
  9898.         )6 B) {  e, w# p" d' K' x0 G
  9899.         elayer
    & `- Y) E, D. x2 `
  9900.       )6 `, a/ m! J; E$ O% x; {
  9901.      )* |' ?" T* F; ?2 f1 }
  9902.      elayer/ a" t" u( z) y1 W& M
  9903.     )- U4 m8 `0 t. S' j; U7 f
  9904.   )
    ) X# P, Z4 n6 f6 b6 @
  9905.   ;;
    + W! e  \8 [( X" M4 W5 }$ y( ]
  9906.   ;; Edit box selections end up here.  Convert layer entry to upper case.  If. v0 T0 F" r# b$ A, V" f
  9907.   ;; layer name is valid, clear error string, call (laylist_act) function./ l' F9 p( ~) h6 C0 }* o6 W5 x0 X
  9908.   ;; Else print error message.
    . g# ^! k* y: m* R  j3 Z) x" T- B
  9909.   ;;# [5 a3 ?' D( v+ {  p
  9910.   (defun layedit_act (layvalue)) Z* K5 P+ i% N3 y  N) ~& l
  9911.     (setq layvalue (xstrcase layvalue))( r: H% k. I  Q. }! M" y
  9912.     (if (setq lay-idx (getindex layvalue laynmlst))
    $ b3 P7 F* N. A3 M  e
  9913.       (progn8 W0 K4 q2 ]5 e, O1 c$ n
  9914.         (set_tile "error" "")6 i" I" c2 @2 E/ ]
  9915.         (laylist_act (itoa lay-idx))
    9 ]1 |4 V  ~9 ~$ f9 _0 G
  9916.       )
    ! y; e0 R$ h" L6 s$ i- w! r
  9917.       (progn0 w3 @0 e; i0 u9 \3 ^( h$ Z/ o
  9918.         (set_tile "error" "Invalid layer name.")
    * k0 D8 t. c# Y, B$ D0 s5 {0 W2 h
  9919. ;;        (mode_tile "edit_lay" 2)# y3 v3 t& J3 {: r8 u8 I; R& u9 }
  9920. ;;        (mode_tile "edit_lay" 3)4 X5 D/ u7 z1 S3 Z% I+ a$ `
  9921.         (setq lay-idx old-idx)/ _8 [- y% [- K
  9922.       )2 W: T4 A6 \' A2 h0 S+ L
  9923.     ): A% B+ o; c  P9 b) O2 o2 E- E
  9924.   )
    0 Y4 o3 w  g5 v
  9925.   ;;
    . b# O6 b+ \/ E3 _9 p  A5 d
  9926.   ;; List entry selections end up here.
    % |! A7 d- w" n" f6 T
  9927.   ;;
    % X; p1 ]  }5 g( q0 j
  9928.   (defun laylist_act (index / layinfo color dashdata)
    " f8 e0 S6 c$ v# T# |3 o2 o
  9929.     ;; Update the list box, edit box, and color tile.4 H5 ~, z& [& c
  9930.     (set_tile "error" "")
    7 Y  T( N* R4 e# ~! W7 ?* }
  9931.     (setq lay-idx (atoi index))$ o/ [- U" M4 x" F  d; l
  9932.     (setq layname (nth lay-idx laynmlst))" ^2 x1 E4 S2 m) P/ T# g7 a6 _
  9933.     (setq layinfo (tblsearch "layer" layname)): T0 A/ g6 ?! Z& a% x  y) W
  9934.     (setq color (cdr (assoc 62 layinfo)))4 w4 ~' F6 J( O1 w; f- U, N$ B: s
  9935.     (setq color (abs color))! p4 P/ q6 s( a
  9936.     (setq colname (colorname color)): ]  r) e. m: z5 p
  9937.     (set_tile "list_lay" (itoa lay-idx))
    & Q) H; A1 X, i( c$ L8 c
  9938.     (set_tile "edit_lay" layname)
    ) h: z+ ]% I' F
  9939.   )! q# a  v0 q) ], k& l$ n# z
  9940.   ;;; q3 V5 ]; e3 j4 J( A; b8 O
  9941.   ;; Reset to original layer when cancel is selected.
    8 p9 x# C) x1 m  s
  9942.   ;;5 ]% y6 h! }4 P6 z) P" T
  9943.   (defun reset_lay ()
    ! v% B1 }3 J0 s8 y5 U
  9944.     (setq lay-idx old-idx)
    9 D/ B( y8 q" D1 L2 n0 _
  9945.     (done_dialog 0)4 ^4 O0 C3 g+ X2 o
  9946.   )
    $ F8 {* q- X7 Z* J
  9947.   ;;& o/ ?+ @4 h) j. G9 i
  9948.   ;; Checks validity of thickness from edit box.2 u" I* l8 x% z, a
  9949.   (defun getthickness (value)5 v0 q- P0 Z$ s5 o
  9950.     (setq ethickness (verify_d "eb_thickness" value ethickness))
    ! V# g- k& M! \# c# t
  9951.   )
    6 h3 ?9 A$ W6 S# Q  y" h6 l  l: L
  9952.   ;;- Y) `- p" l" \' e1 F  W0 W6 k, d
  9953.   ;; Copy of (getthickness) for ltscale.  If more, make this function. T# _- @5 L2 b$ }
  9954.   ;; generic.9 _2 X& r- n# C) E; O( s
  9955.   (defun getltscale (value)  Q- b4 e4 p. \9 c2 S  f! w0 @
  9956.     (setq eltscale (verify_d "eb_ltscale" value eltscale))
    " p8 [) O8 F/ W6 \# x( Y9 m4 y
  9957.   )
    ) q. d. K# ~( y; S+ c7 f
  9958.   ;;* N7 q0 z( i5 p3 S! f
  9959.   ;; This function makes a list called laynmlst which consists of all the layer
    , p' f7 e% W2 {# U( L
  9960.   ;; names in the drawing.  It also creates a list called longlist which: U- ^/ r8 q% g1 b7 _7 Y
  9961.   ;; consists of strings which contain the layer name, color, linetype, etc.1 i7 a9 r  S* i% k' d& k
  9962.   ;; Longlist is later mapped into the layer listbox.  Both are ordered the
    6 @: ]5 f6 \' E, g. H8 V* u5 \
  9963.   ;; same.
    9 V% V3 x) ?6 G. n
  9964.   ;;
    + P. @) S" R( r, K" I, a6 \
  9965.   (defun make_lay_lists (/ layname sortlist name templist layer_number)* W) [2 c8 d. g1 }
  9966.     (setq sortlist nil)
    2 q2 ]( R/ r  p4 I
  9967.     (setq templist (tblnext "LAYER" T))# b2 ~  a7 y3 J8 z, Z
  9968.     (setq layer_number 1). B3 j7 P  h) o& h' B
  9969.     (while templist8 Z% n! @* V: {1 p# |; S! C8 N' D9 {
  9970.       ;; No xref dependent layers, please.% m# a! L6 f- @' n) Z0 J- d
  9971.           (if (/= (logand 16 (cdr (assoc 70 templist))) 16)) v- E( {" {  X) U8 i) m7 b8 h
  9972.             (progn
    & W- Z1 V# T8 |& b, A  e; @
  9973.               (setq name (cdr (assoc 2 templist)))
    0 I1 h0 a- y( O2 E% K0 }5 n
  9974.           (setq sortlist (cons name sortlist))+ A) Y' I" S3 z( X
  9975.         )  s' |+ S! Z" F( B7 T8 {& Z
  9976.           )
    ) j; B& @+ ^" n- |+ n
  9977.           ; Get the next layer.
    % U) L6 [' f1 h( v$ J4 V! L( B
  9978.       (setq templist (tblnext "LAYER"))8 k1 l9 d0 k* s. A6 f" d
  9979.       ;; Not dead message...0 Q" b2 o5 i- N( ]
  9980.       (if (= (/ layer_number 50.0) (fix (/ layer_number 50.0)))1 |& U6 `! g$ Z/ d# P
  9981.         (set_tile "error" (strcat "Collecting..." (itoa layer_number)))3 o5 m7 D! E9 F2 ~$ E
  9982.       )( F7 N- p% E  X6 [& h
  9983.       (setq layer_number (1+ layer_number))
      X9 W8 l$ k0 Q9 h% ~& z6 g0 x
  9984.     )
    4 _9 W. @% G+ Q) d8 j
  9985.     (set_tile "error" "")+ L* |; y1 a, A3 v
  9986.     (if (>= (getvar "maxsort") (length sortlist))
    # q5 O9 v( W  H7 d: s! m) u3 a) Y
  9987.       (progn* O# U% ?  I3 a0 K0 I5 E- ]- ^
  9988.         (if (> layer_number 50)
    % A& E) M( S  f) v( e* M" P
  9989.           (set_tile "error" "Sorting...")% g" @7 ~1 s: t9 v: g% F, ~3 D
  9990.         )6 @; }; r+ v" T* \. S3 P+ h  p" t
  9991.         (setq sortlist (acad_strlsort sortlist))  X% B* @& q* t
  9992.       )4 g$ |6 O, P" z
  9993.       (setq sortlist (reverse sortlist))
    0 M/ d( M, ~7 C' r# G& W, b& v2 `
  9994.     )
    7 |$ z" H5 q) }! B, i8 z% Q
  9995.     (set_tile "error" "")
    * L7 o" V7 u, u+ `0 b0 G# |. L
  9996.     (setq laynmlst sortlist)
      b7 P- P" i0 |  u3 {- ], x
  9997.   )+ ?+ W! ?7 g3 f$ W2 s! \) h
  9998.   ;;+ z1 v. j3 Q( b& Z; p- o
  9999.   ;; This function makes 2 list - ltnmlst & mdashlist.
    ) T8 e) t0 X. ]9 r
  10000.   ;; Ltnmlst is a list of linetype names read from the symbol table.  Mdashlist% ]) P1 q, }% L* Y# }
  10001.   ;; is list consisting of lists which define the linetype pattern - numbers, o- E$ n( |4 J' r* z
  10002.   ;; that indicate dots, dashes, and spaces taken from group code 49.  The list
      g# b8 H$ ^! e$ h6 s, i  a
  10003.   ;; corresponds to the order of names in ltnmlst.: X# s) j$ b6 r$ W! r- S! P
  10004.   ;;
    + S2 c, G; P; }9 R4 V4 ?0 w
  10005.   (defun make_lt_lists (/ ltlist ltname)' t) ?  Y3 o) r! i; D% `0 |
  10006.     (setq mdashlist nil)2 u) u: ~. X* ], J% B- A% e
  10007.         (setq sortlist nil)
    . m6 ~  T: ]! I7 |% n
  10008.         (setq ltype_number 1)
    + k' N) p  q% l6 {" q( r2 l
  10009.     (setq ltlist (tblnext "LTYPE" T))
    / N2 a) F, T# a& I: n8 h
  10010.     ;;(setq ltname (cdr (assoc 2 ltlist)))
    - i, I* g( e  C( F
  10011.     ;;(setq ltnmlst (list ltname))  `6 N% q5 k0 k% f* e' H
  10012.     (while ltlist: z5 U* A& G* m, [; V* a6 R) j
  10013.           ;; No xref dependent linetypes, please.
    5 \  ]+ L7 |! R; r! {% W( M8 [2 o
  10014.           (if (/= (logand 16 (cdr (assoc 70 ltlist))) 16)
    ! @: M* K7 H, z$ n5 w
  10015.             (progn. B5 C8 ?( y* r+ c4 R& R& O  _
  10016.           (setq ltname (cdr (assoc 2 ltlist)))
    ; {8 J- V8 y% E! Z- Z  H, F8 z
  10017.           (setq sortlist (cons ltname sortlist))
    # p7 z/ P' K1 z  E/ B
  10018.             )
    3 A, ]# X) V3 N/ a
  10019.           )
    + h! z5 i1 o+ m  r6 E# L" @: i
  10020.           ;; Get the next linetype.
    % x1 W! u. q6 p' t
  10021.           (setq ltlist (tblnext "LTYPE"))$ y. x( e( _( L! _! f+ x* ^

  10022. % ?& i1 X2 d& T( T
  10023.           ;; Not dead message...9 L2 J8 Q* S( Q8 E6 [: w
  10024.       (if (= (/ ltype_number 50.0) (fix (/ ltype_number 50.0)))) p9 v3 B, L: Z$ v6 ^
  10025.         (set_tile "error" (strcat "Collecting..." (itoa ltype_number)))2 J7 _) [1 t) I# X; X
  10026.       )
    - @1 b; d1 G, o" p+ g8 D
  10027.       (setq ltype_number (1+ ltype_number))
    ! N& c3 Q0 B; @; L& H2 t1 b
  10028. 4 f7 ~' |! b% a+ W- X
  10029.     )
    * n6 H7 h: |# o2 L3 _

  10030. " }3 k' L1 i& E  {
  10031.         ;; Remove Collecting message.
      k5 E7 Z0 D  P
  10032.         (set_tile "error" "")
    5 r7 E, m+ \* O% {, F
  10033. 4 Y7 T7 ]& @2 P* Z
  10034.     ;; Sort based on maxsort.; w8 p; f) J8 D4 A
  10035.         (if (>= (getvar "maxsort") (length sortlist)): h$ O( J8 A9 e3 p2 H% j
  10036.       (progn8 i2 d2 `; {5 z7 Z/ s
  10037.         (if (> ltype_number 50)
    2 B+ L9 o: K5 h$ \. y% o
  10038.           (set_tile "error" "Sorting...")
    8 i# @+ \7 e/ [8 |, r
  10039.         )
    ) ?. F- C- Z4 j/ C
  10040.         (setq sortlist (acad_strlsort sortlist))- @% S: k9 [% m/ r" m! \
  10041.       )2 T1 M# n0 p4 `$ Q) P$ k% k
  10042.       (setq sortlist (reverse sortlist))* h" n, x- C  i) J2 t# |
  10043.     )
    6 T& X' S$ h6 y$ X: x
  10044.     (set_tile "error" "")& @" T, T. v) e4 e2 n5 ?) c
  10045.     (setq ltnmlst sortlist)
    . K5 L- R% d- {5 g

  10046. ; G$ y9 p4 h: p3 W# F/ Q. z
  10047.     (foreach ltname ltnmlst2 U# Z  |6 F2 s( @, d  {
  10048.       (setq ltlist (tblsearch "LTYPE" ltname))
    5 U! R3 E! i) ~; w4 y! b6 [6 y2 b' W
  10049.       (if (= ltname "CONTINUOUS")
    ; A+ G/ f& r$ ~, s8 ^
  10050.         (setq mdashlist (append mdashlist (list "CONT")))
    + [, v- L4 @2 B. |, g
  10051.         (setq mdashlist& d' a- p. `% m1 {/ q6 n9 }3 `
  10052.             (append mdashlist (list (add_mdash ltlist)))
    , s5 b4 r& H5 t6 U8 |
  10053.         )
    ( W! n% s# Y3 \0 g
  10054.       )! y& I& |% k6 Z
  10055.     )  e9 L( g. x6 n  y- C  V3 E/ b
  10056.     (setq ltnmlst (cons "BYBLOCK" ltnmlst))/ A5 s$ p$ o1 o, q+ K7 z
  10057.     (setq mdashlist  (cons nil mdashlist))) @! z9 N- g0 |2 @# |- h! \& o
  10058.     (setq ltnmlst (cons "BYLAYER" ltnmlst))
    8 V$ O4 m- J  D: ~
  10059.     (setq mdashlist  (cons nil mdashlist))7 E. C  G9 ]# A( b& \6 ~
  10060.   )
    % x1 I+ l/ k' I3 I! c
  10061.   ;;# h9 L$ V$ r! h5 e& W
  10062.   ;; Get all the group code 49 values for a linetype and put them in a list
    - F- y5 e0 x, ^* o' [% `8 s
  10063.   ;; (pen-up, pen-down info)., J7 \7 \% m7 O2 P7 E% x+ I. C
  10064.   ;;7 F! K/ z7 I# h2 D, m
  10065.   (defun add_mdash (ltlist1 / dashlist assoclist dashsize)) d5 @) a7 J. _% h  ~0 _
  10066.     (setq dashlist nil), B4 e5 H! Q0 \1 A2 z# V8 A
  10067.     (while (setq assoclist (car ltlist1))
    # ]8 b/ g+ S. ~2 b  s
  10068.       (if (= (car assoclist) 49)
    - a% ^/ k' c& j# W- T
  10069.         (progn
    9 v/ i( _: i: k3 }' J7 r
  10070.           (setq dashsize (cdr assoclist))
    5 O1 i- c% S; Z
  10071.           (setq dashlist (cons dashsize dashlist))
    3 I% q4 R: s# d4 X& @" r
  10072.         )
    2 D; ?. {  E& x3 A, a
  10073.       )
    4 [, F" D% m9 l! F* F- ~
  10074.       (setq ltlist1 (cdr ltlist1)): G2 _9 F* j3 S8 x2 f- x: B/ `
  10075.     )& _9 U& d1 D1 X( n# X7 ?% L' y
  10076.     (setq dashlist (reverse dashlist))
      X0 @( x: X; }; ]  P) ~8 R% Z: |
  10077.   )4 l$ N1 M' p/ V, E0 w5 F
  10078.   ;;, W. |; p8 i' r$ J# u
  10079.   ;; Color a tile, draw linetype, and draw a border around it
    . W1 {. _; g: |/ |1 F4 @$ T) K
  10080.   ;;
    + m" I0 o% f/ ~" f9 K# h
  10081.   (defun col_tile (tile color patlist / x y)( i" Z$ r( J# H% w  c, g4 W
  10082.     (setq x (dimx_tile tile))- {2 m+ ~+ }6 s: `; C( b
  10083.     (setq y (dimy_tile tile))
    7 Q' z" N5 a1 U9 U
  10084.     (start_image tile)9 R- A/ o, t9 h  H- k3 ?3 t. i
  10085.     (fill_image 0 0 x y color)
    ) T6 A3 h+ M$ J* G2 X7 x3 x
  10086.     (if (= color 7)0 ?! {& I# ^* e/ f# w
  10087.       (progn
    3 a2 s  ?1 d% T) H& d
  10088.         (if patlist (drawpattern x (/ y 2) patlist 0))/ f( W; r( J+ x
  10089.         (tile_rect 0 0 x y 0)
    " }! E1 w( Q& j
  10090.       )
    ( W/ W3 o, r" v7 F" w5 q0 v
  10091.       (progn( o& \4 P& ^+ h
  10092.         (if patlist (drawpattern x (/ y 2) patlist 7))3 p7 c1 o- g. T& |( P, V
  10093.         (tile_rect 0 0 x y 7)) l2 m4 X( Q+ T0 J; I  l0 @5 l! V
  10094.       )0 Z1 `' q+ s; d! A" L" p
  10095.     )# R1 ?/ e7 f3 W+ d
  10096.     (end_image)
    : R5 E- `7 G: |$ A1 S  }
  10097.   ); y; \/ B& Y  ?5 T# G+ A: d
  10098.   ;;& k8 F. p* V/ i4 [% u' d: `
  10099.   ;; Draw a border around a tile: y0 V" T% Z8 s! V
  10100.   ;;2 [6 R* r& z0 n3 S1 U: B; H
  10101.   (defun tile_rect (x1 y1 x2 y2 color)0 O* j8 A5 ?4 t  F" |1 h
  10102.     (setq x2 (- x2 1))
    2 L4 Q" V# J* j' t0 g4 ~' k* x
  10103.     (setq y2 (- y2 1))
    * n6 C& N! X% w
  10104.     (vector_image x1 y1 x2 y1 color)3 B! k: g$ E6 |  P
  10105.     (vector_image x2 y1 x2 y2 color)) O4 A  ]1 O' O3 i( {( b, Q) n- g
  10106.     (vector_image x2 y2 x1 y2 color)
    ( B3 {8 F- F, m# I' ]7 [
  10107.     (vector_image x1 y2 x1 y1 color)
    $ V: G0 G; {* K7 H/ i
  10108.   )7 n& c2 E0 `0 @1 h1 [! z" k
  10109.   ;;+ D8 o1 h1 A. C* i  d2 h5 T1 ^& o
  10110.   ;; Draw the linetype pattern in a tile.  Boxlength is the length of the image
    / M- ]% c" a6 p: d3 h! {
  10111.   ;; tile, y2 is the midpoint of the height of the image tile, pattern is a
    4 ^: S8 G; C+ j8 |
  10112.   ;; list of numbers that define the linetype, and color is the color of the
    $ Y- X3 n9 m( t: o, p1 u, d6 t$ n
  10113.   ;; tile.& h8 Q; S( F! W1 K
  10114.   ;;% V" x+ D# p! T
  10115.   (defun drawpattern (boxlength y2 pattern color / x1 x2* [# V$ i& \- [- [2 G
  10116.                       patlist dash)! L! k( }. N  g5 m$ O" V7 q
  10117.     (setq x1 0 x2 0)
    7 F: D. r9 P$ u, Y* f+ Z& M
  10118.     (setq patlist pattern)# |3 W3 g' `4 }
  10119.     (setq fx 30)
    ( {8 X" S& y) _! f5 x" ^- q" b: v
  10120.     (if (= patlist "CONT")
    2 s4 K- g# d: b$ a! e0 G$ Z; B
  10121.       (progn (setq dash boxlength)
    , w+ g$ f% S* [3 C* \5 D
  10122.         (vi)
    % k  X0 U1 p' j/ A6 R; U$ _* O
  10123.         (setq x1 boxlength)  o6 _7 z0 B/ U$ ~/ G6 V
  10124.       ): x# d3 ?9 w! w- ?8 i
  10125.       (foreach dash patlist, h; ]* A+ I2 [% K
  10126.         (if (> (abs dash) 2.5)% c6 `( H9 {- F/ r/ c4 o
  10127.           (setq fx 2)
    ' |" R: u% q$ {/ Y- ^# `6 G  o$ E
  10128.         )! o$ \2 x& u- p
  10129.       )6 q. L- b4 q6 V4 Q6 @' B  G. i; J2 ~
  10130.     )
    ; N6 r0 _% _" j/ V
  10131.     (while (< x1 boxlength)
    ! n4 r0 q9 t& A1 }  g4 x
  10132.       (if (setq dash (car patlist))
    $ W4 E3 R4 l, i( [
  10133.         (progn
    2 f& a+ l" g2 p8 t# a) l% R. v, Z; x
  10134.           (setq dash (fix (* fx dash)))
    * s- R4 v9 U6 [1 K  }: {6 e; a
  10135.           (cond
    & y% e6 }& m) ^0 S8 M
  10136.             ((= dash 0) (setq dash 1) (vi))1 A0 [; r& ~5 }% r/ Q" V
  10137.             ((> dash 0) (vi))+ X* w* H* F  }0 I) U0 {, Q$ g
  10138.             (T
    5 z& ~8 @0 K9 l+ e9 }
  10139.               (if (< (abs dash) 2)& e+ t2 x5 I- ~2 N
  10140.                (setq dash 2)6 L& n' b* c/ G/ U! i! l* K  }
  10141.               )
    / S7 h- [* b6 {2 B) Z/ z
  10142.               (setq x2 (+ x2 (abs dash)))/ t4 p) ^8 r7 n( i- g
  10143.             )
    6 H2 j9 H: x1 H( L
  10144.           )& u4 C3 p8 K2 H: |4 N6 X! r, G# V
  10145.           (setq patlist (cdr patlist))
    2 ^: m! s! t  N% R0 h7 C
  10146.           (setq x1 x2)
    5 {. S, p8 Q* v: Y& \2 s9 X& s4 e
  10147.         )2 l2 ~1 n$ h& n
  10148.         (setq patlist pattern)& `- @' c2 K" H. @/ T0 [% s
  10149.       )1 q6 J4 n9 ?/ Q/ z/ e9 E
  10150.     )
    6 i8 W4 I4 g4 D, ~
  10151.   )% l* e* u3 D7 m1 E+ m
  10152.   ;;
    + F8 D2 }9 M" L+ _
  10153.   ;; Determain state of xclip# R6 Z9 E& F" b; W( ~9 U2 U! h
  10154.   ;; Returns the group 71 value of the spacial filter dictionary.
    ! J2 C+ w' z$ o! \
  10155.   ;; If the entity doesn't have a spacial filter dictionary, this6 G6 T% k- v: J! w
  10156.   ;; returns 0. If it does it will return 0 or 1 depending on the
    + j* u0 g4 p1 p0 |
  10157.   ;; current setting of the state of the clipping visibility.
    ' o) S: b1 ]+ o9 D0 ^5 h- H4 Q& k
  10158.   ;;5 X2 N9 A, o8 Z% p% j7 }
  10159.   (defun xclipon(elist). j1 p6 n9 f. i( @8 R
  10160.     (setq hasclip T)4 D9 c, ^3 N* L' V& y! j  W% x
  10161.     (if (/= (assoc 360 elist) nil)
    / g2 T8 J% T$ t% ~
  10162.       (progn* J8 U; \2 |( L
  10163.         (setq tmp (entget(cdr(assoc 360 elist))))% b9 X: x: t; M: ]/ t1 O
  10164.         (if (/= nil (assoc 360 tmp))
    , {" S4 `' ^- l: ?7 t
  10165.           (progn6 c! _1 J  R! q, e! b, ]' ]& T
  10166.             (setq tmp (entget(cdr(assoc 360 tmp))))
    . w4 g' |( p6 c" O1 z( O- c( y& r
  10167.             (if (/= nil (assoc 360 tmp))
    1 R; D$ ]- h  k
  10168.               (progn
    ! `( C4 ^! H" |4 m# o
  10169.                 (setq tmp (entget(cdr(assoc 360 tmp))))
    $ k7 y- m9 K* u' z) P! w
  10170.                 (if (/= nil (assoc 71 tmp))* x0 ~; ~; H. X* G! x/ G
  10171.                   (cdr(assoc 71 tmp)). S7 @* e) J! x" z& O
  10172.                                   (progn
    : d. D0 o: ~& k" ~7 D/ b
  10173.                                         (setq hasclip nil)
    7 K- m2 ~+ {/ L
  10174.                                         (eval 0)
    5 E3 D; l& D$ D8 ^4 c1 }
  10175.                                   )
    0 y2 J8 C+ A3 V) Z0 Z$ I
  10176.                 )8 ]1 [9 p1 P+ I5 L6 T/ N, F& [
  10177.               )" Y; }( q' `/ w$ k# ?8 e1 U
  10178.                           (progn
    5 y, T7 j$ a" C  |3 `. C9 T/ i& L
  10179.                                 (setq hasclip nil)/ T8 J7 ]5 \$ N/ G" B$ [" L
  10180.                                 (eval 0)
    ; [! [/ w8 A* [: Y( Z
  10181.                           )
    4 `$ W# @* r+ t
  10182.             )
    * g+ r/ y' D' Y. A  M
  10183.           ): m: K) E0 z/ I6 F+ t) ?
  10184.                   (progn
    ; c" e9 c: {. Y2 F- p& u; O
  10185.                         (setq hasclip nil)
    1 U8 ^/ w9 P8 {2 c" P$ e( _
  10186.                         (eval 0)! L4 i; i1 p/ }& B8 V
  10187.                   )
    & }' E. i% _8 y( h5 ~" J
  10188.         )
    0 V( v. q: `! B+ M
  10189.       )! A! q" y+ f, O1 h" j( _' r3 Q
  10190.           (progn 0 v& q" X0 K' n! l/ u  o
  10191.                 (setq hasclip nil)
    % V& s: B6 d- M4 T
  10192.                 (eval 0)
    6 Z$ V( Y- W' t$ l6 \
  10193.           )& }- U: ]* }8 M$ w' r
  10194.     )
    5 z  L8 O$ L4 r
  10195.   )9 u! J: ?1 W: v, l
  10196.   ;;$ p/ V, V, R/ m% V5 \9 S2 q
  10197.   ;; Draw a dash or dot in image tile! Z/ }/ `& ^. t1 L
  10198.   ;;3 n- C; O4 @. N
  10199.   (defun vi ()
    4 R7 y4 w- f. o& S9 c, k4 ]& p
  10200.     (setq x2 (+ x2 dash))
    & I% q# k( S2 q" b5 T
  10201.     (vector_image x1 y2 x2 y2 color)5 H; v( h3 U7 _+ v* m4 L
  10202.   )
    , o0 r/ I2 h4 a# K2 o& |" N
  10203.   ;;7 }+ a8 I* k8 f6 _
  10204.   ;; If an item is a member of the list, then return its index number, else% Y/ B  G3 K9 C
  10205.   ;; return nil.9 n8 n" W* i1 R# r
  10206.   ;;
    3 a2 Z- v+ H& D8 ~
  10207.   (defun getindex (item itemlist / m n)
    - v4 p+ D. ~7 _; L: A( {6 R' Q
  10208.     (setq n (length itemlist))
      l" I' q- O, g( [! T
  10209.     (if (> (setq m (length (member item itemlist))) 0)
    5 T) z3 t  q9 r: M+ B
  10210.       (- n m)
    / S  C; [( Z( K! b
  10211.       nil
    * f' ^& H+ n+ q+ n1 s+ k( t
  10212.     )5 v6 ]* f0 P7 f' k5 A, u  e
  10213.   )
    6 t* \, W4 l) M, u
  10214.   ;;
    9 Y) G; I1 k& l8 X2 m- k' s0 A9 Z
  10215.   ;; This function is called if the linetype is set "BYLAYER". It finds the
      G0 o6 R- @! Z; F  j0 P& B
  10216.   ;; ltype of the layer so it can be displayed  beside the linetype button.& L8 `2 s  g& N, a- D$ Z* d1 u- K
  10217.   ;;: v' Z* V% \, D2 S7 R
  10218.   (defun bylayer_lt (/ layname layinfo ltype)+ B/ U7 G% |: [2 t
  10219.     (if lay-idx
    : r6 l6 q, O! q
  10220.       (progn
    7 I$ t& M1 ^. I% u* _
  10221.         (setq layname (nth lay-idx laynmlst))
    * r3 }- \+ o/ Q  P- G2 w
  10222.         (setq layinfo (tblsearch "layer" layname))
    6 L' _- ^: t) h) C: b
  10223.         (setq ltype (cdr (assoc 6 layinfo)))7 S! a# G4 L; A+ Q1 t- U& R
  10224.         "BYLAYER"* t1 Q9 C( q& k; Y- N
  10225.       )7 {9 _, P% b2 T- {. z2 _. X
  10226.       "BYLAYER"  A, U6 k$ U1 p/ ?
  10227.     )
    1 J9 r; f" V' |. K/ ~, n
  10228.   )
      M! h: ]- Q% C2 v& \
  10229.   ;;8 Z+ r" g: y' ^& p1 m3 H5 H/ o8 C" Y
  10230.   ;; This function is called if the color is set "BYLAYER".  It finds the color* L; ^+ y5 ?8 x5 n
  10231.   ;; of the layer so it can be displayed beside the color button.1 ^3 V/ [7 A/ N2 B/ ?) D
  10232.   ;;9 v. |& D5 r  ~3 {
  10233.   (defun bylayer_col (/ layname layinfo color)7 |1 H  t  A  H6 \  @2 ~
  10234.     (setq layinfo (tblsearch "layer" elayer))
    $ ~  K# ?3 K/ ]. g1 h" V, F0 ^
  10235.     (setq color (abs (cdr (assoc 62 layinfo))))
    6 }; F1 L- y' Q6 E( O
  10236.   )8 x4 G' i- O+ ^) Q/ J
  10237.   ;;
    * ~5 T+ w7 |9 g0 K2 [4 Q# n: ]0 u
  10238.   ;; Used to set the color name in layer subdialogue.
    7 K  a5 E* h6 r3 @; E/ F, \
  10239.   ;;( f' d% \# E) M* C
  10240.   (defun colorname (colnum / cn)
    : Y2 k& g$ L, p6 t7 m0 u  G
  10241.     (setq cn (abs colnum))9 y9 d) b6 K0 W
  10242.     (cond ((= cn 1) "red")' v! |6 l& s' s) E1 A1 n
  10243.           ((= cn 2) "yellow")
    ) |1 e* p  U6 ^( Y
  10244.           ((= cn 3) "green")
    6 p. z# U- l* X3 U8 y: {. C
  10245.           ((= cn 4) "cyan")
    ! O2 n: \; Z+ @) Q# x  b- Q% k# z, `
  10246.           ((= cn 5) "blue")
    8 M6 a2 ^/ q- T* ^7 Q$ [  M
  10247.           ((= cn 6) "magenta")
    9 J" V0 I- M, w" ^' S
  10248.           ((= cn 7) "white")
    # `7 }. g0 m4 X1 L
  10249.           (T (itoa cn))
    - Z+ p2 N3 h$ h* E4 u, U. G
  10250.     )
    ) e) u( H( J' J6 F
  10251.   )
    * i9 s, T2 ]0 n
  10252.   ;;2 U0 f' a8 v3 v% Y
  10253.   ;; If their is no error message, then close the dialogue.; K: L" j5 ?; H- o7 m8 `0 u0 L
  10254.   ;;
    ! }7 h$ F0 K3 t
  10255.   (defun dismiss_dialog (action)5 ]5 o* u$ |) z  w
  10256.     (if (= action 0)
    9 O/ r2 Z4 A; c2 L8 W1 M
  10257.       (done_dialog 0); f8 i3 d8 E, r& q, x0 H, t# [
  10258.       (if (= (get_tile "error") "")7 ?1 U2 ]& P4 g& r6 S
  10259.         (done_dialog action)$ @( E3 j% d! c! V* e
  10260.       )1 Z7 u. \- z! B4 Q
  10261.     )! R5 F  O. F7 Z2 H( r2 t$ O% e- C
  10262.   )" Q  |2 Q, u! g, H) ^
  10263. $ D% L# }; V* B. Z: h& L( A. w" T
  10264.   (defun test_ok ()
    - m1 L, Z9 f/ N+ l+ L! R: ]" i4 s
  10265.     (if (= (get_tile "error") "")% \/ f  Y% V+ Y' k( N! U6 M' o$ C
  10266.       (done_dialog 1)
    0 x+ P; I4 p8 T" @- w& w! n
  10267.     )
    " O6 A# v1 J, V8 A( M9 V1 Y; ~
  10268.   )3 S0 V: @( a; Y& k" i: E

  10269. 2 r8 d$ p9 r8 _* J
  10270.   (defun cancel ()$ _2 A" ^1 t* H% a* e$ }, z
  10271.     (done_dialog 0)
    - P! B, }5 ]* d5 L7 c: W( M) g
  10272.   )
    8 W# i: ~7 w: l9 I) z
  10273. 6 b7 p/ }. A) x! K$ O( [! D  R- ?2 p
  10274. ;;; =======================================================================
    & m# S) v  p  ~. N
  10275. ;;; SETUP layer and linetype lists for application, and initialize all
    % u$ N/ W% ]4 N  ~3 P
  10276. ;;; program variables.  c: Q5 n3 j' p0 O5 \7 R  [; V
  10277. ' X3 u9 [% x- Z) c6 T
  10278.   (setq elist       (entget ename)
    2 {6 }3 e% q: X
  10279.         old-elist   elist
    ' O5 m! I1 v  D0 w$ V/ i; @
  10280.         modlist     elist
    5 Y4 r! m6 I& l- r
  10281.         etype       (strcase (cdr (assoc 0 elist)))
    9 g6 p6 A0 l: K: j% b1 P
  10282.         ecolor      (cdr (assoc 62 elist))
    ! L- s3 Q! e: D5 r) \
  10283.         elayer      (cdr (assoc 8 elist))3 a2 B7 _! i6 \0 \+ G; }
  10284.         eltscale    (cdr (assoc 48 elist))
    + `9 q) M4 A. p
  10285.         ethickness  (cdr (assoc 39 elist))
    ) p3 `& r; r( K6 W5 a
  10286.         eltype      (cdr (assoc 6 elist))$ Q& n, I6 ^+ P7 z/ }  [
  10287.   )
      D0 t6 a+ r& N% N  m/ d  R6 M
  10288.   (if (= (assoc 210 elist) nil)9 F) ~: T4 Y, a( x. d. r
  10289.     (setq extru (list 0.0 0.0 1.0))
    # [7 Q" l, c6 r" s7 j+ x) `( B
  10290.     (setq extru (cdr (assoc 210 elist)))3 k: y" \$ Y% p8 ~) d( w
  10291.   )
    3 U0 z, ^& j/ L% t
  10292.   i# U7 {8 u) `# D! e6 _# f" C
  10293.   (if (not ecolor) (setq ecolor 256))3 ]& G' B$ E  f; P9 f" G- s
  10294.   (if (not eltype) (setq eltype "BYLAYER"))
    ; T7 s' x) l/ H8 [+ u' M# I, W
  10295.   (if (not ethickness) (setq ethickness 0))+ }& m/ r3 ^; _" T0 |
  10296.   (if (not eltscale) (setq eltscale 1))
    & P3 I2 C0 E2 L8 i$ [/ b$ t0 w
  10297. ) ; end ddmodify_init
    0 p! D" _9 I* ]7 T

  10298. 2 Q% R$ ~- V5 }3 g5 [' K1 C
  10299. ;;; --------------------------------------------------------------------------
    + h. [+ e& s5 V% h! Q; \
  10300. ;;; Function: DDMODIFY_SELECT9 Y1 ?) W. o6 p: i7 e
  10301. ;;;7 X2 g0 M9 }5 z3 _8 q) q% W& s
  10302. ;;; Object aquisition function.
    # }1 V0 I8 M4 A9 H4 |2 n
  10303. ;;;
    . \& [  H2 w3 h0 |5 x, L# x, p
  10304. ;;; (ddmodify_select)
    3 H" }4 ^$ H' T& \+ n! F& d
  10305. ;;;
    ' {) r  V% o  a* M9 D: V) P
  10306. ;;; Obtains object to be modified, in one of three ways:0 G9 _: `+ o8 e% H8 @0 B
  10307. ;;;
    9 s; ?& O/ q8 j# d5 N
  10308. ;;;   1 - Autoselected.0 S7 t$ e3 X/ e9 \" \! U4 Z
  10309. ;;;   2 - Prompted for.
    / J/ j: e$ [- M0 @' U
  10310. ;;;   3 - Passed as an argument in a call to (ddmodify <ename> )' ?" g; P/ i! T& m1 w: v) G
  10311. ;;;
    : p3 a; N6 _# m( J, V1 A
  10312. ;;; The (ddmodify_select) function also sets the value of the2 W8 q9 ~6 j" [1 _9 d$ t
  10313. ;;; global symbol AI_SELTYPE to one of the above three values to
    4 h9 E9 T2 j% K3 T
  10314. ;;; indicate the method thru which the object was aquired.! Q# ~3 O3 \4 h4 y# o
  10315. ;;;* g* k" ?4 W$ R& ], {
  10316. ;;; This value can be useful to applications that want to RESTORE3 P) o; [5 v7 l2 x
  10317. ;;; an object that was autoselected to its previous selected state
    8 d; ^# v) j1 x
  10318. ;;; when they terminate, although there doesn't appear to be any
    " S2 J0 C$ H$ \# F8 C9 _1 L5 k
  10319. ;;; way to do this right now.# h: N4 C: W( |$ ^8 i) U( |

  10320. & z* x; z( y# }$ q+ f4 Q
  10321. (defun ddmodify_select ()
    4 t/ a! a' v% u( D6 e1 Y+ J
  10322.    (cond
    ) q) c5 ~1 k0 A$ l
  10323.       (  ename                             ; (ddmodify) was called
    & V# y' t1 }- t
  10324.          (cond                             ; with an <ename> argument
    . x, n+ \% F6 _
  10325.             (  (entget ename)              ;   If object is non-deleted% y( O5 T' m( V9 I+ Y
  10326.                (setq ai_seltype 3)         ;   then return its ename.
    & y1 h) S, m! b
  10327.                (ai_return ename))))
    $ |2 G& }& W' h/ k
  10328. ! u$ p+ q7 e1 c+ }
  10329.       ;; return auto-selected , see ai_utils.lsp/ _, T9 f5 L  L3 y* M2 Q) U! S
  10330.       (  (ai_autossget1 "\nSelect one object to modify: "))* r9 A  ]' l- a8 _! [

  10331.   x5 b5 u  T- i8 r1 s
  10332.       (t (princ "\nNothing selected.")6 w) w- b. K4 B% i# N  x
  10333.          (ai_return nil))9 d- m* V, u; r0 e! j
  10334.    )# `0 _, b+ j& F$ o) L2 z* B& J
  10335. )' s) X) U# _6 D- s
  10336. " y2 E* R1 I$ p- V# c( V
  10337. ;;; ============= Command line interface function =======================& R( M* g- r7 F0 a/ `9 V6 `
  10338. . a4 @8 J/ f; ]1 _& \$ a
  10339. (defun C:MMO ()
    % J7 J% u- E* V
  10340.    (ddmodify nil)
    / Z, e8 T: s1 e6 B, b) M! @9 s
  10341.    (princ)! V+ c. B, Z$ g. u  I8 o
  10342. )$ N! i* l  H' B+ ]

  10343. / a" y/ _% v- r6 a3 `
  10344. ;;; ================== (ddmodify) - Main program ========================) s3 A7 B* J  B
  10345. ;;;
    # u# n) o, [/ c2 k/ J& u
  10346. ;;; (ddmodify <ename> )
    . k8 s2 ?( q5 p% \7 Z& l- ~% ?% |
  10347. ;;;1 D4 c! e+ y# R( [. F8 M2 V
  10348. ;;; Main program function, callable as a subroutine.+ K2 f5 D/ m, s( e3 K' y5 p* e
  10349. ;;;. v: n, N% }1 s, C6 i( @1 h% |. s
  10350. ;;; <ename> = object name of the object to modify.3 J+ p9 E. k3 a1 V, A- a& B
  10351. ;;;! t! K& _/ p) E2 _* X
  10352. ;;; If <ename> is nil, then user is prompted to select
    4 C8 Z1 T: f/ o1 z) F4 Y& d1 C2 Q
  10353. ;;; the object interactively.4 i" D, q- i8 W% H6 [0 |/ L$ y! `
  10354. ;;;
    7 U2 L* [' w$ H/ ?% D( O) L
  10355. ;;; Before (ddmodify) can be called as a subroutine, it must/ Z) O8 A9 N1 |9 X; Y
  10356. ;;; be loaded first.  It is up to the calling application to1 }/ A: O% v, S6 b' x; G
  10357. ;;; first determine this, and load it if necessary.
    - V, I( r, `- c2 J' |

  10358. ' k8 q4 D( l! [. ^/ x4 z
  10359.   y7 \0 t2 v/ L- L
  10360. (defun ddmodify (ename /$ W% f9 }% r4 i+ M8 s; ]4 e
  10361. 2ndpt              ell_calc_area            move_pt1               templist
    & M' @9 n$ n) p4 A* l8 q
  10362. add_mdash          ell_tile                 n                      tempmod
    1 m. K# V  z1 X" n
  10363. alipt              eltscale                 name                   tempst_ang6 U' @  _: ]* F8 Q
  10364. ang                eltype                   newpoint               test_ok9 Q6 f0 p% C5 \; R# A1 ~. r7 N
  10365. arc_calc           emod                     next                   text& m. f1 F0 w- s; h
  10366. arclen             end_ang                  next_vertex            th-value
    / d+ I4 ?! m6 V- I
  10367. assoclist          endpt                    obl                    tile
    " L" w1 c0 a  @  l: D$ b! X( v
  10368. atprompt           errchk                   off                    tile_rect  w/ B4 q+ ?; i* o4 e5 o3 X0 X
  10369. attag              ethickness               old_majrad             tilemode1 O  o# w8 |. E+ I3 \
  10370. attprompt          etype                    old-closed             totang6 f7 u% Y* s$ s7 h4 m; Q
  10371. bit                extru                    old-closedm            tstyle: a% l( G) d7 u$ V% ?
  10372. bit1               fchk                     old-closedn            u
    ! x6 O& L) m, j) B% |7 I/ W
  10373. bit-10             first-10-rec             old-elist              undo_init7 r$ O6 }5 Y8 c+ u
  10374. bit-11             first-10-time            olderr                 upsd
    7 o  d4 Z  @$ _/ F3 G) Z
  10375. bit2               first-11-rec             old-fit                v+ ]' ^6 J* ~- e! v: v- q8 U. v1 Z
  10376. bit3               first-11-time            old-idx                va
    ( k9 _/ n) G# Y* c- t
  10377. bit4               fit                      oldlist                value
    2 m, z$ h! {, j! e/ ^
  10378. bit70              frozth                   old-spltype            ver_4; K; f. \6 S! z2 x% j9 ?; v% w0 a6 q
  10379. bit-70             f-vis                    old-u                  ver_ang1
    * c8 a2 G) L" R
  10380. bit75              fx                       old-v                  ver_ang2
    - D2 H$ [0 j; ^' V
  10381. bk-up              get_color                on                     ver_col
    ( r0 j3 h1 q/ t" V5 Q+ b( Y  A
  10382. bkwd               getcolor                 onoff                  ver_colsp) {( {5 Q5 y4 W4 `: r2 K
  10383. boxlength          getindex                 on-off                 ver_eangle: A0 y) W: f% B: }
  10384. bylayer_col        getlayer                 patlist                ver_hght
    $ R/ z, A! n- y& o+ N
  10385. bylayer_lt         getltype                 pattern                ver_majrad3 Z' Q) u# U) d! a
  10386. calc               getthickness             pltype                 ver_obl" `: ?' h4 n! k$ m3 x1 k; ]
  10387. cancel             globals                  polytype               ver_pt1
    , V6 m% x! u0 V- z( s
  10388. cir_calc           ha                       pre                    ver_pt25 `5 E' `; L) G/ l3 c
  10389. closed             ha-prev                  proplist               ver_pt3
    3 W' p; r4 H" C
  10390. closedm            help_entry               pt                     ver_pt4, V2 M( \3 I) [9 @
  10391. closedn            hght                     pt1                    ver_rad7 N( Z4 C  I6 n$ g6 t5 P
  10392. cmd                icvp                     pt1_eq_pt2             ver_rot
    . s! [8 m( f, |3 q6 f1 }, w
  10393. cn                 image_add_vector         pt2                    ver_row; J. L9 `" N- j
  10394. cname              image_clean_variables    pt3                    ver_rowsp
    $ e( V: u0 t; c
  10395. cntl-pt-indicator  image_cross_product      pt4                    ver_tag' O% a9 d+ _! Y+ E+ h) Q
  10396. code_71            image_disp_opt           ptype                  ver_u6 \( _; L1 \* o& l* H. n6 `
  10397. col_tile           image_dot_product        radius                 ver_v! m; q% i+ n# ~- F
  10398. col-idx            image_normalize_vector   rational_spl_flag      ver_wid
    / m6 ]( H: x# c8 u/ G, ?, l
  10399. colname            image_rotate_vector      reset                  ver_x1/ B' T' g/ a: p
  10400. colnmlst           image_scale              reset_flag             ver_x2: o9 j9 u. ~  p; e6 N& x2 ~3 B
  10401. colnolst           image_scale_vector       reset_lay              ver_x3
    8 V; r/ J- `3 z
  10402. colnum             image_update             reset_lt               ver_x4) {3 D  @; S% y1 L
  10403. color              index                    reset_uv               ver_xline_pt10 \, g0 ^% I1 c, u* W
  10404. colorname          inv                      rot                    ver_xline_pt2
    * d5 y: }1 O' o* G( }: W- }' ^
  10405. colorno            item                     rows                   ver_xline_x1
    2 R! g# K& |3 N0 T+ y
  10406. col-sp             item1                    row-sp                 ver_xline_x22 b, o$ h3 y9 I1 r+ ~. }
  10407. columns            item2                    rrat                   ver_xline_y1+ E% ~4 Z1 ^/ Z' x' V/ F9 J
  10408. con                itemlist                 s                      ver_xline_y2
    - Q! r" y! O' O7 |' Y1 Q' ~) h
  10409. coord              jlist                    set_action_tiles       ver_xline_z1+ ^( Q4 H0 C* O7 i
  10410. ctr                jlist_act                set_just_idx           ver_xline_z2
    + o" C# i0 z: q9 x2 z
  10411. cur-10-rec         just-idx                 set_tile_bk-up         ver_xscl0 j' v6 n9 w4 v3 w/ S
  10412. cur-11-rec         layedit_act              set_tile_cntl_pt       ver_y18 I: v1 T3 q- \& q; T/ S
  10413. cvpname            lay-idx                  set_tile_data_pt       ver_y2
    . f- [" F/ a$ i. k1 r
  10414. dash               layinfo                  set_tile_dirv          ver_y3% k$ d% S! _0 I
  10415. dashdata           laylist                  set_tile_edges         ver_y4, S' U$ A7 |# e% {
  10416. dashlist           laylist_act              set_tile_endang        ver_yscl  N; Z. M# l- Z8 v  K% T8 _: N
  10417. dashsize           layname                  set_tile_hght          ver_z1
    " ]. W8 |6 V9 R/ h5 U! q4 k) `
  10418. data-pt-indicator  laynmlst                 set_tile_icvp          ver_z2
    4 h' c9 Q$ W, ^, f9 Y8 Q
  10419. dcl_id             layvalue                 set_tile_just          ver_z3
    # l9 X' Q& F8 y/ x0 d* B
  10420. dd3dface           line_calc                set_tile_obl           ver_zscl/ S1 O) N" w' w1 p' {& {! ^
  10421. dd3dsolid          linetype                 set_tile_prompt        verify_a
    6 j6 I& G5 W5 y
  10422. ddarc              list1                    set_tile_props         verify_d6 O7 a& p0 x2 B: Q- z% a
  10423. ddblock            longlist                 set_tile_pt1           verify_i7 v' k" {2 E) f$ L5 X- v5 z
  10424. ddbody             ltabstr                  set_tile_pt2           verify_xline
      d+ P  l5 ^$ H9 |0 [$ Q  @- w
  10425. ddcircle           ltedit_act               set_tile_pt3           vfy7 k6 M0 j" i. p0 L& p4 O8 l
  10426. ddellipse          ltidx                    set_tile_pt4           vi. K- Z: l  g0 Q2 f- L# M4 T  `
  10427. ddgetprompt        lt-idx                   set_tile_rad           vlist" l# i) k: s2 ]
  10428. ddgettext          ltlist                   set_tile_rc            vname
      M5 Y0 _. j/ C& ^- C6 x
  10429. ddimage            ltlist_act               set_tile_rot           vpf
    % p. ^. f* G  ^- u, p
  10430. ddimen             ltlist1                  set_tile_scale         vpid
    4 o, E# n( E' M6 x. B
  10431. ddleader           ltname                   set_tile_spline_props  vpldata5 M" {% q4 S! {8 R4 A! q+ K& i
  10432. ddline             ltnmlst                  set_tile_stang         vpn- }  l- z; |' G; F; V3 W
  10433. ddlist             ltvalue                  set_tile_style         vpt
    8 G5 x- _5 n+ |% H1 V7 @% w
  10434. ddmline            ltype                    set_tile_tag           which_tiles# Z& G: s3 R7 Y; |+ \4 T
  10435. ddmodify_err       m                        set_tile_text          wid
    + h9 B) j2 B: w& \& `5 s
  10436. ddmtext            majrad                   set_tile_vpt           x! @$ Q! H( C) P. @2 n5 A
  10437. ddpline            make_lay_lists           set_tile_wid           x1% s9 e" o4 F* T$ {
  10438. ddpoint            make_lt_lists            set_tile_xline_pt1     x2
    $ x& i& f# P2 C/ c' u. z6 E  @& e) J  i
  10439. ddray              mdashlist                set_tile_xline_pt2     x3
    1 [& Q: v' p& ]& g( L- a
  10440. ddregion           minrad                   setcolor               x4# m+ D& B! S1 d' k6 X8 S
  10441. ddshape            modify_3dface            shght                  xdlist
    - }+ s4 z( \1 o- v4 B. X
  10442. ddsolid            modify_3dsolid           showpt                 xline_pt1
    0 U* B! V, a$ l: I1 D# b+ g
  10443. ddspline           modify_arc               size                   xline_pt2# e, B. _2 Y. b/ i
  10444. ddtext             modify_block             slist                  xline_x1
    ; M* Q( S+ j% L& h1 J
  10445. ddvport            modify_body              sname                  xline_x2! {7 O% ?! h, u, p& v* S& ]
  10446. ddxline            modify_circle            sortlist               xline_y1
    % m: c/ G' A* |* `7 l  e1 P" n
  10447. denom              modify_ellipse           spltype                xline_y2
    , J; b5 P; ^( ?/ v! B- d+ O
  10448. dialog-state       modify_image             ss                     xline_z12 l: z, M, }% s. S$ p5 r2 ?3 [
  10449. dir_pt             modify_line              st_ang                 xline_z2
    1 {! Y- t/ |: W" K% @! g) S
  10450. dir_ptx            modify_mline             stpt                   xscale
    % K/ _, `  M, r' e& _8 B+ U) \9 \: H
  10451. dir_pty            modify_mtext             style_act              xx* A. K  G& p+ Q
  10452. dir_ptz            modify_point             style-idx              y
    : ]% _! U3 r! {: f1 t& ~$ L
  10453. dismiss_dialog     modify_polyline          style-list             y1
    6 G) _: }5 h6 H% s& p" A
  10454. drawpattern        modify_prop_geom         tagval                 y21 d' i  X) {9 J& H
  10455. echo               modify_properties        temp                   y3
    * \7 D+ C: K' R/ ?, @
  10456. ecolor             modify_ray               temp_color             y4
    6 ~: t) r( ]4 q! F- p! r
  10457. edge1              modify_region            temp_dir_x             yscale
    1 n' B. O& [5 ^1 @- F- E3 Q. ]
  10458. edge2              modify_shape             temp_dir_y             yy
    % m3 e6 ~5 s/ B( j4 Q: X/ s# p- X
  10459. edge3              modify_solid             temp_dir_z             z1* _* B5 I6 Z; D1 j7 V$ C) H
  10460. edge4              modify_spline            temp_xline_pt1         z2) g+ v4 u0 Y  U* `6 N$ \: n7 [
  10461. edgetest           modify_text              temp_xline_x1          z39 |) b# ]/ {$ c
  10462. elayer             modify_vport             temp_xline_y1          z4
    . v# P7 C# U$ H' o
  10463. elist              modify_xline             temp_xline_z1          zscale
    " p9 K$ g4 \) [# b
  10464. ell_calc           modlist                  tempend_eang           zz
    ! p/ f9 G" i4 w* Y. \
  10465. dir-idx            safe_ddedit              ver_MtextWidth         xcliponoff
    ; G9 x  T1 B6 v
  10466. MText_style, _5 t1 I9 M/ S2 W3 i) V7 Q
  10467.   )! ~0 Y; N5 O& o, g. m

  10468. - @. o! {! H5 ~% A) e
  10469.   (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho
    6 {+ H" G4 t8 W( K& }
  10470.         old_error  *error*            ; save current error function
    " ]2 l. ]; D0 J# S/ k' K
  10471.         *error* ai_error              ; new error function  ?1 b. L, H- ~/ x, A9 l
  10472.   )3 P$ M3 s* U4 I' Q# Y
  10473. 4 j/ @8 W2 O3 g2 G# [& d
  10474.   (setq old_pickstyle (getvar "PICKSTYLE"))          ; save old pickstyle3 h6 J; I9 q9 b( H; [
  10475.   (setq new_pickstyle (logand old_pickstyle (~ 1)))  ; turn off group selection
    . p9 u+ C# B1 N, @: j
  10476.   (setvar "pickstyle" new_pickstyle)                 ; bit and set to new value
      ~8 h% T' F8 y% X: J

  10477. ; H* d, m* j) n8 z9 P
  10478.   (setvar "cmdecho" (cond (  (or (not *debug*) (zerop *debug*)) 0)" M$ Y& ~5 E5 v
  10479.                           (t 1)))
    , i# x1 q# Y$ a7 N
  10480.   (cond
    ; O7 q- R/ u$ W9 r. F$ v: T
  10481.      (  (not (ai_notrans)))                      ; Not transparent?
    % L2 I7 z( w5 z/ }6 G7 q
  10482.      (  (not (ai_acadapp)))                      ; ACADAPP.EXP xloaded?
    ( N7 Q! m6 Z( k5 e$ {' }2 Z
  10483.      (  (not (setq dcl_id (ai_dcl "ddmodify")))) ; is .DLG file loaded?
    9 H' w7 H/ U( y# L
  10484.      (  (not (setq ename (ddmodify_select))))    ; object to modify?  V; H2 v  l; j2 s  C4 n8 e
  10485. 7 _' R$ h/ N, H' N
  10486.      (t (ai_undo_push), b$ K+ z8 O1 O3 u
  10487.         (ddmodify_init)                          ; everything okay, proceed.6 P5 l! O. r. g6 ~$ ~" r
  10488.         (cond
    9 b6 ^7 ^0 L+ _' Y( \: P/ d
  10489.            ((= etype "LEADER")7 |5 j- j1 V6 g, E: w* }' n( c
  10490.              (setq help_entry  "modify_Leader_dialog")
    ' P3 f7 Y" z7 s7 u% B
  10491.              (ddleader)
    : ]' n' V6 J" ?( o; V4 |: }
  10492.            )
    4 ]; X  ?9 W' {1 ~3 s: r4 z9 h
  10493.            ((= etype "ARC")4 O$ {6 H0 @" j1 ~% Y
  10494.              (setq help_entry  "modify_Arc_dialog"). z% M) I' R, o& E0 x  X0 @
  10495.              (ddarc)
    1 B0 Y' R( m+ `) F
  10496.            )
    6 M( M) J8 X, }- S5 C- s0 y- V
  10497.            ((= etype "ATTDEF"). z8 D) N7 U. J! Z  K) @
  10498.              (setq help_entry  "modify_Attribute_Definition_dialog")& W4 N. o/ z) A5 P7 k" ~
  10499.              (ddtext)2 ]: w/ a# L. z' q, J, U/ `
  10500.            )
    ' z) m! \7 g8 m3 h) X2 n5 L: O9 Q. ~
  10501.            ((= etype "CIRCLE")
    ) h& G' i9 q$ j! s
  10502.              (setq help_entry  "modify_Circle_dialog")% O/ x0 h- g4 Y
  10503.              (ddcircle)
    8 z3 i7 m: F, t$ N7 c+ q; z
  10504.            )8 j6 ?; ^7 R  D8 F. |1 J
  10505.            ((= etype "ELLIPSE")% `8 L8 X# x3 b0 Q6 c" y# R0 K# U
  10506.              (setq help_entry  "modify_Ellipse_dialog")5 n6 M6 V6 U: t6 j/ u. _, e
  10507.              (ddellipse)4 t* a4 j# s0 _2 _
  10508.            ); R# z6 f' Y) \+ ^. \& V
  10509.            ((= etype "3DSOLID")* _# j+ @& p' g9 a/ \& v
  10510.              (setq help_entry  "modify_3d_Solid_dialog")
    - i3 O. U+ z. x' I) S8 Q
  10511.              (dd3dsolid)
    - E; }) @# i' l1 M
  10512.            )- [) b3 v! ^* p7 G7 }' f
  10513.            ((= etype "BODY")
    ! V1 f) ~3 k( e/ ]6 z5 T) }% u8 a
  10514.              (setq help_entry  "modify_Body_dialog")
    , X" x3 J, E) ]! ^6 h
  10515.              (ddbody)
    . j: B$ H1 T! ?* U
  10516.            )
    $ B( [. n$ i& j! o1 o# c
  10517.            ((= etype "REGION")6 J; ]9 A9 y8 p& ]! Z
  10518.              (setq help_entry  "modify_Region_dialog")+ E/ ~' K4 V% g6 I
  10519.              (ddregion)9 Q+ [9 U9 B+ V( Z9 [0 k4 X
  10520.            )
    / ~( r1 C2 Z/ D- a2 U
  10521.            ((= etype "HATCH")
    9 J3 W: w* l6 t# G- t; h
  10522.              (setq help_entry  "modify_Hatch_dialog")
    ' E8 N, y; Y' t8 T1 V3 Y) \
  10523.              (ddnewhatch)
    # c7 s9 T% p$ X9 {
  10524.            )5 X8 {: F* T1 D) {% \! K; ?6 l- D
  10525.            ((= etype "SPLINE")+ \0 |9 v* T% i% Z6 b3 H
  10526.              (setq help_entry  "modify_Spline_dialog")
    ( f% ]- C4 a* \& k0 u, U
  10527.              (ddspline)2 y- l8 G1 `9 S0 w. }: m
  10528.            )
    3 q" \7 g) `3 q, i0 M! c
  10529.            ((= etype "INSERT")    ; see ddblock for help_entry
    9 T: E0 I' U' h4 Y/ \0 U5 R& M
  10530.              (ddblock)- `% d# s3 `+ n3 h
  10531.            )
    % u+ I8 K# y$ |4 B7 |
  10532.            ((= etype "LINE")4 g% ^( d) @* f+ [' l
  10533.              (setq help_entry  "modify_Line_dialog")
    & N) {8 n4 W/ m& c' p$ H4 ]
  10534.              (ddline)5 z8 Q0 l. R' W! F0 N* V, e4 S* a
  10535.            )  i3 T) e, u4 M8 |2 @
  10536.            ((= etype "MLINE"). g1 M8 i& s* H. N& h( i, p; o4 J2 C
  10537.              (setq help_entry  "modify_multiLine_dialog")
    $ y: _, V6 s) \$ r7 j
  10538.              (ddmline)3 }0 g0 L1 p$ I2 ]4 A( b5 z4 g3 P  B
  10539.            )! A8 P. Z0 w9 p( n/ w# R- J
  10540.            ((= etype "RAY")
    ) k2 i3 V, B; S( x, t0 T0 E% _, u
  10541.              (setq help_entry  "modify_Ray_dialog")
    # x7 y6 F/ z1 y, q$ \
  10542.              (ddxline)
    ; G8 y: Q/ }# p5 p$ [( }
  10543.            )) w- I( E, x# B# j" z+ w: C
  10544.            ((= etype "XLINE")3 y- w; }6 t9 S( `/ g5 Y; }7 m* i
  10545.              (setq help_entry  "modify_Xline_dialog")
    5 V+ }! [. H0 m5 x
  10546.              (ddxline). s; M7 v7 c3 w; o2 [
  10547.            )  H7 Z9 d  j( N" I6 m& J
  10548.            ((= etype "POINT")
    $ q0 m) V* s& \; R3 K) j
  10549.              (setq help_entry  "modify_Point_dialog")7 d7 E* |) C: L+ ?9 O, C1 B; \
  10550.              (ddpoint)
    7 I* ^, I- W2 [4 F" g
  10551.            )
    7 u- a) B! \/ }- G: \
  10552.            ((or (= etype "POLYLINE") (= etype "LWPOLYLINE"))
    . M4 h  }& P2 X0 j
  10553.              (setq help_entry  "modify_Polyline_dialog")
    ; t& V5 C) n3 }4 z/ ^0 y# g
  10554.              ;; If a 2D pline, check to see if it is planar to the current" N0 M/ @3 z7 h. U+ t( _# @+ Z- N
  10555.              ;; UCS, reject if not.   To see if the pline is parallel,. y9 Q8 y" }) X
  10556.              ;; the 210 group (WCS) is added to the current UCS origin (WCS)8 x7 F, I% L. t& o0 M1 p( r) ^
  10557.              ;; and then converted to the current UCS and checked to see if7 w8 H0 e9 @2 r1 H% h: U( q
  10558.              ;; it is equal to (0,0,1).
    9 v" \" w3 w! Z3 Q
  10559. : |" ~/ n& _7 T) T1 w. x& p
  10560.              ;; Incase the 210 is default and not in the dxf list.
    2 q5 t1 Z; F7 c7 D4 ~
  10561.              (if (= (assoc 210 (entget ename)) nil)2 x+ E- M0 k+ [! d$ v% |
  10562.                 (ddpline)3 n( q6 m, s9 B2 y
  10563.                 (progn
    / @/ q7 ~- i- h1 G
  10564.                     (if (and (zerop (logand 120 (cdr (assoc 70 (entget ename))))). g7 V4 D' g" T7 M; t6 I: Z5 `) I
  10565.                             (not (equal '(0.0 0.0 1.0)
    6 s/ q# P# l  l! v
  10566.                                    (trans (mapcar '+$ O: _1 E+ p( p4 t$ {3 m# ~. w" P
  10567.                                              (cdr (assoc 210 (entget ename)))! f7 \) ?/ a. H* k+ t8 Q0 `0 s1 W
  10568.                                              (trans '(0.0 0.0 0.0) 1 0)
    7 v1 y5 t, w, Q1 i+ t
  10569.                                           )
    : h; W" l8 y* ~/ H; W$ g7 Z) g
  10570.                                      0 1
    " p) R3 E& l1 o: C% }( d- @
  10571.                                    )
    6 i4 }! |& i" t/ k) r% X5 v
  10572.                                    0.0000000001            ; fuzz
    & D) {; j9 |# H# K3 C/ V  m
  10573.                                 )8 r# Y) t! n3 u) @
  10574.                             )
    4 Q0 h- I. W0 S/ Y- x
  10575.                         )
      m. l; g+ {0 \) @# W3 s
  10576.                     (princ "\nThe 2D Polyline is not parallel to the current UCS.")
    # M2 r% d0 ?  [' ]; b" T$ L
  10577.                     (ddpline)
    ! h3 {0 v) B1 Q+ w( J+ Y0 w1 ^- L0 L
  10578.                     )" G/ |3 r2 x' Q% R
  10579.                 )
    4 h7 {' M8 P! Q: [3 x( e
  10580.              )
    + y1 W1 O/ @* h6 f# I
  10581.            )! [# N/ C8 w) b

  10582. + b% S3 c) Q+ l/ ^! F8 {
  10583.            ((= etype "SHAPE")
    9 i4 L; O6 ~' D7 {( }' v7 a
  10584.              (setq help_entry  "modify_Shape_dialog")" |* Z4 a9 Y2 z; i
  10585.              (ddshape)# Y0 s, K7 P6 }( q" @6 f) Q
  10586.            )2 x" q& w5 W( S# ?' A! n
  10587.            ((= etype "SOLID")
    3 g1 E1 J/ Q$ b( u* t
  10588.              (setq help_entry  "modify_Solid_dialog")
    ) ^. s# W4 ^! H# [1 R
  10589.              (ddsolid)2 P8 `+ I( E; X/ d* i
  10590.            )
    ( X. |3 |) G. x, d
  10591.            ((= etype "TEXT")( o/ W3 r) }5 _9 w) j7 V
  10592.              (setq help_entry  "modify_Text_dialog")
    ) S8 g% z$ {, r$ t- m4 x. m4 q
  10593.              (ddtext)1 y  X7 [: u7 z& S  r
  10594.            )3 N) }$ ?9 V9 g# z; e2 A1 |7 ~
  10595.            ((= etype "MTEXT")
    6 z' W: u' V7 o6 e/ B2 C. [
  10596.              (setq help_entry  "modify_MText_dialog")$ `  y) e% d5 y
  10597.              (ddmtext)) B2 [+ v6 e9 O% u( G- ?
  10598.            )
    # I# W2 w( w1 N7 i6 F6 E2 a! {2 }
  10599.            ((= etype "TRACE")7 T' a) b9 [; A% S
  10600.              (setq help_entry  "modify_Trace_dialog")
    $ F% [7 s* J! Z) m1 n" ]2 D' A
  10601.              (ddsolid)
    1 z, [  c5 C% \1 B! b
  10602.            )1 e7 O) C. P* v/ f1 h4 C0 h
  10603.            ((= etype "VIEWPORT")  F$ Z; I* F6 W$ e# {" z2 R" y& W
  10604.              (setq help_entry  "modify_Viewport_dialog")
    & `) L: ^( e$ k7 A8 z$ _
  10605.              (ddvport)2 v" K, Y. r8 i9 u/ M
  10606.            )
    , Q% B' a; {/ ^& k. i% s
  10607.            ((= etype "IMAGE")
    : G3 k/ c) ^0 G8 R: Z
  10608.              (setq help_entry  "modify_Image_dialog")
    ' }/ Q, u4 n0 ]: O' y% q
  10609.              (ddimage)' `. y* r0 |% C4 @! n
  10610.            )
    9 t# U% |9 k" O  e, V% V) j, a$ b
  10611.            ((= etype "3DFACE")7 D8 `- T* e' s
  10612.              (setq help_entry  "modify_3D_Face_dialog"). t% T- T! d& X& s4 l4 [
  10613.              (dd3dface)
    2 O3 B) [: U; Z- N) _
  10614.            )0 ?9 F; I& D* H5 n
  10615.            ((= etype "DIMENSION")" u0 _0 N. c7 g' B
  10616.              (setq help_entry  "modify_Dimension_dialog")
    2 j7 k' o5 W, Q; d/ D1 V" B. i
  10617.              (ddimen)
    5 L: B) Y. L3 P; {9 i; u$ ^
  10618.            )
    & @" s7 s6 Q$ |* X3 u% i! h
  10619.            ((= etype "TOLERANCE")
    ) k! `* o5 c( m2 c2 M
  10620.              (setq help_entry  "modify_Tolerance_dialog")0 h1 u9 t) f% y0 J* p- k
  10621.              (ddtolerance)
    9 X( w* P: y. v; N* m% C5 b
  10622.            )! k- p- u* l3 Q: \8 ]2 y9 `$ g
  10623. ;; Fall-through condition changed by MCAD for MDT 1.1 release.
    ! m0 W; _2 B7 s) m" W- O
  10624. ;; This allows DDMODIFY to work on any custom object or any new object type
      H5 c/ l  d  _! F% v) z4 }
  10625. ;; that isn't specifically handled above by calling the more generic DDCHPROP.+ H8 [; S1 j' Y" ~! R1 j5 C) p8 ?3 z
  10626.            (t
    ; M  G" E" o9 O8 V2 t7 m( ?
  10627.              (if (and (not ddchprop) (not (load "ddchprop" nil)))
    1 Y3 l1 N$ c% Q) p
  10628.                 (princ (strcat "No dialog support for object type: " etype ".")))
    # C9 }( I7 u3 W: r
  10629.              (progn
    7 f3 g2 R" D1 L# E/ h  P
  10630.                 (setq tempss (ssadd ename))+ Y% W- _7 p. H
  10631.                 (ddchprop tempss)/ A' t  y/ M6 `% D- }4 _. |
  10632.                 (setq tempss nil)
    0 g3 K- V/ b% S
  10633.              )5 a, W: m& b2 B* t3 t0 h
  10634.            )8 a2 A* H" j  n  c5 r' t
  10635.         )
    * f2 l+ d# L1 |  `, x1 {' E
  10636. ;; Previous fall-through condition.! n0 s9 z% P9 f6 _7 j; g. T
  10637. ;;           (t (princ (strcat "No dialog support for object type: "2 Q! t1 G: D& N1 _
  10638. ;;                             etype "."# J7 P/ q0 _. g3 F
  10639. ;;                     )" M2 q$ D7 g+ n7 ]3 E3 i2 E
  10640. ;;              )1 L- t2 I0 v5 G% t4 {
  10641. ;;           )
    & D# l4 F; |9 B6 E. v3 @
  10642. ;;        ); m8 ?+ p4 u& M
  10643.         (ai_undo_pop)$ u4 f( c. @: {* q, T9 B
  10644.      ), `6 D# s# |0 Q: l# m
  10645.   )
    $ Q9 M/ j! |# h) `- D
  10646. # }4 _9 L- \9 W( U0 ^& ]" @
  10647.   (if (eq new_pickstyle (getvar "PICKSTYLE")) ; if user didn't change pickstyle
    * r* @) p1 N9 E, A
  10648.       (setvar "PICKSTYLE" old_pickstyle)      ; transparently then set it back+ Z: w- ~, N! D
  10649.   )                                           ; to what we started with! I- n- Q: Z* h* H" ?

  10650. " G0 ^, X# }1 e9 X. v: c, U4 a
  10651.   (setq *error* old_error)" @( W( p5 z8 D6 M' K/ z4 P
  10652.   (setvar "cmdecho" old_cmd)/ B9 D0 t: d5 q% O! l; T. h
  10653.   (if (not reset_flag)            ; if object was modified, then: q: c& ~( _) k7 C2 E: a) z; F, E
  10654.       (ai_return ename)           ; return it's ename to caller$ k" @& b2 H- l# X; a0 i3 q
  10655.   )
    ( C7 U: h% k9 ^, l: m% U, |* [
  10656. )2 u* V( k* B, B/ |6 s3 Q: b
  10657. # p5 b; f% @! Z+ Z1 C
  10658. (defun checkForLockedLayer (ename)6 I9 u# H5 H4 Y2 y' N
  10659.     (setq layername (cdr (assoc 8 (cdr (entget ename)))))
    % v6 N! q! z+ u* g7 F( p
  10660.     (setq layerflag (cdr (assoc 70 (tblsearch "LAYER" layername))))9 r+ V0 ~4 f3 f, i7 E, e" V" K/ ?/ O6 R
  10661.     (if (= layerflag 4)8 K( [" b2 d! d2 `
  10662.         T& ^0 g1 A5 {2 t% I
  10663.         nil
    % P/ r; L2 s- _. O
  10664.     )% g4 `8 R" }) h) \8 _
  10665. )! @2 C6 u+ p, m( O" b

  10666. 3 l# D0 o8 I; x5 b! b+ U
  10667. (princ "  DDMODIFY loaded.  ")  @/ w3 u5 @3 V/ i9 R$ J4 _
  10668. (princ)
    0 v# _4 z9 t, y3 s# p
  10669. ;;;???;;;---------------------------------------------------------------------------------------6 T6 H+ N6 z9 ~& T
  10670. 1 \" K4 ?1 L' C/ _% Y. O( b" |& p
  10671. ; Next available MSG number is    8
    ( r0 I/ k* O# v% [4 o8 ?
  10672. ; MODULE_ID DDUCSP_LSP_4 a: ^2 P' P1 p1 @2 w
  10673. ;;;
    : m; H" n. R- R- B- X# u# I  U
  10674. ;;;    dducsp.lsp
    3 r% J: v8 W7 \4 n. }
  10675. ;;;' x" {; N. `. f0 x. I! `
  10676. ;;;    Copyright 1992, 1994, 1996 by Autodesk, Inc." I, s. h9 k7 T( F- v( F1 z
  10677. ;;;
    8 _  a0 ^' O; p* e  H" a  P
  10678. ;;;    Permission to use, copy, modify, and distribute this software5 M9 ?! ]3 |" t, B6 P. {, ?2 v2 a* y. ~  U
  10679. ;;;    for any purpose and without fee is hereby granted, provided
    . i7 O6 u( F. X7 M' F* k6 Z
  10680. ;;;    that the above copyright notice appears in all copies and, ^2 H' {) H  l# V
  10681. ;;;    that both that copyright notice and the limited warranty and
      T, z8 u  T; M, }
  10682. ;;;    restricted rights notice below appear in all supporting
    , p. Y$ e1 Q- U% K- a
  10683. ;;;    documentation.. Z! v% x/ |/ \8 \( e: b
  10684. ;;;0 d" ?$ c1 u5 _! I5 h& r' r, |
  10685. ;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
    ( Z, [- s: U# T0 S# O! Y' D6 g
  10686. ;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
    , u6 i, c7 w6 ?, t4 \" ~2 Y
  10687. ;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
    # F9 ~, e# y) X. c$ D
  10688. ;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE4 `$ v; x" [5 L; l
  10689. ;;;    UNINTERRUPTED OR ERROR FREE.2 _1 e( ?4 a, j) ]2 q. h3 @
  10690. ;;;4 o+ N) R4 [( i: C1 R/ W8 U, O
  10691. ;;;    Use, duplication, or disclosure by the U.S. Government is subject to0 w' q/ I% [3 R, O
  10692. ;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
    : v3 Y6 v1 K2 [3 }! O, t& _! m. F
  10693. ;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
    # h7 M6 K$ Q) T" z5 b1 k7 f* a
  10694. ;;;    (Rights in Technical Data and Computer Software), as applicable.& G6 D5 p3 k9 M# J" F7 Z' G
  10695. ;;;
    1 O2 O) q9 n& v
  10696. ;;;.5 _7 L! R9 M9 [/ n
  10697. ;;;   C:DDUCSP - User Coordinate System presets dialogue.2 W# O8 D2 o3 n  l! r
  10698. ;;;     
    + m, p7 |& W0 q
  10699. ;;;              Uses DDUCSP.DCL for the dialogue definition.  The+ g+ [5 ^, k/ i3 Q
  10700. ;;;              slide images are in ACAD.SLB.. B2 D8 C& W6 e: v2 f0 k5 k. @+ |
  10701. ;;;
    6 e. p1 s# X1 v: t- w
  10702. ;;; ===========================================================================
    + |' }8 M  o. Y
  10703. ;;; ===================== load-time error checking ============================& ^" u1 R% o  X: M. X! `/ w% T
  10704. ;;;
    ; {# V, f5 P  s

  10705.   g* @8 H5 v: Q; `- c
  10706.   (defun ai_abort (app msg)
    , i/ j8 W0 O3 b
  10707.      (defun *error* (s)0 z% t+ i5 r( }) {3 |/ i
  10708.         (if old_error (setq *error* old_error))
    ' a* V1 n% `/ u$ {# U1 H
  10709.         (princ)& _) Z% [" I3 l! |0 L1 b
  10710.      )
    ; p4 j& ^/ _+ ?- c$ h
  10711.      (if msg
    ! W0 b8 G! U+ L
  10712.        (alert (strcat " Application error: "# r! r! r; D; H" q. l
  10713.                       app
    & g+ |- f4 {' ?; N! ~
  10714.                       " \n\n  "6 w' ?, g8 A6 t# G, z
  10715.                       msg
    ' D9 L, J: Y! ?" K% s- P
  10716.                       "  \n"
      Z  X2 ~* C( f) l1 t
  10717.               )
      z$ C3 E! X0 A, A' d" W
  10718.        ). w) t5 G8 A7 M$ d* m3 i8 }+ Z" Y% X
  10719.      )- K+ m" @  l) L. z
  10720.      (exit)
    * r5 G/ I: t9 s8 x; G& ?& G
  10721.   )
    4 G: i4 h* I* O$ L: e6 X8 u" {

  10722. ( q% Z8 y- ^0 g; L# y1 i% i, X* _
  10723. ;;; Check to see if AI_UTILS is loaded, If not, try to find it," M" b1 }; c' m1 k0 z8 ^
  10724. ;;; and then try to load it.
    + o3 k7 C- \! S
  10725. ;;;
    ) u( @3 ]- T0 Q
  10726. ;;; If it can't be found or it can't be loaded, then abort the
    2 Y2 }: V# i8 A2 S6 w/ Q
  10727. ;;; loading of this file immediately, preserving the (autoload)# ]) }+ _. D# c/ a0 _* m! R
  10728. ;;; stub function.. R. D3 ?% b" Y* ?! f& [! g3 G: P

  10729. & `8 c2 G2 e+ ]( }4 X' u  B
  10730.   (cond0 P8 w' T' ?1 @
  10731.      (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.! O6 f4 x) T( Y  p
  10732. 6 X! J3 D' P& ^; m# K3 F8 ]. ?, |! w
  10733.      (  (not (findfile "ai_utils.lsp"))                     ; find it
    9 J; d2 z5 ?$ q# ]- {& Z3 O/ `
  10734.         (ai_abort "DDUCSP"1 u& {+ s) v+ `$ e6 I+ w
  10735.                   (strcat "Can't locate file AI_UTILS.LSP."
    ! W1 o9 @4 n, q3 v1 t! L  B% u
  10736.                           "\n Check support directory.")))
    # N! q8 A  [- U" u/ l

  10737. 4 s& ]1 P/ t& G- I
  10738.      (  (eq "failed" (load "ai_utils" "failed"))            ; load it5 M; y# l: F! h6 z! h
  10739.         (ai_abort "DDUCSP" "Can't load file AI_UTILS.LSP"))5 Q" i3 p- Q  c* ^6 s
  10740.   )
    % |% W* |. X- M

  10741. ' c: R3 l9 W0 k) D7 b" E
  10742.   (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
    . w6 b" M# ]5 c; B- ]
  10743.       (ai_abort "DDUCSP" nil)         ; a Nil <msg> supresses9 W3 L& Y, [3 u) m  t2 T0 l3 ^
  10744.   )                                    ; ai_abort's alert box dialog.
    " c- ~+ e2 j" z" w
  10745.   `  U' ]' W, ^- ?+ y2 Z
  10746. ;;; ==================== end load-time operations ===========================# v) w2 a! i/ i  ^8 [2 h  b

  10747. * k7 q6 E4 B0 Q: o2 g
  10748. (defun ai_ucsp_start ( / program)* p. P, M2 i2 F: c  Y7 A4 q+ p& I
  10749.   ;; Get program name
    2 o# F+ P/ K- P( u
  10750.   (if (not (setq program (getvar "program")))
    7 u7 Z: Q& y/ m( H. a4 \
  10751.      (setq program "acad")0 w4 z9 X* I( Q# d% I+ p  o
  10752.   )
    . T) q  I7 f; h' O( U. z* p* ^9 U' J
  10753.   (foreach v0 '("world" "left" "cview" "top" "front" 6 S+ C. ^- e5 x+ |
  10754.                 "bottom" "back" "right" "prev")6 z( g5 _. r4 }- A! S3 E  n7 Z1 H
  10755.     (start_image (strcat "ucsp_" v0))
    ) |& q$ |- r, d) A( h
  10756.     (slide_image" w4 u# `5 M, X7 J4 P
  10757.       0 02 \, G0 z8 j1 q: w+ m* b
  10758.       (- (dimx_tile (strcat "ucsp_" v0)) 1) (- (dimy_tile (strcat "ucsp_" v0)) 1)
    ) G: H8 g: `* x) y* |
  10759.       (strcat program "(u-" v0 ")")
    , `1 G* b( ^6 U3 v0 Y7 M: A# Q( \
  10760.     )
    5 G; s( A2 I6 t0 o) W- k% p
  10761.     (end_image)2 u, I3 z! W) \1 f
  10762.   )
    / q8 k6 ]% I4 T
  10763. )
    7 F% n6 m) i) c# |
  10764. 9 H% O" k2 q& @, m% ~- n8 m; D
  10765. (defun ai_ucsp_set ()0 ?5 Q: J: h6 w- q4 i
  10766.   (if ai_ucsp_sv( L% U9 T. Q! `6 p
  10767.     (command "_.UCS" "_V")
    1 b9 Z' h( c" U% K6 ?
  10768.     (if ai_ucsp_prevs
    + ]  y2 O6 M. N1 O# I
  10769.       (command "_.UCS" "_P")* z' J9 G0 l* F( P. G
  10770.       (if ai_ucsp_chg, O9 q. o0 b' Q9 N& B+ j, p
  10771.         (progn
    # K& s- `) O" c
  10772.           (if (/= ai_ucsp_a "*")
    * X8 e. A) U2 F+ v8 ^  O7 c
  10773.             (setvar "LASTPOINT" (trans (getvar "UCSORG") 0 1))
    ) q( a! C+ `  m& p! T
  10774.           )
    5 w! N$ }* V9 P0 f
  10775.           (if (< ai_ucsp_pick 6)
    + f' ]7 _4 X4 j* S* Q0 m9 h
  10776.             (setq ai_ucsp_set0 "@")
    2 ]  v% u1 C+ \: r5 g
  10777.             (setq ai_ucsp_set0 "*0,0,0" ai_ucsp_a "*")! a2 `/ W) H+ D
  10778.           )
    5 J  I! j( R# M5 f
  10779.           (cond ((= ai_ucsp_pick 0)
    ) z( q' f0 d$ u0 @  p8 g
  10780.                  (setq ai_ucsp_set1 "0,-1,0"
    - ?( X' |. y: o" S! M
  10781.                        ai_ucsp_set2 "0,0,1"
    " _" P: H) \; O+ G5 `, {% G" K, g
  10782.                  )
    1 \4 @7 R% I- R3 R  @; K, L! z
  10783.                 )
    % m2 q7 n6 a9 h) j" x; R! ?# e  g: U
  10784.                 ((= ai_ucsp_pick 2)9 N- R9 Q% Y. y" @; @1 q; O
  10785.                  (setq ai_ucsp_set1 "1,0,0"
    & Q# ?2 D+ _" c) s
  10786.                        ai_ucsp_set2 "0,0,1"3 N' D( I  W7 v- S% b9 [
  10787.                  )
    , ~# c; s! F, E3 `  k) q  e% C
  10788.                 )4 P7 Q% V" P7 G- Z3 f- u  @
  10789.                 ((= ai_ucsp_pick 3)# N3 u; I6 g% Y) ]: @+ O3 W$ [- I
  10790.                  (setq ai_ucsp_set1 "1,0,0"
    ! G4 t  x# {9 g
  10791.                        ai_ucsp_set2 "0,-1,0"% f' W1 x7 x8 Z, A6 J+ W
  10792.                  )4 [! w1 T8 M' E; y1 |& D
  10793.                 )
    8 C6 K+ D1 X& Y3 z
  10794.                 ((= ai_ucsp_pick 4). p5 A6 v) r: ]& h* ?+ f+ q2 W: p
  10795.                  (setq ai_ucsp_set1 "-1,0,0"
    1 O8 b1 L. u! \. h2 j* D
  10796.                        ai_ucsp_set2 "0,0,1"
    + O" I4 N8 A$ `  H/ `) k- t9 R
  10797.                  )+ k& B4 I+ Q% O; F4 _
  10798.                 )
    ! L6 O. x7 ]* B2 k/ Z4 k
  10799.                 ((= ai_ucsp_pick 5)5 \# Z. L% Y% ]; F
  10800.                  (setq ai_ucsp_set1 "0,1,0". ]( H! G- @$ {0 B( ?7 V, f
  10801.                        ai_ucsp_set2 "0,0,1"
    ) E) e! \$ u9 T
  10802.                  )$ g* s/ ?- @$ D/ a
  10803.                 )1 j# t: }8 }! B9 b
  10804.                 (T
    : V9 g, e& D- |2 v0 [1 {2 [7 f  X
  10805.                  (setq ai_ucsp_set1 "1,0,0"
    % d2 f7 `0 g8 f4 q# s) F
  10806.                        ai_ucsp_set2 "0,1,0"6 v4 P/ B4 S5 V* f! g$ |
  10807.                  ). ^5 T* T1 ~' p1 ?4 n/ g4 x* Z
  10808.                 )
    0 G3 @' N, U9 e* B
  10809.           )
    $ n( ^( `! U4 i: Q1 H
  10810.           (command "_.UCS" "_3P" ai_ucsp_set0
    5 w/ j; b4 c% m
  10811.                    (strcat ai_ucsp_a ai_ucsp_set1) # v9 C- L! k8 [
  10812.                    (strcat ai_ucsp_a ai_ucsp_set2)1 Y) g7 q( O( B; F2 Q1 ^  \
  10813.           ) 5 ~; u9 ]. P8 G% X/ W7 Z) B
  10814.         )
    ' @& j2 o8 H! n$ _" p  F
  10815.       )* w& [( u( e- p0 i' s: ]
  10816.     )  h3 n, m6 f% k# Y
  10817.   )6 t( t! X! P; S% Q: c# f. ?* k! {% Q) W
  10818. )5 ^8 `8 [  h8 _; k' m% }

  10819. 7 O4 _0 S$ N6 N
  10820. (defun ai_ucsp_p (val currtile)
    * O( f2 ~) G: w) W6 d* {5 A
  10821.   (mode_tile ai_ucsp_currtile 4)6 a0 x+ ~' Q! Z# {. r6 t1 M+ ~5 F+ N
  10822.   (setq ai_ucsp_pick val
    0 J2 n+ ~4 f8 Z, L5 K
  10823.         ai_ucsp_sv nil
    . z* @$ l0 `2 V( L* @
  10824.         ai_ucsp_currtile currtile
    8 ?: r1 n: E1 L
  10825.   )
    / W; u" {: q# {; Z& C0 u
  10826.   (if (/= val 1)
    0 T) L9 I: z$ o$ i
  10827.     (setq ai_ucsp_chg T)6 \; Z1 ?. S$ I2 S
  10828.   )
    , n; \" M& F2 q
  10829.   (mode_tile ai_ucsp_currtile 4)
    - v. |0 [' K4 c! }8 r9 u8 I
  10830. )
    , B8 x+ n: F; V6 a9 S! P8 n
  10831. , y; z7 k; _8 x( u& K! N
  10832. (defun ai_ucsp_swcs ()
    , D; W' A0 N. }5 P& k: G
  10833.   (mode_tile ai_ucsp_currtile 4)
    # P: s( \1 f3 t0 `* @3 |; b
  10834.   (set_tile "ucsp_a_wcs" "1")9 j( [( r5 I4 s
  10835.   (setq ai_ucsp_pick 6& z7 t' I. W1 R! C
  10836.         ai_ucsp_sv nil1 ]1 w* H' V: S! w
  10837.         ai_ucsp_currtile "ucsp_world"
    ' S1 s7 |7 C/ c* V& C
  10838.   )0 t& m( f! j+ G! c# ]/ ?4 B) x) X/ E
  10839.   (if (/= 1 (getvar "WORLDUCS"))
    ( g3 |0 e; J1 ~0 C+ E" w& `- Y4 c
  10840.     (setq ai_ucsp_chg T)) z: p( J+ S6 d9 v* N
  10841.     (setq ai_ucsp_chg nil)
    + [! h6 h0 u' }# _
  10842.   ). t0 p. a4 m) G( ]# t9 r
  10843.   (mode_tile ai_ucsp_currtile 4)" `, k3 P9 `! C" Q' i9 K2 H
  10844. )% R$ ^$ J3 Y5 q; O4 a; _/ v. c

  10845. ( b) ^; a+ R, ~0 f
  10846. (defun ai_ucsp_cview (), \( `9 g# O" p" W! p4 K# d8 O& a) S
  10847.   (mode_tile ai_ucsp_currtile 4)
    5 u, o! u+ q* j, l& O$ [
  10848.   (setq ai_ucsp_sv T 6 i  ]: e9 [9 m6 Q' |* ]( L
  10849.         ai_ucsp_chg nil/ f. E+ P2 e! ^, p9 N7 ^
  10850.         ai_ucsp_currtile "ucsp_cview"
      ~0 A, y* `, t. y# H# I
  10851.   )
    6 P) X5 d& |* r: S; Y8 J
  10852.   (set_tile "ucsp_a_wcs" "1")
    , y/ a! l, r* u" C
  10853.   (mode_tile ai_ucsp_currtile 4)
    " z1 t5 o; p( w0 ]: P  `
  10854. )
    1 ~! f7 n) R7 T; H7 q. Y) V
  10855. ; p& e1 i8 G- W  C( C. w" @' [' j) p
  10856. (defun ai_ucsp_rucs (typ)7 u+ Q' h. h  V! P4 i; y0 D, M
  10857.   (setq ai_ucsp_a typ)1 n( |2 ]) k* G0 i9 c3 s# z& p2 j9 T
  10858.   (mode_tile ai_ucsp_currtile 2)
    1 Y! U& N2 g5 U5 l# i
  10859. )
    - C- y9 V8 ], i' H( W9 t
  10860. 5 j* _! s; p; f0 C2 R% W% M2 |* L
  10861. (defun ai_ucsp_prev ()5 a8 J5 s9 q8 Q* U
  10862.   (mode_tile ai_ucsp_currtile 4)
    / s+ K7 `. _& E8 r. S
  10863.   (setq ai_ucsp_prevs T
    ) m0 k6 B1 U0 C
  10864.         ai_ucsp_currtile "ucsp_prev"/ g/ e' Y& [" f: Z/ c
  10865.   )
    ) b) Z& _! `% X0 g
  10866.   (mode_tile ai_ucsp_currtile 4)5 M0 K1 w" ~* H9 C
  10867. )
    5 }" u3 R/ U0 F& J+ q+ Z) {3 n

  10868. ) K! d; g/ T( ]" q$ f0 \* M* T
  10869. (defun ai_ucsp_main ( / ai_ucsp_pick ai_ucsp_sv globals)& K+ R# A  w  D: r( |4 j: i
  10870.   (if (not (new_dialog "dducsp" dcl_id))
    0 R. T; Q4 I- G$ R7 x7 `
  10871.     (exit)
    # d5 j: m; e6 U
  10872.   )
    # A0 U4 J& Z! D8 H; z* j; K

  10873. ' A; v2 o5 q  u2 U5 N
  10874.   (ai_ucsp_start)
    ! r  U& W1 p% V& `
  10875.   (setq ai_ucsp_a "@" 0 A# _- @, @: r- ]6 d
  10876.         ai_ucsp_pick 2$ _( P6 x& q3 I" }1 Y8 U* q4 F
  10877.         ai_ucsp_currtile "ucsp_top"
    % s% F# ?: ]1 f& k" }7 Z. x
  10878.   )
    , c$ S1 ]  |" g( F4 u+ f5 c
  10879.   (if (= 1 (getvar "WORLDUCS"))
    ! \/ F, V4 O. \- D8 l' Q
  10880.     (progn& s9 t" d: I' S
  10881.       (set_tile "ucsp_a_wcs" "1")
    & U, O: K9 p  a& z0 h% r
  10882.       (setq ai_ucsp_currtile "ucsp_world")* O" e, e7 _  j0 x- h' F
  10883.     )) H) u- w& [2 ?, ]& q$ E8 L
  10884.     (set_tile "ucsp_r_ucs" "1")
    / q; o) ^  x2 j$ H. D- N
  10885.   )( [7 y+ t2 Y9 v; M
  10886.   (mode_tile ai_ucsp_currtile 2)
    ; \7 N5 o/ [9 Q( q9 V0 p! {
  10887.   (mode_tile ai_ucsp_currtile 4)* r8 i( g+ v; a; |- [
  10888.   (action_tile "ucsp_world" "(ai_ucsp_swcs)")) g! c+ H* l  n" T
  10889.   (action_tile "ucsp_cview" "(ai_ucsp_cview)")
    ( u) L, i0 `% M  B
  10890.   (action_tile "ucsp_left" "(ai_ucsp_p 0 $key)")1 P) }' J* h7 O+ `+ _* e7 u. j
  10891.   (action_tile "ucsp_top" "(ai_ucsp_p 1 $key)")& J) y7 A6 Z' r# v0 D
  10892.   (action_tile "ucsp_front" "(ai_ucsp_p 2 $key)")3 Y$ e1 [. d) i7 N2 D8 s, V
  10893.   (action_tile "ucsp_bottom" "(ai_ucsp_p 3 $key)")
    7 T4 q+ K" {0 Y" ~: m: x) Y
  10894.   (action_tile "ucsp_back" "(ai_ucsp_p 4 $key)")
    5 `+ y  y( {: O
  10895.   (action_tile "ucsp_right" "(ai_ucsp_p 5 $key)")
    0 I7 w; `- P" |
  10896.   (action_tile "ucsp_prev" "(ai_ucsp_prev)")" G5 ~$ `6 y" E: y1 N) L% Y
  10897.   (action_tile "ucsp_r_ucs" "(ai_ucsp_rucs \"@\")"): B3 Q" f4 _) d2 y! q8 J" i
  10898.   (action_tile "ucsp_a_wcs" "(ai_ucsp_rucs \"*\")")/ H) l. b$ R* A
  10899.   (action_tile "accept" "(done_dialog 1)")
    ! U- _4 g  n+ z3 Q! V4 J
  10900.   (action_tile "cancel" "(done_dialog 0)")
    % X5 M6 _- p$ c- U. x5 t  i
  10901.   (action_tile "help" "(help \"\" \"DDUCSP\")"). ^( Q- j7 r  d* p
  10902.   (if (= (start_dialog) 1)
    2 g3 `1 e8 r$ x1 E  a2 B
  10903.     (ai_ucsp_set). {% o2 p9 A/ H! O1 ~1 S
  10904.   )/ |5 l3 F( f% s1 K! D
  10905. ), v% W- Q+ U+ s; i% O. k  M7 U7 Q

  10906. 7 e( i6 y6 |. ^0 T  A9 I3 R
  10907. (defun c:UUS ( / app dcl_id old_cmd old_osmode ai_ucsp_prevs ( q4 P: w) ?! N
  10908.                     ai_ucsp_sw undo_init)4 p6 e1 s* V+ X3 ^" d1 x- @0 q

  10909. ) J6 B; j) T$ J! L7 U& t$ E
  10910.   ;; Set up error function.  b$ ^$ m8 a2 X3 \7 m$ N8 v0 J1 U
  10911.   (setq old_cmd (getvar "CMDECHO")    ; save current setting of cmdecho
    5 C+ Y( M" ]0 o% _& R
  10912.         old_error  *error*            ; save current error function
    5 K0 Q2 Z1 T5 N+ C; U
  10913.         *error* ai_error              ; new error function" [6 l0 ?+ O6 J; f* f: S1 P
  10914.         old_osmode (getvar "OSMODE")  ; disable OSNAP for duration
      V- `& L! V8 M" d, R
  10915.   )
    - t; y, W8 v% j; W
  10916. " R& O" `  N' p5 O, _
  10917.   (setvar "CMDECHO" 0)
    ; v/ F3 P) V6 |0 k6 Y
  10918. ! }3 ^6 z# @( [5 w5 o
  10919.   (cond. C. a) x7 |9 }1 m: z4 v! N
  10920.      (  (not (ai_notrans)))                     ; transparent not OK( z+ K6 G) t, }4 v" R  m
  10921.      (  (not (ai_acadapp)))                     ; ACADAPP.EXP xloaded?7 r/ _1 ?0 N3 N% M7 U" I
  10922.      (  (not (setq dcl_id (ai_dcl "dducsp"))))  ; is .DCL file loaded?
    ! X$ t- O* @  H$ l5 P7 M4 Y
  10923.      (T (ai_undo_push)
    / F& G" X, _$ z* k' J
  10924.         (setvar "OSMODE" 0)& M; H$ V  r! q0 L+ L/ c. J
  10925.         (ai_ucsp_main)
    " ~9 b, ^+ ?1 \9 G" f4 u
  10926.         (setvar "OSMODE" old_osmode)
    9 |) _$ G7 k6 E/ v& R
  10927.         (ai_undo_pop)6 R3 `% X- Z/ k+ u
  10928.      )! a6 C) ?" |, y- x2 M& X
  10929.   )9 d) L. a* S, `
  10930. + d. Y+ q+ e$ l, J, Q
  10931.   (setq *error* old_error)
    0 U. y4 S( K0 g& b5 x- l3 |4 V/ I$ ?. m) M
  10932.   (setvar "cmdecho" old_cmd)
    ; E& L! B& q0 t. A0 M7 X" R
  10933. & I' \$ s, D5 I
  10934.   (princ)
    $ b2 r) J- }6 }7 o# N3 k4 u" y: k
  10935. )
    ( z" E) ^! v" h  Q4 h& R" Q
  10936. % k! P& Q: f7 G, I1 i# j3 s
  10937. (princ "  DDUCSP loaded.  ")* s* ?, N: K5 Z* m4 k" {' h
  10938. (princ)
    + O, n9 C) c0 f+ {' f# l
  10939. / I. W# ]# z( M- w' Y
  10940. ;;;???;;;---------------------------------------------------------------------------------------, T1 I& s9 E! P  d

  10941. ' K. i% D% f+ ~! E6 |. J+ E
  10942. ;;;----------------------------------------------------------------------------. ?! T1 S  g2 ]# E: o* v; M
  10943. ;;;
    4 _% {% M0 I( y' W
  10944. ;;;    EXCHPROP.LSP   
    * J/ b! r" V" ^( J2 n
  10945. ;;;    Polyline and text modification capabilities added by
    6 U# j  z; F" @0 p$ [) M4 R
  10946. ;;;    Randy Kintzley  . S& w: b1 m& C9 Z8 x" Q, c
  10947. ;;; 8 }: m9 K2 T8 U6 G' x. w
  10948. ;;;    Copyright (C) 1997 by Autodesk, Inc.
    / ]; w0 m+ v0 A  n- t0 ?
  10949. ;;;4 c( W- Q3 Q# _& L" R
  10950. ;;;    Permission to use, copy, modify, and distribute this software; @% ^* H* `8 g: O' K
  10951. ;;;    for any purpose and without fee is hereby granted, provided& p9 f+ R) @6 w1 J, z2 q- @
  10952. ;;;    that the above copyright notice appears in all copies and  u$ X+ X' A0 v. ]3 k, a
  10953. ;;;    that both that copyright notice and the limited warranty and+ S7 B1 H8 Y% ~& T0 d5 i
  10954. ;;;    restricted rights notice below appear in all supporting8 W: |- K4 ]3 l# a
  10955. ;;;    documentation.; W$ A1 ~5 R: O) Y$ P0 I$ c& N
  10956. ;;;: P. U: D3 R" H0 K
  10957. ;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
    ) \  X: B$ l5 G2 e
  10958. ;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
    8 ~+ G* E) J. @- {4 |
  10959. ;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
    4 [6 R1 x5 ~6 c6 `4 x
  10960. ;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE: W3 [' M: S, z8 P( Q/ S& {/ `
  10961. ;;;    UNINTERRUPTED OR ERROR FREE." [) u8 d% U9 m2 g7 b/ X
  10962. ;;;
    & _4 s1 |0 N# U& M
  10963. ;;;    Use, duplication, or disclosure by the U.S. Government is subject to. H: T7 _% D& v! ?6 S( Y, U+ `3 r
  10964. ;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
    / B  D9 M! p- \9 w1 V- a
  10965. ;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)0 c* p' {. Y+ {. ]0 U
  10966. ;;;    (Rights in Technical Data and Computer Software), as applicable.0 k9 ^+ w5 |; {6 s: i
  10967. ;;;* ?7 P% l# O, ?2 H+ k# H) k9 ~
  10968. ;;;.
    1 {) F+ y& M. u' r; z# n
  10969. ;;;    28 February 1997* w* h/ ]4 D! _. K0 y1 h: |( r3 i
  10970. ;;;# `1 @* e- a& H) c/ M- O* f
  10971. ;;;9 `) E- }/ a5 `6 }. l; ]; a3 Q& a) |
  10972. ;;;----------------------------------------------------------------------------. h  U3 ^0 U, ]$ p1 ?! U8 n
  10973. ;;;   DESCRIPTION
    + E+ s# ?) ?! {& C
  10974. ;;;----------------------------------------------------------------------------
    / h! N6 A" d& @' {! x
  10975. ;;;   C:EXCHPROP is an extended or enhanced version of ddchprop. This  
    2 `  O2 G8 l3 B, D' s
  10976. ;;;   command gives the user the abilitie to change several characteristics - H) y: o9 n3 L2 k3 S3 D
  10977. ;;;   of selected polyline and text objects. ' L; s+ ?% A/ m) b. F6 |' i9 a8 y
  10978. ;;;       The style and height of selectected text objects can be modified
    ! z: T% z/ S3 m: D# F
  10979. ;;;   (including text, mtext and attribute definitions) as well as, width and . P( _9 c- a% n4 y" M+ H& M! ^3 l
  10980. ;;;   elevation characteristics of selected polylines (includes lightweight and 8 P# a1 ^, V$ v  e( [
  10981. ;;;   traditional polylines.)
    , y6 r/ b6 K" \9 d0 `
  10982. ;;;----------------------------------------------------------------------------
    + U7 |& n' |% K: [, q0 }
  10983. ;;;----------------------------------------------------------------------------
    : B& ]0 C3 k, R  f5 |
  10984. ;;;   Prefixes in command and keyword strings:
    4 C0 s5 J. r1 D
  10985. ;;;      "."  specifies the built-in AutoCAD command in case it has been9 Z* v. {% ?! V
  10986. ;;;           redefined.0 i% m$ g' ~6 Z# |
  10987. ;;;      "_"  denotes an AutoCAD command or keyword in the native language. e$ b8 Z; L7 M" V, w/ i
  10988. ;;;           version, English.
    ) ~& {" s6 i3 q2 O/ u) m& x
  10989. ;;;----------------------------------------------------------------------------7 ?$ o$ q: e7 T0 y, V4 Z( ~$ r, a9 ]
  10990. ;;;
    # @1 ^+ x/ A, ?/ w
  10991. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9 Z; @! e3 Q0 `- |
  10992. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;GLOBAL INFO.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    0 y, t3 A4 x5 b9 z
  10993. ;Functions created as result of loading file: exchprop.lsp
    5 [. ~/ Y+ [3 I  }$ q" C2 t# V
  10994. ; DDCHPROP2
    8 f* q8 f; |# k1 Q7 d' ^
  10995. ; DDCHPROP2_INIT/ N3 `1 M% I* U2 Z
  10996. ; DDCHPROP2_SELECT- i6 U- |2 J( `
  10997. ;/ t! Q2 f5 X, e! V$ Q
  10998. ;Variables created as result of loading file: exchprop.lsp
    7 _4 O; D8 r2 Z) b% u* _' ]8 A
  10999. ; OLD_ALLOC# d. i% m6 ?  x5 z
  11000. ;
    3 C- \: V- v9 |; U
  11001. ;Functions created as a result of executing the commands in: exchprop.lsp
    8 l4 g3 O- N  }5 @
  11002. ;5 n$ ^) }- B, s' n  k3 F
  11003. ;Variables created as a result of executing the commands in: exchprop.lsp
    % i: u3 h( F0 ]: ?. f) v
  11004. ; AI_SELTYPE& M3 H# _8 P" _& _- U
  11005. ; BONUS_ALIVE
    6 q# w9 {/ K0 n% {1 ~
  11006. ; BONUS_OLD_ERROR
    / p- R% q" `' w. H8 Z
  11007. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;GLOBAL INFO.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3 v8 L& t7 D3 [
  11008. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    " w6 ~& @0 P3 m; S' ?
  11009. , ?  I3 h8 w* T# ]) @; R, E- G
  11010. ;;;$ [0 O3 J* T6 w- @& G- r
  11011. ;;; Avoid (gc)s on load to improve load time.# a5 ^- K5 j4 R& q2 O9 z7 U
  11012. ;;;8 M6 z7 R" r1 H9 L1 d, J4 i& ^% P
  11013. (defun do_alloc (/ old_allod new_alloc)
    ) N6 ]3 U: x1 ~4 \, G+ a1 M# n
  11014.   (setq old_alloc (alloc 2000) new_alloc (alloc 2000))
    " ]: F" E  X  e  Y
  11015.   (expand (1+ (/ 4750 new_alloc)))
    6 q. F$ l4 O: \- V; L6 |& i: e
  11016.   (alloc old_alloc)7 A" v0 n5 B+ S
  11017. );defun5 P5 L* A! F4 ^/ [: m9 o
  11018. 7 n, _7 ?( e$ H5 E
  11019. ;runs at load time - rk
    ) `$ p" a8 `' }" J
  11020. (do_alloc)  g9 ^; S5 H" y, `% L
  11021. (setq do_alloc nil)6 k% o& w0 J9 D
  11022. ;;;8 i2 f$ x3 A+ D6 d4 a2 O" k
  11023. ;;; ===========================================================================+ b4 ?7 ]5 `& z4 b+ j# K7 @" Z7 [2 O
  11024. ;;; ===================== load-time error checking ============================
    # s( \$ {+ l) `1 p: a$ r
  11025. ;;;
    . ]2 I$ I2 B& k

  11026. % c5 O; X0 e- |3 l
  11027.   (defun ai_abort (app msg)
    " z& K  }# f/ C: z) {
  11028.      (defun *error* (s)
    5 v# Q7 q) T( K$ R! K* i& B
  11029.       (if old_error (setq *error* old_error))+ J- b+ c5 |  ]: \4 k
  11030.       (princ)* X  E' i0 E7 w7 I2 L. o' V7 A  E& ?
  11031.      );defun
    ( p% k" |6 D0 Z5 p1 \- m
  11032.      (if msg
    ( [, ^* k4 t7 k4 x1 N% p
  11033.        (alert (strcat " Application error: "
    : b6 J) W4 P  U/ y
  11034.                       app
    ' g- L! y  B/ F+ h, N% B
  11035.                       " \n\n  "
    . J+ ?5 q' L$ s. b3 v
  11036.                       msg! e4 m- M: _0 G+ ]* r# _7 H6 W6 o7 N
  11037.                       "  \n", P5 s' s1 c8 C% \
  11038.               )  U3 l9 w- @2 n- ?
  11039.        );alert' x) T! \7 X  M& a- U0 u* @" a
  11040.      );if& u2 l( Z# d/ w- j: `/ g: H2 i) U8 r$ i
  11041.      ;(*error* msg)
    & @5 X8 J# D. I6 W8 V+ b
  11042.      (exit)
    ) ?& u4 b& |5 v+ m  F
  11043.   );defun ai_abort
    6 h- W, S) q# Q* M) K- }
  11044. - Y: i" r" {/ e4 @% S$ ^9 |
  11045. ;runs at load time - rk" v1 x; H) \- O* ?5 k. ~
  11046. ;(if (and *error*      ;added the if wrapper around this - rk." U8 X9 \7 g* H+ a
  11047. ;         (not old_error)      
    ) X6 h9 |+ j  r+ }' p! \* [
  11048. ;    );and
    % J7 r- |8 K* }7 E* H1 @& I
  11049. ;    (setq old_error *error*);setq
    - K2 w) t# ~! u( c5 F) n
  11050. ;);if
    / M6 [' r. K" ~% j9 h& i
  11051. 6 s/ y- ~7 x# S5 D0 L- D5 Q

  11052. , D0 q3 k( A! U+ Q0 c  r4 h3 L, |
  11053. ;;; Check to see if AI_UTILS is loaded, If not, try to find it,6 Z% q) \& F# T, q8 h; X$ w+ [5 B
  11054. ;;; and then try to load it.
    . O4 Z- T( ~0 s: T9 M  a2 Y' j
  11055. ;;;
    1 {8 i! e8 v0 j3 o8 i8 g3 H: z
  11056. ;;; If it can't be found or it can't be loaded, then abort the
    % y: w8 g8 Z2 d6 _* o
  11057. ;;; loading of this file immediately, preserving the (autoload)
    - E9 h3 Z6 r  I- O# v: f6 t! d
  11058. ;;; stub function.
    3 p" d! v* X% N; m5 a6 o2 p

  11059. 5 I5 H4 t6 M+ E) F$ f5 I( Z. y$ i
  11060. ;runs at load time - rk.
    - S/ i7 F, m3 l+ t( P
  11061. (cond4 b3 d7 l  V9 ?# B% P
  11062. (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded." S# u5 y0 W" P+ N
  11063. (  (not (findfile "ai_utils.lsp"))                     ; find it5 Y6 F9 L4 f1 W6 s& {
  11064.     (ai_abort "EXCHPROP"
    * h9 a' ]. O% O: l' H  |
  11065.               (strcat "Can't locate file AI_UTILS.LSP."
    : Y% g- r5 Z5 a7 f$ q2 s. J
  11066.                       "\n Check support directory.")
    : U' T' \. [! d7 R* H
  11067.     );ai_abort
    ' o& e1 K2 Q. Q
  11068. )* t1 `" o  \! {
  11069. (  (eq "failed" (load "ai_utils" "failed"))            ; load it
    / y  A, w' _1 t+ n# S7 i  ^2 T) s3 E
  11070.     (ai_abort "EXCHPROP" "Can't load file AI_UTILS.LSP")
    , Z" ~6 `9 H, k# t' M
  11071. )
    0 }3 }& M9 H$ y, {1 o2 i: X5 B+ q
  11072. );cond close
    & G2 p7 w1 ]# p2 f7 s2 w9 a0 r2 I

  11073. 4 q6 {; L! `8 M) Y( H6 @3 X
  11074. (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP( y+ ]4 Z* h2 w3 V6 [& f
  11075.     (ai_abort "EXCHPROP" nil)       ; a Nil <msg> supresses
    6 O# i! f) T8 k3 d
  11076. );if                                 ; ai_abort's alert box dialog." e9 C/ L  n1 }' b$ R( T

  11077. 9 O  w: e/ Q' }+ N5 r
  11078. ;;; ==================== end load-time operations ===========================
    * z% r* {9 P1 \. |$ x
  11079. ) y( u$ W" \7 H1 \' Z' A# z3 k  l
  11080. ;;; Initialize program subroutines and variables.
    % s2 |! F3 F0 l$ j
  11081. ; p$ C  P8 h$ p; K; \- H! c
  11082. (defun ddchprop2_init()# x' ^! {3 B4 k1 {

  11083. 7 U4 X2 _3 V9 y/ w; n

  11084. 3 ~6 F( y- V# e$ a* X8 I
  11085. 5 g0 d: u+ l6 i- R8 T
  11086.   ;;
    8 t0 M* W  ~6 o3 b  w
  11087.   ;; Define buttons and set values in CHPROP dialogue box
    8 e5 }$ x- z* p* Y3 n' l) O" q
  11088.   ;;
    2 t& X8 ~- p! S
  11089.   (defun call_chp2 (/ cmdact p1 p2)
    % ~6 \- E# b: _8 L: `

  11090. . h; C# E+ h) m
  11091.     (if (not (new_dialog "ch_prop" dcl_id)) ( U5 g! ]* N# P7 A
  11092.         (exit)5 F+ I7 g8 Z1 e
  11093.     )
    ; W: ~4 N. H  }! ~" V5 N
  11094. % B( J) Q# R7 D! E2 v3 W
  11095.     (set_tile "error" "")! v9 V1 q7 O% ^' }
  11096.     ;; Set initial dialogue tile values
    $ b- z' X* E+ C8 K; }
  11097.     (set_col_tile)3 I2 V' C, u0 w/ n# m3 {
  11098.     (set_tile "t_layer" elayer)
    6 r; K7 e. d  x- @

  11099. " T" A# B, ^8 k' f
  11100.     (cond8 ^2 ?. N5 v6 S- V. W; E
  11101.       ((= lt-idx nil)
    ; f" H; _3 p# p! z- Q
  11102.         (set_tile "t_ltype" "Varies")9 {: }1 e* |9 \- Z
  11103.       )
    ) w) ^  X6 E! ~  W! \: k
  11104.       ((= lt-idx 0) ; set tile "By layer & layer linetype"
    ' N+ \, ^: Q1 p
  11105.         (set_tile "t_ltype" (bylayer_lt))
    ) y: i6 A6 K. g/ v
  11106.       )8 ~& O5 g5 ?8 Y1 |0 ~: q
  11107.       (T
    / V, M) o2 C, _% w4 r
  11108.         (set_tile "t_ltype" (nth lt-idx ltnmlst))
    5 }5 M! _+ A: J& x- B1 d& O
  11109.       )
    9 |' E" B9 b5 Z' B3 `9 |
  11110.     )4 T8 {( ~0 u% u% Q4 J+ s
  11111. - j3 R' i/ w- T. B* w
  11112.     (if (or (= ethickness nil)
    ; u% |; k1 H0 x1 n# G) D" V9 M$ Z! s
  11113.             (= ethickness ""); D. _1 Q( Z8 D5 y9 n- l6 I
  11114.             (= ethickness "Varies") : H" ~$ I  T. n5 o; X4 w; H
  11115.         );or: X4 l1 z, u2 n: ^; X
  11116.         (set_tile "eb_thickness" "")
    4 L4 H% {9 G% ?: V9 A
  11117.         (set_tile "eb_thickness" (ai_rtos ethickness))
    , d5 B3 ^1 ~5 V8 N0 f, V5 d
  11118.     );if
    : f! h8 S2 @+ d" d( T& H' c; F
  11119.     (if (or (= eltscale nil)& V# n8 t8 f8 G: A) V( s/ y
  11120.             (= eltscale "")( \& |0 R0 T7 ]! z
  11121.             (= eltscale "Varies")
    5 z4 _7 F8 ~6 q/ o) O

  11122. ) H6 C; N) D0 L7 U! f! a
  11123.         )
    3 o# V& Q' Q. G+ x0 p1 {
  11124.         (set_tile "eb_ltscale" "")
    3 u/ K$ D! h$ k  y' N
  11125.         (set_tile "eb_ltscale" (ai_rtos eltscale))
    : e8 h1 q: s7 c8 d: E# ?
  11126.     )
    ' B# S# o4 H0 x" r) t$ D
  11127.     (if# L' G7 D& f; @+ ~7 a5 P4 v
  11128.       (numberp ewidth)
    1 O! v7 U+ t1 V) t1 U$ i! [  d
  11129.       (set_tile "poly_wid" (ai_rtos ewidth))( q5 c1 j+ }$ ~: H( |, V4 z
  11130.       (set_tile "poly_wid" ewidth)2 C; O- m& ^* S  Q, w
  11131.     )
      o: q! [$ c- `4 v( i5 s! [6 O) N
  11132.     (if
    ) s# F( o( @. i! j- l5 O+ t
  11133.       (numberp eelevation); ?9 E/ L- J6 N# [
  11134.       (set_tile "poly_elev" (ai_rtos eelevation))+ i/ h4 S6 `6 O
  11135.       (set_tile "poly_elev" eelevation)
    # b+ I; L/ k+ U0 D2 v
  11136.     )
    8 f( G7 A  b, n
  11137.     (if! B! A; g' e( |! A
  11138.       (numberp eheight)
    ; u$ p7 s* i% W' k5 q) g+ t9 w
  11139.       (set_tile "text_hgt" (ai_rtos eheight))" q1 j% c1 `4 x8 n6 {
  11140.       (set_tile "text_hgt" eheight)
    & _0 `. ?) `# V3 a
  11141.     )* J9 T6 g7 o6 `. T6 v
  11142.     (if (not estyle)# o$ j, ~% U9 D( o
  11143.         (setq estyle "")
    0 ]; V5 S; v  r9 ?3 j* N
  11144.     );if
    ) t7 u( h9 L0 r9 i% `8 W  {
  11145.     (setq hair_style_list (tnlist '("style" 16)));setq
    ; O$ v! g6 @* @5 b
  11146.     (if (not (member estyle hair_style_list)), {9 S  \7 t, u' L# c4 U: Z" [
  11147.         (setq hair_style_list (append hair_style_list (list estyle)));setq1 Z  ]1 E8 k  D
  11148.     );if " W4 n: R( _3 n5 a1 J; |
  11149. 9 M$ x# u3 ]0 E. w7 d2 c
  11150.     (setq hair_style_list (acad_strlsort hair_style_list));setq
    ' d! ?0 z9 M3 H; B8 ]& J
  11151.     (mpoplst "text_style" hair_style_list)
    9 l# C) G* d" @
  11152.     (set_tile "text_style"
    1 ^$ G' o$ _# J8 w% F7 t0 B0 b; e
  11153.               (itoa (position estyle hair_style_list))- e0 O/ C4 R, U1 h4 z/ V
  11154.     );set_tile
    0 i$ _5 K) N6 J  h

  11155. - ^: h# D4 {* K" k. F; E. j* f
  11156.     ;; Disable tiles if need be...  ;@RK
    . Q# \- O' I0 ~# X: x9 [7 l, K
  11157.     (setq a 0)
    5 N$ L3 E* z* {* {" x4 T* w
  11158.     (while ( < a  (sslength ss))
    7 `: h6 {2 ?* J- o& U8 W0 g0 j; ^
  11159.       (setq which_tiles
    ! a) Y# v9 M8 J, N& \
  11160.             (ai_common_state (cdr (assoc '0 (entget (ssname ss a))))))
    4 L' {9 S4 G7 j5 V: P0 o
  11161.     % T" h. c0 P8 m, v  n1 Q9 F
  11162.       ;; If all fields are enabled, don't bother checking anymore.6 y  S% B- c7 `" A4 n' o0 r
  11163.       (if (/= which_tiles (logior 1 2 4 8 16))6 k% y' Q4 U6 X6 w
  11164.         (setq a (1+ a))
    ( f- T" b0 e$ ?8 v
  11165.         (setq a (sslength ss))5 H- m  _) w3 V2 {4 P' j/ _
  11166.       )  H( m; N, t# F4 z% p9 n6 E
  11167.     )
    2 A% M; {( A( f5 B
  11168.     ;; Layer Button and Text Field
    4 a5 ?* y; f# y# B$ b
  11169. : n- S; ~, X; {( h0 ]; F
  11170.     (if (/= 1 (logand 1 which_tiles))
    1 M1 H' b- G, h' b0 C! A
  11171.       (progn0 m- G  W, D# R9 v9 j0 L  [
  11172.         (mode_tile "t_layer" 1)) N: J2 [2 f9 v" K# s8 q
  11173.         (mode_tile "b_name" 1)0 j5 v- B5 ]6 X6 v1 N
  11174.       )
    5 g! c  C8 B. W  ]& ?
  11175.     )
    / s+ \+ o$ E6 |. ?2 g& j! [

  11176. ' l1 w5 \4 F: [- W
  11177.     ;; Color Button and Text Field
    5 a' E+ d* L1 S$ F- N
  11178.     (if (/= 2 (logand 2 which_tiles))# B4 t6 T3 V5 b% g# x! a2 m
  11179.       (progn0 B7 R4 ~6 C6 Y8 k
  11180.         (mode_tile "t_color" 1)
    & }3 A$ w( J  n
  11181.         (mode_tile "b_color" 1)
    & [% y" P! W' h/ X1 B. j
  11182.         (mode_tile "show_image" 1)  K6 s! x: o- M( |: _; L3 K
  11183.       )
    ' j9 j; }2 O$ b" [
  11184.     )( k; D& }3 D+ G8 X% {  e: w) M- S
  11185.     ;; Linetype Button and Text Field- z# d/ G8 |+ j5 Y
  11186.     (if (/= 4 (logand 4 which_tiles))
    , d& j* F2 z) o: ]6 g5 g
  11187.       (progn1 Y. q' A$ @, }% T4 ~% m9 d
  11188.         (mode_tile "t_ltype" 1)
    2 `/ h( X, M. I6 f1 w( ]% F2 [
  11189.         (mode_tile "b_line" 1)4 y; n( v/ |, Y9 K8 a! c$ O! O
  11190.       )- S4 c; G" q. l  ~2 [  p" M* r2 z
  11191.     )
    8 s1 F/ g+ m/ L0 I
  11192.     ;; Linetype Scale Edit Field8 l# F/ e4 G/ ~: w# ]
  11193.     (if (/= 8 (logand 8 which_tiles))4 e* f* [  _, |6 S1 s  t0 @8 [
  11194.       (progn, F% A+ `5 ~/ e0 o7 k( ^, V
  11195.         (mode_tile "eb_ltscale" 1)
    ' Y9 ?/ Q  K9 M. g! S
  11196.       )( y! `/ g2 P3 {$ R0 [
  11197.     )
    3 M" V* v& c: L0 k
  11198.     ;; Thickness Edit Field.
    2 @4 N* I% D0 s7 p% Q: j8 o# I/ Y! M5 f
  11199.     (if (/= 16 (logand 16 which_tiles))  p  Z7 X, ^" S# M/ `7 C8 `
  11200.       (progn; M$ T2 H% K5 F0 P1 e2 C& g+ k  _
  11201.         (mode_tile "eb_thickness" 1)
    / `; k3 v9 f+ s) u! a
  11202.       ). {( R5 y& x6 }7 E( S# z$ R
  11203.     )
    9 e( W" Y9 ?' ]
  11204. # n5 n; Y9 i! `. l5 N: c2 p
  11205.     ;; Polyline box and tiles          @rk 10:05 AM 1/30/97
    ( R& X* s4 h) H. }0 o
  11206.     (if (not (= 2 (logand 2 eflag)))
    : f- {$ a7 Z! |! g* c) C
  11207.         (progn$ s! b% I0 H6 D0 C# _/ B
  11208.          (mode_tile "text_hgt" 1)
    : A( f9 h/ ^9 W$ ~
  11209.          (mode_tile "text_style" 1)7 }* i1 x6 x% N
  11210.         );progn
    1 h% R0 b, Z) S- u8 p; l
  11211.     );if$ _, t* @5 y/ V& p; I; A/ m
  11212.     (if (not (= 1 (logand 1 eflag)))
    4 v3 w, H! S  o; t2 |
  11213.         (progn
    8 T& v+ }3 {/ c
  11214.          (mode_tile "poly_wid" 1)
    : K5 Q/ W6 k2 J  s
  11215.          (mode_tile "poly_elev" 1)- Y( o( h) P3 R$ x) W# X5 V& a  R( `& p
  11216.         );progn then disable polyline fields& C" X' D2 _3 L
  11217.     );if8 ^" [5 K( l9 h7 u4 P

  11218. 0 c- L; N% A, n. W: }: `
  11219.     ;; Define action for tiles& Q' v6 O' G* p5 i2 }* a! q
  11220.     (action_tile "b_color" "(setq ecolor (getcolor))"); B! X' y8 J/ J. t4 Z, @+ _
  11221.     (action_tile "show_image" "(setq ecolor (getcolor))")6 [9 b* C( [0 ~7 _* w; B# ^! }7 U
  11222.     (action_tile "b_name" "(setq elayer (getlayer))")
    $ n: O$ V1 |( p. \/ f
  11223.     (action_tile "b_line" "(setq eltype (getltype))")
    9 X3 H6 X! V8 o4 \+ g, |
  11224.     (action_tile "eb_ltscale"  "(getscale $value)")
    , k& T# o4 D7 J; \9 c0 z
  11225.     (action_tile "eb_thickness"  "(getthickness $value)")
      @1 A2 o9 l# g% H
  11226.     (action_tile "poly_wid" "(getwidth $value)")  U& B: e* D! e7 x
  11227.     (action_tile "poly_elev" "(getelevation $value)")
    / k7 B" ]0 v) @
  11228.     (action_tile "text_hgt" "(getheight $value)")
      Q1 }5 b4 y; O/ y& k$ a7 A$ x2 b
  11229.     (action_tile "text_style" "(getstyle $value hair_style_list)") . _$ w* p9 X( F1 Y8 m
  11230.     (action_tile "help" "(help \"AC_BONUS.HLP\" \"EXCHPROP\")")9 q6 K' Q" W, Z; l& M
  11231.     (action_tile "accept" "(test-main-ok)")
    * u3 F1 G( g& b) E

  11232. 4 A7 K* q) L2 A
  11233.     (if (= (start_dialog) 1)
    1 \! @3 z2 p) s8 s7 j% [, n5 I* w; l: y
  11234.       (progn7 z# b4 N) }# z- o  z
  11235.         ; Update special properties for polyline and text selection-sets.
    4 x5 ^$ S. m# a% f& V- P( s
  11236.         
    ( a% r7 U- o8 ~2 J" }" x) S" Z3 o7 U
  11237.         (if (and (= 1 (logand 1 eflag))   ; polylines rk chprop
    7 S3 x, ]: B: X+ X4 O% U
  11238.                  (or ewidth! y; k4 E, t2 {. {  ~8 g$ W' m
  11239.                      eelevation
    ! G$ V3 p6 h3 V0 P6 G+ {4 E) ~* v4 `
  11240.                  );or
    7 l4 o; x8 U2 J2 D( H
  11241.             );and
    7 [8 K* {; k! k  W6 G( x( m3 t( m
  11242.             (progn
    1 S" Q" v' r/ Z0 `1 k
  11243.              (setq  ss-index 0 * e4 ~: \3 h: @1 T7 ]/ M% d3 l
  11244.                    ss-length (sslength poly_ss)+ I. T7 Y  P, p& p: {* |
  11245.              );setq
    7 C, q6 {2 c3 @% r# u
  11246.              (while (< ss-index ss-length)( w/ p7 x$ q! R7 o+ ]# m% M1 ]5 n
  11247.                (setq ename (ssname poly_ss ss-index)
    1 p$ L, E7 S6 y3 G
  11248.                      elist (entget ename)
    / u2 h5 e, \1 {% @4 l
  11249.                );setq
    2 a, \! A4 g1 X3 }) Y
  11250.                (ucs_2_ent (cdr (assoc 210 elist)));this function lives in ac_bonus.lsp) M+ ]( h$ z: }- c
  11251.                (if ewidth 5 D7 A6 E/ z0 H/ n, t* ?
  11252.                    (command "_.pedit" ename "_W" ewidth "_x")+ R- W( W4 [7 S0 D/ U
  11253.                );if
    + i0 y5 l; v" x& G) a
  11254.                (if eelevation % b0 n8 G$ Q0 f/ A2 n' L: g
  11255.                    (progn* j$ A4 a1 A2 ~+ x$ f; ^$ \6 y
  11256.                     (setq p2 (list 0.0 0.0 eelevation));setq( U/ E! s8 p0 U# ]0 `: M) D: a
  11257.                     (if (equal (cdr (assoc 0 elist)) "POLYLINE")
    ! e, g4 C6 L1 V  c. z4 c
  11258.                         (setq p1 (list 0.0 0.06 y$ E  t. O2 X+ X1 @2 c
  11259.                                        (caddr (cdr (assoc 10 elist)))
    " W5 C+ F$ X- T( `0 p. y3 Q7 C% N; }
  11260.                                  );list  S: a. U7 t. X  ~
  11261.                         );setq
    - w8 n$ |6 f. o: k/ y! I
  11262.                         (progn( u9 D, I7 W8 W0 }" D2 G3 n3 f3 J3 ]
  11263.                          (if (assoc 38 elist)0 n3 O6 m( s  E* j$ S; |
  11264.                              (setq p1 (list 0.0 0.0" q9 M" d, \7 c% z* K
  11265.                                             (cdr (assoc 38 elist))
    7 j6 u0 D! T. n( X2 a( z
  11266.                                       );list
    3 v5 m' m# V' ~
  11267.                              );setq
    ) L5 h" r: O1 u  L0 Z5 |1 [
  11268.                              (setq p1 '(0.0 0.0 0.0)). K. v3 }3 \: U; c1 |7 g" X' V& `
  11269.                          );if
    ' f% F7 b6 s' z: \
  11270.                         );progn 3 U: y7 z8 _& W( |& f6 s+ k2 X
  11271.                     );if
    : o9 H' h3 k  e3 R, Y3 w: ]
  11272.                     (command "_.move" ename "" p1 p2)8 Q: X- _% p, a
  11273.                    );progn then change the elevation of the polyline
    7 j* b' m) ]- ?6 i  M; x, Z) M
  11274.                );if9 e1 j3 u5 U& \' @5 |3 J& Q. d$ [; m
  11275.                (command "_.ucs" "_p")
    ; J) d5 s& Z; f9 W# U5 E
  11276.                (setq ss-index (1+ ss-index))
    / D" x- c' z  U- G/ L5 f
  11277.              );while" a- e3 p' `, W: Q% I0 P! s7 |
  11278.            );progn then polylines are in the selset. W' k4 o- T; }; K4 c9 m6 D
  11279.          );if7 p. _# R4 E$ r+ c1 Y9 ^" t: E3 R3 A
  11280.          (if (and (= 2 (logand 2 eflag))     ; text
    , k4 O& x( h1 v3 F# o+ n" X0 b, {$ ~
  11281.                   (or eheight / x. j% t$ F2 N: ]# y& G2 ?
  11282.                       estyle
    % B0 |' |& c* y  L1 B5 h
  11283.                   );or
    ) `" \0 |8 o* C& \- R/ @
  11284.              );and9 l+ ]  c' J' J+ T" K
  11285.              (progn! b6 `. W* C; _: c6 ^$ @
  11286.               (setq ss-index 0 ss-length (sslength txt_ss))+ h, i1 @6 F) \' o! s
  11287.               (while" U8 _5 E1 E* D+ Y1 t4 u( q& v1 x
  11288.                 (< ss-index ss-length)
    5 ]; F8 E9 x$ o0 ^$ E. ^
  11289.                 (setq elist (entget (setq ename (ssname txt_ss ss-index))))
    * Y+ a6 t: _; g$ D% m" R+ w9 d, ?
  11290.                 (if (numberp eheight)( R' h7 V2 k" o4 ?7 }7 d
  11291.                     (setq elist (subst (cons 40 eheight)
    3 n" @+ D& z3 y
  11292.                                        (assoc 40 elist)" E9 X% \. F9 \4 z- u5 i
  11293.                                        elist
    , c( O- p+ Q3 Z7 Q  |. c- K+ h8 E) }
  11294.                                 );subst) u0 y8 n- C: v2 W; g$ V
  11295.                     );setq
    ( Z/ G. e: L" v8 O; m
  11296.                 );if
    : `4 Z$ `" g+ M) _) F
  11297.                 (if (and estyle ;(not (equal estyle ""))* j# z6 N$ u$ \# K
  11298.                          (not (equal estyle (cdr (assoc 7 elist))))
    - j) y+ P. E# z' ?
  11299.                     );and
      W3 @; |3 d. l) A( q
  11300.                     (progn  
    " R6 e- w& I$ K' o/ {/ p- u
  11301.                      ;rk. This needs to be implemented as per mtext font issue in                                                                                                          ;    ddchprop_notes.txt $ O( u( x; C8 z- O5 A
  11302.                      ;(if (equal "MTEXT" (cdr (assoc 0 elist)))3 ?! @. K" q/ U4 W9 M" L5 u5 w( Y
  11303.                      ;    (setq elist (fix_mtext_fonts estyle 3 o! h9 g4 \# i- ]& L2 |
  11304.                      ;                                 elist
    + L/ ~. q4 N- T- J+ f
  11305.                      ;                )
    , \5 W$ q  Y$ \+ f& G
  11306.                      ;    );setq then- u. o" w+ m3 L( Y8 c9 w% @
  11307.                          (setq elist (subst (cons 7 estyle)
    " `) y+ |' G2 W: U- m* K7 G
  11308.                                             (assoc 7 elist)
    ' d  S. q' V/ k% V0 g0 ~0 X
  11309.                                             elist. E* v+ U  ]4 x8 o2 X1 I+ N' k
  11310.                                       );subst$ e4 q8 }% m; c& X6 b0 J
  11311.                          );setq else3 _9 c, Z$ @! ]: E
  11312.                      ;);if
    # ^  g) l( E4 r
  11313.                     );progn% }* s5 w$ x/ Q" L) R8 p# l
  11314.                 );if
    4 Z" l& P$ x' P5 x2 U
  11315.                 (entmod elist)& }0 ~7 G3 _) D# Y/ E
  11316.                 (setq ss-index (1+ ss-index))
    , l6 V* c. \$ _0 M6 z3 `- R4 g2 b
  11317.               );while
    ' t; H, u& @3 K1 N6 K
  11318.              );progn then8 J+ n% z, _/ w9 ~3 s1 k
  11319.          );if
    $ |: u; H: |2 e: l

  11320. 4 K$ e* |0 q1 F. n, d- Z
  11321.         (setq cmdact (getvar "cmdactive"))
    ) m* J0 I/ G  W9 s! Z3 a
  11322.         (command "_.chprop" ss "")
    : e% @0 p7 R& I5 {6 d# _! Y# H
  11323.         (if (/= cmdact (getvar "cmdactive"))  ; Is CHPROP actually running?) `) z0 O" ^4 J  u
  11324.           (progn
    ! {, w; h8 H8 h, x) X5 Z
  11325.             (if ecolor
    * E0 f6 }& U) x( ?0 d6 q, S$ P
  11326.                 (progn
    1 \$ m3 N% Z* e, Y
  11327.                  (if (= 0 ecolor)   (setq ecolor ;|MSG0|;"BYBLOCK"))
    9 \: Y, y( {; e0 f1 S+ C$ n' B# V
  11328.                  (if (= 256 ecolor) (setq ecolor ;|MSG0|;"BYLAYER"))
    9 J  s% e9 d( M! }/ S
  11329.                  (command "_c" ecolor)
    * ~) j9 Y9 [8 l( a' m/ U
  11330.                 );progn then
    ' K9 C: o  S6 ]- F
  11331.             )& F. h) X* H" W: I. d
  11332.             (if (and lt-idx
    5 B6 m$ I: A) R
  11333.                      (/= eltype ;|MSG0|;"Varies")- M6 ^/ d% {* S
  11334.                 )  r1 @, F* `8 @1 z- j
  11335.                 (command "_lt" eltype)
    # O3 o) \. g) X" W2 `; |
  11336.             )6 w9 U# x0 [' l( B( m3 {% o
  11337.             (if (and lay-idx
    5 O6 X5 j" o6 v- H2 x5 X
  11338.                      (/= elayer ;|MSG0|;"Varies")
    # u  w. e$ C6 V7 @+ d
  11339.                 )
    3 B  \6 g! L  N# I
  11340.                 (command "_la" elayer)  j. X& X; e5 A$ j
  11341.             )
    % }" x& ^& C/ y
  11342.             (if (and ethickness
    2 N+ G. M  W* H
  11343.                      (/= ethickness "")' x1 N/ D% j8 O, b! U$ r
  11344.                      (/= ethickness "Varies")
    7 E9 X7 d' I# `  |2 w$ x
  11345.                 )$ [0 u3 D. |# a0 V
  11346.                 (command "_t" ethickness)
    8 v$ A) O# W# e
  11347.             )
    2 ]& z+ N/ b) \- V9 x: x- f5 T
  11348.             (if (and  eltscale (/= eltscale "")). n. r8 K) V& ^; R! g
  11349.                 (command "_lts" eltscale)4 P2 n! w  H( c9 G- h% o
  11350.             );if
    & q( {1 ?" @- c1 ]2 J
  11351.             (command "")
    3 ^2 O2 d3 m2 |+ M( e( n
  11352.           )
    ! s; M) z  L4 \. @& l3 l9 P, p
  11353.           (princ "\nProperties unchanged")  ; CHPROP didn't like our SS set
    8 ]8 |% _' [( s) D( J) {  h/ k
  11354.         )
    . l" @4 S5 G! D% u

  11355. 5 d. w# `" h3 J7 }& I9 g" R
  11356.       );progn then OK was picked in the dialog.  O$ B4 D! s6 o! G+ K# s% E5 O
  11357.       + @9 N9 u0 \: h+ @9 p
  11358.       ;; Fred GERBER - 25-AUG-94  q! W  b- j8 F. H
  11359.       ;; Don't print the "Properties unchanged" message when the user cancels& P( g5 |# g6 T  w  s+ v' Z% z6 q
  11360.       ;; the dialog because he knows that already (otherwise he would have4 A! S3 B5 z6 k- `0 R( Z
  11361.       ;; hit the "OK" button). Display the message only if CHPROP fails for
    ! V4 M6 e. d5 z- A0 R
  11362.       ;; some reason, because it is not the expected behavior of the command.
    , p8 X: b( B- f2 d8 w; O2 e" Q
  11363.       ;;7 H3 }! z% e6 f% q* Q1 q
  11364.       ;; (princ ;|DDCHPROP2_LSP_8|;"\nProperties unchanged")) O, A. ?7 \* R
  11365.     );if
    5 v* ]) k: W, q" A
  11366.     (princ)
    0 J! ^# \5 W% W0 Y! v9 p( o
  11367.   );defun call_chp2  g- ?$ S) ?6 j5 I2 n
  11368.   ;;: G* U$ m/ z' j( K6 q9 w( c
  11369.   ;; Function to set the Color text tile and swab to the current color value./ r( w( {' v; d8 ^$ N5 ]
  11370.   ;;
    ! U: a! ~+ d  ]0 Z! s1 |$ r+ }6 ?4 O4 N
  11371.   (defun set_col_tile()' u4 D& V& y, z" j1 v
  11372.     (cond
    9 I/ T9 W% t8 Q5 {* G
  11373.       ((= ecolor nil)
    3 r, T: ?1 o7 L2 l8 [: d. M# t
  11374.         (set_tile "t_color" "Varies")2 p- z/ O! [& ~* e5 E& S
  11375.         (col_tile "show_image" 0 nil)/ D* ^" X8 B2 D& C4 R
  11376.       )
    ( A& {( j  S/ {. K9 h
  11377.       ((= ecolor 0)
    $ h* I/ |; ?* J3 h7 O3 K; x
  11378.         (set_tile "t_color" "BYBLOCK")
    # }8 v5 x5 p. W8 k5 `8 @
  11379.         (col_tile "show_image" 7 nil)    ; show BYBLOCK as white
    ' I. K' ~  e, e1 Q
  11380.       )
    ! i" ]! m5 t$ n
  11381.       ((= ecolor 1)
    6 K! f4 f, Y3 q: w4 D( D
  11382.         (set_tile "t_color" "1 red")# P% i' O1 G5 q9 F8 I1 P" U
  11383.         (col_tile "show_image" 1 nil)
    # T- C# l4 n* r/ t8 z, j# {; j
  11384.       )% z, P% A% N7 g1 z
  11385.       ((= ecolor 2)
    1 L2 M: f7 F+ M1 w1 J& d" X& B8 _
  11386.         (set_tile "t_color" "2 yellow")" V1 W& o( {8 ?& L7 v1 w
  11387.         (col_tile "show_image" 2 nil)
    * P+ ~4 \: r/ T: h! u: _" ?) Y
  11388.       )  p% _" B4 ^+ a% n% J# N8 s
  11389.       ((= ecolor 3)# T: \, `3 k: V. l* y/ G3 z
  11390.         (set_tile "t_color" "3 green")
    ! t8 G1 G; L: o# ]) W
  11391.         (col_tile "show_image" 3 nil)9 J* H9 S7 H! |" ]- ?* }+ V, \
  11392.       )
    9 r: ?  m' s8 b5 k
  11393.       ((= ecolor 4)
    2 y: @' {. S- I0 W% C
  11394.         (set_tile "t_color" "4 cyan")" q( M, Y7 r1 m' ?
  11395.         (col_tile "show_image" 4 nil); D  P; a" ]% S; Z9 T6 a8 b* U0 R& [
  11396.       )
    9 n5 A% H4 E' P# r& m, n% r
  11397.       ((= ecolor 5)# i/ M) F4 a  H; U: }1 z  R
  11398.         (set_tile "t_color" "5 blue")& c, R* e' B% K6 x3 T: J% j9 i
  11399.         (col_tile "show_image" 5 nil)2 s0 r* r1 G6 l4 {5 ?
  11400.       )* g, M) D0 l6 j( e
  11401.       ((= ecolor 6)
    9 h0 e, J5 @4 H% O( h
  11402.         (set_tile "t_color" "6 magenta")
    5 O; D0 s5 ~/ b2 j; ]9 `
  11403.         (col_tile "show_image" 6 nil)
    " C( u1 ]4 V. }0 q
  11404.       )
      `$ X! @: ]6 Y/ E' ?
  11405.       ((= ecolor 7)+ ~# J& e; ?! X6 p2 c4 D
  11406.         (set_tile "t_color" "7 white")1 D+ E0 n. l5 C8 S$ a1 P  K6 F( Y
  11407.         (col_tile "show_image" 7 nil)
    , @$ @9 e8 F; Q. A9 [
  11408.       )3 \" i  Z2 ]0 v/ B" o5 j6 v
  11409.       ;; If the color is "BYLAYER", then set the tile to
    0 C$ l& M9 G$ [1 p; ]# j+ S" r
  11410.       ;; show it's set By layer, but also indicate the
    ( g% R4 [) Z7 f4 [7 @
  11411.       ;; color of the layer - i.e. By layer (red)
    2 R- G7 K5 m3 O
  11412.       ((= ecolor 256)! y* i; `$ B2 C5 r% L5 f
  11413.         (set_tile "t_color" (bylayer_col))6 Y! C3 d; D& Y
  11414.         (col_tile "show_image" cn nil)$ y6 x- @3 s; J# K: c) D% U
  11415.       )$ m- D( `, C) l& b
  11416.       (T
    ' B3 t! @; c  B% ~9 S2 v( d
  11417.         (set_tile "t_color" (itoa ecolor))
    . d  ~+ H5 R# `! n2 L9 x; I
  11418.         (col_tile "show_image" ecolor nil)* d' I' W1 R! k; U6 F, ~- V
  11419.       )% F+ j6 M! Q9 L, t' R6 M) O. T
  11420.     )
    ; O5 S6 a" k( Z, l
  11421.   )( ?* J, e2 \7 H+ O% P* k
  11422.   ;;
    7 j) T6 }+ z1 y6 a  q
  11423.   ;;  Function to put up the standard color dialogue.1 w0 ]; e% Q- k; f
  11424.   ;;: u3 n5 d$ E* r1 a) t
  11425.   (defun getcolor(/ col_def lay_clr temp_color)
    $ s% c7 c9 U) C* `, k
  11426.     ;; col_def is the default color used when rq_color is called.  If ecolor
    & ~& X5 ^2 Z- D! e8 B9 E+ O
  11427.     ;; is nil (varies) then set it to 1, else use the value of ecolor.4 L* O3 n2 I" b; \- l4 Q1 d
  11428.     (if ecolor! d1 m- |+ Q, Q+ |+ Q2 K
  11429.       (setq col_def ecolor)7 K/ m0 D) Q) R7 B- U, E/ X
  11430.       (setq col_def 1). q/ }% x/ s0 g  @7 Q9 P  y
  11431.     )
    ' P8 M) r/ M! A: c, W

  11432. ; V6 J) Y9 n# {* [6 D7 ?# J
  11433.     ;; If we're working with a single layer, get its color9 `7 ^- z2 ]' F3 c& W% P0 t1 _
  11434.     ;; for use in the color swatch if the user selects color BYLAYER.
    5 Y7 b$ A" p" J; ^) d. V! _+ b1 d
  11435.     (if (/= elayer ;|MSG0|;"Varies")) M, F: e1 |  g" x: F
  11436.       (setq lay_clr (cdr (assoc 62 (tblsearch "layer" elayer))))" W& {5 a1 l. L6 y8 H3 O8 e2 ]
  11437.       (setq lay_clr 0). l/ }9 p$ S- |# V* s) V
  11438.     )# b) p: y5 C% w5 a* F! x
  11439.     (if (numberp (setq temp_color (acad_colordlg col_def T lay_clr)))* I. K. Q. c0 i0 v
  11440.       (progn  J* R6 f1 V/ O( k# O1 J; R
  11441.         (setq ecolor temp_color)1 P6 Z+ A" C% o' F8 ?1 M5 ^
  11442.         (set_col_tile)
    * m8 V6 V+ ^3 ^' y1 L: o
  11443.         ecolor
      v3 g# U& S( c' W
  11444.       )
    . D* e) }) a% E& _3 T6 G. J$ R
  11445.       ecolor
    4 m( T7 ?; Z; Z" i0 y3 P+ V, S$ ^
  11446.     )% u, Z, ^8 a3 ?
  11447.   ); P7 m1 N1 ~6 V3 f
  11448.   ;;! w9 f; G1 ]9 C* V/ B
  11449.   ;; This function pops a dialogue box consisting of a list box, image tile,
    0 }& }  |6 y3 r
  11450.   ;; and edit box to allow the user to select or type a linetype.  It returns
    . h# K% H- @' c+ p1 P7 J# p
  11451.   ;; the linetype selected.% m, O% H: l. }5 M' Q( {
  11452.   ;;
    7 x" U( W/ ~7 I3 \; [# f& _
  11453.   (defun getltype (/ old-idx ltname); r6 I1 Y9 a9 f9 I/ x4 j  q
  11454.     ;; Initialize a dialogue from dialogue file6 f/ k+ Z3 Q% a+ ]
  11455.     (if (not (new_dialog "setltype" dcl_id)) (exit))
    7 H; |) b( [& J! d9 e8 D
  11456.     (start_list "list_lt")3 o! v; I0 u  S& u  z5 ?- E
  11457.     (mapcar 'add_list ltnmlst)         ; initialize list box
    $ q# M1 v* i+ @2 b+ S- Z3 @! c
  11458.     (end_list)
    # Y3 Y$ _! x% n) O& P% w
  11459.     (setq old-idx lt-idx)
    ; s0 m# s: p9 y$ B  R* J
  11460.     ;; Show initial ltype in image tile, list box, and edit box
    0 M5 P3 _% F- ^0 O- E2 d  }9 S" Z* ~/ Q
  11461.     (if (/= lt-idx nil)/ O' B8 _/ ]% x" b3 C- O
  11462.         (ltlist_act (itoa lt-idx))' a+ N4 o0 J: Z" X% t3 B9 n
  11463.         (progn
    ' C. X& U' o4 F5 |
  11464.          (set_tile "edit_lt" "")
    # t: _7 J! Q& K& s+ |
  11465.          (col_tile "show_image" 0 nil)
    7 Y+ n3 v+ \2 n6 e; f' _9 X
  11466.         );progn else6 ?, g/ C: I5 W$ Q9 ^4 V  O# E, p
  11467.     );if5 C/ F( _8 |4 I# E/ H
  11468.     (action_tile "list_lt" "(ltlist_act $value)")
    . U- }" |$ S# v$ F5 ~: N1 Z" E
  11469.     (action_tile "edit_lt" "(ltedit_act)")# L) F( ~0 M, z* z& X9 c
  11470.     (action_tile "accept" "(test-ok)")
    2 b* j) h2 l1 @& A& J/ M5 C2 h3 b7 m
  11471.     (action_tile "cancel" "(reset-lt)")( G; |: \# p1 s4 M2 s
  11472.     (if (= (start_dialog) 1)           ; User pressed OK8 I4 a0 N  |- e
  11473.         (cond2 @$ a5 ~& e+ J6 ]% L2 o" p
  11474.          ((or (= lt-idx nil)
    - B% o5 e5 i: e6 g
  11475.               (= lt-idx (1- (length ltnmlst)))7 G5 p; l2 d6 C! V
  11476.           );or
    $ _8 h1 H# ^* t
  11477.           (set_tile "t_ltype" "Varies")- N5 v. Q+ p0 O
  11478.           ;|MSG0|;"Varies"
    - o3 J0 k  Q# B- l
  11479.          )! A& w) y* Z& X, C% }! s, X
  11480.          ((= lt-idx 0): V. U* g% s, y, }& d
  11481.           (set_tile "t_ltype" (bylayer_lt))
    , ^- f8 ^& {% h& @
  11482.            ;|MSG0|;"BYLAYER"' P" N! F4 w7 X5 f9 z% j
  11483.          )( z4 ^" L2 E) u  I8 {1 s% o
  11484.          ((= lt-idx 1)6 W4 W3 D* t* S! `
  11485.            (set_tile "t_ltype" "BYBLOCK")
    & L, |' ?9 M# e" E+ Y
  11486.            ;|MSG0|;"BYBLOCK"
    ( P9 [5 V/ M4 w" x
  11487.          )9 }- Y/ t9 z1 o: W1 `  z
  11488.          (T
    4 ]. o4 a& W2 U0 e9 h* v( Q4 \
  11489.            (set_tile "t_ltype" ltname)
    , x2 A. _5 e) u$ \% ~  p& w
  11490.            ltname
    ! z4 L3 t2 {0 q. {6 p
  11491.          ); M, p; c. Y/ e9 M
  11492.         );cond then2 q8 ]7 n8 [( i9 F. z0 q' X: |9 |
  11493.         eltype
    " g, d1 t& R/ a7 n
  11494.     );if
      o1 B  b4 }$ \9 ]: f
  11495.   );defun5 O+ W% m9 v9 R- ^2 l
  11496.   ;;
    7 y3 b8 m( Y1 k& \; Q
  11497.   ;; Edit box entries end up here7 V4 w- N) C8 f' c. g6 p% _
  11498.   ;;
    * K4 b2 J" `+ D
  11499.   (defun ltedit_act ( / flag)
    3 H8 x- ~  Y# C- |0 T/ d' A& y* f
  11500.     ;; If linetype name,is valid, then clear error string,* |: d2 _2 ]! @, \6 U) r
  11501.     ;; call ltlist_act function, and change focus to list box.: Y4 R( T+ J3 }, R
  11502.     ;; Else print error message.% h2 C2 q4 s: ]" x9 p; C6 o- w
  11503.     , N$ I$ ?* p  l8 {
  11504.     (setq ltvalue (xstrcase (get_tile "edit_lt")))
    5 z6 N- c3 S3 m( Z% ~# i" ?9 ?/ V
  11505.     (if (or (= ltvalue ;|MSG0|;"BYLAYER")
    5 P, j+ C8 \9 m7 @5 z9 X
  11506.             (= ltvalue "BY LAYER")$ n6 p9 o* c" S- j; ]) q$ z
  11507.         )
    * H+ Z# {  l# M
  11508.         (setq ltvalue "BYLAYER")3 v: j+ Z6 u/ `# R! m# J( T
  11509.     )
    : ?. t3 {& R* S0 C+ w
  11510.     (if (or (= ltvalue ;|MSG0|;"BYBLOCK")- w* x- Y" G6 ~1 C8 U
  11511.             (= ltvalue "BY BLOCK")
    6 }9 f# I8 _7 u# J3 D- R
  11512.         )
    * S* c0 i9 J/ X- V5 `$ Y6 M  j( T
  11513.         (setq ltvalue "BYBLOCK")( x& P; O. T9 b( B( g* M0 T+ e' O
  11514.     )
    1 K! x% d, U, j7 w
  11515.     (if (setq lt-idx (getindex ltvalue ltnmlst))
    4 V! Q, U, d. @6 Y; ?% c  r. d
  11516.         (progn' [  k8 W' y5 w4 q" M
  11517.          (set_tile "error" "")
    ( P9 P- v/ P, @3 v0 B7 K
  11518.          (ltlist_act (itoa lt-idx))
    - Z( a. B. W% ~6 z2 H
  11519.          ;(mode_tile "list_lt" 2)! r  N" L3 R0 P- `  q5 N' H$ t
  11520.         );progn then
    * d' U7 i6 i1 w( n% Q
  11521.         (progn# i$ S+ H. R5 m4 R+ i
  11522.          (if (/= ltvalue "")* s6 o) J$ N" h+ @6 g
  11523.              (progn
    # @& r) L' H1 R
  11524.                (set_tile "error" "Invalid linetype.")$ G/ i- s- o6 P* r! S% D
  11525.                (setq flag T)
    " [1 ^/ e7 i, _* F# `3 y3 \2 K
  11526.              );progn+ Y( S  G" F; E* N; E" O: _
  11527.          )! ]7 r3 u  q7 H2 l* w
  11528.          (setq lt-idx old-idx)
    * h0 _" ^/ j1 C* a
  11529.         );progn else
    - C7 q' r8 L8 h  ?' A3 u+ O. T
  11530.     );if
    # d: D, N2 z* y$ ~
  11531.     (if (and (not flag) ;added so a return will take you out of the dialog.
      f6 y$ Z0 p/ f6 E
  11532.              (= $reason 1)
    5 ~$ a* u* s6 L: |# l/ u4 N# F
  11533.         );and% q: d/ L: c- t* S
  11534.         (done_dialog 1) 8 X' ?5 G/ F# k" C$ ~
  11535.     );if
    * E: F/ G. i- K3 q$ L
  11536.   );defun ltedit_act! \1 y) z; _. i4 Y
  11537.   ;;2 E4 J/ Q9 ?* _  E( B  T- [& S
  11538.   ;; List selections end up here
    " K" H% R5 Y5 u& _6 Z
  11539.   ;;
    ( Z5 X& e% ^+ l5 P; F
  11540.   (defun ltlist_act (index / dashdata)5 k, P9 w4 I( x# D. s$ Z
  11541.     ;; Update the list box, edit box, and color tile
    9 J% y# g/ r1 f& r2 ?+ w
  11542.     (set_tile "error" "")
    - j- J9 x" B6 J, Y; L
  11543.     (setq lt-idx (atoi index))
    ' b# {4 h8 Z2 F, p0 W& m$ Y
  11544.     (setq ltname (nth lt-idx ltnmlst))
    6 F8 I; T9 f/ p, S
  11545.     (setq dashdata (nth lt-idx mdashlist))) x4 q! Q* y# @! g; F. F. f
  11546.     (col_tile "show_image" 0 dashdata)1 B0 k+ q8 q" ]2 I( @
  11547.     (set_tile "list_lt" (itoa lt-idx))1 b; v6 M  f7 D/ r6 ~
  11548.     (set_tile "edit_lt" ltname)
    5 s* |( n( x, N8 z
  11549.   )
    , X9 ~( B6 W" m& I1 Z* S
  11550.   ;;+ w& ?* z1 S# r" {2 S
  11551.   ;; Reset to original linetype when cancel it selected4 e5 z1 G" `: N" F6 n) p
  11552.   ;;
    8 {, Y0 c: j( o/ H2 ]8 b6 o
  11553.   (defun reset-lt ()
    / T/ u& H  }  ^6 Y6 A% C, P* x
  11554.     (setq lt-idx old-idx)
    , O- Z7 z! q. R: H/ b! Y
  11555.     (done_dialog 0)
    : |4 l! j6 H- ~' G: k  w
  11556.   )" A4 X2 K+ h1 Y, r
  11557.   ;;
    0 C1 y( s2 p; U- m* J* l: |6 n1 @
  11558.   ;; This function pops a dialogue box consisting of a list box and edit box to0 C3 ~- }" h$ f1 R  }+ Y
  11559.   ;; allow the user to select or type a layer name.  It returns the layer name2 V$ G* j" ?+ U+ L) A7 A
  11560.   ;; selected.  It also the status (On, Off, Frozen, etc.) of all layer in the
    + G0 i5 n" X+ v7 P: I( i% e
  11561.   ;; drawing.
    ! i# H3 f% P9 d4 f7 f5 m
  11562.   ;;( q. t; ~' I) V( c4 r
  11563.   (defun getlayer (/ old-idx layname on off frozth linetype colname): n  e5 p+ J5 e, X
  11564.     ;; Create layer list the first time the layer6 B- d9 C" b/ ]
  11565.     ;; dialogue is called.) d. x6 Y8 X- R* ^) O( t
  11566.     (if (not lay-idx)$ q5 f; X% _  a8 M) q: z5 r4 d# S
  11567.         (progn
    8 |  \! Z6 v- e( B
  11568.          (makelaylists)                     ; layer list - laynmlst
    9 \0 J& m4 f4 f1 ]
  11569.          ;rk
    $ f- e9 C7 M% K, y) G
  11570.          (setq lay-idx (getindex elayer laynmlst))
    7 `) a" y; E* Z! R/ j/ t
  11571.         );progn: d& ^; m( i9 m2 P$ W
  11572.     );if  P0 f5 |2 P) s5 h+ A! T- ^9 }
  11573. : R/ _" |7 K; {: R- `) N' w: Z
  11574.     ;; Load a dialogue from dialogue file6 s" s3 {6 ^! M' c  e9 V
  11575.     (if (not (new_dialog "setlayer" dcl_id)) (exit))& A% A3 c3 l6 B0 o( k; D1 P$ r
  11576.     (start_list "list_lay")! r% o* n$ P3 S
  11577.     (mapcar 'add_list longlist)        ; initialize list box' t, D1 K; S% L9 }
  11578.     (end_list)
    : D' _: Q6 {- S' u) G% ]
  11579.     ;; Display current layer, show initial layer name in edit% K: v7 L1 p! y: Y
  11580.     ;; box, and highlight list box.8 S' B7 e+ C) K5 _# p
  11581.     (setq old-idx lay-idx)
    # j2 U! n* \- h+ j3 A+ `
  11582.     (if (/= lay-idx nil) (laylist_act (itoa lay-idx)))& H  N! d2 Z# Z" F  H+ k
  11583.     (set_tile "cur_layer" (getvar "clayer"))
    0 @% x$ X! D1 K$ L% S; p& P$ E/ X
  11584.     (action_tile "list_lay" "(laylist_act $value)")
    0 P4 l3 O/ X; J/ W( N) @
  11585.     (action_tile "edit_lay" "(layedit_act)")1 B3 E6 t" Y9 X( h' ^: {
  11586.     (action_tile "accept" "(test-ok)")
    , w, D- C" b8 R4 g* y4 r
  11587.     (action_tile "cancel" "(reset-lay)")
    " \- |5 ~5 y% w: L
  11588.     (if (= (start_dialog) 1)           ; User pressed OK- ^% w4 P- k, }/ O% A
  11589.        (progn
    ; m0 c  X4 J# ?% |4 C
  11590.          (if (or (= lay-idx nil)
    3 p0 Y# t( i: P
  11591.                  (= lay-idx (1- (length laynmlst)))
    7 R  ~) k& P( i/ [+ A) w3 a
  11592.              );or+ \: J& N8 e+ [1 H8 v" @# N& F
  11593.              (progn
      b1 d' O) F+ w; Y  w) H, I
  11594.               (setq lay-idx nil)  0 h$ \! _# q  z7 D5 w. o8 k! u
  11595.               (setq layname ;|MSG0|;"VARIES")6 s3 O8 i. J5 \
  11596.               (set_tile "t_layer" "Varies")2 y4 O4 K/ q6 X1 g# y
  11597.               (setq layname "")8 Q( V- Z7 O. f# N) v, L* _" B/ F
  11598.              );progn5 }+ ?+ r# C/ |, M* J% D
  11599.              (set_tile "t_layer" layname)
    " s3 I8 h3 Y0 e) [( C9 B0 `
  11600.          );if
    " n7 L1 {9 T) K2 ]; A( U# ]
  11601.          ; If layer or ltype equals bylayer reset their tiles9 _9 x0 E; S: v6 l# `/ \1 p
  11602.          (if (= lt-idx 0)& ~+ P1 B* {8 C' t. K
  11603.              (set_tile "t_ltype" (bylayer_lt))% j* G, `; q1 [4 K1 S& G6 ?
  11604.          );if9 L- g2 M5 X1 T) k+ L. t& z& _7 o
  11605.          (if (= ecolor 256)
    ; a: N# L) h; m6 Z) U$ }# Z
  11606.              (progn
    7 W1 F, Y* o4 o  k6 p4 _7 v
  11607.               (set_tile "t_color" (bylayer_col))
    ( r5 R( F; h) D$ o4 {, C" f
  11608.               (col_tile "show_image" cn nil)! K: j& g6 n2 H# Q" r3 Z
  11609.              )
    * z' h' g3 v" a/ D& C! M
  11610.          );if6 ]4 r4 z& Q+ |0 s
  11611.          layname
    7 p0 |8 W9 i- D& n
  11612.        );progn$ I# [0 {( R  @# e$ ?' _- i! D
  11613.        elayer1 f$ J' S8 a  C. }8 t& }
  11614.     );if
    2 n) d; X+ L" F* {; [8 A
  11615.   )
    % m' w% Q2 a- `7 D
  11616.   ;;! x' b! c( B& @+ H6 f( i
  11617.   ;; Edit box selections end up here4 I8 o# n& W8 ^' x  H3 o6 z
  11618.   ;;
    ; U5 B: Q5 s, A6 _% Z. v2 w
  11619.   (defun layedit_act()
    ! O. U3 o# n: O( ]
  11620.     ;; Convert layer entry to upper case.  If layer name is
    7 ]# T1 x& a! ~. W) E  G9 C
  11621.     ;; valid, clear error string, call (laylist_act) function,
    $ V6 J  [" G2 p. y6 _
  11622.     ;; and change focus to list box.  Else print error message.
    % v, n+ h, |& d  k
  11623.     (setq layvalue (xstrcase (get_tile "edit_lay")))
    , `7 l1 D* r( F  Y" Z0 N
  11624.     (if (setq lay-idx (getindex layvalue laynmlst))3 F3 U) K' A5 S  D9 P" G$ i8 R
  11625.         (progn2 ?% _. L7 k/ K, @8 o) \/ D
  11626.          (set_tile "error" "")
    2 \8 b' X: x. Y
  11627.          (laylist_act (itoa lay-idx))
    / L* `# Q; r/ l, D/ n7 }  `3 l
  11628.         )
    , i2 x0 x4 n$ m4 `3 p
  11629.         (progn
    $ t6 }! F. N& H& k" A
  11630.          (set_tile "error" "Invalid layer name.")
    , P, b2 n( ~( y1 F, C
  11631.          (mode_tile "edit_lay" 2)1 d4 `; n1 ]6 p* A% C! l
  11632.          (setq lay-idx old-idx)
    - y3 i' V! [' h) u3 W
  11633.         )' W: |" B7 C& @4 }0 C/ O
  11634.     );if3 D* v. [; ^* j5 ]& v
  11635.   );defun
    ; b" k3 y5 U8 z1 K' t& W  R
  11636.   ;;6 c3 p3 |: S" ^* k2 G' b- v; B
  11637.   ;; List entry selections end up here
    / L4 i8 j& Q- k: |/ y
  11638.   ;;( t' N9 A, P  q+ c+ B
  11639.   (defun laylist_act (index / layinfo color dashdata)
    ( j* a6 `  u. v& }
  11640.     ;; Update the list box, edit box, and color tile
    ' b4 c$ B" L, Y" v' p
  11641.     (set_tile "error" "")
    1 ]/ M6 x8 r% X
  11642.     (setq lay-idx (atoi index))
    ) Q' H, J) L; N, ?* t+ m2 N
  11643.     (if (not (equal lay-idx (1- (length laynmlst))))' D! A# l$ ^: M9 h& K2 V0 S
  11644.         (progn
    ) W' _2 \- O6 l: V
  11645.          (setq layname (nth lay-idx laynmlst))) z# x1 F2 |" _5 O, r
  11646.          (setq layinfo (tblsearch "layer" layname))
    0 Z4 M( `6 w; i
  11647.          (setq color (cdr (assoc 62 layinfo))): z  m- q1 S: K4 z. ?
  11648.          (setq color (abs color))) a# O1 R9 @4 `0 P
  11649.          (setq colname (colorname color))' _* i: D* @1 j* D* N
  11650.          (set_tile "list_lay" (itoa lay-idx))# |3 \2 P, ^' v# l% T
  11651.          (set_tile "edit_lay" layname)  ?" h/ J0 V: M' {( m
  11652.          ;(mode_tile "list_lay" 2)
    , B: e% S3 a  }  l7 T! V
  11653.         );progn then
    5 [7 A4 H# p- y6 G8 |' H/ i" H
  11654.         (set_tile "edit_lay" "") + F2 a# t7 ^5 A4 N
  11655.     );if
    6 n! |1 B: [6 a9 \. [
  11656.   );defun laylist_act
    2 h* Y; D* k; l9 ~! M
  11657.   ;;5 L* @2 W) v8 H
  11658.   ;; Reset to original layer when cancel is selected
    : t+ m* y  j+ P$ o3 }! t
  11659.   ;;! D0 Q7 l. p" v7 D( S
  11660.   (defun reset-lay ()" Y. h4 z/ w8 D$ N$ X9 W1 I* ?
  11661.     (setq lay-idx old-idx)
    4 h0 k( E0 v& A$ \; H
  11662.     (done_dialog 0)1 V, F/ u1 v/ I
  11663.   )
    5 N/ x! ~# U1 I2 c# G
  11664. 2 M+ p0 _# E* }" W
  11665.   ;; Checks validity of linetype scale from edit box.  It checks to. Y- u8 E" B  @* x& f7 J* T; M8 j
  11666.   ;; see if the value equals "Varies".
    ' e9 n8 f9 y8 w' q

  11667. 3 F3 P+ P6 `& F% I( K) Y) u4 V
  11668.   (defun getscale (value / rval)5 v9 [  O9 f$ [9 O; Y
  11669.     (setq value (strcase value)
    , \  }( `) H* J
  11670.            rval (distof value)
    # q7 S) C& ]6 \  {  X+ _
  11671.     );setq4 e5 _  w# z- i1 `/ C2 n
  11672.     (if (or (= value "")/ i3 B5 @9 w! F  B/ k$ I, t
  11673.             (> rval 0.0)
    + I  S5 o: k  \* p# X( O  M
  11674.         )
    + m! y# K3 a# [: L3 v, V% j! g& y
  11675.         (progn& ^. b8 Z1 C7 r8 X( @! E
  11676.           (set_tile "error" "")" {; ?+ p& w$ t4 K8 ^" d% v
  11677.           (if (= value "")
    / `4 Y0 a- K7 R( I7 k- G
  11678.               (progn
    5 ~0 s+ e, b+ _5 ~
  11679.                (set_tile "eb_ltscale" "")
    4 v  y2 H. g% \5 m6 \
  11680.                (setq eltscale nil)
    " V2 l* ~; d: N+ G3 K8 _; B
  11681.               );progn then
    * D; E0 C  `% `# Z" m
  11682.               (progn
    ) t0 O7 J# B7 a: q+ J5 \4 F  A: `6 ]
  11683.                (setq eltscale (distof value))  z% l3 |# X5 @+ f; ^
  11684.                (set_tile "eb_ltscale" (ai_rtos eltscale))
    0 M5 ^% m( @* b' |1 }: ]; Q
  11685.                eltscale1 |0 e4 E: s  ?& v  f
  11686.               );progn else' v, A! @) I+ p# ?9 F, v& p$ z
  11687.           );if
    " Q; y3 `5 m" f( H
  11688.         );progn
    ! U# S% ?' ~2 p& f) L  i; P
  11689.         (progn
    - x0 d: G8 E9 ?/ \0 i& E/ F
  11690.          (set_tile "error" "Invalid ltscale.")
    * H4 d7 G' U4 x7 O: q2 U
  11691.          nil
    ! O. N3 S3 b- q* X
  11692.         );progn else
    ' e  l( I, S$ V8 G% u
  11693.     );if7 e& }; U( Y# p9 \
  11694.   );defun( r; K0 r4 D: V: }5 i$ t9 t
  11695.   ;;
    ! A2 D, Y2 B+ S
  11696.   ;; Checks validity of thickness from edit box. Since (atof) returns 0 when a
    $ b1 N1 w* s% k2 F
  11697.   ;; string can't be converted to a real, this routine checks if the first+ p; R6 s' d1 c2 H
  11698.   ;; character is "0".  It also checks to see if the value equals "Varies".2 y) v' t8 B+ _; J
  11699.   ;;
    2 o  L% k  J' x5 i. I1 ?
  11700.   (defun getthickness (value)
    0 S8 q1 m$ v; L- L4 K
  11701.     (setq value (strcase value))
    7 h* j% |" K1 g6 g' @
  11702.     (if (or (= value ""); s: S3 C8 G. ~& I- K+ w/ o
  11703.             (distof value)3 Y; Z* ^9 L1 e: d
  11704.         );or' s. H6 r5 [4 k& J; `, U: m! j
  11705.         (progn
    7 ?' J5 _5 S6 M3 ?+ G0 A2 i: ^
  11706.          (set_tile "error" "")0 J8 C! H8 p" V; z& r0 `& c
  11707.          (if (= value "")
    2 U7 y2 _6 ^- B$ |8 y9 a6 }7 Y
  11708.              (progn
    2 K* [& @2 n/ Q
  11709.               (set_tile "eb_thickness" "")& Z! |+ x) a3 E
  11710.               (setq ethickness nil)$ n0 X. u" F' q, d
  11711.              );progn
    ' Q/ i& ^0 Q( g8 S
  11712.              (progn
    # z6 }# U) }' n& N4 L1 K
  11713.               (setq ethickness (distof value)): d7 R& Z! C8 o3 P/ E
  11714.               (set_tile "eb_thickness" (ai_rtos ethickness))( O( U% z  n5 N; M2 ~( O
  11715.               ethickness
    # m. m) {, q4 A; x- \
  11716.              );progn, T; K/ Z6 q: G4 j% q- }) }, b, E5 a
  11717.          );if
    ! {' ]) v+ c4 k; f( v$ S5 ?3 e  [
  11718.         );progn- V: U; V1 Y: _; ~& C! _6 Q. r
  11719.         (progn, u8 s6 L' d) Q7 L
  11720.           (set_tile "error" "Invalid thickness.")
    , E; Q, |- f/ @, c
  11721.           nil7 Q  k8 t0 X" M# ]) a3 y" `( ~
  11722.         );progn/ g! O6 I9 i9 G$ {# Z  {0 e) H7 J
  11723.     );if
    ( d9 s! c# r1 h
  11724.   );defun
    + R$ e+ U& r2 e: B/ J
  11725.   ;;5 i! Q. Y0 J/ Y" L, R5 e
  11726.   ;; Checks validity of polyline elevation from edit box.
    / w' H; W* ~% [9 V  A1 H8 j
  11727.   ;;
    ' ^- N3 j2 O: Y' V1 z9 o
  11728.   (defun getelevation (value)
    0 Z8 ~* C0 f# k7 t. Z4 r( a
  11729.     (setq value (strcase value))
    4 I5 B$ S+ K) y' T
  11730.     (if (or (= value "")
    0 ]2 u) r" M* `: O6 }7 L) R% i
  11731.             (distof value)& |9 O9 X( C  N' D0 ^; p5 B
  11732.         )0 M# y( s, V' c
  11733.         (progn8 X3 [: M* ]$ f, c( v! i
  11734.          (set_tile "error" "")
    ; ^' [9 X+ b1 N: W  ^% R* N
  11735.          (if (= value "")5 t. D, J+ x9 {. r" Z
  11736.              (progn1 m4 o( f3 P" L" D
  11737.               (set_tile "poly_elev" "")
      [! a2 \/ E6 T5 ]: A6 f+ ^  p
  11738.               (setq eelevation nil)
      W8 V, R: E, _: W5 \2 x" A5 d. ^
  11739.              );progn
    " j: h& i) `( L' D! B( q, }& x1 l0 N
  11740.              (progn
    + R4 H: I& R3 k4 m! _
  11741.               (setq eelevation (distof value))
    0 x: y" F- w/ i3 f
  11742.               (set_tile "poly_elev" (ai_rtos eelevation))
    % Q. V' f, T" e! B
  11743.               eelevation
    - a& W( I+ D, `  T" Q  G$ L
  11744.              );progn
    6 q  s* T; ^' ?6 Z7 a' F; a
  11745.          );if
    ) G; I6 w! L7 p" p4 B2 ?! M0 P
  11746.         );progn( \( W. B2 C8 `2 n3 e3 E8 v
  11747.         (progn6 F$ V5 M8 n- ~( C# a- y! B+ H( `
  11748.          (set_tile "error" "Invalid elevation.")! C% V+ Y5 O, R6 g0 [! @
  11749.          nil
    0 M! }$ U6 \  q9 X/ ^1 |. Y( Y. s! b
  11750.         );progn
    % y- T6 o/ G1 h) g/ j8 ~* L
  11751.     );if* L- S6 F8 g  P7 l# B! B  u4 y" N+ b
  11752.   );defun
    . {* V% P3 Y" u! h: H) I6 `9 ?( W
  11753.   ;;
      S- f, E7 J$ [% P% h6 W( m
  11754.   ;; Checks validity of polyline width from edit box.2 E3 r* _8 \: Q; M- R
  11755.   ;;
    9 ^% C- Z& R8 C4 Z' _  ^$ Y
  11756.   (defun getwidth (value / rval)
    * A/ U: O5 F# [7 a4 N
  11757.     (setq value (strcase value)
    # L0 B% Y. C7 t9 N" w- l& ?/ T
  11758.            rval (distof value)
    2 F1 t  ]2 J3 ^  X. n1 p: b& z6 S
  11759.     )
    5 M0 l9 @. d, O' `3 e6 z
  11760.     (if (or (= value "")
    ' |( |6 u% P# v5 M
  11761.             (>= rval 0.0): f$ C, G* Q' x
  11762.         )
    # s7 q+ o. k; D' v; Y! s3 L
  11763.         (progn
    . ~! r* |. U" ]& q+ [
  11764.          (set_tile "error" "")2 t4 f8 e( T  N$ ]; e/ ^
  11765.          (if (= value "")  j2 L- ?; x& z4 |+ d
  11766.              (progn; y: F1 }& l: e& m) C! i
  11767.               (set_tile "poly_wid" "")
    & B3 j& q& a* O
  11768.               (setq ewidth nil)" ?3 o; F; W  Q$ Q: q8 H% }1 T; i
  11769.              );progn
    $ U/ u+ ]; M3 J' c
  11770.              (progn
    2 g& O2 f1 @7 i1 {2 n
  11771.               (setq ewidth (distof value))2 W$ H5 e# A# c* L, @
  11772.               (set_tile "poly_wid" (ai_rtos ewidth))
    6 C1 N" r# |, V
  11773.               ;width7 E6 W. T& h  Q$ l: s
  11774.              );progn
    # L1 L1 }1 O: D1 K' |' K
  11775.          );if7 b0 j9 j/ e8 P, ~* @& q
  11776.         );progn
    6 s" Q6 f4 e4 g$ @5 {' ]
  11777.         (progn
    1 R" r  c' V  S' c5 m. @( ]
  11778.          (set_tile "error" "Invalid width.")
    4 Y0 H7 N" E6 L5 q' `1 e* Y
  11779.          ;(setq ewidth nil)( j& p5 N7 w. i. L/ P- b
  11780.          nil : w$ v0 i, b0 ?8 e5 ^1 w, V" X
  11781.         );progn4 c' V, W3 T+ W; p) H: m: q
  11782.     );if
    - M  a+ N# A0 a, h2 b
  11783.   );defun4 o; [" z% q* a4 b6 X
  11784.   ;;6 F' ~* V8 O0 Q3 f( @
  11785.   ;; Checks validity of text height from edit box.
    & X) C  B" C1 d% p
  11786.   ;;; T) i% ?) I! `
  11787.   (defun getheight (value / rval)
    7 W, l5 [3 M! x7 r) Q6 y
  11788.     (setq value (strcase value)
    % j8 e: v" U: D0 o
  11789.            rval (distof value), @9 d- c3 X! z5 d( A
  11790.     )
    ( p- e8 a8 u& @1 j6 ~
  11791.     (if (or (= value "")
      s8 Q; H7 C8 K2 \
  11792.             (> rval 0.0)
    : U$ g+ K6 H0 H. [
  11793.         )
    8 R* M7 M( x5 G7 ^& G
  11794.         (progn
    ( b5 c6 i0 B# ]6 \% H0 g
  11795.          (set_tile "error" "")" R, |! F" Z! i# L( m1 L% X
  11796.          (if (= value "")- ?" i9 ~0 a" H
  11797.              (progn
    . D# _" W9 b" b, `& }+ I6 B
  11798.               (set_tile "text_hgt" "")5 {3 G# u" K+ N* A7 k8 P7 M
  11799.               (setq eheight nil)
    $ W8 h1 h8 ~1 B+ D2 u
  11800.              );progn9 t3 ]6 }* k9 q7 z9 ]
  11801.              (progn
    . o% h* L# s2 A  d' I, o
  11802.               (setq eheight (distof value))
    ! C, B0 f/ y$ K/ g* m5 w
  11803.               (set_tile "text_hgt" (ai_rtos eheight))
    9 `5 C  m3 Y, u3 p% U
  11804.               eheight! e1 F% d0 b$ i7 K' B& X
  11805.              );progn2 ?/ s! {6 x" L' L' G' }1 r
  11806.          );if
    . h' L* |' ]) T5 @$ j" o/ W) Z
  11807.         );progn
    ! G( K. x- {& ^8 d5 U* y
  11808.         (progn
    + @% M' [8 {# c4 q8 R
  11809.          (set_tile "error" "Invalid height.")# D* l, c" D+ f
  11810.          nil
    ) C2 x* D8 X6 `. E0 R
  11811.         );progn8 c* d5 r; Z) c. t
  11812.     );if
      X- z3 Z+ t4 O% H5 e, F+ C
  11813.   );defun
    ( B0 {" s% F9 r. Y2 u6 Q# k+ h
  11814. 2 d9 J. [3 n; m
  11815.   (defun getstyle (value lst / rval). [2 B/ ^* _8 p" H, ?* Z3 B& n0 ~
  11816.     ;(setq value (strcase value))/ j5 s) ^# ]3 R) l# Z  M
  11817.     (set_tile "error" "")$ U' j7 d% ]) p& q1 p
  11818.     (setq estyle (nth (atoi value) lst))
    % d# `9 Y6 F7 Y. v
  11819.     (if (equal estyle "")
    5 ?% h" x! ]3 {1 k: T
  11820.         (setq estyle nil)+ x5 m* t+ C2 d
  11821.     );if
    $ P  r; S" p5 k) Q

  11822. ) a0 j9 ~; o7 r: U
  11823.   );defun getstyle! H. r# p( j- L) R8 v! y1 [5 Z

  11824. 4 _3 h; W7 @/ z  M  @. V# D6 t( i6 S
  11825.   ;;
    2 X7 j3 A# _; J0 H8 C9 a
  11826.   ;; This function make a list called laynmlst which consists of all the layer
    , k  Y( B$ v' b; S: v; z7 X' F
  11827.   ;; names in the drawing.  It also creates a list called longlist which% |7 o2 {0 `6 }* h3 \
  11828.   ;; consists of strings which contain the layer name, color, linetype, etc.: R5 \, ?5 E0 B$ e( D
  11829.   ;; Longlist is later mapped into the layer listbox.  Both are ordered the
    6 e$ ^9 G4 z1 q/ l
  11830.   ;; same.. m8 v7 W2 d# ?4 ]5 c
  11831.   ;;( r2 a) l5 j% }
  11832.   (defun makelaylists (/ layname onoff frozth color linetype lock vpf vpn ss cvpname
    ( [0 @, Y( [5 i- X: s5 p
  11833.                          xdlist vpldata sortlist name templist bit-70
    ' `$ _0 f" d2 f' b- h
  11834.                          layer_number7 X9 k$ z8 h7 o2 Y* u
  11835.                       )! w2 A1 V0 X, e( u" @5 R
  11836.     (if (= (setq tilemode (getvar "tilemode")) 0)  j3 e' F3 Z. g! W6 W
  11837.       (progn, }8 z! J7 Z/ I
  11838.         (setq ss (ssget "_x" (list (cons 0 "VIEWPORT")
    0 A2 ~0 n) _4 R( m- e6 c$ l; o0 F
  11839.                                   (cons 69 (getvar "CVPORT"))
    : f3 u3 S: ^- y( a: p7 V
  11840.                             )5 w% m4 o2 k4 j% S0 u
  11841.                  )
    & R" I& I( J& ?' [
  11842.         )
    ( h* C4 Q( ~) B: E% K) \4 r- {
  11843.         (setq cvpname (ssname ss 0))
    1 u# J. ]1 [( i0 V$ j% D1 q' [
  11844.         (setq xdlist (assoc -3 (entget cvpname '("acad"))))
    , e/ E2 d/ |; O$ J, _
  11845.         (setq vpldata (cdadr xdlist))9 W+ w  e6 y6 M
  11846.       )/ c$ }% g: B! g( C' B4 O
  11847.     )
    0 N# z; R. l) Z- [6 c% G
  11848.     (setq sortlist nil)
      P  e+ `; V5 D
  11849.     (setq templist (tblnext "LAYER" T))
    6 D$ I3 c/ i6 c. ?5 K9 v
  11850.     (setq layer_number 1)  |3 ^( z3 f7 P- a; w6 g
  11851.     (while templist0 H/ l" k2 f) G' ~8 {
  11852.       (if (not (equal 16 (logand 16 (cdr (assoc 70 templist)))))
    . `+ i5 w1 `0 D4 A7 v+ W* y
  11853.           (progn  
    ' ]0 p5 q# t& e  @" x& n: l
  11854.            (setq name (cdr (assoc 2 templist)))
    ) i4 A0 Q4 Y/ H, S
  11855.            (setq sortlist (cons name sortlist))
    1 q. n$ B6 t* B" J
  11856.            ;; Not dead message...; z0 M! g8 j/ z
  11857.            (setq layer_number (1+ layer_number))
    ; ^! y2 `% P- I5 D1 a
  11858.           );progn
    : e$ b1 B$ `/ p6 F
  11859.       );if. h7 B' j. U" s7 G. U
  11860.       (setq templist (tblnext "LAYER"))8 l/ O: r+ p! ?. `$ R
  11861.       (if (= (/ layer_number 50.0) (fix (/ layer_number 50.0)))3 e9 o9 u3 {  t. C8 ?
  11862.           (set_tile "error" (strcat "Collecting..." (itoa layer_number)))
    # |# Z$ T, q0 C; r. a+ Z
  11863.       );if$ `/ v% P3 w4 l% j( i6 Y
  11864.     )
    + }$ x( o" _' I! F0 K
  11865.     (set_tile "error" "")4 _% {1 f4 J) J: b8 o
  11866.     (if (>= (getvar "maxsort") (length sortlist))
    + x( q' X. e2 R$ d
  11867.       (progn# _! {# {2 w7 ?. j' W! _
  11868.         (if (> layer_number 50). z0 b% J0 H3 ^6 T6 Y' y
  11869.           (set_tile "error" "Sorting...")
    5 V. M6 }& m: E& R1 F+ ~, z
  11870.         )
    ) k/ o: p; {, k7 t- ^# t& ]
  11871.         (setq sortlist (acad_strlsort sortlist))
    6 C+ N# N& I3 @8 L' z
  11872.       )
    # \6 L* Y( Q0 R. r1 _" K
  11873.       (setq sortlist (reverse sortlist)): P1 C9 U6 x# x, B; |; L8 ]. N
  11874.     )! u9 q5 _2 Y, c9 R4 B
  11875.     (set_tile "error" "")
    % a8 y7 X( t1 ?: e# o$ K0 ^+ ^
  11876.     (setq laynmlst sortlist)" M$ b: K7 S" J& v3 a9 _7 m
  11877.     ;rk
    * _3 c9 n& }* {; W; V4 W
  11878.     (setq laynmlst (append laynmlst (list "")))     
    1 z; ?- _9 ]) r3 L2 j5 \

  11879. 4 N3 U2 D6 L+ H# H% h
  11880.     (setq longlist nil)
    % g) P- |. C% Z) B
  11881.     (setq layname (car sortlist))- C3 u) L7 G. F, B* x
  11882.     (setq layer_number 1)
    * n) U) ~* j% u3 A" }2 b$ g  v  M
  11883.     (while layname
    # t. M6 f1 ~2 ^
  11884.       (if (= (/ layer_number 50.0) & u8 T' _1 |' k7 L
  11885.              (fix (/ layer_number 50.0))# V" S+ S, M0 I  K2 J/ e1 [
  11886.           )$ j  z( J8 N( k  ^4 H
  11887.           (set_tile "error" (strcat "Analyzing..." (itoa layer_number)))
    1 `& C: Y- y8 i8 k" [
  11888.       );if) F! Y1 B, J; U  h* ^
  11889.       (setq layer_number (1+ layer_number))$ e2 Q8 H( p! t+ r  V* x
  11890.       (setq laylist (tblsearch "LAYER" layname))" V. C" `/ F/ z# H% @9 V) d
  11891.       (setq color (cdr (assoc 62 laylist)))+ ^* t1 I5 S5 M
  11892.       (if (minusp color)
    8 ]7 d) t8 W4 R& F) T, n
  11893.         (setq onoff ".")5 C- G+ ^: F3 Q  t
  11894.         (setq onoff "On")6 L/ M: r) Z: H( V& L+ |
  11895.       )
    . p, ~4 @# A+ z6 _
  11896.       (setq color (abs color))
    + V) U+ Y4 v8 E7 L; Z/ L! S8 T
  11897.       (setq colname (colorname color))
    + M2 Q& l8 R+ O* o
  11898.       (setq bit-70 (cdr (assoc 70 laylist)))
    ! }# o! q* v6 l9 L! C
  11899.       (if (= (logand bit-70 1) 1)
    , A. D2 P5 c; V. g
  11900.         (setq frozth "F" fchk laylist)
    % @' F+ O7 B( C1 d4 M6 w$ ]+ H
  11901.         (setq frozth ".")
    2 y( F: m  m8 b- p$ Y+ s
  11902.       )
    , b- }7 ]: D. n, {" F0 v5 w; T
  11903.       (if (= (logand bit-70 2) 2)
    1 H8 O6 _' O4 N6 w* H% t* S% d4 g
  11904.         (setq vpn "N")
    ' C% \2 L5 T4 W: k& o+ {6 @% w/ z
  11905.         (setq vpn ".")! Q% I7 y; Q% t- |7 h1 J: u2 l
  11906.       )
      c. N9 |4 ~  J# ]8 ~4 W$ k
  11907.       (if (= (logand bit-70 4) 4)2 l  y7 T- s2 v' T+ ]) |
  11908.         (setq lock "L")
    $ h: L' I! n  K' @
  11909.         (setq lock ".")
    , _; q# n) u, b
  11910.       )1 ~& A' |: d7 i% n' A4 c
  11911.       (setq linetype (cdr (assoc 6 laylist)))
    $ n) A8 u0 T: z' J" h* N& k0 b2 f
  11912.       (setq layname (substr layname 1 31))
    - i' G, |  O) l2 M
  11913.       (if (= tilemode 0)3 E. F, j3 N) k% B) C' ]
  11914.         (progn
    7 U: c  i% p. P2 D8 a4 B& r0 K
  11915.           (if (member (cons 1003 layname) vpldata)
    + J" I( `9 b* m) X& d5 |9 Z
  11916.             (setq vpf "C")
    , Z# a0 T6 k5 f6 o
  11917.             (setq vpf ".")9 ]; E. P1 ^7 e' Y% `  b& H
  11918.           )
    / l0 G; H, {( D# a1 n, |
  11919.         ), n2 D2 G( q9 ~
  11920.         (setq vpf ".")
    # H$ z* h/ b; [) \( V, Q/ @  M+ {
  11921.       )
    8 ]- T6 u+ d5 Q- g7 b
  11922.       (setq ltabstr (strcat layname "\t"; d/ H2 |) E  O6 {, b
  11923.                               onoff "\t"
    4 x3 \8 b/ G6 M, ~5 J
  11924.                              frozth "\t"
    + p, j) e! x9 ?, l( g
  11925.                                lock "\t"8 H* G% H# M1 k: Z& H5 r  j0 A; h  A( v
  11926.                                 vpf "\t"
    ) g: e- I6 T" ?" U, _8 m5 L6 P
  11927.                                 vpn "\t"  U0 j" I1 i5 N- Y  ~0 g$ w% F0 j
  11928.                             colname "\t"8 N, l% g8 I6 o1 ~: L" G- Y. y& a
  11929.                            linetype
    & {  F0 A4 c! p4 f
  11930.                     )
    , f# B+ U( _) q! |, a: t
  11931.       )4 {& s" u) |/ \2 R
  11932.       (setq longlist (append longlist (list ltabstr)))
    1 z, V! W" `6 v
  11933.       (setq sortlist (cdr sortlist))  S, x0 J& V( f. w# t$ S, y
  11934.       (setq layname (car sortlist))
    1 H" j; y5 `4 h
  11935.     );while9 M( r. U/ h7 f  k9 l# e
  11936.     (setq longlist (append longlist (list "")))) M6 J' d* d7 T
  11937.     (set_tile "error" "")* r$ p, G9 f9 N. w
  11938.   )7 c3 o; r. w) _- C1 u
  11939.   ;;
    / m2 M4 N  _: N6 ~" L- C
  11940.   ;; This function makes 2 lists - ltnmlst & mdashlist.  Ltnmlst is a list of- q0 T+ K" ^' J
  11941.   ;; linetype names read from the symbol table.  Mdashlist is list consisting
    / U- j  W6 i0 p
  11942.   ;; of lists which define the linetype pattern - numbers that indicate dots,6 W1 I1 D# t9 X1 i& ~! O
  11943.   ;; dashes, and spaces taken from group code 49.  The list corresponds to the3 R; i! l8 ?' m& a! k4 L4 z/ _" o
  11944.   ;; order of names in ltnmlst.) D1 G/ a# G( N  A! S2 S+ W
  11945.   ;;  l. M5 _- J; ^! ^2 O
  11946.   (defun makeltlists (/ ltlist ltname)
    2 L- z. i  I  f. I) i% Z1 F
  11947.     (setq mdashlist nil)5 x: J, b/ P1 S& [8 U; t& l+ }
  11948.     (setq ltlist (tblnext "LTYPE" T))9 X$ J2 Z: D! L0 G8 A/ U& C, V
  11949.     (setq ltname (cdr (assoc 2 ltlist)))  E' ^  K" a7 n7 `" }
  11950.     (setq ltnmlst (list ltname))6 m: R3 h/ P8 X4 E# B. }# R  N* F
  11951.     (while (setq ltlist (tblnext "LTYPE"))  D; S. i3 s  K$ V' O
  11952.      (if (not (equal 16 (logand 16 (cdr (assoc 70 ltlist)))))
    " V4 s/ [+ h0 U; z) |% M* E
  11953.          (progn
    ! x! Z4 X! i1 ^( r3 b
  11954.           (setq ltname (cdr (assoc 2 ltlist)))
    8 o6 [+ \/ }. _" p( l# H' U  _
  11955.           (setq ltnmlst (append ltnmlst (list ltname)))
    ; Q. h. M2 k% y2 l+ t; y
  11956.          );progn: n( i- e) w4 I" j
  11957.      );if
    ; C; a  z& R- r& p( W% B
  11958.     );while0 M* b% ]1 o7 j3 i' n& ^
  11959.     (setq ltnmlst (acad_strlsort ltnmlst))
    - W; y( z6 o. k; B% F; P# V& r
  11960.     (setq ltnmlst (append ltnmlst (list "")));add by rk 0 S. m. W5 }7 e1 ?# Y1 P
  11961.     (foreach ltname ltnmlst- E, x7 N% q( z- h0 f1 e- d7 C
  11962.       (setq ltlist (tblsearch "LTYPE" ltname))
    + s& v! u+ j0 ?
  11963.       (if (= ltname "CONTINUOUS")5 H3 L+ X' I  o$ c( O6 _+ Q7 @5 m
  11964.         (setq mdashlist (append mdashlist (list "CONT")))* O( r( _. Y# o
  11965.         (setq mdashlist1 A2 Q. ?9 e: B6 a# X. P
  11966.             (append mdashlist (list (add-mdash ltlist)))' z% j6 N% C( D  i+ E* y& _
  11967.         )1 i( N1 r/ T( f
  11968.       )
      I1 \5 c: X6 v8 }; T* ~# x  S, q9 z
  11969.     )! Q) K/ _8 N* p9 m- U/ U
  11970.     (setq ltnmlst (cons "BYBLOCK" ltnmlst))) q3 I8 J! ~+ H: g0 c" y
  11971.     (setq mdashlist  (cons nil mdashlist))/ r- G8 G/ p" B0 k& Q: H7 a# c' [6 b
  11972.     (setq ltnmlst (cons "BYLAYER" ltnmlst))
    . J6 ?' f  d! x) X% r+ S
  11973.     (setq mdashlist  (cons nil mdashlist))9 L7 h9 y' L/ U% S3 g/ F  h
  11974.   )2 D! k; l  A, N7 I
  11975.   ;;0 R) `. x- C" K/ u( `: R3 [: f
  11976.   ;; Get all the group code 49 values for a linetype and put them in a list; D4 ^/ z9 w7 i- _7 g- m
  11977.   ;; (pen-up, pen-down info)7 ]0 Y+ x! l  N; h" J
  11978.   ;;: F) d- M; R+ h8 w
  11979.   (defun add-mdash (ltlist1 / dashlist assoclist dashsize)$ w$ L- ^! \7 t; z( `# P
  11980.     (setq dashlist nil)
    ' e7 L4 S% C% ~! [8 S
  11981.     (while (setq assoclist (car ltlist1))
    + F1 _( \+ e! {9 s" t4 z# r
  11982.       (if (= (car assoclist) 49)+ S( W7 H+ \3 o1 [7 V
  11983.         (progn7 @5 c6 e: Z. ?7 A: {9 W1 l& {3 j+ \
  11984.           (setq dashsize (cdr assoclist))$ |$ X7 R' d. q
  11985.           (setq dashlist (cons dashsize dashlist))
    ( x9 i: J- q: R% I/ S( K
  11986.         )
    7 w; p$ F! `# y' b; }
  11987.       )
    7 I5 A: _( Z1 m% L
  11988.       (setq ltlist1 (cdr ltlist1))
    # ~# H8 @+ e1 b4 e
  11989.     )
    9 z% v! ~) O6 |7 k; J
  11990.     (setq dashlist (reverse dashlist))! I3 Z8 E+ D$ P. n8 E4 C: F9 x
  11991.   )
    + m- b1 x/ B" R" x1 S' X8 G7 I+ H
  11992.   ;;5 ^2 z8 j; l. c% i/ q9 f3 g
  11993.   ;; Color a tile, draw linetype, and draw a border around it, n3 A" C4 k4 }) {& V  [
  11994.   ;;
    % m' p. x# y# F6 }1 d6 c* y
  11995.   (defun col_tile (tile color patlist / x y)/ ~0 T; k4 W: g( U0 C" C. T
  11996.     (setq x (dimx_tile tile))7 Q7 m7 a  k; U/ B
  11997.     (setq y (dimy_tile tile))- a" s3 C  K) q. R3 o; o2 o
  11998.     (start_image tile)
    9 l) ]1 _. e; ~- `  \) e7 }
  11999.     (fill_image 0 0 x y color)
    9 e5 g$ S/ G! ~4 _. u
  12000.     (if (= color 7)/ Z6 m2 Q  L! s
  12001.       (progn
    # n, |7 A5 k/ E% J. C
  12002.         (if patlist (drawpattern x (/ y 2) patlist 0))7 X6 o+ N9 m: g0 G* e0 P; H" \( i
  12003.         (tile_rect 0 0 x y 0)1 p1 `0 h# u: K; E
  12004.       )9 }* S- m* Q& N) _1 K2 Q1 m6 W8 o
  12005.       (progn
    " _" h" u, y5 F' N
  12006.         (if patlist (drawpattern x (/ y 2) patlist 7))
    # M( j  h: X$ I# \9 i% ^% H5 h# f
  12007.         (tile_rect 0 0 x y 7)
      h( M, R& D. T1 ?& Y
  12008.       ): `& _# ?% ~% S; J( {/ ]  O) p8 c
  12009.     )
    0 ?/ C! v; x2 L; X
  12010.     (end_image), s6 N7 M9 ?# k; s; v
  12011.   ), j- G" S  F" ~4 i
  12012.   ;;
    ) C* O; I+ Q' l- j+ A) E3 K8 ^
  12013.   ;; Draw a border around a tile
    . ^* \! ?- j5 c  U9 c
  12014.   ;;  i8 z  X$ D/ c4 U2 k: p5 z
  12015.   (defun tile_rect (x1 y1 x2 y2 color)! z  G' \- S; q9 ~  \
  12016.     (setq x2 (- x2 1))8 l. r3 [; Y: p
  12017.     (setq y2 (- y2 1))4 N/ J' @8 ^% ~9 D
  12018.     (vector_image x1 y1 x2 y1 color)
    7 x1 M5 v2 G, w% ~9 a! u- t
  12019.     (vector_image x2 y1 x2 y2 color)% V# X& @; B3 V! J3 Q7 u+ P; N
  12020.     (vector_image x2 y2 x1 y2 color)
    " o  F6 ?" X- |+ l
  12021.     (vector_image x1 y2 x1 y1 color)
    0 I7 k/ R0 y* Q$ O6 p
  12022.   )* T1 q5 @' I3 }  O7 {- y
  12023.   ;;
    + F/ a! x9 b0 {/ i, d
  12024.   ;; Draw the linetype pattern in a tile.  Boxlength is the length of the image
    9 R+ r( ^$ d  h% v* q9 z
  12025.   ;; tile, y2 is the midpoint of the height of the image tile, pattern is a, |+ e' C7 B: c  W& ~
  12026.   ;; list of numbers that define the linetype, and color is the color of the
    4 z3 Z/ V  ^! S+ A. m( ]* }
  12027.   ;; tile.
    ) a  b& ]% f8 ^& c- W% [- |/ F
  12028.   ;;
    + t; @) ^9 w1 d& B+ y1 e
  12029.   (defun drawpattern (boxlength y2 pattern color / x1 x2% r0 d+ G7 D2 E' Q( m  o9 t% r2 M
  12030.                       patlist dash)
    + E  n. R' B8 y: t0 q2 P
  12031.     (setq x1 0 x2 0), H& c( H/ j! w5 g: s
  12032.     (setq patlist pattern)
    # R* O* H; u' V  {. t
  12033.     (setq fx 30)
    : R' ]- K! p  P
  12034.     (if (= patlist "CONT")
    , w. b" U2 t; e* `
  12035.       (progn6 F% S7 v3 r4 W/ z4 c" i
  12036.         (setq dash boxlength)
      m% x! b& w( p, q; {9 v
  12037.         (vi)  Q2 t! P5 }; \0 J, t
  12038.         (setq x1 boxlength)
    * m8 u  j7 j8 e! [2 G; _6 h  J) R, H
  12039.       )( Z6 R2 q( ]: K' o3 C7 H4 {) z
  12040.       (foreach dash patlist
    ! n. \* D1 E1 _' D" B' W
  12041.         (if (> (abs dash) 2.5)
    : d: g8 N7 t) L4 L' D& `
  12042.           (setq fx 2)
    9 |$ p3 G8 s% W
  12043.         )* B3 ?2 _2 l6 Z: }7 \
  12044.       )
      j$ W( K7 R# [1 S. E+ w
  12045.     )
    5 O1 u2 |  G8 A; |- m) {. i" x
  12046.     (while (< x1 boxlength)6 W9 m% ?& e& q  V
  12047.       (if (setq dash (car patlist))
    ) a1 K  [3 u; V- {" i4 x
  12048.         (progn
    1 Z( T2 ^! D2 S$ {
  12049.           (setq dash (fix (* fx dash)))
    + H* a' v3 i3 R" V1 G
  12050.           (cond  D! x( L# ~- t$ s9 @9 c" X
  12051.             ((= dash 0)
    ) u. [- y" @$ Q  M
  12052.               (setq dash 1)
    / e! S& Z$ A* N1 w7 Z  e: F
  12053.               (vi)
    ; P9 P8 U$ c0 i; G
  12054.             )0 D" ?4 p8 T- W& `8 V
  12055.             ((> dash 0)
    " h" o2 a' p6 D# ?% M: s8 W
  12056.               (vi)
    / e) J4 f) w$ E0 T; d0 R
  12057.             )- Y+ U8 \$ G2 m4 b) N$ `5 e
  12058.             (T2 _) V5 M* F2 l* y" ], h
  12059.               (if (< (abs dash) 2) (setq dash 2))
    ; ^5 M+ k2 I. p6 \
  12060.               (setq x2 (+ x2 (abs dash)))
    0 j8 T" c9 P' e/ g, E6 u, ~
  12061.             )3 c/ o) i5 s# G" ^: V2 ^* |$ B) e' c
  12062.           )
    % x; Y; Y1 f7 C
  12063.           (setq patlist (cdr patlist))
    % H& I: w, J; Z% F8 p
  12064.           (setq x1 x2)- Y8 b& q) [0 C3 k( W
  12065.         )
    , K: L6 c0 q1 T; O
  12066.         (setq patlist pattern)
    * ]6 E0 s# A( g- @" r( N
  12067.       )
    * a  |* Q) p: O; t# O
  12068.     )" s3 [7 j4 Z* Q9 E4 X1 }, s
  12069.   )
    0 S  K( y7 l8 \
  12070.   ;;
    ! t5 @9 x* ]- b+ z4 e3 _
  12071.   ;; Draw a dash or dot in image tile
    " r& }* n0 [: x* B0 J/ \
  12072.   ;;3 s, j8 z1 s) G$ J2 o* P/ V: W5 K. ~
  12073.   (defun vi ()
    % m- {$ ~' c! i# v
  12074.     (setq x2 (+ x2 dash))
    / W7 j' r3 u  X0 p* y
  12075.     (vector_image x1 y2 x2 y2 color)
    5 W. v( J7 B0 \# z5 v
  12076.   )  R+ l8 }$ o" I- G) z. L
  12077. - J2 V" `/ J3 V! E5 C# p$ L
  12078.   ;; This function takes a selection and returns a list of the color,4 _) F+ G7 ^+ c" e" c3 d0 _
  12079.   ;; linetype, layer, linetype scale, and thickness properties that! r' |, E# r3 L- z  D
  12080.   ;; are common to every entities in the selection set - (color$ L* V6 M3 Z3 K5 \- W& U
  12081.   ;; linetype layer thickness).  If all entities do not share the same7 J8 P* O# `% ?2 f- F; p+ W
  12082.   ;; property value it returns "Varies" in place of the property
    * u, R% d, w; j/ X
  12083.   ;; value.  i.e.  ("BYLAYER" "DASHED" "Varies" 0)
    ) _% b9 r# B" f
  12084.   ;; The last item in the return list is an integer flag for the
    8 q- g0 F3 S: I) k
  12085.   ;; homegenity of the selection-set object types.; Z% V1 z" Q, ^! f
  12086.   ;;   1 = All polylines
    0 M- |  w) b1 e) c0 P* e- d0 q
  12087.   ;;   2 = All text or mtext or attdef, or a combination of the three
    1 ]2 F4 `8 v9 a/ y
  12088.   ;;  -1 = Any other mix of objects
    : U( I1 X/ c- S- A; @# K. ]+ W

  12089. ; r2 I% R0 y: z* B
  12090.   (defun getprops (selset / sslen elist color ltype layer ltscale thickness
    + y( r; m' y& T* p+ I( e
  12091.                           width elevation height go ctr
    ( n+ u0 n' [* f
  12092.                           eflag
    1 i( t' O9 k1 d
  12093.                           etype temp 6 h& ?: n' D6 d- ]6 o$ p; s, K
  12094.                           txt_ss     ;;;;rk 11:24 AM 1/30/97( K' E$ a) X0 K
  12095.                           tmp
    3 b* B1 m% B: H- I3 z
  12096.                           poly_ss   
    1 ?& E# s5 f% ]
  12097.                           style1 Y. b/ Y2 U5 v4 [! B' f' z
  12098.                   )  ^: m0 Y- \* J* O9 @
  12099. , Y) a, j9 Q; h7 q& g# E$ C6 ^
  12100. 8 F. ^( G9 W5 j  y
  12101.     (setq     sslen (sslength selset)
    + [: Z/ P! D! m! M) Y6 v
  12102.               elist (entget (ssname selset 0))
      }7 j2 U7 ]! M0 c1 G
  12103.               etype (strcase (cdr (assoc 0 elist)))/ r; ~6 _) {; w+ o
  12104.               color (cdr (assoc 62 elist)); R: _: L8 i: X& P) g: d
  12105.               ltype (cdr (assoc 6 elist))
    ' M4 {4 K  z' k* x# t
  12106.               layer (cdr (assoc 8 elist))
    % [0 C3 |0 Z; q" g3 p: X
  12107.           thickness (cdr (assoc 39 elist))
      s& K# w/ E8 o' n. ~. a
  12108.             ltscale (cdr (assoc 48 elist))
      ~# |) A9 L: B; B
  12109.     );setq7 i+ m: x& |0 C3 X7 |9 H; K
  12110. . E- H5 E4 K4 L+ c" M4 S9 M
  12111.     (if (not color)     (setq color 256))
    5 o; u7 Y0 c# r9 W
  12112.     (if (not ltype)     (setq ltype "BYLAYER"))+ o9 {$ o1 _$ r8 D. `! a
  12113.     (if (not thickness) (setq thickness 0))
    ; Z% Y* ?7 `- d* ~4 K; W1 @. ]" K
  12114.     (if (not ltscale)   (setq ltscale 1))
    8 F6 L  R( C. M1 p( b8 J
  12115. * @, s! j  [" w$ i
  12116.     (if (not width)     (setq width ""))
    ; L: M. b/ S. u% }8 S; ?
  12117.     (if (not elevation) (setq elevation ""))" v- C/ c1 z4 p4 C3 P
  12118.     (if (not height)    (setq height ""))
    " P8 Q5 y' |+ u, s' D" L/ e, t

  12119. " x9 j8 g" O1 c0 P6 F( N5 B
  12120.     (setq      go T
    6 d2 C8 ~+ w9 a+ Y! J6 e9 L
  12121.           chk-col T
    2 ]' l( Z  ^" a/ @! F
  12122.            chk-lt T / S0 `  r. e8 b: v1 k' F; `. \
  12123.           chk-lay T
      F9 `4 |, @: _0 y" ?
  12124.           chk-lts T ' _5 y& W, v) j7 r
  12125.            chk-th T
    + R! J" ]2 d/ ~0 H% V) Y; M
  12126.               ctr 0
    0 z$ w+ D3 z- O  J7 `
  12127.     );setq5 v) D. t; |- t  S
  12128. 1 y/ E! `7 v9 U' C( }. e7 e- O/ q
  12129.     ;; Page through the selection set.  When a property
    - Y7 [4 B: U% s! p% }
  12130.     ;; does not match, stop checking for that property.5 I$ n. U; y1 ~* H: p. D8 \! @
  12131.     ;; When the selection set is not homogenous, stop checking.3 X5 v  N( C3 h  h* _
  12132.     ;; If all properties vary and the set is not a type 1
    1 H, E" h3 C' x8 B1 U% o- l
  12133.     ;; (polyline) or type 2 (attdef/text/mtext) set, stop paging.
    . S6 V& G" x7 A4 t4 u/ X- @8 F
  12134. " F5 y) Q2 c7 a1 j
  12135.     ;Lets set the eflag so we know if the selection set includes any
    % p9 D& t% W$ X5 y
  12136.     ;combination of polylines, lwpolylines, text, mtext or attdefs.
    + J7 @1 Z  j7 R; Z  Y  s

  12137. 5 Q2 Z' b; t  X" U: \& Z
  12138.     ;watch out for 3dpolyline and 3dmeshes here! @rk 10:17 AM 1/30/97
    * C, }( \; b0 n/ `
  12139.     (setq eflag 0)* _* `) g$ Y6 z
  12140.     (if (setq poly_ss
    2 o% p. y/ s% V9 T' L) d) L! `
  12141.               (ssget "P" (list '(0 . "*POLYLINE")) j* ~- i1 q5 _
  12142.                                '(-4 . "<AND")
    8 B8 ~# z, q- ]) A! y, Q
  12143.                                   '(-4 . "<NOT") '(-4 . "&=") '(70 . 8)  '(-4 . "NOT>")
    3 t8 h2 g; o5 e2 o8 a
  12144.                                   '(-4 . "<NOT") '(-4 . "&=") '(70 . 16) '(-4 . "NOT>")' z! V! h8 f  ]' a  d3 L
  12145.                                   '(-4 . "<NOT") '(-4 . "&=") '(70 . 64) '(-4 . "NOT>")8 {/ _8 }+ o" D- S+ M
  12146.                                '(-4 . "AND>")
    ' \* |2 M0 ]; i1 n: i
  12147.                          );list* q8 o2 o5 \2 j1 z" u, a
  12148.               );ssget get 2d polylines (legacy and lw)3 Y% G8 \  J8 I7 o- I* i/ D3 q
  12149.         );setq
    ( x% z' Y$ A0 j; c
  12150.         (progn0 }5 D4 F$ r1 Y& X' C
  12151.          (setq eflag (+ eflag 1))7 Q/ _. E% [' C7 |+ z* v
  12152.          
    & E/ C9 _$ m  u2 h; p# h# U8 N
  12153.          (setq tmp (entget (ssname poly_ss 0)));setq" H# k, k5 ^6 m5 I

  12154. ; f% K2 k0 K; L. |& p# _. J5 \7 M
  12155.          (if (equal "POLYLINE" (cdr (assoc 0 tmp)))
    & W! w& O! D) S! [
  12156.              (setq elevation (last (cdr (assoc 10 tmp))))- z4 g& U3 P- e9 Y
  12157.              (setq elevation (cdr (assoc 38 tmp)))
    3 c" v5 L- W1 P$ e- u. F
  12158.          );if6 X* R8 z% ~% H! a
  12159.          (if (not elevation)3 ]0 j; z7 N2 N2 ^: Y0 p4 ?% ~
  12160.              (setq elevation 0.0);setq/ k. B; o3 z. v. h! [6 x
  12161.          );if: F4 N5 a! I2 D# t, I9 k; q
  12162. : g/ P5 z- |" j6 j1 a
  12163.          (setq tmp (ssget "P"
    * v. b1 U* p  J! a8 ^7 |: B
  12164.                           (list
    & C9 }6 [1 R+ j; P
  12165.                              '(-4 . "<OR")
    + M" a6 O. a) l- O" B; B9 T$ A
  12166.                                '(-4 . "<AND")
    & J- }- X" D; }0 K5 m
  12167.                                  '(0 . "LWPOLYLINE")7 Y4 H. _' l& l% ]
  12168.                                   (cons 38 elevation)/ C. F# \1 n  x4 y) s: E5 w
  12169.                                '(-4 . "AND>")
    5 e7 c; p4 c# n
  12170.                                '(-4 . "<AND")
    # b+ p- T( L3 R
  12171.                                  '(0 . "POLYLINE")
    ( \( A# C- [8 f. f
  12172.                                  '(-4 . "*,*,=") 1 V  r$ }8 U' R8 W+ K
  12173.                                   (cons 10 (list 1.0 1.0 elevation))
    8 J: k( g7 y- P1 ^
  12174.                                '(-4 . "AND>")
    5 I* c  F0 g4 h1 d8 i
  12175.                               '(-4 . "OR>")9 h, V! {/ S9 e3 @: K9 H1 K
  12176.                          );list
    $ n  Z% x! D/ t
  12177.                    );ssget
    ! c/ \  p% b5 p0 A2 l) p2 |) I
  12178.          );setq
    3 s& ~6 t: G1 @# o

  12179. 0 v* ?2 g7 G& Z' c$ u# \
  12180.          (if (and tmp
    1 J- H( O) D, c$ q6 w
  12181.                   (equal (sslength tmp) (sslength poly_ss))
    & A, t( W1 o) h. S, J6 N2 N
  12182.              );and
    , ^/ W$ J9 c  E) [9 p: n; A
  12183.              (setq elevation (ai_rtos elevation));setq
    + j) O  x0 N; @# }
  12184.              (setq elevation "")
    2 A' C: P  A. d: ?1 E
  12185.          );if
    1 h1 {5 v! S" C2 G
  12186.           0 j, |4 j! U- c4 F
  12187.          (setq width (pl_width_getter poly_ss));setq" M1 {& q" U  e% N! Y, o2 T
  12188.          
    $ R3 m1 j7 X3 @4 Q! A8 H- \
  12189.         );progn then 2d polylines and/or lwpolylines are in the HHHHHOUSE!
    . I& ?/ z& f9 Z4 K: |% m6 N  y
  12190.     );if$ A6 T& X: I' |6 L& l& D$ _1 ^
  12191.     (command "_.select" selset "")
      t  I" L- [) y8 Q
  12192.      
    + P7 }& Q, V2 T& B; A0 G
  12193.     (if (setq txt_ss
    ! h2 m0 h2 S. q' E' O5 x( g" t. U1 ?
  12194.               (ssget "P" '((-4 . "<OR") (0 . "TEXT") (0 . "MTEXT") 8 X0 g% i5 [6 y6 p5 Z; |
  12195.                            (0 . "ATTDEF") (-4 . "OR>"))/ Q" j4 X& A! E! `  Z
  12196.               )  
    ( x# @: C) V1 r- v  p4 j
  12197.         );setq
    9 @: L+ h$ k$ n- {1 U
  12198.         (progn! Y. O5 D: c7 |
  12199.          (setq eflag (+ eflag 2))$ b: V" z/ a4 ^$ h
  12200.          (setq height (cdr (assoc 40 (entget (ssname txt_ss 0))))
    + G; U( A) r1 b  I
  12201.                   tmp (ssget "P" (list (cons 40 height)))
    & g- B  }3 _4 w8 @7 z
  12202.          );setq ' j, Q" F- D9 I0 X, O  O
  12203.          (if (and tmp
    * `0 i2 q0 D. y, i
  12204.                   (equal (sslength txt_ss) (sslength tmp))                    , O0 ]  c7 a5 Y
  12205.              );and: n+ j' i" l' \% Z. u
  12206.              (setq height (ai_rtos height));setq  ;@rk need to translate from float , f6 ?/ b* l0 M' r0 Q! `. b3 ]
  12207.                                                    ;to string and back again easily
    , L) K6 n0 ~$ b) Y
  12208.              (setq height "");setq else the height varies 6 p( K* n- A7 F3 F% k" ?
  12209.          );if
    1 ~3 h+ l: t8 {7 L' O$ @- v
  12210.          (command "_.select" txt_ss "")
    : W& {* R  F9 b7 K3 b
  12211.          (setq style (cdr (assoc 7 (entget (ssname txt_ss 0))))
    2 [) C/ [, v( n& D* V
  12212.                  tmp (ssget "P" (list (cons 7 style))) $ c( e- `  _9 q" r, a
  12213.          );setq
    # a4 R' n, a- r  e
  12214.          (if (not (and tmp
    2 F& y+ Z" [3 O! t, U8 p
  12215.                        (equal (sslength txt_ss) (sslength tmp))                    3 R5 \" R9 q0 C+ L% {
  12216.                   );and
    ; n2 F; S( x% y9 A: x0 @
  12217.              );not( W% \/ G# K2 L1 N$ m7 g
  12218.              (setq style "");setq then the style varies
    " j  [  N! U, o! _, H
  12219.          );if+ r; D5 \1 m/ J
  12220.         );progn the text type objects are in the selection set
    4 y; ?: Z2 n5 V
  12221.     );if" @9 k; H9 j5 r; p/ ~6 o/ I
  12222.     (command "_.select" selset ""); ]# ?/ \9 g$ C. x0 P
  12223.    
    8 j/ A' O1 _% w8 {2 s7 |
  12224.     (while (and (> sslen ctr)
    , \: g# [1 C! Z# H
  12225.                 go
    , D. a  q$ J: g3 N3 D
  12226.            );and) S" E3 e% V6 o8 j7 a4 F( x$ N2 `
  12227.       (setq elist (entget (setq en (ssname selset ctr))))
    & ]. `+ m! c1 |' P. r7 k% Q9 j

  12228. . ]* n% x) Z9 S3 H
  12229.       (if chk-col (match-col))! Q+ |0 l7 D$ }8 N
  12230.       (if chk-lt (match-lt))
    . d% @' X$ G( m3 ~1 Z
  12231.       (if chk-lay (match-lay))
    $ |* d8 R9 s2 y
  12232.       (if chk-lts (match-lts))' l6 C5 |' H$ s. D8 T7 r' Y# `
  12233.       (if chk-th (match-th))
    0 o9 b9 [( t1 H( j+ {6 p
  12234. * n; A' n" D, Y
  12235.       ;(if chk-etype (match-etype))
    & E, z8 C- }5 @# A" g' U) ~9 O* K

  12236. 4 r9 e) _% u+ k& K; E! S: O( x$ j3 T
  12237.       (setq ctr (1+ ctr))
    ; A3 x9 M" a* C5 U0 X
  12238.       (if (and (not chk-col)
    ; `; D  m' M: Q( c& ~
  12239.                (not chk-lt)7 j; s+ ], T2 x
  12240.                (not chk-lay)/ S! Y' C, \5 J- o
  12241.                (not chk-lts): D& t$ `% x& h" z4 a$ ?/ g' k
  12242.                (not chk-th)# h* j7 W+ [6 W, N& R
  12243.                ;(not chk-etype)( k5 C' v. l1 A9 A4 o4 c% i3 c
  12244.           );and6 r9 x8 N4 m0 W6 o
  12245.           (setq go nil)
    7 a" {% \  Z& C8 t' B. p. t# E: j$ N
  12246.       );if/ K# ~+ t+ g7 x8 G$ [8 X' g
  12247.     );while
    ' `  ?1 p9 \5 `$ P
  12248.     " b! p  u: @. Q3 m$ j3 E$ R6 T
  12249.     (list color ltype layer thickness ltscale
    / y! d7 e* r8 Q( V4 ^1 a' D$ f' R
  12250.           width elevation height eflag
    " L5 x! U2 i- i
  12251.           style poly_ss txt_ss" ~; D5 ]9 z8 L
  12252.     )- g5 f  ~: v9 r8 n7 O
  12253.   );defun getprops
    6 G. j* P$ D3 o" r- U

  12254. 6 W9 X. u+ e/ _. i5 s+ i
  12255.   ;  This is a speedy little routine to tell whether the polylines in % |# j2 \" o1 U5 G
  12256.   ;the selection set argument are of varying width or a constant value. & W% H# l- B9 z" W+ ^$ N, r; Q; e& L
  12257.   ;Looping through the vertex's has to be done for old polylines when
    5 }4 K4 }  J  e) W
  12258.   ;the polyline header has width values of 0.0. Basically, in this case,
    ! E( p4 e' t4 q1 B
  12259.   ;information in the polyline entity header is abmiguous. Width values
    + r2 ]7 n1 b( X9 [) {* V. D
  12260.   ;of 0.0 in the header entity could mean the polyline has a constant
    ' n5 q4 q' D( Q, I
  12261.   ;width of 0.0 or it could mean that the polyline has vertex's of varying 8 z( H5 ^' s$ a6 N; l2 j
  12262.   ;width.
    ! B" o: n( W( q
  12263.   ;
    - ?* `+ [$ i8 O% y
  12264.   ;  It's all in wrist. Err a.., I mean it's all in the 'if'
    0 s" L. s1 T& F  @- Q/ }+ n- E, P
  12265.   ;;
    8 M' W; h9 d+ Q% a" ?
  12266.   (defun pl_width_getter ( ss / ss2 ss3 n na e1 width width_a width_b flag flag2)+ a* f8 `& }( z9 w2 h6 ]
  12267. # ]  B+ ]( m, p+ B
  12268.    (if ss
    ) h% E. c2 y6 B) v) X
  12269.        (command "_.select" ss "")
    8 s# a$ _4 r9 n
  12270.    );if
    / E+ g/ b' W+ t6 q! g) q! {! \
  12271.    (setq width ""
    3 I# ?, q$ Q& \
  12272.           flag nil
    " j! q$ L& P4 A
  12273.          flag2 nil
    . g- t0 {; W+ ^
  12274.    );setq
    # D! c" P- a8 @  P! q% l
  12275.    (if (not
    3 L. L! E1 q3 m2 \; a2 \3 d
  12276.          (and ss' y; w8 V) A# g% |5 O! {
  12277.               (setq ss2 (ssget "p" '((0 . "LWPOLYLINE"))));setq0 [4 D7 L8 E) {( S' _
  12278.               (setq    na (ssname ss2 0)9 I0 \9 |, A7 u3 T
  12279.                     width (cdr (assoc 43 (entget na)))
    , Z) }1 q# D* |/ c9 J; E
  12280.               );setq1 B) R& I" j. b' a9 o( h7 `
  12281.               (setq ss3 (ssget "p" (list '(0 . "LWPOLYLINE")( W9 O" G* r4 q2 S( s/ W/ n9 e
  12282.                                           (cons 43 width)3 _5 ?4 o. @9 v! m: q
  12283.                                    );list
    % H, j& n% R( Z8 W# b
  12284.                         );ssget! j) c3 ]3 _+ z7 d
  12285.               );setq- E- J; `" o% h% l- v& @
  12286.               (setq flag T) 5 }! w9 h+ @2 w& w) A
  12287.               (equal (sslength ss2) (sslength ss3))
    , B' u# U! h% M9 i) r: ~% X
  12288.          );and
    / O7 F5 Q' [) i- k+ o7 }  U
  12289.        );not/ x; |; J; H) i5 ~
  12290.        (progn* a9 |% h  o' q# V- V9 p* S
  12291.         (if flag. a4 v& f9 J, `! x, ~0 a
  12292.             (setq width nil) 3 a: U. b; w- k$ G" O4 u% p8 V$ w
  12293.         );if
    : _3 _# ]( O* ?: l
  12294.        );progn: i1 T8 K. ~8 I% N1 g" `) B
  12295.    );if
    4 W0 n% O8 `% z" Y# D7 v& O
  12296.       
    - D1 H5 E- `. E2 a; B( u1 O; ^
  12297.    (if (not 6 s8 s8 U. H, y$ \  E
  12298.         (and
    , m8 k6 p# X, }% D8 }
  12299.              ss3 w5 M' M7 L5 l
  12300.              (progn (command "_.select" ss "")
    * g0 y. L! [7 w3 J' I
  12301.                     (setq ss2 (ssget "p" '((0 . "POLYLINE"))));setq! A+ W5 v  z7 V: q
  12302.              )
    . G" D1 o( o6 M
  12303.              (setq      na (ssname ss2 0)
    ) D- O. G: m- o# C( K
  12304.                         e1 (entget na)
    , b  O, Y' a1 t( d2 A* G3 ?! h2 |
  12305.                    width_a (cdr (assoc 40 e1))
    # @, O* N4 S) a
  12306.                    width_b (cdr (assoc 41 e1))
    8 g, c" N8 d' h( Q" N6 G
  12307.              );setq
    8 [; H2 H; t1 ?, v0 |# j+ F; R
  12308.              (equal width_a width_b)
      v$ u4 {1 ~: W* h5 M$ \
  12309.              (setq ss3 (ssget "p" (list '(0 . "POLYLINE")& h# W7 @& q8 \9 \) A7 z
  12310.                                          (cons 40 width_a)" A1 d3 l+ U  z; y& Y
  12311.                                          (cons 41 width_b)
    . e. g/ x" X  z
  12312.                                   );list
    3 z! Y* b5 W8 J
  12313.                        );ssget% T/ _. K+ |4 c, A" V
  12314.              );setq, ?- K6 a5 t1 v$ Q) r% P, k% D
  12315.              (setq flag2 T)/ {( B" a5 A' F. [$ ]
  12316.              (equal (sslength ss2) (sslength ss3))$ H6 ?- q0 a/ N% {# y6 _
  12317.         );and % Z# J1 k8 Y5 X9 ^
  12318.        );not 0 J8 o, N3 q# q7 W3 X5 @
  12319.        (progn
      l' e3 t4 s! m9 `! i0 v1 Z: d' L
  12320.         (if flag2' X! y' w+ p2 P  b5 s0 B: e9 ]
  12321.             (setq width nil);setq
    $ }5 c% E! l3 l2 @
  12322.         );if; L$ Y% L+ B, @1 h. Y! \
  12323.        );progn then  F+ l" t0 I" z& q8 r% z
  12324.        (progn
    # H, q8 S# W( V; M1 A* [
  12325.         (if (or (equal width "")
    6 F) C! E4 a) a/ \6 @9 d
  12326.                 (not flag)2 k- {1 t$ A7 b7 ^; n
  12327.             );or
    / C" G" ?7 m3 b( k' V
  12328.             (setq width width_a). ?: W' S% D% F* |3 h* S2 [: k
  12329.             (progn
    ! k$ h* @) y% ^+ }4 t
  12330.              (if (not (equal width width_a))
    - y8 a: P; o$ T6 [! K( F
  12331.                  (setq width "")( ~  H& R* _: j
  12332.              );if  
    5 i8 c  @0 @% ~7 D5 z$ J
  12333.             );progn. m% I0 N3 p& B( ^1 o4 a* G# S# p
  12334.         );if) ?* c7 a+ [. [+ t
  12335.        );progn
    - e' V& J+ h9 S, Z5 u" ]; @  H( R
  12336.    );if
    1 Z( B) v$ l, ~( N3 h& Z! n. C
  12337.       2 V2 k5 N, X  v' g, A! Z

  12338. 4 c+ H' [0 Q7 E, C
  12339.    ;now for the special handling for old polylines
    3 E* @; M  S* g
  12340.    (if (and width
    ) k( V/ o0 F7 j: Z3 q4 v
  12341.             (equal width 0.0)
    . p: h& G) }8 P0 j% m" U
  12342.             flag2
    0 a4 O! M6 s& f7 z; u, [. A
  12343.        );and $ {' X5 q: H( `" p
  12344.        (progn5 i' s8 R5 F7 f. g$ K, N
  12345.         - H) ^& N; S# Z
  12346.         (setq n 0);setq
    : e7 |- Q0 o6 Q/ [# v
  12347.         (while (and (equal width 0.0)$ q5 C' q* r7 A( y) Q) Y; P! y& b2 H
  12348.                     (< n (sslength ss3))
    & t9 N$ d6 o4 u! ]) J) O6 U
  12349.                );and
    8 x$ ^' ?1 r6 ?0 M& n: @. C
  12350.          (setq flag nil
    - |# ^+ \& b/ ~  |/ Z( e8 R7 z$ C! S7 [
  12351.                  na (ssname ss3 n)$ ?) [( ]2 E1 {5 G4 m& ]
  12352.                  na (entnext na)
    : L4 o# |+ d/ k
  12353.                  e1 (entget na)4 r& m* \! I; E
  12354.          );setq
    " k; T6 W( \* T
  12355.          (while (not flag)
    ' e5 g& U$ |/ v& L
  12356.           (if (or (equal (cdr (assoc 0 e1)) "SEQEND")
    0 g0 e* W  l2 ?5 W& W" b1 i
  12357.                   (not (equal (cdr (assoc 40 e1)) 0.0))4 t5 m9 G! k5 I5 c6 M
  12358.                   (not (equal (cdr (assoc 41 e1)) 0.0))
    ( I! g$ Y5 t6 c% k: S' Y; ^
  12359.               );or
    - v1 ^. o! u: z6 N
  12360.               (progn
    % j* Z2 o; v1 h% z4 [9 v2 S" s
  12361.                (setq flag T);
    3 N- a! G1 P( h
  12362.                (if (not (equal (cdr (assoc 0 e1)) "SEQEND"))
    / e, o" [7 F9 Z4 O9 a
  12363.                    (setq width nil)
    4 U/ x# w6 f* O2 b# N
  12364.                );if
    # `5 [( B. U" E- z2 i& ]
  12365.               );progn then jump out of the loop
    5 Z3 D$ S9 y0 {
  12366.               (setq na (entnext na)! q  X# _5 {5 U4 m0 O/ {, l6 A
  12367.                     e1 (entget na)
    & w3 M1 r6 N" x! Z
  12368.               );setq
    4 L3 a- t) c/ F6 F9 n* [  P$ m4 M
  12369.           );if & i; _- x2 G# E) _
  12370.          );while
    ' \. b- m5 y" |" F" Q
  12371.         (setq n (+ n 1));setq  : B# Z4 k: l; q7 P
  12372.         );while & x& B" m) G1 E% T
  12373.            / A: l2 A' T' L* |6 _4 ?
  12374.        );progn then it's a legacy
    ; m$ g" q' b* ]; h+ x& y9 S* Z4 Q
  12375.    );if    ;legacy polylines that may have varying widths  ; @- f+ s% P# O* L. ^

  12376. 4 X( G4 `+ ?7 V& l. i$ C0 W; P+ a
  12377.    (if (not width). U( ?$ e4 e! J  F6 B/ a
  12378.        (setq width "");setq
    % u3 D5 v0 q6 _: z1 u! e( Y
  12379.    );if
    : Y6 z& a( A, t! F& w, P9 ~
  12380.    (if (not (equal 'STR (type width)))
    $ X; K% P# s# B1 m, o% O
  12381.        (setq width (ai_rtos width));setq / k7 r$ k; q1 h7 [! h3 x% E
  12382.    );if , L6 m- P/ K  M7 V, d( l. Z8 w
  12383.    
    0 t: z0 o7 L/ x0 Z2 B
  12384.    width   
    6 C) h1 Y4 w3 a! Q, s
  12385.   );defun pl_width_getter
    ! l3 e" j- k2 L- X) r
  12386. 4 E: T& g6 n! u4 ?" k2 @
  12387.    
    7 c5 k9 F$ y  {2 Y6 f
  12388.   (defun match-col (/ ncolor)
    5 ?1 p0 u: }" o
  12389.     (setq ncolor (cdr (assoc 62 elist)))
    % G, {( a* v2 |* x, M. N8 x8 P
  12390.     (if (not ncolor) (setq ncolor 256))/ @$ Y" j/ y9 g* l$ q( }
  12391.     (if (/= color ncolor)" e# s) h* \- A% d4 j
  12392.       (progn
    * {9 w+ J9 ~4 C. M% K6 _  Y
  12393.         (setq chk-col nil)
    7 x( N5 d% X% c' N4 X# |% f" q' P  l
  12394.         (setq color nil)
    4 [7 m- }( `) c: N
  12395.       ); ~, n0 s2 e$ P& d5 U
  12396.     )' W9 A4 @2 N/ I+ D+ i$ |+ P
  12397.   )
    " H3 g" B: ?+ e; }) ^' P
  12398. ; q8 k4 e7 z" [4 {( F
  12399.   (defun match-lt (/ nltype)
    0 t7 P. a% y2 T1 t6 x/ r% ?( \
  12400.     (setq nltype (cdr (assoc 6 elist)))
    / q1 x9 Y2 v7 o* K
  12401.     (if (not nltype) (setq nltype "BYLAYER"))8 e4 h4 i# _+ A9 [8 h# P
  12402.     (if (/= ltype nltype)
    , n2 w- F( l4 \$ `+ i  \9 v; e0 T8 R
  12403.       (progn
    - B$ l/ w& {; q6 Z, I# }
  12404.         (setq chk-lt nil)
    % D6 ]# `/ V( S5 {- E3 v) `
  12405.         (setq ltype ;|MSG0|;"Varies")
    7 y. R; r4 W1 ~, }$ C/ Z) u
  12406.       ): d/ `6 Z  j( ?7 O
  12407.     )$ Y2 Z7 c$ l- X0 v) `3 A2 t% W2 J& m
  12408.   ). q& [% x, Y) p3 t0 ]$ l0 F/ n
  12409. ) [+ |, @  h5 q; S+ ~' _# u
  12410.   (defun match-lay (/ nlayer)1 e3 O6 t# U4 ]( @* J
  12411.     (setq nlayer (cdr (assoc 8 elist)))
    1 j, q0 U, k. [: [# ~: l& V, F
  12412.     (if (/= layer nlayer)+ ^( \! a( k; D
  12413.       (progn
    6 _, {4 m, ]# S9 m1 m& E6 P1 U& z7 `
  12414.         (setq chk-lay nil)
    ! |( D: M' T) K: E
  12415.         (setq layer ;|MSG0|;"Varies")# }; e4 C2 ]3 i; C, r
  12416.       )2 h6 ]! U+ Z" w9 ]$ d
  12417.     ); |2 q) w/ Z4 A
  12418.   )  L1 I: g) o( g1 ~2 V
  12419. : K+ \5 R6 f0 D* N  S9 h7 I
  12420.   (defun match-th (/ nthickness)" `; @0 @4 v  ^
  12421.     (setq nthickness (cdr (assoc 39 elist)))$ B$ b* {; V( c* {5 D8 ^! V
  12422.     (if (not nthickness) (setq nthickness 0))
    6 y+ I$ `+ ^+ X) ^8 Y2 m0 C
  12423.     (if (/= thickness nthickness)
    . k! Y0 ?- z; I4 p* M
  12424.       (progn; X- ]. z% K, M5 J2 ?, w! _
  12425.         (setq chk-th nil)
    2 J2 ^: P: ~# T5 s# ?8 }) u( H
  12426.         (setq thickness ;|MSG0|;"Varies")# S  P8 a. f6 B
  12427.       )' e6 C) n% v7 X+ _2 `, o
  12428.     )
    - l* n# f# D  y3 t9 C3 `
  12429.   ). S6 B$ B  G! f4 m# _

  12430. / n) ?4 W& O( h! c3 t  h
  12431.   (defun match-lts (/ nltscale)+ @. q! L1 S! |; w
  12432.     (setq nltscale (cdr (assoc 48 elist)))4 G" b& }$ u7 l1 }* W, ~% d
  12433.     (if (not nltscale) (setq nltscale 1))
    8 }9 p6 x/ v- g
  12434.     (if (/= ltscale nltscale)
    ( P7 m+ k/ N& S1 K' g
  12435.       (progn& \; P# s5 c( z% [2 e* x
  12436.         (setq chk-lts nil)
    & }3 L# y, ]8 n* @8 o- K& L
  12437.         (setq ltscale ;|MSG0|;"Varies")3 ?+ }: X  `( ]$ _: f
  12438.       ). q3 ^% R& L3 B5 M% j" z* E2 `
  12439.     )
    % q) z  c4 f7 D: X' b5 M7 x
  12440.   )# }3 u6 S/ {" Z) \  {6 C3 J

  12441. - ^8 b: d" p4 \& d9 c
  12442.   ;;
    6 o. u2 D0 o- R) e+ c
  12443.   ;; If an item is a member of the list, then return its index number, else" @' L4 O4 P3 ~0 X; C
  12444.   ;; return nil.+ s5 J" s1 D; ~1 c: _0 r1 C! _  d
  12445.   ;;( V8 p- s0 B9 y- J1 ~
  12446.   (defun getindex (item itemlist / m n)
    % _6 Z1 w6 V" l- ?! i( D' o
  12447.     (setq n (length itemlist))2 S( `: t  ~' a! v% K, X
  12448.     (if (> (setq m (length (member item itemlist))) 0)
    4 Y' ]9 s. _7 m
  12449.         (- n m)
    ' m7 h5 T$ V, R
  12450.         nil/ n0 d9 o) {, g! B  q. q; ]5 E
  12451.     )  X5 \( V' I  u0 Z. r0 V7 O2 u
  12452.   )
    3 |  i8 o8 X9 x+ V+ ^4 }) Z
  12453.   ;;
    3 R8 |2 E, c2 v. ^0 X9 C! A& U, l
  12454.   ;; This function is called if the linetype is set "BYLAYER". It finds the
    : q; Y$ G+ {. s: v( P  H; ]' W6 m/ E
  12455.   ;; ltype of the layer so it can be displayed beside the linetype button.+ j$ Z& I0 }6 |) E4 d% N, [5 w
  12456.   ;;
    ' X8 u5 e. S9 q7 t2 @$ x; j  z* A
  12457.   (defun bylayer_lt (/ layname layinfo ltype)# c! L5 V' p, Z/ F
  12458.     (if lay-idx2 m( B5 G$ j- S/ y+ k+ V# M& F) R" x
  12459.       (progn
    ) m0 J) J# V- j4 e! }. k0 U) x
  12460.         (setq layname (nth lay-idx laynmlst))
    , k2 ~# {3 _! f8 ^' G; l4 x  ?: [
  12461.         (setq layinfo (tblsearch "layer" layname))
    * z3 A  b2 |! I4 {
  12462.         (setq ltype (cdr (assoc 6 layinfo)))8 s% h6 `& @* y' _2 a
  12463.         (strcat "BYLAYER" " (" ltype ")")6 k6 G9 I2 P4 @# y7 ?
  12464.       ); \; t6 \+ c  @# u+ g  s
  12465.       "BYLAYER"
    0 X  X+ H7 w/ A; R. S1 G
  12466.     )& `8 M* G* m5 @- [9 |
  12467.   )
    7 j& y2 F5 m7 a1 c9 h+ n
  12468.   ;;
    / A  F# J7 d8 G6 l
  12469.   ;; This function is called if the color is set "BYLAYER".  It finds the8 `: a9 h7 b1 n5 t+ \; P# ?
  12470.   ;; color of the layer so it can be displayed  beside the color button./ W9 o3 ?  E8 |& |) I
  12471.   ;;
    4 ~, y' @0 {0 }* o% c
  12472.   (defun bylayer_col (/ layname layinfo color)
    $ k8 E8 o4 h8 ?% f7 g/ f
  12473.     (if lay-idx( \! k3 h6 P; n! [) b: f  R
  12474.       (progn
    / L* x$ }8 k) y/ [! y8 G
  12475.         (setq layname (nth lay-idx laynmlst))
    * z, A; ~# _- `) S* O1 ^
  12476.         (setq layinfo (tblsearch "layer" layname))" z6 |: l' [2 {; I8 z% V& X1 R! Z  @
  12477.         (setq color (abs (cdr (assoc 62 layinfo))))
    1 _4 B! L2 o8 ?1 @
  12478.         (setq cn color)
    1 ]# i1 d! ~' i
  12479.         (strcat "BYLAYER" " (" (colorname color) ")")! y+ Q6 K% ^; K7 h8 ?
  12480.       )* @8 W# v; I. l* F! v2 ]5 l
  12481.       (progn
    " i" R( [* @2 _: p8 q" ^
  12482.         (setq layname elayer)6 l- t4 |. A2 ]! ]
  12483.         (if (and (/= elayer "")$ _" T; Y- @" @
  12484.                  (/= elayer "Varies")
    . x+ _" y/ f8 H! ~1 m6 U
  12485.             );and
      o* s& f6 Q! S; G* ]
  12486.             (progn
    . X7 ~3 c+ W8 C' J8 }
  12487.              (setq layinfo (tblsearch "layer" elayer))( o$ N3 q7 O( J0 A8 e7 ]2 h: O
  12488.              (setq color (abs (cdr (assoc 62 layinfo))))9 v( D9 w% E( ^; h" @! k+ @: u
  12489.              (setq cn color)- @; v' f5 ^0 f/ g/ K; g
  12490.              (strcat "BYLAYER" " (" (colorname color) ")")+ `9 E# e9 X/ H% `5 b4 z
  12491.             )
    . J4 \5 r/ X1 o4 c+ `3 T" }  v
  12492.             (progn
    3 r0 m& v1 S% U. [
  12493.              (setq cn 0)
    * Q0 [+ u1 C$ c! P
  12494.              "BYLAYER"
    9 H* f7 O. X# W6 c
  12495.             )" U" \. S& Y8 H; J. ]4 f
  12496.         );if( _! u2 p) b, S7 t
  12497.       );progn
    ' _; m8 ]& e- q' E2 A! E: {
  12498.     );if$ L+ N  M) I) c& Y8 P6 q% b, }: @
  12499.   )
    2 D, l" ^) P! m2 o/ [$ C
  12500.   ;;
    7 U& F0 Y1 e% J: E" W
  12501.   ;; If there is no error message, then close the dialogue: L( d* Z$ t8 F8 j9 l6 r
  12502.   ;;
    3 r  {. X8 ~- j1 q* Y
  12503.   ;; If there is an error message, then set focus to the tile
    / w- V+ G) q7 C/ J
  12504.   ;; that's associated with the error message.
    ( ~5 L/ f' Z( R& P. g! ]: J- d3 u
  12505.   ;;+ J3 a* a6 U9 C5 y
  12506.   (defun test-ok ( / errtile)
    1 y% O$ A& G8 z9 R- J/ E
  12507.     (setq errtile (get_tile "error"))6 O( S4 u+ P8 g9 [
  12508.     (cond
    / u6 `& H; H4 w) h! q6 G- T1 X
  12509.       (  (= errtile ""), D: K4 ~  l2 _& k/ A5 ?
  12510.          (done_dialog 1))) Q9 Z- ^! a7 l9 l% J) H7 B2 ~- J
  12511.       (  (= errtile "Invalid thickness.")
    - V8 q+ d% }+ `
  12512.          (mode_tile "eb_thickness" 2))
    $ P7 ^8 \' B7 S4 c: c, q
  12513.     )
    5 O& O6 k) l: R4 T9 h9 n+ g3 j$ P
  12514.   )1 U. k5 Z, z  B1 S$ q6 Z
  12515.   ;;  m2 J6 Z! m3 j% y4 n1 Y' g
  12516.   ;; OK in main dialogue.3 c+ e) u6 m6 h& C, B, p
  12517.   ;;8 e" x) e" N& `6 j+ [( C5 W4 u& @
  12518.   (defun test-main-ok ( / flag)0 e7 O: F1 W" |$ V# N
  12519.    (setq flag T)
    / Y6 f- x* E6 e) a
  12520.    (if (not (or (distof (get_tile "eb_thickness"))- t7 m/ V1 N* t$ N% i
  12521.                 (= "" (get_tile "eb_thickness"))6 w, O2 ^0 Q' g2 z
  12522.             );or
    + ?& b- E- g5 ^2 \. t& ^
  12523.        );not! `; U8 @! f3 L& C% m
  12524.        (progn
    2 t$ J  L) G9 O( `9 @* w
  12525.         (set_tile "error" "Invalid thickness.")
    8 A0 y2 D6 N7 t) e$ r/ [
  12526.         (mode_tile "eb_thickness" 2)& O9 p0 ]. V- @2 S6 ~' z
  12527.         (setq flag nil);setq
    8 O. }! H  X7 r! L$ ~* [: _
  12528.        );progn
    " }  o" s+ C) k, J7 ~
  12529.    );if) {( }# y: {+ j  ?* _& K2 k- n
  12530.    (if (and flag
    . D0 ^. u1 A) e3 ], s; G6 ^) l
  12531.             (not (or (< 0 (distof (get_tile "eb_ltscale")))
    + ^3 @# F* ?! f( d
  12532.                      (= "" (get_tile "eb_ltscale"))
    * V4 o: s" [, _8 N2 w% g- E: c: b
  12533.                  );or      
    : R% t$ E: ~. S& ?' J, ?
  12534.             );not6 o# V1 p8 q! {6 M6 J+ [9 h
  12535.        );and
    ; N2 ^. P. y& k1 I2 `2 p% H5 u
  12536.        (progn# ]1 }$ a: k" j
  12537.         (set_tile "error" "Invalid ltscale.")8 F& M/ R/ @, D+ k
  12538.         (mode_tile "eb_ltscale" 2)
    ; I: M6 y$ i, B6 t+ _0 R+ E" r
  12539.         (setq flag nil); , [$ Y: Q3 u  [; _' I; g+ O( }" T
  12540.        );progn then) k5 m& x. J) ~0 @: Q' U$ K6 A" i
  12541.    );if8 I, ?: r% a) n9 K6 w3 m7 G
  12542.    (if (and flag, Z3 P. h" u& n* B
  12543.           ; Don't test the tile's value unless it's enabled.$ r. z7 l8 g( J3 S
  12544.           ; We're not set up for the display-only value
    1 ^% i2 s( X% B% z- W% u' ~4 B5 S, ^
  12545.           ; of "" here in the error handler.
    # C5 D: n& V) V  \& [3 G2 b
  12546.           (= 2 (logand 2 eflag))  k6 S1 P) i* n& [2 T0 m! W0 W
  12547.           (not (or (< 0 (distof (get_tile "text_hgt")))
    6 S4 ?+ w) L& `) O0 |5 i6 X
  12548.                    (= "" (get_tile "text_hgt"))
    ! g! N3 |' b* M% D
  12549.                );or
    * L& S- u' _7 a' U+ U! j
  12550.           );not% S7 o. `3 U1 }: x
  12551.         );and9 [! B- P9 N3 ]
  12552.         (progn
    ! H  `' S& {2 @" I9 Z; u
  12553.          (set_tile "error" "Invalid height.")
    / j0 w3 n, V' T, r1 w' C' L5 s
  12554.          (mode_tile "text_hgt" 2)( C+ m, W2 V9 f
  12555.          (setq flag nil);
      f8 r  W( e1 S1 ^$ B) Q% R
  12556.         );progn then" u. f" e* x# A# [
  12557.    );if
    0 e7 w# Z9 {8 o+ d: o
  12558.    (if (and flag$ n% w- l, W5 [- ~, W9 `
  12559.             (= 1 (logand 1 eflag))
    & Z  e1 C* h7 ~5 \( x
  12560.             (not (or (<= 0 (distof (get_tile "poly_wid")))% F2 G0 R- j  \6 C+ J$ T
  12561.                      (= "" (get_tile "poly_wid"))# Q9 A) s8 L9 t8 V5 u+ Y' x
  12562.                  );or
    ' l3 ]7 R7 k9 T4 w1 E4 c
  12563.             );not
    5 H. w! R( g& _
  12564.        );and2 f% |  r, {) u
  12565.        (progn) I% E7 u( O4 Y% _9 b9 ^
  12566.         (set_tile "error" "Invalid width.")1 r( @$ C# `' f$ H
  12567.         (mode_tile "poly_wid" 2)
    5 V( G5 G6 i/ v( u. l
  12568.         (setq flag nil)6 d+ X* j, R) l9 ]% [4 L
  12569.        );progn then" _& [( f3 N) e2 N, U; S: W
  12570.    );if ) P0 e: G. j  d8 j: w
  12571.    (if (and flag
    5 M4 s* R, P% j+ C' c
  12572.             (= 1 (logand 1 eflag))/ V9 F* m; m2 r7 w# t) q
  12573.             (not (or (distof (get_tile "poly_elev"))/ T7 \6 @! R0 V" N! H3 g
  12574.                      (= "" (get_tile "poly_elev"))$ H9 \; l& _6 l# m8 Z3 ?
  12575.                  );or
    0 t; V% B7 s& n0 g/ S; M
  12576.             );not$ m1 L/ I/ N9 M+ B
  12577.         );and
    8 e' d) D$ N: G( S
  12578.         (progn  [! r% ~+ X% I5 G, K: o7 g
  12579.          (set_tile "error" "Invalid elevation.")
      X# ~, ~4 K3 b2 B+ N7 M. p& n
  12580.          (mode_tile "poly_elev" 2)
    + [, c, Z" w1 L
  12581.          (setq flag nil)
    # M* `) V9 q& g* z
  12582.         );progn then; u) ?. n& J% X7 n1 w0 h' a: [
  12583.    );if  # Q3 y2 z5 _6 Z! f8 O. x
  12584.    (if flag 1 b2 c" ^3 ?* i
  12585.        (done_dialog 1)
    ) C( F: X% L, ?" v+ U- \
  12586.    );if
      U' R' f9 ^  \
  12587.   );defun test-main-ok
    : l" X; c- x4 O

  12588. , x1 Q2 \' ^$ `/ `3 S
  12589.   ;;
    : [$ Y3 I" A8 v3 H
  12590.   ;; A color function used by getlayer.
    # K$ N2 W9 ?% Z8 M
  12591.   ;;; q- W3 o, v5 S
  12592.   (defun colorname (colnum)8 t# ]0 H7 B% B2 i6 v, e
  12593.     (setq cn (abs colnum)), _! G1 y7 k; ?7 F) P
  12594.     (cond ((= cn 1) "red")& @7 X* |' f) T7 g, O
  12595.           ((= cn 2) "yellow")
    * i4 X$ a. Q9 a$ x9 v* \, e- j
  12596.           ((= cn 3) "green")
    ! Q- C. ~9 F' ^) Z$ a2 B' Q0 Z
  12597.           ((= cn 4) "cyan")4 X. o9 \; l, j  J
  12598.           ((= cn 5) "blue")
    * v' X6 j5 p$ k1 c) b; e
  12599.           ((= cn 6) "magenta")
    ' h8 q4 V& Q( Q$ {+ x
  12600.           ((= cn 7) "white")" `: m  O& l% N) J) N. a6 f9 |- q
  12601.           (T (itoa cn))2 z7 _3 }5 C- x* L# E; K) J/ i# \; e. [
  12602.     )" |: }$ d5 T. ]) G% {( R
  12603.   );defun! v: i& l3 {1 m- T( S
  12604. ) [( m7 j# `2 y% K
  12605. ;;; Construct layer and ltype lists and initialize all, P  H' @. M( h5 j* Q( v, i  H* p' _
  12606. ;;; program variables:  G7 ]2 t6 @; J- g% o
  12607. 3 N. y/ J9 ?2 v' i
  12608. ;  (makelaylists)                     ; layer list - laynmlst7 a3 b& X& C/ E9 l9 G

  12609. ! U( Q5 C; V8 s: G+ o! Q! S

  12610. 4 T% l: n: L; P
  12611.   (makeltlists)                      ; linetype lists - ltnmlst, mdashlist
    " {7 v( T- l- I! N0 g! y: b

  12612. + ?! H( b0 z" E. O
  12613.   ;; Find the property values of the selection set.
    0 v, k8 m7 t8 e1 T5 x9 r
  12614.   ;; (getprops ss) returns a list of properties from
    9 U3 n  _) `. {8 J/ h! z
  12615.   ;; a selection set - (color ltype layer thickness HEGHT STYLE WIDTH).
    ! E( H: L$ m0 x& Q  ?
  12616. 4 |( `7 I1 G/ W! w( V% m
  12617.   (setq proplist (getprops ss));@rk interesting things happen here, X  K# ~- U0 x

  12618. / M) V' A" P% C- g* {
  12619.   (setq6 M# T4 s2 K& r4 I
  12620.             ecolor (car proplist)7 ?. a1 ], G: \9 w7 H
  12621.             eltype (nth 1 proplist)- W# ~$ ^) ], @( j7 x8 `3 q
  12622.             elayer (nth 2 proplist)- J5 b% Y9 c: i0 D9 Q9 S
  12623.         ethickness (nth 3 proplist)* i5 A/ e8 v5 W6 ^' Q9 K
  12624.           eltscale (nth 4 proplist)
    # m+ n! c3 e' s4 G
  12625.             ewidth (nth 5 proplist)4 y: |# O+ G+ |. c' u
  12626.         eelevation (nth 6 proplist)' B. w+ @3 w" J2 Y7 h
  12627.            eheight (nth 7 proplist)( u  h  ]/ N$ n5 }& j
  12628.             ;etype (nth 8 proplist);commented out and replaced with the line below. RK.0 A, X- `; _5 O/ }
  12629.              eflag (nth 8 proplist)9 w1 e* H& ?! |: k# N- S
  12630.             estyle (nth 9 proplist); J) w4 m2 ]0 P  {5 {+ Z
  12631.            poly_ss (nth 10 proplist)
    2 u$ T0 G- l1 Y7 U& ^
  12632.            txt_ss  (nth 11 proplist)/ D4 s0 L- W. k, T  d
  12633.   );setq
    & q+ W- Z4 K) E* |; N% R
  12634. ) \$ [  ?5 H/ O3 }) ]  I8 z, L
  12635.   ;; Find index of linetype, and layer lists
    : u& I4 d: K) @7 K/ _6 G
  12636.   (cond
    ! N% J1 n; H$ I6 F; j( N
  12637.     ((= eltype "Varies") (setq lt-idx nil))
    # A7 }: U( W6 T  W, M
  12638.     ((= eltype "BYLAYER")
    , c4 ~; X/ _0 q# C" _5 o* a! R
  12639.      (setq lt-idx (getindex "BYLAYER" ltnmlst)))9 i" m6 O* @- U& K
  12640.     ((= eltype "BYBLOCK")- _; U/ P8 Q$ q- H4 Q
  12641.      (setq lt-idx (getindex "BYBLOCK" ltnmlst)))
    + J2 {5 H# p! I0 R% A
  12642.     (T (setq lt-idx (getindex eltype ltnmlst))): P+ e' ^6 R! {5 g1 @1 ]7 b
  12643.   )1 K% r  y( |+ y. W$ l" v. l! k
  12644.   (if (= elayer "Varies")
    7 N) n4 z) F( m7 a' m8 v6 F3 V; T
  12645.       (setq lay-idx nil)
    2 L1 I8 z( W1 s7 u0 L$ x- G, ^
  12646.       (setq lay-idx (getindex elayer laynmlst))
    * g! M. `, f% u+ r2 ~
  12647.   );if
    % p3 y4 |* }$ \. X$ u
  12648.   (if (= ethickness "")
    ; ]+ w( e& O- \! a8 v6 b4 q
  12649.       (setq ethickness nil)0 q- I* q1 p* f3 E& g
  12650.   );if
    $ K  ?" v& W& o( l* L% ]- d- x
  12651.   (if (= eltscale "")
    7 g  {5 R" \) p' g4 S
  12652.       (setq eltscale nil); e& I6 E6 l* T0 B, e
  12653.   );if
    : v5 z( W0 H! m& Z# ^
  12654. 8 b! q. j+ z- A; J$ m9 T& ~. ^0 F* c
  12655. );defun ddchprop2_init   ; end (ddchprop2_init)4 g  d/ M1 G  e, L/ J" B

  12656. , Q) o9 m8 n5 q  ^  ]  h
  12657. ;;; (ddchprop2_select)
    % d# I" c4 e4 X
  12658. ;;;3 y/ C1 N% T# x* z* h
  12659. ;;; Aquires selection set for DDCHPROP2, in one of three ways:: h' o. R- r3 Q: ^( n
  12660. ;;;
    * p' c! a1 C) ~8 m, \* ]' I( P6 m
  12661. ;;;   1 - Autoselected.6 `: H2 P2 n7 b
  12662. ;;;   2 - Prompted for.' M. `: v5 x7 Z( r: M- \# X6 V
  12663. ;;;   3 - Passed as an argument in a call to (ddchprop2 <ss> )
    ( B3 U, ^7 X3 f
  12664. ;;;3 `2 a% K& b9 t5 m. o3 e. g+ T
  12665. ;;; The (ddchprop2_select) function also sets the value of the
    ) ~! F& y8 F: z7 [, x6 M) M: v
  12666. ;;; global symbol AI_SELTYPE to one of the above three values to# h+ Q5 A' D* b$ P8 i5 v% m
  12667. ;;; indicate the method thru which the entity was aquired.
    ( Y, Y0 Q& ]( E  [' g
  12668. ( Z; D1 X% y9 n7 B3 \  N- ~

  12669. + Z( v5 X6 j" A3 p( X2 _% t
  12670. (defun ddchprop2_select ( / )
    2 o5 u* m2 I; W4 U$ \- h4 e) o

  12671. 8 O& f2 T1 _8 a3 q# S

  12672. 8 U" e' W9 W) {
  12673. ;returns only entities in ss that are in the current space.
    ) P! S& J) ~# c: ?& Y5 N
  12674. (defun ss_in_current_space ( ss / a cur_space ss2)8 ^: @+ M7 t& {! q5 m. Q; I

  12675. & v) G, ~! F! ~+ w  M7 |1 K2 [
  12676. (if ss5 m! d! x2 r8 z5 o( l: @4 `
  12677.      (progn
    # Q; r+ y! y5 ?( |
  12678.       (if (and (equal (getvar "tilemode") 0)  H. E3 z: B% Z) o& [
  12679.                (equal (getvar "cvport") 1)
    4 `$ x" }* X( R, F  M7 o8 y1 V/ g
  12680.           );and
    8 Z- z& r0 F1 F, |0 d  i
  12681.           (setq cur_space 1);then paper space is where we are.1 g5 @) M& Z9 u8 Q! a0 e
  12682.           (setq cur_space 0);else model space.9 x4 \/ B# F* D# X+ F" B
  12683.       );if
    ' \- q' O; e! h1 \4 ^  v
  12684.       (command "_.select" ss "")# `! _: e, p1 w- b. p
  12685.       (setq ss2 (ssget "p" (list (cons 67 cur_space))));setq9 {' f9 t; c- `8 k3 o( K) V+ ?
  12686.       (cond                              ;;;;;tell the user what's going on.
    6 ^) m) K# e) P5 U  t) F  A; R
  12687.        ((not ss2) (princ "\nNo objects found in current space."))
    - y- \' i1 z$ ?% v- s
  12688.        ((not (equal (sslength ss) (sslength ss2)))& j) Y- ^4 w, }1 F' y
  12689.         (princ (strcat "\n" (itoa (- (sslength ss) (sslength ss2))); l+ T, R. ?3 ~) K1 b! R
  12690.                        " object(s) were not in current space."
    " R3 I$ d6 d" H) f* _& o
  12691.                )
    % d7 Z4 f8 |" e1 E
  12692.         )
    * z9 @0 F7 V5 r3 `1 N( U
  12693.        ) 7 t5 G2 @5 L' W% L% C+ Y8 o
  12694.       );cond $ r/ @) y; A9 n3 o9 J
  12695.      );progn then6 n% v+ \( ~  D% T  a: G: Q) L" O
  12696. );if  
    9 g1 j; Z/ [! T" k4 [& U
  12697. ss2% z) V# @; n. P: M
  12698. );defun ss_in_current_space
    / [8 a- g( X9 B2 F) K, F
  12699. ( U" Z' A5 f: m. w; S( s5 `! }; ~$ G
  12700. 1 H9 Z- Y( o/ a3 h" I
  12701. ;;;begin the work of ddchprop2_select) y- Y* M6 F6 W
  12702. ; k/ p/ H; r0 Y; A: h1 A2 U* ^7 j
  12703. ;; temporarily restore original highlight setting.
    & k' w# M* a4 K6 n
  12704. (b_set_sysvars (assoc "HIGHLIGHT" (car bonus_varlist)))7 k+ l- k& M6 }4 U6 F5 m
  12705. (cond$ B+ g& I! I+ q' o, V1 X
  12706.    ((and ss . W$ R! S9 x: ^, D% Y4 [/ _
  12707.          (eq (type ss) 'pickset)! g7 e* u! A5 Y7 U1 t
  12708.     )        ; selection set passed to  @% ^& y, d1 U
  12709.     (cond                                   ; (ddchprop2) as argument! J8 \( f7 p: m. D. _$ {( o
  12710.      ((not (zerop (sslength ss)))       ;   If not empty, then
    . C- Y: c: p/ A' i9 ?# q2 B
  12711.       (setq ai_seltype 3)               ;   then return pickset.
    ! [  O) v4 _5 |, g4 p! J7 K
  12712.       (ai_return ss)
    : z. \9 _1 ?( t4 e% A3 s4 r. O
  12713.      )
    . U) E8 F- o* V/ }4 `4 i
  12714.     );cond close
    7 \- Y" h& w' F7 g- C; M" z
  12715.    );cond #1
    ' G/ z* x3 y. o/ A. y
  12716.    ((setq ss (ai_aselect)))                          ; Use current selection* o# q5 h+ I- v! l- G* C
  12717.                                                      ; set or prompt for objects% j. t9 l! o3 E+ K/ H
  12718.    (T (princ "\nNothing selected."): a" @- j8 i7 b: T
  12719.       (ai_return nil)2 `6 ~1 p4 {4 p# I$ J
  12720.    )
    : m3 O5 E' u1 d( K& s, J" O
  12721. );cond close- u  ^$ Z4 S6 C" O/ P1 |  l
  12722. (b_restore_sysvars)% R, R2 S  A) M$ c. A5 b; [
  12723. ( L% U& N, _0 e) _: y( D
  12724. ;(if ss8 t; F/ v& j* L" @4 ]0 S; r& `
  12725. ;    (setq ss (ss_remove_locked ss)) " f/ a& k: S" Z* \! Q  A
  12726. ;);if
    ( v! A* {  a! c3 Z. J, [" A/ @2 i
  12727. (if ss* w$ m# X* r' a' X9 C4 ~. O* e
  12728.      (setq ss (ss_in_current_space ss))
    0 ~7 \5 \, P; B3 K+ y
  12729. );if4 l6 i9 r. B3 p$ N$ g# z

  12730. 7 T$ u9 Y! K* {* J
  12731. ss
    . s% Y. P6 ]! a! s$ ]1 B3 o
  12732. );defun ddchprop2_select4 X* J! \' |6 {$ g
  12733. 9 q4 ^# J0 X; |- b
  12734. , j% I- F+ }. y$ F5 y
  12735. ;;; Define command function.  h& X6 m4 A, z5 ]5 x. K: b
  12736. (defun C:CCH ()& D* L6 D: j0 ^
  12737.   (ddchprop2 nil)& v6 i8 E" e/ w' i4 g1 s/ B
  12738.   (princ)
    + d- o+ n& N% @9 P+ ~& v; G0 b
  12739. );defun# F: X) `5 a- J+ `, n- W
  12740. 6 ~2 J# P$ P" c! |8 D5 B

  12741. # u% h- k4 x4 O4 U  O
  12742. ;;; Main program function - callable as a subroutine.
      P" b) L7 M  ]6 u3 N, n: [
  12743. ;;;
    " v2 O8 l: |; Z/ ^, y2 |
  12744. ;;; (ddchprop2 <pickset> )
    - o  L1 t+ q4 P( r& n# H* ]
  12745. ;;;- b) i; t, H. q7 Y; J
  12746. ;;; <pickset> is the selection set of objects to be changed.
    & D- l7 [2 N6 [1 x2 E" J+ U
  12747. ;;;" p5 M; q: n! z' p
  12748. ;;; If <pickset> is nil, then the current selection set is
    ( q2 _2 {. O9 |& D
  12749. ;;; aquired, if one exists.  Otherwise, the user is prompted; D- |: e6 z9 a* h! R7 n
  12750. ;;; to select the objects to be changed.
    - `5 q9 q' Z  X' ?, g7 R( l1 |" h  Z
  12751. ;;;
    % e6 J+ H3 s/ ?' Z5 V& l
  12752. ;;; Before (ddchprop2) can be called as a subroutine, it must
    5 w8 G& V$ u5 o  A) E
  12753. ;;; be loaded first.  It is up to the calling application to
    ) s; T2 C4 I+ m4 o- k' M
  12754. ;;; first determine this, and load it if necessary.
    1 ]! z$ p  H/ t1 J9 U, E( e
  12755. * z# y3 L3 A  f( D2 u" u
  12756. (defun ddchprop2 (ss  /
    7 p; q6 U; M4 F7 c$ P; B8 T4 c8 \/ u
  12757. ( ?/ K# U! I0 t3 D2 i" A
  12758.                   a
    4 p- }1 \9 I$ z
  12759.                   add-mdash6 ^( K8 B7 ^# F) g1 w
  12760.                   assoclist* A; k* s6 y* d) _1 h
  12761.                   bit-70/ Z: E8 I: {2 O0 j8 E1 E% k- v% a; Q! m
  12762.                   boxlength2 A# T+ z: h$ n8 m- s" p
  12763.                   bylayer-lt
    4 g- `8 U" L& P+ `  Z' B7 K
  12764.                   bylayer_col
    2 i7 R5 {) _) O5 @$ s  U; s2 _& u
  12765.                   bylayer_lt
    ; h: a0 _( e6 a4 n  q6 {& }) I. |6 |
  12766.                   call_chp2
      D. t; r( Y$ {4 B& I% ]
  12767.                   chk-col
    0 F+ L9 j: Z6 O1 \. {9 W! P6 `! [
  12768.                   ;chk-etype        ;var removed by rk
    5 J# u+ p& n" O% D7 [
  12769.                   chk-lay    7 E4 u+ H% v! `% s3 D
  12770.                   chk-lt4 D/ ~  p% M4 J0 ~( K9 t
  12771.                   chk-lts           ;var added by rk # M" N- O/ P( X; }
  12772.                   chk-th
    ) o+ e* x  `5 ^5 N+ E
  12773.                   cmd
    * ^7 y/ b& k# N$ Y
  12774.                   cmdecho: x9 Y2 z' K1 b% b7 n: J
  12775.                   cn! v5 `8 j1 x2 ]5 i& o3 g' E
  12776.                   cnum1 e( m& V0 }5 g0 s* j) O
  12777.                   col-idx
    # _; C2 h3 o( d# [+ O) R$ V
  12778.                   col_def% E0 V" E' r( @9 q
  12779.                   col_tile; d* b# a0 P2 s' S0 ]( q/ k4 [" r
  12780.                   colname  O- z9 w; B- K- O1 x7 c) ?! P
  12781.                   colnum
    3 J+ A1 _% ~" [  d
  12782.                   color
    - D: y: i6 ?; _) S- k. q' P% d5 t
  12783.                   colorname% V, p- d; i6 H* a. v4 A# P
  12784.                   cvpname
    ( d! E6 g* F' ^6 W2 O1 @9 A" H2 J* E
  12785.                   dash6 r/ K% o: n3 V* {) p( x; L! S
  12786.                   dashdata
    ( R/ W) J1 I; c# W
  12787.                   dashlist
    ( g' A6 C5 P7 H" R' [2 M
  12788.                   dashsize7 Q7 C' T" _% {( ^* E% n
  12789.                   dcl_id
    1 b/ g& v& ]* Q
  12790.                   ddchprop-err
    2 e) }% C! H7 @* k, k- Q
  12791.                   drawpattern
    9 V  C$ h- z7 u9 x$ N
  12792.                   ecolor/ u6 d; }: P. B3 w
  12793.                   eelevation3 l) P+ ~! f; z' n+ o" f
  12794.                   eflag  m- d, z7 w2 E3 F5 f) g: Z1 b8 L5 T
  12795.                   eheight5 D: ^) V, I  Q* J
  12796.                   elayer" _2 @4 `5 K0 V- O6 w8 K5 K& l
  12797.                   elevation
    1 }+ Y! p" ^+ Y5 q3 |, _
  12798.                   elist
    : X% T# w" d3 s; [8 W: `0 f
  12799.                   eltscale
    $ {5 f2 ]2 F$ |5 b
  12800.                   eltype
    " B, ~8 ~; a' K- x( ~% |5 o" R; ^
  12801.                   en7 g3 ~9 u6 {  |8 e* F
  12802.                   ename
    9 _, i" d* n( ?# z$ E! b' A
  12803.                   ESTYLE             ;var added by rk; z* H" r3 B4 J7 D$ ^# n% F
  12804.                   ethickness6 i1 }8 w7 |2 e* {1 W
  12805.                   ;etype             ;var removed by rk
    # I8 T6 ~* N2 a2 A
  12806.                   ewidth0 C- A, C) l4 |: m
  12807.                   fchk0 w$ `, `& e6 \7 s) {
  12808.                   frozth# G3 O6 K" x/ E1 \0 V* y0 s7 V
  12809.                   fx
    - F3 m* V3 l8 b+ M$ I
  12810.                   getcolor
    ) b/ c6 Z& h( Z7 V3 N
  12811.                   GETELEVATION      ;function added by rk
    % f7 g8 X9 e! Q5 \/ E+ Q! {
  12812.                   GETHEIGHT         ;function added by rk
    ) D; _/ ?9 R) o& j$ x
  12813.                   getindex
    * v' K% `# ~3 m. j! N" F- y
  12814.                   getlayer
    # l( P' V% y: J7 S& R4 `8 B  M/ }
  12815.                   ;get_locked_layers ;function added and then removed by rk
    $ U1 q' Q$ o' q$ ^9 |4 Z  |
  12816.                   getltype# _1 \( p% X+ o
  12817.                   getprops
    ) k( J3 r0 Y: E0 F- v. L
  12818.                   getscale          ;function added by rk
    6 C8 L2 X+ M! o& P8 h" a# Q' D
  12819.                   GETSTYLE          ;function added by rk
    1 P2 {; T4 X+ c
  12820.                   getthickness
    5 Q0 k8 V: ?1 V( R9 x
  12821.                   GETWIDTH          ;function added by rk! w  Z7 m; j3 ^, a( \8 }' {1 D
  12822.                   globals
    " A8 E$ {" J" q" K) M
  12823.                   HAIR_STYLE_LIST   ;var added by rk0 i% y3 f2 R' A+ @
  12824.                   height' `6 ^" [9 f- e, r7 B0 ]* r: d
  12825.                   index7 Q& J. g" _% V) L* R% Q
  12826.                   item
    ) f  L4 M0 C+ d1 ^6 A5 B
  12827.                   item1+ S! M8 X9 r1 B; w/ \/ w1 X$ O8 r
  12828.                   item2
    / V/ }2 `! B* J" u, D
  12829.                   itemlist
    . f" J8 M9 k) k% ]! m
  12830.                   lay-idx
    $ S# Z) m) d- a
  12831.                   layedit_act' x; Q  A4 A3 N" K, l! H
  12832.                   layer
    9 o2 J9 G8 @( u, f1 b
  12833.                   layinfo
    9 [* {4 y9 [$ K3 Y% y
  12834.                   laylist4 i% _, D8 D) Q; ^# K
  12835.                   laylist_act& X6 c  ?, z% F3 I! o3 G; [- L! q3 C
  12836.                   layname
    4 z6 d# a8 b0 `7 Q; o$ o
  12837.                   laynmlst, J1 P& j7 W9 U  y+ \7 T" A
  12838.                   layvalue8 v$ @7 P1 ?7 g: D
  12839.                   linetype* k$ ~4 N4 y* U) e, R
  12840.                   list1
    + t" G9 {# e: B3 @# P% D, {
  12841.                   longlist
    8 P& U, w. m& X3 _  A6 j, |
  12842.                   lt-idx! H% D8 E4 {, G2 h4 ]$ F
  12843.                   ltabstr
    4 ]0 }6 M/ z7 E' C" w
  12844.                   ltedit_act
    ) _" q# y; n. Y! M0 x; @" f
  12845.                   ltidx
    0 H9 s" e" Y% s( z1 d  V
  12846.                   ltlist3 ^! P! H) k( }2 E0 H; a7 {, A2 X7 r
  12847.                   ltlist1
    ' w) L% j% ?/ P% e
  12848.                   ltlist_act
    7 M3 n' H! D  ~, k+ Y! g1 E
  12849.                   ltname6 W' j0 v1 ^' s4 v. {1 q
  12850.                   ltnmlst
    ' v# @  x7 `/ J, x/ Q" @
  12851.                   ltvalue1 ^4 U% B7 n/ Q" y
  12852.                   ltype4 u0 C- }8 w  a5 ]( T
  12853.                   m8 d4 b/ J" D5 t% `% q. `% \6 d) b, _
  12854.                   makelaylists  e1 {9 |) W, |' D9 {0 R
  12855.                   makeltlists
    & [( ^& Y. L% l5 H3 B. s1 p
  12856.                   match-col
    & T5 h" [) ]" v, T
  12857.                   ;match-etype          ;function removed by rk
    9 O. X1 Z8 E  _- d) [2 r
  12858.                   match-in9 F! N6 i" ?( N/ h1 ]7 a
  12859.                   match-lay% Y- t. e. [# e
  12860.                   match-lt' o' W  e, \! H# g
  12861.                   match-lts
    - N' h* D' G+ w7 u! [) @
  12862.                   match-th3 n; T, S& G1 N0 i6 u% Z
  12863.                   match_col% L% k0 ]3 n) f- v
  12864.                   mdashlist
    ! W* x# T; D# W* {
  12865.                   ;MPOPLST               ;function added and then move to ac_bonus.lsp by rk# f- @; g, l% k
  12866.                   n& M6 ?* v! x( A) m+ }" \! Z" F
  12867.                   name! p( ?' o. Y! i$ }
  12868.                   ncolor+ \% W6 r' ^& H& Y, d
  12869.                   nlayer
    ' k& i. z, u  [- h; z) M& o0 s0 F
  12870.                   nltype
    6 P% P$ ]( A& p8 `
  12871.                   nthickness
    9 q; L1 P' S6 y
  12872.                   off
    ( x  [7 C, l4 [- z5 k+ A
  12873.                   old-idx
    ; w6 }* O4 E6 x% f1 \
  12874.                   olderr
    * |$ s$ z+ n7 z" V5 d9 @7 h
  12875.                   on  G/ K3 Q7 H) e
  12876.                   onoff. L, ~" d5 ]6 Z7 a' ~' d9 s3 ~( u
  12877.                   patlist
    7 S& _: v* Z3 ?$ W2 p
  12878.                   pattern
    + x2 z; J/ s7 }1 h$ ^$ _
  12879.                   PL_WIDTH_GETTER       ;function added by rk
    ) A; b# ~9 |9 w
  12880.                   POLY_SS               ;var added by rk
    9 a& Q9 u& O! e, c# @
  12881.                   ;POSITION              ;function added by rk and then moved to ac_bonus.lsp
    - Y. K" x1 u- \! R/ ?
  12882.                   proplist& Z8 u5 B4 D+ [% j# X
  12883.                   reset-lay) _; u, `# H+ [1 }7 Z% `* ]
  12884.                   reset-lt
    2 v8 e4 l9 c3 X8 y- }
  12885.                   s# ~' v/ t. e' C, D6 N# l7 f
  12886.                   selset) J3 F7 R8 I, K8 H) X4 `
  12887.                   set_col_tile5 y6 e  y( D9 Q3 |
  12888.                   sortlist2 }; o- d; m0 {" M+ [$ V2 j9 i
  12889.                   ss- \- h- f9 U4 A8 @  ~, F
  12890.                   ss_in_current_space  ;function add by rk.
    $ `5 V4 C" E% m, v% S7 A
  12891.                   ss-index# Z$ m5 x0 s; Q# F5 f, @5 p
  12892.                   ss-length
    * F' ]2 c2 t. R
  12893.                   ;ss_remove_locked     ;function added and then removed by rk.
    0 s3 f& A9 g8 v+ o9 U/ U
  12894.                   sslen. S. `. N8 n) [8 C3 V: ?
  12895.                   temp_color
    , }! o0 {: @+ M4 X
  12896.                   templist) w- j: i, K9 k( }6 E' b2 d; t
  12897.                   test-main-ok1 N5 O' I) ~4 L
  12898.                   test-ok* P6 V7 M+ G; ^' y
  12899.                   testidx
    / D( @$ g/ A# {
  12900.                   testlay
      g& P' s" ^) m& k0 _
  12901.                   th-value
    9 r" N" Z& ?- o3 v) W
  12902.                   thickness
    0 Q5 j7 d, o8 u# W* j) a
  12903.                   tile
    + p8 F8 Q% |( w. L
  12904.                   tile_rect" K  u2 |' B. x3 m, _
  12905.                   tilemode8 \( s& L: T( g; W& M6 l
  12906.                   ;TNLIST           ;function removed and moved to ac_bonus.lsp by rk0 |) ~: D3 G, T
  12907.                   TXT_SS            ;var added by rk) L0 P% L$ y+ q( D8 B
  12908.                   ;undo_init        ;removed by rk.
    5 W) B0 D% `2 x6 P9 k9 ]# K* ~, R. c
  12909.                   vi4 `+ q( I( |3 f; _) N
  12910.                   vpf
    * E9 F& l& H8 O' `/ t; B
  12911.                   vpldata/ x* D6 S6 t3 i7 E4 c# C
  12912.                   vpn
    , [2 ^9 O& e  X
  12913.                   which_tiles0 c# {7 S6 c0 }: ]: Z
  12914.                   width
    # |; M5 S# m8 n; Q: O+ Z7 x5 i
  12915.                   x4 ^' F( \: ]1 S$ d
  12916.                   x1/ ?* w- `( C1 d4 N' I, Z
  12917.                   x27 I& Z' I- S. c& p
  12918.                   xdlist  ^0 k; e* w( e
  12919.                   y$ z1 D' Y+ `; ^' o/ l" n5 S2 Z) l) g
  12920.                   y17 _8 @* W$ m9 c" s# s" \; ~
  12921.                   y2: o) D5 A7 D" m7 i
  12922.                 )
    / g: ~$ h. G' V+ F3 w6 l9 m
  12923. 6 c( S  N! U' e' m9 s) l
  12924.   (if (and (not init_bonus_error) 7 D2 g% S" h$ Q
  12925.            (equal -1 (load "ac_bonus.lsp"  -1)) : }3 E& t- }% ?, q' @  d/ e' d4 c
  12926.       );and
    / _. J0 n" G3 J% [  l& T
  12927.       (progn (alert "Error:\n     Cannot find AC_BONUS.LSP.")(exit))- _7 b: p! k+ y; Z3 b! J7 e  u
  12928.   );if
    2 r3 ]) Q* O1 G9 I4 S
  12929.   (init_bonus_error (list
    # g6 ]" K, s' g" |$ Q! Z
  12930.                      (list   "cmdecho" 0 0 r3 D. l  H) ?' h
  12931.                            "highlight" 0
    - `! b" r8 A9 v9 r
  12932.                            "regenmode" 1' [  [5 Q$ Q: A) \. G& L5 w3 S
  12933.                              "ucsicon" 0$ O  D4 B, J; B, b7 x1 B
  12934.                      ) 8 J- Z1 {7 a, }# a7 K( c
  12935.                      T     ;flag. True means use undo for error clean up.                    
      Q) q* h: O/ @; d
  12936.                     );list  * M+ R# T- a9 R' w( |) b
  12937.   );init_bonus_error
    5 [) F9 }/ s3 V4 I2 v, S; `1 X: E
  12938. ) t' [1 O8 M$ c2 T
  12939.   (cond# B2 k4 {, ~" K2 J2 z" m- v
  12940.      (  (not (ai_notrans)))                       ; Not transparent?
    % y  D0 y' z5 ~- [
  12941.      (  (not (ai_acadapp)))                       ; ACADAPP.EXP xloaded?
    ) C- E' L3 A9 U( H, B& h+ A
  12942.      (  (not (setq dcl_id (ai_dcl "exchprop")))) ; is .DCL file loaded?
    + ~& o* w+ P: k* U
  12943.      (  (not (setq ss (ddchprop2_select))))       ; objects to modify?
    - a7 k, e7 x  d! S1 Y: ~
  12944.      (t
    / f  j) E4 `% b$ j- C
  12945.         ;(ai_undo_push)
    5 [& E1 C0 _& Y5 M6 B
  12946.         (ddchprop2_init)                          ; Everything's cool,: w, W) X, {5 C6 R7 I8 x
  12947.         (call_chp2)                               ; so proceed!1 h0 u* W$ G" c, x5 j
  12948.         ;(ai_undo_pop), o9 K3 M7 Q, A$ R$ a# s( f
  12949.      )6 I2 ^; e3 c9 f: E. [0 s0 ?6 n. W! d& }* `
  12950.   );cond close
    7 \; o0 V. y3 [6 D- C3 P' p

  12951. ( i+ S+ O) Z( v0 C. L) e0 i- ~
  12952.   (restore_old_error)
    % N$ Y! c# C* \5 h( J$ P# [

  12953. # [% F9 ~/ I5 Q) x$ ]  M" ^
  12954. (princ)
    5 z# {: Q6 y( g" C( R
  12955. );defun ddchprop2
    9 f) n8 B4 z4 {7 R6 Q: {* m
  12956. 8 D" N' Y$ _" V1 u3 [# A9 K& }  Q  O3 Y
  12957. ;;;----------------------------------------------------------------------------/ ?6 u! S2 J0 [" g. Q0 l

  12958. ; `. G* x0 D' \; {
  12959. (princ "   EXCHPROP loaded.")
    " _, ]9 i: q# ^' m
  12960. (princ). J/ Z/ D- A. R7 f9 M5 n
  12961. - z; C4 S  {: Y0 ]+ e
  12962. ;;;----------------------------------------------------------------------------
    7 K1 m) j% l- C! O9 R( D. e
  12963. ;;;---------------------------------DDCOLOR_LSP--------------------------------
    " D5 O: H% I6 m- D+ {
  12964. ;;;----------------------------------------------------------------------------
    , z6 w7 O8 [: Y" m
  12965. + w* }9 }$ c: Q
  12966. ; Next available MSG number is    24
    2 h$ X* V& [. _
  12967. ; MODULE_ID DDCOLOR_LSP_" i/ `  U9 X0 [/ c: P2 m
  12968. ;;;6 w; l- U) R2 a) d: W# w
  12969. ;;;    ddcolor.lsp
    - ?1 U6 u7 L; G- ?) V
  12970. ;;;    % L1 `% ?" }4 x1 S1 D7 X" R
  12971. ;;;    Copyright 1990, 1992, 1994, 1996 by Autodesk, Inc.
    7 }9 V2 H' R1 b- A6 W3 _( H
  12972. ;;;1 k; U8 n5 s8 Y$ z/ V
  12973. ;;;    Permission to use, copy, modify, and distribute this software
    # v7 D+ w8 E9 G5 ^6 m) C8 S
  12974. ;;;    for any purpose and without fee is hereby granted, provided, @5 Z: z: E1 k* U
  12975. ;;;    that the above copyright notice appears in all copies and) `9 o% c% F% y* o: J
  12976. ;;;    that both that copyright notice and the limited warranty and
    : t) v$ O$ G5 o0 B* q; n6 [
  12977. ;;;    restricted rights notice below appear in all supporting( T) p/ |( R5 |; Z( ]- F
  12978. ;;;    documentation.
    # B+ h# U6 O7 U, |3 q! |
  12979. ;;;% W1 F! L8 {: ~; N: Q
  12980. ;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.# k1 Y  q+ f* }9 [6 F
  12981. ;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
    9 U4 d7 e- Y0 w# I$ F
  12982. ;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.0 ], R$ l1 p( E3 Q( M3 u& V+ w! L
  12983. ;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
    + u1 ~3 x0 e  e* L! {
  12984. ;;;    UNINTERRUPTED OR ERROR FREE.8 u2 a( M- S( \. v
  12985. ;;;
    + S# q1 d5 Z- ^2 x) o0 W
  12986. ;;;    Use, duplication, or disclosure by the U.S. Government is subject to
    3 Q2 n% L, |, D! ~+ O
  12987. ;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
    . T8 K/ L. z7 d, f7 v
  12988. ;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 8 [( ^7 W! U  i" ]8 r! d7 d
  12989. ;;;    (Rights in Technical Data and Computer Software), as applicable.9 R1 q* N( n& N9 L
  12990. ;;;
    / Q! k0 b, @9 e3 \
  12991. ;;;.
    0 Y! P. Y( Z6 @% Q
  12992. ;;;- h! {) L6 Q8 n  M5 p: {  X
  12993. ;;;----------------------------------------------------------------------------
    ( _9 F8 G' |7 I& P; ~1 x
  12994. ;;;    DESCRIPTION
    ) J  W( `2 F, r
  12995. ;;;     3 ^- l$ S% X  X" [
  12996. ;;;    Chromatic Pallete style color selection dialog.
    ; C8 C# B! }) f1 n, S- }
  12997. ;;;   
    - \( r" B+ o; S5 G6 e* V2 a
  12998. ;;;    Globals:
    8 E7 c& ?: V0 f) H
  12999. ;;;    + g  O: Q8 K% a
  13000. ;;;          chroma_color - Integer color index.  The last value selected# i7 J5 l2 ]+ |$ q
  13001. ;;;              by the user in chroma dialog.  It is not cleared or reset, Q  `" M7 M) U1 l6 u
  13002. ;;;              by a cancel.  Only used for communication between callback2 _- k# ?; I5 J$ @/ ~; |
  13003. ;;;              functions and the (chroma) funciton.% X4 d8 o  [1 X4 ]2 I0 L) M' R
  13004. ;;;   
    1 }4 ]/ u3 q5 E$ B5 {7 ?& O; v
  13005. ;;;    Depends on the definitions for the dialog provided in chroma.dcl.
    . |" A- v3 e& b# j
  13006. ;;;    + F0 R4 K" E/ L0 w
  13007. ;;;$ l' C9 p# y+ \
  13008. ;;; C:DDCOLOR -- Dialogue front end to the CECOLOR sysvar.  Uses the chroma & _: Z7 s# C3 m' Z5 v
  13009. ;;; pallete style color selector.
    ' q; t3 u- J' `5 Z
  13010. ;;;
    2 H9 I. L8 B% G0 u2 `  D
  13011. ;;; ===========================================================================" C6 J+ r: D5 O7 D
  13012. ;;; ===================== load-time error checking ============================
    ! s4 V) P! U1 r7 X/ s# `9 n
  13013. ;;;# e; y' C) ~+ V2 c0 ~% U
  13014. / G! m& o: M* C4 m" k0 i
  13015.   (defun ai_abort (app msg)
    - m/ Z$ I1 y9 _# g0 n6 d
  13016.      (defun *error* (s)" W' Z: X1 M5 i7 L
  13017.         (if old_error (setq *error* old_error))* R  L# m" [9 z7 m
  13018.         (princ)
    : Q/ T9 j! i% }0 x% J, P4 r1 Z
  13019.      )
      V4 `; v6 w; {  ^" g
  13020.      (if msg
    $ Q7 u6 K; h% |2 A' l. x- h
  13021.        (alert (strcat " Application error: "
    7 X5 I' ]$ ?4 u7 l: @/ W7 I( @6 F
  13022.                       app
    # B7 [0 `6 m  `& a: w
  13023.                       " \n\n  "7 K% q) d0 G. \/ j: y, v. W3 P
  13024.                       msg+ r( _' L( p  m! Q
  13025.                       "  \n"+ Y. A( L, l' l/ X0 a8 [" e9 ^
  13026.               )
    ' Y0 B. _/ v) \7 }! J
  13027.        ); J& q5 g/ R1 F' U
  13028.      )9 T' s/ t% |  p9 U3 a
  13029.      (exit)
    * M$ V  `6 g  k  |* A, d6 \+ U% n6 @
  13030.   )
    ! {8 f& R4 |, v) k0 Y% r

  13031. 6 d0 i! w3 x# r0 X+ z$ Y
  13032. ;;; Check to see if AI_UTILS is loaded, If not, try to find it,
    * C: x8 `+ c% o7 G( z# |4 H
  13033. ;;; and then try to load it.
    , p$ E1 v5 p& c) {( \
  13034. ;;;  Z5 c4 ?5 P4 {- o6 Z$ f7 ~
  13035. ;;; If it can't be found or it can't be loaded, then abort the
    % e) b* D1 D) G( G. T3 b, r: b
  13036. ;;; loading of this file immediately, preserving the (autoload)4 v: o* u8 G% T: L* _' I6 g9 H% f
  13037. ;;; stub function." A$ \: ?* j2 O  V2 [
  13038. " \: V# R6 c! n  U3 F; p( D
  13039.   (cond# d/ U' y4 d' V3 z6 l7 m" C1 W
  13040.      (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.1 ?& k; D6 F2 D5 o5 N9 X% g

  13041. ( k8 G( m' g2 X% |
  13042.      (  (not (findfile "ai_utils.lsp"))                     ; find it8 }8 Y* l  e9 s, c1 Q) E/ R
  13043.         (ai_abort "DDCOLOR"
    , p- x2 _& T3 @" A' O$ \: Y6 N& u
  13044.                   (strcat "Can't locate file AI_UTILS.LSP."7 U$ Q" F+ R9 Y; \, |6 r" F9 K
  13045.                           "\n Check support directory.")))' n' k0 R( R1 o7 K8 y) d
  13046. + D; k& B0 {; l( R6 e% v0 E# V$ _
  13047.      (  (eq "failed" (load "ai_utils" "failed"))            ; load it$ B  u4 ^: k0 V% l+ A# X
  13048.         (ai_abort "DDCOLOR" "Can't load file AI_UTILS.LSP"))
    6 h* G, y% p. p8 ~: |' i
  13049.   )3 t$ n( Y4 z/ L

  13050. # _* ]( |, o9 Y
  13051.   (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
    : ?7 q1 X+ \4 c
  13052.       (ai_abort "DDCOLOR" nil)         ; a Nil <msg> supresses
    6 }5 U1 F4 s: W
  13053.   )                                    ; ai_abort's alert box dialog.! P1 z, x' G- z2 O2 t$ Q3 ~  g
  13054. " ?6 r4 _4 m: [6 n/ G+ s
  13055. ;;; ==================== end load-time operations ===========================
    ) ?& q- _8 n" S2 m% l

  13056. ) o- {- J+ F1 U# }
  13057. (defun c:ccc (/ co_oce clrx co_err co_oer lay_clr), p' n. ?6 A5 N5 x" T; E. q' n
  13058. . x9 A3 N; Y1 D7 j# `
  13059.   ;; Main Color function, called by setup code.0 `8 X, D9 l* Z' {2 W, Y4 F5 I
  13060.   (defun ddcolor_main()0 o/ y! k, ]; p9 R) k! N% L) {
  13061. - A6 E, @0 ]$ K4 `9 x$ N1 |
  13062.     (graphscr)
    " Q' }/ f8 }+ d6 j
  13063.   % U- `: H) M# v8 m' k$ h* C
  13064.     ;; Get the color of the current layer, for possible BYLAYER color swatch.* V. T5 L# ]' j" B
  13065.     (setq lay_clr (cdr (assoc 62 (tblsearch "layer" (getvar "clayer"))))), ?: B8 ~" p* b3 \
  13066.   A9 E# @6 |1 _4 h0 c
  13067.     ;; Call the dialog here.../ }: H8 O" i1 z: g" }/ E+ z+ ]
  13068.     (setq clr (acad_colordlg (cstoci (getvar "cecolor")) T lay_clr))
    # \/ A" y# g1 o$ @  M7 X- R

  13069. * w  ?1 n- U! f  p- L' V
  13070.     (if clr
    & g" M$ C; l4 \6 x" `; T& Z
  13071.       (setvar "CECOLOR" (citocs clr)))& O. e. o/ u* E" V7 y6 n9 G
  13072.   )
    2 j9 k! A0 C6 \: A

  13073. 8 q$ p% _9 j2 A& X
  13074.   ;;;4 V0 k( @) J6 }/ `6 j9 M
  13075.   ;;; CSTOCI -- Color string to color index
    , g- [# p7 K/ [& p1 |* P+ ^. |- D
  13076.   ;;;   Convert an arbitrary case string into a color index.
    2 @, {' S8 X7 a- ^: w
  13077.   ;;;   Returns nil if string is not a valid color.
    2 p! `, s* ]  F/ L" v7 [7 [
  13078.   ;;;4 T" {/ n. c8 x3 Y2 H3 ~, t
  13079.   (defun cstoci (str)5 h& v" J; U  k3 a4 i% `
  13080.     (setq str (strcase str))
    * e) r5 [  P; `
  13081.     (cond7 c2 H4 S$ U9 h* ]( k
  13082.      ((= str "RED")        1)
    " m; a+ j( M& Z' X6 H0 O
  13083.      ((= str "YELLOW")     2)) W8 ^3 t7 q  n# c
  13084.      ((= str "GREEN")      3)
    5 m" {( H+ }' L" G
  13085.      ((= str "CYAN")       4), m" u* D; @6 L* Z6 @
  13086.      ((= str "BLUE")       5)  X  L9 \- l  y1 l- ^9 ~
  13087.      ((= str "MAGENTA")    6)2 U" y: J* ^: ?: ]( x* F
  13088.      ((= str "WHITE")      7). _1 {0 W6 @- D, g8 \  S; m( Y
  13089.      ((= str "BYLAYER")  256)% s4 I1 r8 a) V" @; I
  13090.      ((= str "BYBLOCK")    0)
    & ^! P' f1 i. j9 F2 s/ f
  13091.      ((= str "BY LAYER") 256): I) T1 D. t! z0 R. E, m8 u, o
  13092.      ((= str "BY BLOCK")   0)7 V; u: E$ n* e9 C9 j/ M% A
  13093.      ((and (< 0 (atoi str)) (> 256 (atoi str))) (atoi str))* ?4 N% g) \; C0 r; j
  13094.      (nil))+ M$ g4 e6 \+ n! p  t& l( G
  13095.   )
    . C% ~, w) ]9 |& m( [" Q5 q% }0 J2 g- Q
  13096. ) W  w2 m: i- c( A. l

  13097. + H+ h1 p0 N5 N  q* l/ j/ ~
  13098.   ;;;' p* A1 l9 g+ ?+ E$ r
  13099.   ;;; CITOCS -- Convert color index into standard color name.
    . \3 a( T" t* m7 ]
  13100.   ;;;    Will return the standard and logical color names as text0 G; J: C0 g0 X# m7 G) f7 Q
  13101.   ;;;    strings.  Returns nil for out-of-range color indicies.% ?' A1 ?2 r% O) d7 o) v
  13102.   ;;;% ]& a+ |, h+ |; ?  d* O
  13103.   (defun citocs(i)
    & T  Z! p3 x' P, l
  13104.     (cond# _3 I* c- I0 z) j4 f9 I
  13105.      ((= i 0)   "BYBLOCK")6 W+ {4 o' {2 |* w# y! C# N
  13106.      ((= i 1)   "red")
    , B  r1 q( F. Q$ s5 J7 t& Y  f
  13107.      ((= i 2)   "yellow")
    8 D9 m2 g7 J. _
  13108.      ((= i 3)   "green")- d0 A8 k( H$ }* s
  13109.      ((= i 4)   "cyan")! ?9 b1 G/ g: E
  13110.      ((= i 5)   "blue")
    " ^! Z7 S% _9 o' s9 j1 c
  13111.      ((= i 6)   "magenta")
    & z# t& R, J' A8 n! G% t
  13112.      ((= i 7)   "white")
    7 R3 ^% R- r; Y4 `7 K
  13113.      ((= i 256) "BYLAYER")
    . c/ p& T! k  |# [( b; O+ q
  13114.      ((and (< 0 i) (> 256 i)) (itoa i))
    ) w$ z. `9 ^" ?, t
  13115.      (nil))
    ' z7 W5 t6 l  Y& [
  13116.   )
    1 n; J! }# u# x$ k. R$ }

  13117. 3 ^8 t9 h; I, s7 p8 [0 Z/ }2 d" T
  13118.   ;; Start of ddcolor
    + P* ~; X( O; B# ~0 G5 K. u* R* g
  13119.   (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho' ~. p" f4 r- |. ~7 A/ k
  13120.         old_error  *error*            ; save current error function4 @) `+ ^4 Z* ^; P7 h; ~) c
  13121.         *error* ai_error              ; new error function
    5 o' e; D* e8 h" F7 n% o
  13122.   )5 Z6 X1 Z! k- z& N# R3 ~
  13123. 4 f2 z) _. P0 M
  13124.   (setvar "cmdecho" 0)
    - |, P! ^4 C  U) `- K- j9 E9 F

  13125. 8 O& f- o' {) t8 R# \
  13126.   (cond
    9 ~* p  Q- ?& x% U8 U0 ]& K
  13127.      (  (not (ai_trans)))                        ; transparent OK, h& H9 s# _7 P  f1 ^" A( b
  13128.      (  (not (ai_acadapp)))                      ; ACADAPP.EXP xloaded?5 f5 M" C& G) I! ]

  13129. 9 d7 u: G4 L3 G) l+ z
  13130.      (t (if (and (/= 1 (logand 1 (getvar "cmdactive")))
    - A4 J2 [0 G" A& t
  13131.                  (/= 8 (logand 8 (getvar "cmdactive")))
    7 l% ~8 g! t" `
  13132.             )
    5 @7 b4 j# |4 C- _
  13133.          (ai_undo_push)
    . r0 t. a6 @7 W* ?- N
  13134.         )/ F% Y9 ]7 q3 J/ y( T' v6 Q% X

  13135. 8 u" R2 g; _9 P8 D" ^
  13136.         (ddcolor_main)                          ; proceed!
    " H# n6 v; u- w: `  D/ ~
  13137. ; j" {2 j/ e% A/ G9 u: }
  13138.         (if (and (/= 1 (logand 1 (getvar "cmdactive")))0 H: r( S3 F" ^$ S
  13139.                  (/= 8 (logand 8 (getvar "cmdactive")))
    $ _! J- R! [+ u/ h
  13140.             )
    7 ]$ |1 o" H1 g/ g
  13141.          (ai_undo_pop)5 B2 H+ y- e. r7 l* x  [
  13142.         ). {- T  S  K  L% [# O
  13143.      )  s) R6 S. c/ V4 `  [4 t# B
  13144.   )0 \; [/ P8 X0 q/ ]4 W

  13145. 1 w8 x7 V  Q% ]" x: A5 L9 J7 u
  13146.   (setq *error* old_error)
    , {0 t* n# _, u2 I) e5 I/ H- _
  13147.   (setvar "cmdecho" old_cmd)6 @# |# p% [, `; G" L
  13148.   (princ); Y0 P8 h& y3 a  `& y- D3 ?9 P
  13149. 0 w9 r# E, n. J' b% Z5 Y
  13150. )8 n* X) W% ~. U" j5 z
  13151.   r) T6 c! [* g! v$ }1 O# @
  13152. ;;;----------------------------------------------------------------------------+ a# P! _( w' [8 A% y+ O4 y' j' T

  13153. + z% ]6 W6 ]# |: i; y6 Z& S1 \
  13154. (princ "  DDCOLOR loaded.  ")
    : K8 p7 ]' H* }8 A: V+ z0 Q
  13155. (princ)
    2 z0 q0 A5 O  k# W9 K% q& D
  13156. . \5 x5 l" e6 d7 @* {
  13157. ;;;--------------------------------------------------------------------------;
    3 [! i6 b9 j: k' W2 i2 w
  13158. ;;;---------------Chon NHANH Nhieu Doi Tuong GIONG THUOC TINH----------------;
    2 u7 |; V* b9 E! B9 \8 o
  13159. ;;;--------------------------------------------------------------------------;
    # b& s1 R: n  l, G7 ?" N  x2 r2 `# c
  13160. ;;;   ssx.lsp
    5 _  [0 K* M' n4 F" s8 _9 F- I
  13161. ;;;   Copyright (C) 1990 by Autodesk, Inc.
    " {% I. D+ p# z. _/ x' F
  13162. ;;;   Copyright (C) 1991 by Control Systems, Inc.# G% b4 j) p9 q$ i1 O
  13163. ;;;4 f6 u/ A8 q. V( ]* Q
  13164. ;;;   Permission to use, copy, modify, and distribute this software and its: G& U. Y5 k9 N$ x7 L
  13165. ;;;   documentation for any purpose and without fee is hereby granted.0 y' {3 l) u' P% [* M9 ]
  13166. ;;;
    ' Q% b% t: D& q7 G3 M% T7 z2 W! y; b/ u
  13167. ;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.3 D) l3 u+ Y% J3 n/ H5 u
  13168. ;;;   ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
    ( k* H2 Z: u# z# c
  13169. ;;;   MERCHANTABILITY ARE HEREBY DISCLAIMED.
    8 C7 x- z( g+ y* U3 Z' a
  13170. ;;;
    # S1 U( Z0 B0 M8 I9 C- m) l2 R
  13171. ;;;   Larry Knott                        Version 2.0    7/18/88
    4 p' [6 Y+ B; S; Y( ]& n. u
  13172. ;;;   Carl Bethea & Jan S. Yoder         Version 3.0% ~4 ?/ A$ c6 s5 p2 I5 r# s" i
  13173. ;;;   Enhancements to (ssx).
    8 a$ Y) y9 H  k0 ~. _
  13174. ;;;   15 March 1990
    5 V1 w7 E3 J# @3 I
  13175. ;;;' K0 l8 @/ B( y0 B5 z' O) b; j
  13176. ;;;   ARTIST Software, Inc               Version 4.0   December 1991" ], {5 l( o: n, c, B4 P; p
  13177. ;;;   Modified for FLEXICON usage. If the variable FLEXVAR = 1,: r6 a* ^7 S2 ?+ j. i. K9 N
  13178. ;;;   use Flexicon menus7 K/ m$ E! k; L- ^
  13179. ;;;
    $ e9 i. i$ ^& Q) ~% V5 U
  13180. ;;;--------------------------------------------------------------------------;
    7 c9 B( D( J, a5 ~) X2 p
  13181. ;;; DESCRIPTION
    % D/ g0 _( y' M+ `  q
  13182. ;;;                              SSX.LSP                                  * a8 H+ x2 O* i+ `# _
  13183. ;;;                                                                          
    $ \  ?- p' g; i' I5 l
  13184. ;;;   "(SSX)" -  Easy SSGET filter routine.                                    9 K6 P4 J! ~, a
  13185. ;;;                                                                           
    2 h! @9 P5 B; k# n" H* i- r
  13186. ;;;   Creates a selection set.  Either type "SSX" at the "Command:" prompt   ; z& P0 o( |; D
  13187. ;;;   to create a "previous" selection set or type "(SSX)" in response to 8 F% c0 y# I5 n/ ~
  13188. ;;;   any "Select objects:" prompt.  You may use the functions "(A)" to add
    ) ^' d/ o! o. {8 m- K* x
  13189. ;;;   entities and "(R)" to remove entities from a selection set during   \" V# I9 c" P9 n; x1 m- w& u
  13190. ;;;   object selection.  More than one filter criteria can be used at a
    * c4 H% _  A: f/ q+ u5 Q; o2 ~' ^0 v
  13191. ;;;   time.         ' h' A( K# L, o5 F+ L
  13192. ;;;                                                                          3 t/ c# @6 B+ Y6 a2 A1 b0 o
  13193. ;;;   SSX returns a selection set either exactly like a selected1 `4 j% X! |. \# d6 ?# C  b
  13194. ;;;   entity or, by adjusting the filter list, similar to it.  j/ i4 {) D. N# q
  13195. ;;;
    $ D3 G( Q- N( d
  13196. ;;;   The initial prompt is this:
    1 y' J$ Z. _) i: Z' b! Z/ o3 |" K
  13197. ;;;   # p( v# \* l* s% E; A
  13198. ;;;     Command: ssx
    ! w0 m9 ?# c+ w; Z+ T! v
  13199. ;;;     Select object/<None>: (RETURN)/ X8 }0 a; Z5 |& ?: O
  13200. ;;;     >>Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector: 7 V* p, z3 B% J0 t
  13201. ;;;   ( y0 @) U! \5 k( Z5 o, |2 f" Z
  13202. ;;;   Pressing RETURN at the initial prompt gives you a null selection
    : R) R! i* J/ @( _0 b* a2 p
  13203. ;;;   mechanism just as (ssx) did in Release 10, but you may select an ! Q9 Z% S: C4 u  J/ u5 Z; o
  13204. ;;;   entity if you desire.  If you do so, then the list of valid types 6 M( V( Q* u$ ]8 J. o
  13205. ;;;   allowed by (ssget "x") are presented on the command line.
    8 t) D4 _5 `, O5 Q) r2 O
  13206. ;;;   ! {% b" z% C7 [4 r
  13207. ;;;     Select object/<None>:  (a LINE selected)
    + M+ q3 o* g( }1 e2 B- l
  13208. ;;;     Filter: ((0 . "LINE") (8 . "0") (39 . 2.0) (62 . 1) (210 0.0 0.0 1.0))   m& Q& g: q* w7 g) k
  13209. ;;;     >>Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector:
    0 V0 K# r4 C; @" b* k, r
  13210. ;;;   
    / M+ y6 ]* E% r9 ~' L) V
  13211. ;;;   At this point any of these filters may be removed by selecting the
    ) k: p$ M$ q# {" \# c1 G& O
  13212. ;;;   option keyword, then pressing RETURN.
    $ R' U4 t' [. P9 d
  13213. ;;;   
    0 ^' `4 G' {% e% O) E% K$ B4 ~
  13214. ;;;     >>Layer name to add/<RETURN to remove>: (RETURN). u( c* R4 s- k, K- \0 {1 A# `
  13215. ;;;         . w+ L. Z: u& s; x( ]9 x
  13216. ;;;     Filter: ((0 . "LINE") (39 . 2.0) (62 . 1) (210 0.0 0.0 1.0))! H# x: P: n/ i5 ?  c) V$ v
  13217. ;;;     >>Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector:
    ! j8 i+ f, r4 a% O0 h
  13218. ;;;   
    # j; K- x4 A2 M' b) Q0 k
  13219. ;;;   If an item exists in the filter list and you elect to add a new item, & k8 J5 A% d* s" P0 W2 j6 v
  13220. ;;;   the old value is overwritten by the new value, as you can have only ; V/ U+ S! x5 c, N3 E- @5 T
  13221. ;;;   one of each type in a single (ssget "x") call.! W9 \  S7 Y( ]# I# k1 f" @" |' ?
  13222. ;;;$ }' r0 O' ?. R3 u5 ]* h' e' [
  13223. ;;;--------------------------------------------------------------------------;
    1 s" s9 e% s$ A) n/ B
  13224. ;;;
    . S: ~$ u0 `' l- _* ~, b* M
  13225. ;;; Find the dotted pairs that are valid filters for ssget
      b/ W0 k- @& p( [7 \$ j
  13226. ;;; in entity named "ent".
    " ?1 V" N& x" D
  13227. ;;;& ?# T) {2 m1 w5 |# ^( C1 A
  13228. ;;; ssx_fe == SSX_Find_Entity
    6 ?9 v* u. ?8 E7 i
  13229. ;;;
    5 c5 I( p4 m7 ^
  13230. (defun ssx_fe (/ x data fltr ent)
    1 l6 M1 l4 E1 W
  13231.   (if (and (= flexvar 1)(/= t2 "Pick"))0 J4 M0 _; u4 W4 i
  13232.    (setq ent nil)
    7 R% F, Y2 {5 g5 J  x1 l1 s+ s# e% [+ Q
  13233.    (setq ent (car (entsel "\nSelect object/<None>: ")))
    # _7 b7 \, @! i" m# h8 W6 Q0 w$ E
  13234.   )- m' W4 v# M1 x' B" X4 j- t
  13235.   (if ent
    / I% S5 W3 h; L3 A7 s2 O* }
  13236.     (progn" ?* U' e! {& ~' y
  13237.       (setq data (entget ent))
    : Z6 n( M+ B. e0 H4 I- I
  13238.       (foreach x '(0 2 6 7 8 39 62 66 210) ; do not include 38: F; w5 z" @. c  N& P% y
  13239.         (if (assoc x data)# j: Y& y9 E3 m  _4 Z6 P4 a1 @
  13240.           (setq fltr . ^+ E* C, z: E: @: R9 ~
  13241.             (cons (assoc x data) fltr)
    * R, i& H$ G; z- X7 m9 ?% a
  13242.           )
    0 ~- d5 X1 C; l- p0 O
  13243.         )& D6 Z2 Y  t" O; G3 n
  13244.       )   
    * K; i+ D2 \# H5 Q8 g
  13245.       (reverse fltr)& e2 E4 @/ `. d& @) n: W. E: G4 p  Q
  13246.     )
    1 ]0 `& J. u6 I) H
  13247.   )
      ^% E$ P5 r; |7 n9 ]1 R6 ?& `
  13248. )9 p' M) ?, ~+ _! U5 C
  13249. ;;;* o  @; ?4 D+ z5 b2 w& \; b) v
  13250. ;;; Remove "element" from "alist".
    7 ^: ^! K) I& ^3 d7 S, k9 S7 b
  13251. ;;;) f" f* l3 c* R/ {) a! D2 n
  13252. ;;; ssx_re == SSX_Remove_Element
    7 r/ r+ M" `$ M  _8 g
  13253. ;;;
    & v7 q6 x2 |# ~& ^4 g- f. i7 t
  13254. (defun ssx_re (element alist)
    & H* n" c- b! i* |
  13255.   (append4 l& i. M' |( h6 u2 @
  13256.     (reverse (cdr (member element (reverse alist))))1 L+ `5 x& i/ R# k' H: L
  13257.     (cdr (member element alist))   
      V/ `, [8 p- g( [1 q- @6 L
  13258.   )7 O( ~- R+ k. w1 y' @5 S
  13259. ). a1 D+ K- A/ P
  13260. ;;;
    6 Z, e# U5 y4 {; |+ i3 e
  13261. ;;; INTERNAL ERROR HANDLER - @% {0 G* Z; C7 x- z5 S* |' |
  13262. ;;;
    6 G8 s" d& l9 s2 X
  13263. (defun ssx_er (s)                     ; If an error (such as CTRL-C) occurs5 q# h+ o) r+ x: D2 P; u. X
  13264.                                       ; while this command is active...8 t: H2 \0 v+ u1 N; z# C& d! [* R
  13265.   (if (/= s "Function cancelled")  |/ e0 b4 q1 k; o' z; k
  13266.     (princ (strcat "\nError: " s))
    ' I+ [) D% k/ z& ]  ^  v
  13267.   )
    4 |1 l3 `% T8 d. f
  13268.   (if olderr (setq *error* olderr))   ; Restore old *error* handler
    $ S- d6 n7 L. S: U' ]) w
  13269.   (setq flexvar 0)
    9 A3 M# ^! S% n. w( ^) w* u* d& h
  13270.   (princ): h, a) D7 H* I0 p* ?
  13271. )" V+ L% p9 s& ~# N5 C, r
  13272. ;;;1 Y3 |; E+ }/ ]* t( n. a
  13273. ;;; Flexicon call routine
    5 }/ }$ R, O4 O3 E: }
  13274. ;;;3 K2 X: G; s& Z/ n1 |2 S! I; ]; {
  13275. (defun flexmnu (a)2 ~! m3 D4 Y: T- b
  13276. (if (= flexvar 1)5 x3 ]% z8 H! r. T" Z* b7 N
  13277.   (command "FLEXICON" (strcat "FLEX" a))
    " s% h7 e5 i/ H6 l5 t, s* e* Z
  13278. )0 x6 x+ D% u- c) o2 Y$ C3 r' k
  13279. )( \1 e- B$ L8 C8 P5 i" L/ i6 L
  13280. & C# l% d& S" @, h, U: O
  13281. ;;;   
    - R8 u: l" E7 Q6 L
  13282. ;;; Get the filtered sel-set., M0 b' P6 X# @( L/ a
  13283. ;;;
    9 q! E. B0 p6 p$ b8 C' O1 H
  13284. ;;;
    , N. ^# t* @; O
  13285. (defun ssx (/ olderr)5 y  o6 L. x( l4 R3 O! Y; a' L
  13286.   (gc)                                ; close any sel-sets            
    & O$ R- ?! @2 f# d
  13287.   (setq olderr *error* ; b3 P4 N; s3 }! ]3 N
  13288.         *error* ssx_er
      l: [" W0 f1 D8 ^; I. B
  13289.   )
    0 c0 s" \4 E% j) H/ N/ P  m
  13290.   (setq fltr (ssx_fe)) . u' Z* I9 s2 k$ I" Z
  13291.   (ssx_gf fltr)
    ) _, f- t6 v, C
  13292.   (if (= flexvar 1)
    / g3 q2 Z' o1 W6 l7 z3 [- R
  13293.    (progn# p! ~0 r$ |# k( G4 T3 ?! Y8 i
  13294.     (prompt "\n \n \nNow select the required EDIT command and (P)revious.")
    ( _+ e0 U! l, |6 A6 N3 {
  13295.     (flexmnu "EDIT")
    : E3 x/ d% H5 S1 ~5 [$ b
  13296.    )( ?, y0 _1 c5 Z
  13297.    (command "p")
    $ C, B, C' [, V( Z: |, D, z
  13298.   )% H% s3 |9 e5 Q
  13299.   (princ)
    ! f. d6 L2 K# b; H1 I+ k; l
  13300. )$ g7 I; V2 _6 B# y: Z: s
  13301. ;;;6 n6 ~0 e9 x: Y+ T, @8 G
  13302. ;;; Build the filter list up by picking, selecting an item to add,
    5 f/ H- I8 y1 ^* [/ x+ Z5 e
  13303. ;;; or remove an item from the list by selecting it and pressing RETURN.
    % M* J1 c# O& }: W2 _
  13304. ;;;2 ?; U/ }2 I$ J! x* l! R
  13305. ;;; ssx_gf == SSX_Get_Filters
    7 V* N6 v" ]; ~- ?$ K! A
  13306. ;;;/ J5 `2 @+ U) }
  13307. (defun ssx_gf (f1 / t1 t2 t3 f1 f2)
    % q! b- `, M  G: v$ O
  13308.   (while 6 m. J3 Q0 m5 i% S& q$ w
  13309.     (progn
    ; b+ g; V9 p+ ?/ V( R/ [( @
  13310.       (flexmnu "SSX")! o* h  U$ Q0 @3 {( u& f, |1 a7 A# \
  13311.       (cond (f1 (prompt "\nFilter: ") (prin1 f1)))1 Q8 b! m' U" L# F1 G& @% w
  13312.       (initget 6 q# @  i0 A% X; z. h/ z, g* H
  13313.         "Block Color Entity Flag LAyer LType Pick Style Thickness Vector")
    4 R3 T$ h+ M' ~7 K' i$ _
  13314.       (setq t1 (getkword (strcat
    ' a. W: D9 ~  _5 v4 |
  13315.         "\n>>Block name/Color/Entity/Flag/"
    3 S) y+ o4 }  Q4 z: w+ z' s
  13316.         "LAyer/LType/Pick/Style/Thickness/Vector: ")))
    / Y) K+ Y- U7 F# a" E
  13317.     )
    0 V+ D' V! n$ g5 r
  13318.     (setq t2, m/ y; k3 D$ k  i  ]% F
  13319.       (cond: e; j6 A9 u+ m7 k6 f
  13320.         ((eq t1 "Block")      2)   ((eq t1 "Color")     62)$ [6 [1 W, H& g! i% t* t
  13321.         ((eq t1 "Entity")     0)   ((eq t1 "LAyer")      8)
    - @# m* s) Y3 N( V( r* d1 ]0 W* d7 e- H
  13322.         ((eq t1 "LType")      6)   ((eq t1 "Style")      7)/ ^0 u+ x2 w  q$ }) T& i
  13323.         ((eq t1 "Thickness") 39)   ((eq t1 "Flag" )     66)
    * Z( F0 f! W$ t, }
  13324.         ((eq t1 "Vector")   210)
    - f( g& p0 R! B* y& w1 z; Q
  13325.         (T t1)) y  x: s( a, o4 @$ e5 z
  13326.       )! f& ~6 B( x7 V6 M5 A$ Q) O/ J- k
  13327.     )
    5 |5 k2 w  q0 g# L
  13328.     (setq t30 s! U! s/ \0 H& M5 Y" C& h
  13329.       (cond
    ; h5 v5 Q( @2 S' A4 I9 z
  13330.         ((= t2  2)0 D, [; y6 B# V1 \" b
  13331.          (if (= flexvar gtads 1)
    * P, \8 a7 V( ?" d+ S2 K
  13332.           (progn
    ; q& O- v2 W) T
  13333.            (prompt "\n>>Block name to add/<RETURN to remove>: ")) a- H0 W: ]! j
  13334.            (gttable "BLOCK")
    - z$ [* J, u3 V1 I! n
  13335.           )
    ) u' @% Z2 y' y* ?7 @" _, G/ Z
  13336.           (getstring "\n>>Block name to add/<RETURN to remove>: ")
    ) H1 k) }2 @8 b: {
  13337.          )9 ^! F- C0 P+ E2 C% S
  13338.         )
    2 `; R* ^# Q* M( i# ^" v
  13339.         ((= t2 62)  (initget 4 "?")1 q6 _! i5 z% l# Z- B
  13340.           (cond+ D$ ?7 G" t5 Q4 C1 @
  13341.             ((or (eq (setq t3 (getint : D- w8 f  w& ~- [5 C1 j* L
  13342.               "\n>>Color number to add/?/<RETURN to remove>: ")) "?")   Y$ K0 [& i9 h
  13343.               (> t3 256))- ^0 L' i* M+ `
  13344.               (ssx_pc)                ; Print color values.) C9 B* Q0 ^. [! g3 H; b
  13345.               nil
    & e# D. r1 E( w/ k6 v# Z. V7 E
  13346.             ): }( s3 j% e8 ^( l" b. {
  13347.             (T  z% w. W9 G1 _- u% A7 e
  13348.               t3                      ; Return t3.9 S7 H0 @1 U! _$ |; v
  13349.             ); k7 ~  e2 s8 p* \6 P6 i
  13350.           )% P, q& h9 M& ]  H& }; \
  13351.         )
    . _# C9 {7 U5 h: J! i2 K
  13352.         ((= t2  0) (getstring "\n>>Entity type to add/<RETURN to remove>: "))
    6 g7 Y1 U, g& x/ P* I
  13353.         ((= t2  8)
    ' p' @; h& m; W- y9 E) [5 i
  13354.          (if (= flexvar gtads 1)
    - }" \2 ^, B) C( A+ b; \( o0 l# L
  13355.           (progn) V/ t) `9 b7 M  I2 X# H+ U, O9 h6 \
  13356.            (prompt "\n>>Layer name to add/<RETURN to remove>: ")' o% P" {4 r9 q, G( R4 z" Y4 J; g' U0 _
  13357.            (gttable "LAYER")
    ) _9 j8 A$ N% [! M( z
  13358.           )3 N; K1 u7 g: J% r5 u
  13359.           (getstring "\n>>Layer name to add/<RETURN to remove>: ")2 z7 r, ^& p6 H0 Y1 Z
  13360.          )
    & H* K4 t* o) c9 |) G
  13361.         ), R# j# T) ]7 l' y
  13362.         ((= t2  6)
    2 ?# i- W8 A- e
  13363.          (if (= flexvar gtads 1)
    ; v% [& H$ I, C3 O
  13364.           (progn
    & @% }5 `. |3 x# {6 m, W9 f
  13365.            (prompt "\n>>Linetype name to add/<RETURN to remove>: ")9 ]  u- i+ J+ H
  13366.            (gttable "LTYPE")
    4 K9 `4 G2 @1 ^) F7 ~! B& C
  13367.           )8 O% |/ _% x: O* C7 T
  13368.          (getstring "\n>>Linetype name to add/<RETURN to remove>: ")3 o6 K3 L- l& }8 ^8 m
  13369.          )
    ' j, H* I  f' B6 p
  13370.         )
    : E% K0 l' f2 f3 @
  13371.         ((= t2  7)
    & h+ I! p/ f) s* t
  13372.          (if (= flexvar gtads 1)
    % K5 G/ w  R8 z. }* ]
  13373.           (progn
    % Y' `- w. U% P/ S' h& O: Q* |
  13374.            (prompt "\n>>Text style name to add/<RETURN to remove>: ")
    8 f; A- a% W4 o2 K6 ^" {
  13375.            (gttable "STYLE")* W$ @5 {) j! @3 Y7 S' ~5 Z
  13376.           )! Y1 g- ^7 S% _, y# X0 d
  13377.           (getstring "\n>>Text style name to add/<RETURN to remove>: ")8 i" D9 O4 Y) ]8 l! P
  13378.          )1 P9 J$ z/ A2 x/ ?) z8 q, t% g
  13379.         ): L9 [* S. ]- Y3 k. ^
  13380.         ((= t2 39)
    5 H$ ]; @6 ?$ k2 K. D( Q
  13381.            (prompt "\n>>Thickness to add/<RETURN to remove>: ")" h+ H) l7 H. D& x0 F4 p* J
  13382.            (if(= flexvar gtads 1)(gtfnum"Thickness to add:")(getreal))
    0 f; v# _+ E: s& R1 O( W
  13383.         )& U- p+ v6 m! D' m: Y, W, K* n
  13384.         ((= t2 66)  (if (assoc 66 f1) nil 1))
    1 q- |. F6 K9 q5 O3 Q6 n
  13385.         ((= t2 210)
    3 @2 R0 M/ E& ?
  13386.           (getpoint  "\n>>Extrusion Vector to add/<RETURN to remove>: ")& ]6 o+ [6 a4 R: e3 e7 C5 A' p
  13387.         )
    4 C' s+ g% A8 Z: B# n3 S
  13388.         (T          nil)
    : \9 m5 e6 m8 o9 b
  13389.       )1 V! o7 C8 P2 z, W2 i7 W
  13390.     )
    # J1 s5 g- W6 u& x: s4 m+ y+ W) g  v
  13391.     (cond0 q/ {0 [$ o9 M  g/ r; H
  13392.       ((= t2 "Pick") (setq f1 (ssx_fe) t2 nil)) ; get entity
    $ X' a, S0 d+ ?. b; K* ~
  13393.       ((and f1 (assoc t2 f1))         ; already in the list8 R4 \1 b: r' E3 E" B0 }& C
  13394.         (if (and t3 (/= t3 ""))8 m* E4 V& _3 r: t3 h7 l" E2 ~
  13395.           ;; Replace with a new value...             7 e$ Q2 S, n* v
  13396.           (setq f1 (subst (cons t2 t3) (assoc t2 f1) f1))
    : v7 b" f: y  t2 e
  13397.           ;; Remove it from filter list...
    2 Z- b- S9 S7 D: s) ~" X  X. }! ?
  13398.           (setq f1 (ssx_re (assoc t2 f1) f1)) 7 f3 D! K# Z$ A
  13399.         )  $ J, S( q" I* P
  13400.       )' A+ P" C/ r- ~" n
  13401.       ((and t3 (/= t3 ""))# {; j: n1 S; U! ^/ e
  13402.         (setq f1 (cons (cons t2 t3) f1))
    ) B6 i1 W& h( @
  13403.       )8 X, _0 I# P4 w8 b
  13404.       (T nil)
    6 h/ w5 i' N  p. ]( m6 s
  13405.     )
    8 z. j: Y. z- s
  13406.   )
    / z1 |% X  s& |5 P. c  @6 Q
  13407.   (if f1 (setq f2 (ssget "x" f1)))
    9 X- F- c; z# G( d
  13408.   (setq *error* olderr)
    : R+ J) k+ \  u; C0 Z0 L
  13409.   (if (and f1 f2)
    / }; z$ r: |9 s: b7 e  C7 c: f
  13410.     (progn
    ) A1 A, q7 [0 H8 y4 m
  13411.       (princ (strcat "\n" (itoa (sslength f2)) " found. "))3 }' Q. {( _2 f) x3 ]
  13412.       f2 , @, A$ P6 G% H9 H8 D) T" G+ g) e
  13413.     )4 w0 E, f/ S1 R& G$ U
  13414.     (progn (princ "\n0 found.") (prin1))! r$ L# P) }! k( ]8 o# B
  13415.   )
    7 r1 w3 Z& H* q" M$ f
  13416. )% z, O' t" _. G8 O, k
  13417. ;;;4 g4 |, R( W9 c  u; r! }4 ?6 d) b, Q
  13418. ;;; Print the standard color assignments.
    $ T; W  X$ [7 @: ]
  13419. ;;;
    ' H; ~4 ~  C  `1 o; l$ T
  13420. ;;;
    4 \4 U1 R# \/ a% d& h$ }
  13421. (defun ssx_pc ()3 N8 Y( u" \9 O0 D, K" \
  13422.   (if textpage (textpage) (textscr))1 w" s* O- p4 i$ v3 S4 x3 B
  13423.   (princ "\n                                                     "); d3 c- H6 i/ T/ v
  13424.   (princ "\n                 Color number   |   Standard meaning "); Z0 K3 X: k4 ]# X. }1 |1 Y
  13425.   (princ "\n                ________________|____________________")
    1 @' f: J  O* N, `3 M
  13426.   (princ "\n                                |                    ")' L" f! B9 S# W! @
  13427.   (princ "\n                       0        |      <BYBLOCK>     ")0 \; Y2 O2 {% r, j: X9 h- K! [
  13428.   (princ "\n                       1        |      Red           ")  n$ V% m. ~* R' [- D" F$ k
  13429.   (princ "\n                       2        |      Yellow        ")9 {5 I% w6 X6 A% C' y0 H3 B
  13430.   (princ "\n                       3        |      Green         ")
    0 m  R, M0 s+ R  _8 y( n
  13431.   (princ "\n                       4        |      Cyan          ")" Z6 p6 u+ }! S) W) H
  13432.   (princ "\n                       5        |      Blue          ")8 ?; W! f, X6 V% b$ @
  13433.   (princ "\n                       6        |      Magenta       ")! X/ ~* H  f8 c/ C( e5 y" b2 w" ~, H
  13434.   (princ "\n                       7        |      White         ")
    9 p$ d% A% W/ @( m0 p( Z: P
  13435.   (princ "\n                    8...255     |      -Varies-      ")
    " `" G8 ~+ p5 `* f2 V5 y  t% w
  13436.   (princ "\n                      256       |      <BYLAYER>     ")  r$ B" A8 F7 h9 e% J5 h
  13437.   (princ "\n                                               \n\n\n"); A9 P; l2 `, l+ ?: Q
  13438. )
    # K* l+ ]" c8 P% z4 f0 Q
  13439. ;;;
    / @; w5 L7 ]9 u6 U- b. d
  13440. ;;; C: function definition.
    7 R- \7 F0 E" [& b3 Q# f8 n
  13441. ;;;. p! ?3 [/ I# Y- |0 ]6 l/ Y! q
  13442. (defun c:ssx () (ssx)(princ))
    7 J% O5 D9 D# s1 D* @+ ?9 c, v" e
  13443. (princ "\n\tType \"ssx\" at a Command: prompt or ")" v  A0 ^1 q+ k- u( A
  13444. (princ "\n\t(ssx) at any object selection prompt. ")
    1 |. B3 B$ O. q- w! |  h: o
  13445. (princ)
    2 m. `4 f; H* J8 v0 D0 D% O" p

  13446. ( z7 {$ ^8 ^/ T
  13447. ;;;--------------------------------------------------------------------------;6 X; H  z- ^6 F" _8 R4 T  M' `7 x! @% I
  13448. ;;;--------------------------------------------------------------------------;7 k; W, k4 e: U6 X
  13449. ;;;--------------------------------------------------------------------------;
    ' F8 S2 n4 F' J" L# n0 w
  13450. (defun S::STARTUP (), z% I1 U; W2 t8 I1 f
  13451. (setvar "cmdecho" 0)' V$ P( \" w8 u; R
  13452. (setvar "cmdecho" 1)" @- d& V1 u5 }, c2 r; F
  13453. (setvar "LTSCALE" 10)) m' E) h6 i3 ~* ]
  13454. 8 k& m$ f# u& u9 r
  13455. ;(command "_load" "chenKH.fas")
    : W* K. F* t7 P9 J/ ^+ _4 G) n
  13456. ;(command "_load" "ctcot.fas")0 K7 \9 m4 G( L! }
  13457. ;(command "_load" "damdoc.fas")
    2 C4 o& H# n( k2 c0 _9 K- Q
  13458. ;(command "_load" "ghichu.fas")0 ~4 l* u! J% m
  13459. ;(command "_load" "hamtutao.lsp")2 J( X6 f6 c- j8 c0 w! Q2 U1 ~* [% m
  13460. ;(command "_load" "KHOITAO.fas")
    3 S* r3 ?& e/ Y; F9 W& b
  13461. ;(command "_load" "KHthep.fas")
    5 D; J( g8 \8 P" P! c, Z
  13462. ;(command "_load" "mbmong.dcl")& A5 p" ~: E/ N/ y! k
  13463. ;(command "_load" "mbmong.fas")% m0 ^; S4 R6 [& Q! I$ X
  13464. ;(command "_load" "mccot.fas")
    1 Y% _7 |" r( L
  13465. ;(command "_load" "mcdam.fas")
    ' M* _. F( R' \/ e' [  G, X' X
  13466. ;(command "_load" "mcmong1.dcl"): ^  t( q. h5 r" n5 d; k
  13467. ;(command "_load" "mcmong1.fas")
    ' F8 _* c  `$ i$ l
  13468. ;(command "_load" "mcmong2.dcl")
    ( V$ Y& b6 U6 Y4 n7 x# M. ~
  13469. ;(command "_load" "mcmong2.fas")6 k8 S; ^- X$ [/ H
  13470. ;(command "_load" "mcmong3.dcl")
    / V* x5 ]1 k( u. p6 w% X
  13471. ;(command "_load" "mcmong3.fas")! j( @1 K: M5 v1 ~) ]
  13472. ;(command "_load" "mcsan.fas")- W2 A7 F0 v, e8 U. f
  13473. ;(command "_load" "thepdai.fas")9 W& o& N; L+ U
  13474. ;(command "_load" "thepdoc.fas"). \1 l/ Y' V7 ^) G: k$ K
  13475. ;(command "_load" "thepmb.fas")/ P/ x# n# n: i8 T& p# G
  13476. ;(command "_load" "thepphbo.fas")
    5 Z. {0 E8 J1 H4 ~1 X* H  U
  13477. (command "_script" "thongso.scr")
    2 ^/ V5 C  i/ `( m
  13478. ;(command "_load" "thongso1.dcl"). W& b3 C1 r9 `$ g) q2 s% }  \( h
  13479. ;(command "_load" "thongso1.fas")
    7 m# z  L) D/ o' i( r' K2 @
  13480. ;(command "_load" "thongso2.dcl")' Z. k! k/ T9 b+ a
  13481. ;(command "_load" "thongso2.fas")
    0 |8 t$ A) Z% n% z2 R2 e
  13482. ;(command "_load" "tietdien.fas")
    9 T! ^) ^# l( A) Q
  13483. ;(command "_load" "vehan.fas")
      Z3 o0 x# }0 j- I
  13484. (command "_load" "phamDuy782006_TKT.lsp")- T& Z. O4 C; }+ r
  13485. (command "_load" "phamduy782006ganhtd.lsp")( V$ p8 k5 k2 ]+ R+ _3 P# L+ `& s
  13486. (command "_load" "phamduy782006ganhtds.lsp")
    5 W/ Q& S0 n, _/ k- g: q5 G
  13487. (command "_load" "phamduy782006htd.dcl")" K- G% J/ b% ^
  13488. (princ)
    9 W; |2 z9 w; A* w3 T
  13489. )
    : N. p3 @+ r6 O# p3 j9 p! P9 B; D

  13490. / ]% @9 I( i( B2 i7 L1 W; N2 q
  13491. ;; Silent load.6 m0 L/ u. \- r7 B7 ?* B
  13492. (princ)  P1 S8 a# ?7 }1 |# m. F) e7 k

  13493. ; g. k- g. }: J+ Z' J9 g
  13494. * R4 P& R( `9 w) f$ l1 H+ x
  13495. ;; Silent load for the Express Tools.
    1 G. h, T/ z) a3 p' d7 b
  13496. ;; Altering this line will affect Express Tools functionality! Y) k, n* ?9 _- K
  13497. (load "acettest.fas" (princ))2 x! {! L; O1 S# T' T& a/ _
  13498. �32
Sao chép mã

: ?+ o+ F( I9 e9 O2 A# h4 p) c00st Cách Thêm Menu & Lisp Vẽ & Fonts Chữ mở Gõ Chữ Administrator để Gõ
7 o% z6 m* G" E9 s2 B- _

2025-04-21 Plot.jpg (70.6 KB, Lượt tải về: 105)

2025-04-21 Plot.jpg

2025-04-21 Text Style.jpg (42.87 KB, Lượt tải về: 95)

2025-04-21 Text Style.jpg

2025-04-21 Layer.jpg (26.81 KB, Lượt tải về: 101)

2025-04-21 Layer.jpg

2025-04-21 AutoCAD Message.jpg (8.58 KB, Lượt tải về: 94)

2025-04-21 AutoCAD Message.jpg

Screenshot_20220406-091212_Facebook.jpg (306.88 KB, Lượt tải về: 83)

Screenshot_20220406-091212_Facebook.jpg

00st Cách Thêm Menu &amp; Lisp Vẽ &amp; Fonts Chữ mở Gõ Chữ Administrator để G.jpg (249.66 KB, Lượt tải về: 97)

00st Cách Thêm Menu &amp; Lisp Vẽ &amp; Fonts Chữ mở Gõ Chữ Administrator để G.jpg

Untitled-1 Da Xong Trump Putin 0 Hoi Xong Chua copy.jpg (299.44 KB, Lượt tải về: 80)

Untitled-1 Da Xong Trump Putin 0 Hoi Xong Chua copy.jpg

RUN-2000.zip

1.11 MB, Lượt tải về: 5, Tải điểm: Thưởng -2 điểm

Zip






Chào mừng ghé thăm Thư viện xây dựng: Tiêu chuẩn xây dựng- Văn bản- File mẫu- Sơ đồ- Quy trình- Phần mềm xây dựng (https://xaydung360.vn/thuvien/) Powered by Discuz! X3.2