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 đề: AutoLISP AutoCAD 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 đề: AutoLISP AutoCAD kts. Trần Ngọc Thắng TỰ BIÊN SOẠN + SƯU TẦM
  1. <a href="https://www.mediafire.com/file/czicu7v2hdd904k/Library_2008_TnT_For_AutoCAD.zip/file">Library 2008 TnT For AutoCAD</a><a href="https://www.mediafire.com/file/czicu7v2hdd904k/Library_2008_TnT_For_AutoCAD.zip/file">" q# l. `# z6 G# A: D: U" |
Sao chép mã
********************************************************************************3 y% N. F- N( J
*             ACADLISP FOR AUTOCAD R.14 -> AUTOCAD R.2012                      *
& d2 F7 V4 ~" I7 c$ o* q* @7 m*         Tran Ngoc Thang DHXD-HaNoi41 from years 1999 -> 2015                 *
' U! [5 n  I8 s3 W1 y. u# I4 E* L*                         Suu tam & Soan                                       *7 x, Y  s( z% v2 X4 |
********************************************************************************3 ~4 A' b: S# q5 L

6 Z/ J$ z+ x0 s+ \3 R) ^; Next available MSG number is  104
& @- ^( I, a! w( v; MODULE_ID ACAD2000doc_LSP_1 d* [# d* Q% ^5 o) T$ K8 c
;;;    ACAD2000DOC.LSP Version 1.0 for AutoCAD 2000
, v6 B; _  e2 P! I- A;;;! X/ m% |3 o7 @3 y% D& A
;;;    Copyright (C) 1994 - 1999 by Autodesk, Inc.
& S: ~- L, W3 P/ c;;;  u8 ]+ I2 @+ N) S! Y: G+ L
;;;    Permission to use, copy, modify, and distribute this software
8 D+ w9 [# j+ l0 N5 `;;;    for any purpose and without fee is hereby granted, provided6 m/ c* p# i( B3 N. E+ Z1 K. H: V3 j
;;;    that the above copyright notice appears in all copies and* L3 f9 B# q6 n" S! D+ v
;;;    that both that copyright notice and the limited warranty and% p. ]6 L# \; ^8 I+ `
;;;    restricted rights notice below appear in all supporting
0 ^  v7 H5 }" T. o* @' g;;;    documentation.4 z) ?3 V5 g8 I( ]: r: |+ t# G
;;;
& b* y: u' X# s/ [5 K;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
3 b9 t: S7 J- ]1 g8 o;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
8 Q, p, I  K8 h7 @, ]  g3 R;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
, d/ O, v6 v) O, X' S;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE9 o1 ^2 ]( i, G4 X
;;;    UNINTERRUPTED OR ERROR FREE.( l5 \* Y4 V7 c0 G2 d
;;;
" d9 Z% N, B# \0 r/ };;;    Use, duplication, or disclosure by the U.S. Government is subject to5 H( {# C" u3 t/ n7 B+ B
;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer( D2 H. q) m* v0 V2 g$ F
;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
: l) b2 V0 Z$ ~' u) C5 j;;;    (Rights in Technical Data and Computer Software), as applicable.; A' Z& ^- R% R- b* _
;;;* t8 c! y8 w- g9 H. t3 T9 ]  r2 m
;;;.' e$ U" c7 a$ D1 l, @
;;;& {0 j- E5 F1 s/ [4 W5 m5 l
;;;    Note:
6 ^: A; }: _  I/ M$ k$ L' I;;;            This file is loaded automatically by AutoCAD every time & D1 Q+ o9 F6 j3 Q5 r" A  j
;;;            a drawing is opened.  It establishes an autoloader and
2 J: z/ f- y" C' Z* f7 q& m;;;            other utility functions.* |, _# g( n! t/ E' ]9 G
;;;
$ B5 B- w; H1 c;;;    Globalization Note:   
1 T& ^4 n1 Y( r- ~0 T;;;            We do not support autoloading applications by the native
% F  d2 y, f8 r, k8 Z' c;;;            language command call (e.g. with the leading underscore( Q) u  F4 X+ E2 C
;;;            mechanism.)
! _8 @- P: z/ |! c: V( J/ A7 H) m0 H$ ~' L, V. X. I, @
, T% x. B& U" X' d$ C- G# U
;;;===== Raster Image Support for Clipboard Paste Special =====
; `* h1 O5 _* Z;;
' W4 X" Q& q, g( W. O;; IMAGEFILE
: G. N& R) l* w7 Z! @% R1 @" A; K;;6 k* ~6 r5 O* C' D
;; Allow the IMAGE command to accept an image file name without
, j! l2 r9 F% N- G  b;; presenting the file dialog, even if filedia is on.
- K% V+ S* G# F;; Example: (imagefile "c:/images/house.bmp")
. z8 q1 T+ x, N8 o# q6 a;;* @  K& Z; t! }1 Z" [' B* o! E
(defun imagefile (filename / filedia-save cmdecho-save)* Z" J( n' {/ k
  (setq filedia-save (getvar "FILEDIA"))& F; b% _- W* y& d/ C1 n! R
  (setq cmdecho-save (getvar "CMDECHO"))7 J9 `' }( b  [' |: E
  (setvar "FILEDIA" 0)
2 M) R: D0 P! j3 H7 |$ `1 x  (setvar "CMDECHO" 0)1 |% C/ y3 f* F" F" X! t, y7 S
  (command "_.-image" "_attach" filename)
( F9 X4 {& i: E9 K: H6 \: C  (setvar "FILEDIA" filedia-save)
$ e7 a: `( F( K+ O  (setvar "CMDECHO" cmdecho-save)
% t  k5 c3 L+ V* p$ x1 r  (princ)% M3 z# {- ~0 C% p! X* P+ A8 B
)
! X& t7 l% O/ _+ i0 J( T;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7 R' V# l7 }* X
; Next available MSG number is    11 ( C, v+ o) s5 O4 g+ L" Y
; MODULE_ID DDVPOINT_LSP_9 i/ c+ ?2 \! @1 [
;;;2 |$ N, v' d- {/ ]$ D) ^/ ^, R3 M7 e
;;;    ddvpoint.lsp) k# N; A! K' [3 X1 P8 z
;;;5 f+ H$ y# d( Z+ C, p% {7 Y
;;;    Copyright 1992,1994,1996-1998 by Autodesk, Inc.
' ]: Y) Q- l- s# R: R3 p& x" C;;;
  u. i! M( c1 r, O: K* ?  W( H;;;    Permission to use, copy, modify, and distribute this software: Y: k4 G, Q- `
;;;    for any purpose and without fee is hereby granted, provided
( l, U' F% c# [8 i) v$ p7 a;;;    that the above copyright notice appears in all copies and
. ?" d1 p# P2 e( G  x/ P2 `;;;    that both that copyright notice and the limited warranty and7 ]$ u! b1 e0 }' W
;;;    restricted rights notice below appear in all supporting' m% x/ r8 j0 y, z, \# X  s0 j1 Y
;;;    documentation.
+ W+ ~7 j+ v# U) ^0 `% }- {; m;;;
/ B! I/ D% L* V! k- ^;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
1 o3 C  [1 d# s. Z9 l# f8 E;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF$ b1 [. C- {0 E8 U0 J
;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.! ~7 b$ y( m9 C1 \
;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE( q- D' L1 H" B. y2 W4 |% r9 D
;;;    UNINTERRUPTED OR ERROR FREE.
9 ^5 x1 s( }. _;;;& q9 k+ c6 X( k# \3 c% L* S2 L* Z
;;;    Use, duplication, or disclosure by the U.S. Government is subject to" `, n& J( F: ^0 G
;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer1 y( _; w# m. k, Q8 b+ T2 z
;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) ! Y" h6 _9 S5 |; s  G  d5 d
;;;    (Rights in Technical Data and Computer Software), as applicable., {5 C& h+ }( P
;;;! |4 y7 O1 |3 N0 |9 P
;;;.4 D* M! @* `8 p9 a
;;;    CDVPOINT - 3D Viewpoint presets dialog.5 H5 M1 P: f# p( q
;;;
6 G. {, G) y7 _1 q" ]% |& M;;;                Uses DDVPOINT.DCL for the dialog definition.
% k+ @) X, X" a( @4 z;;;                The slide image is in ACAD.SLB.
4 {( W3 B9 T9 F( O;;;. f: X) f: f9 K* _! P9 f
;;; ===================== load-time error checking ============================
) W; f3 B+ w. u+ X& l# d  @;;;
8 f0 d6 M( J# z$ d4 T  [7 {4 F/ M$ O$ ?
  (defun ai_abort (app msg), q5 }0 x% H, y
     (defun *error* (s)
' K3 t+ j2 v( h# o7 q        (if old_error (setq *error* old_error))1 t+ {8 D0 j" L+ s
        (princ)
2 i0 }# {) K( m1 P  g     )
# X$ t6 j1 f% v     (if msg
: p# [" D! x5 C: B$ t' u       (alert (strcat " Application error: "
1 \0 g8 r; n2 j0 o2 @, E7 V: C                      app5 J+ ^" v: q; y0 r
                      " \n\n  "
5 B. K9 s; m. E0 q+ z3 C% m                      msg: {4 {; m& v2 ?7 m. `( d0 X
                      "  \n"
1 V6 e* Z) G3 P: n1 L              )$ K2 T( a7 q$ q% W8 e( R5 Z
       ): Q7 m: i! k* S3 o5 Z
     )6 R) R1 R* n$ }+ R1 [5 P9 V* X" n! A
     (exit)
+ u% m& W) C1 V) G2 d8 }  )! V8 o) N5 o1 Y( {. U0 K

& k: Z# u. V2 T" i- \4 l; A;;; Check to see if AI_UTILS is loaded, If not, try to find it,- U" U$ \+ h& n- i5 P5 v
;;; and then try to load it.
7 ]8 e: b, y  A& t9 E, u;;;( w' i0 S& y- C4 F: ]( ~
;;; If it can't be found or it can't be loaded, then abort the  [( g9 {* E5 ^( l  f# n% P* H
;;; loading of this file immediately, preserving the (autoload)9 W, _0 E; Z$ b" n4 B  n
;;; stub function.
% J7 B: m5 R6 C. S- K3 d
7 n: Z9 u$ [8 N! U  K  (cond
2 D0 |& l; F+ b& j' U9 K     (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.  X2 N6 B+ b0 C) R( O4 |

5 \! C8 q2 ~' g6 }1 }     (  (not (findfile "ai_utils.lsp"))                     ; find it
& W( D  a" B0 B( W! C; u$ F        (ai_abort "DDVPOINT"
8 x( h3 t( A/ }; Q. a/ H+ H                  (strcat "Can't locate file AI_UTILS.LSP."( P, G5 G. Q: ~/ Y9 L+ X5 [
                          "\n Check support directory.")))
% m( |! R2 [  F/ b, \" H; A5 o( a: g9 m7 a8 c( W, R9 \( G
     (  (eq "failed" (load "ai_utils" "failed"))            ; load it
6 @! H% R* C8 \  Z( K        (ai_abort "DDVPOINT" "Can't load file AI_UTILS.LSP"))
; k! [. J5 ^1 }2 R% ^: W  )$ s/ x  [' S7 e+ \% Z* s

# y, R; L4 l+ \4 q/ E' ~5 {9 q# J  (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP6 {* n2 o; Q6 l% J+ K+ V
      (ai_abort "DDVPOINT" nil)         ; a Nil <msg> supresses
" k  N, V3 x7 j+ r- x  )                                    ; ai_abort's alert box dialog.
& f8 h/ G7 n7 J' [3 i9 T
, o8 w% I, k  o  ~/ A- j. K2 g;;; ==================== end load-time operations ===========================
' Y( A6 U% B4 B! N( M. }6 ?/ A/ D& V) e& q" f; z
(defun ai_ddvp_start ( / image_x image_y image_h slide_x slide_y slide_h program)
2 T: g, u3 q6 ]2 q9 T8 A! M8 A  ;; Get program name
# j5 z/ W3 G. H" a6 a. o1 V  (if (not (setq program (getvar "program")))
4 R* I8 ~" X7 }( J, @& B8 M, w     (setq program "acad")
) O& }0 U2 |! S( Q  )( F5 s6 A1 b0 g3 ?" E, e! k
  (start_image "ddvp_image")
. _5 b  }8 B2 _/ x* `2 i  (slide_image
% L, b1 {. l, {% v    0 0; u4 g+ X" ]6 K. b" j3 ]( y* N
    (- (setq image_x (dimx_tile "ddvp_image")) 1) & z0 F) l: L  o5 {
    (- (setq image_y (dimy_tile "ddvp_image")) 1)
( W1 ]3 R* ^: h7 P, j7 M    (strcat program "(ddvp3d)"), Q+ k5 L! H% V$ m7 f
  )
' ~; E; o& \+ \6 h  (end_image)3 |% \0 ]8 L- e+ ?0 ^! b9 m
  (setq
, O4 |" T  M. v! a- ?& D$ g        image_x (float image_x)
# C# g7 k( L: w* m) k) s$ X4 M        image_y (float image_y)5 [: |6 x) N# V- [+ A9 O
        slide_x 12.4265
1 z7 [# F5 z# ^+ |/ i        slide_y 9.0% i4 \$ {! M4 {6 W* k: D! M5 ~
        image_h (/ image_x image_y)
" ^" i4 N3 |* t" ^* q) {' I: k        slide_h (/ slide_x slide_y)) R" Q+ V- ^; ?, l' C
  )
9 H1 u9 g2 Y$ N7 a  (if (< slide_h image_h)  O% {% q% _. _3 t5 [
    (setq slide_y image_y4 k0 G( {" i+ u9 S! t
          slide_x (* slide_y slide_h)3 d' Z% V2 u! x8 n/ y" |. R# J
    )
, I' D: ]" g& D  k7 H2 X    (setq slide_x image_x2 x# L! U) n- `. L2 o0 f8 e
          slide_y2 (* slide_y (/ image_x 12.4625)). A  J: V; W. x& ^# p* f4 u
          image_y2 (/ image_y slide_y2)7 O( u$ d; U5 Y* B
          slide_y (* slide_y2 image_y2)
9 V+ J8 I& D  }5 g9 H- S; v. v5 D2 k7 s3 O, ?8 z
    )- k; L: G' F1 b, A
  )5 g4 u1 Y. E: U7 S2 C9 F. U" P/ W) V
  (setq ai_ddvp_bx (fix (* 0.295 slide_x))+ p# t1 O' X" Q( C; X
        ai_ddvp_ax (fix (* 0.65 slide_x))/ @0 p) z0 |7 s
        ai_ddvp_by (fix (* 0.4875 slide_y))4 }1 n+ k: B! T; v
  )0 Z- b$ L9 J5 A' C9 g! Y
)
/ D* z7 W# y* E  H& H% W) Z5 ?! F
(defun ai_rtd (arg)1 x" a+ N1 D! r; ?2 _% n" Y" t
  (/ (* arg 180.0) pi)$ b6 ^6 m, ]+ c
)
: N8 ^1 N7 W0 @  n3 [6 c& m" L# F0 g! m. A% P
(defun ai_dtr (arg)
8 B5 o7 U. V9 B8 c& h  (* pi (/ arg 180.0))) K( A8 s' V5 ^9 v: z
)( j# ?. I  t7 @6 B4 k
% j4 l& }( g+ x8 k5 w( ^, a
(defun ai_ang3dv (v1 v2)5 x  }; o. ]7 V* E% Z
  (if (not (equal v1 v2 1e-12))
# p; Z5 H& c6 G. z    (ai_arccos8 s- K+ o3 ?7 A* j8 C- y7 u
      (/ (ai_dotp v1 v2)
4 j7 T8 y; @6 U" l1 b; z4 M: R0 ]         (* (sqrt (ai_dotp v1 v1))2 {6 u; a. E% K
            (sqrt (ai_dotp v2 v2))
1 k4 H$ M$ Q$ M         )
) C: T6 X! W6 m' R% C0 a" i8 ^9 X      )/ o* N1 p( M1 }$ {
    )
4 f/ g& N. ]* X, R, G3 H    (eval '0.0)
% T2 D/ g! o/ o$ Z+ i! `1 r  )
6 V. a* W9 e$ J/ r5 j, d)
- E3 ?' O- w/ c/ R/ @" W# }* t- }: h9 b/ Z
(defun ai_arccos (ang). X. o+ u- J1 s) n
  (if (not (equal ang 1.0 1e-06)). X; e2 f7 ~' o- X1 ^# Z& b
    (if (not (equal ang -1.0 1e-06))) F2 ^! g6 y- K3 @( D" u9 i
      (atan (sqrt (- 1.0 (expt ang 2.0))) ang)# v6 i; v9 p7 Y
      (eval pi)+ P1 u* p# t9 K7 r. y
    )
& N8 a$ `$ l: N$ p! F4 Y    (eval '0.0)6 V, i: e) S9 f, c8 c
  ), @- c* m, K2 s% {" I1 W
)- @7 F$ b3 P( j' D

7 S9 ~5 c7 D; q( O(defun ai_dotp (v1 v2)
; w. H7 i; r* i  (+& C  K7 V; z8 U% X! \( l% A
    (* (car v1) (car v2))
* s3 P) ~3 u  W; m3 _( e    (* (cadr v1) (cadr v2))
; G, i& E4 A# K1 t- A' m    (* (caddr v1) (caddr v2))
# N6 Z5 i7 Y: ?5 }' j0 E6 n& u  )
, Y: f7 f( O- U; L" v)# N# O& s& c! u+ U
# s% ~$ \. e$ }6 I# x# y7 \8 u
(defun ai_ddvp_do ()0 K1 g- U. l2 p0 b- i
  (if (or (>= ai_ddvp_b_curr 360.0)/ U( x/ k( R& i8 L" v1 r6 n
          (< ai_ddvp_b_curr 0.0)# F, }( ?* B4 ~. z0 {( P
          (null ai_ddvp_b_curr)4 D, I, g3 H1 I7 ~, e
      )
: Z3 X: x4 B+ L# i    (progn
1 Q7 U) _! t3 W0 A  ]6 T      (ai_ddvp_drx ai_ddvp_b_last ai_ddvp_bx 0)
0 l4 Z: c% G& }1 \  g: l7 Y      (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 1)& T8 ]/ ^$ f# s# Z  w
      (mode_tile "ddvp_val_x" 2)
9 o- R0 m3 H* O      (set_tile "error" "Invalid angle from X axis.")
) ~' I. ?! L% F9 \$ a3 D9 w# I    )
, @/ ]) Q0 @" [4 A    (if (or (> ai_ddvp_a_curr 90.0)
+ e) T4 W; d' D* e4 C) U0 i            (< ai_ddvp_a_curr -90.0)" n( Z( e* ?! D3 `" ?5 |+ Q
            (null ai_ddvp_a_curr)
7 o0 o& b. W; P, ]5 _- r9 E        )) }1 ]) M. r  L$ Q4 k
      (progn
) n" V- p  ]3 J! m8 Z8 G& ]% V        (ai_ddvp_drx ai_ddvp_a_last ai_ddvp_ax 0)9 |  K: o# `. g: n6 r
        (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 1)- `7 u3 X/ I) A) m2 m% }/ I
        (mode_tile "ddvp_val_xyp" 2)& x6 Y+ B$ r+ B# @) c: x
        (set_tile "error" "Invalid angle from XY plane.")
) ^) T- K" K$ h" s      )
4 k: O7 z7 V8 k/ V( Q      (done_dialog 1)
. O0 x4 |; r( {( |& s1 k: Y    )$ L" Q2 z$ i3 U! f# U, C6 q7 s
  ), t2 k) {. w, ^, ^6 e- w
)
- E  y7 k7 q2 B; f- J: m3 {' b$ p6 C' G6 q: W, I
(defun ai_ddvp_set_a (ang), J5 c0 O) y$ D2 R2 ]
  (setq ai_ddvp_a_curr ang)
/ s: P$ w, n- ]; n- K  (if (or (> ang 90.0)- S6 K! B" I; {9 n
          (< ang -90.0)
" _0 V# u& Y$ @8 A          (null ang)
8 _- y1 \& M" v+ Q  `      )
& \7 p$ n* q8 C' L2 z9 r    (progn% c5 c2 X6 }5 e2 g9 o
      (ai_ddvp_drx ai_ddvp_a_last ai_ddvp_ax 0)
6 b8 U* \4 a) b3 A" _; P  |# U2 `      (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 1)
* `( s5 P, @' h, C4 C      (set_tile "error" "Invalid angle from XY plane.")
3 P0 y8 _% h6 Y6 n3 Y: `    )$ H2 ]% V2 H% \2 x. l- t
    (progn
( m' a- |8 @8 |* m      (set_tile "error" "")
) f/ y" G0 N' K4 \      (ai_ddvp_drx ai_ddvp_a_last ai_ddvp_ax 0)) s! ?6 ~( V6 O0 M' @$ W) Z
      (setq ai_ddvp_a_last ai_ddvp_a_curr ai_ddvp_t T)$ E% J4 S/ m4 x9 m2 Y
      (set_tile "ddvp_val_xyp" (rtos ai_ddvp_a_curr 2 1))2 _: A2 Z8 B3 [, ^/ ~, P$ V
      (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 1)' e- B5 V. f& D  O
      (ai_ddvp_drx ai_ddvp_a_curr ai_ddvp_ax 7)
5 ~' J6 j( K/ M4 {. U) e: K3 v1 x" }: A    )
1 C1 q: G6 E6 X6 {  ). i2 ^# t$ r- v! _
)9 g) a( }1 @& t, g: A. g1 L

! V" \9 S/ R( U& r, P5 y4 K(defun ai_ddvp_set_b (ang): z8 o7 ?" Z4 m
  (setq ai_ddvp_b_curr ang)1 `' Z1 Q1 y7 g0 K
  (if (or (>= ang 360.0)) x" h+ C8 F( l& K0 b9 Q. X$ K' ^
          (< ang 0.0)
# Q+ G) h) k& C; g6 i2 y- `) Q          (null ang)! Q/ U  @6 o$ q8 u8 ?4 t
      )
" ?7 K8 a5 m- V& K4 y1 S* U    (progn' G  l/ v: P! \4 H
      (ai_ddvp_drx ai_ddvp_b_last ai_ddvp_bx 0), D7 Z% g& ?6 W4 v
      (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 1)
1 A: v7 [7 r' W! l6 w1 K      (set_tile "error" "Invalid angle from X axis.")/ _8 S0 c6 b( s5 ?9 S. `/ a7 @
    )
! K0 X! f, o6 t  H7 T    (progn
% o, r9 s5 W4 |' `: `: W      (set_tile "error" "")! G+ `) g2 q2 T( a+ k
      (ai_ddvp_drx ai_ddvp_b_last ai_ddvp_bx 0)
3 u$ s4 y  b4 x2 N8 c$ L      (if (= ang 360.0). q, B7 W2 N- j8 z0 N: h1 p
        (setq ai_ddvp_b_curr 0.0 6 N9 Q$ T7 D2 K) u4 [) I
              ai_ddvp_a_curr 90.0 - u9 d, i* }8 W; Y
              ai_ddvp_p T' o! [9 u4 |' Z. N7 Z. D
              ai_ddvp_b_last ai_ddvp_b_curr
" n/ J( V* K# L        )
: M' o0 k7 F) S9 I7 l- l$ c' m+ S        (setq ai_ddvp_b_last ai_ddvp_b_curr ai_ddvp_t T)/ a( \& o7 d/ Q& r
      )7 |" F6 M) m' _7 z
      (set_tile "ddvp_val_x" (rtos ai_ddvp_b_curr 2 1))
- [- U; e2 E4 v5 {5 k7 p- r; f4 V      (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 1)
* T; C6 N8 D: ~' z& I      (ai_ddvp_drx ai_ddvp_b_curr ai_ddvp_bx 7). Q* t/ {( \5 e! o4 \; {. e0 \* {
    )# c3 c) i" s( `+ v1 m
  )8 f; B+ A9 ?+ e& g
)+ ]7 Y( |6 P5 L$ K4 e1 Z

, Q9 Y7 p( t, R/ d$ B(defun ai_ddvp_drx (ang x1 col / a x2 y2)  C& D9 X: F5 S/ W! ]& g. A
  (setq a (polar (list 0.0 0.0) 6 y. {* J$ m8 v# |; M2 A  Y- r, t
                 (- (* 2.0 pi) (ai_dtr ang)) # H1 G9 W6 r% Q* t* w+ [
                 25.01 O3 |/ F, [% k$ S
          )
7 D' E1 }2 N9 l  w9 u/ y        x2 (+ x1 (fix (car a)))+ S" c- L0 [4 z: T0 K
        y2 (+ ai_ddvp_by (fix (cadr a)))% x* A) v3 }' m6 _: P, K
  )9 q4 D" m% x* E, F% n5 E7 ^
  (start_image "ddvp_image")& [& |7 X! F8 I3 Q
  (vector_image x1 ai_ddvp_by x2 y2 col)( M+ o5 `( x6 a
  (end_image)
- A, F. t9 r- D2 l" n% K" X, q)4 g) x3 v; m8 K+ j
+ L$ ?3 R& \% r4 H$ T
(defun ai_ddvp_image (x y / ang1 ang2 list_xy list_axby list_bxby)
& f& ]3 D. u7 N/ h, p" Q) W  (setq list_xy (list x y)4 v. q5 V# Z+ I5 F% V# W1 s5 u. k
        list_axby (list ai_ddvp_ax ai_ddvp_by)
+ Q3 V. w: q/ C9 k$ w        list_bxby (list ai_ddvp_bx ai_ddvp_by)
: K2 z- k5 E; ]  ), O9 V* y' i; O4 ?5 H
  (if (> x (- ai_ddvp_ax 1))9 T6 ^9 `% h2 W6 Z! _) ~6 _0 ]
    (progn
3 E" p3 B+ x0 a- M$ ]9 i/ }& I      (setq ang1 (ai_rtd (- (* 2.0 pi) (angle list_xy list_axby))))0 J& f7 O  A7 g" f$ n
      (if (< 90.0 ang1)* ?, j* \$ E4 d. Q3 g3 a$ g$ M
        (setq ang1 (- ang1 180.0))2 F: i, c1 T* ?/ P2 A
      )0 X1 d9 h# r' N$ x, [' a9 x
      (if (< (distance list_xy list_axby) 40)5 @$ H  h: G/ z' h: L. A
        (ai_ddvp_set_a ang1)+ b) W5 T, A0 N9 |5 A' H8 R3 [
        (if (< (distance list_xy list_axby) 84)
; B9 a2 D+ p# ]) d* M/ x          (cond ((= ang1 0.0)
! ]2 X3 F. \7 k- E  g- p# Y                 (ai_ddvp_set_a 0.0)8 J5 s" ~" H* _2 s5 p6 [2 m/ ]2 r
                )
# m+ n, @; L% [. ^& z                ((< ang1 -72.0)
6 F( F5 ]. f- L3 B5 h. t! j                 (ai_ddvp_set_a -90.0)# G6 O' q6 n4 `% r9 R
                )
6 y: T3 [" A/ v0 ^9 ^! S                ((< ang1 -53.0)
7 U& ~* ~$ i7 N6 h8 I" Y5 N/ b1 n                 (ai_ddvp_set_a -60.0)4 b" Z3 N# i( Z# X" T
                )4 \& x) J7 h3 L# K' \
                ((< ang1 -38.0)1 g2 f! w0 _, R' V
                 (ai_ddvp_set_a -45.0)$ h  O& k( v7 R! b( {
                )$ }( ?' z( C  q$ o2 b- y) C: x- e+ v
                ((< ang1 -20.0)- l1 ~  W9 I7 q1 F+ ~
                 (ai_ddvp_set_a -30.0)) |0 v$ c0 N* O/ W8 i
                ): L( C5 W* H! H; j
                ((< ang1 -6.0)
3 f( s9 I% w" f6 }                 (ai_ddvp_set_a -10.0)
% |, j' @7 t- Y3 G: _$ B* O( W                )
. Y9 o' h- o  d" ~                ((< ang1 6.0)
( W/ u% l5 N0 H" X: C                 (ai_ddvp_set_a 0.0)/ f6 d7 p/ \. m. l/ }3 ]  Y
                )
+ W0 e& C1 A# t- {, ]6 E  Y. O. g                ((< ang1 20.0)1 z, D! R9 a" W, v; t
                 (ai_ddvp_set_a 10.0). V9 n) W0 ~+ W6 b6 Y3 Y
                )
9 p/ Y: b1 p) ], Q8 _# Z7 h                ((< ang1 38.0), h0 X, ?% B# v$ i
                 (ai_ddvp_set_a 30.0)- X' P! a. y. k8 G2 D2 |
                )7 p* p" B& Q, v9 B
                ((< ang1 53.0)* y( l7 b% z6 n! c- @6 }) W9 U
                 (ai_ddvp_set_a 45.0)1 l7 @- W9 g: z, j8 ?
                )
" r/ l4 o1 E* w' h                ((< ang1 72.0)
0 s# r. _% ~# L5 M) C                 (ai_ddvp_set_a 60.0)
$ R4 J! w* M1 T; S3 H0 `& g' L                )7 w- c  O1 N# a% }4 Q+ E, O
                (T: ]( g& w6 I) x4 p5 E
                 (ai_ddvp_set_a 90.0)
- \( ]! h: @3 u& J6 [8 I% V0 |. ^9 t" J                )
2 G4 V: h1 H0 @* T0 d/ W0 n5 }          )5 u5 ^- t1 D0 r$ M
        ). k# K2 n; V$ g' z0 ~; \" S
      )
) t9 i1 z( Z* d: P( A    )* Z3 M2 _: T7 q: u2 q2 l+ g% b* R  ?
    (progn
, C$ {' C) o6 [. V4 K4 Q) a! W      (setq ang2 (ai_rtd (+ pi (- (* 2.0 pi) (angle list_xy list_bxby))))); G" M$ Y3 @/ T) v/ ?$ E( T
      (if (< 360.0 ang2)$ _+ ^  b$ I& Z  w- k+ i6 |% ~" P; ~
        (setq ang2 (- ang2 360.0))+ V/ J& ^. Z2 `$ w
      )
, C" O+ r- B, X: D& i+ ]( q      (if (< (distance list_xy list_bxby) 40)  [6 L2 V7 k$ V7 e# W1 g
        (ai_ddvp_set_b ang2)
# w; F- e# E6 k7 f  m$ y. w        (cond ((= ang2 0.0)& R  y' M; z0 w* Q, b
               (ai_ddvp_set_b 0.0)+ U' @* S5 C' N6 c/ M
              )
1 U/ H; F" o* P; C              ((< ang2 22.5)& q; T2 t5 X! G1 W# N0 P
               (ai_ddvp_set_b 0.0)' a: W- @  \3 k# c8 l/ g% u
              )
. U! |( {1 x( v) u' ]7 d              ((< ang2 67.5)
8 t7 P9 d/ |3 q0 L8 G% T               (ai_ddvp_set_b 45.0)
5 B3 `: h6 a: _# R/ f9 z- M              )
" D, ^; K6 z% p! F  l              ((< ang2 112.5)
0 s, U  g+ G) t1 l( w               (ai_ddvp_set_b 90.0)6 [8 c) s0 x1 r
              )( W' \; N/ _3 i2 S$ X
              ((< ang2 157.5)0 m1 T2 o9 k7 H' _
               (ai_ddvp_set_b 135.0)  w5 W6 ?; ?* G/ B+ P$ s
              )
3 W, J6 y; E8 R# C: t              ((< ang2 202.5)
# ?- \% p& s: j, L! {               (ai_ddvp_set_b 180.0); I+ n6 M; }7 D* j, E4 k
              )
, f5 W) D6 w5 E              ((< ang2 247.5)
7 \# W3 U9 D2 o- W' ?$ P  Y1 q               (ai_ddvp_set_b 225.0)# p) X( M! G" D& L9 c* t# y; @* F. M
              )% C$ e, @& S% P- z% H% W
              ((< ang2 292.5)
' W" y1 K1 W0 X& L               (ai_ddvp_set_b 270.0)9 P3 {5 w4 F! g7 A/ K' g
              )4 r! ^# ~+ @" g. I6 M9 d  ?; r
              ((< ang2 337.5)
3 X( ~. o7 T' F+ l6 Z+ J9 C8 H               (ai_ddvp_set_b 315.0)
6 C6 y5 i! G. t9 w" D              )4 k! d- X- }3 n3 K
              ((< ang2 360.0)
( Z% R# l5 l+ D0 b8 A. Z) r2 d               (ai_ddvp_set_b 0.0). y' r& K( b  O) b) a9 E
              )
, P' I$ u3 g6 [+ }. [8 F% Y- [              (T
5 |& M; C* d; h+ b" R8 e, q               (ai_ddvp_set_b 270.0)
! x- n6 {; r  r; s              )
% C5 I6 [0 A5 `* f; a        )
5 v( o; B, X2 L( d, w      )5 b4 i  T" r7 m* E! W1 Z. D
    )7 E- [+ O( z/ B) g0 q
  )
" z$ P8 B3 T7 |1 z: U0 ?5 D5 b)8 D) {/ l, q& t! M

( J# Z/ j- }) J  ^, R# m6 y(defun ai_ddvp_plan ()
# S* ]* c9 O0 B. D/ F7 u* i# P  (ai_ddvp_set_a 90.0)
3 U2 n2 y3 c. D+ R. z8 W  (ai_ddvp_set_b 270.0)
1 L! c: K1 S! r6 W4 j' i& G)
0 m% i+ V1 x3 n+ U8 e0 ?7 Z% s( m
+ A) `7 Q8 i% m8 J(defun ai_ddvp_setvdir (a b)
( J. p" t4 H" n: g9 n  (list (* (sin (ai_dtr (- 90.0 a))) (cos (ai_dtr b)))' ]& Q2 @# w1 j" B
        (* (sin (ai_dtr (- 90.0 a))) (sin (ai_dtr b)))
6 o8 R- ^$ p$ G1 S        (cos (ai_dtr (- 90.0 a)))" @: V( p! E0 u& a3 J! n
  )
6 N; h6 w& g! H)
6 B3 J  b$ e/ Z1 ]8 F+ s8 j8 u% c: \
(defun ai_ddvp_set_abs ()
) ~" K- p% y8 y  g  (setq ai_ddvp_wv 1)6 T5 n" p4 q% f8 H& \) ^
  (ai_ddvp_drx ai_ddvp_b_curr ai_ddvp_bx 0)9 G1 a. ~# @; m! [
  (ai_ddvp_drx ai_ddvp_a_curr ai_ddvp_ax 0)
/ f, t' X6 G8 N2 C# y' ]; T  (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 0), [# _) L2 L7 A5 Z
  (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 0)5 c5 ], E" z- q! K# K' L, M3 @% r
  (setq ai_ddvp_vdir_base (ai_ddvp_fixzero ai_ddvp_vdir_base))8 _0 A7 n! E7 q. F
  (ai_ddvp_setang (trans ai_ddvp_vdir_base 1 0 T))
5 I7 t: h8 T3 C- z/ O  (setq ai_ddvp_a_base ai_ddvp_a
/ G$ p7 q5 B4 X3 u! e7 D        ai_ddvp_b_base ai_ddvp_b$ G. b( U9 l) o) B
  ). o4 S. L# s6 H6 u: q" o6 n
& [7 V; i# V  K) C4 [2 J7 i' m7 Z8 }4 D- ^
  (setq ai_ddvp_vdir_curr % z2 [+ I% R% [% p+ O+ ?
        (ai_ddvp_fixzero ( V# m! A- I* U
          (trans (ai_ddvp_setvdir ai_ddvp_a_curr ai_ddvp_b_curr) 1 0 T)
0 q* ]+ t8 d  F9 r6 F( b1 E0 L3 D        )
( B& m: t, Z; y$ [0 z  )% R# X4 {0 x, m6 n
  (ai_ddvp_setang ai_ddvp_vdir_curr)
1 `9 Z& _2 f' d: E. {3 M5 k4 y! p  (setq ai_ddvp_a_curr ai_ddvp_a
7 V% q" W6 r: C1 p7 N        ai_ddvp_b_curr ai_ddvp_b
5 t: f  c/ k. k0 g  )
' y" s# ^/ o) z' p, j
9 H, Y% k5 P" R% S9 S6 G7 ?- Q% H  h  (ai_ddvp_set_a ai_ddvp_a_curr)
0 O% m- H% f, a" v" a. v6 {+ g  (ai_ddvp_set_b ai_ddvp_b_curr)
2 {6 d) x9 S/ F, c6 e)! D! ^- B; y- h0 C, J. Y
: D- C- h2 E" U* o2 V
1 S9 ~; g* ]8 M
(defun ai_ddvp_set_rel ()- p3 \% g# j, j) r- Z! K
  (setq ai_ddvp_wv 0)
: u% d9 o* y8 {$ c! ]6 s" f  (ai_ddvp_drx ai_ddvp_b_curr ai_ddvp_bx 0)! g# `& S7 ^' R: h& b
  (ai_ddvp_drx ai_ddvp_a_curr ai_ddvp_ax 0)
) z! h6 ?. K$ }; k9 I- W  (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 0); F' F' a& G$ c
  (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 0)1 e  w2 U0 G" i
  (setq ai_ddvp_vdir_base (ai_ddvp_fixzero ai_ddvp_vdir_base))3 H$ L  ]$ f+ Y% [
  (ai_ddvp_setang ai_ddvp_vdir_base)' ]' [% d7 t# I2 V8 A
  (setq ai_ddvp_a_base ai_ddvp_a
. P! L& S5 n3 B; H: A3 x1 ?3 a) B        ai_ddvp_b_base ai_ddvp_b
/ i& ~+ B: k  T" J  )
. q$ P2 @; r1 F5 e( p' R6 D  (setq ai_ddvp_vdir_curr 2 d3 D( W. p6 l. }  u. L
        (ai_ddvp_fixzero 1 b+ v1 Q' B& L! d+ D
          (trans (ai_ddvp_setvdir ai_ddvp_a_curr ai_ddvp_b_curr) 0 1 T)# `; z5 j5 M! Y
        )
9 y) D& W" Q: Q, P& W  )/ i0 t/ `, u6 o& ?8 _, r0 X$ w# f
  (if ai_ddvp_init( O3 e$ U) H2 K( v1 D& S- ^
    (setq ai_ddvp_vdir_curr (ai_ddvp_fixzero (trans ai_ddvp_vdir_curr 1 0 T))
' H3 A) m" F) `2 S" h3 y" k& m          ai_ddvp_init nil' o, X9 L' I/ I
    )( ?1 @( t8 h& W
  )
) e8 q! J' a, W: D  (ai_ddvp_setang ai_ddvp_vdir_curr)3 C, l! V: q6 h' N" U
  (setq ai_ddvp_a_curr ai_ddvp_a/ V$ {  ]  Y5 B. e1 r4 g- C6 Z
        ai_ddvp_b_curr ai_ddvp_b* [0 J/ s1 ]  |/ `0 ~0 x7 w
  )+ c( i# y2 w* J6 x. e3 }
  (ai_ddvp_set_a ai_ddvp_a_curr)
% k% ~+ V2 x/ R, I& ^4 L, Z! u  (ai_ddvp_set_b ai_ddvp_b_curr)
: C. P3 D4 U! z6 s4 {+ R/ D/ {)
, B7 w& f, O6 d$ K6 C3 n; p) _! Z1 W6 e# z* j- K4 V8 Y
(defun ai_ddvp_fixzero (vector / vector_x vector_y vector_z)
" a0 u& e! H. ]9 d6 x4 y0 g  (setq vector_x (car vector)0 {/ [6 m9 n2 q- m# x
        vector_y (cadr vector)
4 h$ _: V9 G; I) a1 ~6 I        vector_z (caddr vector)* q# A. m+ c2 ?& u) z' Y
  )
! Y3 ], }, a3 S1 c" g" e( M' ?  (if (equal vector_x 0.0 1e-06)1 _5 w3 m9 k; h3 f
    (setq vector_x 0.0)& e' u" d( d5 J8 a# B
  )2 ]+ K) o# W# t( e
  (if (equal vector_y 0.0 1e-06)5 K" j$ E: [% H' w
    (setq vector_y 0.0)3 E) d' g2 ^  {
  )6 A$ p6 T6 t0 e* I9 K6 c  G' L. V
  (if (equal vector_z 0.0 1e-06)7 g. h9 s& m4 k2 t
    (setq vector_z 0.0)
4 D9 f8 M) y2 Z- N  )
& B7 Y# s. Q- Z( R- A; a/ l% v8 E  (list vector_x vector_y vector_z)* T0 n) n) Z% c) X  I5 u$ F) Z8 I
)- x+ s" t& X. O% ]  Q2 B1 ^8 Z

2 y' k7 ?, w% B' ?(defun ai_ddvp_setang (viewdir / viewdir_x viewdir_y viewdir_z ai_viewdir)- a# y" f, Y  A+ e/ i
  (setq ai_viewdir (ai_ddvp_fixzero viewdir)7 l& S4 q8 P6 v! ]6 O( y
        ai_ddvp_b (ai_rtd (angle ai_viewdir '(0.0 0.0)))' l+ y4 T7 k# Q1 `) ~  _- m
  )1 v/ H  X1 `" j( ?; \
  (if (equal (list (car ai_viewdir) (cadr ai_viewdir)) '(0.0 0.0) 1e-06)3 c9 ~, D; T! L
    (setq ai_ddvp_a 90.0)
0 T. y9 J8 r6 j1 f3 f    (setq ai_ddvp_a (ai_rtd (ai_ang3dv 0 y/ T2 f+ r0 G9 Z" N$ `% u
                             ai_viewdir3 D0 c9 A2 ]' t; i8 ]
                             (list (car ai_viewdir) (cadr ai_viewdir) 0.0)) J" n  e2 c6 P4 l) x1 k
                            ), `+ X* t! R4 {9 s2 M( z
                    )' v& b# u6 O) a4 G" z& \; t$ h
    )
' k; [& Y: n/ a3 v" U' u* j  )# K; Z! A: ?. ~
  (if (< (caddr ai_viewdir) 0.0)
1 |' v& \! N. v1 [3 S    (setq ai_ddvp_a (- 0.0 ai_ddvp_a))
8 B0 }" h1 |2 \' k  c% {    (setq ai_ddvp_a (abs ai_ddvp_a))& U$ i( w5 r& ~) O
  )
& M& N) p. r: g3 o; w" x; N9 v  (if (>= ai_ddvp_b 180.0)
' G6 q: |! i+ V6 G2 @+ n3 K    (setq ai_ddvp_b (- ai_ddvp_b 180.0))
3 h/ ~; C: M/ o" ]( g3 M- J. X    (setq ai_ddvp_b (+ ai_ddvp_b 180.0))9 v7 M' U- I# k% h* `9 z* R) [
  )% d2 n' m, Y) q0 ~$ a( ~) ~
  (if (or (= ai_ddvp_a 90.0) (= ai_ddvp_a -90.0))3 b  d& Z, h" ?, Q$ I
    (setq ai_ddvp_b 270.0)
) f) \( s+ @. d  h% y: |, w  )
1 z( c- z$ _1 L  u)
" R% t# s8 \% k" A5 P. T+ Y+ v+ c) V3 }% j2 T, C( a! x7 y
(defun ai_ddvp_main ()& W0 T+ a! U/ n6 Q6 _
  (ai_ddvp_start)* a7 ^3 g$ x5 [8 b
  (ai_ddvp_setang ai_ddvp_vdir_base)  C! w& @: Y. G) s/ g! ^  \, X
  (setq ai_ddvp_a_base ai_ddvp_a
, S! r0 A' y& b2 D        ai_ddvp_b_base ai_ddvp_b
% ~) p" u  ~2 J& ^4 r* q' R        ai_ddvp_vdir_curr (ai_ddvp_fixzero
( C$ z+ d) J4 s$ m+ o4 [                            (ai_ddvp_setvdir ai_ddvp_a_base ai_ddvp_b_base)
) l1 y6 O3 w$ S3 l- p                          )* g2 l5 L, e) X6 b6 l4 d
  )
! B+ h1 ]3 Z' S( \' S3 M4 M, T  (ai_ddvp_setang ai_ddvp_vdir_curr)
6 ~; h5 S) t6 @" C3 P/ @$ U8 ~  (setq ai_ddvp_a_curr ai_ddvp_a7 t% D3 p9 {  F0 b2 L, y, U6 o
        ai_ddvp_a_last ai_ddvp_a_curr  N1 C- s' s; }; v! E1 ]! k
        ai_ddvp_b_curr ai_ddvp_b
' I& O. j( q! z5 ^" L        ai_ddvp_b_last ai_ddvp_b_curr
4 c9 s- K$ _# t& o+ Q. [# Z0 e! e  )& c$ f4 f* d% B$ G7 E& {
  (if (= 0 ai_ddvp_wv), k* Y* B' S3 t3 s$ Q9 Y9 E! i
    (progn+ A/ q* h- l1 \1 A
      (ai_ddvp_set_rel)
$ R2 {+ Z5 N2 h! a4 h      (set_tile "ddvp_rel_ucs" "1")
! G& N: Z- I" }( y2 [    )$ Q8 {) p  N$ R! T/ T7 |8 A
    (ai_ddvp_set_abs)
4 E+ ]& m0 J7 l5 ?" u7 c1 ^  )
6 D8 K, m: R2 L  (setq ai_ddvp_t nil)$ H# F6 Q* L, a% T# m' ]. |
  (set_tile "ddvp_val_x" (rtos ai_ddvp_b_curr 2 1))
) z/ e9 ]. S$ Y3 G  (set_tile "ddvp_val_xyp" (rtos ai_ddvp_a_curr 2 1)): e4 C4 V) a( B2 c
  (action_tile "ddvp_abs_wcs" "(ai_ddvp_set_abs)")
% K; c0 b. J' X$ C. g  (action_tile "ddvp_rel_ucs" "(ai_ddvp_set_rel)")2 D2 i6 Y8 k, e1 O( u' a& I- o
  (action_tile "ddvp_image" "(ai_ddvp_image $x $y)")
- A  s. E/ t8 u( r3 U. a3 m  (action_tile "ddvp_val_x" "(ai_ddvp_set_b (distof $value))")
6 v) _8 k8 d9 a5 [( a  (action_tile "ddvp_val_xyp" "(ai_ddvp_set_a (distof $value))")
! _* _9 w3 d. i( g0 _8 L  (action_tile "ddvp_set_plan" "(ai_ddvp_plan)")
/ p; }, {; b* ]# j1 R- H  (action_tile "accept" "(ai_ddvp_do)"), I( ?1 C- q1 H8 ^2 p% N
  (action_tile "cancel" "(done_dialog 0)")
4 w7 v7 x# l, z5 l* P3 r  (action_tile "help" "(help \"\" \"viewpoint_presets_dialog\")")# H  C( k: w  {/ G6 u5 ]0 U/ i
  (if (= (start_dialog) 1)0 p4 u) s6 e2 U+ r3 F
    (if ai_ddvp_t
; m- a% {9 o9 e; I& K8 g- W      (progn* ~( d0 o- i* W0 Q# _; C( F
        (command "._WORLDVIEW" ai_ddvp_wv)
6 c& N8 ^/ a0 u        (command "._VPOINT" "_R"
6 U* F3 A# r$ g                 (strcat "<<" (rtos ai_ddvp_b_curr 2))/ Q( S5 \, h% t- ]2 R0 r) C( z: ]
                 (strcat "<<" (rtos ai_ddvp_a_curr 2))! o0 R* T; o( B, p2 d" A
        )0 W9 _1 V8 ~" B, o
      )  K) P: J# g, Y( |5 s5 {- v0 i- k' N
    )9 P! o4 A) ]6 x
  )" v9 g  p0 b: w8 A  J- H+ g
)
2 `, K0 x* F/ o2 l3 d1 p) V& n8 X8 [! U& s2 A: }7 |# A
(defun c:VP ( / ai_ddvp_wv ai_ddvp_vdir_base ai_ddvp_vdir_curr
) w" q  H: y6 F9 X2 [; y+ f8 S                      ai_ddvp_bx ai_ddvp_ax ai_ddvp_by ai_ddvp_a_curr- n# |8 Q  b# y7 R
                      ai_ddvp_b_curr ai_ddvp_a_base ai_ddvp_b_base ai_ddvp_p" N" E" W% I8 z+ [7 F
                      ai_ddvp_t ai_ddvp_init ai_ddvp_a ai_ddvp_b! b. R4 X+ Z1 q8 E( c
                      ai_ddvp_a_last ai_ddvp_b_last, s+ D- Y/ ^4 t( |- }. s. [7 C
                      app dcl_id old_cmd undo_init
4 t4 ?, f& ?: r0 }/ D' g2 ]9 `4 ~                  ). ~- {6 b6 ~7 ]6 h) u
" {" ^3 s2 R# d  s( E
  ;; Set up error function., ?- o5 x) [% S" F& {0 H
  (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho
0 M" O" J1 n; T2 A3 z( K        old_error  *error*            ; save current error function
4 W6 f0 p5 S- [" ~9 [. w" N' n1 j        *error* ai_error              ; new error function9 C1 K/ V4 u4 Q- W7 x" p
  )$ }/ f+ [" N  w5 j" P  ^
1 q+ O" H' Z0 w) r' I
  (setvar "cmdecho" 0)8 L  j$ O% j+ |6 h5 T) m$ \

4 T) C2 |5 Y6 s% f: R0 D: d! T  (cond
. J5 O  h' L# v5 U$ y+ I1 Y     (  (not (ai_notrans)))                       ; transparent not OK6 u& D/ U6 Z: @- h, P
     (  (not (ai_acadapp)))                       ; ACADAPP.EXP xloaded?* R/ H1 h( n  n5 l- p! G
     (  (not (setq dcl_id (ai_dcl "ddvpoint"))))  ; is .DCL file loaded?: O" @; c7 Y+ ]$ B- {) _3 {& ~
     (T (ai_undo_push)
" h* B( {7 U% \  d. {  e* f        (ddvpoint_main)                           ; proceed!
4 x" g8 j# s7 ]" a        (ai_undo_pop)
% W( u  B! C# o+ Z: f2 P! I     )                                            
; ]- K5 F3 w2 M( V# z6 T  )/ T9 P  R+ G/ {# w

( \- L- t: B7 A! F/ r: q  (setq *error* old_error) % B6 _& X" c8 N- [( i# o9 u$ M4 ~9 v% a! B
  (setvar "cmdecho" old_cmd)6 e( M  i2 Q) b& Z9 ^4 r7 Q
  (princ)
) A1 e" X% c# `0 [)
* c& n) X* V9 I8 R9 l4 U6 s. n) Z9 x+ m' W8 o8 z6 d: |& `
(defun ddvpoint_main()
# ^5 z/ {0 A# P/ U1 |5 J( q
4 z( m1 H* X0 a' S4 [, H  (if (and (= 0 (getvar "TILEMODE"))
* I$ z! v4 A" c& Q" C           (= 1 (getvar "CVPORT"))
- }4 [7 y( B2 E: f" b$ }; p      )
" w' }) o1 q0 \1 z    (princ "\n** Command not allowed in Paper space **")4 `( D3 y7 @' T
    (progn
/ C4 N& ~5 c" c) G# k      (if (not (new_dialog "ddvpoint" dcl_id))
' S  F+ O6 ^, c: _+ |        (exit)2 z: p+ n" R" Z" G# f' |
      ). e" b5 S# B- ]5 l0 t5 x, O- {
      (setq ai_ddvp_vdir_base (ai_ddvp_fixzero (getvar "VIEWDIR"))- l" ]) Q* Q! B1 j
            ai_ddvp_wv (getvar "WORLDVIEW")3 Z' r/ F/ v4 q5 v( ^1 R
            ai_ddvp_init T
0 U* g4 M7 H' \" K9 U4 b) [# A      )- m8 r7 \$ l* Q4 D, J) R
      (ai_ddvp_main)% W* F/ T$ a2 O# F5 c
    )  _* x3 a, d# d+ `- J% }% O% H5 U
  )
; C! ^2 W7 {5 L)
9 T2 G7 r1 ?$ B% h# z! w- _& z
( X# N, G* w, Z3 R(princ "  DDVPOINT loaded.  ")3 m7 E9 w6 G6 `- n
(princ)
8 g: U) Q) P( V, A5 _2 s% X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
# S; q$ e" r, `9 [8 R: y  C3 l* E;============================= Tran Ngoc Thang =================================
7 Q- \. Q) V5 f5 _- [; u(defun c:zx () (command "zoom" ".5x"))
2 S! ~# ~7 W2 W: r4 z(defun c:zz () (command "zoom" "p"))
; S" w& ]: S0 H' o  @(defun c:za () (command "zoom" "a"))
: m+ w/ B' K5 h(defun c:zd () (command "zoom" "d"))
- J( a! I5 p1 n. u& d/ d4 _, U(defun c:ze () (command "zoom" "e"))
) H& G9 I/ z$ Q# A9 i(defun c:zr () (command "zoom" "" ""))
  H* R* b- m1 W/ W: A4 ?( G  C# D(defun c:vv () (command "ucs" "v"))
7 E2 J. ~2 r# `+ Z9 x$ v(defun c:co () (ssget) (command "copy" "p" "" "m"))! \: P2 b( S3 R! C8 B& ]/ {6 k
(defun c:c () (command "circle"))% A( l5 w# ?5 }  K" y; I
(defun c:rt () (command "rotate"))
1 f- _+ Q  B2 m9 Z(defun c:3q () (ssget) (command "_rotate3d" "ANGDIR" "value" pause (princ)))6 p: c$ `; [6 I: I, u; x
(defun c:30 () (ssget) (command "rotate" "p" "" pause "30")); ?3 L; D1 K  p: R# ]9 Q7 a- x
(defun c:-30 () (ssget) (command "rotate" "p" "" pause "-30"))  B% C- J: C! Y, h
(defun c:45 () (ssget) (command "rotate" "p" "" pause "45"))
& ?% q: G8 F! R7 P4 P; F  G% q" d(defun c:r5 () (ssget) (command "rotate" "p" "" pause "5"))
6 g8 G. a4 t, e% l$ S(defun c:60 () (ssget) (command "rotate" "p" "" pause "60"))
1 S5 g1 K6 u) i9 d' A/ {' v(defun c:-60 () (ssget) (command "rotate" "p" "" pause "-60"))0 x: I; |4 ^9 M# R! D# E
(defun c:90 () (ssget) (command "rotate" "p" "" pause "90"))2 E4 z6 T) a' l
(defun c:180 () (ssget) (command "rotate" "p" "" pause "180"))6 j! h! k& z! z' g+ y: T
(defun c:-45 () (ssget) (command "rotate" "p" "" pause "-45"))! C, H7 q0 B* v. p$ I6 C. s# N( Y
(defun c:-90 () (ssget) (command "rotate" "p" "" pause "-90"))( [# I" r2 }8 Z2 G8 g: _
(defun c:md () (ssget) (command "mirror" "p" "" pause pause "y"))
9 |/ y. R+ \. X( ^5 t9 V( [(defun c:fd () (command "find" "p" "" )(princ))(princ)
8 ]# i' J+ ^" j
- n* T6 E- U0 [(defun c:VNI () (command "-style" "VNi-AUCHON" "VNI-vauchon" "225""1""0""n""n""n"))(princ)
4 T0 K# D  n) s$ w( P0 c3 P  ?2 s3 V2 v/ V
(defun c:romantdim () (command "-style" "ROMANT-DIM" "romant,vnh.shx" "200""1""0""n""n""n"))(princ)4 V) I, r* h6 F
(defun c:romantext () (command "-style" "ROMANT-TEXT" "romant,vnh.shx" "200""1""0""n""n""n"))(princ)
. @* t- f# E8 ~(defun c:vnhelvthuong () (command "-style" "VNHELVLT-Thuong" "vnhelv,vnh.shx" "500""1""0""n""n""n"))(princ)2 h- g4 d* W. H, @
(defun c:vnhelvhoa () (command "-style" "VNHELVLT-Hoa" "vnhelvh,vnh.shx" "500""1""0""n""n""n"))(princ)
5 k+ x( F* j# E. f9 W4 p(defun c:truc () (command "-style" "TRUC" "impact" "0""1""0""n""n""n")), w: `+ _1 u6 E6 O
(defun c:chu () (command "-style" "CAMBRIA" "Cambria" "200""1""0""n""n"))3 r# C" h' Z% ~/ C" o3 b6 ^
(defun c:cot () (command "-style" "COTES" "Romand" """1""0""n""n"))/ K1 |$ a- R9 w" P7 Q
4 a5 Z" d) O8 ~# G- q* S
(defun c:an () (command "-style" ".AVANT" ".vnavant" "200""1""0""n""n"))
- |9 w# i$ l- I' _+ o8 {(defun c:ah () (command "-style" ".AVANTH" ".vnavanth" "200""1""0""n""n"))
# p# S9 b1 s0 Q(defun c:ha () (command "-style" ".ARIALH" ".vnarialh" "200""1""0""n""n"))
% ]0 U- U& h6 _. _6 Q1 a(defun c:na () (command "-style" ".ARIALNARROWH" ".vnarial narrowh""1200""1""0""n""n"))$ n5 k9 h8 K. G: q
(defun c:vn () (command "-style" ".VNTIME" ".vntime" "200""1""0""n""n"))1 h3 ]* l. q' V1 K3 _6 G
(defun c:vh () (command "-style" ".VNTIMEH" ".vntimeh" "200""1""0""n""n")): G! P+ x2 S2 e  T! n6 B. R

8 e% b$ c6 _1 S/ M& O(defun c:ps () (command "SOUT" "CorelDraw-import-Photoshop" "W"))(princ);export the current view of a drawing as an EPS file) f9 \( A* X! {8 o2 j
) J& P$ }8 m. [
;free lisp by cadviet,cd2k44' v5 Q) t0 H) w: |* J
;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830
- Z8 z+ B; O* s$ J7 X(defun c:FTEXT (/ ent tstyle )
$ F; U0 S, w- a- x5 B1 ^9 Q$ G(command "undo" "be"): L9 N& W. t$ D) ]
(setq ent (entsel "\n Pick text :"))
& {1 V( P  y6 _3 K" H, x+ D(setq TSTYLE (cdr (assoc 7 (entget (car ent)))))+ x- }+ _  A! J/ @
(command "STYLE" TSTYLE "romant.shx,vnh.shx" "0" "1" "0" "N" "N" "n")# E  m# m+ ^' R! k) L9 {" m+ l
(setvar "TEXTSTYLE" Tstyle)
) {5 D# I+ L1 p6 F& a, @(command "undo" "end")
9 i$ c5 q: R" C' k( j)3 F; Q  O# R0 V8 s1 D9 H# I5 B
;Cam on cadviet nhieu 27-11-2023 04h15p36s (thanks cadviet)1 N& w: K: o4 E9 G* K6 `
( r; q% W+ _7 [* [/ S% a8 S$ r( b
;free lisp by cadviet,cd2k44' c5 h4 F8 d. |+ T! }' `' {
;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830% y3 [5 k; y# c: \; l  h) j
(defun c:Fvnh (/ ent tstyle ); x5 ?5 x$ W& ]+ I* H! a
(command "undo" "be")! M8 [5 Y/ q4 E7 p2 H
(setq ent (entsel "\n Pick text :"))) ~( i" t' g8 [+ p' Z! W
(setq TSTYLE (cdr (assoc 7 (entget (car ent)))))
' R# y1 H. K- L. T, g& V(command "STYLE" TSTYLE "vnhelvh.shx,vnh.shx" "0" "1" "0" "N" "N" "n")
' a0 _5 `" Z2 I/ P2 Y9 W(setvar "TEXTSTYLE" Tstyle)
. [( `" O$ n7 f) ?* q(command "undo" "end")$ G8 R7 d  I& h
)
$ I" e0 y3 C- V. l& e$ }; y4 g4 v' q# |! E
;free lisp by cadviet,cd2k44% j& e1 t# S0 G0 v* L
;link bai viet http://www.cadviet.com/forum/index.php?showtopic=538302 W  y, j7 Y% I8 r+ f$ Y
(defun c:Chbg (/ ent tstyle )
* b+ E9 W0 i" Q# A; {(command "undo" "be")% e7 _) d+ g! |% s4 A! a  P
(setq ent (entsel "\n Pick text :"))
  H' @4 S" @) F/ k9 w9 W(setq TSTYLE (cdr (assoc 7 (entget (car ent)))))
" ]( f5 I3 o$ j# B" r. L(command "STYLE" TSTYLE "chhbg.shx,vnh.shx" "0" "1" "0" "N" "N" "n")& B( P8 ?( f* o$ G. k* h
(setvar "TEXTSTYLE" Tstyle)
4 ?6 J$ H1 j/ B* }% ~0 Y(command "undo" "end")
! W8 g" p7 @, J) S6 g+ T+ I9 J% N% d)
$ Q* k' x9 h  x! _! J# K) p8 R/ N$ n" z: l( u
;free lisp by cadviet,cd2k44
6 N2 G) e) Q: A' u  y;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830
- a9 |% |7 @- b# f, w  N(defun c:Chsm (/ ent tstyle )
/ h; A6 v. ^& R; c' X- a) G+ \6 }7 y(command "undo" "be")
2 R7 _, x+ t5 R4 Z! B  ]2 w(setq ent (entsel "\n Pick text :"))
9 ~1 S8 a. K  ]% r(setq TSTYLE (cdr (assoc 7 (entget (car ent)))))# _# b6 G- i# y& f% ^
(command "STYLE" TSTYLE "chhsml.shx,vnh.shx" "0" "1" "0" "N" "N" "n")
( X; O4 n" z- b(setvar "TEXTSTYLE" Tstyle). o. \( I9 K  J0 `6 \3 c
(command "undo" "end")
7 R4 f6 P  \/ r7 [. f)
% G7 ^9 I. T+ W4 j  i5 [
, M- A: ]2 X  B5 e1 P' v- Z;free lisp by cadviet,cd2k44& V2 A  x& V1 L& E" N' v
;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830$ o# ^. ~9 Q+ v, l5 {
(defun c:Fttf (/ ent tstyle )# c; m/ h2 A& x
(command "undo" "be")) [5 U5 N0 d. P
(setq ent (entsel "\n Pick text :"))6 K8 b6 [! O: T) j$ z  C
(setq TSTYLE (cdr (assoc 7 (entget (car ent)))))
7 L7 o6 |, \( f' ?(command "STYLE" TSTYLE "Cambria.ttf" "0" "1" "0" "N" "N" "n")
: i1 A) O( m( w  r1 k(setvar "TEXTSTYLE" Tstyle)7 f& T- \/ L% \9 H2 R
(command "undo" "end")6 d) t5 f! x' R9 j. a
)
! J' y* ?4 _* @7 \, w& v, K! E+ {# H8 {, a
;;; ============================================/ b  C" j; ?: x, O7 ~
;;;0 `+ C# R5 \- y2 O* s
;;;   LISP Creater Tao Duong Dan AUTOCAD20005 m4 O. v. ?) ]: v8 k% n
;;;& n/ O$ U& `# o) @4 P8 g; s) }
;;; ============================================" Y/ K& C1 r. l! Z

: \9 P& ]( ]3 O7 X6 z;;; ============================================3 ?& K1 }  M: I$ W4 R5 i
;;;; z/ E( i3 A0 x
;;;          CREATING FROM AUTOCAD2000
5 S1 T! _  }. `; R% E6 J+ a+ M;;;      Tran Ngoc Thang - Sinh 03-05-19763 e. m5 l$ u8 S, g/ q
;;; ============================================9 {2 C9 Q& D/ }& {! {7 S
2 e. S' g# a* ~- F' _7 C
(setvar "MEASUREMENT"1);Bien So SCALE Cua BHATCH
( X6 h1 E) O3 t1 t; d! Q; Q;(setvar "DYNMODE"2);Bien So An Hien COMMAND LINE( V" ?# A; u1 H
;(setvar "VTENABLE"0);VTOPTIONS Enable Animation for Pan and Zoom. b+ G: q, c2 _+ @2 R8 f! R
(setvar "INSUNITS"4)
* E  [1 A# Y: i- t  y(setvar "ANGBASE"0)
0 Z4 F0 ?) t+ Z5 D" Q9 [(setvar "ANGDIR"0)- [0 K0 o0 @' I
(setvar "AUNITS"0)
5 ~1 o& W9 m9 p& u( p(setvar "AUPREC"8)
1 l) n2 K9 K; _0 G(setvar "LUNITS"2)  Z. ?7 C2 G) x. \5 ]8 i( W
(setvar "LUPREC"8)) e' _1 f5 {0 |/ t+ I) F
(setvar "ACADLSPASDOC"1) ; y# }! ]# H- J5 v
(setvar "pickbox"5)
$ F' F4 D* p5 H, o4 S& Q- r(setvar "blipmode"0)0 n0 z5 _7 A: G* Q3 Q; s* o
(setvar "mirrtext"0)
9 s. F0 I. O) X8 T* ~1 K(setvar "cursorsize"100)
  L* l/ T. a$ A/ A, ?9 q(setvar "ZOOMFACTOR"75)
% ]# B  \& J# A: ~3 J1 K( p2 V(setvar "LTSCALE" 10)
& k4 u& @! W8 |! w3 `% `- E(setvar "lwunits"1)
9 A$ q9 K2 m* v& l8 z6 q) @' e- }$ a1 ](setvar "DIMBLK" "Closed")$ Y. t% n) ]* {) o6 m  ~
(setvar "DIMGAP"0.0693)
3 m5 i4 c/ Q' F9 j(setvar "DIMASZ"0.20)
* v5 m/ N- P6 D(setvar "DIMCEN"0.2)  M% A1 N: \: H3 Q9 ^  q$ b4 f
(setvar "DIMDLI"0.1)0 t$ q, W. F" P* P. v
(setvar "DIMEXE"0.0693)1 D6 B8 h. t) E
(setvar "DIMEXO"0.25)% E* L( [. \, M4 F
(setvar "DIMDEC"0)
, T3 ]. Q3 q9 s3 {* B(setvar "DIMTIX" 1)
- p6 n# [' \+ X+ h) n0 c(setvar "DIMTXT" 0.099)
( Y6 Z4 _5 A4 M, V0 J(setvar "DIMCLRT" 7)" Z' Z- p% s( s& u
(setvar "DIMTVP" 1)/ l0 S" Y# x! X4 y# F- o/ Z  l3 V
(setvar "DIMJUST" 0)$ g; a( M3 ]8 a
(setvar "DIMTIH" 0)
! L) K2 v+ D7 L3 Y" y7 k(setvar "DIMTOFL" 1), L. L) E  r1 C* ^! Y
(setvar "DIMSCALE" 1111.1111)4 L. i8 v, s$ x$ ]+ Q

) @- ]/ P- \8 i* G% s% @: V# c$ E3 A6 Y' ^* g- D+ L! L- g- Z
: C3 [( z5 `7 v; s6 z6 s
(defun c:zp ()  (command "'.zoom" "p"))
% v5 d5 G& A1 l3 Q2 Q(defun c:zz ()  (command "'.zoom" "p")): Z6 [. T+ z. k/ u8 ~9 y) y
(defun c:ze ()  (command "'.zoom" "e"))) }# U7 l0 J5 [  r" l
(defun c:za ()  (command "'.zoom" "a"))  D  R+ c2 f" v8 D- n2 b7 E# w( W
(defun c:zd ()  (command "'.zoom" "d"))
# L; \6 }9 G. b9 b7 f% g(DEFUN C:ZZZ () (COMMAND "ZOOM" ".25X"))' n) V9 c8 X! C8 d0 C
(DEFUN C:ZX  () (COMMAND "ZOOM" "2X"))1 F' V) {  r3 w
(defun c:de () (command "ddedit")(princ))2 a% i- H& W7 O: `* P$ r
(defun c:dda () (command "Dimaligned"))
" [/ d5 N. x, }; B( O(defun c:ddb () (command "Dimabaseline"))" [  B0 J" w! ^) ]0 g
(defun c:ddc () (command "Dimcontinue"))1 z8 W* A) b, c8 {8 S' d4 v5 m
(defun c:dde () (command "Dimtedit"))
9 Y# C* p3 B9 l: @" u' H(defun c:ddf () (command "Ddattdef"))2 O9 B, p- A6 a* s
(defun c:ddi () (command "Dimdiameter"))$ S1 r" e7 D1 S! T0 H/ d; [4 D
(defun c:ddl () (command "Dimlinear")); V' i7 D( q. U: w. p$ y; p; v, {, U
(defun c:ddn () (command "Dimangular"))
; ~/ x& O% a7 |! L1 c(defun c:ddo () (command "Dimordinate"))
# |, h! y9 {* }(defun c:ddr () (command "Dimradius"))0 X# p1 F( n  z4 `+ w* e1 h% }
(defun c:dds () (command "Dimstyle")): J8 ^5 h* V% }

$ F" }& H; {' O: @8 ^. E7 S' f(defun cU () (command "dim1" "up" "select" "exit" pause ))(princ)
/ C0 a$ G+ w3 D1 {4 Q(defun cH () (command "Dim1" "home" "select" "exit" pause))(princ)
# j$ \3 h7 z$ r, I(defun c:UU () (command "dim1""update""all"))
: v$ o6 Q5 ?$ T5 M- H(defun c:ded() (command "dim1""tedit"))
) Z) ?/ `0 T% b! k" [(defun c:da () (command "dim1""ali"))% K( }$ U6 @. ^0 }/ `3 z" y
(defun c:dll() (command "dim1""l"))
/ Q3 s! p$ T  O: {(defun c:dan() (command "dim1""an"))
0 ?) O# P: R# t5 z" P" j, B(defun c:d1 () (command "dim1""ra"))& l6 _$ T, S- e
(defun c:n  () (command "dim1""new"))9 W4 ]( ~$ V, y* m4 T
+ C7 I5 p' K: ~: w8 v$ B
(DEFUN CE  () (COMMAND "EDIT"))
/ k/ J1 N. ?! Y$ F9 N2 z(DEFUN CL  () (COMMAND "LINE"))0 m2 g' e, [; R9 S" d. `
(defun c:dd () (command "dist")(princ))2 C7 d, u1 K  [9 A  G  H/ h
(defun c:w () (command "pedit" pause "w" "au")(princ))8 P: ~" |& P4 V8 K
(defun c:pg  () (command "polygon" "polygon"))
: D- H" V% u+ P(defun c:el  () (command "ellipse"))
$ V" ]5 A  `. \2 E' Z+ R+ K! q(defun c:xe  () (command "explode"))
6 k% o% w+ C. x(defun c:eex  () (command "extrude"))
6 |3 h4 V% O' H, s6 }. @7 B(defun c:xg  () (command "xline""a"))
0 [8 w! g% Q8 d6 }- M3 F' ](defun c:xh  () (command "xline""h"))
3 g7 [& `/ f( r7 E' p5 h! n(defun c:xv  () (command "xline""v"))# a7 [( C8 B& u' `& I& G

9 X/ U+ m4 c. {2 R5 A+ r! E(defun cc () (command "osnap""cen"))/ k% {" N: F, B+ i' J
(defun cd () (command "osnap""nod"))) A" `( V6 [* P3 k$ }+ A8 I7 C
(defun ce () (command "osnap""end"))
+ V3 K# S5 H* J3 `( E5 }/ ~2 k3 i- G(defun ci () (command "osnap""int"))
! Q2 o" J) A, n& n/ f' g(defun cr () (command "osnap""per"))* ]: c1 o* P3 j: l/ x# u2 _9 m
(defun cn () (command "osnap""none"))
! F# m8 J  `* `1 B! p2 r(defun cq () (command "osnap""qua"))
: ?" ?& P4 |) ^5 n& M8 W" e0 \5 |! `(defun cm () (command "osnap""mid"))) e8 }& Y7 X" c
(defun ct () (command "osnap""tan"))$ L5 F3 Y% m3 f; i( d
(defun cin () (command "osnap""ins"))6 Z. y. y. V3 `# Y8 F' G
(defun c:oa () (command "osnap""nea"))( w5 Q, ?& l+ X; C7 z0 b
(defun c:ol () (command "osnap" "End,Mid,Cen,Node,Nea,Int,Perp,Qua")(princ))7 p' D; S: b5 |! d9 X* q
;(defun c:du () (command "dim1" "up" "s" "pick" "other"))
. f8 j7 |7 C$ `3 G# c8 B& O;(defun c:nn () (command "new" "y" ))" N* {' D( N* O- ]1 l
& j3 ?% U- J1 g9 a- b7 g: b) v; F8 ]
(defun c:/ () (command "limits"))
8 ~* I6 V. h- V! ]6 z2 E(defun c:`1 () (command "region"))1 M* p* L8 z. Q/ w0 t1 b7 \# r# t6 T
(defun c:`2 () (command "subtract"))5 m5 `% P# j9 X2 h9 ]
(defun c:`3 () (command "union"))/ n4 P$ R% J* L; @1 F2 X9 e
(defun c:`4 () (command "intersect")): j- N8 n- {5 A# s' W
(defun c:`c () (command "cal"))# w6 j) n' d+ D% H1 X: w0 Z
(defun c:`g () (command "olygon"))$ Q4 v& Y1 W- |% N% B, b! y9 j6 c& C
' Y$ o2 c' F0 t' M( e! B0 D  U
(defun c:lmi() (command "LIMMAX" pause "" "zoom" "all" )(princ)). m1 \  F3 E$ O; S, ]1 s
(defun c:drt () (command "DRAWORDERCTL" pause "Integer" "" "" )(princ))8 D  l! c. a! E
(defun c:ip () (ssget) (command "print,_plot" ))(princ)1 C1 e! y4 k) z. E8 V

7 A# C6 @3 c* w& j- C7 M% T(defun c:ddm () (command "ddlmodes" pause))$ v; `4 L  N" s- q1 ?. y/ t0 F
" \( i3 |9 y  p. G( z9 m! L" e: W
(defun c:sha () (command "shade" pause))6 c! G& a( m5 s2 O

( ~* [3 T# F4 v# ~(defun c:sr1 () (command "surftab1" "p" "" pause))
2 V& D4 ^$ R6 w4 b(defun c:sr2 () (command "surftab2" "p" "" pause))
8 f* C) O% x! [1 ]; a3 r
& B! q0 l; Y' U' R: Z! u(defun c:ad () (command "audit""y"))' F( v" m2 G7 d/ @
(defun c:q () (command "quit"))
) L0 H' R/ x) `$ B- X1 X% f2 w6 T+ B
(defun c:30 () (ssget) (command "rotate" "p" "" pause "30"))
: j+ U2 q2 b3 \. M) V7 e" Y$ d9 c(defun c:-30 () (ssget) (command "rotate" "p" "" pause "-30"))
' s) M6 U2 V& |5 g0 |(defun c:45 () (ssget) (command "rotate" "p" "" pause "45"))
6 H: A* M& p, v1 |(defun c:-45 () (ssget) (command "rotate" "p" "" pause "-45"))
6 t' w9 q* y0 `* N" Z" @(defun c:60 () (ssget) (command "rotate" "p" "" pause "60")); V/ \  V/ z" @
(defun c:-60 () (ssget) (command "rotate" "p" "" pause "-60"))
8 ]" ]6 Z) N; U0 ^, O  m3 t(defun c:90 () (ssget) (command "rotate" "p" "" pause "90")); e6 c" z0 b& Z" M' D2 j9 C7 t
(defun c:-90 () (ssget) (command "rotate" "p" "" pause "-90"))
. c5 B. S' w; F. u/ k% M4 a(defun c:180 () (ssget) (command "rotate" "p" "" pause "180"))) o( p, ]% E) B  {) V, x
% |' y' M6 W! E; ?
(defun c:u3 () (command "ucs""3"))
# p& r' G5 D' ~7 [4 ^: ~4 C. X(defun c:ue () (command "ucs""o""end"))% y  Z" B' R7 q1 e% U( z
(defun c:ui () (command "ucs""o""int"))
; i2 Q( d6 C! g, Q, ?3 [(defun c:um () (command "ucs""o""mid"))1 S3 U7 P8 k' u1 U/ n
(defun c:uc () (command "ucs""o""cen"))- m! D2 K6 v' s7 a# {6 W
(defun c:uq () (command "ucs""o""qua"))& m: e, H& a2 u% t* E
(defun c:3s () (command "ucs""3")): _3 |8 ~  Z% D5 U
(defun c:sx () (command "ucs""s"))7 H; T0 {/ p- s! }1 O" E
(defun c:sf () (command "ucs""o"))
7 {: t: K: k' m4 N7 ^! r(defun c:sz () (command "ucs""p"))8 j2 O1 g; m" E
(defun c:sr () (command "ucs""r"))
, q" B: A; M8 }' M) w( K8 g( ^(defun c:sw () (command "ucs""w"))
2 T" ?3 x2 ^7 Z  b7 n, A- G(defun c:fv () (command "ucs""v"))- g* Q# |: Y7 [8 [- i0 v
(defun c:ux () (command "ucs""x"))0 R1 a- `) J$ v9 K! Z3 Q! s1 @
(defun c:uux () (command "ucs""x""90"))
: ?, f3 a+ S. J# U- n8 z(defun c:xxu () (command "ucs""x""-90"))+ i; g: F8 v, ~7 W
(defun c:uy () (command "ucs""y"))
8 i+ ?1 u& \6 ~1 o- }, M(defun c:uuy () (command "ucs""y""90"))
6 W7 k0 c9 Z& y4 x9 _! A4 k(defun c:yyu () (command "ucs""y""-90"))% [$ q5 n6 y  b! z- F0 W9 g
(defun c:uz () (command "ucs""z"))1 T7 w* B; @; _: p! a8 v0 |  L- Z8 u
(defun c:uuz () (command "ucs""z""90"))
3 P- L/ _* G% Z) w# n9 O(defun c:zzu () (command "ucs""z""-90")); S1 c* t% `4 D& o
(defun c:uci () (command "ucsicon" "roperties" ))(princ)
4 G% _; e0 c- x& o- |(defun c:ucm () (command "ucsman" ))(princ)
5 |+ ]5 f0 n3 ]: F( c+ t
1 l  k4 [2 S+ R) y9 x& {5 q(defun c:sa () (command "vpoint""_non""-1,-1,1"))1 s  O- F& j7 ?9 J( Y4 e- D
(defun c:sd () (command "vpoint""_non""1,-1,1"))
9 M1 n2 B8 |; c4 B(defun c:se () (command "vpoint""_non""1,1,1")), b7 x- }: \0 u4 @) x$ J: T
(defun c:sq () (command "vpoint""_non""-1,1,1"))
  ^. j( S, O% F(defun c:vc () (command "plan""")). H7 |, k: W2 v) R6 c3 v
(defun c:vd () (command "dview""all")). f3 [" ]" J" a

" U. q2 M. n: M0 h$ }(defun c:TT0 () (command "tilemode""0"))3 g, w; p( m* w$ ]* ?# p
(defun c:TT1 () (command "tilemode""1"))6 H! j. t7 a; S7 j' x

  s* {6 A' H& d' E(defun c:vt () (command "vpoint""_non""0,0,1"))
5 b  Q% v+ a0 m8 M2 {, y(defun c:vb () (command "vpoint""_non""0,0,-1"))
7 h8 k1 j! v( }3 s) }# m(defun c:vl () (command "vpoint""_non""-1,0,0"))
7 F# L# Z# Y9 Y- ^(defun c:vr () (command "vpoint""_non""1,0,0"))* P3 |8 m6 K6 j
(defun c:vf () (command "vpoint""_non""0,-1,0"))( q6 }2 m3 b+ v% q' j( {
(defun c:vk () (command "vpoint""_non""0,1,0"))6 L, [( m+ y% ^) P& b% ]% j! Q

  G: Y1 [  g% g8 I" e6 j3 g(DEFUN C:MM  () (COMMAND "MIRROR"))
/ i& ~( o' G4 f9 Z8 V* ~/ h(DEFUN C:MP  () (COMMAND "MOVE" ""))
4 X0 x; E, p- H( N: q! \$ i+ c* V9 i  P9 o) T9 |( I1 m
(defun c:mee (/ a)
% h' o9 R0 {6 H7 N; n  (setq a (ssget))(command "move"a"""end"pause"end"))
: O6 v$ k) y! u6 T; F(defun c:mc (/ a)
  C' c, {* t* u  (setq a (ssget))(command "move"a"""cen"pause"cen"))
! ~. X( @% w* B% v* y$ U" |  [(defun c:cc (/ a)
1 q. I) ?- r) w  (setq a (ssget))(command "copy"a"""m"))5 y) o" G* Q) |6 J( z% u2 @2 O% u
(defun c:ce (/ a)! `6 {( A; g. U2 B! G
  (setq a (ssget))(command "copy"a"""m""end"pause"end"))
5 r1 T) |( s! D9 r+ n- i+ u$ R(defun c:cn (/ a)6 Q$ g1 K) [( P: b
  (setq a (ssget))(command "copy"a"""m""cen"pause"cen"))
% y. u+ l9 v/ N: v(defun c:tl ()(command "trim""l"""))) v3 q9 F) L& I5 L2 l
(defun c:tf (/ a)- H' X( e0 {& _! M4 K: ]
(setq a (ssget))(command "trim"a"""f"))* O. ?) J: \# e: o7 G- c
(defun c:el ()(command "extend""l"""))+ D& _  I' \0 [9 V  |7 P
(defun c:ef (/ a)
6 l! B1 I1 J, p& @% R: `: {/ W  (setq a (ssget))(command "extend"a"""f"))/ l1 r8 K! D; J5 P9 ?
3 m# n( T! G% G/ p5 A/ c
# q  D' z5 t1 o% Q& `% N
(DEFUN C:110   ()(princ "\nChon doi tuong can offset ra 110.......") (COMMAND "offset" "110"))  d9 x, G2 T% T, a0 t
(DEFUN C:220   ()(princ "\nChon doi tuong can offset ra 220.......")(COMMAND "offset" "220"))
# [2 C/ [! p  k$ R! ?0 ~; C(DEFUN C:330   ()(princ "\nChon doi tuong can offset ra 330.......")(COMMAND "offset" "330"))
8 C0 Z9 n* f5 m5 u0 @' \- Z(DEFUN C:400   ()(princ "\nChon doi tuong can offset ra 400.......")(COMMAND "offset" "400"))8 H# D# A! f$ F! {
(DEFUN C:55   ()(princ "\nChon doi tuong can offset ra 55.......") (COMMAND "offset" "55"))( S- e: u' z1 U2 Q+ _2 _4 Y& I3 P9 q
(DEFUN C:600   ()(princ "\nChon doi tuong can offset ra 600.......") (COMMAND "offset" "600"))
5 X  r' N5 y5 _( _9 g! {" L(DEFUN C:700   ()(princ "\nChon doi tuong can offset ra 700.......") (COMMAND "offset" "700"))
8 h) {4 }6 l9 |: e4 m(DEFUN C:800   ()(princ "\nChon doi tuong can offset ra 800.......") (COMMAND "offset" "800"))* V2 n: B: Q5 l  o7 H3 F9 ]; I& @, Z
(DEFUN C:900   ()(princ "\nChon doi tuong can offset ra 900.......") (COMMAND "offset" "900"))
0 A7 o2 h4 m# C0 l$ c9 F(DEFUN C:1200   ()(princ "\nChon doi tuong can offset ra 1200.......") (COMMAND "offset" "1200"))- S. W- y! j' `
(DEFUN C:1500   ()(princ "\nChon doi tuong can offset ra 1500.......") (COMMAND "offset" "1500"))' a/ H: o* {; J' K  p
(DEFUN C:1800   ()(princ "\nChon doi tuong can offset ra 1800.......") (COMMAND "offset" "1800"))+ L4 v/ X, s/ r8 Y
(DEFUN C:2400   ()(princ "\nChon doi tuong can offset ra 2400.......") (COMMAND "offset" "2400"))
) e" F& |. L' E/ s/ |% b7 c$ m(DEFUN C:3000   ()(princ "\nChon doi tuong can offset ra 3000.......") (COMMAND "offset" "3000"))
& P) M# L% D) J& `: d8 i(DEFUN C:3600   ()(princ "\nChon doi tuong can offset ra 3600.......") (COMMAND "offset" "3600"))
1 B& p9 P' Q" h. O- K6 F(DEFUN C:4200   ()(princ "\nChon doi tuong can offset ra 4200.......") (COMMAND "offset" "4200"))5 e4 w" T0 [$ F* C7 g. V9 C, g" x
(DEFUN C:5000   ()(princ "\nChon doi tuong can offset ra 5000.......") (COMMAND "offset" "5000"))) T4 f2 X# W: R% q$ g

+ D& d! ~3 a; g, R(defun c:mla () (command "-mledit""av"))1 E5 m9 ]+ @7 l+ B9 T
(defun c:mlc () (command "-mledit""mc"))! ~9 W$ K3 D, o8 l: E& C# h
(defun c:mld () (command "-mledit""dv"))0 Y7 [+ n4 o  @2 E
(defun c:mle () (command "mline""end"pause"end"))( G$ Y! T) b! k& u! l& K# A; ~% w
(defun c:mli () (command "-mledit""ca""int"pause"int"))
5 H, s( M8 O7 Y2 V2 ^/ T0 ?0 F2 [(defun c:mlj () (command "-mledit""cj"))) i# Q+ X8 i1 o2 C8 K+ [" ~
(defun c:mlt () (command "-mledit""mt"))
8 ?6 {; i0 U$ c(defun c:mlk () (command "-mledit""ca""end"pause"end"))( W3 Q3 B, F) H# T0 F- a
(defun c:mlw () (command "-mledit""wa")), }) d! R& s; f2 U3 p9 K

& `$ K' J% \! f, M(DEFUN CCA () (COMMAND "DVIEW" "all" "" "CA"))( g% [3 s' l- k0 j
(DEFUN CPA () (COMMAND "DVIEW" "all" "" "A"))
6 i: ]3 }# Q1 O8 |. ~3 h& @7 S(DEFUN CPO () (COMMAND "DVIEW" "all" "" "O"))
6 H/ \; l! R3 M3 @$ A/ o(DEFUN CDD () (COMMAND "DVIEW" "all" "" "D"))7 ^' }- z8 I) ]8 v% a4 D% l4 W( @
(DEFUN CZ  () (COMMAND "DVIEW" "all" "" "Z"))
5 a* x$ P" q! \2 |. z
6 C3 |. b+ d' n8 W- d(defun c:p0 () (command "pline""""w""0""0"))
- ?0 F  E& ^, p0 p6 |# k(defun c:ot  () (command "offset""t"))3 H& E* E, D, ^# j% X* I; G3 z
(defun c:t  () (command "mtext"pause"j""bl""h"pause))6 a" B$ {, ]# _5 n4 \
(defun c:uo () (command "ucs""ob"pause))
, X, G% b9 L7 a9 T(defun c:f0 () (command "fillet""r""0"))
& p; B, i4 P. ^. E(defun c:fr () (command "fillet""r"))' X8 L2 O2 r! E& z
5 [3 r5 e* u3 e3 k- T9 M' }, }
;CHAMFER
3 W, t/ n& p0 [' M8 U(defun c:cf () (command "chamfer"))5 y0 B$ m- u. e1 j
(defun c:cfd () (command "chamfer" "d"))2 k6 ~' K! T8 s5 ^% J
(defun c:cf0 () (command "chamfer" "d" "0" ""))
  c' b- \1 Y5 S5 J
% C4 a6 ~4 z8 l+ j2 `" D+ |;FILLET
  h- H9 u  W, G  s(defun c:f () (command "fillet"))+ D! P5 }3 t% M. K
(defun c:fr () (command "fillet" "r"))* z' B  U1 }$ z6 y, c
(defun c:f0 () (command "fillet" "r" "0")): I1 U6 i- G! J* F

5 s( O  ~* Y0 V* d* N(defun c:OO  () (command "oops"))+ F5 L7 V8 Q" D. E2 I. v( T
(defun c:dln  () (command "dimlinear"))  c' r3 D- N" w# D8 W5 X6 a
(defun c:dan  () (command "dimaligned"))
! U# B) y# C! C3 a% i(defun c:ddc  () (command "dimcontinue"))
; Y7 d" Q; ?* `, q- _1 f5 l5 V& g/ v0 Q9 ~# M
(defun c:sc () (command "scale" "auto"))
4 U! g0 m, P' w(DEFUN C:XO  () (COMMAND "snapang"))0 r# I, p/ e, A" @+ ^
(defun c:cc (/ a); d5 j* ^! l/ |2 M/ ^' Y1 u
  (setq a (ssget))(command "copy"a"""m"))
) r. S, g) C9 k4 I* B- }) S+ d" ]- B& B) U; W
(defun cJ (/ a)
; U) b- K& H! G- |7 m4 P, D  L  (setq a (ssget))(command "pedit"a"""j""all""y"))
1 W+ p, y* s( T' H( |" O(defun c:JJ (/ a)
1 p& [, e) I! L, ?% ^( W  (setq a (ssget))(command "pedit"a"""j""y"))
3 h! D, ^1 l" U% m1 s+ k& x(defun c:TN (/ a)
: I6 P, t% g. W) p5 S  (setq a (ssget))(command "change"a"""p""T"))
. T' K+ t7 l. |3 n: S9 j; }: ~' D7 [- J# R9 j$ O$ G- S# ]" n: b
/ w* p% g$ b0 S& Y
;================== Tran Ngoc Thang - Sinh 03-05-1976 - Suu Tam - Tu nam 2000 - Hoc nam cuoi KTS . DHXD ====================
/ L! N3 s: q" R8 y7 a! B8 k2 V  p0 A, D$ v% N
(defun C:IB ()(setvar"cmdecho"1)
/ w6 x8 p: e+ c3 B1 @) R  (setq pt(cadr(entsel"\nSelect Block:")))
+ U* `, p0 B# ^$ Z% \3 ?  (setq e1(ssget pt))
  C  U- m2 p8 M* m8 \  (setq e2 (entget (ssname e1 0)))
3 d/ `3 _3 _2 ~  n: o" t" N# u* ~  (setq blname (cdr(assoc 2 e2)))
6 @& H) s" s: U( E7 K" P  (setq oer *error* *error* err2)(command ".insert" blname))
+ A8 b7 u9 R& A# z8 c6 [
: Q7 H% q1 e# ?1 d(defun c:II ()
- l9 ~$ X0 e4 I" W- o7 u: X2 w    (setvar "cmdecho" 0)9 t" K1 I; @$ T* k) M4 ~9 o
    (setq olderr *error* *error* myerror)
4 j* d- g4 x8 U3 H    (prompt "\nSelect objects: ")7 u0 ^7 s% j; `$ A3 u
    (command "select" "au" pause)
* V2 Z! g& p, j, ?4 S% e2 l" }    (setq sstxt (ssget "p")
! N8 v4 y* H" y          sslen (sslength sstxt)
1 A6 z1 D: L$ y% h1 o3 w8 J- E          ctr 0# P+ ~3 B( t+ X  }& Z( v* t/ v
    )7 A* s! e3 s. d& n( l8 R  Y. C8 _: S
    (command ".undo" "mark")+ y1 p0 S" o- Y9 g- G) |
    (while (< ctr sslen)
% T% {* |( a9 a( E7 U4 w           (setq listxt (entget (ssname sstxt ctr))  K+ B4 a  f9 M% d' `
                 txttxt (cdr (assoc 1 listxt))
: K% c, @- s3 ?  I  P                 enttxt (cdr (assoc 0 listxt))  K, k5 _- J( T
           )4 v$ Z7 W# P3 H/ m
           (if (= enttxt "TEXT")5 t- l3 L' A9 t, H- G
               (progn4 ^* H4 h0 ?+ D* ]
                   (setq testxt (substr txttxt 1 3))
. e4 c3 y) ?* I                   (if (or (= testxt "%%C") (= testxt "%%C"))
/ y7 a8 m" u" b4 ?) G$ I                       (setq newtxt (substr txttxt 4))  @8 F3 Q% U4 R
                       (setq newtxt (strcat "%%C" txttxt)), A& w* s  k4 b) ]: o
                   )
# v- x. @( w' m4 S$ x, }                   (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))
! \4 C9 [" y* Z                   (entmod listxt)
) z; A1 L) G( b$ T- h! \                )6 Q9 G9 C  x6 b) G1 Z/ t
            )
8 B& W9 w" o, \/ g$ _2 `            (setq ctr (1+ ctr))( C0 g8 `2 p6 K# k' \
    )" j. H' a# q4 l6 o* l
    (setq *error* olderr)
5 ~: l# Q9 M, Y" \7 l0 m    (setvar "cmdecho" 1)
) U: d' L+ ]& D( k+ v    (princ)
3 ?/ a; E, s3 @' u* {)+ _; O4 D% G: B& f/ }
) N5 }. {  {4 K, ?, j
(defun cG ()% ?6 h3 I- R% t( w; n4 H
    (setvar "cmdecho" 0)- e9 Q0 c+ D' i* n  M3 P
    (setq olderr *error* *error* myerror)
* \/ j3 L( @  H! W& i    (prompt "\nSelect objects: ")
2 V2 d) v0 d5 P. v    (command "select" "au" pause)) ^. U* E& ]* S1 \
    (setq sstxt (ssget "p")
1 o! F8 M! G+ A: s% d% c! Q          sslen (sslength sstxt)8 ]5 z3 v5 y  W: W) d7 f" P7 X
          ctr 0
/ V; P2 d% R# f3 P    )
. _8 M4 Y, y; z3 b  o2 z+ B    (command ".undo" "mark")
9 H; P, a# d' H9 o8 s0 |+ H- N    (while (< ctr sslen)
5 E2 k: @( j+ P" @; G           (setq listxt (entget (ssname sstxt ctr))
: J5 {& q$ c$ G* d+ O8 Q# g0 e                 txttxt (cdr (assoc 1 listxt))3 b% o7 V0 @% y1 Y7 O6 V# |
                 enttxt (cdr (assoc 0 listxt))7 ?4 Q' O) u/ ?
           )
/ t1 j/ t0 h! y& b. L% P           (if (= enttxt "TEXT")' E+ I  u. m6 C8 o
               (progn
* {1 P+ D; L0 @( b# Y                   (setq testxt (substr txttxt 1 3))
0 V' B7 T! g( G# b8 b& Z# I                   (if (or (= testxt "%%d") (= testxt "%%d"))1 w* c/ ]/ J9 J2 T% s2 s" i
                       (setq newtxt (substr txttxt 4))$ T/ ?, l, i5 H9 F0 o
                       (setq newtxt (strcat txttxt "%%dC" ))
/ h9 u3 f( G, D+ l9 `2 f' Z+ J                   )" f: z2 R; i3 ~" q( `% n8 [
                   (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))
- F. e# ]; G) m6 x                   (entmod listxt)
; I8 x3 ~( ]& }                )0 w6 @8 w# g: v+ a$ W5 Y* O
            )( C! y3 ]% O; W( X0 ]4 w! t7 i+ P
            (setq ctr (1+ ctr))) n8 F2 t) q: V6 e9 P9 U
    )
6 T& g: w4 {8 N+ k    (setq *error* olderr)
4 v/ Z" b; t/ @$ P8 X    (setvar "cmdecho" 1)  J1 h! I" T8 b- g
    (princ)1 f$ T' p* \0 @1 n3 ~
)1 r% H2 d; M6 S3 Q" N' m- _( C
$ T% S8 d& P* {; X* T
(defun cI ()
5 S+ ^2 F9 r) e4 @    (setvar "cmdecho" 0)9 S4 L1 B8 A  Z. I4 W5 X& m
    (setq olderr *error* *error* myerror)
: l! n' j; J# b( S9 l8 Z  H    (prompt "\nSelect objects: ")
( [6 k. S$ t( n# Q    (command "select" "au" pause)4 V9 W$ B5 @+ w( ~
    (setq sstxt (ssget "p"). C1 J. l3 u& _$ j9 Q  T
          sslen (sslength sstxt)
7 ^/ z* o$ m) j  L% C4 v; t          ctr 0
" x+ W7 }9 ]9 X) K    )
5 }0 h# U& M! e8 X    (command ".undo" "mark")
6 a+ m1 `" p6 k$ {    (while (< ctr sslen)
# M' C* N0 m1 G, Z" Z           (setq listxt (entget (ssname sstxt ctr))
6 E$ o! h4 e+ d3 [                 txttxt (cdr (assoc 1 listxt))5 n& M2 w+ p% T, t8 ^
                 enttxt (cdr (assoc 0 listxt))
7 f  z) o9 ?; q$ T           ), u3 t3 {' q; v; @- D
           (if (= enttxt "TEXT")
, ?) R1 @6 ]- g; v7 G7 d; d5 b               (progn) X+ j3 Y( e8 I) _8 t
                   (setq testxt (substr txttxt 1 3))
! B" [" h  O3 G! t                   (if (or (= testxt "%%p") (= testxt "%%p"))
3 V% R) S  H7 k2 x1 k% f                       (setq newtxt (substr txttxt 4))
( e6 g2 v2 x+ @+ l9 K$ `5 d                       (setq newtxt (strcat "%%p" txttxt))
4 N% |* y) F, w% B! V                   ); K: C& o# D3 v0 d, q8 B
                   (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))5 \, t+ G4 Y4 w, O5 E2 M& T
                   (entmod listxt)1 \" c7 g5 z- C% o
                )$ q, I5 W. [1 C
            )2 Y$ m  ~- v" e% a" I
            (setq ctr (1+ ctr))
! t1 Y9 ?0 r3 g$ r. F% F    )
& o' u6 i# z2 A( E6 g3 J    (setq *error* olderr)
" ]) g( l( q% M' N3 @& b    (setvar "cmdecho" 1)
6 ?- [  v# l0 b, T3 @    (princ)0 w9 a; E8 ]- s& o/ ^* ?% v2 g
)
! C* k* y) {5 x* y* G/ f" B( E
  \, _" f; p  d) s(Defun c:CB (/ a)
4 k' J6 O, b$ X" E   (setq olderr *error* *error* myerror). s' D0 P( ]6 R& a& a
   (setq ocmd (getvar "cmdecho"))
- A! e8 @* `- G4 o! H   (setq oblp (getvar "blipmode"))
* f  Q3 Z9 c  K3 r' [8 G( s   (setvar "cmdecho" 0)
' \5 }/ K# {) N6 c+ @$ Y! N+ E   (setq a (ssget))
5 d0 l3 m! ]6 p* |( D+ T   (command "CHPROP" a "" "C" "bylayer" "")* F5 e+ T. ]" s# {
   (setvar "cmdecho" ocmd)
. V6 ~9 Z1 u$ d   (setvar "blipmode" oblp)' |: V& D- h/ @7 J7 S' x7 ?! u
   (setq *error* olderr), p+ ^+ v1 X! m6 x  L, y
   (princ); \. h  Y# M/ b6 u
)
0 D/ {3 z% N, `0 J  j4 B0 s% A: F- f8 R- b: Y5 G' T
(defun cCC (/ co43 obj23 la23)
# ?# V! D( ?% r! E8 u" a5 I7 B   (setvar "cmdecho" 0)3 o5 M! \$ ?  {2 Z2 N4 j/ U
   (setq co43 (getstring "\nNew color : "))0 Q' K' @. @. z. X  H( G3 V$ m
   (setq obj23 (car (entsel "\nPick object on desired layer: ")))
3 b1 n8 T. M* ?: u0 |2 v   (if obj23 (progn8 M' o1 M* _* v% b9 F7 x- ]
             (setq obj23 (entget obj23))' L9 {+ \3 R% K$ R0 D
             (setq la23 (cdr (assoc 8 obj23))), }8 N: S! a" D$ s' W. `# W
             (command "layer" "c" co43 la23 "")
  {( c  Y* S% M* |4 r9 r          )3 j$ G2 }% f& O" ^7 c% g  o
    ). b( K! ]  C5 l
   (prompt (strcat  "\nLayer has changed..." la23))
' O; c7 @; E! o: S  n   (setvar "cmdecho" 1): j1 @" A" G! s* L. S+ N
   (princ), K) L, x8 c* q6 U6 E# I1 J
)  
5 y. h( i, J% j+ J6 t* h  w0 t4 [, o! x' L/ I9 u  M
(Defun c:RP (/ a)
: y) ^: Z% u5 N+ u) C' A   (setq olderr *error* *error* myerror)7 q! _8 H6 Q7 u
   (setq ocmd (getvar "cmdecho"))7 h/ ]% [& m' q, S" A
   (setq oblp (getvar "blipmode"))' ?0 m, O5 j7 b* e6 N% ~
   (setvar "cmdecho" 0)
7 Y: I# L, c. }2 M   (prompt (strcat "\nUSE: Delete object(s) belonging to"
4 z( s: j! e6 p% @; T! M                   " the layer of the entity picked...!"))9 D% |) @" J& j# u
   (setq a (entsel "\nPick the entity with the desired layer to delete: "))
0 t- g0 N5 q) E4 M6 L   (if (/= a nil)
8 W  @2 |7 q8 p5 c" C# A      (progn (setq a (cdr (assoc 8 (entget (car a )))))& G4 Z: O8 ~! r' z
      (command "Erase" (ssget "x" (cons (cons 8 (eval a)) tempword)) ""))0 E- j! |" _0 x5 |/ ~
      (prompt "\nNo entity selected!"))7 ]+ _" ^/ |7 d
   (setvar "cmdecho" ocmd)
: m% O- C# U3 [9 w3 F; l: a7 {   (setvar "blipmode" oblp)
4 v! A  M3 G% J/ z- e4 E   (setq *error* olderr)
# S2 n# I- ]2 `. v5 u8 d* ^0 j   (princ)
, w2 A* ]. J. F2 A' o5 o# O)
, f; Y8 O2 e0 U8 b' U* r! d7 ]" L$ w( U, I2 w/ g' t
(DEFUN C:WL(/ SSET NET SSL M)
% c+ }7 h) s0 d" B# U8 @   (PRINC "\nSelect lines :")
0 ~' y6 D: D6 w+ P   (SETQ SSET (SSGET)), g0 y% i7 p- F+ V+ }6 \6 j
   (IF (/= NIL SSET) (PROGN' J3 V5 q, Y9 k% N& K
   (SETQ SSL (SSLENGTH SSET))
6 i$ p" A9 v" K7 r   (INITGET 4)
; p- D$ J! G0 l* h; A; V   (SETQ NET (GETREAL "New width : ")); P. o1 |0 Q- _
   (IF (/= NIL NET)2 a, m4 d8 V; W8 {
    (WHILE (> SSL 0)
- ]- u$ g, X2 [( c( P3 b/ G5 I      (SETQ M (SSNAME SSET (SETQ SSL (- SSL 1)) ))1 I0 i; l0 |% B* `8 Y+ U8 @
      (IF (= (CDR (ASSOC '0 (ENTGET M))) "LINE") . u2 C& i) C5 S8 o& x. m- l
          (COMMAND "EDIT" M "Y" "W" NET "") ' e, c  H$ O: |$ S% N
      )
' T; X2 w; i. }$ L1 U    ) 3 y0 c% i( a; u* y9 V' u5 L
   )))
' G: \: f% F3 F# k- U* \7 e   (PRINC)1 D  J  h% B4 \! O5 F( |& n; J3 p
)% j( P5 Z  j) |

, r. i; z3 C+ }(defun C:MML ()# a% C( ~( N. `% ^( G# e1 o
  (princ "\nSelect objects to move to another Layer.")
. \) I3 H4 C+ r0 E  (setq ss (ssget))
4 h! I& S3 X- {1 e' _1 P( ?, Q  (SETQ UL1(GETSTRING "\nLayer to move entities to : "))
: V( L; b3 X+ ^  (setq counter 0), \; q5 ]6 G0 l% N7 w2 q$ l  l: |$ }* M
  (prompt "Moving to layer.....")(princ ul1)
# P) Y5 ^( |1 z, x' z6 W  (setq e (ssname ss counter))
) F8 D( G4 u) G6 W& X3 z! Q  (setq l (cdr (assoc 8 (entget e))))# m# _" K) _/ p- C
  (setq S (ssget "X" (list (cons 8 l))))
8 g4 M7 H- g0 K1 C% W- C9 x  (command "CHANGE" ss "" "" "LA" UL1 "")! X% v! i! z( Z
  (setq counter (+ counter 1))
- O3 m: |' B1 B. ^; K, U0 ](princ)
. Z& l4 O2 [& S/ e$ n4 \2 S) G)
+ a6 U4 w' Q$ a# S% S6 c
) E9 i5 Q% O& Q! Z% m;;; ================================ GHI CHU ============================
. S' w9 c0 S% V" s0 x+ w' T;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========% u3 J6 g; {, L3 }! X( B3 u" A8 i, u
;;; =======================Thuong Dung Font Romant.vnh===================. ?  r8 a6 n- X" z8 Z' @/ ]7 a' E
;;;==================== Tran Ngoc Thang - Sinh 03-05-1976================2 n- T6 y& @  d2 a0 K; W2 V
( Y0 s' T+ q4 q* O* r
(defun c:RS (/ pta ptb ptc ptd X Y X1 Y1 rmsz pl1)1 {6 p, V  y' N
  (setq oer *error* *error* err2)
; y5 i" G+ O; y+ J. I  (PROMPT "\n(VNI-TTF)(D)ining room. (S)torage. c(L)oset. (C)onference. (O)ffice. (K)itchen. (B)ath. (M)aster Bedroom. ")
7 w: B3 k3 \# p# k: l1 }- @  (SETQ Cpt(GETSTRING "\n (RomanT.vnh)(DD).(SS).(LL).(CC).(OW).(KK).(BB).(MM). (Vni-SHX)(oD).(oS).(oL).(oC).(oww).(oK).(oB).(oM)."))
; _# ]8 F2 h1 E! L  (IF(OR(= Cpt "K")(= cpt "k"))(SETQ CPT ' "Nhaø Beáp"))0 d1 l+ S3 T4 l% k( h# ?
  (IF(OR(= cpt "B")(= cpt "b"))(SETQ CPT ' "Phoøng Veä Sinh"))
; f0 M  A1 u% {. g  (IF(OR(= cpt "C")(= cpt "c"))(SETQ CPT ' "Phoøng Hoïp"))
9 ^8 C/ `5 t0 x  (IF(OR(= cpt "O")(= cpt "o"))(SETQ CPT ' "Phoøng Laøm Vieäc"))
, X) U) U& }7 f, t) L: }8 F" t  (IF(OR(= cpt "M")(= cpt "m"))(SETQ CPT ' "Phoøng Nguû"))
7 X3 t: J/ d* |( N* Y" o/ O( D  (IF(OR(= cpt "D")(= cpt "d"))(SETQ CPT ' "Phoøng Beáp + AÊn"))
+ c7 ^; B, I  _) Y- a$ H  (IF(OR(= cpt "S")(= cpt "s"))(SETQ CPT ' "Nhaø Kho"))
3 R4 y+ C$ Y3 F4 c/ t3 r" |  (IF(OR(= cpt "L")(= cpt "l"))(SETQ CPT ' "Phoøng Ñeå Ñoà")); ~" {. o2 X( F2 h. _/ M2 W

2 ^* h! a- M+ p1 y/ ]1 P% T  (IF(OR(= Cpt "KK")(= cpt "kk"))(SETQ CPT ' "Nhµ BÕp"))9 b% {  k- E4 \) |3 Q/ A) h
  (IF(OR(= cpt "BB")(= cpt "bb"))(SETQ CPT ' "Phßng VÖ Sinh"))
' O" e1 f$ n; O6 q0 X: ]0 @  (IF(OR(= cpt "CC")(= cpt "cc"))(SETQ CPT ' "Phßng Häp"))
' Z  }% Q* E# m  (IF(OR(= cpt "OW")(= cpt "ow"))(SETQ CPT ' "Phßng Lµm ViÖc"))5 J7 |% A) j  ?: ?; Z
  (IF(OR(= cpt "MM")(= cpt "mm"))(SETQ CPT ' "Phßng Ngñ"))
' C8 G) M" C7 [% p" T) N! a  (IF(OR(= cpt "DD")(= cpt "dd"))(SETQ CPT ' "Phßng BÕp-¡n"))8 g. k" |. I5 ~( Q8 k9 @# B
  (IF(OR(= cpt "SS")(= cpt "ss"))(SETQ CPT ' "Nhµ Kho"))
+ O; ~- I/ Z8 [0 x  (IF(OR(= cpt "LL")(= cpt "ll"))(SETQ CPT ' "Phßng §Ó §å"))
8 J# B: `# ]/ V' w7 `5 C' e
0 A' Q% Z4 `! c5 E% K  (IF(OR(= Cpt "oK")(= cpt "ok"))(SETQ CPT '"NHA/F BE/M/SP"))
3 d2 d, t2 ~$ K1 B5 h. a  (IF(OR(= cpt "oB")(= cpt "ob"))(SETQ CPT '"PHO/F/NG TA/W/SM"))2 J, @; m% \% n  w. l  d
  (IF(OR(= cpt "oC")(= cpt "oc"))(SETQ CPT '"PHO/FNG HO/JP"))* S0 C3 Q" C  ?2 i/ ^
  (IF(OR(= cpt "oww")(= cpt "oww"))(SETQ CPT '"P.LA/FM VI/E/M/JC"))
4 S$ F7 e/ M: q  Z7 Z- g: z3 {& R) _  (IF(OR(= cpt "oM")(= cpt "om"))(SETQ CPT '"PHO/FNG NGU/R"))
- |- L6 J9 }* D$ h5 t/ x' R  (IF(OR(= cpt "oD")(= cpt "od"))(SETQ CPT '"PHO/FNG A/WN"))  x: ?9 Z4 ^  D) W& K; ~
  (IF(OR(= cpt "oS")(= cpt "os"))(SETQ CPT '"NHA/F KHO"))
$ d7 I  m: e5 E( `% s+ a  (IF(OR(= cpt "oL")(= cpt "ol"))(SETQ CPT '"PHO/FNG /DO/M/F"))$ j1 g* ^# X) c5 A- ?/ h# \
(setq pta (getpoint
# a& |- J$ I# G* F* W    "\nPick first corner. : "))
3 H! s2 D, {- \5 h! \8 P2 F- I4 t  (setq ptb (getcorner pta! D1 b& a9 ?- o" k8 y
    "\nPick second corner. : "))6 i6 M9 [4 m- \" y
  (setq ptc (list (car ptb)(cadr pta)))
4 C  d8 w. {/ N  (setq ptd (list (car pta)(cadr ptb)))! a, b: u% V9 D5 I6 l" c2 p
  (setq ang (angle pta ptb))
' l) A7 K% N& o$ p* ?  t& Q+ `  (setq d1 (/(distance pta ptb) 2))( s5 X3 e( j4 z' B6 j' ^4 I1 N0 ^
  (setq cp (polar pta (- ang (dtr 0)) d1))& m8 h4 N* D/ Z5 ^$ j' n. {
  (setq X (distance pta ptc))
' K! C) j3 m" C* p+ K  (setq Y (distance pta ptd))! B. m) P0 q8 U3 d  g4 @1 L" ]# b0 B& A
  (setq X1 (rtos x 2 1))- b* X  h3 Z3 N3 f. P& S, p$ s8 _
  (setq Y1 (rtos y 2 1))
$ [" k2 R8 s) I3 N# s! d# x  (setq rmsz (strcat "(" X1 " x " Y1 ")"))
/ z2 q: |. p1 c2 a2 S( ?. s  (command "TEXT" "c" cp "0" CPT "ROMANT-TEXT" "" rmsz))/ J1 Y0 C+ t* d" G
  (defun dtr (angg). r7 r. I/ r- M/ }' v- @" N& V  S
  (* pi (/ angg 180.0)))
/ K. `6 V9 K# ]1 v; Q) c" G: V" R' q2 v* s
(defun c:ZS (/ pta ptb rmsz pl1)
% d3 g# E1 W! Y: Z/ n; }2 k  (setq oer *error* *error* err2)6 |8 o6 V$ W8 R2 t. v; t
  (PROMPT "\n (Vni-SHX-TTF)floorp(L)(oL)an.(E)(oE)levation.(S)(oS)ection.(M)(oM)planFoundation.(C)(oC)Found.(K)(oK)Khung.(P)(oP)View3D.")
3 k$ K2 o5 j# Y9 z8 d  (SETQ Cpt(GETSTRING "\n (RomanT.Vnh)(LL)floorplan.(EE)elevation.(SS)section.(BM)planFoundation.(CM)foundation.(KC)Structure.(PP)perspective."))
3 p% o9 M  u4 i0 p" F# N4 j
3 M% B9 a7 `  n. B+ d  (IF(OR(= Cpt "LL")(= cpt "ll"))(SETQ CPT ' "MÆt B»ng TÇng 1 : TØ LÖ - 1:100"))  ]. a  n7 ], o: |4 m
  (IF(OR(= cpt "EE")(= cpt "ee"))(SETQ CPT ' "MÆt §øng Trôc ?-? : TØ LÖ - 1:100"))
0 j' u; R/ H0 U5 A  (IF(OR(= cpt "SS")(= cpt "ss"))(SETQ CPT ' "MÆt C¾t A-A : TØ LÖ - 1:100"))1 S. E- R9 b3 R' h+ U( M. j1 w
  (IF(OR(= cpt "BM")(= cpt "bm"))(SETQ CPT ' "MÆt B»ng Mãng : TØ LÖ - 1 : 100"))
: y3 Y7 C: q7 I# r: v" ]  (IF(OR(= cpt "CM")(= cpt "cm"))(SETQ CPT ' "MÆt C¾t Mãng : TØ LÖ - 1 : 100"))2 _: P2 \5 v5 _/ m* _
  (IF(OR(= cpt "KC")(= cpt "kc"))(SETQ CPT ' "KÕt CÊu Khung Däc Nhµ : TØ LÖ - 1 : 100"))
$ f- y" y# B! [) i, |3 e" S$ U  (IF(OR(= cpt "PP")(= cpt "pp"))(SETQ CPT ' "Phèi C¶nh Mét Gãc Nh×n"))) B' W2 V2 \0 K0 j; j/ g

( V/ Y4 }8 @- b9 }7 k( u# g- U# k  (IF(OR(= Cpt "oL")(= cpt "ol"))(SETQ CPT ' "MAËT BAÈNG TAÀNG 1 : TÆ LEÄ - 1:100"))
5 H' [" x% `# g# T  (IF(OR(= cpt "oE")(= cpt "oe"))(SETQ CPT ' "MAËT ÑÖÙNG TRUÏC ?-? : TÆ LEÄ - 1:100"))
" {1 q, Q4 {0 m* e- W  (IF(OR(= cpt "oS")(= cpt "os"))(SETQ CPT ' "MAËT CAÉT A-A : TÆ LEÄ - 1:100"))  b' n2 l% X4 c
  (IF(OR(= cpt "oM")(= cpt "om"))(SETQ CPT ' "MAËT BAÈNG MOÙNG : TÆ LEÄ - 1 : 100"))" S2 V- L, o7 R( I# E8 C3 ^
  (IF(OR(= cpt "oC")(= cpt "oc"))(SETQ CPT ' "MAËT CAÉT MOÙNG : TÆ LEÄ - 1 : 100"))
* G* |% l5 }9 @5 g" T$ A% R% ]  (IF(OR(= cpt "oK")(= cpt "ok"))(SETQ CPT ' "KEÁT CAÁU KHUNG DOÏC NHAØ : TÆ LEÄ - 1 : 100"))! W2 ?3 b, `- @& U
  (IF(OR(= cpt "oP")(= cpt "op"))(SETQ CPT ' "PHOÁI CAÛNH MOÄT GOÙC NHÌN"))
: f. p$ m1 ]2 O) m+ G1 r: A7 ]  k* Y: b
  (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"))
3 ^& }: k3 ^# m0 w& Y$ R8 l8 f9 y  (IF(OR(= cpt "E")(= cpt "e"))(SETQ CPT '"MA/W/JT /D/}/SNG TRU/JC ?-? : TI/R LE/M/J - 1:100"))
- }7 N' U) ^7 y: l  (IF(OR(= cpt "S")(= cpt "s"))(SETQ CPT '"MA/W/JT CA/W/ST A-A TI/R : LE/M/J - 1:100")): P, B' A; b* `! v& Y. A, \
  (IF(OR(= Cpt "M")(= cpt "m"))(SETQ CPT '"MA/W/JT BA/W/FNG MO/SNG : TI/R LE/M/J - 1:100"))$ D+ v: T" k. K; C6 c
  (IF(OR(= Cpt "C")(= cpt "c"))(SETQ CPT '"MA/W/JT CA/W/ST MO/SNG : TI/R LE/M/J - 1:100"))5 u) X4 H# t: R9 e
  (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")). q- e- z9 m2 V3 H2 U
  (IF(OR(= cpt "P")(= cpt "p"))(SETQ CPT '"PHO/M/SI CA/R/NH MO/M/JT GO/SC NHI/FN"))+ R2 N. w9 t, N0 N( a/ O
(setq pta (getpoint7 {* a# b; x( R3 R/ a
    "\nPick first corner. : "))
: A2 f) Y) k* D0 g, r  (setq ptb (getcorner pta, l. Q5 K: p4 j1 ]- |) W# A
    "\nPick second corner. : "))( N9 e2 _6 _2 I6 S
  (setq ptc (list (car ptb)(cadr pta)))- [' m; i7 B0 U
  (setq ptd (list (car pta)(cadr ptb)))
# @" Z1 p$ k- ]" v# L! X' b% Z  (setq ang (angle pta ptb))1 }9 P9 D+ r+ n( m' D
  (setq d1 (/(distance pta ptb) 2))+ x1 ~8 l9 b2 n+ q
  (setq cp (polar pta (- ang (dtr 0)) d1)). Q) N) c! P$ J( m
  (command "TEXT" "c" cp "0" CPT "ROMANT-TEXT" "" rmsz))
/ m% Y' ]7 S& P( C. O* J  (defun dtr (angg)/ a- N: U+ k3 ?  t" [
  (* pi (/ angg 180.0))), ^$ w: }& t2 @  c6 Q& W. e" d! G
5 E. c3 y& P* b
;;; ================================ GHI CHU ============================5 o; [, m" ^* x' J
;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========
/ P' g3 S, [% o) ~) r;;; =======================Thuong Dung Font Romant.vnh===================) f: m5 U; X3 u
;;;==================== Tran Ngoc Thang - Sinh 03-05-1976================
& W( B8 }. o: b/ x& Q; N# p+ S0 d7 j  ~5 [* V
(defun c:RRS (/ pta ptb ptc ptd X Y X1 Y1 rmsz pl1)1 }$ |  K6 S# L' T
  (setq oer *error* *error* err2)
* w6 B. C4 j$ R+ ?4 u) `1 Z  (PROMPT "\n(Vni-SHX-TTF)(oD)(D)ining room. (oS)(S)torage. c(oL)(L)oset. (oC)(C)onference. (oWW)(O)ffice. (oK)(K)itchen. (oB)(B)ath. "); J+ {, E4 T/ N7 k- |; i% L" U
  (SETQ Cpt(GETSTRING "\n(RomanT.Vnh)(M)aster Bedroom. (DD). (SS). (LL). (CC). (OO). (KK). (BB). (MM). "))
# ?7 I' N0 T2 w' i: `  (IF(OR(= Cpt "K")(= cpt "k"))(SETQ CPT ' "Nhaø Beáp"))
" o) T4 R; q  ?( S7 F2 F  (IF(OR(= cpt "B")(= cpt "b"))(SETQ CPT ' "Phoøng Veä Sinh"))
  V2 r, D1 B% }9 u  (IF(OR(= cpt "C")(= cpt "c"))(SETQ CPT ' "Phoøng Hoïp"))8 {1 l+ z3 u+ a3 T
  (IF(OR(= cpt "O")(= cpt "o"))(SETQ CPT ' "Phoøng Laøm Vieäc"))  E- J3 s6 j* s
  (IF(OR(= cpt "M")(= cpt "m"))(SETQ CPT ' "Phoøng Nguû"))
. v: @3 i8 ~7 A3 h# l1 B  p  (IF(OR(= cpt "D")(= cpt "d"))(SETQ CPT ' "Phoøng Beáp + AÊn")): n+ S% w- ]; O# M- a9 W: _0 _- t
  (IF(OR(= cpt "S")(= cpt "s"))(SETQ CPT ' "Nhaø Kho"))
3 O4 N/ P6 e& R0 J+ n0 [, T) R  (IF(OR(= cpt "L")(= cpt "l"))(SETQ CPT ' "Phoøng Ñeå Ñoà"))8 S0 }) ]' o. D. {) h- w2 ~
: C8 [& k. ]& N/ ]4 U; W* w
  (IF(OR(= Cpt "KK")(= cpt "kk"))(SETQ CPT ' "Nhµ BÕp"))
  v- d5 Z; L; c; \! E; _' G/ a  (IF(OR(= cpt "BB")(= cpt "bb"))(SETQ CPT ' "Phßng VÖ Sinh"))6 C! [3 e$ o! ~6 @# M: j, @
  (IF(OR(= cpt "CC")(= cpt "cc"))(SETQ CPT ' "Phßng Häp"))
1 ^4 k4 V# w7 Z1 d& A  (IF(OR(= cpt "OO")(= cpt "oo"))(SETQ CPT ' "Phßng Lµm ViÖc"))
0 _  R& P/ r0 T. U  (IF(OR(= cpt "MM")(= cpt "mm"))(SETQ CPT ' "Phßng Ngñ"))
* P+ K8 p$ r8 a& }2 S% ~% K) i3 d  (IF(OR(= cpt "DD")(= cpt "dd"))(SETQ CPT ' "Phßng BÕp-¡n"))3 v- z/ D5 I: s7 h$ y* \8 Y* U* |
  (IF(OR(= cpt "SS")(= cpt "ss"))(SETQ CPT ' "Nhµ Kho"))( V9 {5 V8 g, S4 U$ c, v" h) y. f( m5 C
  (IF(OR(= cpt "LL")(= cpt "ll"))(SETQ CPT ' "Phßng §Ó §å"))
! Z- i4 I1 ~* V4 }, b* h  S0 f, u: j% |
  (IF(OR(= Cpt "oK")(= cpt "ok"))(SETQ CPT '"NHA/F BE/M/SP"))
  _, T( p  E* R. k7 o7 c  (IF(OR(= cpt "oB")(= cpt "ob"))(SETQ CPT '"PHO/F/NG TA/W/SM"))
9 B$ @; @( R, Q1 j0 R  (IF(OR(= cpt "oC")(= cpt "oc"))(SETQ CPT '"PHO/FNG HO/JP"))) x8 p  q( h% x' o* u" b, X/ R
  (IF(OR(= cpt "oww")(= cpt "oww"))(SETQ CPT '"P.LA/FM VI/E/M/JC"))
5 A# w" R9 }# a/ H  i  (IF(OR(= cpt "oM")(= cpt "om"))(SETQ CPT '"PHO/FNG NGU/R"))6 _/ V2 a  `. j- l) y
  (IF(OR(= cpt "oD")(= cpt "od"))(SETQ CPT '"PHO/FNG A/WN"))
$ w$ Z/ ~3 N( m& A, i* ]  (IF(OR(= cpt "oS")(= cpt "os"))(SETQ CPT '"NHA/F KHO"))7 }( [' D' |6 d" C) {$ Q9 E
  (IF(OR(= cpt "oL")(= cpt "ol"))(SETQ CPT '"PHO/FNG /DO/M/F"))
3 Q+ G0 R  f' Q+ e
( T5 {+ Y2 N8 x0 ~& ~% } (setq pta (getpoint
8 q$ D6 r9 f" p/ o    "\nPick first corner. : "))
: o/ g0 d% m7 ?9 W  (setq ptb (getcorner pta
, Z. _- A2 Q2 _! [) d  U    "\nPick second corner. : "))
- A0 V9 U! ^. y! b  (setq ptc (list (car ptb)(cadr pta)))8 K6 D3 J' m$ y6 N9 D0 `
  (setq ptd (list (car pta)(cadr ptb)))
; Z9 `1 \2 y' c1 j  (setq ang (angle pta ptb))
8 O/ K; @* Z! @! X! k+ _  (setq d1 (/(distance pta ptb) 2))6 g) u5 C. E* v. I+ }$ z
  (setq cp (polar pta (- ang (dtr 0)) d1))+ B# B- A: Q7 h$ t7 n! T
  (setq X (distance pta ptc))4 F1 |3 h  [/ x* N7 e( }
  (setq Y (distance pta ptd)). {! B' n4 Y6 A* F* u7 p0 r; W
  (setq X1 (rtos x 2 1))
2 k2 J5 M1 F( F4 Z6 K  (setq Y1 (rtos y 2 1))
1 Z- b$ H" C! C  (setq rmsz (strcat "(" X1 " x " Y1 ")"))
. g  H9 [1 B% h% a+ L+ L. H: k  (command "TEXT" "c" cp "0" CPT "text" "" rmsz))
" y- _$ H' N* ?/ q  (defun dtr (angg)3 T, a8 @' K5 Z! w7 ?2 [1 ~
  (* pi (/ angg 180.0)))
+ K0 @) F% k, N, \4 I9 `7 g# C* k6 S
;;; ================================ GHI CHU ============================# @, ~+ l6 n: |+ ~; L- q
;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========
$ n% b7 r; |* m4 l" r9 }. `% n; O' r;;; =======================Thuong Dung Font Romant.vnh===================
: \8 ]7 X- S# V; ~* Y6 t
1 i. L) `0 X$ A3 s/ ]- n(defun c:GS (/ a b c d)
8 @/ X  E" Z; m& B, j7 V% e  (graphscr)
0 P+ P- K5 L- e/ B  (prompt "\nSelect text to set style....")
0 k* P9 A# u5 g3 k  (setq a (entsel))) E/ t, j' D- a; Q# G# h7 F' j5 F7 z  d
  (setq b (entget (car a)))
! f7 _$ j3 W+ C2 {! M  (setq c (cdr (assoc 7 b)))
* a! @% @9 C# z  (setq d (cdr (assoc 40 b)))
4 y8 @1 r* n& @# e* W- I  ^6 ~  (command "style" c "" d "" "" "" ""))
* x. n# ?+ c2 n4 v2 U  (princ "\nType GS to set text style.")
2 `6 y, X9 |$ Z5 U% L) X- p& A9 t2 P0 u+ G( y' X
(defun c:RC (/ olderr ocmd oblp pt1 pt2 pt3 pt4 l w)
+ S! z5 E  v! B# G3 c  (setq olderr *error* *error* myerror)) H5 Z5 s" s/ I  q4 h' w$ ^+ ~
  (setq ocmd (getvar "cmdecho"))5 W/ w" L4 P( j; O  Z2 ?
  (setq oblp (getvar "blipmode"))! h, K! l- p; y9 @0 l
  (setvar "cmdecho" 0)! f4 [1 F& ^1 j
  (initget 1)                         ;3D point can't be null- y- G" ]' E/ T8 ]
  (Setq pt1 (getpoint (strcat "\nCorner of rectangle or square: ")))1 T+ y7 ]9 x3 ~: ^
  (setvar "ORTHOMODE" 1)
9 g/ ^, Q% y( A: ?% G  (initget 7)                         ;Length can't be 0, neg, or null
  P! ?" C2 ~9 B  (Setq l (getdist pt1 "\nLength: "))
+ x# m" B/ |' k& N7 J  (Setq pt2 (list (+ (car pt1) l) (cadr pt1) (caddr pt1)))+ ]4 c$ V6 l4 y" b4 x
  (grdraw pt1 pt2 2)
7 B* A- x$ o5 e" R' W  (initget 7 "Square")                ;Width can't be 0, neg, or null; V+ r' |0 l8 N* l9 {
  (setq w (getdist pt1 "\nSquare/<Width>: "))2 Z: I, l, n( K( T1 J3 }" z( N
  (if (= w "Square") 4 O1 [! j: I/ S/ m7 n; ?
      (setq w l)
5 [, u1 _3 E! \  )
& v& w' r, r3 j8 G7 W, X  (setq pt3 (list (car pt2) (+ (cadr pt2) w) (caddr pt2)))
$ [* [' K# T* W( N: L$ _1 u& T  Z- e' K  (setq pt4 (list (car pt1) (+ (cadr pt1) w) (caddr pt1)))
0 {; k1 M* x/ X7 c: @: a: e+ e  (grdraw pt2 pt3 2)
7 o7 X1 V  [7 J6 O  (grdraw pt3 pt4 2)
( ~+ K+ z1 ]+ |) `) W  (grdraw pt4 pt1 2)
, a/ Q& I- p# ^  Q, X  (setvar "ORTHOMODE" 0)
/ ^9 z* p. H) C- M. U# e  (command "pline"  pt1 pt2 pt3 pt4 "close")( u0 r, ?+ v' n: h& _, O0 v. h9 ?
  (setvar "cmdecho" ocmd)
$ H. c8 |$ R8 j4 }0 A2 M# \4 u  (setvar "blipmode" oblp)! A! }. O% z8 N8 k$ N% s5 a
  (setq *error* olderr)               ; Restore old *error* handler
) O! J9 ~: E9 h' [% Y# |" P  (princ)5 e, o0 v! @  m$ h$ U; S
)! H: k5 U+ p% u% ?0 `7 y
$ I2 |7 \: q6 d6 d' G
(defun c:SG (/ ent pt1 pt2 ang), o, D; ]: k/ T( O* }0 Y7 e+ p; n
  (setq cmd (getvar "cmdecho"))
; ?$ n0 s* w) b! N  w, t  (setvar "cmdecho" 1); w- C6 ?% [  U
  (prompt (strcat"\nSnap angle will be set to angle of line"))
3 t) l' g0 c/ O& K5 K. e  (setq ent (entget (car (entsel))))
3 |# Y( b  r! @, k. D7 p$ Z  (setq pt1 (cdr (assoc 10 ent)))4 z. D0 ?" C% \1 R
  (setq pt2 (cdr (assoc 11 ent))). J  t- i! k; z5 k
  (setq ang (angle pt1 pt2))
  ?  Q2 ]& x; [, T" t+ M  (setq ang (/ (* ang 180.0) pi))
4 g% }  X( [1 E) Y  (setvar "cmdecho" 0)3 j( I0 d% i; ]; \+ }- U5 X3 X" l
    (command "setvar" "snapang" ang)
2 _  N4 m$ a6 d; o& q% m    (setvar "cmdecho" cmd)
# J% N/ ~. n. j) d& ])
! l5 ]7 R( u/ c" x, n/ G) q) x) O8 x9 X' a" C$ d
(defun C:TG (), @- d) w! l- e" F& n
  (initget "Increase New")
; n" n: f) W8 L, q/ q0 Q  (setq ans (getkword "Increase/<New>: "))
$ f4 g9 R0 [$ [  Q, m  _$ H  (modang)
% z$ C6 r* \; I8 Y) ^+ B: H)
& ~6 H9 n! _& g- f(defun modang (/ ang ss ca e na ssl). V8 u2 p; _( _  Q2 `0 I
(if (= ans "Increase")4 F1 R. ?. \8 g, F% A
     (princ "\nIncrease angle for text by: ")
9 \3 F2 }' v3 q5 E: n5 {, z     (princ "\nNew angle for text: ")+ u1 o* W* E+ v! T& o! ]
)
+ P8 \, `+ Z+ W. }7 e2 w7 s) K* m$ J (setq ang (getreal))
- C' z" V3 j* X) P& B0 _ (setq ang (* (/ ang 180) pi))8 l8 G4 n  F* F! F2 ]
(setq ss (ssget))
* a, v4 t" J4 q% Z: O, z, Y* h (setq ca 0 ssl (sslength ss))
, J  a) Q+ y% {; x! u3 B- q/ N2 P (while (< ca ssl)
' a$ H" V& K3 c; u3 L  (if (= "TEXT" (cdr (assoc 0 (setq e (entget (ssname ss ca))))))) D& u- W. ]: t" e4 q8 F
   (progn, V1 `: p& c* ]
    (if (= ans "Increase")  s9 S, S4 a% p2 n6 D/ y
        (setq na (cons 50 (+ (cdr (assoc 50 e)) ang)))7 \/ o. t2 W% y3 ?4 z4 R
        (setq na (cons 50 ang))
" u2 ?* r8 W- ~3 g, @    )
+ }4 u7 z$ C' h3 Q    (setq e (subst na (assoc 50 e) e))! u& L5 ~5 S. z% `- G" |6 v0 E
    (entmod e)  T) _7 u) N) j! Z
  (setq ca (1+ ca))% |& f# U* Q5 F# i1 ^4 I, F
)& I$ I9 R3 [: R
)+ X) n- j3 F' r0 Z3 t
)  ]2 c. a* l4 o' @2 P  d
(terpri)
. L3 W" S5 @& a4 k! A! _)
, \, C' P/ C6 p, C6 q" r, o& u1 K7 {0 Y$ `' h

0 B! u3 t2 r2 V  `: h2 ], z(defun c:WL ()
2 X8 Y% J' d0 i2 Y. T2 @  (setvar "cmdecho" 0)
$ O9 x3 v9 a/ S5 |' R! s+ t  (setq a 1)
! u4 N: d. i- G2 l7 K* i' d  (prompt "\nSelect Polylines to change: ")# Z/ w1 ^7 P( F! A
  (while (/= a nil)6 n# ~% Q9 v8 k  h* Z3 Z
    (progn* p; Y8 Q9 }& u: O( S
    (setq a (entsel))
. C7 n" G  d* }$ n, P8 ]    (if (/= a nil)* y) {$ q1 N6 d( Q
        (progn
8 y, b' Q" g4 _          (setq b (entget (car a)))
- [6 q8 W6 \, R) y          (setq c (cdr (assoc 40 b)))
9 h' M" i7 O& T: ^( ^- B' L9 H          (princ c)( R& r' q! H% m. Y
          (command "pedit"a"w""lw""")& p* N" _& n; f" e9 I" l
        ))))
9 K# o6 _. |" W4 v0 ~" `$ `% g  (princ)
. u! a; L* i. l. Q3 J# r)3 ~! T! M0 J, s( A7 E6 i5 s: g
0 u; q, q0 I+ N1 f* M
;;; ================================ TEXT FIT ============================
7 U. o' Z7 [: m1 i7 k9 Y0 Q  R( g: ]; k& g4 v
(Defun c:FT ( )5 R5 m" A! _' v& r( a
  (defun setsnapang (arg /) (setvar "snapang" (angtof (angtos (cdr (assoc 50 arg)) 0 8) 0 ))  )
7 w8 V  \" O/ {/ j# }( R  (Defun LL-xyz (arg) (CAR (TextBox arg))  )# Z5 S2 H* c! D. Y9 i+ c) F$ G; ]; R
  (Defun UR-x (arg) (CAADR (TextBox arg))  )) C$ p* w, W% V# h7 J% {! b6 a: a, x
  (Defun LL-y (arg)     (CADAR (TextBox arg))  )
  N; r8 R- s5 f' K( \7 n  (Defun LR-xy (arg)     (List (UR-x arg) (LL-y arg))  )
5 ]9 P" E/ O/ Z! a   (Setq ename (CAR (EntSel "\nSelect Text to stretch/shrink:"   )  )
) L, f0 l% m! a& ~3 X# l$ y; A      Textent (If ename (EntGet ename))   )   2 l/ {. m2 |" T! s% d! ?
   (If (= (CDR (Assoc 0 textent)) "TEXT")' s4 _) n3 ^% t/ B" t! Q4 q  p5 ?
      (Progn (initget 0 "Start")5 y; C% J' z1 ^; ~
         (Setq  NewEnd  (Distance  (LR-xy Textent) (LL-xyz Textent) ) )  ~5 @1 `9 n6 D& U
         (setsnapang Textent)                 ;set snap along text entity$ L8 \3 w+ r2 C% E) e0 z
         (setvar "ORTHOMODE" 1)                   ;drag along the text
7 F2 Q5 R1 K; S6 z) d6 g         (setq 2 |- E8 V  J2 d8 i
TMP (getpoint (cdr (assoc 10 Textent)) "\nStarting Point/<Pick new ending point>: ") )% A0 [4 I  Y: H" H4 i% k
         (setvar "snapang" 0)+ j$ j; `0 n7 f5 ^- y# ]
         (cond
+ ]# S+ d- |! P/ U4 E0 k/ h4 s4 t8 I5 z           ((= (type TMP) 'STR) ;;new starting point to be selected0 x: |' @! [7 X5 `: H# l
               (setq Start (getpoint "\nPick new starting point: ")), g- v# y5 r9 l$ k
               (if Start  (progn
1 h4 B; M7 g' e7 f0 G                  (command "_UCS" "_E" (cdr (assoc -1 textent)))
0 @6 [; v! h4 R* ~                  (setvar "ORTHOMODE" 1)" Z2 s" Z* S; ?( S/ y* ^0 f
                  (setq NewPt0 H7 ^+ p1 f/ A8 p
                        (if Start
5 z! ?" S( q5 F; Q          (getpoint (trans Start 0 1) " ending point: ") nil ) ), [2 \0 O: H1 w+ J; G
                  (if NewPt (setq NewPt (trans NewPt 1 0)))
  T, m' ]1 W1 o                  (setvar "ORTHOMODE" 0)
; n; Z. C/ L2 Y3 @                  (command "_UCS" "_W") ) ) )# S5 g% c1 n' V' H+ K7 ^( h, u6 h& H9 e
           ((not (null TMP))    ;;new ending point selected
' t9 z2 R2 G  W9 _  A               (setq Start (cdr (assoc 10 Textent)) NewPt TMP)  )* f- Z# g* t5 H! }% Z. A
           (t  (setq Start nil NewPt nil) ) )' C3 y1 b0 y3 ]0 d
         (if (and Start NewPt) (progn  E1 c. O3 |+ B( h5 f; n$ B
           (setq Val (Assoc 41 Textent) ;;current width factor8 B! ?4 F' x4 t* S6 g$ f
                 Val (if Val (cdr Val) 1.0)  LTC_%       4 a  H# _$ H" r. P& L7 k: o' R
          (* (/ (Distance Start NewPt) NewEnd ) Val )
" i1 ^/ w, P# N2 t: A! e% t1 p                 textent (Subst (cons 41 LTC_%)' p& I: p. y7 L7 v
           (assoc 41 textent) textent), A5 p! p5 c( B8 W# {3 V
  textent (subst (cons 10 Start) (assoc 10 textent) textent)! K& h: g+ q, S, j, l; e
  textent (subst (cons 11 NewPt) (assoc 11 textent) textent) )' G+ f* \4 w  @9 W
   (EntMod textent) (EntUpd (cdr (assoc -1 textent))))))) (Princ))7 v* A0 q, R, z% g! Y( ]

( l9 s8 H, S3 \7 N# B% W;=====================================================================
3 r8 P$ H2 K: s% A;=========================COPY + ROTATE ==============================
2 C4 V: w0 D, i8 _7 N;=====================================================================( R# [) c/ d1 M+ S
6 @' n' b3 p/ y) c' w. [6 c6 _! L+ U# M
(defun c:CR(/ olderr cm loop ss1 ss2 bp mult lent ss2 lp1 lp2)( g/ y9 ~; }  N
  (setq olderr *error*. ]; o8 U% |) `- P3 A* f- ~5 P
        *error* croerr)
) a0 h/ Z- E9 _2 x+ o- d  (setq cm (getvar "cmdecho"))# \+ s  D. A4 a0 O
  (setvar "cmdecho" 0)
8 [$ J6 |; h: }# z2 z: c  (setq loop t)+ b/ h$ F4 i8 Q7 r6 R
  (while (not (setq ss1 (ssget))))
/ Y7 @; b3 a! |2 y4 F6 b  (initget 1 "Multiple")
: x# Y% [% J0 Z6 ~( y$ K2 X  (setq bp (getpoint "\nBase point or displacement>/Multiple: "))
, Q: @: B# u) D, [  (if (= bp "Multiple")/ \4 K, d5 u  s7 A
    (progn
) b& k) C  M5 N7 K" n6 J2 @      (setq bp (getpoint "\nBase point: "))
& d! K! }5 E( {3 F. k2 J      (setq mult t)
% g! M& l; R3 e; T9 l1 c    )7 e# s' M' W5 q7 B1 V+ x
  )3 X# b  S7 ]8 I) H. T
  (while loop
* H# g; a4 O7 T, D! A: J    (setq loop mult)
+ r1 H; M. b1 \+ N( j    (setq lent (lastent))
+ C. i6 M2 @5 b3 x7 l$ V: H* f    (command ".copy" ss1 "" bp bp)
: O: J' q: c0 `    (setq ss2 (lss lent))# ?( W/ R1 m2 I7 k5 i3 }4 J$ i
    (setq lp1 (getvar "lastpoint"))
# _5 i7 m$ u/ p    (prompt "\nSecond point of displacement: ")
1 b2 z+ w6 R( i* X: o9 ]& T    (command ".move" ss2 "" bp pause)1 s1 \. |! h( @% g) c( v) `$ n* K
    (setq lp2 (getvar "lastpoint"))
8 Y8 \% m+ u, C0 p0 T    (redss ss1)5 H2 U- K0 g1 {+ n* U; p9 A# z3 ]
    (if (and (not mult)
% R# C' n. W- E             (= (distance lp1 lp2) 0)
' r5 u9 V: _6 G) _) ?        )+ n+ a/ G# B9 r# `3 \9 L
      (setq lp2 (getpoint "\nRotation Point: "))
( a' U# S! h1 B' |. n: u7 w$ ]2 [- q* t    )3 ?; |2 z2 ?, G" A
    (if mult9 N! j( u8 h0 K! U9 C' k) ]* Z
      (prompt "\nRotation angle ")
$ h6 j' S  N) k7 @0 N) d      (prompt "\nReference/<Rotation angle>: ")
( {6 B- S, \# @# ~( q  d    )6 I2 v) f6 o; t0 V; ]+ v$ m3 [
    (command ".rotate" ss2 "" lp2 pause)% R  k6 b- u, Y- i/ y
  )$ P2 c, ]# D% A2 z8 ^; g0 W7 j
  (setvar "CMDECHO" cm)
; ?' n' W; z8 W* N' c9 I  (setq *error* olderr)
  ^$ }# E3 ?; Y8 w" }- l* u9 e* ^  (princ)
; Y% N1 N$ e5 l: m8 K( |" s)% z" D6 M& T4 `) H9 b
(princ)
9 Y4 i8 z9 I/ B" y. P+ d6 i0 U(defun croerr (s)        
# @  P' R; i9 U2 A4 @' X1 [+ x9 c3 J  (if (/= s "Function cancelled")
# R* J/ g* a' w8 L* o    (princ (strcat "\nError: " s))( R1 C9 S3 Y0 |
  )
: w  P2 x) S! E- w( g1 c6 ]% u  (setq S nil); {; I+ O% f- F
  (setvar "CMDECHO" cm)  K. g) Z, A% t# I2 f" |
  (setq *error* olderr)
+ E9 l  B: x( O# P5 ^  (princ)# R- V! ]6 ~5 C* Z7 W6 ^  F7 E
)0 E3 F: t: b2 @: g
(defun lastent (/ a b)
8 T  }& o" k' B# t6 s  (if (setq a (entlast))
% ?1 F1 ^6 @: q& |( V% {% O    (while (setq b (entnext a))7 e8 z7 B3 Y& W' Y% I
      (setq a b)4 V$ O! M( p7 _0 {7 l. Q
    )2 _( ^7 `$ L9 G% v8 \% X! E
  )
" ?3 }7 a/ B# s8 M  a- C' N6 z$ ~) ]) G  w+ u
)4 l' s( J- W) \1 T) K
(defun redss (ss / en i)
) ^! I  ]4 G. T2 {" X* S! q  (setq i 0)2 R2 {$ l8 W3 Z6 }2 l( j2 X
  (while (setq en (ssname ss i))
) ?% @2 a# F' R    (redraw en 1)
; s5 V6 F' B. M$ I5 N    (setq i (1+ i))
: M+ ?: ^$ k* {% A+ y, i1 f) ~8 S; J  )
. H/ P# z. l( P# G1 Z)5 M4 {. |+ e/ r* {  x1 Q: y
(defun lss (en / sels ed)
7 L& J  s& l& z0 Z" Y+ g. Q6 ]  (setq sels (ssadd))
: @# H, _/ {. I( O( S) `; o  (while (/= en nil)4 o. u6 ^! v' g* X) w3 S
    (if (setq en (entnext en)) (setq ed (entget en)))
' g; _& c3 A8 m# b1 W8 H    (if (/= en nil) (setq sels (ssadd en sels)))) ]# Q- q) B5 m* T# M- V
    (if (or (= (cdr (assoc 0 ed)) "Polyline")5 R0 l3 f! H2 i! U! F- J% F' J
            (= (cdr (assoc 0 ed)) "Insert")
( t$ j2 a/ o* B        )
( q5 o0 p) j8 D9 n8 t- R/ ]6 Q& p      (while (/= (cdr (assoc 0 (entget (setq en (entnext en))))) "Seqend"))
* @' b; V! l' T, _( A    )
% U7 ~+ h, N7 F  ): L/ y& A! G, J. O7 M
  sels
3 s: @$ ~7 B( h+ c7 M)
  F% ]8 ]( }- H, i1 |
7 e# m/ h0 k' Z; o4 I: H$ g+ C1 n;;;; ================== CAC FUNCTIONS DUNG TRONG ACAD.LSP ==================2 v2 ?1 B6 [+ }' }; S$ M3 L
;;;==================== Tran Ngoc Thang - Sinh 03-05-1976===================2 Q6 d, l0 j+ F% V  ~- V
. {! ^  `- I# u5 R
(defun c:00 ()(princ "\nChon doi tuong net Defpoints")(ssget)(command "change" "p" "" "p" "la" "Defpoints" ""))
2 j1 P/ l; l) T# x# f(defun c:0 ()(princ "\nChon doi tuong net 0")(ssget)(command "change" "p" "" "p" "la" "0" ""))
  t% u' Q: N- ^6 d(defun c:1 ()(princ "\nChon doi tuong net COT")(ssget)(command "change" "p" "" "p" "la" "COT" ""))
) b  Z  v& `8 p8 @. `! v) U3 u' o(defun c:11 ()(princ "\nChon doi tuong net DIM")(ssget)(command "change" "p" "" "p" "la" "DIM" ""))
- C$ Y# K$ x5 \/ {( F+ A(defun c:22 ()(princ "\nChon doi tuong net MANH")(ssget)(command "change" "p" "" "p" "la" "MANH" "")), i( W+ ^7 o# X2 N9 g8 y8 c. J2 m* l
(defun c:33 ()(princ "\nChon doi tuong net NETMANH")(ssget)(command "change" "p" "" "p" "la" "NETMANH" ""))
8 r1 o9 [  }# |(defun c:2 ()(princ "\nChon doi tuong net NETDUT")(ssget)(command "change" "p" "" "p" "la" "NETDUT" ""))
1 [0 k' v0 `0 g2 I: I& c1 r(defun c:3 ()(princ "\nChon doi tuong net NOITHAT")(ssget)(command "change" "p" "" "p" "la" "NOITHAT" ""))  T( c. L! Z0 F1 |3 Y
(defun c:4 ()(princ "\nChon doi tuong net TUONG")(ssget)(command "change" "p" "" "p" "la" "TUONG" ""))
3 d) o9 Z7 E' B& H% @$ B(defun c:44 ()(princ "\nChon doi tuong net KHUNGTEN")(ssget)(command "change" "p" "" "p" "la" "KHUNGTEN" ""))
; R' c7 T, [) R) u, w2 J(defun c:5 ()(princ "\nChon doi tuong net TIMTUONG")(ssget)(command "change" "p" "" "p" "la" "TIMTUONG" ""))
( m' B: N4 Z5 Y(defun c:6 ()(princ "\nChon doi tuong net CUA")(ssget)(command "change" "p" "" "p" "la" "CUA" ""))
8 }- I7 j3 J! A(defun c:77 ()(princ "\nChon doi tuong net THAY")(ssget)(command "change" "p" "" "p" "la" "THAY" ""))+ k6 T/ T% _$ [' e# W9 u+ U
(defun c:7 ()(princ "\nChon doi tuong net NETTHAY")(ssget)(command "change" "p" "" "p" "la" "NETTHAY" ""))& `4 I9 N- @" `. q
(defun c:8 ()(princ "\nChon doi tuong net HATCH")(ssget)(command "change" "p" "" "p" "la" "HATCH" ""))9 e; ?" A, z/ E; y: w6 _1 S
(defun c:9 ()(princ "\nChon doi tuong net TEXTTXT")(ssget)(command "change" "p" "" "p" "la" "TEXTTXT" ""))
: e/ }! ^# m, z& m. [! ~0 e1 E(defun c:99 ()(princ "\nChon doi tuong net TEXTVN")(ssget)(command "change" "p" "" "p" "la" "TEXTVN" "p" "C" "bylayer" ""))- x/ @+ o5 X1 l5 @& N! ?( T  w
(defun c:td ()(princ "\nChon doi tuong net THEPDOC")(ssget)(command "change" "p" "" "p" "la" "THEPDOC" ""))
- f5 x! E0 U. J7 H7 Q(defun c:ddt ()(princ "\nChon doi tuong net THEPDAI")(ssget)(command "change" "p" "" "p" "la" "THEPDAI" ""))/ ~  U. k5 R2 e% {& u! p% X

; m) c# M% c4 d2 u; C+ h;=====================================================================8 u. q7 ?  W4 l
;===================DAT Ti Le Theo KHO GIAY BAN VE====================
% ]) ?4 w0 E$ |6 H) t, \; Q7 w, R;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================% U% Z1 {0 e; t- t# X

$ p/ ?) Z  {& V3 [& w;(defun c:SA6 () (Command "DIMSCALE" "111.11111" ))(princ)- t$ C% x! x% E3 g+ d
;(defun c:SA5 () (Command "DIMSCALE" "1111.1111" ))(princ). }- V& y1 J( j9 \2 @4 @2 _* V
;(defun c:SA4 () (Command "DIMSCALE" "1111.1111" ))(princ)
; ?  ]/ N! A1 Y) e: \5 c9 ^. c;(defun c:SA3 () (Command "DIMSCALE" "11111.111" ))(princ)1 o) t9 a1 _& g* ^
;(defun c:SA2 () (Command "DIMSCALE" "111111.11" ))(princ)1 Z! F3 {" ~6 Y/ q
;(defun c:SA1 () (Command "DIMSCALE" "111111.11" ))(princ)
; f+ t8 ]. H- Q) Q, g( o;(defun c:SA0 () (Command "DIMSCALE" "1111111.1" ))(princ)- f- E2 ]% O' b# H3 [: e
8 w) g4 t2 r4 S: F$ f; i
;=====================================================================
" k' b1 B$ W8 @$ M# m! {;===================DAT Ti Le Theo KHO GIAY BAN VE====================
- Z+ r6 {" E% f' O5 B;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================, H/ ?3 H/ R. F
& m3 F  \4 [! R, j- E/ P
;=============== DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =============
' e- m% Y# c- p) h  U, Y9 w* ?  j1 w
9 f* P' Z$ d. |) }1 v;=============== DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =============
# u, I( W* o* u; N- _' S+ a
+ d) F7 U5 w& ?' u0 L* s(alert "Using the NetXuatAnh-[ 5940.00 x 4200.00 <pixels> ] command!")
2 e- ~; t1 _3 W% T3 h(princ "\nEnter (DEFUN C:netxuatanh () to get to real LAYER command.\n") (command "NETXUATANH")) ]4 g' B" p8 \4 f0 |* P2 Z) r( }

6 p$ I/ R8 m2 M;=============== DAT LAYER NET de xuat anh JPG [W x H] [5940.00 x 4200.00] ===DRAW===" j5 ?+ s  [7 p& Y! ]4 g3 t5 X

- ^3 i3 B- c  c" l' _;(DEFUN C:netxuatanh ()
2 H' U9 O; W! C2 N  q& w                            (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.6" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "5" ""8 J6 u8 X8 V: H0 W7 k9 l$ k
                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "1.58" ""9 Y7 e2 |+ T% |( W  V0 O. a
                                           "M" "MANH" "C" "9" "" "Lw" "0.5" """ {+ v* ~2 I% v
                                       "M" "DIM" "C" "1" "" "Lw" "0.6" ""
( i8 d( M" S7 r1 w; @% p                                       "M" "THAY" "C" "7" "" "Lw" "0.7" ""- ]) R% v2 Q4 t
                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.5" "". l; g: N' S, x4 |
                                       "M" "HATCH" "C" "5" "" "Lw" "0.35" ""  [3 A6 a4 F$ Z  J
                                       "M" "COT" "C" "2" "" "Lw" "2" ""; w! v) L& m; q% b8 D  x
                                       "M" "Defpoints" "C" "7" ""
# E. S: m7 U0 n& Z; }: u                                       "M" "0" "C" "3" "" "Lw" "0.5" ""+ U& b% D& e3 F+ Z! ~+ O
;                                       "M" "1" "C" "1" "" "Lw" "0.5" ""
* r% ]4 V0 H: e2 ~$ W;                                       "M" "2" "C" "31" "" "Lw" "0.5" ""
1 s; }2 r/ x- Q8 J6 `;                                       "M" "3" "C" "8" "" "Lw" "0.35" ""
+ C7 u- `# A2 z2 X9 f, G, [$ Y/ D;                                       "M" "4" "C" "4" "" "Lw" "0.8" ""
- @- I. b& [1 d, v" w0 h;                                       "M" "6" "C" "6" "" "Lw" "0.35" ""
# b9 Y5 n+ J- e+ o$ y7 V& s' `;                                       "M" "7" "C" "7" "" "Lw" "0.4" "") l  k  g" C5 O) f. P
;                                       "M" "8" "C" "8" "" "Lw" "0.35" ""
. `( s# _5 a) }1 U' @                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.5" ""0 G" \) R, B6 p( M. \
                                       "M" "DUONGBAO" "C" "7" "" "Lw" "1" ""
/ S% p- T& W* M5 D. ~! K  u;                                       "M" "KE" "C" "8" "" "Lw" "0.3" ""' I, x4 X6 Y; `. _
;                                       "M" "KT" "C" "9" "" "Lw" "0.35" ""
. H( \: ?& W( Z4 f* R6 D. h; T( d                                       "M" "NETDAM" "C" "4" "" "Lw" "1" ""; _" B- H- b0 B- F0 B3 O
                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.7" "") O. K( C9 g; b/ @  M4 o
                                       "M" "NETMANH" "C" "43" "" "Lw" "0.5" ""
0 W, e9 U, i- K0 _. k                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.8" ""
5 M: i4 r+ A9 g" f+ _& A/ x% t; }                                       "M" "TEXT" "C" "7" "" "Lw" "1.58" ""
, W- D/ i/ K/ t' I0 e% R                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.5" ""
; d$ E8 {0 a% |/ j+ x                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.4" ""
1 D$ s% g; x( q5 b1 o                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.4" ""
' u6 X# B6 b; R                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.7" "") n$ x8 F+ @; V: k" @' J
                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.58" ""( [0 F6 Y( J( o1 w3 L6 L
                                       "M" "CUA" "C" "6" "" "Lw" "0.5" "") W9 a8 L( x* U1 F$ A/ `8 k! X
                                       "M" "CUAMATDUNG" "C" "6" "" "Lw" "0.5" ""' Z# g- n. E* R2 a# I2 P
6 X& K" H4 ?1 C; b1 q( t* C
;=============== DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] ===NUOC===
) n/ C, b2 C* A8 \( O" q) {/ `: ^
" n) ]3 O# r. i6 x/ B" l$ c3 K2 o                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.5" ""/ k3 T3 p: C8 I0 _
                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE1" ""
, n2 ^2 m. y8 r( @  L                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE2" "", V. h0 n, A) a8 `" u5 c2 }( C
;                                       "M" "250" "C" "250" "" "Lw" "0.35" ""
* |, _) P2 V9 i+ y4 J                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1" ""
' s  H* K: [: `/ M5 m* I& k                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.5" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "10" )(princ); t9 Z- K, r! ~6 t! @

$ U, K" J/ e  a% N6 E- ^;=============== DAT LAYER TEXT de xuat anh JPG [DIM] [TEXT] [GHI CHU]======
2 D2 P1 p3 g6 u8 A& q% K$ i;===================================30|04|2024==============================! p- s; _, ~2 T# v& P. [/ E. r

0 ]' n, @6 v9 L" S4 W! `                     (Command "-style" "VNi-AUCHON" "vauchon.ttf" "225" "1" "0" "n" "n" )(princ)7 \2 {4 E; h8 D) T) X5 c6 F
                     (Command "-style" "VNi-COURI" "vcouri.ttf" "200" "1" "0" "n" "n" )(princ)/ ?# c9 Q8 ]# s# I3 u; ?" O
                     (Command "-style" "VNi-COURIB" "vcourib.ttf" "200" "1" "0" "n" "n" )(princ)3 q" p: ?1 R3 a$ R. Y/ p. A
                     (Command "-style" "Vni-VietNam" "vn_vni,vns.shx" "0" "1" "0" "n" "n" "n" )7 W3 u* b1 V" U; H% r
                     (Command "-style" "Vni-ROMANS-TEXT" "vni-romans,vns.shx" "200" "1" "0" "n" "n" "n" )) f! \3 d+ M8 j7 E9 I
                     (Command "-style" "COTES" "tcvn3italic,vns.shx" "0" "1" "0" "n" "n" "n" )
/ f! y  S: c' U2 B9 p8 u                     (Command "-style" "TRUC" "impact" "0" "1" "0" "n" "n" )6 |) Q1 |4 l! x
                     (Command "-style" "VNHELVLT-Hoa" "vnhelvh,vnh.shx" "500" "1""0" "n" "n" )
5 y3 c! F! i" w: R* g! g1 E- E                     (Command "-style" "VNHELVLT-Thuong" "vnhelv,vnh.shx" "500""1" "0" "n" "n" ). n. t4 f& k; j# e0 p; O) ^+ H
                     (Command "-style" "STANDARD" "Cambria" "250" "1" "0" "n" "n" )
4 ^7 g, d- @6 W7 u) g9 j2 o                     (Command "-style" "CAMBRIA" "Cambria" "200" "1" "0" "n" "n" )" z6 l, u7 v9 S0 |6 U
                     (Command "-style" "GHIKH" "romant,vns.shx" "0" "1" "0" "n" "n" "n")
- o/ n& }" F2 e1 z                     (Command "-style" "GHISH" "impact" "0" "1" "0" "n" "n" )
# O! X# F, i) @+ G+ [                     (Command "-style" "ROMANT-DIM" "abcroman,vns.shx" "0" "1" "0" "n" "n" "n" )
+ m# \% k' V4 }$ c" Q                     (Command "-style" "ROMANC-KhungTEN" "abcroman,vnh.shx" "200" "1" "0" "n" "n" "n" )
3 x5 W( I% m5 b- r; b; P                     (Command "-style" "ROMAND-TEXT" "abcrom,vnh.shx" "200" "1" "0" "n" "n" "n")
. a( }& z" m) `; E/ r                     (Command "-style" "ROMANT-TEXT" "tcvn3italic,vnh.shx" "200" "1" "0" "n" "n" "n" )(princ)& @+ A; T( R; }# z0 [% @

- ]3 a5 a, e5 P/ q;============= DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =DIM-STYLE=8 H) h# v. T/ l$ G' W
;===================================17|10|2024===================================
- I2 G$ Z; e' ~/ a3 [% B5 E8 Q- f( o( [
                     (Command "DIMTXSTY" "ROMANT-DIM" )(princ)
0 [, M% v) U: f) ]5 ^                     (Command "DIMBLK" "Closed" )(princ)  U2 N, m; y, k/ d3 U9 }1 d

0 j" Q& ?% e& r/ A/ Q;============= DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =DIM-STYLE=" s0 u+ \; S' k% k3 l$ Y
;===================================17|10|2024===================================0 V' c1 }) v/ r4 M( ~  ~

& s% {# G+ u: E$ y1 U+ F. g% I;(Command "-units" "2" "8" "1" "8" "" "N")3 c9 d( G* L3 b3 ?2 e0 h" |: F
(Command "-plot" "Y" "" "publishtoweb jpg.pc3" "User 1 (5940.00 x 4200.00 Pixels)" "Landscape" "N" "Display" "Fit" "Center" "Y" "monochrome.ctb" "Y" "" "N" "" "N" )(princ)6 ]  a  c% i6 @$ ~

' R9 Y. F7 K; `8 @$ Y;============= DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =DIM-STYLE=$ L* Y" x: B) v- w3 Q+ Q
;===================================17|10|2024===================================
$ |" Z6 B! N/ K: |3 z3 k, Y4 d9 c' |
;======== KET THUC - DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =====0 n0 x) O, z. Z  A: u+ c

% J) ~6 Y1 p5 N) C* X) V;======================== DAT NET IN & TI LE BAN VE =============================9 O* d6 [2 A7 [: ]$ C

' N1 p: L$ m0 U;=================LENH VE KHUNG TEN - Tieu Diet Lenh==================$ P0 e, ]' K1 E% D
;=============== DAT KHO GIAY BAN VE - KIEU KHUNG TEN ================
8 V% x5 u% ^& P1 z- V. h;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
0 K1 ~; ?0 w4 D0 B9 I;=============================11|07|2025==============================- t" k. k0 M( D- H% D; a
;Ti Le Ban Ve - 1 : 1008 g% F1 G, F9 k- i* @- x" x- V
(Defun c:kta4 (): A: p. v8 q9 }
        (setq mv_sc 100);Ti le  ban ve
7 R2 k, M3 T; t) ^! R      (setq x4  297)* w# a- m/ R& j6 X6 }
      (setq y4  210)
# z& [. a  G1 e0 S# |+ e$ o  (setq x4 (* mv_sc x4)
+ Z! w# x' o$ ^- K$ R" z. d        y4 (* mv_sc y4)  )5 c  x8 F/ w# Z
  (command  - I0 @) @( I+ }
    "LIMITS" "0,0" (list x4 y4)
8 K" {. m9 p# w/ j9 n    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"+ O$ v. S7 {7 v4 `& G) A
;Khung CHU NHAT Chinh    3 B9 \) G6 N  u
    "RECTANG" "500,500" "@28700,20000"
1 }7 h% a; y$ A0 T# M    "RECTANG" "700,700" "@28300,19600"
; e/ S1 }5 D5 d5 e;Khung Ten Chung
$ e: H$ e5 U. l6 f/ H    "RECTANG" "700,700" "@8000,1250"
# n5 f" d, V/ b+ C* ^$ L6 t' ^, G    "RECTANG" "700,700" "@17300,2500"
0 x8 X# _; Q. R6 g2 M;Ten Ban Ve: Q3 W+ |' C: r7 e5 }' k4 P9 I
    "RECTANG" "18000,700" "@11000,1250"! l4 [& Z& u* S# l" e* ?9 P! o
    "RECTANG" "18000,700" "@11000,2500"9 I. ]% R  L& t" m5 t
;Khung Ti Le + Ngay Thang Nam% W0 G& h4 X, S
    "RECTANG" "22500,700" "@2000,2500"+ k/ }/ U: C5 h9 ]' q$ W8 n4 V
;Khung CHU TRI
6 F7 D, q6 S$ g" M" y3 M    "RECTANG" "8700,700" "@3800,2500"
; a4 `8 H" M' P$ f% g& W- Z$ B"ZOOM" "_a"  ))1 J7 Z5 i( o( K4 L; ^: j; j) r
;=====================================================================4 @2 u, \: M: V  K" B) E6 E
;Ti Le Ban Ve - 1 : 100
% \9 D+ p- j* C(Defun c:kt4a ()' A" F$ m6 n. D. o/ b' k
        (setq mv_sc 100);Ti le  ban ve" w; q! X6 k4 n4 v% W6 J' K& E
      (setq x4  297)
3 o7 w; O  O# B, d1 i      (setq y4  210)# E. ?* D& x; ]$ {% D% W+ b, d
  (setq x4 (* mv_sc x4)
: S; g" K; f- K% a2 k) M" s        y4 (* mv_sc y4)  )
" a; _: W" @2 H2 E: C9 R8 O6 t  (command  2 ^7 ?' M# E0 X3 u/ n4 n
    "LIMITS" "0,0" (list x4 y4)
" v  b( G* r7 {6 G, C6 R; a    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"$ c; d$ ]/ k5 Q( o6 X
;Khung CHU NHAT Chinh  6 T# H! V7 F$ s& x1 T  s4 @  j$ D
    "RECTANG" "2000,500" "@27200,20000"
# G  f( H! A6 d    "RECTANG" "2200,700" "@26800,19600", G* B+ Q2 i: w3 k& B  A8 g: q& k
;Khung Ten Chung
8 f9 r1 q; G* U0 D, `5 }    "RECTANG" "2200,700" "@6500,1250"
, X7 Q) M8 {% T9 C. C6 |    "RECTANG" "2200,700" "@15800,2500"3 L' \( {) ^5 f
;Ten Ban Ve
+ D1 y: ~/ M, O4 i: M% N    "RECTANG" "18000,700" "@11000,1250"" r- ^, k8 |: K0 |
    "RECTANG" "18000,700" "@11000,2500"5 A  _3 U+ |- m, S  y" Z8 M
;Khung Ti Le + Ngay Thang Nam7 o, u! Q5 h3 V/ A$ H- w: ~
    "RECTANG" "22500,700" "@2000,2500"4 T2 l0 d3 D! k: s+ f
;Khung CHU TRI" R& [4 d, l3 h: e/ F- q6 i
    "RECTANG" "8700,700" "@3800,2500"# k7 D7 r; s" \: N0 }
    "ZOOM" "_a"  ))$ l9 y7 r& P6 C4 d7 j2 x9 r
3 C  ^+ s+ v6 J$ ^! f9 _
;=================LENH VE KHUNG TEN - Tieu Diet Lenh==================
( A/ h. U4 k/ k- a7 k- @0 f6 \;=============== DAT KHO GIAY BAN VE - KIEU KHUNG TEN ================9 u. [& ]8 L/ x  t1 d# l, j
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
* X8 t4 @& B1 ^' a- P;=============================04|07|2026==============================
' @, E+ `" T. b8 e9 R;Ti Le Ban Ve - 1 : 100
% W1 f5 \/ s" U* M( c(Defun c:za4 ()' Z  S4 g6 D0 H" c  v! \
        (setq mv_sc 100);Ti le  ban ve2 X+ N3 X( g4 l' z! l) ?" u8 E
      (setq x4  297)
, t7 A" `/ r# T8 s4 |* r) ?      (setq y4  210)
% \4 _" n& I3 N  (setq x4 (* mv_sc x4) : u7 I! |* b2 V  l& o/ u& D
        y4 (* mv_sc y4)  )9 A5 n) D- ~- A
  (command  
+ Y% Y  z& G2 h9 m    "LIMITS" "0,0" (list x4 y4)6 a, V6 `1 C: }) E, A
    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
2 e2 P; ?3 k3 B7 U% Z$ G;Khung CHU NHAT Chinh   
2 H& O8 F9 p7 e    "RECTANG" "500,500" "@28700,20000"
/ [( ]- \3 b7 Z$ J5 {    "RECTANG" "700,700" "@28300,19600"$ K# L, M3 W6 o: H! Y% @" d
;Ten Ban Ve8 {) M. p, f' b7 U3 @
    "RECTANG" "24500,700" "29000,1950"
- _& e1 ?0 Y' Y. _9 q    "RECTANG" "24500,1950" "29000,3200"
6 Q5 P5 M  e7 Q, L, M) v( ?;Khung Ti Le + Ngay Thang Nam( c: A( c8 U( Q, v  m4 o8 K5 O
    "RECTANG" "24500,3200" "26750,4450"# a0 P" L& _3 D
    "RECTANG" "26750,3200" "29000,4450"
8 u$ N4 C% Q" K4 K( A;Khung Kiem Tra
; C& ]! l7 f$ p6 ~    "RECTANG" "24500,4450" "29000,6325"
. m% k; K, e0 G" m- X;Khung Thiet Ke
1 ]: x7 t, Z1 `: Q" |9 @    "RECTANG" "24500,6325" "29000,8200"4 h* N4 s0 }0 |1 T
;Khung CHU TRI
: m/ Q1 \% N4 s2 L0 d    "RECTANG" "24500,8200" "29000,10075"
9 R) j) b* \" q7 F- E* G6 M) v' H. I;Khung GIAM DOC
' e& w9 \: D8 B) _8 o1 v# q    "RECTANG" "24500,10075" "29000,11950"
: _& V/ [3 _3 u$ G9 u* s, _; q;Khung HANG MUC5 {2 d( t0 d3 _& x& ^: I, h; q
    "RECTANG" "24500,11950" "29000,14450"3 e9 B  \6 s+ J2 C6 \
;Khung CONG TY& b: F0 g4 y  p7 m
    "RECTANG" "24500,14450" "29000,16950"5 Q; }" |5 C3 r+ \) l/ X: y# N
;Khung REPAIRE
% M$ H% K/ B7 _- S5 _) ?  y    "RECTANG" "24500,16950" "29000,18125"
4 w7 x# l6 r4 Q    "RECTANG" "24500,18125" "29000,19300"
" T4 O4 a- G1 \    "RECTANG" "24500,19300" "29000,20300"
8 n, T# o6 f$ Z. A    "RECTANG" "25500,16950" "25500,20300"- z7 d& F/ f. H5 r8 K
    "ZOOM" "_a"  ))
5 J1 J& L$ N  L3 @& N( ^6 }( {;=====================================================================
, Y* q) T/ S% t4 y3 ?* l;Ti Le Ban Ve - 1 : 100! d2 |: G8 t3 p& X3 D
(Defun c:zb4 ()
; x+ d& }9 @  \1 P) M$ m        (setq mv_sc 100);Ti le  ban ve$ T4 N, `3 f) @
      (setq x4  297)1 `% }: A+ `: o+ Y/ a0 t
      (setq y4  210)
" {0 [* g: F7 b' ~5 W! c% H, Y, Z  (setq x4 (* mv_sc x4)
) t% y4 V' t8 V2 s) A: J        y4 (* mv_sc y4)  )3 J3 S2 T: _$ V4 f) w5 [+ e
  (command  
9 \0 \: A, j" `# w' l" f" e% c& Q    "LIMITS" "0,0" (list x4 y4)
$ y1 o* W& w/ R0 b7 O& _( P    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
) j9 s5 W; H4 P. s- X9 l;Khung CHU NHAT Chinh  6 a: t: L& J) g5 l: c
    "RECTANG" "2000,500" "@27200,20000"9 N0 K2 ?- a, p6 K3 B- q: s  Z
    "RECTANG" "2200,700" "@26800,19600"( d7 U  r4 A7 O- \; w  l  D; _
;Ten Ban Ve
- t2 r5 ^+ m: h' Z    "RECTANG" "24500,700" "29000,1950"- V- y& f) \  L" ~
    "RECTANG" "24500,1950" "29000,3200"0 g! Z) p2 v  q; N; T3 |* f
;Khung Ti Le + Ngay Thang Nam
% ^: Y1 R& Q- t2 f* |' _% r    "RECTANG" "24500,3200" "26750,4450"% N$ X4 O2 V+ R/ ~
    "RECTANG" "26750,3200" "29000,4450"2 B  i3 b/ W2 K
;Khung Kiem Tra8 J( e: e% p: w
    "RECTANG" "24500,4450" "29000,6325"
) O" ]& g# k' ^3 m5 {;Khung Thiet Ke# K1 v. O, P" x( W1 O' n
    "RECTANG" "24500,6325" "29000,8200"/ k9 Y$ `) b2 @, s1 [8 c! }
;Khung CHU TRI
1 Y: Z  {, X& P# B  T3 a7 F    "RECTANG" "24500,8200" "29000,10075"  o( p  q  l5 I+ s* c6 B" A  H
;Khung GIAM DOC: N" x! d1 m' h  d& N2 {
    "RECTANG" "24500,10075" "29000,11950"( m: T: v, Y( `" s3 Y/ ?( V1 ]& G
;Khung HANG MUC) O. m) C& g) s9 H( w
    "RECTANG" "24500,11950" "29000,14450"
" q4 \9 V. \, w' y! v( w9 z;Khung CONG TY
  T% D: }2 A! Z9 {: e    "RECTANG" "24500,14450" "29000,16950"/ O" L5 [2 ~6 _! @
;Khung REPAIRE
) }' d/ C5 O% Z/ y4 p- b1 Z    "RECTANG" "24500,16950" "29000,18125"1 T3 v: G4 G$ T
    "RECTANG" "24500,18125" "29000,19300"
! ]# T$ o% u" Z- M. y% _& }    "RECTANG" "24500,19300" "29000,20300". x, u; ]4 k0 b
    "RECTANG" "25500,16950" "25500,20300"! K" N! \, {) f' H( ~, O
    "ZOOM" "_a"  ))& U6 O" G0 I9 g0 q3 N$ c7 f

1 m9 v/ o8 p9 P8 K* H  u( r;;; ============================GHI CHU Khung Ten========================
0 v( a# c$ q; {1 [. |;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========% x! T: n9 X+ e% w- o  K0 `
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 ====================0 ~) q0 n8 Z$ \
;;; =======================Thuong Dung Font Romant.vnh===================
" n, \$ n5 j; C8 t' [8 W) J- X- ^+ m; W, g2 v
(defun c:GhiChu (/ pta ptb ptc ptd X Y X1 Y1 rmsz pl1)
0 o. }0 H! d4 a* H6 k1 D, j  (setq oer *error* *error* err2)
7 M2 l& t7 ~7 C$ T+ C2 Z3 X8 A  (PROMPT "\nChuTri. ThietKe. KiemTra. TiLe. Ngay. HangMuc. QuyMo. KieuNha. CongTrinh. KyHieu. TenBanVe. Kts. TranNgocThang. ")
4 j' N: I! d9 P: ?6 `# A* H) j  (SETQ Cpt(GETSTRING "\n(CT). (TK). (KT). (TL). (Ng). (HM). (QM). (KN). (CTr). (KH). (TBV). (Kts). (TnT). "))+ _* r7 [- {1 ^$ C* b
  (IF(OR(= Cpt "QM")(= cpt "qm"))(SETQ CPT ' "Hå S¬ ThiÕt KÕ Nhµ D©n Dông quy M« :"))2 ^. v* ?% F/ p% u4 b
  (IF(OR(= cpt "KN")(= cpt "kn"))(SETQ CPT ' "2 TÇng 1 Tum Thang"))6 ]# o0 ^$ H' W# l* L. n- b; H3 I* `
  (IF(OR(= cpt "CT")(= cpt "ct"))(SETQ CPT ' "Chñ Tr× :"))1 O+ {( w$ ~5 [
  (IF(OR(= cpt "HM")(= cpt "hm"))(SETQ CPT ' "H¹ng Môc :"))
; N8 ^* l; ?$ B3 k  (IF(OR(= cpt "CTr")(= cpt "ctr"))(SETQ CPT ' "Nhµ ë Gia §×nh - Nhµ LiÒn KÒ"))
) ^7 Z; e0 E/ b, T+ a3 i% z0 {  (IF(OR(= cpt "TK")(= cpt "tk"))(SETQ CPT ' "ThiÕt KÕ :"))
# O! F3 K- Y3 Z: s+ `0 J5 p  (IF(OR(= cpt "KT")(= cpt "kt"))(SETQ CPT ' "KiÓm Tra :"))" A$ t% d/ a4 A8 ^" z: F
  (IF(OR(= cpt "TL")(= cpt "tl"))(SETQ CPT ' "TØ LÖ :"))
5 o* p- D3 m* s, q) L  (IF(OR(= cpt "KH")(= cpt "kh"))(SETQ CPT ' "Ký HiÖu :"))
3 Z: b& T6 ?+ i+ }3 A0 N  (IF(OR(= cpt "TBV")(= cpt "tbv"))(SETQ CPT ' "Tªn B¶n VÏ :"))
+ s4 _( M( a! R) d& q  (IF(OR(= cpt "Ng")(= cpt "ng"))(SETQ CPT ' "Ngµy :"))( {. J3 ^8 d1 Q+ D, B+ ^
  (IF(OR(= cpt "Kts")(= cpt "kts"))(SETQ CPT ' "Kts. TrÇn Ngäc Th¾ng"))
/ L  E; @$ W: _& O. D3 c' X  (IF(OR(= cpt "TnT")(= cpt "tnt"))(SETQ CPT ' "TrÇn Ngäc Th¾ng"))
" \9 D! b2 x' q8 O3 n: ^  j (setq pta (getpoint
2 x  q9 u9 s5 @- J  I" @    "\nPick first corner. : "))
- t8 M. \6 N/ }, Y% g' d0 u# J  (setq ptb (getcorner pta0 B. e) Q+ U; M1 K, e
    "\nPick second corner. : "))1 R7 l4 e: t# _1 b  n. G) K* v
  (setq ptc (list (car ptb)(cadr pta)))
2 ]# {; f8 T1 X2 E3 I  (setq ptd (list (car pta)(cadr ptb)))
$ c' `5 T% W% U" x" }  A4 e5 j  (setq ang (angle pta ptb))
& E+ [, `$ E7 ~% [  (setq d1 (/(distance pta ptb) 2)). v- h5 |/ k7 ^
  (setq cp (polar pta (- ang (dtr 0)) d1))0 b: p: _1 ?6 [
  (setq X (distance pta ptc))5 ?7 Y6 f' F4 l) a8 q% M5 ^
  (setq Y (distance pta ptd))- k; K' ]- R  ~6 k, Y: j
  (setq X1 (rtos x 2 1))
/ d' A& h; ^6 |* s  (setq Y1 (rtos y 2 1))  O5 C/ S" p6 s' W
  (setq rmsz (strcat "(" X1 " x " Y1 ")"))
; u$ j9 b+ }4 p8 `, d$ {  (command "TEXT" "c" cp "0" CPT "text" "" rmsz)). O+ j' I" F$ b: W) v& m9 I
  (defun dtr (angg)
) ?6 |: |! ^+ p" k( d5 {  (* pi (/ angg 180.0))): E) ^& y3 X9 e/ a
, v( k2 I* D- J3 M; n3 h* Z4 A. ~0 E
;;; ============================GHI CHU Khung Ten========================
  p" q5 H' v! K9 `;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========
0 k7 Q+ u/ m5 j( a1 };;;=============== Tran Ngoc Thang - Sinh 03-05-1976 ====================9 I; G. N3 G) ?( ~6 |7 u3 b
;;; =======================Thuong Dung Font Romant.vnh===================
- w( J7 S. a$ Z4 C7 Y: n; d
: ^( ~0 O" _, V- W$ P8 i/ w(defun c:iit (/ pt str pta ptb ptc ptd X Y X1 Y1 rmsz pl1)
: z" G( Q- B! N# S' L  (setq oer *error* *error* err2)
* V! G* z' N8 q  (if (not h_text) (setq h_text 250)) ; Kích thuoc chu mac dinh là 2.5
5 X+ J( A9 Y' w# Q: n2 E
% k* s- X) I* X  (setq ht (getreal (strcat "\nNhap chieu cao chu <" (rtos h_text) ">: ")))( g. v; l% B& x( |+ ?. k

7 S9 y5 S# p$ b7 o; r  (if ht (setq h_text ht))
6 ~. S4 I) k$ y7 I9 u
' n& ]5 c2 H8 K8 T8 k0 ^' F+ G+ ?  f" o" K
(setq ang (getreal "\nNhap goc nghieng moi (do) <0>: "))7 n+ X! d8 M9 L3 Y( k

" g- Y7 Q4 P$ A1 T! l      (if (not ang) (setq ang 0.0))3 `8 m" g  W/ |2 p# T
& j& J4 j7 g4 k; F0 M% P* v
/ H8 z# i! c" H8 J; C$ f2 e
% |% `2 K$ [. y5 V* D
(setq pta (getpoint
  u( B! U% J- O! V# d7 u* V* Q    "\nPick first corner. : "))
' W" i9 [" K! }+ I# H/ ^  (setq pt (getcorner pta4 A" F0 v9 X4 E6 o, m
    "\nPick second corner. : "))
5 _" R4 [* c1 H/ w  [; U# I% W2 f. `. b' t& c

' z& u$ Y) p6 O  D1 ]  (command "TEXT" "j" "M" "4700,2575" "0" (SETQ pt ' "Hå S¬ ThiÕt KÕ Nhµ D©n Dông Quy M«") ) (princ)
6 A9 N& Q9 A+ v* g- m5 g$ T% f
- i. D# f2 N  A$ B! p  (command "TEXT" "j" "M" "4700,1325" "0" (SETQ pt ' "2 TÇng 1 Tum Thang") ) (princ)
8 a; m! `3 u$ c! ~; Z/ {* |/ L6 k7 R7 k) u6 s$ ?
  (command "TEXT" "j" "M" "10600,2850" "0" (SETQ pt ' "Chñ Tr× :") ) (princ)
$ w. U; B* K+ x  M8 b! ~/ g5 k* i) k. _& L0 k( N) K: p6 }
  (command "TEXT" "j" "M" "10600,1100" "0" (SETQ pt '  "TrÇn Ngäc Th¾ng") ) (princ)8 J; d2 ]2 X" v$ c! Q

, t* \/ V+ H' c: T) N2 a" T  (command "TEXT" "j" "M" "15250,2575" "0" (SETQ pt ' "H¹ng Môc :") ) (princ)
2 L% e. S* r" m1 e" ~# C: G. m( V! h2 `6 J& ~8 T4 P
  (command "TEXT" "j" "M" "15250,1950" "0" (SETQ pt ' "Nhµ ë Gia §×nh . Nhµ LiÒn KÒ") ) (princ)
2 M& X+ S4 ]3 y! l6 n8 r" p$ [. R) s! g
  (command "TEXT" "j" "M" "15250,1100" "0" (SETQ pt ' "Tel : 09.76.89.12.94") ) (princ)7 n$ h' N3 E: Z( p. z

. W% X8 x. B) y" [& e! V% ]6 y4 t  (command "TEXT" "j" "M" "20250,2850" "0" (SETQ pt ' "ThiÕt KÕ :") ) (princ)
# i) g! Y6 R$ O) a: n9 r9 o7 X* w3 d4 o# e7 c8 j$ B
  (command "TEXT" "j" "M" "20250,2300" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)# X* p  G) t! Z" f+ n

+ G# S+ R3 e; z- T  (command "TEXT" "j" "M" "20250,1600" "0" (SETQ pt ' "KiÓm Tra :") ) (princ)
$ I/ T3 j2 ~' C, u7 a! H; E
, N% J, x1 B9 q$ ^* r  (command "TEXT" "j" "M" "20250,1100" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)
* a- O7 d7 }: r" g; G$ f6 G7 w# F% e; y" y. f
  (command "TEXT" "j" "M" "23500,2850" "0" (SETQ pt ' "TØ LÖ :") ) (princ)
3 G- D8 N" N. `; v# Y
: ~& A0 T( ]! w) t  (command "TEXT" "j" "M" "23500,2300" "0" (SETQ pt ' "1:75") ) (princ)
# x# d2 z- n$ G  o. ^$ T6 d& Q' X% e
  (command "TEXT" "j" "M" "23500,1600" "0" (SETQ pt ' "Ngµy :") ) (princ)  H  @& h3 m. E0 ?1 r  C; w- x
0 J1 l, w2 Z4 L/ S
  (command "TEXT" "j" "M" "23500,1100" "0" (SETQ pt ' "2026.07.02") ) (princ), m# Q2 Q' C9 ?; I* E( u+ M

" d. C' w6 {5 P) l3 V+ p& W  (command "TEXT" "j" "M" "26750,2850" "0" (SETQ pt ' "Tªn B¶n VÏ :") ) (princ)* B) s. C$ u3 R, F

" F+ L$ ?( ]8 z, `& [, }# c  (command "TEXT" "j" "M" "26750,2300" "0" (SETQ pt ' "MÆt B»ng TÇng 1 + 2") ) (princ)
) ]' \9 k0 I. Q5 @, P* `
# i; C6 T2 B; N* `; X  (command "TEXT" "j" "M" "26750,1600" "0" (SETQ pt ' "Ký HiÖu :") ) (princ)
( Y$ t7 G1 P6 ]& G8 @  w+ \3 ?
1 l. L0 n& m" q' \  (command "TEXT" "j" "M" "26750,1100" "0" (SETQ pt ' "KT-01") ) (princ), }2 T/ B6 O1 Z  H# b

) T! w( |& i' q. _  (setq ptc (list (car ptb)(cadr pta)))$ y1 V8 q- \4 _! k& Q! [
  (setq ptd (list (car pta)(cadr ptb)))
- ?+ r+ J8 o- @1 n" l) k  (setq ang (angle pta ptb))
! p3 L% q: w- Z$ T  Z  B  (setq d1 (/(distance pta ptb) 2))0 E" @+ K3 }* `- d/ z( m% q) t
  (setq cp (polar pta (- ang (dtr 0)) d1))3 x3 G! p+ M8 Z5 d' h( h" o% }8 D/ u
  (setq X (distance pta ptc))' o- Y, R- C  i" p
  (setq Y (distance pta ptd))
$ D6 d0 O" ]3 }% b5 J+ I  (setq X1 (rtos x 2 1)): R) |4 o% S/ |. H+ }
  (setq Y1 (rtos y 2 1))
" G1 a0 W9 Y4 K. g  (setq rmsz (strcat "(" X1 " x " Y1 ")"))
  ~9 e  U; a: ?: c  U0 h) r  (command "TEXT" "c" cp "0" CPT "_text" "" rmsz))8 ]1 ~6 |& \$ U4 Q' G7 g+ H
  (defun dtr (angg)
: |2 c) U5 ^6 F4 Z( k" r  (* pi (/ angg 180.0)))6 [  M5 k( z  t" n

. f, ]2 ?* N5 `2 c' L$ z9 @;;; ============================GHI CHU Khung Ten========================
4 i8 N6 s: _- A1 W* z# G;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========( m# I9 d( P" b- [; E- B
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 ====================
$ t. z/ B& @0 ^3 W;;; =======================Thuong Dung Font Romant.vnh===================
, Q, d% T8 g8 \8 Z/ n5 |- _+ W% U/ }) u3 B; p
(defun c:ipt (/ pt str pta ptb ptc ptd X Y X1 Y1 rmsz pl1)4 m' n( j; {4 U! |$ h2 x3 B& D6 C
  (setq oer *error* *error* err2)
! a! [# V6 N1 b7 W* ~  (if (not h_text) (setq h_text 250)) ; Kích thuoc chu mac dinh là 2.53 \4 \* y2 J  g3 p& F  u0 z2 [

, [3 y# p# {+ v  (setq ht (getreal (strcat "\nNhap chieu cao chu <" (rtos h_text) ">: ")))- |. w- E, k6 M# |! N

$ w1 {8 Q* p1 V, g1 |, j  (if ht (setq h_text ht))- E3 Q9 Z4 x& U- q9 [

% U0 _4 C  J  V2 Z+ A
" U: ]( H: h8 u8 L# \4 U(setq ang (getreal "\nNhap goc nghieng moi (do) <0>: "))/ A6 C* z$ X, k5 B
* H* k3 [- l, `( g7 d! d1 |
      (if (not ang) (setq ang 0.0))  J3 ~; B% F$ V; a  [3 ?4 d

$ a2 O% U7 r% x1 x- n( _4 W7 Y* K  s6 j
, i) E# v5 E, Z  _8 i
(setq pta (getpoint
, l  ?: t8 j7 X    "\nPick first corner. : "))
" [* Z# U- e. ?0 B  (setq pt (getcorner pta- N: k7 C  l; J
    "\nPick second corner. : "))
, i6 E' ^! N8 t0 n. l4 \' }6 Q( Y1 y9 J, j

( q- w* j9 W* Y# f6 n$ v- e  (command "TEXT" "j" "M" "5450,2575" "0" (SETQ pt ' "Hå S¬ ThiÕt KÕ Nhµ D©n Dông Quy M«") ) (princ)
. c9 K9 q7 `/ i$ P2 g+ T. U  t
  (command "TEXT" "j" "M" "5450,1325" "0" (SETQ pt ' "2 TÇng 1 Tum Thang") ) (princ)
- O$ R5 O0 y- G$ D8 x2 }9 D$ N* ~: H- {, k8 w; _+ A( v8 I" ]
  (command "TEXT" "j" "M" "10600,2850" "0" (SETQ pt ' "Chñ Tr× :") ) (princ)3 r: U* ^3 [3 Z$ r- Z4 [

+ N- n# U: c7 M; P: n$ S  (command "TEXT" "j" "M" "10600,1100" "0" (SETQ pt '  "TrÇn Ngäc Th¾ng") ) (princ)% k0 y' l& P+ E: D
, m1 }: d6 y. X) d9 [; p
  (command "TEXT" "j" "M" "15250,2575" "0" (SETQ pt ' "H¹ng Môc :") ) (princ)( X  P4 p/ b& @
% u) Q. E8 F+ \# n2 o: s9 b' j! l9 G4 H
  (command "TEXT" "j" "M" "15250,1950" "0" (SETQ pt ' "Nhµ ë Gia §×nh . Nhµ LiÒn KÒ") ) (princ)
: |+ H9 E$ N5 d6 V6 F- M* k( v+ u0 k" o" `$ w
  (command "TEXT" "j" "M" "15250,1100" "0" (SETQ pt ' "Tel : 09.76.89.12.94") ) (princ)) o: v- ~$ ^8 A0 C

' z9 @6 J% U0 I; t  (command "TEXT" "j" "M" "20250,2850" "0" (SETQ pt ' "ThiÕt KÕ :") ) (princ)6 Z9 s: g2 a) p8 J6 q

2 \. [, ?% ?' U* P6 c  (command "TEXT" "j" "M" "20250,2300" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)8 n1 w  ?  W& J0 X; |$ _

/ h2 I/ l8 P2 L$ Z2 w  (command "TEXT" "j" "M" "20250,1600" "0" (SETQ pt ' "KiÓm Tra :") ) (princ)
; C/ u3 o. ~( y. Z. y$ z* G) l- G
6 L; D4 M9 w5 R& q- _3 p& ~& c( E  (command "TEXT" "j" "M" "20250,1100" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)7 \1 D/ f( P5 g$ |9 A5 |
) B1 o7 Q* y8 `: Z" `
  (command "TEXT" "j" "M" "23500,2850" "0" (SETQ pt ' "TØ LÖ :") ) (princ)% c% k1 B4 l; I) s
$ H6 @9 f$ f4 g( h
  (command "TEXT" "j" "M" "23500,2300" "0" (SETQ pt ' "1:75") ) (princ)
/ L  R( t3 b4 f
- U4 Y3 F2 n7 Y8 t4 V$ D  (command "TEXT" "j" "M" "23500,1600" "0" (SETQ pt ' "Ngµy :") ) (princ)$ i9 v# A5 {3 V$ B9 v  p) H% J* e+ B

( f5 X, u) \) ]% j3 V  (command "TEXT" "j" "M" "23500,1100" "0" (SETQ pt ' "2026.07.02") ) (princ)
1 q0 I( I. w& ]. f, Z; z% j
" v! l; `& D9 R: a9 w1 l  (command "TEXT" "j" "M" "26750,2850" "0" (SETQ pt ' "Tªn B¶n VÏ :") ) (princ)
* x8 Q+ O# c1 k9 ]/ d2 o  U& h) q+ g+ {8 N5 f" |3 ~
  (command "TEXT" "j" "M" "26750,2300" "0" (SETQ pt ' "MÆt B»ng TÇng 1 + 2") ) (princ)3 [' E1 s' T) W8 M. M9 J6 w
6 U; b! O; w6 a8 l. _
  (command "TEXT" "j" "M" "26750,1600" "0" (SETQ pt ' "Ký HiÖu :") ) (princ)/ m1 l0 j: s8 K0 j9 t2 Q& i! f% T( k/ E

& b0 h, ~( A& R) L" s  (command "TEXT" "j" "M" "26750,1100" "0" (SETQ pt ' "KT-01") ) (princ)+ w, T: y3 X& _* ^' `+ E
- N, Q* d( _! d* y  h7 [
  (setq ptc (list (car ptb)(cadr pta)))
. Q' Y- z6 z$ T4 Y& Y9 o  (setq ptd (list (car pta)(cadr ptb)))
; O  z# }. M8 T& x/ r  (setq ang (angle pta ptb))) A1 }# r$ J9 t2 A
  (setq d1 (/(distance pta ptb) 2))
* Q6 \3 A1 Z) s) \& f  (setq cp (polar pta (- ang (dtr 0)) d1))% q: C0 ^! V& E, d6 Q, {2 ]( _2 Y7 }
  (setq X (distance pta ptc))* Y4 }7 ^4 D8 u8 T) \1 p
  (setq Y (distance pta ptd))
1 D% {/ H, d+ T: O# P  (setq X1 (rtos x 2 1))
$ H, B( l, \/ e! f* t  (setq Y1 (rtos y 2 1))! W, ], h$ F7 n! [. T
  (setq rmsz (strcat "(" X1 " x " Y1 ")"))8 i, J. A! X9 D6 O
  (command "TEXT" "c" cp "0" CPT "_text" "" rmsz))
8 L" y' n5 m& K- k- x  D  (defun dtr (angg), P2 c9 f# Z! r
  (* pi (/ angg 180.0)))% I+ \# T  `8 }) k; ^! G0 {

( c3 b0 S/ P: C;;; ============================GHI CHU Khung Ten========================: l" R7 f6 O. F( P1 V3 b4 {
;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========
$ C8 g0 e# T1 O7 l;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 ====================. L: j- b: K( t9 E% j
;;; =======================Thuong Dung Font Romant.vnh===================
4 q+ j& c1 D6 r8 A9 D  C& n" o" M' C3 ?" N3 P3 E+ a- I  f3 @
(defun c:iza (/ pt str pta ptb ptc ptd X Y X1 Y1 rmsz pl1)
, v6 i' a* Z# [! f  ]' J8 M  (setq oer *error* *error* err2)
1 j* z% Z9 G: v3 I5 Y' {7 \; [  (if (not h_text) (setq h_text 250)) ; Kích thuoc chu mac dinh là 2.5
5 R: D9 p4 q% o* A8 F
" L4 l8 t4 y0 L# w2 e( ]9 j  (setq ht (getreal (strcat "\nNhap chieu cao chu <" (rtos h_text) ">: ")))3 C; \' v8 R; Q) A9 a
& Q0 h7 o! c) X; ^9 {! g
  (if ht (setq h_text ht))
, K! s0 V: A' t, Y6 F  L) E& j9 `  g2 O
% J" F9 A2 c! ~; Q
1 @  ~" ]" V  k; j& I; m0 e" Q(setq ang (getreal "\nNhap goc nghieng moi (do) <0>: ")). m  }& d$ l6 a8 I( s1 q) F. i

4 g, s* X- J& M, ~      (if (not ang) (setq ang 0.0))' a* P' G' h' J. M( T

9 E9 S6 j' E. l5 E2 G% Z) Q( E1 w( l; i

7 Q0 ^& J2 w" W/ q3 N4 h3 T (setq pta (getpoint
# L$ Z! \: j- V: Z* J  d5 q5 o    "\nPick first corner. : "))# U' c  l2 ?" ?2 a
  (setq pt (getcorner pta* J; h2 Q9 Y9 \
    "\nPick second corner. : "))0 ]  c8 S) J- a3 U

, {9 G+ ^# b- p/ `, O5 _- g( C; ^/ H% _- r
4 ~( e. d  h, o% V& x# O1 h) N
  (command "TEXT" "j" "M" "25000,19800" "0" (SETQ pt ' "STT") ) (princ)9 s) B4 L0 z( R% Z, l! P. M2 U6 k' k+ K
0 y1 p" B9 Y" R1 ]) K0 c- ~
  (command "TEXT" "j" "M" "25000,18712.5" "0" (SETQ pt ' "1") ) (princ)
8 z( W7 R7 W& F# p% w+ I4 Q' J, ?: b( |4 l+ C
  (command "TEXT" "j" "M" "25000,17537.5" "0" (SETQ pt ' "2") ) (princ)* Z. |: x. V8 k+ d+ ]2 F' V

# c2 T; P* H0 K# t4 _/ Z+ ?) y
; ^/ F+ V. P4 X- k" t3 o  (command "TEXT" "j" "M" "27250,19800" "0" (SETQ pt ' "Ngµy Söa Hå S¬") ) (princ)
6 E% \7 W8 R# c- V4 R5 y: Y$ s1 R8 _- ~8 a1 h( `/ b  ]% p+ k
  (command "TEXT" "j" "M" "27250,18712.5" "0" (SETQ pt ' "15.05.1997") ) (princ)
" k) v, P% w& l
3 P& [. \* ]. v4 X, u  (command "TEXT" "j" "M" "27250,17537.5" "0" (SETQ pt ' "04.07.2026") ) (princ)
5 x" y  X6 r$ |' S, e0 @9 x3 K! l+ j" Q
+ q, y4 V& t' b
  (command "TEXT" "j" "M" "26750,16600" "0" (SETQ pt ' "C¤NG TY - Corporation") ) (princ)( R1 M. ]! e, i& A1 Y0 k

1 y' U) q. s( p3 N% q  (command "TEXT" "j" "M" "26750,16016" "0" (SETQ pt ' "ZENNI.S.Z.T.K") ) (princ)
: V  s$ ~3 G& s$ n9 x- w7 \/ ?$ D% X* F4 J* ?( F) T
  (command "TEXT" "j" "M" "26750,15433" "0" (SETQ pt ' "§Þa ChØ C¤NG TY") ) (princ)
+ h5 V) [5 K" c
" t9 F3 _: a4 z  (command "TEXT" "j" "M" "26750,14850" "0" (SETQ pt ' "§Þa ChØ : 00.00.00.00.00") ) (princ)# ^7 i; [( i2 Q

6 R1 D# ~: C; {& t, ^4 T; R
6 w4 Y  X. y! k; r* d  (command "TEXT" "j" "M" "26750,14100" "0" (SETQ pt ' "H¹ng Môc : Part Project") ) (princ)8 r- J% X2 l/ W# v' A
% e& V+ n, Y2 @7 L) u8 o& b: N
  (command "TEXT" "j" "M" "26750,13516" "0" (SETQ pt ' "Nhµ ë Gia §×nh") ) (princ)
$ Y1 t/ g9 e6 I  I, B" U: u) q$ P' p& w; f9 p* Y" D! s# Z# J
  (command "TEXT" "j" "M" "26750,12933" "0" (SETQ pt '  "Nhµ LiÒn KÒ") ) (princ)8 Q; U+ I4 r+ y5 H4 d8 y

# Q2 X( r& ?7 O9 U3 R/ m3 ~  (command "TEXT" "j" "M" "26750,12350" "0" (SETQ pt ' "Tel : 00.00.00.00.00") ) (princ)5 o' v+ \, B; b$ P+ ]
( O& W" C; x: g# h$ U- |5 h6 c6 E

1 O5 g* m0 a# C3 k5 d6 o) B" E  (command "TEXT" "j" "M" "26750,11600" "0" (SETQ pt ' "Gi¸m §èc : Director") ) (princ)9 x3 M* |! s9 o" m' O) q2 N& ?5 _9 B- Q

" S+ \( X" R" U' {: ^6 s2 f5 {  (command "TEXT" "j" "M" "26750,10475" "0" (SETQ pt ' "ZENNI.S.Z.T.K") ) (princ)5 W2 s7 z4 N7 p

6 g1 c8 \6 s" _6 F  (command "TEXT" "j" "M" "26750,9725" "0" (SETQ pt ' "Chñ Tr× : Main Project") ) (princ)
' J  ^# O  O) j3 R+ @0 M* ~
/ t! z* J& H$ e) Y" W2 [  (command "TEXT" "j" "M" "26750,8600" "0" (SETQ pt '  "Kts. TrÇn Ngäc Th¾ng") ) (princ)8 O0 l! U2 |0 W: U# ~7 g& t  Q

1 e. J- X( M1 ?+ i, _* K  (command "TEXT" "j" "M" "26750,7850" "0" (SETQ pt ' "ThiÕt KÕ Vµ VÏ : Design") ) (princ)
& [# H, L0 F8 _% V* x
* u( t5 ]3 i( ~1 ]1 d  (command "TEXT" "j" "M" "26750,6725" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)
% m0 l! r9 W, T  X2 S+ z' X$ G5 E0 m# P$ Q
  (command "TEXT" "j" "M" "26750,5975" "0" (SETQ pt ' "KiÓm Tra : Checking") ) (princ)
! t3 t8 d: t) Y" p/ a, U! {  Y' [/ J2 w& p" T. P3 }
  (command "TEXT" "j" "M" "26750,4850" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)% t' H7 u* R+ _! ?0 ]% f. U+ x
) X& x+ c: a- H0 C5 s8 k. s

5 `$ ]5 `5 [0 i/ D4 [+ ]
2 i; }) s) n0 r( Z3 t$ A  (command "TEXT" "j" "M" "25625,4100" "0" (SETQ pt ' "TØ LÖ-Khæ") ) (princ)
7 d$ B- s2 t$ P! x3 R# N' v# u3 V/ B* ?4 a
  (command "TEXT" "j" "M" "25625,3600" "0" (SETQ pt ' "1:75 - A4") ) (princ)
+ q) {8 Q4 W) x" w% l
( o& n; `" ~# d/ H+ r  (command "TEXT" "j" "M" "27875,4100" "0" (SETQ pt ' "Ngµy Xong :") ) (princ)  L) c7 }6 M9 w8 E( m0 c
. U3 {* G" i$ l7 ]7 @" J  I+ X' S
  (command "TEXT" "j" "M" "27875,3600" "0" (SETQ pt ' "2026.07.04") ) (princ)8 Q1 g6 T) R" |' g3 z5 X# E

9 P7 ~& q7 H- j3 S3 T  (command "TEXT" "j" "M" "26750,2850" "0" (SETQ pt ' "Tªn B¶n VÏ :") ) (princ)" u" D, r# {' G: [% k. O
3 y. F+ G2 `, ^
  (command "TEXT" "j" "M" "26750,2300" "0" (SETQ pt ' "MÆt B»ng TÇng 1 + 2") ) (princ)4 X4 V+ K; `! D: z

! S3 n! ~8 w1 P9 i  (command "TEXT" "j" "M" "26750,1600" "0" (SETQ pt ' "Ký HiÖu :") ) (princ), S$ m7 _' X8 v  \* S7 v2 ?9 F

, [% ]! T+ l( i$ Z  (command "TEXT" "j" "M" "26750,1100" "0" (SETQ pt ' "KT-01") ) (princ)
0 p" Q+ U; \) y
4 j; m6 P. d& N  F! {  (setq ptc (list (car ptb)(cadr pta)))
0 k! C( j+ h2 y8 ^  (setq ptd (list (car pta)(cadr ptb)))7 H1 n2 j- T1 T) r: O! c$ |# C
  (setq ang (angle pta ptb)); {( [5 \6 k# f- X! @. ^5 S
  (setq d1 (/(distance pta ptb) 2)): M6 u6 Z0 g9 g! ]8 O$ P( J7 u3 I% N
  (setq cp (polar pta (- ang (dtr 0)) d1)), \) n. ^" _) @9 h9 m
  (setq X (distance pta ptc))
+ G9 o3 M$ P& O( G, [  (setq Y (distance pta ptd))9 h5 W* w- ~2 \6 W, g- h  G
  (setq X1 (rtos x 2 1))
' w, J! F; p% I1 U6 c; F0 ]; Z  (setq Y1 (rtos y 2 1))* p4 F3 o7 y  \7 _. r
  (setq rmsz (strcat "(" X1 " x " Y1 ")"))
+ Q+ v7 l. z, R7 v# H! i0 Y  (command "TEXT" "c" cp "0" CPT "_text" "" rmsz))* u9 V: t8 m1 q/ q- e
  (defun dtr (angg)
$ w8 l' q  E4 W) j  (* pi (/ angg 180.0)))
% ~$ W3 Z: Q, [3 T
4 G& ?! l$ D$ r! |8 j;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========- |: N4 d! t! W$ }+ E
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 ====================
1 p) r  k4 ?, `+ N;;; =======================Thuong Dung Font Romant.vnh===================6 a5 {. v( S+ Y  {+ t( r

. E- Z) T4 Q2 I0 n  L8 ?$ w- f(defun c:pta4 (/ pt str pta ptb ptc ptd X Y X1 Y1 rmsz pl1)& @% z8 c) @6 O1 A* l' {
  (setq oer *error* *error* err2)* i- T5 I! H9 ^2 b8 e
  (if (not h_text) (setq h_text 250)) ; Kích thuoc chu mac dinh là 2.5
2 h; f! v# A$ L: F+ E% M% o+ q! x7 G5 o! u
  (setq ht (getreal (strcat "\nNhap chieu cao chu <" (rtos h_text) ">: ")))  s# x( H) B! ^
: D4 d! u7 F: ^. }
  (if ht (setq h_text ht)); j6 F! \6 c/ h0 b, l

6 `4 l. n1 T4 Q# O7 N8 e1 H+ y% U$ h6 U$ _9 u5 c
(setq ang (getreal "\nNhap goc nghieng moi (do) <0>: "))
; [' D3 b% a  T9 E" ~! D/ F  s6 ?7 V' @& w
      (if (not ang) (setq ang 0.0))
$ v9 i. ]  x# u5 |* n5 W0 s9 n( h" u4 x

( ^- o0 a4 K9 U( Z
1 Y; V; ~/ k0 J8 v  W0 m' y (setq pta (getpoint. r% S, J1 B; j
    "\nPick first corner. : "))
  a: A( n; n/ ^9 S8 ?, G$ q$ K  (setq pt (getcorner pta
  t- l# _4 \1 ?$ {    "\nPick second corner. : "))
; {+ A, |- N6 e  D9 w; h
8 [7 T- P* I8 p5 `# m( o! G, Z- v! S0 R
  (command "POINT" "4700,2575" ) (princ)0 i6 ?4 n" ?2 c( n2 h3 x
4 G& y$ [, q) K4 M* H) I2 L
  (command "POINT" "4700,1325" ) (princ)$ u; {6 Z/ B2 A+ r- |, `5 z
4 I9 ~; v7 a5 [7 S9 T5 x7 H
  (command "POINT" "10600,2850" ) (princ)
6 y: h( g/ c. r3 h7 i% S! A
" Y) [7 @( w% @$ ^1 \  (command "POINT" "10600,1100" ) (princ)8 D* E2 X4 o: z" Y

1 e7 W. M  F2 |4 D" K# I  (command "POINT" "15250,2575" ) (princ)- ?9 K; e7 J  H; v( t  W

/ v1 r2 M) l) g/ R1 D) w  (command "POINT" "15250,1950" ) (princ)9 c! X; a! a4 g1 a5 d( \
; U- z; h' P( d" q( a6 i/ e$ j* E0 ]
  (command "POINT" "15250,1100" ) (princ)
; h/ C: _! b; L& C% Y. d1 R( ~9 e
  (command "POINT" "20250,2850" ) (princ). F) [( e( d( a5 I
. U2 r) k) ?/ \, g7 X; Q. U& u' @
  (command "POINT" "20250,2300" ) (princ)$ u" o1 [' L. r2 y4 |& q4 ~( H

0 J3 _/ ]  |* g7 y; V  (command "POINT" "20250,1600" ) (princ)
6 h' ?/ n7 @0 ^' R8 ?
" G, n: b& S& b0 R  (command "POINT" "20250,1100" ) (princ)
$ h* m/ x% F( A+ A0 @* @5 j: k4 U; Y( n3 r1 l2 m1 U
  (command "POINT" "23500,2850" ) (princ)
1 b: [, B: d3 R
$ R& n7 o* E" m3 Q  (command "POINT" "23500,2300" ) (princ)" J8 Y6 k. q$ J4 {4 K9 w8 u5 f
" L  U5 D; _2 s1 g& z
  (command "POINT" "23500,1600" ) (princ)
& H' v6 Q" e, m& E2 @4 h
* g  q3 W2 O; V2 S2 ~9 W( f2 U' A  (command "POINT" "23500,1100" ) (princ)
4 F. q6 n! P1 [
% M0 V: T% V' u& p. j/ Q7 j7 m6 ?  (command "POINT" "26750,2850" ) (princ)
# h! }- g& a6 _: h3 f- l' R: l" X( D+ N% I% {
  (command "POINT" "26750,2300" ) (princ)0 r" x" Q# J2 a+ c
- B5 b- T) `+ L( x+ ?$ X8 S
  (command "POINT" "26750,1600" ) (princ)
2 c% t, C0 ^( w7 l/ U
6 R$ c  M$ g  V; {5 y* S$ {  (command "POINT" "26750,1100" ) (princ)
/ b$ e, o. x$ D& I3 J% B% D' a8 B+ X7 ]) o1 M' k$ x! X
  (setq ptc (list (car ptb)(cadr pta)))8 E3 }: x* W* u3 c  b* P
  (setq ptd (list (car pta)(cadr ptb)))
% W6 |3 b+ J7 }  (setq ang (angle pta ptb))
) W; H, i2 B. }3 M! }  (setq d1 (/(distance pta ptb) 2)); o1 I" `6 m7 ?. `$ m5 Y  s# Z
  (setq cp (polar pta (- ang (dtr 0)) d1))
1 b8 _" V, J4 c, K# Y  (setq X (distance pta ptc))" y  h/ K" j5 _
  (setq Y (distance pta ptd))
+ j9 A+ W& q: w  (setq X1 (rtos x 2 1))
0 r8 ^6 r* k, }  (setq Y1 (rtos y 2 1))
) n3 d, J' H. Y! [$ B  (setq rmsz (strcat "(" X1 " x " Y1 ")"))
7 N3 k$ H( ?( z5 }: `  |  (command "TEXT" "c" cp "0" CPT "_text" "" rmsz))) |) v; w8 R+ J
  (defun dtr (angg)  B% F$ N6 R1 b
  (* pi (/ angg 180.0)))
$ @3 r# |0 c5 y( F# I& u6 \/ _  q- D- f# n4 i& |
;=====================================================================8 s6 [! j) z/ o9 u( e1 w! @
;====================DAT KHO GIAY BAN VE - KIEU 1=====================# }( g  v* q9 R, y( ]
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================7 C+ n1 S0 Q* ~7 y+ }. i2 O5 I9 S1 q

) ?- c' n) e0 i6 `# ~/ I(Defun c:a6 ()% ^& }3 c3 {$ D' e5 n9 A0 C# _
        (setq mv_sc 100);Ti le  ban ve
: _- Q. A2 H( A7 P      (setq x4  74.25)7 q4 K- b, w2 Y! D  }: z7 e! b: f3 h, m
      (setq y4  52.5)
- Y2 }6 Y/ b" q: I! Y* V  \  (setq x4 (* mv_sc x4)
0 B, s5 P7 ]; n/ S- P6 G        y4 (* mv_sc y4)  ), m& }$ [  u, w; [0 a! F) F
  (command  
3 v* Y% V# Z+ a1 V/ L% _( L* M    "LIMITS" "0,0" (list x4 y4)" O8 q$ X7 l. P7 O* o# a
    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"+ A# g$ M6 _& N  z" O
    "RECTANG" "125,125" "@7175,5000"
, Q: A9 N6 V; S. f    "RECTANG" "175,175" "@7075,4900"
' t: B% Y8 G7 X5 [- f' {    "ZOOM" "_a"  )); V* ]) D9 L: @  F# z
;=====================================================================; C0 y7 I0 C: g, }
(Defun c:a5 ()' [! L- h0 g. J8 f0 C+ d
        (setq mv_sc 100);Ti le  ban ve/ q5 q. j9 @6 b3 i  o. ~
      (setq x4  147.5)
0 r9 }$ T3 H3 g( o5 l7 l% ~& _      (setq y4  104)
; c; x$ z3 r0 z  (setq x4 (* mv_sc x4)
  f' q( e2 v: V        y4 (* mv_sc y4)  )
; P. V( L( B; V$ Q- W  (command  
4 R2 g  w6 q  O' o7 A& N8 d. o) b$ q    "LIMITS" "0,0" (list x4 y4)% J- I0 n5 o1 ^+ p* m. i3 v
    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
( T1 _, R+ e/ ]    "RECTANG" "250,250" "@14350,10000"3 r$ |' A" L2 R8 r( `7 @9 g* G
    "RECTANG" "350,350" "@14150,9800"& O4 w5 m1 ~: U, @- l  s8 x4 k
    "ZOOM" "_a"  ))& f2 g; |  P* c1 c
;=====================================================================
  P3 }! m& x* ~0 ~) V7 O0 W(Defun c:a4 ()6 Y, _# Y- w8 b/ u! q8 O: V
        (setq mv_sc 100);Ti le  ban ve, _" U% J3 m* G& ~6 a7 O
      (setq x4  297). {4 @! f4 F. Z
      (setq y4  210)7 Z2 R% J& J( u" }1 z
  (setq x4 (* mv_sc x4)
) ^8 l! {2 n! T8 W        y4 (* mv_sc y4)  )
6 ?! {6 c( _. q6 X8 Z/ U, m* W  (command  
6 P- u( N1 M& D* r* f! R    "LIMITS" "0,0" (list x4 y4)) C, k5 A  S% Y3 Y; [
    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
( L/ ^3 D7 b' A  P- M* A9 J0 u    "RECTANG" "500,500" "@28700,20000"
; P! R+ R9 b' f2 f    "RECTANG" "700,700" "@28300,19600"
3 |# h2 A/ \  N( t$ n% x+ b* @    "ZOOM" "_a"  ))
* o" ?. a1 g+ T6 K: K% L;=====================================================================
3 j$ r2 n% ^7 t8 Q: \(Defun c:a3 ()
6 i9 W$ e/ E% ~4 a7 i6 V        (setq mv_sc 100)) Y+ r: x# Y( o( h
      (setq x3  420)
/ `' I2 X8 X" `      (setq y3  297)$ T% ^+ d% F1 y9 j
  (setq x3 (* mv_sc x3) 2 G, a, x% P4 M& K$ O5 ^3 j
        y3 (* mv_sc y3)  )5 y8 E2 |6 m& l) T' U9 O. p
  (command  
( U% k- }5 \0 K, [" W    "LIMITS" "0,0" (list x3 y3)
9 I4 [- d5 M# `) q. w7 v! X    "PLINE" "0,0" (list 0 y3) (list x3 y3) (list x3 0) "0,0" "_C"5 _' Q- J" L; z8 ^: r, g  E
    "RECTANG" "707.14285714,707.14285714" "@40590,28285.71428571"
/ @! _% e2 R3 Y, s2 S    "RECTANG" "990,990" "@40024.28571429,27720"# z3 B# [- Q% g
    "ZOOM" "_a"  ))
( G* J8 I; a5 R8 _! D;=====================================================================7 @9 R7 w4 w0 k! B8 I
(Defun c:a2 ()9 u0 g/ L! ?" [, B! I' {. L+ ~
        (setq mv_sc 100)
1 T& l, B7 I7 P2 S0 E      (setq x2  594)
! p" V% L  D* s% A0 S( P) `      (setq y2  420)" d# [7 y; r. r6 s+ c' a- f
  (setq x2 (* mv_sc x2)
6 B) o. m# M" L- y        y2 (* mv_sc y2)  )
' d* u, L$ U9 a) D  (command  5 d$ S4 Z1 I# H7 c
    "LIMITS" "0,0" (list x2 y2); s) d3 w9 q  O% V% @
    "PLINE" "0,0" (list 0 y2) (list x2 y2) (list x2 0) "0,0" "_C"
$ W2 ~3 m1 q! R! n* E    "RECTANG" "1000,1000" "@57400,40000"
1 `$ f0 y3 X) x3 F. e    "RECTANG" "1400,1400" "@56600,39200"2 A7 Y' h$ z& E% V" ~8 B$ ~  b* k
    "ZOOM" "_a"  ))
$ ?6 U4 w6 O" U' O/ A;=====================================================================4 S* Y/ ]: x3 W6 i0 p) Q, `
(Defun c:a1 ()8 q3 `0 Z' s) _1 X' p
        (setq mv_sc 100)$ N: Q1 G% v- \7 \
      (setq x1  840)- l8 O) Y* Z0 p* |6 ^3 Q, s  p
      (setq y1  594)) M+ J9 E2 P# j
  (setq x1 (* mv_sc x1)
4 n' a3 `" v1 T9 r" u6 l        y1 (* mv_sc y1)  )
. R8 t$ X* w5 P  W8 \  (command  
1 z7 [- i7 g& q: E2 y  ^7 B# h3 D    "LIMITS" "0,0" (list x1 y1)
# A; k: v! d3 W, {    "PLINE" "0,0" (list 0 y1) (list x1 y1) (list x1 0) "0,0" "_C"
' ^+ _/ ~3 `8 ]* ~, ~/ N5 K7 I    "RECTANG" "1414.28571429,1414.28571429" "@81180,56571.42857143", Y7 ^/ m' H& q  D* G% l5 I6 m
    "RECTANG" "1980,1980" "@80048.57142857,55440") m6 w& M4 t# u% _4 y/ I" D0 ^! z: Q
    "ZOOM" "_a"  ))
/ j* B; T, x6 y6 y3 U;=====================================================================8 ?  E3 h2 B8 n5 Q) m5 U
(Defun c:a0 ()+ j1 T  `; \/ \' U% z
        (setq mv_sc 100)! F" v9 k) p$ _
      (setq x0  1188); z: S( G/ ~: {& {5 ~0 o8 z
      (setq y0  840). V; n; F( ^: @5 R# T4 c3 r4 S4 r/ {
  (setq x0 (* mv_sc x0) ' d7 X3 O/ a6 c. o5 u+ m9 g
        y0 (* mv_sc y0)  )
+ |$ [8 l7 U9 O/ ~. l1 ]/ n6 i- O  (command  
/ L7 e" W! q9 _+ _    "LIMITS" "0,0" (list x0 y0)! ], o1 q% d# f8 d6 s& F
    "PLINE" "0,0" (list 0 y0) (list x0 y0) (list x0 0) "0,0" "_C"9 t: _- a4 T7 D: z
    "RECTANG" "2000,2000" "@114800,80000"
+ D* N1 `2 i* z$ b) L8 T6 ?4 E/ i    "RECTANG" "2800,2800" "@113200,78400"
2 Y% ^% p+ O9 z3 }* ]    "ZOOM" "_a"  )), h# z; C! Y/ ~- F

' K, Y8 x( {& k7 L;=====================================================================
0 U$ N; x7 P% x% Z;====================DAT KHO GIAY BAN VE - KIEU 2=====================+ P+ V( L* N# y6 V& ~+ B
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
$ E" {; E2 \) p
0 m4 V- h! r9 u3 x" r(Defun c:6a ()
6 x% q' r) m( {  `* Y) ]        (setq mv_sc 100);Ti le  ban ve
: F  s/ d1 f4 V0 Q      (setq x4  74.25)! o4 r; A* c/ f# O! Q$ O; v
      (setq y4  52.5)
- V6 |; h+ K3 V2 o" G& O" B) X  (setq x4 (* mv_sc x4) 5 d9 @) j. a; s5 n) N: \% n! u
        y4 (* mv_sc y4)  )
, C* N( Z- u  l; X  (command  
, o5 W8 k+ B+ _* V    "LIMITS" "0,0" (list x4 y4)
7 I6 q- F) i0 e' f4 \8 h  o    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"9 k3 T: Y! h4 v! E$ s
    "RECTANG" "505,125" "@6800,5000"
3 s8 g# M9 [) v3 s7 b- f3 `    "RECTANG" "555,175" "@6700,4900"
" `+ T$ f- q$ u4 X& M/ ^    "ZOOM" "_a"  ))
% f/ j5 J$ a+ a* N0 x5 g) C;=====================================================================
# i1 c1 y* @8 F! N6 K$ t* B  S(Defun c:5a ()8 d' T, f; d& S3 Q! V4 q
        (setq mv_sc 100);Ti le  ban ve. b% E* Z0 X4 D3 d, ]. x/ ~
      (setq x4  148.5)& V7 m4 m# x5 ~! G5 U' R
      (setq y4  105)9 T: [: x) D* f% L$ U; `! K/ K
  (setq x4 (* mv_sc x4) * b; x4 R& h1 b+ Y
        y4 (* mv_sc y4)  )" v0 A/ i; r  [! q% D: k
  (command  
/ t5 ^6 s- W0 F9 g# t2 B# Z    "LIMITS" "0,0" (list x4 y4)% I8 {; H# P3 C& q% p
    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
; p5 t* x7 m* W# }: J5 H    "RECTANG" "1000,250" "@13600,10000": h9 g7 c4 |' u
    "RECTANG" "1100,350" "@13400,9800"
( h& A' _' w7 d. H    "ZOOM" "_a"  ))
) E- V' {. K7 c9 x; K4 q;=====================================================================
) o+ l3 B" A" C, O; a(Defun c:4a ()# o  \  U2 g( p% N2 ^, Z$ C0 E
        (setq mv_sc 100);Ti le  ban ve2 I% N6 J2 U; o- y) S
      (setq x4  297). f) Z$ k$ [1 T0 z, n' y- [
      (setq y4  210), \/ ^: ]& v8 a% n% g' O
  (setq x4 (* mv_sc x4) 5 ]: j* H: u' s& ]
        y4 (* mv_sc y4)  )4 p' Y- n4 Z" N/ Y& o5 v; w
  (command  
* u2 R! t, j, d1 X. S    "LIMITS" "0,0" (list x4 y4)
/ z. R- `5 b6 q  _3 k$ K) i    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
' F" T! b+ u: H) {" w. K    "RECTANG" "2000,500" "@27200,20000"
& H' z5 |" K& O, c8 u3 R1 j    "RECTANG" "2200,700" "@26800,19600"2 t/ f: F2 j* \7 m& s* ?+ r
    "ZOOM" "_a"  ))
5 E* ?: m0 }7 F" S;=====================================================================
/ Y2 w4 J) r# X: k) h7 }(Defun c:3a ()
) J8 K2 {7 N- T  d7 \0 `  @        (setq mv_sc 100)
* T% Y3 K4 [* V      (setq x3  420.0428571429)
" V& A- n. S- l4 F5 H; j      (setq y3  297), L6 ]" c9 T) u/ K3 _
  (setq x3 (* mv_sc x3)
* N; u% L, ?) K# I        y3 (* mv_sc y3)  )
- ^- K6 d0 B1 q9 ]  (command  1 L0 I8 Q  h  ]( X" X
    "LIMITS" "0,0" (list x3 y3)
0 C! r1 J# k) q, o. ]' Z7 i) X/ [* f    "PLINE" "0,0" (list 0 y3) (list x3 y3) (list x3 0) "0,0" "_C"; K2 m6 ]) [7 q! a( b5 g
    "RECTANG" "2828.57142857,707.14285714" "@38468.57142857,28285.71428571"! w, h3 C6 C. L) {) J! a+ z
    "RECTANG" "3111.42857142,989.99999999" "@37902.85714287,27720.00000001"4 o* \7 k  g( z2 g8 z
    "ZOOM" "_a"  ))1 T( o7 }  U2 h" L1 P7 V
;=====================================================================
9 q" X9 Q, Q5 E% U! R3 _; c(Defun c:2a ()
( Z1 Z% {3 M& {2 h        (setq mv_sc 100)2 F4 h3 }4 @8 k7 p
      (setq x2  594)& k* Y! _, I" C7 u, s) s* E9 t
      (setq y2  420)5 ?6 N1 A& T5 W) o6 P4 v/ h
  (setq x2 (* mv_sc x2) 4 v7 H' T( g& v' ?9 m
        y2 (* mv_sc y2)  )
5 t* ~0 g' Q# y$ j' J% H  (command  5 [' I) ^& s+ x. S; t+ V! I
    "LIMITS" "0,0" (list x2 y2)
- k! Q% e  @. i) p! ~    "PLINE" "0,0" (list 0 y2) (list x2 y2) (list x2 0) "0,0" "_C"' I4 n/ N6 |1 K4 d8 g4 v
    "RECTANG" "4000,1000" "@54400,40000"" H7 I9 Z, S( x
    "RECTANG" "4400,1400" "@53600,39200": Z# p5 q8 s  l+ d
    "ZOOM" "_a"  ))
( r3 m# s4 Q5 Q, [;=====================================================================0 Q+ D* ]$ T' P3 x0 ?0 y1 z
(Defun c:1a ()
0 f4 I: {+ _1 A  v$ X        (setq mv_sc 100): ?- d7 W6 J7 D* ^  O8 y' k  T; i
      (setq x1  840.0857142857)
4 p/ J* E4 h4 e; b      (setq y1  594)
0 d( q, O( h6 \, E. @% `6 b  (setq x1 (* mv_sc x1) 1 L# _. V) r, {# Y$ j
        y1 (* mv_sc y1)  )
! o& j2 x# E' [5 o  (command  9 G/ c. m( u. o: u! T0 i
    "LIMITS" "0,0" (list x1 y1); x$ H; Q6 Y  }; p
    "PLINE" "0,0" (list 0 y1) (list x1 y1) (list x1 0) "0,0" "_C"
3 \3 e9 r1 `( ?4 q. d/ P0 j% B+ x) F    "RECTANG" "5657.14285714,1414.28571429" "@76937.14285714,56571.428571436"
1 [# H* ]! H- v; o" K    "RECTANG" "6222.85714286,1980.00000001" "@75805.71428570,55440"/ \: G. _" f7 r: \+ H* p/ L
    "ZOOM" "_a"  ))
2 G3 p) g. j1 N; C. i) x$ M( K3 x;=====================================================================; W6 T' F1 j) k, s
(Defun c:0a ()
, F! W: W' |# @' A/ p* s0 i        (setq mv_sc 100)
! D0 e# C4 O. B3 w4 }      (setq x0  1188)  v$ A* G9 v: T3 {  ]
      (setq y0  840)
% H9 `6 l( w9 C" X" i$ J7 J, \  (setq x0 (* mv_sc x0) ! H+ M5 X1 b) S1 S
        y0 (* mv_sc y0)  )
- ]5 ^  b: \- q1 U& c6 A  (command  4 O; `' S- a" u8 U" z0 Q
    "LIMITS" "0,0" (list x0 y0)* m- p' ]) Y% T! s3 z8 N
    "PLINE" "0,0" (list 0 y0) (list x0 y0) (list x0 0) "0,0" "_C"
6 U# E4 P1 v. t2 H4 D, c5 o    "RECTANG" "8000,2000" "@108800,80000"2 U  j' V1 ~0 w  ^( l  L# C
    "RECTANG" "8800,2800" "@107200,78400"
8 Y1 v6 w0 A# ?7 [- [    "ZOOM" "_a"  ))
9 V( f/ b) V; j1 T7 M; c; d0 S# ]! Y
- I- @# a: B; W1 |0 l  A5 h( G! B;=====================================================================
: B- o! F4 \' P2 A;==================DAT KhoGiay Theo KHO GIAY BAN VE===================
+ \0 Q3 x0 L' {  ^1 o+ V: d;=========================== Nguoi Khac ==============================9 C6 q! n2 P8 _' b: c
(defun c:khogiay (/ oldlst a b c d e f g h kho TL)% f" J/ J* ^% z1 z: g
(command "undo" "be")* g6 A; P4 w/ L& [6 b7 q
(setq oldlst (mapcar 'getvar (list "CMDECHO" "OSMODE" "cecolor")))
% ^8 V0 _' [  z; @2 l(setvar "CMDECHO" 0)( v) D$ X) w( n7 q; w$ a% g4 i
    (setq a (getpoint "\n chon diem chen :"))8 W9 c8 Y3 p! W5 h
(if (not TL) (setq TL 1.00))0 O  d; e6 E0 U2 C4 f+ D
(setq TL1 (getDIST (strcat "\nScale <" (rtos TL 2 2) ">:")))" L' Z0 @+ T3 Y- J4 `1 y9 p  Y) t1 W
(if TL1 (setq TL TL1))
, |7 e2 G# ~6 C( C% [- [(setvar "osmode" 0); O# I, R( T$ J8 [1 g" A+ G
(if (not (tblsearch "layer" "Defpoints")) (Command "layer" "N" "Defpoints" ""))" V" w& J; Z+ G
(initget "0 1 2 3 4")
; Y/ y, G" p) `& m, t& ^' O# H       (setq kho (getkword "\Kho A0 _ Kho A1 _ Kho A2 _ Kho A3 _ Kho A4 [0/1/2/3/4]? <0>:"))
  p& W. I8 m, d; U) i* H6 { (if (= kho "0")
+ Z2 D' N( J* y: I; I5 I+ X9 e7 H8 p     (progn/ m; X) b: C6 u0 A8 T3 H9 ^& }
             (setq b (polar a 0 (* TL 1189)))
- w% @* u/ I; R6 Z- ^                     (setq c (polar b (/ pi 2) (* TL 841)))
; d) E; R+ k- w" w4 ]. Y- Q                     (setq d (polar a (/ pi 2) (* TL 841)))
: D3 Z# H( @9 T9 K1 Q9 k- A4 O' d             (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 12 12))))). j$ U4 ], Q# P! X9 N2 L+ @
                     (setq f (polar e 0 (- (* TL 1189) (* TL 24))))8 I: \* C6 z' Q2 C0 y9 ^$ ~7 [. P
                     (setq g (polar f (/ pi 2) (- (* TL 841) (* TL 24))))( V! j' ^% A# {" Q' \6 Y! d1 M8 Z. l
                     (setq h (polar e (/ pi 2) (- (* TL 841) (* TL 24))))
2 v1 b5 H. t& j( ?3 n  (command "Pline" e f g h "c")            
+ @! Z! N$ o5 d3 ^(command "change" "last" "" "properties" "layer" "0" "")
6 u/ o, {% c& ](setvar "cecolor" "4")
8 g* U2 V9 j8 i; J! |  (command "Pline" a b c d "c")8 ^# i' F' r0 z) c
(command "change" "last" "" "properties" "layer" "defpoints" "")))    " ]- J  U# }- {$ y' o& s. d9 l3 U' r
(if (= kho "1")3 E, m' p% ~" R' h
     (progn6 |% D7 q& [( j! }: t
             (setq b (polar a 0 (* TL 841)))
% [8 c! L5 H6 m& a' W7 G                     (setq c (polar b (/ pi 2) (* TL 594))): ~8 M1 n3 e: O9 V% C5 X! [
                     (setq d (polar a (/ pi 2) (* TL 594)))# Q) F% A* f: u& I7 l
            (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 12 12)))))7 e5 J8 i$ W% E
                     (setq f (polar e 0 (- (* TL 841) (* TL 24))))
4 f& {5 c4 W. b/ [$ F                     (setq g (polar f (/ pi 2) (- (* TL 594) (* TL 24))))
: h8 t, S8 F5 k5 o  v, _                     (setq h (polar e (/ pi 2) (- (* TL 594) (* TL 24))))
* [+ _) H; H6 I5 j* \9 G  (command "Pline" e f g h "c")            9 T% r" Z, k/ b8 r! d2 s( ?( f
(command "change" "last" "" "properties" "layer" "0" "")2 ?8 p0 Q& ]: {7 `5 w
(setvar "cecolor" "4")
6 l4 z  |7 w# w- U% S  (command "Pline" a b c d "c")
  M$ e1 `$ b0 Y$ L4 ^(command "change" "last" "" "properties" "layer" "defpoints" "")))  B7 N6 P# i1 _3 V2 u' F
(if (= kho "2")
& N' M7 I2 |% }- F4 V     (progn% \- x. a+ a: t+ e
             (setq b (polar a 0 (* TL 594)))* h; P: Q$ X! [! V
                     (setq c (polar b (/ pi 2) (* TL 420)))2 {! C/ H$ l' n
                     (setq d (polar a (/ pi 2) (* TL 420)))
5 F+ O0 c2 N1 I! D; }3 C# _             (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 100)))))
+ T8 }3 Z3 [" `* M+ P. T, ]- s                     (setq f (polar e 0 (- (* TL 594) (* TL 20))))
/ g; b& a; Y( Q4 O$ C; i9 ~, G                     (setq g (polar f (/ pi 2) (- (* TL 420) (* TL 20))))
/ t# x1 \! @8 j                     (setq h (polar e (/ pi 2) (- (* TL 420) (* TL 20))))" a- U" _% u0 B" {7 V. Z. H5 w! g
  (command "Pline" e f g h "c")            
) g4 p+ c4 {2 D$ m# p: O(command "change" "last" "" "properties" "layer" "0" "")
+ w- c0 Q5 A/ p" Z1 ~0 \% ~(setvar "cecolor" "4")
$ z+ p  R, i1 P7 z* O( g  v& Y9 M  (command "Pline" a b c d "c")
, x) O: q5 @0 L+ @0 J/ a( D" N& ?(command "change" "last" "" "properties" "layer" "defpoints" "")))
6 C' P+ u) C2 D- C! y (if (= kho "3")
/ |& g( Q2 g6 y. f+ R/ c' W$ }     (progn
4 I1 D+ W; L) u) Q3 u             (setq b (polar a 0 (* tl 420)))
/ ~* W2 s% y  I1 c1 L5 ~0 k                     (setq c (polar b (/ pi 2) (* TL 297)))
9 h; H' n: o8 {% u, i% b1 @/ L4 q' x6 g                     (setq d (polar a (/ pi 2) (* TL 297)))
4 k8 i' `* O) N- L$ {             (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 100)))))6 p+ ?9 z; i, L( N
                     (setq f (polar e 0 (- (* TL 420) (* TL 20))))
: s) V* Q- B7 V# r0 I9 D                     (setq g (polar f (/ pi 2) (- (* TL 297) (* TL 20))))8 E( ]& P, p- a) Q. m8 q
                     (setq h (polar e (/ pi 2) (- (* TL 297) (* TL 20))))
1 {, `! \4 H- v1 N! U1 |! y(command "Pline" e f g h "c")
% [1 k: h# r% `  (command "change" "last" "" "properties" "layer" "0" "")  O9 G# y  G# a+ q0 S7 T0 m, M% @
(setvar "cecolor" "4")
. w2 b# O- }7 H& s(command "Pline" a b c d "c"), I" W0 y$ m7 {0 p1 X
  (command "change" "last" "" "properties" "layer" "defpoints" ""))). ^5 e& H6 o9 B9 ~
(if (= kho "4")2 g) l4 O# U7 l& ~3 Y& [" |
     (progn
/ l7 m5 J" r7 B4 n0 T             (setq b (polar a 0 (* TL 297)))6 ]! A3 X2 k, N  X
              (setq c (polar b (/ pi 2) (* TL 210)))7 D( y7 w# @# `6 ~$ F, E& e
                     (setq d (polar a (/ pi 2) (* TL 210)))
5 E. g+ m* |/ t3 Q            (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 81)))))) e1 D# T. Q* F' F9 J0 D6 h8 ?
                     (setq f (polar e 0 (- (* TL 297) (* TL 18))))! Q5 a. a$ Z" S. y" @
                     (setq g (polar f (/ pi 2) (- (* TL 210) (* TL 18))))  w$ d4 H/ k; U
                     (setq h (polar e (/ pi 2) (- (* TL 210) (* TL 18))))
& r8 H( ]0 s9 }# W2 p& n* G+ _  (command "Pline" e f g h "c")            
1 q3 l# J2 w) `9 K7 i(command "change" "last" "" "properties" "layer" "0" "")
4 l6 b$ ^& U7 a6 u5 G  [( _* G(setvar "cecolor" "4")
7 U% I; S0 ^4 L- s1 b  (command "Pline" a b c d "c")
. B: Z! `0 C$ @9 o" ]5 U(command "change" "last" "" "properties" "layer" "defpoints" "")))
, p+ e' K& ~$ a0 x( N9 W; U3 L(mapcar 'setvar (list "CMDECHO" "OSMODE" "cecolor") oldlst)
" F' A9 E$ I! z2 J( Z' O. i(command "undo" "e")
4 Q, R  d# W  r& P2 Q( R(princ))
& ^8 g5 o4 V; J4 F6 F( [( U;=====================================================================
6 l* T( D7 i: w;==================DAT KhoGiay Theo KHO GIAY BAN VE===================
) `, b$ R2 J# m8 M' v0 R' _6 @;=====================================================================! u5 _3 v3 A0 D! s5 Z1 p8 _- _) ~
3 F0 _8 o6 o5 v) g7 b4 C( `
;=====================================================================
# I( C5 x. e6 i- ?;===================DAT Ti Le Theo KHO GIAY BAN VE====================
1 A" j' Q7 u# q;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
' Y2 q" U( O5 w+ ?$ M5 o& @; ]# ~& f5 a
(DEFUN C:SA6 () (setvar "DIMSCALE" 411.11111)
+ {8 w8 w5 @& \                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.1" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "5" ""
/ F/ y9 g1 W4 m, Z5 _8 ^* l0 A                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.3" ""
# n) I9 ]" B6 I. j5 @                                           "M" "MANH" "C" "9" "" "Lw" "0.1" ""% ?0 q/ p& O2 P9 d
                                       "M" "TEXT" "C" "7" "" "Lw" "0.12" ""4 J3 l9 d7 \5 z) X" r8 [. ]
                                       "M" "DIM" "C" "1" "" "Lw" "0.12" ""
  j# X; A5 F8 a, {' J& I                                       "M" "THAY" "C" "7" "" "Lw" "0.2" ""
* L/ d! M& u; z/ ^                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.12" ""
4 N$ |  X& \; E4 _# X+ |                                       "M" "HATCH" "C" "5" "" "Lw" "0.1" ""! w% L- X3 @; _  w( r' R
                                       "M" "COT" "C" "1" "" "Lw" "0.3" ""/ E0 b- F% z& e7 D# E( ?
                                       "M" "Defpoints" "C" "7" ""
  b: Q3 @+ w; F2 R                                       "M" "0" "C" "3" "" "Lw" "0.12" ""; A" Q. O& t) i7 A1 T0 f( t4 |
                                       "M" "CUA" "C" "6" "" "Lw" "0.12" ""
) p0 Y+ G8 {6 Y7 o) A% T. H                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.12" ""
7 V  i+ Y! ?) C3 j2 h# l2 R; V                                        "M" "DAY-DIEN" "C" "3" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1". G* z% P  m: M: I2 s. Q
                                       "M" "NETDAM" "C" "4" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"
0 u! [% m! [  y, r- `- X                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"$ a# s( {/ g7 L  m+ t6 W2 e; y
                                       "M" "NETMANH" "C" "43" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"$ j2 _$ l3 u, p# [9 I: T- k
                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"5 Q2 X( u1 z% x0 j+ c. b  h; q. s
                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"4 e5 [$ s; H$ L8 c
                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"
* a* j: m+ T. I: i, W                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"
- q: O. E: ^* z4 q1 f. v                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
) k$ a8 a* L; |1 }& H1 q                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.20" "" "LT" "Continuous" "" "" "LTSCALE" "1"% U. f. i6 H/ X. `3 D
                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"
) D8 y: Y' f0 T! `# ~$ ]) d                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.4" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"$ F. G( X- z/ C' `
                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.4" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"/ Z0 m& p8 k5 l0 c
                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"# g- t! d9 |" A4 _+ A( Z: s
                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.1" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "3" ""))(princ)
$ ^" U0 H  s, o(DEFUN C:SA5 () (setvar "DIMSCALE" 611.11111)+ Z  K" F! o$ z
                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.12" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "10" ""( Q9 A: o4 e# v6 ?  w* o4 Y
                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.4" ""4 s3 M9 r+ }: {/ ]( ^' e. U
                                           "M" "MANH" "C" "9" "" "Lw" "0.12" ""+ Z; i) n" B; Z7 @
                                       "M" "TEXT" "C" "7" "" "Lw" "0.12" ""0 r$ m5 Q& ?' o: _% ]
                                       "M" "DIM" "C" "1" "" "Lw" "0.2" ""; {* A+ `- R# Y) j. e5 f
                                       "M" "THAY" "C" "7" "" "Lw" "0.2" ""7 H( f& j8 ~' E+ G$ L7 U
                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.2" ""$ @  `. @2 x3 k* ?9 R* M$ L; V
                                       "M" "HATCH" "C" "5" "" "Lw" "0.1" ""
' S" c/ W& z+ R- d5 ~' q! D- G                                       "M" "COT" "C" "1" "" "Lw" "0.4" ""- B9 w$ p* f# k2 T$ V
                                       "M" "Defpoints" "C" "7" ""8 c6 n# A' s8 b& [% c
                                       "M" "0" "C" "3" "" "Lw" "0.2" ""! x4 B* s7 e8 Y7 o
                                       "M" "CUA" "C" "6" "" "Lw" "0.12" "": N  k3 M4 r" [% ?
                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.12" ""
1 S; _( Y5 M+ ^7 \( I; P! X( A                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"
. h/ ]8 n3 a7 q. ~5 n5 g9 f# f1 F                                       "M" "NETDAM" "C" "4" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1", l2 _; O9 j5 ]! `' f, F7 B* N2 k% w) h- j
                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"0 }8 L" i4 y; N4 b; h
                                       "M" "NETMANH" "C" "43" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"
/ }' X  G" v4 X; U6 Z5 z                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"3 m1 f$ p2 k0 k5 ?6 f2 s; b* y
                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"
; e0 k% w0 I% V1 X9 z                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"8 l2 {' M! o( D( c9 S( D/ R! V- f
                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"
* g' N' D/ K* g' N$ g                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"' l5 S0 D/ Z$ c2 `
                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.40" "" "LT" "Continuous" "" "" "LTSCALE" "1"6 W; q1 J' D3 Q1 j
                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"1 I) L+ s/ }; y4 R$ h3 e
                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.5" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"
" k- h0 y" p/ m6 u                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.5" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"
' g' }+ T0 c* x7 _2 H' v                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1", p- P/ F3 |* A: N5 g3 w' ~
                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.15" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "5" ""))(princ)
8 W9 b, R* e9 H4 h! d! O(DEFUN C:SA4 () (setvar "DIMSCALE" 1411.1111)8 m0 i5 T' e! r. \8 {! T6 T% }. t
                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.2" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "20" ""
1 y* }1 _9 n: I  ]  E$ X. s                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.6" ""8 ?, G6 p) |* c4 X: i
                                           "M" "MANH" "C" "9" "" "Lw" "0.2" "") }4 s- A8 W" h/ R2 u9 H3 O( N" C2 ~
                                       "M" "TEXT" "C" "7" "" "Lw" "0.2" ""
! M7 @: u* i0 I) I" B* y3 \1 Q                                       "M" "DIM" "C" "1" "" "Lw" "0.25" ""
2 Y) \/ g! l& U% m                                       "M" "THAY" "C" "7" "" "Lw" "0.35" ""
% G* e2 x3 f' l* z  A5 h                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.25" "") `+ q) |4 C& h: o3 h% ~8 Q1 T5 h+ L
                                       "M" "HATCH" "C" "5" "" "Lw" "0.15" ""
4 W) N' p. Z3 u6 m                                       "M" "COT" "C" "1" "" "Lw" "0.6" ""# v6 R2 C! z: n
                                       "M" "Defpoints" "C" "7" ""
4 S# R$ s1 `/ Q5 k; e3 A# @. w                                       "M" "0" "C" "3" "" "Lw" "0.25" "", y5 R: a  L9 L, D" e2 S
                                       "M" "CUA" "C" "6" "" "Lw" "0.25" ""5 P4 Q9 J: {. ]: x1 R  L
                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.25" ""
) T1 ?3 U# W$ ^  H                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
/ v% ?) B+ e1 D# x. s, K% ~                                       "M" "NETDAM" "C" "4" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"' B& n& K1 w2 Z. \: H( ?
                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"
+ N0 f7 \/ W4 ~8 |' q) W. X                                       "M" "NETMANH" "C" "43" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"0 V0 d; V! ~8 ?/ w+ g: m
                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
) z7 ]. n( |3 c0 z" O                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"/ u7 E# d+ l) z! n# x+ a3 J2 C5 C
                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"( B; ?! `" U5 B4 [- ^
                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
2 |0 m5 |* p  G# F; o: g0 K2 f                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"8 Z& _5 R6 M/ }
                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.58" "" "LT" "Continuous" "" "" "LTSCALE" "1"
: `$ ?6 R5 @/ P/ C* h                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
: S* ~2 H, W# T6 j% f% c) }                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"
  ]" `6 T7 n4 Q4 s$ p/ }6 |, B8 g; z                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"
, P8 P$ u8 v5 {) Y) o# N                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1.00" "" "LT" "Continuous" "" "" "LTSCALE" "1", }( b; K) w7 s/ J3 U
                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.2" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "10" ""))(princ)
4 ^% p; X! p; t% g+ _2 Y& Y        & X) J  U; h: q& w  w
(DEFUN C:SA3 () (setvar "DIMSCALE" 1611.1111)
: |) i. o' m* c. s' M                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.35" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "30" ""( Y: O, P; Q! ~: s# l1 t% w
                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.7" ""* R3 k5 O) E5 R6 y' t: F
                                           "M" "MANH" "C" "9" "" "Lw" "0.25" ""3 h; @1 H, w: H2 q
                                       "M" "TEXT" "C" "7" "" "Lw" "0.2" ""
" P: @2 Z3 E7 {$ P8 B: x                                       "M" "DIM" "C" "1" "" "Lw" "0.35" ""
3 w/ a. A# |8 T5 z3 Z4 G                                       "M" "THAY" "C" "7" "" "Lw" "0.4" ""7 q3 m' G- p+ g
                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.25" "", P: T6 Y" i2 Z' S
                                       "M" "HATCH" "C" "5" "" "Lw" "0.2" ""7 w7 f& P0 w- T+ ^4 F8 G
                                       "M" "COT" "C" "1" "" "Lw" "0.7" ""
6 \) P  X; f, k* Y+ y2 y( t. h                                       "M" "Defpoints" "C" "7" ""
  V$ y0 X7 [, z; C                                       "M" "0" "C" "3" "" "Lw" "0.25" "". R# H" ]$ n3 A4 }
                                       "M" "CUA" "C" "6" "" "Lw" "0.35" ""' p' H+ |4 I' w. o; }4 Z) H0 b
                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.3" ""
+ ?9 X5 z! n/ s6 e2 i                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"% s' c/ p) Y* Z' a) ^: H
                                       "M" "NETDAM" "C" "4" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"' Q4 v  `5 R1 t6 @
                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"
8 ^8 m1 @% j! s% Y' l  o                                       "M" "NETMANH" "C" "43" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
, ]# z# L) e8 j) @                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
& d9 v1 r4 m/ `. k( i                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
0 q  p; [0 ]* J3 F( H8 U5 p9 G                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"; v( o3 M4 E: k$ h6 y
                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"9 C, I8 X- l3 r! h( x
                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"$ s  E! _, L! b3 ^+ _
                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.58" "" "LT" "Continuous" "" "" "LTSCALE" "1"/ p4 z. d0 p0 F+ \, r3 e3 i- U
                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"# ]4 U/ V% R4 [+ p7 X
                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"8 |2 C3 {# ?" O- @' B, H" P
                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"" h( |! _- I0 i! n
                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1.00" "" "LT" "Continuous" "" "" "LTSCALE" "1"3 y% u3 u$ j; M1 \
                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.25" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "20" ""))(princ)9 Y0 k4 V  L: [; s3 M  S: n
7 j' k- I6 _- p2 Q" c8 f
(DEFUN C:SA2 () (setvar "DIMSCALE" 4111.1111)
7 P8 E9 j/ n6 D9 X6 z: f                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.35" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "45" ""
7 J8 P  Q* k" ?1 }: z. C                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.7" ""1 L' ^! G! ]4 j0 I
                                           "M" "MANH" "C" "9" "" "Lw" "0.25" ""
& @5 {. {7 ~9 G; k5 ]) V- ]                                       "M" "TEXT" "C" "7" "" "Lw" "0.25" ""
8 V. `! m9 @- k$ |" U6 Y6 |5 ?; h                                       "M" "DIM" "C" "1" "" "Lw" "0.3" ""
9 F" A. z" Z! N- K) I                                       "M" "THAY" "C" "7" "" "Lw" "0.4" ""& @3 k- h% N" d- R  e
                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.3" ""
9 \- K9 z+ N5 F' z# C7 w& q                                       "M" "HATCH" "C" "5" "" "Lw" "0.2" ""# C5 F6 P9 y" `9 ]/ G
                                       "M" "COT" "C" "1" "" "Lw" "0.7" ""7 i: O! E* W: I
                                       "M" "Defpoints" "C" "7" ""
& k) i8 k1 j6 v. w. V4 {  F                                       "M" "0" "C" "3" "" "Lw" "0.35" ""
. j) N; o/ U- p+ D. T. B* v8 Y/ O                                       "M" "CUA" "C" "6" "" "Lw" "0.35" ""3 g8 W# ?* g0 f% d% f) K
                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.3" ""
$ f% l8 I5 [. N) H/ Q/ D1 ]                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"# q5 G2 y9 t& {
                                       "M" "NETDAM" "C" "4" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"
" m* h& A2 k" K7 z0 N                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"
, }* m. p' R$ v! F" z                                       "M" "NETMANH" "C" "43" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"7 l4 }! z2 s5 f0 w$ ?
                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"+ P8 r3 d  x! h" J5 [8 K
                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"* S  `! U3 X% F0 }7 @  O% f6 A
                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"
1 S7 I3 U: z3 T  m- N  y' @                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"3 w" O2 s4 b! ?& F* H6 `
                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"; j9 y2 H' G! {+ \
                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.58" "" "LT" "Continuous" "" "" "LTSCALE" "1"0 g/ C7 `& O2 z$ x3 Z
                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"
2 M- R( R# A- E                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.7" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"
9 I/ ?! o3 _& {) e9 ~' E4 _                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.7" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"
# e% K, D5 k+ ~                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1.20" "" "LT" "Continuous" "" "" "LTSCALE" "1"
" c* A6 m. u) S+ F( j3 I% W                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.25" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "30" ""))(princ)
  Z0 F+ K* a: @# R0 r: z
1 T0 [7 D. I- [* n(DEFUN C:SA1 () (setvar "DIMSCALE" 4411.1111)$ _: D; t% C" Q4 s/ `1 M2 z
                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.4" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "60" ""
4 g! s" }: S8 p                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.85" ""
. l/ [; m9 t" [4 Y7 ~5 V                                           "M" "MANH" "C" "9" "" "Lw" "0.35" ""3 V2 M$ k' L$ K" g: ~2 G
                                       "M" "TEXT" "C" "7" "" "Lw" "0.5" ""
8 x* _: F7 Z% z2 f7 k) M% ~                                       "M" "DIM" "C" "1" "" "Lw" "0.35" ""
; _" K4 k( X6 M4 D) K- r                                       "M" "THAY" "C" "7" "" "Lw" "0.4" """ J8 r4 }8 m/ a: q
                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.35" ""  S. P" F- a/ S8 c3 C
                                       "M" "HATCH" "C" "5" "" "Lw" "0.25" ""
! l3 w- H7 n3 [, }% a5 o                                       "M" "COT" "C" "1" "" "Lw" "0.85" ""  ^- S+ }$ J- X
                                       "M" "Defpoints" "C" "7" ""/ y  ~) n1 ?+ A
                                       "M" "0" "C" "3" "" "Lw" "0.35" ""% }8 _4 t7 V5 {. v4 B7 D- U
                                       "M" "CUA" "C" "6" "" "Lw" "0.4" ""$ p4 C! W3 _% q8 B' Q4 n
                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.35" ""
( F7 n2 n: h' e" i                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1": e! H( [/ t9 r% `- Z
                                       "M" "NETDAM" "C" "4" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1": B4 {+ E2 M* r. `0 w1 a6 {
                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.9" "" "LT" "Continuous" "" "" "LTSCALE" "1"
( X7 P% N1 t8 D! j/ q                                       "M" "NETMANH" "C" "43" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"/ S. U& p# ?% d' y+ _* C
                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "1.0" "" "LT" "Continuous" "" "" "LTSCALE" "1"
9 S1 F: ^6 j2 K  y9 v2 H$ A# R! q                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1": c( ]! S9 W& k$ ]/ J8 ?
                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"
6 `6 q9 q5 s9 j( @/ Q: C5 t                                       "M" "TEXTVNi" "C" "4" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"8 ~* e  x' V; e; g0 U9 k6 ^- @
                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.9" "" "LT" "Continuous" "" "" "LTSCALE" "1"
0 s) e6 h3 V2 |: X/ J                                       "M" "THEPDOC" "C" "2" "" "Lw" "2.00" "" "LT" "Continuous" "" "" "LTSCALE" "1"
: M2 L! i2 D# A, p7 M$ |                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"
7 X1 s6 P) B$ q5 U& q4 [/ n7 ?                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.8" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"/ i1 c# {: V# Z$ M# E
                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.8" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"# N$ R' Y8 Q+ D& c& {/ e: D% x
                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1.40" "" "LT" "Continuous" "" "" "LTSCALE" "1"$ s/ O7 v; o3 V1 q" d7 E) l
                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.3" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "40" ""))(princ)
4 T: R3 F( x) `5 d        3 ^8 u. P2 n- I: k* G: {
(DEFUN C:SA0 () (setvar "DIMSCALE" 6111.1111)
9 [" |  ]" m1 ~/ ?                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.5" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "85" ""
! o2 ]( ^/ m2 `( b$ M4 ]                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "1" ""$ t0 i" w4 V$ E9 I; g& }
                                           "M" "MANH" "C" "9" "" "Lw" "0.35" "": _( g$ y7 q( W# H9 o3 O
                                       "M" "TEXT" "C" "7" "" "Lw" "0.5" ""; `; I2 ]& N$ i
                                       "M" "DIM" "C" "1" "" "Lw" "0.35" ""
9 z9 z7 b* i1 h7 b                                       "M" "THAY" "C" "7" "" "Lw" "0.5" ""
' V% V, [/ ^3 A2 D0 s# \                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.4" ""5 B& N, e4 O8 `/ p5 I: K
                                       "M" "HATCH" "C" "5" "" "Lw" "0.35" ""; g( s8 w: Y+ n" ?( E
                                       "M" "COT" "C" "1" "" "Lw" "0.1" ""
+ Q  C# }2 I1 J3 u: _7 o+ r                                       "M" "Defpoints" "C" "7" ""
- l% ^3 m, p. W; U! ]! `# v                                       "M" "0" "C" "3" "" "Lw" "0.5" ""
* p* F7 b" I& r- `5 M                                       "M" "CUA" "C" "6" "" "Lw" "0.5" ""
# h3 k% F1 n  _4 Z                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.4" ""# d+ \2 i& T6 Z1 T! D7 q1 j/ B
                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"8 p: T% j2 ]+ a# R/ h
                                       "M" "NETDAM" "C" "4" "" "Lw" "1" "" "LT" "Continuous" "" "" "LTSCALE" "1"
$ g' d1 E8 X) H7 ?3 b: A- J8 w6 Q                                       "M" "NETTHAY" "C" "255" "" "Lw" "1.00" "" "LT" "Continuous" "" "" "LTSCALE" "1"
& W( [  b+ R4 V1 i( C                                       "M" "NETMANH" "C" "43" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"! y; @# l+ V" N9 E6 F0 E1 p6 `
                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "1.20" "" "LT" "Continuous" "" "" "LTSCALE" "1"
5 m4 a; s, e+ P8 [1 H1 H8 ?                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"
* p8 M+ z& a2 N9 z) d                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"
* V: b2 J6 M/ B& M' K; P                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"& x8 @+ m6 L+ r2 \' J! o
                                       "M" "THEPDAI" "C" "3" "" "Lw" "1.00" "" "LT" "Continuous" "" "" "LTSCALE" "1"
4 T9 f4 G$ U2 |% _) C) H                                       "M" "THEPDOC" "C" "2" "" "Lw" "2.11" "" "LT" "Continuous" "" "" "LTSCALE" "1"( P! \8 |4 c/ K. c. K. ~, o
                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"
- C! S( j! z' R& p. E& C; P, j. w                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.9" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"% J$ {* O4 o4 m% K  Q& K
                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.9" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"
9 v1 @0 u7 F# R% R                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1.40" "" "LT" "Continuous" "" "" "LTSCALE" "1"
6 f0 Q" B/ y) C" f                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.35" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "55" ""))(princ)/ x) |& |4 @. T8 n# T
(DEFUN C:O   () (COMMAND "OFFSET"))- ~4 ]/ U7 [+ \+ h) n
(defun c:s1 () (command "surftab1"))
  L* _, \) L4 w(defun c:s2 () (command "surftab2"))
: k9 G0 U- c* i( v3 k(defun c:ep () (command "explode"))' E  P8 |+ ^3 l
(DEFUN CS () (COMMAND "AUDIT" "Y" "purge" "all" "*" "N" "QSAVE"))8 Z7 n. `& T9 n
(DEFUN CV   () (COMMAND "QSAVE"))
) w+ G! \7 s, {* i9 s5 A(DEFUN C:S    () (COMMAND "STRETCH" "C"))
/ L9 M2 S3 d' \; t4 i
9 t0 C6 p( |  r. O) R2 U;************************** CAT DIM **************************& R. I8 Q3 p3 W$ l) I2 m

6 u1 o' O7 A7 b(DEFUN CC (/ CMD SS LTH DEM PT DS KDL N70 GOCX GOCY PT13 PT14 PTI PT13I PT14I' w9 Q8 c. w/ p* x7 h3 }5 F! j- b( e; l
                PT13N PT14N O13 O14 N13 N14 OSM OLDERR PT10 PT11)
$ G3 F0 ~6 [$ r' a! p(SETQ CMD (GETVAR "CMDECHO"))4 C' j2 @4 N4 n) K: t, y
(SETQ OSM (GETVAR "OSMODE"))
2 n# Z- d5 }1 @) J, p" ]& m; [(SETQ OLDERR *error*
( s6 t  a; R' H      *error* myerror)
, C3 C9 E, ?: ~; q9 m5 L* n9 U(PRINC "Please select dimension object!")+ O# Q, m4 \. N. p6 D6 n% R9 u
(SETQ SS (SSGET))
# g  v- y# p) E& N& J0 f  Z# V) j1 K(SETVAR "CMDECHO" 0)6 s8 }/ Z9 d4 w. i7 f% _
(SETQ PT (GETPOINT "Point to trim or extend:")), o' A% n: Q  t5 \  D; E
(SETQ PT (TRANS PT 1 0))( K% C! a# I7 o" i1 ~# K0 ^9 s
(COMMAND "UCS" "W")* R7 t- ^% D! j3 x7 ]4 Q
(SETQ LTH (SSLENGTH SS))9 m! F4 C. a/ d7 l2 F
(SETQ DEM 0)' l9 I  n5 t0 d, H& I' \( f
(WHILE (< DEM LTH)
" M9 L0 z, X, s$ J% Q, Y: U! \    (PROGN  g0 V+ g* C+ _3 ^- S* s  A2 ~
        (SETQ DS (ENTGET (SSNAME SS DEM)))4 C0 k! ^( A; q+ |/ Q+ f# r
        (SETQ KDL (CDR (ASSOC 0 DS)))
+ K' N" Z3 |+ w2 P" i* u' ^        (IF (= "DIMENSION" KDL)3 Z7 u3 W3 Z1 n
           (PROGN
; k4 i- _- x" S- M5 N                (SETQ PT10 (CDR (ASSOC 10 DS))), ]) g4 F0 d% Q+ D
                (SETQ PT11 (CDR (ASSOC 11 DS)))! [6 ^% C' R/ Y- u# E
                (SETQ PT13 (CDR (ASSOC 13 DS)))! F0 F) _+ u" O1 W+ T
                (SETQ PT14 (CDR (ASSOC 14 DS)))
/ T  ^6 L5 W8 S$ @/ a5 f                (SETQ N70 (CDR (ASSOC 70 DS)))" R  e$ {, K& x
                (IF (OR (= N70 32) (= N70 33) (= N70 160) (= N70 161))
; E0 N0 s& g1 m- {+ d                   (PROGN
* ]0 Y% h# g# l/ p. z. H5 f$ ]                        (SETQ GOCY (ANGLE PT10 PT14))
7 h. y* h- d# j7 |1 n0 I                        (SETQ GOCX (+ GOCY (/ PI 2)))
. M9 Y& A; u. R; l# w                   )
; {/ b  C! d7 v$ i% u                )- X4 n; F/ b9 c/ ?9 S1 g: E
                (SETVAR "OSMODE" 0)
1 F$ [9 B+ V9 d& H3 r                (SETQ PTI (POLAR PT GOCX 2))" [" O% W! x' v8 [, f# l
                (SETQ PT13I (POLAR PT13 GOCY 2))
( J% q8 W& @- g# @" Q- R6 E                (SETQ PT14I (POLAR PT14 GOCY 2))
3 K! p; p- K1 m% F/ s; R2 F+ X  o                (SETQ PT13N (INTERS PT PTI PT13 PT13I NIL))
1 I. j$ @: @+ a                (SETQ PT14N (INTERS PT PTI PT14 PT14I NIL))
* K6 `  u/ i2 s+ X3 F1 ?1 {                (SETQ O13 (ASSOC 13 DS))3 P7 ]$ Z* O" m) C' e: H
                (SETQ O14 (ASSOC 14 DS))
( ^- O8 a6 l) F3 h  f" X* T+ U                (SETQ N13 (CONS 13 PT13N))! k, n" X- ]: R. u; F
                (SETQ N14 (CONS 14 PT14N))) P9 i0 {- T+ c/ w8 `
                (SETQ DS (SUBST N13 O13 DS))) L$ y: K: b0 Q* n) O, j
                (SETQ DS (SUBST N14 O14 DS))
7 w) X! O3 K# ?; z                (ENTMOD DS)
; g, R9 B4 e# Q$ n4 v           )* S/ g9 E9 b0 S; C: T5 P6 j6 A9 I
        )
7 b7 k, m2 E: w; [7 [: j' k& S        (SETQ DEM (+ DEM 1))
, [" i+ T6 i2 x" c# k8 A    )/ S4 M& }1 F/ f, |* [+ f- z8 W
)
4 F$ O. K  d0 q# O(COMMAND "UCS" "P")
6 s/ t. |6 c0 ~' M(SETVAR "CMDECHO" CMD)" @  f- [( t8 |% n
(SETVAR "OSMODE" OSM). |- [1 P" F3 J6 t+ X( E0 I# W9 A  L, W
(setq *error* OLDERR)               ; Restore old *error* handler& j7 G# a7 @% a1 g: o7 I
(PRINC)
) e$ x; ~6 v6 X$ V  J5 h)6 W; C2 C7 C; J5 N0 q/ I' B

/ p+ I7 P+ k- D7 Y( Q4 W: `: c) \; A(DEFUN C:BD (/ CMD SS LTH DEM PT DS KDL N70 GOCX GOCY PT13 PT14 PTI
( @' v5 j- b5 e, x                PT10 PT10I PT10N O10 N10 PT11 PT11N O11 N11 KC OSM OLDERR)
8 Y# \$ g$ f2 d4 K4 T5 s8 s0 r(SETQ CMD (GETVAR "CMDECHO"))/ ~& ?+ _& K. `1 u4 U" y2 o1 v
(SETQ OSM (GETVAR "OSMODE"))) _9 w5 d6 }8 b4 Y' L; P4 C( s: b
(SETQ OLDERR *error*
4 B- s5 [0 C( j' b( \% @      *error* myerror)
# s7 C, I$ f: j, q2 v8 }* G+ r(PRINC "Please select dimension object!"). t$ C# F, s; J" r' m
(SETQ SS (SSGET))7 x+ z$ G0 L5 D/ ?" j" r  O
(SETVAR "CMDECHO" 0)* L! N1 \" B/ P; x) ^
(SETQ PT (GETPOINT "Point to trim or extend:"))- {8 k# G* d! o1 r1 I
(SETQ PT (TRANS PT 1 0))
! E* K% |: }( \: c: z(COMMAND "UCS" "W")
/ H; ~1 I  ^  l! h/ A9 m+ d(SETQ LTH (SSLENGTH SS))6 J' m1 p3 c  f
(SETQ DEM 0)$ f2 j  d5 b: M/ X2 [0 @+ v
(WHILE (< DEM LTH)! d/ E6 Y& V( P6 M
    (PROGN
6 {0 H- O& M$ j) N        (SETQ DS (ENTGET (SSNAME SS DEM)))7 x7 p, d' |0 H0 E+ _# P
        (SETQ KDL (CDR (ASSOC 0 DS)))
& f. F: r$ w0 K3 f: E8 I5 u        (IF (= "DIMENSION" KDL)6 ]9 m7 k$ D: m' |  P1 h. |' }$ M5 ^
           (PROGN2 B* W3 L% h$ _4 t9 @, |3 d
                (SETQ PT13 (CDR (ASSOC 13 DS)))
, X' M7 s- Q+ y8 U. {. d6 G                (SETQ PT14 (CDR (ASSOC 14 DS)))% N. N4 V  d0 e0 |7 G
                (SETQ PT10 (CDR (ASSOC 10 DS)))
; C1 T: @8 ?, F                (SETQ PT11 (CDR (ASSOC 11 DS)))! n4 A: U5 o- H5 N: f5 j( m
                (SETQ N70 (CDR (ASSOC 70 DS)))& S1 f" h) ~* V- e6 {% ]
                (IF (OR (= N70 32) (= N70 33) (= N70 160) (= N70 161))
3 n) U: K- [0 h1 f! s' N8 }6 v  A                   (PROGN
( ]. a7 X  H/ a9 D7 [                        (SETQ GOCY (ANGLE PT10 PT14))
. a0 U4 g, A, Z" T4 c4 r$ t) t                        (SETQ GOCX (+ GOCY (/ PI 2))): @. \$ }3 K' O
                   )
- q9 _: @! C' n2 F% ^% T                ). A0 H7 e3 h) _" g" |2 Q
                (SETVAR "OSMODE" 0). ^3 C5 D5 o7 _/ u1 E" f8 P$ N
                (SETQ PTI (POLAR PT GOCX 2))
1 W8 C- ^9 i: ~6 q1 z; e+ m9 j                (SETQ PT10I (POLAR PT10 GOCY 2))
  y% v7 b) j) I( K- L                (SETQ PT10N (INTERS PT PTI PT10 PT10I NIL)); o4 s: M8 h, X+ x! Z
                (SETQ KC (DISTANCE PT10 PT10N))
; T( ~* a( S; u8 p! T                (SETQ O10 (ASSOC 10 DS)). `9 E8 |6 _1 V- J* P& w0 h
                (SETQ N10 (CONS 10 PT10N)); l/ K+ k# Y  i1 _0 c
                (SETQ DS (SUBST N10 O10 DS))
2 m! F% T3 ~5 @                (SETQ PT11N (POLAR PT11 (ANGLE PT10 PT10N) KC)). F7 n* h( m: o9 v
                (SETQ O11 (ASSOC 11 DS))- `' ]/ L" D' v0 W, r2 E8 H
                (SETQ N11 (CONS 11 PT11N))6 f& N  E5 x3 G) s$ ?
                (SETQ DS (SUBST N11 O11 DS))# X( r: W3 E/ P  ?
                (ENTMOD DS)
1 v* t7 X9 v% q" e. I8 S( e) O9 T+ e           )
% A3 P# v' t* z7 Z+ }" Y: T& v3 d" L        ). P' c2 n' ]7 ]& ~% W" l
        (SETQ DEM (+ DEM 1))/ z4 Q0 T* K6 Z. D9 }& [
    ). d" b' y4 [% Y$ Y, y
)! x% `5 S% }  z3 a) y8 g! g
(COMMAND "UCS" "P")
! z+ f! e- b/ n5 A, o& ?$ k* H' W; G(SETVAR "CMDECHO" CMD)
* w: U( ]3 V: ?(SETVAR "OSMODE" OSM)+ r# \; X1 r, ?# L* g5 c0 k7 r  X
(setq *error* OLDERR)) D% Q) t& d1 g! Y
(PRINC)
2 k& U5 p% Q/ Y8 y7 m4 R)
+ o5 M; j8 }6 S- O& P0 c' `8 _' }# \) ~4 A6 M( N& v+ ?

2 S& i1 D( A% _3 O; m;;; ================ BAT - TAT CHE DO GACH CHAN TEXT (TU) =================
4 G& t3 t: C* X( G) i5 C: Q+ Z( X" {5 ]: j
(defun c:tu ()  (setvar "cmdecho" 0)(prompt "\nHay chon dong TEXT can gach chan ")
; e: U0 T: K( `          (prompt "\nSelect objects: ")(command "select" "au" pause)(setq sstxt (ssget "p")$ O6 r1 Z3 u+ P; A3 u& ?1 q  p2 B
        sslen (sslength sstxt) ctr 0)(command ".undo" "mark")(while (< ctr sslen)(setq listxt4 @" O. i  |) [! M; K/ Q/ ^
        (entget (ssname sstxt ctr))txttxt (cdr (assoc 1 listxt))enttxt (cdr (assoc 0 listxt)))
6 ~5 f6 @  W" u! x& W( {( t  ?        (if (= enttxt "TEXT")(progn(setq testxt (substr txttxt 1 3))(if (or (= testxt "%%u")
6 }% T8 M+ j5 C5 m# a) U8 j# I        (= testxt "%%U"))(setq newtxt (substr txttxt 4))(setq newtxt (strcat "%%u" txttxt)))
& {' S$ m! O1 i/ i; g" _        (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))(entmod listxt)))
1 ~2 ?0 Z; _& g# T        (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))9 z1 l+ Q7 z' I. S
( `- M* h6 P5 r7 q
;;; ================ CHEN COT (TUU) =================" B+ I  {; m5 N4 d3 G$ j
- i6 d" x5 k8 g
(defun c:tuu ()  (setvar "cmdecho" 0)(prompt "\nHay chon dong TEXT can chen cot "): Z& Y; s2 f7 J& n- {
          (prompt "\nSelect objects: ")(command "select" "au" pause)(setq sstxt (ssget "p")
. }  D9 A" @  V+ J1 L6 w        sslen (sslength sstxt) ctr 0)(command ".undo" "mark")(while (< ctr sslen)(setq listxt
, f5 T  f4 I& y; m        (entget (ssname sstxt ctr))txttxt (cdr (assoc 1 listxt))enttxt (cdr (assoc 0 listxt)))) A" z4 e/ w+ u3 k  i* S1 M# \
        (if (= enttxt "TEXT")(progn(setq testxt (substr txttxt 1 3))(if (or (= testxt "%%p 0,000")7 y2 E7 n- U& s* r% C2 D
        (= testxt "%%P 0,000"))(setq newtxt (substr txttxt 4))(setq newtxt (strcat "%%P 0,000" txttxt)))
2 M# J1 G0 o% s' ^* C, U: m        (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))(entmod listxt)))2 P5 M% w/ [- T: n# c
        (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))
' F. e% }# K; l' K
# Y7 |& z; l. i# l5 M" I;;; ================ CHEN KY HIEU THEP (TP) =================; ~  E5 w6 L- r5 m
3 z/ X! n  I2 h$ L( m# m) t
(defun c:tp ()  (setvar "cmdecho" 0)(prompt "\nHay chon dong TEXT can chen ky hieu thep ")1 W9 o& K# Q7 X9 z9 Q) ?: S
          (prompt "\nSelect objects: ")(command "select" "au" pause)(setq sstxt (ssget "p")
3 B. h# {  _! |( \' N6 f% e        sslen (sslength sstxt) ctr 0)(command ".undo" "mark")(while (< ctr sslen)(setq listxt
: d$ Y2 m! h8 C5 O( h  D8 z$ S        (entget (ssname sstxt ctr))txttxt (cdr (assoc 1 listxt))enttxt (cdr (assoc 0 listxt)))( W' N! T$ L# ^) q  A
        (if (= enttxt "TEXT")(progn(setq testxt (substr txttxt 1 3))(if (or (= testxt "%%c")6 c3 j. Z1 b: }3 X3 U
        (= testxt "%%C"))(setq newtxt (substr txttxt 4))(setq newtxt (strcat "%%c" txttxt)))3 O4 ^8 V: m/ s1 V6 d- t, [
        (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))(entmod listxt)))7 L# F' M! o# {7 j' D
        (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))3 I6 X3 M( ^8 R6 y
# A' [! D; L* n- t- A
;=========================== TAM TUONG (TAM) =================================5 w0 W0 p) H& y9 q

2 W8 d" R3 G  x& j) I' l% q9 G  J(defun c:tam(/ data_m)
  o- f* E7 u- h+ a4 Z9 j7 O- \            (defun import_data(/ i)(setq data_m (ssget))(if (= nil distan_m) (setq distan_m 110.0))7 E* x/ M* g/ P" F( G
            (princ "Distance (")(princ distan_m)(princ "):")(setq i (getreal ))(if (not (= nil i))" L4 I! }6 }* W
        (setq distan_m i)))(defun process(/ ent check)(defun p_check()(setq check 0)  f9 |& u* B: S% B8 F
        (if (= "LINE" (cdr (assoc 0 ent))) (setq check 1))(princ))(defun p_d_offset$ B' V; W7 Q) v7 p% O5 Q% Z
        (/ p1 p2 p3 p4)(defun makeline(/ e2 e5)(setq la (list (cons 0 "LINE")(cons 5 (cdr; @8 \. e( m1 ?2 G, [. T
        (assoc 5 ent)))(cons 8 (cdr (assoc 8 ent)))(cons 10 p3)(cons 11 p4)))(entmake la)(princ)
6 V* V) Z6 Y* t        )(setq p1 (cdr (assoc 10 ent)) p2 (cdr (assoc 11 ent)))(if (not (= p1 p2)) (progn (if9 f8 h' j( [1 M
        (< (abs (- (nth 0 p1) (nth 0 p2))) 0.000001) (progn (setq p3 (list (+ (nth 0 p1)
# c/ p  a6 v9 ^        distan_m) (nth 1 p1) (nth 2 p1)))(setq p4 (list (+ (nth 0 p2) distan_m)(nth 1 p2)0 ^  j4 A8 o4 m5 N4 [& P
        (nth 2 p2))) (makeline) (setq p3 (list (- (nth 0 p1) distan_m) (nth 1 p1) (nth 2 p1)))' M$ P/ d) N! Z/ R
        (setq p4 (list (- (nth 0 p2) distan_m) (nth 1 p2) (nth 2 p2))) (makeline)))(if (<
8 O$ f7 G. S' e$ ]: G( j$ l+ w        (abs (- (nth 1 p1) (nth 1 p2))) 0.000001) (progn (setq p3 (list (nth 0 p1) (+ (nth 1 p1)7 }" m( {) b# b5 s% x  P# d0 a! W
        distan_m) (nth 2 p1)))(setq p4 (list (nth 0 p2) (+ (nth 1 p2) distan_m) (nth 2 p2)))
- j! `* d2 ^' z) `" h/ o        (makeline) (setq p3 (list (nth 0 p1) (- (nth 1 p1) distan_m) (nth 2 p1))) (setq p47 p/ ]$ H: }. }# i: r* W( N4 k
        (list (nth 0 p2) (- (nth 1 p2) distan_m) (nth 2 p2)))(makeline)))))(princ))(if (not7 W4 y+ a8 M* \/ |+ C* P
        (= nil data_m)) (progn (setq i 0)(while (< i (sslength data_m)) (progn(setq ent (entget
7 }) S1 e$ ^' D$ e, y' F6 b        (ssname data_m i)))(p_check)(if (= 1 check) (p_d_offset))(setq i (+ i 1))))))(princ))+ j- [5 U* I3 a( J3 t8 }
          (import_data)(ai_undo_push)(process)(ai_undo_pop)(princ))% h- d& K- E9 T& w
- U( D  v- {# q% B* v* f3 z0 }" b
;============ GHI CHU PHI (T1) ================
* J% f, ]$ Z3 |( p; F
4 b# }( \) B/ d$ r- z/ Q: g, r2 ~(defun c:DuongDan ()(setq D1 (getpoint " Diem thu nhat: "))(setq D2 (getpoint "Diem thu hai: " D1))/ R' r- E! r* Y& ~$ m) W
          (if (> (car D2) (car D1)) (setq D3 (polar D2 0 16)))(if (< (car D2) (car D1)) (setq D3# a3 w' A. B- C# u* j3 o
        (polar D2 PI 16)))(if (= (car D2) (car D1)) (setq D3 (polar D2 0 16)))(if (> (car D2)
  b  p, k7 o3 Z+ m        (car D1)) (setq D4 (polar D3 0 3.2)))(if (< (car D2)(car D1))(setq D4 (polar D3 PI 3.2)
0 y" j3 H' T) h        ))(if (= (car D2) (car D1)) (setq D4 (polar D3 0 3.2)))(if (> (car D2) (car D1))
4 s  w3 u- D- A        (setq D5 (polar D2 (/ PI 9) 3)))(if (< (car D2) (car D1)) (setq D5 (polar D3 (/ PI 9)6 s7 S+ O, g% o5 g( l2 g
        3)))(if (= (car D2) (car D1)) (setq D5 (polar D2 (/ PI 9) 3)))(command "color" 1)' v0 E0 q6 W+ K& P, M. y
          (command "line" D1 D2 D3 "")(command "circle" D4 "3.5")(command "color" 7 )
" q$ x# S. J% V) R# t          (command "text" "m" D4 2.5 0 "1")(command "text" D5 2.5 0 "%%c6a150")
, \/ T* \$ j5 ]          (command "ddedit" pause))
% R0 z8 ^8 H6 w: ^- U. S, f4 I) q" V: l. t* [. O
;;; ========================== Join (J) =================5 c( o8 ]2 T; @
: k# Z5 _4 |  i$ t( C- B2 U
(defun C:J () (Setvar "cmdecho" 0)(setq m:err *error* *error* *merrmsg*)(setq sset (ssget))
  l0 H& G; @! U0 _1 N+ G           (if (null sset) (exit))(setq kt (getstring "\nJoin all (Y/N) <Y> ? "))
/ q4 d( l3 X/ x5 v' B          (setq ssl (sslength sset))(setq temp  (entget (ssname sset 0))etype (cdr (assoc 0 temp)1 b& H$ W1 y9 S6 G
        ))(cond((or (= kt "Y") (= kt "y") (= kt ""))(progn (cond((= etype "POLYLINE")6 A! N6 B& t) O3 Z/ J" i. F+ _
        (COMMAND "PEDIT" sset "J" "all" "" ""))(if (or (= etype "LINE") (= etype "ARC"))
& Y: T- V1 ?4 {$ f8 B9 S7 ?           (COMMAND "PEDIT" sset "" "J" "all" "" "")))))((or (/= kt "Y") (/= kt "y") (/= kt ""))
# h5 h% g$ \% M! Q$ k! X: _" r# v        (progn (cond((= etype "POLYLINE")(COMMAND "PEDIT" sset "J" sset "" ""))  5 ?9 h% Y5 H% i0 Z8 d
           (if (or (= etype "LINE") (= etype "ARC"))(COMMAND "PEDIT" sset "" "J" sset "" ""))))))" N! F0 \0 |1 P/ c% S  e
          (setq *error* m:err m:err nil)(princ))
" ~, n7 f. n$ M3 [5 Y% t
4 @/ a/ h- P# y; m- {2 E' b7 [;=====================================================================
8 F# O6 W2 R) W;;; DOOR.LSP 1.0, Copyright (C) 1998 by CAD Department, HUCE.
2 u9 |$ b# G+ t4 z;=====================================================================9 K5 R% h7 B) @6 ^3 p

9 H& e% L1 r" ]) n6 T(defun C:D1 (/ p1 p2 p3 p4 side dis wid ang angsile old)8 F5 K# y+ \& g) m, E6 K" J" M
(setq old (getvar "OSMODE"))
2 K" J9 T7 k7 H
# j8 n" b3 ]$ E; d% r) X& N (setq p1 (getpoint "\nStart point:"))
) z# h8 i" Y5 g, c# L4 H (setq p2 (getpoint p1 "\nEnd point:")); u, ?7 N( O4 w: x1 F
(setq side (getpoint p2 "\nOpen side"))
; S* u1 z! I; w1 R& S6 _9 Y( F: w  n8 ^
(setq dis (distance p1 p2)). N/ }: F  \/ r- j
(setq ang (angle p1 p2))( ~. R# x. p4 R
(if (< ang (angle p1 side))
# ]% L1 L, j4 y. x1 z  (setq angside    (/ pi 2) )' l% L  N4 e# r4 B1 e/ n
  (setq angside (- (/ pi 2)))
/ }( h  b& Y6 f; c& Z9 `. h )
# o' V7 D# x1 o7 v (if  (>= (- (angle p1 side) ang) pi)( h3 G* E! X% B6 u) D; p( [* J
  (setq angside (- (/ pi 2)))1 A8 D  X4 y* _! i6 y
)
2 Z8 p4 }: X6 i& b3 b (if  (>= (- ANG (angle p1 side) ) pi)
& i0 i, }5 Q% Y. H! o% j# P  (setq angside (/ pi 2))/ p4 b6 R" g) C* k, ^5 t" ^
)
" R" A' i( E6 z( `7 a2 E1 M+ `0 j+ F8 l0 u/ h, m
(setq p3 (polar p2 (+ ang angside) dis) )
( B7 d( x7 D% B (setq p4 (polar p1 (+ ang angside) dis) )
' t" X  R! [& W& g6 a (setq wid (/ dis 15))* h  |& e. v1 q$ {0 [

% A/ g1 @/ X5 z% M, p3 `) V (setvar "OSMODE" 0)# c" y' @# B6 A/ T
. k/ }- _5 M$ p
(command "PLINE" p1 "A" "D" p4 p3 "L" p2 * |" H  s; q0 b0 ?* {# A8 X
                  (polar p2 (+ ang pi) wid)
. c0 s, ^8 w$ i# o3 X7 g$ ?                  (polar p3 (+ ang pi) wid)   F, E. g5 d) S" |. k) K3 \$ A
"")
0 i& V, Z! {, a9 S" T' Y4 L0 W$ f  H  u, D2 H4 o- s5 L3 N" K
(setvar "OSMODE" old)
- y6 S6 F0 g+ A+ S: z (princ)
5 {1 b2 v9 {5 S" Y)+ k6 [. b  `7 |2 E$ @, E. M1 e" V
/ w3 F5 Z$ W9 c* f+ n4 n0 {3 _
;=====================================================================
- F$ \& B& G* }
5 d' h! ~1 `& C3 h9 E(defun C:D2 (/ p1 p2 p3 p4 side dis wid ang angsile old)
" n+ n. q' S; q! N (defun cua1 (pt1 pt2): G  g7 [0 o) X2 C" C9 S
  (setq p1 pt1
4 _; r* D" `6 H7 _        p2 pt2)
$ C! J3 S6 T+ W: r  w
3 B- L- y8 s+ b# q" k  (setq ang (angle p1 p2))
' n1 c' ]# t+ Q* G  g  e  (if (< ang (angle p1 side))  ~, s  j- T! k
   (setq angside    (/ pi 2) )
- H/ k0 m1 e5 D/ g4 }   (setq angside (- (/ pi 2)))
, ]: W, r# D# _  )* @$ Q' F8 I# Q# E5 c+ |  q- q
  (if  (>= (- (angle p1 side) ang) pi)- M* E/ _4 _" p4 e3 A' c4 S% [9 Z
   (setq angside (- (/ pi 2)))
. ]0 J6 [$ U9 i5 g% X. g# e7 K  )
9 e% w& \0 ~# P  I: o  (if  (>= (- ANG (angle p1 side) ) pi)! d( u1 Y8 i, U+ a3 o
   (setq angside (/ pi 2))4 J" [; B, |( E5 U. g
  )
' _  Y* F; _& a6 W5 m% \- U% d- s$ D/ s$ [5 A7 T7 ~4 [. `
  (setq p3 (polar p2 (+ ang angside) dis) )
; F4 B6 q- t! `1 N) }! _4 t% d4 l  (setq p4 (polar p1 (+ ang angside) dis) )- j. @' e! _) r
  (setq wid (/ dis 15))
; k, n" q( g: b! T) G8 R1 r
) s, E3 q, i5 S# \; x  (command "PLINE" p1 "A" "D" p4 p3 "L" p2
8 w3 s# k; t! ~% y3 {                   (polar p2 (+ ang pi) wid) 8 v" ?$ n) L# }; b$ R' d
                   (polar p3 (+ ang pi) wid)
1 D, @9 }( b6 Y, @1 A4 i) R" ^) p3 V  "")
7 `* A" \+ G+ d0 e ). x0 X$ s4 u, R* {+ n" S" A% N
;=====================================================================
8 ~: y  z* G" {8 T3 e (setq old (getvar "OSMODE"))
5 L* C: ~/ I& R2 H# e; h( B0 G$ I
(setq p1 (getpoint "\nStart point:"))+ ~& [8 }) _/ u7 l. t
(setq p2 (getpoint p1 "\nEnd point:"))
0 m! P/ b0 p/ X3 |9 f (setq side (getpoint p2 "\nOpen side"))
; o; C& @" o3 r0 p7 Q: ?4 T9 ~& g; `% P/ d" ^- ^$ A
(setq dis (distance p1 p2))4 a5 o3 D9 N" J5 P' w# n
(setq dis (/ dis 2))
, E4 a- D3 u" _$ u
- H1 V, M+ P$ }- Z, C6 m8 | (setvar "OSMODE" 0)# e" q7 O$ U6 P/ X" p
4 \: X" ], a, D) B, b
(setq p1 (polar p1 (angle p1 p2) dis))% Y# S- N. U) r2 Y& X( ~: J. C5 e
(cua1 p1 p2)  1 F4 C+ \. f! U: \1 t: N

6 Y) w! F; R+ f. e$ K  g" S" Z (setq ang (+ ang pi))' V1 x7 o8 t( l0 f, j! H) c
(setq p2 (polar p1 ang dis))
# s9 T6 P+ h9 `9 I6 `; (setq side (polar p1 () dis))
7 y& o0 f% ?# j% T (cua1 p1 p2)  
# r) k0 D' j1 H' M! z* s& d0 {! I6 F  `: I( V
(setvar "OSMODE" old)
) R! R1 [: P6 I% ^ (princ)
; o+ U4 O* T  f0 L)$ h; ~7 j! W  R  j9 U" A

2 [( y  j* W1 X0 C( B) O# ]- w  ?;=====================================================================
! [0 P& `3 [: f  I. J6 e; w: Y;"Glue" text strings.  All adopt first's properties.
4 K" K' K! T; X8 r. o( a* m+ r;        Author:
1 W, d* m/ I9 V' R1 a/ P;                Henry C. Francis- s( G. P- g7 j* N: @6 H2 J6 o6 h$ I" J
;                425 N. Ashe St./ m1 Y* ?- i! D. \; F
;                Southern Pines, NC 28387* l. {' a" m1 n5 t; y7 O' A
;        http://www.pinehurst.net/~pfrancis; l4 U, E  b$ }" k9 [% K/ P) z7 ~+ I
;        e-mail hfrancis@pinehurst.net
% M8 ^; C) t; k4 W" j. E4 x- n;        All rights reserved.
2 O' P  h: t2 F: ^* f- I(defun c:gst ( / ename ent1 ent2 old1 oldsl old10 old11 old40 old50 newstr newsl new1 new10 new11)( g3 q: W0 u* ^" i& M" H
(while' m8 I- _5 S% {7 C% c
  (not* z8 D6 K# v7 ]& H7 B+ b
    (and$ C9 V5 D5 a% e4 {, e
      (setq ename1 (car(entsel "\nSelect first text string to join: ")))
) b% Z* q* s- S- O- z      (setq ent1 (entget ename1))
  F9 \- s  v  }0 b& t) |      (eq(cdr(assoc 0 ent1))"TEXT")
7 c. J8 n! e* c6 s" ?' ?    );and3 F. |. I" ?. C
  );not
2 Y2 F' p  [2 V& J( i);while
+ y/ N1 `& n3 K(setq old1 (cdr(assoc 1 ent1)))
9 }* X7 y$ \  w  x(while1 R  y0 d; u; m# ~/ I, A
  (not
+ V# Z) {8 y& X* l8 y5 L    (and
0 I6 A. `6 w2 c, F" ?! d      (setq ename2 (car(entsel "\nSelect second text string to join: ")))
2 O: Y5 q% P2 K; [. n      (setq ent2 (entget ename2))
- s& M# I. O% D: c+ W/ q) C      (eq(cdr(assoc 0 ent2))"TEXT")$ I1 _+ r( f5 Z
      (not(eq ename1 ename2)); d& P2 D, `% i
    );and
4 f3 h9 ^& ~) P6 h5 ?" L  );not5 s& O! n  D3 r. k& Z/ N
);while' `0 r! c/ J( \+ ^; J
(setq old2 (cdr(assoc 1 ent2)))
/ ^  M3 G3 v  H  v' C" A0 @(setq new1 (strcat old1 " " old2)
: A# K0 X1 V$ J3 c, {6 |5 D: v! C      ent1
$ B, W3 b! s" V( B/ f        (subst (cons 1 new1)
! c. a9 c2 J9 N               (assoc 1 ent1)
' H! U" D/ b! W+ e& I               ent1)- I# \% o* Z0 e  m  U$ S& h
);setq
; N7 `6 M: @' f(entmod ent1)
4 `0 }) P6 Z0 {3 [3 l/ L+ H(entdel ename2)
  z3 [* U- N- A! E+ @0 v(princ)& g9 O5 f9 B7 q7 k- Q
);defun
. D8 q$ @' R9 Y' R! U+ g6 A0 [5 U% b$ j4 Z( Q
;=====================================================================0 K  z0 v* n4 M% R/ k6 a! a

; Y  B) n' i& h' r& _5 q* r/ ~(defun c:nt (/ g1 g2 ss1 olderr nterr l i temp e1 e2 new old dd dc)8 ^( L# J$ [8 n
  }% `9 x) }# C3 G# o$ u
    (defun nterr (s), Z6 d4 a3 U6 n0 K
        (command "_.UCS" "" "_.UNDO" "E")
; s; H6 `/ d' o/ U% x        (setvar "cmdecho" 1)& r" m8 |8 h4 U% u' G% L
        (setvar "blipmode" 0)
/ H5 M( N% q. O- x( T; @+ J/ P0 y6 R        (setq *error* olderr)* V( G& c2 v, Y$ h
        (setq g1 nil g2 nil ss1 nil e1 nil e2 nil olderr nil 0 \8 M) T1 Q- Z2 H: t6 k
                nterr nil temp nil i nil l nil new nil old nil dd nil dc nil)6 c9 ]" |& B0 B# q
        (princ)
, U6 F; Y4 `  k# c5 Z# g( d    )
. J" ]" a# D7 O# t7 G1 e1 x4 f, w
    (defun tim_in (dt / p01 p02 ktra)
, L" v- d$ x1 x# @# I5 X' b% t        (setq p01 (cdr (assoc 10 (entget dt))))
0 T2 e) n4 @( \7 L. j' q, m9 f4 a        (setq p02 (cdr (assoc 11 (entget dt))))* `' ^2 m( X5 e& P) y  S
        (setq ktra T)7 X; E7 b& i: y( B0 X: S
        (if (and (> (car p01) (car g1)) (< (car p01) (car g2))
1 ], }5 P" M2 ^4 `) j" j, C                 (> (cadr p01) (cadr g1)) (< (cadr p01) (cadr g2)))
) N: B+ {4 |- B9 n( B, e            (setq ktra nil)5 K3 D* G) r5 w+ T8 y, X7 Q
        )
. C' {; q* e7 Q6 ~, D& [, e        (if (and (> (car p02) (car g1)) (< (car p02) (car g2))
; }! a( w& g# t. m  [8 M                 (> (cadr p02) (cadr g1)) (< (cadr p02) (cadr g2)))3 F6 z+ @9 c4 b, {8 w5 x# q$ R% g1 ^
            (setq ktra nil); B4 M* ~. X2 D( \3 d# g3 b
        )0 H* v$ {; a: [8 y9 n
        ktra. Z: X$ Q. s# [; Q/ V
   )
$ H8 G  ^* h6 P6 @/ e$ {2 ?- F) F5 O8 r3 ^
   (defun timdt (dt1 dt2 / p01 p02)
% o4 X' ]/ h, D; }% }+ Q/ G0 C- v; p& Y        (setq p01 (cdr (assoc 10 (entget dt2))))
* L) k' `# u' u3 o        (setq p02 (cdr (assoc 11 (entget dt2))))- L2 P1 a$ J* s" M" [* m" g
        (setvar "ucsicon" 0)
6 D% |) S! E) u! W3 B6 O3 Y. ]        (command "_.UCS" "E" dt1)
( I6 f" F. S# H4 y        (setq p01 (trans p01 0 1))
; a. m0 ^, `; r4 A( \5 @5 W        (setq p02 (trans p02 0 1))
& ~& p/ \3 i$ x$ Z! e2 m4 a        (command "_.UCS" "")( d- L; \+ W4 l
        (setvar "ucsicon" 1)
* ^/ v; w. x9 C, h' {8 M! G' N9 N        (if (and (equal (cadr p01) 0 0.001) (equal (cadr p02) 0 0.001))
* S, n  l! x- I; Y- }$ ~, j                T
) T0 u4 _* s; a' A. s5 z7 ?                nil# e2 r2 ~$ o+ E4 A
        )
2 q, A4 u: J5 P$ `9 W! L/ t   )
0 M1 f& |% t' o9 z+ e9 [% n- `! v' x8 [  ^
    (defun tim_out (dt / p01 p02 kt)
& Z" g9 h( u* Q' I        (setq p01 (cdr (assoc 10 (entget dt))))
3 H) b+ m' R: o+ R        (setq p02 (cdr (assoc 11 (entget dt))))% e: }) G6 [( ~. k, t- A
        (if (and (> (car p01) (car g1)) (< (car p01) (car g2))
- V" v1 O7 V; T! E! b                 (> (cadr p01) (cadr g1)) (< (cadr p01) (cadr g2)))
6 b& ^* Q- b8 @# X4 A/ [            (setq kt p02)
1 f/ x1 u9 d% c, f        )
' u' P, ^& g% u        (if (and (> (car p02) (car g1)) (< (car p02) (car g2)) - Z4 x) x6 v& @* P* o- F
                 (> (cadr p02) (cadr g1)) (< (cadr p02) (cadr g2)))- b% q7 [3 _( c7 u
            (setq kt p01)8 v" w: f: @2 ?0 x
        )
8 n8 d6 d! W: c, N" R        kt        
8 M) l' v8 T- H7 V6 B6 t   )
5 P" Q$ o! ^9 z) @! S/ w' Q% g7 O6 g* K2 D  g  V0 D
    (setvar "cmdecho" 0)
( l% Z! o# G6 t5 ?% F    (setq olderr *error* *error* nterr)
* Z& [6 H$ p- w. A    (command "_.UNDO" "G" "_.UCS" "")) r8 C0 A' d& x4 m
    (while (null ss1)9 X5 d. d& `# K+ l; X3 v  N
        (princ "\nChon tuong muon noi...")
: a& G2 A" j1 W) o        (initget 1)
/ t3 t- v4 S7 D' I% J: I$ V        (setq g1 (getpoint "\n>Goc thu nhat:"))
  p% t& J5 ^7 s! @! P; a        (initget (+ 1 32))
6 L' {" h+ F4 j, t4 ~, w0 H        (setq g2 (getcorner g1 "\n>Goc thu hai:"))- `2 {4 n$ q1 `5 \+ V  [0 M9 C
        (setq ss1 (ssget "c" g1 g2 '((0 . "LINE")))): ^8 b6 V# p9 S
        (if (null ss1) (princ "\nKhong tim thay doi tuong!"))) a8 h3 _) }; H7 y+ `
    )& V. H% _! x# j# @) Z

) m/ D/ f8 Q8 ]& m- `. w: W    (setq temp (list (min (car g1) (car g2)) (min (cadr g1) (cadr g2)))& {) z( o' e3 o* E1 _* j, D
          g2 (list (max (car g1) (car g2)) (max (cadr g1) (cadr g2)))
* P8 V0 u2 `: Y$ u6 @( b& X9 j          g1 temp)
2 V1 g$ l- T$ @- M4 Y. q   (setq ss1 (ssget "w" g1 g2))
$ v/ j, y9 f' j) ~# P   (if ss1 (command "_.ERASE" ss1 ""))
2 W. r2 E2 A- i; p( q   (setq ss1 (ssget "c" g1 g2 '((0 . "LINE"))))
' k2 ~* W) f9 x" v3 H
# p; A" l1 K& {: f5 J    (setvar "blipmode" 0)7 }5 W  L; z2 L) t8 p
        (setq i 0 l (sslength ss1))
# q$ G* ?4 ?  ^& d3 u        (while (< i l)
' X; {$ g& C! Z           (if (tim_in (ssname ss1 i))
: P4 V8 b1 o4 @5 Q! J5 ^              (progn
4 f. ]2 I. l6 N/ O' I" N; k                    (ssdel (ssname ss1 i) ss1)
& z( c* n- ?9 ?                    (setq i 0 l (1- l))
2 o# f' K6 u* y, ^8 g              )        
/ \* _* ~( z; Q" z' o- A              (setq i (1+ i))
5 M# H" Z" _7 T2 |* }  Z& L# q           )$ J/ q7 |% B; v8 _' E" K" U, X$ b' `
        )- M! W# S) B- h+ L- O0 y7 M  D9 X
        (setq l (sslength ss1))
9 d1 v0 n* ]* C' }$ z      (while (>= l 2)$ Z  U4 [/ u6 Z/ a
        (setq e1 (ssname ss1 0))1 A. b* k; R4 g: P3 T" F+ P  @
        (ssdel e1 ss1)
( _" F+ X9 |2 M) g$ O        (setq e2 nil i 0 l (sslength ss1))% n$ K6 M( }% h
            (while (< i l)
  l1 j/ p( Y8 v' E0 ]                (if (timdt e1 (ssname ss1 i))& h% w, S, Y' b: _
                    (progn, W6 z9 h& ]- a! x! {
                        (setq e2 (ssname ss1 i))
. v  s# D9 E8 t7 J                             (setq dd (tim_out e1))
1 k- {( S. c! b) w6 r                             (setq dc (tim_out e2)). f- \- Y- X& v& o5 t, L9 l6 A
                    )
$ Z4 A6 \+ V, b' K6 O0 P4 f                )
8 @3 A& @1 P1 O: r+ V- [6 A- G                (setq i (1+ i))
# \: T+ z7 N; t2 a            )
( t/ ^1 N' `$ c# C. P# q. e4 W            (if e2 (progn* O  I6 ?. Z! J* P, R  [
                        (ssdel e2 ss1)                        
# M5 E% ?* X: @1 ~2 o                        (command "_.ERASE" e2 "")
- |/ r# |; m' u6 \- \& T                        (setq temp (entget e1))
6 J& @$ p$ P- Q* l. c4 Z                        (setq old (assoc 10 temp))7 G6 H+ N1 i; J
                        (setq new (cons 10 dd))
" S8 v* `! u5 Y                        (setq temp (subst new old temp))
) ]7 L, s; c8 l( f  A                        (entmod temp)
9 F& f  b% A- r0 q7 h                        (setq temp (entget e1))
/ b) }- I9 w! K' v                        (setq old (assoc 11 temp))
' h' W( B: X- h7 \( c8 L5 X  l                        (setq new (cons 11 dc))
1 L$ V2 O9 s* P! s) d( g                        (setq temp (subst new old temp))
1 h/ K" V2 R' u' X                        (entmod temp)
2 j5 ^1 V+ N9 Z                        (redraw e1)
1 d. M+ S6 |2 X- S8 ?. E! {: F6 A                        (setq l (sslength ss1))  I# |3 q! b* |2 W! |
                   )
' l! p/ L6 H, |) L            )
, Q# |9 V  C0 i: l8 I  X! H0 H        )
" c) b3 v9 m2 S  n5 T4 v% z  H& ^8 w: m
        (command "_.UCS" "" "_.UNDO" "E")) i4 Z3 i5 F/ L9 r% H. }8 ^
        (setvar "cmdecho" 1)
# |9 @( o  E4 I- Y# Q. Y, I        (setvar "blipmode" 0)
% [9 H! `/ {1 L# }* J        (setq *error* olderr), c  n2 `+ m9 }3 K6 {. n, z
        (princ)& p: F. U4 |- g, `
). N. \( w, ^' T- Q2 M
;*********************************************************************
1 l- K9 r7 t# q8 c! I) I(defun ketthuc ()
$ N1 z3 c8 J1 j        (setvar        "cmdecho"        luuecho)
; o9 k  v7 Z/ y  |        (setq *error*        luu
9 q, ]1 P1 U& A# u7 N, k                luu                nil        
0 q" U$ Y0 M6 ]( d) f7 |6 p& p/ y/ o                luuecho        nil7 T! R0 i2 m7 t2 V7 @/ _
        );setq$ T# h+ t" w! s. @: D. {( Z$ m, [
        (princ)
& J+ Y. b7 M4 q. a4 j' a)                0 N8 j: r: j9 B' a3 J! _" @6 c( y
;*********************************************************************' E( Q" r1 U8 D8 o: ^4 |
(defun modau ()# g6 m7 V0 p: _5 U9 P7 U" Y. \7 z7 G
(setq         luu *error
0 |- L* q2 q& u4 d                luuecho        (getvar        "cmdecho")
6 a2 [; o% U6 W1 v; o/ d% y4 c                *error        (ketthuc)% z, c  J* M; f0 E
)/ t0 `. P; F9 \. R5 P) x1 I
)/ r7 u+ A% h0 e9 k+ E( K
;*********************************************************************# O) z; ]; ]' v2 _) M/ j
(defun xulytext (text / kytu ma sokt luusokt lui )
7 d/ V9 a/ ]/ n( {3 w8 o0 ?. e5 c(setq         kytu        (substr text (strlen text))
9 [' {& i, F, w& v                ma        (ascii kytu)9 _+ A# H) W- `& h
                sokt        (read kytu) 1 K( @' ^7 z. z6 F* K
                lui        1
6 l- D- \3 w5 z0 g9 k; l)
, W( d) N$ g) d  b$ ](if (numberp sokt)
1 F4 a, m3 I3 T# _6 q                (progn: \, r! \* C9 ^. a& x* T
                        (setq luusokt        (1+ sokt))- y( n4 d  U+ q  \9 _
                        (if (and         (numberp sokt)
* z# Q% e. [8 h  Z: n3 \                                        (> (strlen text) 1)& D* S" {4 D; F6 N/ A1 U3 f0 d9 N9 \
                            )        
! S/ Z" f+ n" j4 h8 v/ l" k7 D* a                           (progn/ _4 s. `/ E* [3 S' ?4 ^0 l
                                (setq         kytu        (substr text (1- (strlen text)))- t6 T1 l" O: E9 z% ~. Z  q5 A
                                                sokt        (read kytu)
4 C: d# z3 P1 L                                                                                )
; B9 I5 u6 c7 A# _$ u* W' h                                (if         (numberp sokt)
. V# O) I( |6 L- U+ z6 l                                        (setq luusokt (1+        sokt)0 L2 c3 Z7 u' m, X' Y
                                                        lui         2: H' b3 O5 r9 r/ C0 k  ^- |, K
/ M! h1 H3 u# M3 T2 h& R
                                                )
- ^% L) Y9 ^2 n& b: m, t                                )/ c" t' ?2 V0 g: O8 U  _4 f4 [+ C
                            );progn        
  r% c6 i* y' O7 h                        ); P4 Z! f1 \: i4 ^' D
                        (if (= luusokt        100)        (setq         luusokt        0))
5 f- K! P1 F# h" z2 j                        (setq         kytu                (rtos luusokt 2 0)
! p$ _* e0 d: a4 y' q                                       
" X5 C9 x/ f- D( e+ x8 |! U2 P9 t: w                                        text        (strcat        (substr text 1 (- (strlen text) lui))  kytu)7 D: t0 F/ v6 X4 E- `: @
                        )
0 b- {4 p8 F4 i0 T! ~                );progn                         $ O7 V1 _) |' m
                (if   (or         (= kytu "z")' Z/ Z4 X5 a/ {7 ~- V
                                (= kytu "Z")
3 }2 f* o6 n4 l                        )8 Y; R# s! n& P" W4 R
                        (setq         text                (strcat         text        "0")
  w7 d( G2 k% I( d, G' Q                                textxl                "0"
% t0 ?4 S/ E9 ^9 ^0 B                        )
# v7 ~# L. P7 q4 u# d                        (setq                ma        (1+        ma); E% u+ p4 E3 M8 M1 I" I
                                        text        (strcat        (substr text 1 (1- (strlen text)))  (chr ma))
8 T# z5 V  l8 _$ r& T% C                        ); M: A* X* u" v5 I
                );if% `: ^/ Y; P/ v6 ^9 O8 X! M" ?& N
);if) [% Z% ?% z5 \% h# o
)
) I$ j/ @3 ~/ X) U  L3 r, y;*********************************************************************
% c; @% z* ^1 N* c* _(defun doitext(tendoituong / chuoi doituong thoat tam dsach kieu text vitri10 vitri11 dem canle)( C6 G6 ~# n; Q# ^
;Neu doi tuong la text thi tiep tuc
5 c) g' N' \8 ^3 h1 i(setq         doituong         (entget  tendoituong)/ o: U; K# B: I7 T3 i7 i0 h! j
        kieu                (cdr (assoc         0        doituong))
7 J; S! q( z* \+ L/ F* d* g- j4 d        canle                (cdr (assoc         72        doituong))
+ r7 @  U6 I7 A/ K% ~( ^)        - D& ?9 K0 _# [
(if (or (= kieu                "TEXT")$ ?. ^: x6 o) V) y" R. F7 i
        (= kieu         "MTEXT")        
4 I" X; e; |: R; e, e9 a$ Q    )         ' w$ @$ v, {& T  r% \) v
        (progn0 f3 B: i  g& f1 D4 O  E6 r
                (setq        textxl        (xulytext textxl): q- C  I9 ^, V: Q  g* w
                        text        (cons 1 textxl)
4 ]8 o( C7 g) v' d                        vitri10         (cdr (assoc 10 doituong))9 x: Z! p8 K. ~% Y3 Q
                        vitri10         (list (+ (car vitri10) (car vitrilech)) (+ (nth 1 vitri10) (nth 1 vitrilech)))/ V# t# E( u' W1 `4 x/ l
                        vitri10                (cons 10 vitri10)( i( p7 a9 k6 x- Q4 R
                        vitri11         (cdr (assoc 11 doituong))
! v- C' `8 Q" l1 p. C: G                        vitri11         (list (+ (car vitri11) (car vitrilech)) (+ (nth 1 vitri11) (nth 1 vitrilech)))
; d. m' O0 N: A( y, W% O                        vitri11                (cons 11 vitri11)
! O+ C) P. |: C: M4 T6 n# c0 Z                        dem        0
3 e) ^! l! t3 m: E1 Z% i1 m                        dsach        nil
1 I% D* o7 s, |; X% d- O                )
: D1 k: D2 f8 |) `4 |                (foreach tam         doituong1 y8 b4 \$ p' [% K. x+ r
                        (cond( q1 P) E% C3 ]1 }3 b
                                ((= (car tam)        1)        (setq dsach         (append dsach (list text))))% @% v7 h2 c4 X9 u9 S" b' I1 q
                                ((= (car tam)        10)        (setq dsach         (append dsach (list vitri10))))
6 }5 S+ ]6 L! [                                ((= (car tam)        11)        (setq dsach         (append dsach (list vitri11))))# g6 {# G+ R+ |& Y. R: ~% t
                                ((setq dsach         (append dsach (list tam)))): }$ ~0 J3 m4 I
                        )
4 Q! z1 k# R" |8 W% h) M4 }8 y                )* R" s3 l" o9 e8 ]4 f
                (entmake dsach)
: Q: u2 c( W  J; L4 ~* S0 e        );progn) `2 [0 I2 w' h; e' s9 X- C6 l
);if
, a6 f9 h! b, X* v& d        );8 E6 [, z+ s2 Y4 Y
;*********************************************************************/ T9 T6 u# }3 [" j  ~
;sao doi tuong cu sang vi tri moi
' V" L7 }7 r1 K. ]; o1 m9 x
3 s% `- F7 o+ B; i: S(defun copy_dt (tendoituong )
$ e) l% S3 q' {1 K* x/ P/ R(command "copy" tendoituong "" goc toi )7 y$ [0 \' Z4 |5 c2 I% E/ I9 O
);defun
0 J. i( Q* L1 {, `5 A- m0 e
0 L2 @8 D$ p  i; a0 M; s+ x8 {;*********************************************************************
  N: f6 o% b1 P5 |5 m, ~9 i* a6 {3 h
(defun c:ct ( / cumdt dodai thoat dem ten doituong textxl dem goc toi). w' j& |  l( @9 J2 o/ a' q5 @
; Khoi dau cua chuong trinh, Y& H. Z0 i6 g' j
(princ "\nCopy Inteligent...\n")+ @3 _1 C+ s2 v3 a
(setq         luuecho        (getvar        "cmdecho")
+ C/ Q' |3 U, {6 c! f# {  B: u: o        luu        *error*
6 ^: u$ N; V$ t8 c        *error*        ketthuc- C7 }- _, {2 z9 _& H
        cumdt         (ssget)1 u# z7 a/ a  K0 t1 x
        dodai         (sslength cumdt)
  Q+ j, E2 O9 b; V1 I        goc                (getpoint "\nSelect base point:")
2 j, |7 L* t+ K5 q0 m# _        thoat                nil8 N1 h# V: F2 |4 t$ {
        dem                0* K2 ^8 @0 l* Q1 ]
        textxl                nil
5 K# g+ r3 S  p, Q: {9 M);
; C4 ]1 a  ?/ D0 Y8 t3 D2 a(setvar "cmdecho" 0)
! [& B' y3 s% x! R; Loc ra duoc ong text de xu ly/ \% R$ ]( _# X
(while        (and         (= thoat        nil)- @4 M9 X" t  K8 e* I/ I
                (< dem        dodai). [% Q) t# I( X* P) H2 _; w: z" |
        )8 g- C: y3 {. p' ]/ s9 `; U
        (setq         ten        (ssname cumdt dem)+ \4 y: e  {4 [
                dem        (1+         dem)
6 W4 f. f3 e% M, U& \* |7 }                doituong (entget ten)
( @" j! T7 m: P                kieu         (cdr (assoc         0        doituong))                        - z6 f! h, _/ n
        )
0 U5 a2 x- p- P$ f7 I        , G& o7 B: p9 h) C7 Q% R5 F6 m
        (if (or (= kieu                "TEXT")1 P' m5 {9 _# b/ g; V2 G
                (= kieu         "MTEXT")        2 ^7 `5 f. J9 j6 I: i0 |, f# w
                )+ j& U/ x) |+ F) J1 {. G
                (setq         thoat        T7 L9 @, D1 l3 E' _3 ~" `: t7 f
                        textxl         (cdr (assoc 1 doituong))           f0 j% z1 W1 r
                ), N& C; R! v3 S% I
        )' ?4 t! \' j! t$ q% Y9 ]- l
);
* p) u8 i2 b/ h7 c' U1 X(while T
+ {2 t/ p1 Q7 s$ `0 W(setq        toi                (getpoint "\nSelect next point: " goc)4 a- z0 b* C+ |9 e2 |4 {) M) j" B
        vitrilech         (list         (- (car toi) (car goc)) (- (nth 1 toi) (nth 1 goc)))- O& k$ L$ |  B( [
        dem                0: K5 G- x8 Q! Z8 R: y* E
)
! F! _1 T6 B1 X8 u3 K- I(while        (< dem dodai)
6 q; ^. @3 }% K4 x0 b6 _8 N7 l4 {% @        (setq         ten        (ssname cumdt dem); ^3 F% {1 R; c. I" J
                dem        (1+         dem)4 {( u' z9 E: l1 U: D- f6 A
                doituong (entget ten)
+ V6 ]; h' O  Y- A3 N2 L                kieu         (cdr (assoc         0        doituong))                        
2 x  D; y3 m1 r! D2 _) _1 E/ q        )
" ~5 K, z6 y( W7 y/ _$ f: _5 I0 K5 e& M5 h( C
        (if (or (= kieu                "TEXT")
) ?  |" L8 w: R                (= kieu         "MTEXT")        
6 N! d$ Y+ B) ~/ n& \, V/ ^                )
! \7 v& C4 p. `2 S* D6 a" B; f. o  \                (doitext        ten), P: k* f4 i& R; g
                (copy_dt        ten)
$ y; E2 J5 ^% f0 ?5 y) r- y3 `6 o: x# {4 t
        );if
/ K3 [, _1 T# k2 S)+ Z. y% ]& E; J+ _: ]  x4 W
);while
5 I8 U9 O7 h6 H5 o" H(ketthuc)' C% I) a, O; Q
);defun
- y# [+ r  ]* A(princ "Type \"DG\" to start")
. w8 C. Y7 I( ^3 {% H! K7 s;Note: bien toan cuc: textxl vitrilech
  X3 G8 J; m  }7 c6 N6 w2 }6 s' W3 G
;=====================================================================# D/ C! w3 k0 z8 z3 F: T9 ?
;;; PLJOINFUZZ.LSP
! }/ _' B5 V! D- D. {2 n- k% v;;; Joins lines, arcs and polylines using a fuzz distance0 ]! J0 B( l/ O% c; M! j' }
;;; If only one object is selected it tries to join to all objects that are possible* v3 y4 t7 \: \3 ?7 p, d. `* u
;;; By Jimmy Bergmark
) y" Q, o/ V4 C! j9 S6 _5 k;;; Copyright (C) 2003-2004 JTB World, All Rights Reserved# W1 l6 J* `5 |/ l9 H
;;; Website: www.jtbworld.com( E4 ?, Y7 R+ b3 u* t
;;; E-mail: info@jtbworld.com' w7 h( u" Y. C6 E$ `
;;; Tested on AutoCAD 2002,2004 and 2005
! I6 L% F9 K! E$ f9 R0 y( j;;; Latest revision made 2004-11-11
$ Y/ b8 Z/ f8 Z# E9 X8 Z;;; Minor code cosmetic change made 2004-11-13( j$ k! }3 ^/ E
;;; Bug corrected 2004-12-23
7 O$ V# y' X8 `6 L* s/ @5 o  c& P* E+ V
(defun c:jf () (c:pljoinfuzz)) ; this line can be commented out if there is an existing command called jf
5 {, P/ O; R9 i# y(defun c:pljoinfuzz (/ ss1 entLine objType oldcmdecho oldpeditaccept fuzz okObjects); b+ F- }; u" |* G
  (setq oldcmdecho (getvar "cmdecho"))
& ?$ w) Q* K$ Z6 B  (setq oldpeditaccept (getvar "PEDITACCEPT"))
: @9 F- r: y0 P' Y* q. x9 F- z  (setvar "cmdecho" 0)8 Y* x# H$ R3 {% d. ?" V9 I
  (setq A2k4 (>= (substr (getvar "ACADVER") 1 2) "16"))# x$ a3 c# w- x6 y  J
  (if A2k4 (setvar "PEDITACCEPT" 0))5 ^% c7 O  s  m4 D  p
  (setq        okObjects '((0 . "LINE,ARC,POLYLINE,LWPOLYLINE")))
' A$ B! z5 V9 S" t# U: v  (princ "\nSelect object to join: ")
9 ?' W+ m4 Y1 \$ P! ^  (setq ss1 (ssget okObjects))
0 T( J" c2 s) i8 `" y$ O- Z8 D  (setq fuzz (getdist "\nFuzz distance <0>: "))6 D) U6 c1 N7 s  g$ c$ ?
  (if (= fuzz nil) (setq fuzz 0))
7 [2 F+ h# f- P  (if (/= ss1 nil)
3 o' F8 J$ R+ f2 ~8 o      (progn- i8 u+ {* P9 }' x
        (setq objType (cdr (assoc 0 (entget (setq entLine (ssname ss1 0))))))# |3 c5 F4 X* m5 Q0 O+ `8 ?6 ?" m
        (if (= (sslength ss1) 1) (setq ss1 (ssget "X" okObjects)))
4 u+ s( v. {4 }        (if (member objType '("LINE" "ARC"))
8 A8 w5 ]/ V2 E          (command "_.pedit" "_M" ss1 "" "_Y" "_J" "_J" "_B" fuzz ""), \! X' M2 ~4 b% R8 A! F  o
          (command "_.pedit" "_M" ss1 "" "_J" "_J" "_B" fuzz "")8 d6 w, D# j0 g( q) H7 I% h  j! |
        )4 J  \! t3 M& A6 q' K
      )) C' V( a; }% H' Z0 f
  )
; O1 t8 B9 ?. x# `: N! t  (setvar "cmdecho" oldcmdecho); w+ E) N1 e; I. y
  (if A2k4 (setvar "PEDITACCEPT" oldpeditaccept)); g8 G  ?/ W' V# O# T: ^
  (princ). E+ A4 @, t3 t# b& O1 t" K
)
) R* l# _' f$ W0 C* ^6 y6 X+ n5 R. [) H% U! G) C3 P, w8 q
;===========================VE CAO TRINH===========================& v4 e" T2 l; g4 {! c
8 |$ D5 q; c; \7 g
(DEFUN C:Cotcao (/ CMD PT1 PT2 PT3 PT4 PT5 PT6 PT7 PT8 NPI TX DX DY TL OSM OLL2 {, t( `* j& y0 e/ x
                CRST RSIZE TSIZE STR PRMT FCH NBC OLDERR). S1 R1 U: y9 ~: q4 l. L1 C1 j
(SETQ OLDERR *error*( P% v; i5 D, L
      *error* loisb)
; q4 [1 |9 K1 W; B6 V) ~% ^# _(command "layer" "m" "dim" "c" "" """")9 V" V4 @" Z& \; k+ F8 H
(SETQ CMD (GETVAR "CMDECHO"))
! r. V5 x# K2 I2 P(SETQ NBC (GETVAR "CLAYER"))
2 Q6 C' ^0 B" ?. A) ](SETQ OSM (GETVAR "OSMODE"))
# A$ W$ P6 F+ y; [+ g" z(SETVAR "CMDECHO" 0)  H" y6 Y0 c  K4 Z: t1 l  Q5 N
(SETQ PT1 (GETPOINT "\nDiem cao trinh:"))  v1 j0 G5 I. E, P' s0 A, U  d
(SETQ TX (GETSTRING "\nCao trinh:"))
; F- m6 p1 j3 s  O/ y( U* p/ ?: P(SETQ FCH (SUBSTR TX 1 1)), M1 u- G7 c: h0 L& S
(IF (= FCH "@") (SETQ TX (STRCAT "%%P" (SUBSTR TX 2 (- (STRLEN TX) 1)))))
+ t/ ^2 F* v" n+ i* L8 M/ `(SETQ CRST (GETVAR "TEXTSTYLE")), X9 u0 b% i8 g2 x( _1 L
(SETQ RSIZE (CDR (ASSOC 40 (TBLSEARCH "STYLE" CRST))))  I. ~* `7 s+ }2 W! O8 V
(SETQ TSIZE (GETVAR "TEXTSIZE")): C; ~; e- m! t" E6 g
(SETQ STR (RTOS TSIZE 2))3 Z' T% h8 J7 W/ Y9 A; H0 H5 d
(SETQ PRMT (STRCAT "\nText height <" STR ">:"))- f6 Y" D3 U2 g6 J
(IF (= RSIZE 0)5 I: R' I  T  }' O" [
  (PROGN
, B" T  M& H$ F* ~        (INITGET 4)
: _/ s; g; x1 v# u3 b6 `        (SETQ TSIZE (GETREAL PRMT))
& l( @: c2 E3 g0 k" {        (IF (= TSIZE NIL) (SETQ TSIZE (GETVAR "TEXTSIZE"))  [, n( x' T6 c) _6 j1 X! M# p: f3 x
                          (SETVAR "TEXTSIZE" TSIZE))
1 U% b1 v& ~* {; v  )$ g8 N8 g9 f; `* Y  [
)$ G) Z$ W( x! u' d# M( T/ e
(PRINC)
5 F- ~- z+ L# l, N3 S(SETQ TL (/ (GETVAR "TEXTSIZE") 2))* Y* @. _6 G2 F( a. a7 G7 w3 K
(SETVAR "OSMODE" 0)
2 ^# v( |* G, v0 E! j(SETQ DX (CAAR (CDR (TEXTBOX (LIST (CONS 1 TX))))))& J- g, ?! f. \: N
(SETQ NPI (/ PI 2))
) ~% D" [! S/ m# y9 t" x  U! k(SETQ PT4 (POLAR PT1 NPI (* 1 TL))). h; @4 _9 s% f4 Z: t( P
(SETQ PT2 (POLAR PT4 PI (* 2 TL))), v' |5 {1 b2 Z$ K& P  {+ Q$ ?
(SETQ PT3 (POLAR PT4 0 (* 2 TL)))
7 Y' ^( }; O; \7 P; ^" A: x(SETQ PT5 (POLAR PT4 NPI (* 5 TL)))
  S! l, z, L3 _' V( b! O(SETQ PT6 (POLAR PT2 NPI  TL))
3 D0 [4 T" d4 G4 P- f4 [9 w  g6 A! p(SETQ PT7 (POLAR PT6 0 (+ (* 3.7 TL) DX))): V# R. K* g& z; E
(SETQ PT8 (POLAR PT6 NPI (* 1 TL)))& V, K. _' p2 o6 l/ o8 U; D
(SETQ PT8 (POLAR PT8 0 (* 2.5 TL)))
% c" K. y) N. F( Y/ G# t; D; r" z* A(SETQ PT9 (POLAR PT1 pi (* 2 TL)))
- |6 V6 t- B% h$ E: j(SETQ PT10 (POLAR PT1 0 (* 2 TL)))
" K9 w" N4 I+ A" r: Y( f(COMMAND "COLOR" "7" "")  p) u9 ~6 K6 g6 _$ o" U
(COMMAND "STYLE" "COTES"  "tcvn3italic,vnh.shx" "" "1" "0" "n" "n" "n")7 Z# ?1 I9 k  \% g+ ~+ S& H
(IF (= RSIZE 0)(COMMAND "TEXT" PT8 TSIZE 0 tX) (COMMAND "TEXT" PT8 0 TX))
$ x/ V1 s. @2 U(COMMAND "COLOR" "BYLAYER" "")
( e! ?- N3 G7 Y! L3 H' y(COMMAND "SOLID" PT1 PT2 PT4 "" "" "pLINE"  PT1 pt3 pt2  "")
! w4 H  X7 x9 Q- B(COMMAND "COLOR" "BYLAYER" "")
2 B3 T( U0 f, n* r(COMMAND "pLINE" PT1 PT5 "" "pLINE" PT6 PT7 "" "pLINE" pt9 pt10"")
: t. I6 \$ f$ w: L1 n+ W0 V(SETVAR "CLAYER" "0")
4 O  g" d. K% i3 Z; e$ K5 k" g4 k(command "ddedit" pause)7 Z4 l' l" B; F  m7 Y6 y
(COMMAND "COLOR" "BYLAYER" "")/ {" i1 i: l: R1 d1 M
(SETVAR "CMDECHO" CMD)
# R6 W0 U& }, g& l* w+ B3 C(SETVAR "CLAYER" NBC)4 q+ B8 L- c& z5 m5 n, ?4 b
(SETVAR "OSMODE" OSM)( y% o' t1 k* e
(PRINC)
6 h2 i8 Z( l0 r$ `4 R! ?- J1 i)
$ I# H( ]7 M6 @, o# n: ~" Y  S: f% b* r! G9 N
;;; =========================== VE NET CAT CHEO (GC) =============================
/ J* P6 ?, X# K. C6 W/ u, d2 g) p4 b: y5 @6 {0 C* b( v/ c
(Defun c:G1(/ p1 p2 p3 p4 p5 p6 p11 p12 l ang)
' d$ ]- [0 {7 d9 Q        (setq x (getvar "osmode"))
8 Q$ ^1 o4 l- Z+ F5 p        (setq p1 (getpoint "First point : ")
2 e* M- L2 l6 t, y4 |              p2 (getpoint p1 "Second point : "))
, V& D8 W; X! _6 Y9 U9 N2 m        (setq l (distance p1 p2))
) P9 t  L5 v; U4 T0 y! I8 W        (setq p11 (polar p1 (angle p2 p1) (/ l 5))6 n, X6 w, H3 p1 U) E/ e0 L
              p12 (polar p2 (angle p1 p2) (/ l 5)))
: C) P# W7 V  z+ y( _4 N. |! V        (setq ang (angle p1 p2)): B$ j6 y6 x) |* Q% B6 X
        (setq p3 (polar p1 ang (/ l 2.5))
3 j. H% g- F& [3 `* `              p4 (polar p3 (+ (/ pi 2) ang) (/ l 5))8 C8 _7 J0 ^+ v  N
              p5 (polar p3 ang (/ l 5))
3 j* v  \$ S: f( V! x/ k* z                p6 (polar p5 (- ang (/ pi 2)) (/ l 5)))
4 Y6 @( W# i9 y; b4 _0 ^. E1 O        (setvar "osmode" 0)2 M( b' [  r" V& h4 |# L- X
(command "pline" p11 p3 p4 p6 p5 p12 "")
' [) `% \+ p" i* e% B6 I' r# ~ (setvar "osmode" x); U3 y& B8 e1 U+ F4 m" d7 P
)/ i# s* T4 F% V, \
;----------------------------------------------------------------------------------
- y9 Q7 T3 Q% f" c+ v. o(Defun C:G2 (/  ps1  ps2  pf1  pf2  pf3  pf4  pf5  pf6" d5 O! D, e, _; g
   pf7  pf8  sb   sh   se   ang  old_osmode);   (setq old_osmode (getvar "OSMODE"))/ h6 V  L2 ~) p" S; K
   (setq ps1 (getpoint "\Chon diem thu nhat: "))- D3 w# l& n. G& E
   (setq ps2 (getpoint ps1 "\nChon diem tiep theo: "))
+ E( w2 |% T5 C: y- A- j' ]6 u4 Z   (setq sb 50.0 sh 200.0 se 20.0)8 I5 w8 S) L# S; z( f+ e( V& O
   (setq ang (angle ps1 ps2))3 G& d0 H6 B/ i0 X* x8 D5 U
   (setq pf1 (polar ps1 ang (- 0.0 se)))
% k/ U- R  c1 f; [7 b$ A0 [6 J   (setq pf2 (polar ps1 ang (/ (- (distance ps1 ps2) sb) 2.0) ))
$ x; h; D- Y& w8 f/ q   (setq pf3 (polar pf2 (+ ang (/ pi 2)) (/ sh 2.0)))0 @& D8 @7 H0 e* ~
   (setq pf5 (polar pf2 ang sb))
' ?3 u3 W8 _. I+ Q2 O8 s   (setq pf4 (polar pf5 (- ang (/ pi 2)) (/ sh 2.0)))
! `4 F/ c* P% x$ J# r   (setq pf6 (polar ps2 ang se))
7 M0 E# Z6 L. l, C   (setvar "OSMODE" 0)4 z- f' c1 Z+ J! b5 {/ L: l
   (setvar "BLIPMODE" 0)
0 v0 q9 U' r8 w. L( T* Q+ A8 G8 s   (command "PLINE" pf1 pf2 pf3 pf4 pf5 pf6 "")
& D: O% q5 W7 U* G3 y   (setvar "OSMODE" 703)9 U3 v4 V$ t1 ~
   (princ) )2 E7 N* X! s* X6 Z2 n
;----------------------------------------------------------------------------------
" G% C  {/ r" B4 J7 r- ?) p1 t(Defun C:G3 (/  ps1  ps2  pf1  pf2  pf3  pf4  pf5  pf6: p2 y# p: L# f# k- H
   pf7  pf8  sb   sh   se   ang  old_osmode);   (setq old_osmode (getvar "OSMODE"))( d) I* D, J  T3 N
   (setq ps1 (getpoint "\Chon diem thu nhat: "))
0 f$ Q8 b5 f% p# }+ e7 \/ w! e  |   (setq ps2 (getpoint ps1 "\nChon diem tiep theo: "))) }; p' w! v0 o1 i# W7 \
   (setq sb 100.0 sh 150.0 se 20.0)2 K& d/ @: w4 K  |1 Y0 j7 D
   (setq ang (angle ps1 ps2))5 x! L, G2 ?- w$ [# p
   (setq pf1 (polar ps1 ang (- 0.0 se)))
* k8 s( v8 G: ?5 b   (setq pf2 (polar ps1 ang (/ (- (distance ps1 ps2) sb) 2.0) ))
' o4 l6 D) W. I- L; S' g. O  u1 W   (setq pf3 (polar pf2 (+ ang (/ pi 2)) (/ sh 2.0)))) q- M! X3 c; R/ T- r9 _& A
   (setq pf5 (polar pf2 ang sb)); c- g% R4 X) L6 S: V
   (setq pf4 (polar pf5 (- ang (/ pi 2)) (/ sh 2.0)))
  ~6 {+ I) _6 j4 J$ }   (setq pf6 (polar ps2 ang se))
1 ]) V/ W, P6 v  Q+ y' j8 i   (setvar "OSMODE" 0); Q4 Z4 Q& J; D6 R9 e% W! C. U7 y5 X
   (setvar "BLIPMODE" 0)1 ]& a: [" `  k* k, C
   (command "PLINE" pf1 pf2 pf3 pf4 pf5 pf6 "")
+ @5 `, W( q" s# \8 U3 E, K   (setvar "OSMODE" 703)4 R0 W' w; k" F6 ~( y' P  P
   (princ) )6 A9 Q5 @; m; u- \4 Z) e5 j6 B
;----------------------------------------------------------------------------------- C1 [7 `4 T/ u8 j* ~
(Defun C:G4 (/  ps1  ps2  pf1  pf2  pf3  pf4  pf5  pf6% W7 w# `& _6 ?, l
   pf7  pf8  sb   sh   se   ang  old_osmode);   (setq old_osmode (getvar "OSMODE"))
' H9 \: n) C% M0 l( \$ ~# {   (setq ps1 (getpoint "\Chon diem thu nhat: "))
" o6 |+ ?9 T( h$ E! g! l8 k2 k: U   (setq ps2 (getpoint ps1 "\nChon diem tiep theo: "))5 A! {- h. m: K1 B5 y  |7 {
   (setq sb 100.0 sh 250.0 se 20.0)
' |9 r" D1 Q) J' O8 e   (setq ang (angle ps1 ps2))' a3 c1 {0 F8 ~3 W0 m$ W8 D
   (setq pf1 (polar ps1 ang (- 0.0 se)))
  Y4 d/ S  G* R' `   (setq pf2 (polar ps1 ang (/ (- (distance ps1 ps2) sb) 2.0) ))) }+ x" I1 F5 g  P9 E
   (setq pf3 (polar pf2 (+ ang (/ pi 2)) (/ sh 2.0)))6 D' R0 B" R9 K1 Q
   (setq pf5 (polar pf2 ang sb)); n0 @/ |2 ~1 ]# X6 ], J0 F" B8 }8 P
   (setq pf4 (polar pf5 (- ang (/ pi 2)) (/ sh 2.0)))8 O4 Q( j6 E" f& j6 w0 ]
   (setq pf6 (polar ps2 ang se))
4 Z( q7 m" j. F   (setvar "OSMODE" 0)
4 V! j& ]1 H$ d# }& b( l   (setvar "BLIPMODE" 0)
! b9 C) ?. o! R" z3 K! A   (command "PLINE" pf1 pf2 pf3 pf4 pf5 pf6 "")! r9 r% W1 B7 b7 y$ n. `. t
   (setvar "OSMODE" 703)/ M% f3 I  q: u: Z, S# f6 {
   (princ) )
# v3 D2 n) d& }+ m
& d; G! Q2 G9 {" c" D) ^& L1 O* k& y;==================================================================================- L! H( z9 N8 g+ s9 [
(defun c:ang (/ ent pt1 pt2 ang)$ u- U( [4 w& t. @7 W
   (setq cmd (getvar "cmdecho"))
  r( \& c* v  e, Q/ ?  (setvar "cmdecho" 1)
' h7 }+ v0 C& y& Y) \  (prompt (strcat"\nThay doi truc toa do theo duong thang chon truoc"))" z' o1 @0 {1 F1 [3 L
  (setq ent (entsel "\nChon duong thang:"))& M& m! T, @  s
  (if ent
, t" Y$ L8 N  y, E5 t   (progn5 n( ~3 {4 ?: [7 j* w& X7 U  S
    (setq ent (entget (car ent)))% w2 P. W1 R8 r7 ~4 W
    (setq pt1 (cdr (assoc 10 ent)))
$ P  w: ]5 g& j' G6 P6 m# A5 [    (setq pt2 (cdr (assoc 11 ent))); q1 X( `1 z4 j- a! A
    (setq ang (angle pt1 pt2))
% z- ]: c5 `$ ]    (setq ang (/ (* ang 180.0) pi))
# G7 g5 J0 f' s" q* F    (setvar "cmdecho" 0)6 c! |$ r1 V# b+ V/ d
    (command "setvar" "snapang" ang)
( o$ E1 W( X$ n3 D3 o7 @" r, L: K    (princ "\nGoc cua truc toa do moi : ")
2 ?4 O+ t5 L) ?7 c" t    (princ ang)+ n8 r% E' u$ w: d/ i9 @  m
   )
( ^3 f: G4 J3 W3 Y* @% H* L) r  )
* s1 Z' H2 S5 z* y6 d  (setvar "cmdecho" cmd)1 g0 \" H2 O( A/ ^6 P
  (princ)
  H3 j( D; J% J+ _, O): |; U5 u7 H# J' B4 x9 B+ s
;==================================================================================6 ~/ w/ s2 E; B8 W
;==============================   KY HIEU DOI XUNG   ==============================
2 n( P% N7 a8 U5 \; A;==================================================================================% D  S4 M" n  W9 ?* d

# h, {- \' I& a' I(DEFUN C:DX (/ CMD OSM OLDERR PT1 PT2 PT3 PT4 PT5 PT6 PT7 PT8 PT9
! }& A  \0 D6 d; m, F$ A( ~+ X6 M& P- p                SZ G45 G135 G90 G180 SS loi)
' C& X/ l, h; O% j7 T(defun loi (s)+ c4 A" w- ]! |  b5 S: j
(if (= s "Function cancelled")8 t. @4 s* D% v: J/ |
     (princ)
# o6 a* y" x# E, H* {' D0 i$ q# q     (princ (strcat "Error:" s))
( X4 M2 W* i; w! Z" t* o )
: k7 O3 N: t0 M) a. C2 u% L         (SETVAR "CMDECHO" CMD)
+ E$ c  r' S$ m4 Y$ V         (SETVAR "OSMODE" OSM); B) U3 I# v* z: i% v" Q
        (SETQ *error* OLDERR)" b5 Z9 n* ?* o+ Y6 [3 T! |$ n' Q
         (PRINC); H0 D1 ~' z# }
)
7 m+ d9 L' d& y (SETQ CMD (GETVAR "CMDECHO"))
/ D( i( f- t# d- ~6 Y0 f* P (SETQ OSM (GETVAR "OSMODE"))
2 {+ D* x9 W  p) r: j9 l! ?: n (SETVAR "CMDECHO" 0)
" o( Y9 U- t# X. O$ J (SETQ OLDERR *error*
& M+ {% j/ r2 Y+ x1 b% V0 e        *error* loi)
! w) E: ^3 E: ]3 r: Q: B/ k4 \, ~; W (SETQ SZ (GETREAL "Size <1>:")): {. W7 a1 \  v" p( Z
(IF (= SZ nil) (SETQ SZ 100))! w; m# S( ~; [# {" Q, R
(SETQ G45 (/ PI 4))5 K! ?4 O  d$ W0 Q8 D1 ]: i; h
(SETQ G135 (* 3 (/ PI 4)))
0 K. S9 W. I: l$ L/ ? (SETQ G90 (- G45 (/ PI 2)))
# ~2 L% w! ?# U! T" w! L4 s% E (SETQ G180 (+ G135 (/ PI 2)))
; [/ [$ i' t. c0 H8 O$ k (SETQ PT1 (GETPOINT "\nDiem doi xung:"))
+ p9 D4 o' ^3 N6 ]) H0 B2 ^' C (SETVAR "OSMODE" 0)
& ^. s5 ^& W- `6 k8 ^6 }6 c; y (SETQ PT2 (POLAR PT1 G45 (* 2 SZ)))
% p# Q9 {% ~5 U (SETQ PT3 (POLAR PT2 G90 (* 2 SZ)))8 u( C3 U3 g3 B& D8 A
(SETQ PT4 (POLAR PT1 G45 (* 1 SZ)))
/ v% L* }7 z3 c# d (SETQ PT5 (POLAR PT1 G135 (* 2 SZ)))
- Z% v/ `: N+ ] (SETQ PT6 (POLAR PT5 G180 (* 2 SZ)))) l) \5 x1 j0 M8 V: Y- ]& @+ q* v& v
(SETQ PT7 (POLAR PT1 G135 (* 1 SZ)))
: [" m& P1 E1 R( O; w% [3 s (SETQ PT8 (POLAR PT1 G45 (* -0.7 SZ)))
& K% P: S% Z& c  B0 o# T( Y (SETQ PT9 (POLAR PT1 G135 (* -0.7 SZ)))
: ]. h# v" a4 w# @6 [2 x (PRINC "\nGoc quay:")9 I8 M) x1 G8 P2 W
(SETQ SS (SSADD))
8 i" S3 u. k# W! w0 ?9 t8 A, E(command "layer" "m" "Dim" "c" "" """")' {) I- G) w4 K& K
(COMMAND "COLOR" "1" "")3 C4 ~+ y! o* p3 }: K
(COMMAND "LINE" PT8 PT2 "")
0 E& K  n. {" a- D (SETQ SS (SSADD (ENTLAST) SS))
, l7 |/ l% [4 D, h( M+ Z& K+ L (COMMAND "LINE" PT9 PT5 "")& w6 D. v9 i, {3 f7 T6 v
(SETQ SS (SSADD (ENTLAST) SS))
1 e* X5 Z. K  @5 ]7 g) S(COMMAND "COLOR" "1" "")9 z. S# p% y. S# f
(COMMAND "SOLID" PT2 PT3 PT4 "" "")! ^, w% [/ w6 l6 x. z" U
(SETQ SS (SSADD (ENTLAST) SS))9 U6 ^8 d' D1 B9 `5 v/ f+ X
(COMMAND "SOLID" PT5 PT6 PT7 "" "")) W( {, C6 i% P5 G+ N9 S/ T3 m
(SETQ SS (SSADD (ENTLAST) SS))" ?5 y" {  `" q" u0 f
(COMMAND "ROTATE" SS "" PT1 PAUSE)& z; S. Z% `& p9 E
(COMMAND "COLOR" "BYLAYER" "")
: ^% C0 ?# f- Z (SETVAR "CMDECHO" CMD)
% }" H; L8 h0 a (SETVAR "OSMODE" OSM)4 x, V' \. L# [
(SETQ *error* OLDERR)
# v" ~3 ^! ]) W' ~% L9 o+ W (PRINC)
4 f, \6 |# r9 M4 v)' Q: ~# _7 V) K+ k) n

2 k0 B! C9 T& m$ ?8 V! v;==================================================================================
& |7 Z8 \" r' G7 `  o9 A;=================================   KY HIEU TRUC   ===============================
$ v3 F* ^8 t+ q. m+ B;==================================================================================( M% [( ^' b) u* X# R
9 N5 X6 H& o7 ^+ D: l% k* Z
(defun C:vetruc ()
  W( B- J5 B* o(setq bk (getvar "USERR3"))2 h, h% f( _2 e2 b. ^
(if (= bk 0)
. o( t/ z) o6 v# @1 o( s. i  (progn: O2 n2 }# C% u, ]) Q4 U# X5 I0 X
    (setq cont "1")
/ n, u1 T  C* N' I+ J$ a    (setvar "USERR3" 1)
$ E) \  T. h; q- v    ). s+ k$ Z2 `& ^# v6 H
        (setq cont (rtos bk)); s2 J& Q" ?0 e% d3 M8 J+ z
)
8 y' C) p+ }) O$ D% f# T3 q# V7 F(setq pt1 (getpoint "\n Nhap diem dat:"))
% M0 @3 [* |4 _. S5 A) c(command "layer" "m" "Dim" "c" "" """")
  W! w0 B1 \: }. ?, X( W) `(command "osnap"  "")' h+ Q8 d; E  v
(COMMAND "COLOR" "7" "")
* l. h! R, b9 e9 Z(command "circle" pt1 150 "")/ X# h% \( t: ^# L6 h' n) ?5 j
(setq pt2 (polar pt1 0 150))
) Y* g) P, x! F0 t# c# w(setq pt3 (polar pt1 (/ pi 1) 150))
4 [; ?; k- a' u( D" `$ b(setq pt4 (polar pt1 0 300))( t: D$ G) s( }
(setq pt5 (polar pt1 (/ pi 1) 300))( k6 |4 c: p* k  f5 U$ g
(setq pt6 (polar pt1 (- 0 (/ pi 2)) 150))
7 i6 H( m! h  P7 T/ k' r) ?) K(setq pt7 (polar pt1 (- 0 (/ pi 2)) 300))
. a0 q* Q! `4 h; V(setq pt8 (polar pt1 (/ pi 2) 150))
( i8 q/ H, ^! e, j8 j, u(setq pt9 (polar pt1 (/ pi 2) 300))
$ i: {$ H; L" r) ](setq pt10 (polar pt1 0 150))
: e) A8 N: B1 W(setq pt11 (polar pt1 (/ pi 4) 150))! g1 _8 c2 U1 H% ~& h" n
(COMMAND "COLOR" "BYLAYER" "")
" O( V9 T8 ^5 A) K: y% i' S+ P(command "line" pt2 pt4 "")
4 Y' V) r: d' D( f; A/ A; G(command "line" pt6 pt7 "")
! a# y( ~/ K1 y; H(command "line" pt3 pt5 "")9 u/ Y  T# I) T9 W. E% S5 ]' y
(command "line" pt8 pt9 "")
: M- |9 @1 {' o& ?" e: K, u3 ~(setq dk (strcat "\n Size:<"cont">"))- h. L) o5 m; V5 z8 ~  t
(setq bk (getreal dk))
6 U  o' P/ I% w" H  X) r/ t" u(if (= bk nil)
! h# G3 P. E: G$ L (progn) T# v  V- M. P4 }9 L/ @+ K
  (setq bk (getvar "USERR3")). w) f' N  ]; d' T+ ?3 j9 r
        )
- b# _0 D8 j( s- k6 g  (setvar "USERR3" bk)
' L4 P0 d$ o  {9 V* s) M1 K  )0 \7 E2 W  }$ Z- R. U6 _1 X4 m/ r
(command "scale" pt4 pt5 pt7 pt9 pt11"" pt1 bk"")
6 O6 G- l- N  [* ^$ ~, b(COMMAND "COLOR" "7" "")
  Y/ R# n( v, X$ X' S+ f(COMMAND "STYLE" "Truc"  "impact" "" "" "" "" ""): T" E& L# C" R; ^! t6 }) J' x/ t' L
(command "text" "j" "mc" pt1 (* 150 bk) pt10 "A" "")
0 u- Y+ z( v6 d(COMMAND "COLOR" "BYLAYER" "")
1 j, i  ~" m# a3 B)* S. O0 ]( N1 z% Z2 F& d

  r8 P' x3 M; R) }0 v  n  b$ G$ @;=====================================================================5 o% o& z* T$ X! L
;CA - Reverses the case of text.  (Upper to Lower and Lower to Upper.)- ^0 K. f( e* u
;+ r* k0 C) W1 c3 U
;Jeffery P Sanders/ _! U5 p: K- w/ \
;" h' p0 }1 Q' W% l
(defun C:CA(/ en enlist tx newtx cnt tp asc note)% k* K; n* O& }# S/ M# y" Q4 i3 d
(setvar "cmdecho" 0)+ N; C2 D( g  |6 V
(if(setq en(entsel))2 R8 a  s: z" F# O" S: p  z# A* ^5 e
   (progn: a  j- Q* R7 `1 \! n
      (setq enlist(entget(car en)))
( ~3 T. i2 n% S- C9 J* t      (if(= "TEXT"(cdr(assoc 0 enlist)))$ X! N. N7 l+ [1 z  d* _0 _
        (progn
' Q7 ~* J! Q+ D0 G5 O# u# x- B          (setq tx(cdr(assoc 1 enlist))5 m' T8 c& l6 C  T9 a9 C# ~8 W
             newtx "" cnt(strlen tx)
0 C2 U8 E  H- v5 ^+ ~2 B: B3 c              note "\n...CASE Reversed. \n ", a( z4 v4 M% A1 q# _/ ^* }4 D
          )! t9 e/ S% S! R0 V% C) w( z
          (while (> cnt 0)8 k7 s5 @9 S* M! }8 `
             (setq tp(substr tx cnt 1))1 D; Z/ u) R' V
             (setq asc(ascii tp))
* v1 H( F9 `4 X# c+ U* g7 E( q5 \             (if (> asc 96)
) R/ G8 q) V5 b; c1 s' j6 Z8 B               (setq tp(strcase tp))
7 l7 V4 J% i! p( h               (setq tp(strcase tp T))3 e: ~& ~7 L9 ?. v
             )
6 E' l5 S$ z' G# s" M, g# u' L             (setq newtx(strcat tp newtx))6 a2 s' S0 Y: l/ F6 @7 S
             (setq cnt(- cnt 1))7 ]' _% H+ k0 ^3 f" s  `8 P2 X
          )
5 ]- U% k, O. L9 ^# [          (setq enlist(subst(cons 1 newtx)(assoc 1 enlist)enlist))' m7 S) z  P9 V( Q: n! J
          (entmod enlist)5 V, S( |1 \; n+ i3 C8 t: ~
        )
" v( ^3 q1 W6 X* s        (setq note "\n....Text Only Please. \n ")
/ I2 j7 e  [! ~$ D9 ?# E      )8 \" P$ P0 C$ u& @: E1 H/ ]
   )
5 `9 C7 `+ l* W/ z2 d  P   (setq note "\n....Nothing Selected. \n ")
8 T% y( e6 N% Z  )
  R/ G. ~$ Q1 Y7 _4 c& R, g  (setvar "cmdecho" 1)/ O2 }2 p6 Q% f: o; _9 w% i
  (princ note)
: N  q6 f7 x- U: E, }* X  (princ); G7 ~+ W' z! U' i1 x) z9 N
)" X) ~5 D2 }3 o1 K* \

6 Y2 X$ h( X$ r' G/ u7 Y;=====================================================================3 x4 c+ z+ b: ?4 Q" ?+ ~9 X( i) @1 @
;==================== NEW TEXT STYLE UPDATE ==========================
; `5 \! m! G3 |) g; s7 c2 x;=====================================================================3 ~, q6 L  T# v# W% G# r

' w7 F. i3 p% K5 B- @3 s, M! u(defun c:nS (/ tdt ssdt sodt index)
  h9 W+ ?" V& N+ \(defun ObjName (ssdt /)! ]( T4 t' @; ^6 T- G# Y* o8 Q# m
(cdr (assoc '0 (entget ssdt)))- L3 J% @2 \" M9 V; [% P
)
3 W9 s! l9 V+ r: g. G(defun MoPL (ssdt /)
; ^0 E& \* ?& ~( J8 E- x% E/ [(= (cdr (assoc '70 (entget ssdt))) 0)+ h4 P* {. f! m. k5 o# u
)7 j: B" {, F0 R  z$ b0 n  \" ^( o7 W
(defun NoiPL (ssdt /)' h6 _# R: f5 S' ?; \% W  q
(if (MoPL ssdt)$ ]; X) u% `. h" J0 f7 l* W) |1 Z
(command ".PEDIT" ssdt "J" "All" "" "X")# G+ Y3 r1 J3 c- e
)$ w( h6 W, u. _# u* d
)5 T3 U6 B! t- u4 P
(defun NoiLC (ssdt /), o. x- }/ ?5 q; C0 ]  b& g
(command ".PEDIT" ssdt "Y" "J" "All" "" "X")
# `- d$ X3 G4 p$ y8 j: ?2 x)
2 ?8 }0 S% q. y4 Q; V(setq% C8 c+ {! s4 T
tdt (ssget)2 ^! h+ f3 q" A$ u( l) P# b  A
sodt (sslength tdt)' V4 {2 E4 v+ e  }* e
index 00 D) ~0 G/ {8 Y  [/ Z7 ]
)6 B" K. g5 y) ~& ?6 U
(repeat sodt* U' y% Z  y/ E
(setq2 u+ s9 ?/ b! C6 \' I
ssdt (ssname tdt index)
5 U( Y6 B+ @& K; Uindex (1+ index)
4 \9 ]& b) \& ?  m$ Y- ?)' c- h! v  m# j5 K4 @% A' {
(if (or (= (Objname ssdt) "LWPOLYLINE")1 B4 }: M. z9 a) a- h2 j; p5 U! E
(= (Objname ssdt) "POLYLINE")
& V7 K# T6 _) t) W: Y( _)% B% O0 T. o  q) c3 [
(NoiPL ssdt): Y0 {1 N# ^6 d
)& W; X& Z1 K3 d: g
(if (or (= (Objname ssdt) "LINE") (= (Objname ssdt) "ARC"))! P; f$ u! s4 l$ }1 J9 a/ O
(NoiLC ssdt)
$ `- n8 h" G6 S7 l; o- x)8 P# W" O& ^0 w2 V7 j
)/ \' H6 f: p" A4 M4 d$ o3 s7 K
(princ)) }/ w; b- x5 V. C
)
2 p) }$ W4 k5 E6 E! C0 A" Y0 M7 `& k; T& [+ K6 G# m. D
;=====================================================================- h! }# |1 ]9 ?' [9 V) W! r' g
;;; AREAM.LSP; v5 G' }: L$ L, W
;;; Function: Calculates the total area of selected objects
; G; a5 j0 b0 ^9 R2 b  V: q;;; By Jimmy Bergmark2 [( |* k" ?. n: A. a, U: R& h/ ^
;;; Copyright (C) 1997-2006 JTB World, All Rights Reserved" [2 k  y$ b2 T1 u7 J5 D  G
;;; Tested on AutoCAD 2000
% T) W5 l7 K6 k5 o  t
% G5 v( {) k4 [  @: N2 g4 b(defun c:ea (/ olderr oldcmdecho errexit undox restore ss1 nr en tot_area). G( \; j, [5 m2 J/ M9 z9 E( M
  (defun errexit (s)  p1 S3 T" j5 d5 K, E1 ?3 p0 s6 _
    (restore)
4 |; F4 u+ e, p3 h8 t6 a+ H% _5 S  )' t. V& }; L. w/ B# r) Y5 S" G' o
. j- z  ?4 y8 [/ _' N
  (defun undox ()% w. A- C3 O3 H
    (command "._undo" "_E")
3 V; w5 ~4 w" f: ?% @- m    (setvar "cmdecho" oldcmdecho)+ y+ _& V2 l5 Y% G, r
    (setq *error* olderr)8 \* E& ^: a2 l) P& N
    (princ)7 I2 u: q' o8 p4 A7 O# j7 {
  ): Z8 w9 M% j* U+ f/ M3 Z

( h% f+ }" c+ ]5 i# \& k  (setq olderr  *error*, b. t/ m4 c! U" X+ i1 B
        restore undox3 c, h7 w8 L/ Q# N9 a$ e( v2 }
        *error* errexit$ I* Y3 J% M" z( \+ P5 `8 v$ E% [
  )  ]! w# `! }4 b$ ]% a/ V
  (setq oldcmdecho (getvar "cmdecho"))
" U& B) T1 J& J" }' O  (setvar "cmdecho" 0)% O  q- h( j, K* {1 G9 \' p. `$ T
  (command "._UNDO" "_BE")& u5 M$ q) C' d4 u. g, A
  (if (setq ss1 (ssget '((-4 . "<OR")
0 l8 E" k6 t6 X4 S1 _8 q+ g2 B/ M4 a                         (0 . "POLYLINE")" w0 Y) ~9 h; z" V
                         (0 . "LWPOLYLINE")
8 ?: s  S/ I, S+ k: ?+ ]                         (0 . "CIRCLE")
! u% T, C+ K' e$ r, U( ?                         (0 . "ELLIPSE")
% ^; k2 _9 |- w                         (0 . "SPLINE")
3 U4 K# |, D+ a! m1 g) p# T3 L1 U                         (0 . "REGION")$ y6 S. z6 ^. Q7 c2 Q2 X* Y
                         (-4 . "OR>")$ I' Y% O% c" n. X- O
                        )
6 M: L& X) g# T" r% b2 J                )5 H& k5 ~7 N% f; l
      )
- a* m! |2 v/ G8 T4 V2 v3 [3 r    (progn8 Q4 x- K, a! Q2 @+ m
      (setq nr 0)
7 f; q2 X* J2 [: E$ M1 m, U      (setq tot_area 0.0)- s$ U% B0 e' j+ m( S
      (setq en (ssname ss1 nr))( @7 f! T: a! g, h8 D+ ~
      (while en7 S8 E6 v9 t: s, m* i" m
        (command "._area" "_O" en)
3 e# r: h* j$ N9 Z        (setq tot_area (+ tot_area (getvar "area")))6 }" \9 L' n/ @
        (setq nr (1+ nr))
/ s, M$ e0 H( a8 Y3 \2 u        (setq en (ssname ss1 nr))7 w1 U) ~9 k1 c
      )2 d) v6 ]0 U6 v
      (princ "\nTotal Area = ")( D1 F" _4 D/ N& v/ n
      (princ tot_area)
1 t; I9 V" e* h    )
0 E, {8 G# H6 \2 g3 S  )2 n0 R% k% \9 e7 _
  (restore)3 x0 f8 x; N! @& B- E( a7 M
)
5 ?( a7 J7 V: Q7 X9 }. [5 L- R4 D. ?  k
;=====================================================================
% _1 E2 r0 T; C3 f% [. Z! ^2 W;;; By Jimmy Bergmark2 l0 q# L0 R7 c! x
;;; Copyright (C) 2008 JTB World, All Rights Reserved3 u( ?: }/ G& G1 c
;;;
4 J* f. {3 c/ F5 j9 ]* p+ ]; I;;; Created: 2008-03-31: |/ x  v# P# c5 k
;;;
- ]- I( \. e8 z;;; Convert Attribute definitions to mtext) ]! n7 d+ f$ L. A& o
;;;) e% w5 \+ R# X; O# m% C) j
) I7 f+ G6 o# Q- \5 B! b: v
(defun c:ATB (/ eset1 blkcnt en enlist tag1 ht pnt vl space)! b/ S, K. P/ w3 W0 M5 H7 U4 F8 U
  (setq        eset1  (ssget (list (cons 0 "ATTDEF")))+ B. A6 L$ s  u) H* z" q, `8 I
        blkcnt 0
. b4 z- Q$ h6 _6 @1 M/ w& x  ): ^8 G$ D" V) C! K

* M; y+ w; B: h  (if eset1
/ m( B  n5 O3 F$ `2 @4 |3 p    (while (<= blkcnt (- (sslength eset1) 1))
# [3 Q. U& K7 J4 \) l      (setq en           (ssname eset1 blkcnt)
& X! }# m2 A6 u8 j& ^% N0 D            enlist (entget en)
& a1 k8 _# J  {% C            ht           (cdr (assoc 40 enlist))
8 Q9 k  H5 t! C; T            pnt           (assoc 10 enlist)& r0 b4 @; [& }' P+ i6 m/ r
            pnt           (subst (+ ht (caddr pnt)) (caddr pnt) pnt)+ ]" D- I/ r( k% W
            space  (cdr (assoc 67 enlist))& I2 ~5 u, }+ V6 J  d% J% Y
      )& c9 \* u& ^- F3 X1 N0 T
      (setq vl (list; s& G' z7 t4 m( y. Z. ]
                 (cons 0 "MTEXT")
, _1 L0 V! x' l. e0 W2 \1 m. w                 (cons 100 "AcDbEntity")
$ X) N. Q- Z2 o6 r3 z9 C' f                 (cons 100 "AcDbMText")2 j, ]! J0 v/ K4 F/ c
                 (assoc 7 enlist)0 t3 V4 ~9 d2 {7 Z4 S
                 (assoc 8 enlist)4 a0 F, c4 g4 r" y( h
                 pnt4 r0 ]. q. m0 A% j) N
                 (assoc 40 enlist)9 P6 g+ X  ]5 Q. T1 P# B( F
                 (cond ((assoc 62 enlist))
5 H! V& C  p5 g5 W5 [+ P( g                       ((cons 62 256))
* R# N6 ^# o3 ^) r8 W  m                 )0 Z! [' C" u- c9 U9 K; l7 {
                 (cons 1 (cdr (assoc 2 enlist)))
/ g3 N$ B1 A& [# i                 (if (= space nil)
) O( B- h5 |. e* z4 ^- a                   (cons 67 0)
% l8 A" C2 \2 B1 s4 T                   (cons 67 space)
. c" e* Z7 @0 _3 O3 o8 u                 )
$ q$ k6 W( u" o  l" N; N               )
: k- J& P8 o3 h6 m  w* X      )
/ I/ p6 H' i+ b      (entdel en)# s% i  i" x4 V9 h5 D
      (entmake vl)3 {% g7 u( {1 b5 n; b; T
      (setq blkcnt (1+ blkcnt))3 R, _3 q8 `6 L$ _. K% H2 a
    )' n8 T4 n; N  K8 \4 @
  )
2 L( V0 X6 g& G): ]5 [8 v4 i4 o1 r) \
8 I& M5 V! h' W  ~7 Y
;=====================================================================7 S' W/ \7 T1 m2 s$ `6 b5 e

) l0 P' p, j' q0 O% p4 J- P1 ^) c(defun c:xxx ( / cumdt dodai thoat dem ten doituong textxl dem goc toi)( r3 U+ @- [% j
; Khoi dau cua chuong trinh
" N4 V: w/ ?4 ^; P9 V* j! I(princ "\nCopy Inteligent...\n")( J, J; x' O) \5 D0 v# g- @8 |
(setq         luuecho        (getvar        "cmdecho")7 z2 w0 T! ~( D
        luu        *error*1 R7 f7 D( O. [4 P8 y
        *error*        ketthuc
( S# ?5 x" ~) ~; _' P        cumdt         (ssget)7 z. ?0 Z6 q2 M& h
        dodai         (sslength cumdt)
- S$ m  H. Y% r( ?( r9 o6 X: N        goc                (getpoint "\nSelect base point:")5 |! o0 B; _/ n/ o  `3 V
        thoat                nil8 X( }  a6 l1 C
        dem                0
1 j/ n3 u' x* t) T9 b, h        textxl                nil1 J4 V. x3 I& I; d! ~% q' {0 c8 J3 V  r
);; q- i% x0 X# ~& [
(setvar "cmdecho" 0); T2 D! k. v+ j$ r5 {
; Loc ra duoc ong text de xu ly
4 ~' X6 e# q6 T(while        (and         (= thoat        nil)
( l3 ~4 s! G3 U4 O                (< dem        dodai)+ A$ }2 _. |; [' v: J  g
        )* E4 [1 N* _5 r+ U1 C: y2 P
        (setq         ten        (ssname cumdt dem): [5 ?. e% z( u; J: L( R' W8 ~
                dem        (1+         dem)8 `* K- A2 E& v7 r; L
                doituong (entget ten)% b' U/ @+ _' r* ^2 Y! Z
                kieu         (cdr (assoc         0        doituong))                        7 ?$ |2 F. e  l0 f' B
        )4 S8 s, [6 Z' q6 b- |
        0 W9 `$ O' q) q" _
        (if (or (= kieu                "TEXT")( Q3 ]7 o/ m: C0 F% t! q8 I9 F
                (= kieu         "MTEXT")        0 Z* G/ Q0 ?& ~& G$ k
                )
6 e  f" R6 x/ m, b6 `( _% k                (setq         thoat        T
- X0 _6 D! @, q2 q' P                        textxl         (cdr (assoc 1 doituong))         
9 m8 H4 I* D7 ?! D                )
/ r" A+ A" Z0 X# Y+ j  y1 Z( V0 p: n; {+ W        )1 z' f; r( G" o8 P* {- E, H
);/ V+ D! w( D( r/ d- d, `4 }
(while T & }: R! `; x: H, {: w% o2 Z* m" T8 H
(setq        toi                (getpoint "\nSelect next point: " goc)
5 ?9 f! W0 V' d$ w5 t' i2 \1 t        vitrilech         (list         (- (car toi) (car goc)) (- (nth 1 toi) (nth 1 goc)))
3 w/ w# n, u; ]( d6 v        dem                0
* T! A4 P/ X% S! ~1 h)
* C) y8 r) [# C) {9 Z1 }, i" Q(while        (< dem dodai)
3 }) m# @, m4 W- T2 I2 L1 _        (setq         ten        (ssname cumdt dem)
/ `9 X" [, @! `  F2 V                dem        (1+         dem)
+ T; H/ V6 u, u# m8 ^                doituong (entget ten)
8 {9 d* S' w% W! M# C' e                kieu         (cdr (assoc         0        doituong))                        
4 m2 I$ W6 o0 @        )+ A8 }0 s2 Z0 _# U* O( Y, }" I

) b9 X0 R3 |9 H& b( E        (if (or (= kieu                "TEXT")" x: j+ o: J2 j5 i8 J1 i5 F
                (= kieu         "MTEXT")        $ j; V( c- G% d( G; T6 ]
                )4 M% o' [' t& H9 w3 H! P0 t9 X, |
                (doitext        ten)
  i# L3 f- L' b8 X                (copy_dt        ten); k2 R5 V9 y4 T0 t5 }
1 m$ L! M" Z' n3 Z  `
        );if; V8 v" X8 C. {9 L5 {) e
)8 k1 K/ W% Q0 y; G" @
);while" h. D- |) d$ `: G7 w
(ketthuc)" z: v! y- c) e
);defun
$ p: J7 Y8 ]9 M" g! O7 q% [(princ)! K0 k" V9 A( o1 K0 ]# b
- {# g5 V+ j: g  s2 v* n3 ~/ x
;=====================================================================+ m5 q8 t' P4 ?
;;; By Jimmy Bergmark3 V) C- G9 A6 x- R: E3 u' s! T
;;; Copyright (C) 2008 JTB World, All Rights Reserved
7 O* O+ I8 j  t+ L$ q5 f;;;
9 K9 V$ r5 s* [6 J7 M* H% w# d;;; Created: 2008-03-31
+ X. b+ W# K2 E( k8 K* f1 n;;;9 T! _* \% P. ]8 J% K
;;; Convert Attribute definitions to text/ k7 Y7 G5 g0 E- Y7 {- q8 S5 V- S6 D
;;;$ Y" m& R; }5 i+ |9 ]1 T
' X- I$ ]; a$ ^/ A
(defun c:ATT (/ eset1 blkcnt en enlist vl space)
0 P% D0 Y8 V% j1 O0 g  (setq        eset1  (ssget (list (cons 0 "ATTDEF")))
! u! E: M. ]5 D) f: K" H+ |        blkcnt 0
1 t: g7 [- L' V' a5 }. ~7 ?) X! x  )
0 G0 M# |6 u4 \
9 H  u. M; ~2 Z! ]& _' O  (if eset18 v8 `/ T! R; L& g% Z
    (while (<= blkcnt (- (sslength eset1) 1))
  }3 X7 `  [4 z. q, h1 B      (setq en           (ssname eset1 blkcnt)
; t3 k8 S2 C: G- s- [) y$ n            enlist (entget en)) G, B8 H* G6 g/ P9 |$ _* F; b  s7 N
            space  (cdr (assoc 67 enlist))
) d0 l8 `# H# s6 \  T- E3 k% u      )
6 k; T7 [1 C' z4 ^) j      (setq vl (list' Z5 P) i' V3 Q2 K- g" S
                 (cons 0 "TEXT")1 V8 G7 N( l2 Y
                 (cons 100 "AcDbEntity")
6 j, Q/ U9 r4 q. k. b                 (cons 100 "AcDbText")
2 @& R9 E, T; e                 (assoc 7 enlist)
- ^; \6 f! Y. \7 p5 N9 h) n                 (assoc 8 enlist)
; F+ A  T$ c! ~8 s/ r' ?* S9 M; [  M                 (assoc 10 enlist)
4 E( C9 o# U5 u4 u( y$ |6 [                 (assoc 40 enlist)" r6 D$ |: I7 W5 b
                 (cond ((assoc 62 enlist))
) M/ h3 g! g" ~; l0 ]                       ((cons 62 256))/ Q" P! r! m$ B0 E/ Z
                 )
( [1 b: x( D3 V) K                 (cons 1 (cdr (assoc 2 enlist)))) i. a, I* l& U4 \- `. ?1 j
                 (if (= space nil)
- c3 D+ L( P2 I3 r9 r                   (cons 67 0)2 {% _$ O9 B/ `; c5 p
                   (cons 67 space). a! s1 k. Y' E: G+ [- L
                 )
, E, V* n* P/ h' f4 O4 j+ h               )( P& D! L4 G/ J7 @  o
      ): x' ]7 Q7 ?3 S
      (entdel en); Z! u( }# x3 I& p: V/ r
      (entmake vl)1 H4 m# b, t! {) A  ~
      (setq blkcnt (1+ blkcnt))
5 l' Q2 k: F: s! F# Z    )
  S) J3 m( m. e% c& f4 u2 U  )
6 z+ n8 y1 g9 t: a* y)
- n/ I$ s" [/ M; S  M! I;=====================================================================
- W( l' t! z1 d/ `! X3 S% c! @9 ]  h;============================ Doi Truc ===============================; |0 {- X4 n% e6 b% [
;=====================================================================
! K; E& X  h- e
4 p9 p9 d9 V, T;=====================================================================) O4 J7 T& L+ [7 r
;=============== FUNCTIONS GA 1+3+5+7+9+11+13+15+17+19 ===============
7 E. q$ R2 J5 I1 S& Z;======================== Tran Ngoc Thang ============================+ G* E- s3 `- @. C4 N
(defun c:ga1 ()- n  @1 E& |9 \" q+ e! c
(setq a (getpoint "\nChon diem: "))0 T  L0 |* {4 |+ t0 c. T" D
(setq b (getpoint a"\nChon diem: "))6 z& ?: U! l! R$ g; a( p7 \
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
$ W. ~( Z, b- p6 _(command ".circle" c a)' V; `% L( {& i4 v/ b
(command ".line" a c ""); e. H1 X( W/ X) d
(command ".array" "last" "" "p" c "1" "" "")
: `: L9 G7 E1 E' A4 }(princ))
  g& R. b; @8 y/ l
5 z* S6 [. {. ?& U$ F) I. A(defun c:ga3 ()5 A, D* |5 u; b! k" Z2 W1 k4 C$ V
(setq a (getpoint "\nChon diem: "))6 \, E- V  _4 V2 d
(setq b (getpoint a"\nChon diem: "))
+ N6 [6 P$ l. M7 ?(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))6 B* B0 ^; ]* P: y8 ^3 X2 d
(command ".circle" c a)
- p2 w% X' r: R, q(command ".line" a c "")7 S  ?* Q# K% z7 G
(command ".array" "last" "" "p" c "3" "" "")
4 k6 h/ o; M, Q(princ))
" v5 a% T6 [) a% m1 y- D9 X9 b: C& E* L4 A/ K. k, L
(defun c:ga5 (), K5 B& p  b# a9 l2 C% O2 ]
(setq a (getpoint "\nChon diem: ")): q9 W) Q" X! n$ g0 Z$ u9 Y
(setq b (getpoint a"\nChon diem: "))
2 W7 F( I0 _8 G  t" j3 w(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
( x* y" ~0 ~" y& }5 v(command ".circle" c a)
1 X, c( L& e  P; {0 k; k(command ".line" a c "")
2 K5 C( \; x1 i' g9 ~5 ?: }(command ".array" "last" "" "p" c "5" "" "")+ M- s, s# M  [% P5 D3 ~0 `& v
(princ))
' M' x/ H1 {  {% O$ I' ~$ `& ?) d( t
(defun c:ga7 ()
- B8 _$ K3 f- N1 y(setq a (getpoint "\nChon diem: "))
* `6 o3 C8 {) R7 [- q+ R& t% a7 p(setq b (getpoint a"\nChon diem: "))% u/ m7 R8 T$ ^1 y2 R
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))) v( V( _8 [; F
(command ".circle" c a)
3 F: M8 h1 Q# @4 S. D4 g(command ".line" a c "")$ |; a' Q7 v. N5 {8 @
(command ".array" "last" "" "p" c "7" "" "")
2 s: x' H) A* N6 o(princ))
8 L+ r+ }! O! F2 s0 }, X
9 J! S4 h4 x8 l(defun c:ga9 ()
" O1 r0 x) v9 X# t(setq a (getpoint "\nChon diem: "))
6 \  D, W" k; X(setq b (getpoint a"\nChon diem: "))
, b7 j- r6 Y. `+ c(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))5 q7 Z2 D" `0 P# @
(command ".circle" c a)
/ M3 A# \/ }8 i(command ".line" a c "")7 Q. I# L& P& T3 c5 h6 T; T
(command ".array" "last" "" "p" c "9" "" "")7 u6 B1 f0 {6 `5 q5 _
(princ))3 Q* k9 x6 |) O$ I; K( ?- r
6 z0 f5 y! n* l" m. V
(defun c:ga11 ()
/ A2 {# [4 _- Z0 c' H(setq a (getpoint "\nChon diem: "))
/ I0 d, I4 v/ ^(setq b (getpoint a"\nChon diem: "))
2 n. B/ c7 r6 ]3 n- j(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
& G. t# V3 z) `! E' U+ O(command ".circle" c a)
) E. N, }8 ]2 Z. P. F& ^(command ".line" a c "")
8 c/ n. n) j& l+ E7 \& n' u: {1 A(command ".array" "last" "" "p" c "11" "" "")! t/ T% A1 U! X1 A! i5 e0 c, M5 O
(princ))5 z1 x2 w# D; G, A, H

" V2 ^' e- j% ~(defun c:ga13 ()$ ]& M, B; D$ e
(setq a (getpoint "\nChon diem: "))! B# ?4 o% I6 J3 Y( G0 \- z
(setq b (getpoint a"\nChon diem: "))1 D0 H, }' g  I& i0 L9 u$ H% V
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
( S; r+ d% U' w. B6 D- M(command ".circle" c a)* a- L% y3 V5 L) o) w1 k
(command ".line" a c "")
2 |8 p1 S' d' l. k(command ".array" "last" "" "p" c "13" "" "")
3 y/ B/ f5 L: y$ _4 f, K' S(princ)), b6 `; X6 O; Q7 g
! Z! q4 ?( C, ~8 a
(defun c:ga15 ()
) |& D% d6 `/ q# [(setq a (getpoint "\nChon diem: "))
6 T4 e5 Q8 ?8 N9 W$ M, Y(setq b (getpoint a"\nChon diem: "))/ g% Y2 h- b- n& |
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
2 \( u1 c: g" `' _1 y6 M( P$ C(command ".circle" c a)
- P  {, Z# ~% m2 G6 l* i0 `. p(command ".line" a c "")1 f, p' S3 j$ u5 u
(command ".array" "last" "" "p" c "15" "" "")8 e# [. `, O! S7 X( ?
(princ))9 r" l1 l" X; {; j
) t5 i' N1 @, x; o) W+ d8 [# B
(defun c:ga17 ()3 l5 v" k1 w8 c3 W7 z2 t7 b1 g
(setq a (getpoint "\nChon diem: "))9 o' B  w1 x/ u% z
(setq b (getpoint a"\nChon diem: "))
& U( _  A. U7 n(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
6 k4 O0 u% u6 a  B& x+ f3 }(command ".circle" c a)
, P! c( \# k1 C6 s' U; W6 c3 }# T(command ".line" a c "")
* f+ }2 p# G8 b. t+ G* i5 E. Y(command ".array" "last" "" "p" c "17" "" "")
6 @  I, C4 F; K' l, h8 k(princ))
" ~) x: R. ^7 A! w+ m! K' i6 ~9 ]5 ]7 }: I7 G! f0 A
(defun c:ga19 ()
& u; o+ C3 R& k$ m- u/ X! R% O1 X- z; Y(setq a (getpoint "\nChon diem: "))0 B" S4 |( t9 s0 ?
(setq b (getpoint a"\nChon diem: "))* o- T& D7 P6 F' S1 F
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))+ Z4 L' e. g, y+ _) p2 x
(command ".circle" c a)2 j, w/ ~/ m" q. \7 B
(command ".line" a c "")
0 J. _1 g# s/ e8 J) c+ N(command ".array" "last" "" "p" c "19" "" "")
5 T+ [* Q- g: ?(princ))( F' {' E! J9 V0 j; S: ^* p
8 P/ N& J& R* Y
;=====================================================================
3 h* g7 l0 ]& w7 O" E- t& |;============== FUNCTIONS GA 2+4+6+8+10+12+14+16+18+20 ===============
! [) k- J+ t. B;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================5 z% ^. O1 n9 [4 a/ A. |0 A  Z! i
(defun c:ga2 ()& u. t' ?+ t+ i/ w& N$ }  S
(setq a (getpoint "\nChon diem: "))" g8 r* L3 O7 s1 ]3 L
(setq b (getpoint a"\nChon diem: "))2 u) c; M  M% n+ b: P- O9 ]$ z
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
" G/ z) O: l0 j(command ".line" a c "")
. t* s; ~1 ^: f1 u% c5 e(command ".array" "last" "" "p" c "2" "" "")# A- n  J0 x3 K1 h8 i
(command ".circle" c a)
; A- p" V5 K: Z" s9 {2 A& S& T(princ))# j9 a! X9 N& [, \

4 r; H7 K" a( D2 Q+ i* Y; d3 W(defun c:ga4 ()
) F# Y- B/ ~7 e% X( ~/ W(setq a (getpoint "\nChon diem: "))7 S& j/ U, a4 J. G: c- {1 w9 F
(setq b (getpoint a"\nChon diem: "))6 [4 ^+ R- y" c0 u4 t
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))! n9 V6 B. l/ u. u
(command ".line" a c "")
- {- W' P+ Z6 f, o' @" Z(command ".array" "last" "" "p" c "4" "" "")
- r) C, y1 J8 s5 _) J4 B- I1 m4 ~  N(command ".circle" c a)* |/ D. Y- p$ B" `
(princ))
& [# }; S) j, V$ H2 Q$ b, }7 W! f3 K! D/ C$ F& v+ w! u+ g2 F
(defun c:ga6 ()
0 J$ }, z6 d8 g( l& n(setq a (getpoint "\nChon diem: "))' W- J9 n- c$ `7 {! b
(setq b (getpoint a"\nChon diem: "))1 N/ ^$ {' U" L2 I
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
* g+ Q7 a$ F: \2 e3 U) w" ^(command ".line" a c "")
$ f: H8 h+ l% K: W; N" L% ]( N(command ".array" "last" "" "p" c "6" "" "")
8 Z6 w# R& P* W& q) s7 [, A(command ".circle" c a)5 N* h% ?$ X) l. D5 j
(princ))
& T7 e6 @2 s2 P8 P7 G
- Z# f  `  r0 z% Y; M2 L4 Q& K(defun c:ga8 ()5 o' N3 G& d& B
(setq a (getpoint "\nChon diem: "))0 P2 ?6 Y% O+ [$ k! p( k. X3 ]
(setq b (getpoint a"\nChon diem: "))
4 X) u; l6 }$ P) h# F0 D5 M(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
8 i' _# }& @. O6 j; b; O(command ".line" a c "")4 z& F3 c' [8 X5 ?- m+ w  K8 ]
(command ".array" "last" "" "p" c "8" "" "")) D2 M, |! p/ Q# y; g  W0 j
(command ".circle" c a)
/ H3 V( r7 k6 `) J, L(princ))! s8 }6 u# y9 V2 K$ h( x4 p

1 G( }, ^* X# T0 n8 l/ \(defun c:ga10 ()
( w& ?& x0 |6 {! Z! a, E(setq a (getpoint "\nChon diem: "))
1 J$ O! `. z6 X! D1 D4 g: \(setq b (getpoint a"\nChon diem: "))
: G0 J; j$ M9 l4 H6 L(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))* e! A2 w  m  c( B
(command ".line" a c "")5 b6 i' Y/ I, `  w5 N% p! F
(command ".array" "last" "" "p" c "10" "" "")
5 d# L% t8 i; M1 `(command ".circle" c a)( a9 h- f- s& s+ O! c2 z6 W
(princ))
: x5 s9 _5 `: x! t: }$ n5 ?1 X  l% }% s6 U7 E' E3 B4 K
(defun c:ga12 ()
1 p% w7 w3 w+ F' n(setq a (getpoint "\nChon diem: "))
) ~( Q# m; h2 E# T$ O(setq b (getpoint a"\nChon diem: "))6 Z& R% ^# k: ^) F# ~3 @
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))/ f4 t! y! ]1 k2 o9 a% E
(command ".line" a c ""). R& ]) M9 ^5 _
(command ".array" "last" "" "p" c "12" "" "")+ f+ `" n1 A& o# U* a
(command ".circle" c a)' e; R& _) z& G% k6 n
(princ))
6 x! ^+ K- u7 C+ D, C: S( J1 [6 R, A) n" V
(defun c:ga14 ()
% T8 e7 h9 b9 M& Y(setq a (getpoint "\nChon diem: "))
5 ~0 W6 B7 X( [; ?( t% l% s(setq b (getpoint a"\nChon diem: "))0 r/ ?! m% x  |' v& _
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
) ]5 v( D( h. C% L(command ".line" a c "")
! ~: L/ }% I+ z$ C, D1 x! k(command ".array" "last" "" "p" c "14" "" "")
0 M* S" i0 f) a; O$ @6 w9 q(command ".circle" c a)6 I8 d7 s, K0 \/ d5 C
(princ)), W* y1 Z; S7 b. l, p& v. ~. s

2 x5 `" E2 b6 Y4 c- z(defun c:ga16 ()
4 Z' Z8 X8 p" k8 x(setq a (getpoint "\nChon diem: "))
$ E% b9 ^8 t% Y* H(setq b (getpoint a"\nChon diem: "))
5 Q# b( @  L0 U! C(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2))): e4 u! `/ `9 f- B! ?  P8 n
(command ".line" a c "")! D$ d1 s# ~$ _& v7 U# m$ i! G5 c
(command ".array" "last" "" "p" c "16" "" "")1 z* }  y9 y( E# X( L
(command ".circle" c a)" x9 I8 |' N2 {! ^! ?# |! \4 h
(princ))- I0 q8 U; d, ?5 r
8 H# g% Z5 O3 [! }: X# U
(defun c:ga18 ()
3 {, A% r3 _0 V8 J5 u+ ]9 x(setq a (getpoint "\nChon diem: "))
' i5 }" B- G9 d6 e) @(setq b (getpoint a"\nChon diem: "))
. ^3 D6 L- t& F/ g3 A' P# M(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
2 E; Z0 _* @3 A(command ".line" a c "")
/ F, p+ ^8 {, t' D% W$ j3 m( l" X# w: W(command ".array" "last" "" "p" c "18" "" "")
- y; \: Q+ s2 t8 y(command ".circle" c a)) X3 p  ~1 ?# _- y* Z
(princ))
+ A5 H, i, `0 h9 O
, \6 H/ @) t) f: U(defun c:ga20 ()
1 a2 Y, b) {0 K* Z1 O8 D. A(setq a (getpoint "\nChon diem: "))
; J6 W7 e3 l- F6 C; _$ S(setq b (getpoint a"\nChon diem: "))
" b" `  E2 H- k* C7 D(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))9 u$ L: z8 F$ U+ x" i' u6 \
(command ".line" a c "")
6 S4 t3 C$ ^% L! O! c- L# t(command ".array" "last" "" "p" c "20" "" "")
* U9 J2 l$ J* d+ R(command ".circle" c a)
" m4 j6 @0 l# Q(princ))
' A. u2 D1 f4 B0 l
0 H! R9 N4 s: g  I1 Q+ z+ P4 N8 _  ]

8 X- C2 X1 F& Y) V- [0 Q& h;=====================================================================
+ ^2 E" W7 H& f& ]6 k4 v6 e;============== FUNCTIONS GA TUY THICH : EVERYTHING IF ===============
+ |! j( f3 y  `- q- t& F" w;========================== 06-11-2016 ~ 18h00 =======================6 u% s5 Z% ]4 B  z- g) @  \# b" m
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
' b$ V1 q* ]2 d" K# c0 A(defun c:ga ()
% F" u/ ^$ c& j" H(setq a (getpoint "\nChon diem: "))( }+ ^# O; l7 c3 E6 l; w
(setq b (getpoint a"\nChon diem: "))8 p* _! v! g! `% K
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))4 \  Z9 A4 X) e
(command ".circle" c a)
% N! K5 r* l/ Y( U9 c& }(command ".line" a c "")
' u6 [+ o- w- [(command ".array" "last" "" "p" c "NUM" "" "")
6 U0 _& r: y% }: M( o(princ))
+ E4 ~+ p" i$ @" H9 p; G  K. R0 z: b, t$ L! o5 U. M' Z( F
;=====================================================================8 y, ?& a9 g' }6 ^! W& W% Y, Z
;=========== FUNCTIONS HOA THI TUY THICH : EVERYTHING IF =============* Q, L% @! B# F8 A# Z. c) I* b
;========================== 06-11-2016 ~ 18h40 =======================
% {' D% u* w1 j" A/ F" d7 H;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
) ?. t6 `! F! M* f
; q/ ^1 j+ Z7 g  _9 E(defun c:hoathi ()
" E2 @1 J( ?) s  _( k* ~(setq a (getpoint "\nChon diem: "))- ]) H5 f# a- K5 Y( g' N0 W
(setq b (getpoint a"\nChon diem: "))
* u5 T$ ]5 p' O2 @2 p(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
8 P; N7 k+ a; z% B" a( D: ^(command ".line" a c "")! ?- `. G* q8 U
(command ".array" "last" "" "p" c "NUM" "" "")' l8 S" h/ V+ ~" P+ P
(princ))# G3 S0 a! B, W6 V0 ?! Y% ?

3 W/ |; F7 @9 G! D0 Z8 h* W;=====================================================================. B: T9 C. `, w- y1 o4 ^; @/ k
;============= FUNCTIONS CUNG TUY THICH : EVERYTHING IF ==============- v/ Q1 p, c4 x* p% \! ~
;========================== 03-11-2024 ~ 19h33 =======================
# r# P( k3 f( I. T8 x' ^; q;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================5 V: ~1 |8 C) r  y0 l+ v2 Z

, a+ i7 W9 K1 f! J% R0 S' c+ t6 a(defun c:cung ()( K; `' H+ X  J9 p0 u
(setq a (getpoint "\nChon diem: "))4 e6 F/ y# u4 @: ^1 ^% F" c
(setq b (getpoint a"\nChon diem: "))/ @$ J9 j" \, T0 u: d/ C0 E
(setq c (getpoint a"\nChon diem: "))
! o% e" J9 {; F  M# L7 l4 |, ^(setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
1 |* \$ d) A( m9 d& j' {5 F(command ".arc" a b c "")3 u! q9 C! Q9 e5 Q  ?3 S4 a8 m+ [
(command ".array" "last" "" "p" c "NUM" "" ""): m8 s+ h6 l5 k
(princ))
) S. ]0 O/ J) d+ a! v2 [1 W4 {- }* W# x
;=====================================================================
7 O& `9 J9 h& `) D' p;============ FUNCTIONS HECLOIC TUY THICH : EVERYTHING IF ============0 B3 ^: N7 k  E3 d
;========================== 03-11-2024 ~ 20h02 =======================3 a" e/ n0 r7 j& P0 C* \
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
7 a3 w* D4 s) V7 j  {6 O(defun c:hecloic ()
/ n$ w# N! u- X  v" @% Q" O(setq a (getpoint "\nChon diem: "))
8 {4 J- K% o, Z# e2 H& q/ W(setq b (getpoint a"\nChon diem: multi "))
' @& ?* O& s) d" v5 f) W(setq c (getpoint a"\nChon diem: "))(princ)
! H$ j/ m  R) S' S# J, p(setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2))): L7 X) V" T6 |: g4 ^
(command ".arc" a b c "")/ k$ i/ ~/ x; f. K1 Y  i$ {
(command ".array" "last" "" "p" c "NUM" "" "")
7 x1 `7 D% r! m1 G" R(princ))
5 d$ u1 m7 A4 b, ^2 C9 W- y# j8 N0 f' o* Z6 C& ~
;=====================================================================5 ~/ d+ o* [& ^: {" H2 {1 d7 e
;============== FUNCTIONS GAY TUY THICH : EVERYTHING IF ==============
0 ]2 g& a& J& Q;========================== 03-11-2024 ~ 19h38 =======================
: m/ K! Y8 U3 N;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================4 F* u1 R; @+ b, Y/ [. I

& q. o4 R" t6 d" x6 w(defun c:gay ()
0 }# N7 j7 F; \' U/ M" L3 n; K(setq a (getpoint "\nChon diem: "))
' ]9 O  I; X4 C( Z: Q(setq b (getpoint a"\nChon diem: "))8 u- w% H8 H1 t' m! \. N
(setq c (getpoint a"\nChon diem: "))(princ)  H! D, ~$ ~0 [# a; A
(setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
+ g; b0 r3 X- i# P) ]# F- z( _(command ".pline" a b c "")
, N$ f( U: o4 _  l9 z1 |(command ".array" "last" "" "p" c "NUM" "" "")  Z1 b( t* o, A0 N! A+ _0 [3 V: @7 t2 |
(princ))
% a- a5 P: n( Z% C! U$ [
& f9 n1 `8 g; t; @;=====================================================================
  j; U) a$ N1 F' U- {;============ FUNCTIONS HECLOIT TUY THICH : EVERYTHING IF ============
6 \4 @4 ?) h8 z( L: I! T) z;========================== 03-11-2024 ~ 20h02 =======================
1 f9 y, J0 _$ Y3 ~;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
' j$ Z( t% z( O, Z% G& z/ T+ @, }: G) M  r
(defun c:hecloit ()" d1 u! p/ k! `& U+ E2 q7 p
(setq a (getpoint "\nChon diem: "))
0 E0 ^) C* `& Z6 ^. |(setq b (getpoint a"\nChon diem: multi "))
) ?' j! D1 o5 ^(setq c (getpoint a"\nChon diem: "))(princ)1 [) ~* p" B- ?. W# v
(setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))) Q: U  f+ Z6 A
(command ".pline" a b c "")
% a; `* x; R+ ?9 ]8 p(command ".array" "last" "" "p" c "NUM" "" "")4 `* B  l( s! N/ B
(princ))
* Z: u2 S5 w# a2 g' ^- T9 ?4 v- |$ |9 l& a) ^* i8 y1 k) p+ z5 r' F( e

7 y$ n. j- Q% \3 E;;; ============================ Merge Hatch =============================
/ K0 \% |1 N, C5 E7 r4 y" q' Z" v7 h. D1 V: {
(defun c:mh (/ ss entht sl i dt dtht)
6 s2 m' z) K9 H
4 h7 V* V; x2 U& d$ w: D+ G  (princ "\nMerge Hatch - free lisp from CADViet.com")7 L( i  t* L+ o$ M) M5 _0 y

. Y1 e8 W7 D& m* x+ n. e  (setq  R% L; e! G& d8 B" A
    ss (ssget '((0 . "HATCH")))
; M  ?( w& \1 G7 G0 i1 G$ X    sl (if ss! Y+ l9 W. A% N) u$ ?
         (sslength ss)3 f4 u/ B0 |  D; V3 u- t
         0
& g' w( k3 K* k& s2 t* ^0 F       )
2 U- g4 d0 H( [6 Q# S" q$ G7 f) m    i  0
* e" R* w* R, T" j    l  0
+ D6 A! B4 Z3 d& q3 b" _  )
. ?$ q9 X5 l, z4 {% s. h& }1 m2 r$ \  l. C/ c% K! V
  (repeat sl# O" |& P2 |* A9 N6 ~' I4 u
    (setq& T8 }/ `) f  f0 d/ ~
      entht (ssname ss i)2 P& U3 p  {, V
      dtht  (getbdata entht)
& Y. V$ l( N8 C$ K% y      dt    (append dt dtht)  l7 Z4 Q2 p' `  p/ n( U
      l            (+ l (cdr (assoc 91 (entget entht))))8 ]! V8 n8 g6 {8 ^7 x1 d
      i            (1+ i), `2 Q0 _5 y  I( Q/ Y% G
    )
% B! h0 g+ g( {' B4 g3 J6 i- G1 m  )0 O% `  J/ U4 L* H$ v
9 T: J: _0 J: E: ~/ h, B
  (setq        ent  (ssname ss 0). }3 L: W  e/ ?
        ss   (ssdel ent ss)7 ^; U( q0 @: g1 _1 j) M9 K2 r
        tt   (entget ent)
5 J8 g5 d, L2 Z, u) t6 B7 v3 [        duoi (member (assoc 75 tt) tt)% p, e; g+ t' T- Y  h6 B5 p
        dau  (reverse (member (assoc 91 tt) (reverse tt)))5 F; n' Y/ m( r; x7 b4 G
        tt   (append dau dt duoi)
' v6 d6 W  K$ G6 {3 a        tt   (subst (cons 91 l) (assoc 91 tt) tt)  R; s$ n+ _+ r
  )
2 {9 r- e) B  y& i  (entmod tt)
8 F  Q% S6 X# L% J5 K# e5 H- F# ~) P! z6 j' J; X! M* |
  (command ".erase" ss "")
4 Y0 @& W0 p6 n" o  (princ)1 s) Y7 O, W2 ^, J" e
)# }) `1 A2 b% C4 c$ Y
. U& x" p: j$ Z( u$ a
(defun getbdata        (ent)2 f/ M; r( D8 R
  (setq        tt (entget ent)
/ J* u# ~  r2 P2 k0 v+ {" N        tt (cdr (member (assoc 75 tt) (reverse tt)))9 \2 c3 c( X# ^( S3 m
        tt (cdr (member (assoc 91 tt) (reverse tt)))
& G1 M6 s+ B$ Z  )1 }6 ~  ]; Z/ G* e* Y8 \* V
)
# H: N" k! h) o+ B; g" V1 @. Y+ T2 `' y6 q' {
2 q, x2 R9 d7 k- v
(princ)  c& M) ]8 _! h1 q1 W/ ~
) H" s4 K0 h) j9 S
;;; =========================== CAC LENH LAYER ==============================
$ F. H/ B4 \6 u1 u;;; =========================== Layer hien hanh =============================$ m4 s- D+ L! I2 c
5 u' ]% X, _6 d: I1 ?3 R, k
(defun layset (/ LAY) (setvar "cmdecho" 0)6 [% L( m& X5 ?$ B' S5 m/ J. t* h
(setq LAY (entsel "\nPick vao doi tuong muon Layer hien hanh la Layer cua doi tuong do : "))% x0 Y9 L- d6 g
(if LAY     (progn     1 i8 r. X5 J- R. S/ b5 Y
  (setq LAY (cdr (assoc 8 (entget (car LAY)))))% \4 b# p$ p+ T; [+ [
  (command "_.layer" "set" LAY "") (princ (strcat "\nLayer : " LAY " da la hien hanh."))  )
* Z# h4 j: N9 h: w7 Q             (progn4 `$ l8 j2 q9 I. ?3 K) B" ~
      (if (not ddlop) (load "ddlop"))  (if (setq LAY (ddlop))
# K# T: e0 S8 [             (progn
& h$ I) O- ~9 {+ q4 o: Q# S8 n            (command "_.LAYER" "ON" LAY "THAW" LAY "SET" LAY "")  (princ (strcat "\nLayer : " LAY " da la hien hanh.")) ) ) ) )(princ) )
/ X6 e& b' Z( `8 I/ w- z(defun cLL     () (layset))(defun cAYSET () (layset))/ |( o% s6 ]% Z0 @/ P
; L5 W- _' ^% L! i- p
;;; ================== Cap nhat doi tuong vao layer hien hanh ==================. u9 ]$ @8 D* d# I$ a/ [

: n4 @9 g! S4 P$ g9 I; b(Defun LAYCUR (/ SS CNT LAY)  (setvar "cmdecho" 0)
  n# v5 i7 d0 y  (if (not (setq SS (ssget "i"))). R  R9 J. @! s! Y  y- e) S
    (progn (prompt "\nChon doi tuong cap nhat vao layer hien hanh: ")+ w; ^# E1 A( ~( X6 R
      (setq SS (ssget))    )  )
/ [  |* K5 _( q! a  (if SS    (progn
: Q1 a0 b3 M" @4 ?   (setq CNT (sslength SS)) (princ (strcat "\n" (itoa CNT) " doi tuong tim thay."))                  (command "_.move" SS "")                      % J3 A7 ~; @8 i5 b# x
      (if (> (getvar "cmdactive") 0)               
: e1 M# u* C7 y: p" i  C        (progn
/ S( y2 Y3 F% j! @$ i8 ]/ l          (command "0,0" "0,0") (setq SS  (ssget "p") CNT (- CNT (sslength SS))    )   )% n7 q8 S7 N& _
          (setq SS nil)     )  (if (> CNT 0)                                 
: a; Z* W/ S6 k9 }2 i: ~3 x7 v9 l% o          (princ (strcat "\n" (itoa CNT) " doi tuong tren layer LOCK.")) ) ) )( Z7 h9 ]$ A* V' N8 T! o
  (if SS    (progn) c3 e' C; p7 P
      (setq LAY (getvar "CLAYER")) (command "_.chprop" SS "" "_la" LAY ""), i/ a, Q) ^0 `0 }8 e# x! k
      (if (= (sslength SS) 1)1 l; v+ ~: N6 s1 ^' S
        (prompt (strcat "\n1 doi tuong da cap nhat vao layer : " LAY " (layer hien hanh)."))
1 A/ A" V3 j% q5 `8 ]/ X& t        (prompt (strcat "\n" (itoa (sslength SS)) " doi tuong da cap nhat vao layer : " LAY " (layer hien hanh).")) ) ))  (princ) );end- \: |5 N8 ^( K) n7 o+ z
(defun cAYCUR () (laycur)) (defun cHH    () (laycur))
4 W' b5 ~+ Z8 |# x! o
; @- ~6 k" j5 f;;; =========================== Layer Iso ===================================9 X6 T. }/ k/ K

0 G+ P; Z" `1 h4 \  G% e6 y! h8 v(Defun LAYISO (/ SS CNT LAY LAYLST VAL)  (setvar "cmdecho" 0)! x- E4 n+ L8 @$ @/ m4 ?% K4 m
  (if (not (setq SS (ssget "i")))    (progn8 o& a, E. n/ b% @! N5 {1 c% c
      (prompt "\nChon doi tuong tren layer(s) muon lam viec doc lap: ")% a6 P! Q8 T; ^, p2 z
      (setq SS (ssget))    )  )
' i# O; O$ o+ e+ ~. {  (if SS    (progn      (setq CNT 0)
8 \: e" }7 C, s      (while (setq LAY (ssname SS CNT))3 `+ L" j6 t6 l$ C" T2 t5 F
        (setq LAY (cdr (assoc 8 (entget LAY)))); ~1 X2 W3 O+ o! M
        (if (not (member LAY LAYLST))
4 n% t# T+ |5 T) U& j          (setq LAYLST (cons LAY LAYLST))        )
0 K( H$ H  X3 o5 c3 ]2 }6 S1 o        (setq CNT (1+ CNT))      ); I: t- O) L* t  [' y7 c- A
      (if (member (getvar "CLAYER") LAYLST)
: T2 W: `  l; _        (setq LAY (getvar "CLAYER"))
$ O9 z5 C7 j/ {- f6 w        (setvar "CLAYER" (setq LAY (last LAYLST)))      )
- l$ a3 k5 T* Q7 M: F$ s      (command "_.LAYER" "_OFF" "*" "_Y")' `; `; }  u# _1 t: B; m
      (foreach VAL LAYLST (command "_ON" VAL))
' ^# d1 X9 z! x2 q4 y; \      (command "")            (if (= (length LAYLST) 1)5 g# X) ]- V, x* D, w; ?; Q
        (prompt (strcat "\nLayer " (car LAYLST) " da tach ra."))
# d1 ~" T! X: A9 a) ^        (prompt (strcat "\n" (itoa (length LAYLST)) " layers da tach ra. "
7 X7 t. A+ i: M                        "Layer " LAY " la hien hanh."   )  )  )  )  )  (princ) )1 p4 L6 m' W0 |; k
(defun cAYISO () (layiso)) (defun cI () (layiso))$ V1 B1 T- \1 i, ]8 J7 l
) x9 O% K! x+ B# i
;;; =========================  Layer Match ==================================* J/ {' y" k8 l: o$ U7 r
1 Y& D& K7 _# z( R
(Defun LAYMCH (/ SS CNT LOOP LAY ANS)
3 u' N0 c# U4 Q3 s8 J- Q# m  f  (setvar "cmdecho" 0)
0 {3 M* s/ R; Z  (if (not (setq SS (ssget "i")))    (progn; N- Q& q4 f% n; \2 M+ s
      (prompt "\nChon doi tuong muon thay doi Layer : ")
0 B8 v5 Y1 z+ C) z1 @- P! [4 K      (setq SS (ssget))    )  ): m2 c8 K/ \8 V  t( ?( W
  (if SS    (progn' K$ U* g1 |8 {/ Q
      (setq CNT (sslength SS))
. o" |% P/ A+ D3 C# |" J      (princ (strcat "\n" (itoa CNT) " found."))  (command "_.move" SS "")                        
3 M: R/ A1 R& G# c' S% h/ ~4 V      (if (> (getvar "cmdactive") 0)   (progn1 N" W$ ~( i0 g; K' A, F0 Y0 J# r* B
          (command "0,0" "0,0")  (setq SS  (ssget "p")2 V% `/ \1 h7 c1 m5 f% N
                CNT (- CNT (sslength SS))    )    )8 l+ j' H/ L+ w' T" W$ ~
        (setq SS nil)      )  (if (> CNT 0)                                    
$ S7 w; b0 t7 m7 ?: {: m( F/ ~9 g          (princ (strcat "\n" (itoa CNT) " tren layer LOCK.")) ) )  )
) v' ]9 ~6 P& e" E5 h3 A0 C% m  (if SS    (progn
* ~' f0 q7 s: i3 R9 T0 X      (initget "Ten")  (setq LAY  (entsel "\nTen layer/<Pick doi tuong>: ")  LOOP T  )
" d! U( V* i/ z0 A! s% W    (while LOOP        (cond( y3 F* G" Y; `0 l" b6 [
          ((not LAY)
. ?% {- h4 M$ U6 J) f6 b            (prompt "\nKhong chon doi tuong.")3 R6 {  U' D4 I
            (prompt "\nSu dung layer hien hanh? <Y> "). S6 D, X1 V; R! I* g
            (setq ANS (strcase (getstring)))( q1 d. f, Q2 L) c! V( P
            (if (or (= ANS "") (= ANS "Y") (= ANS "YES"))! W  H2 R" a! [/ d: v
              (setq LAY  (getvar "clayer")  LOOP nil )  )  )# }3 Z- Y3 V" v" P& M
          ((listp LAY)  (setq LOOP nil) )
' ?$ |" {" ~# b) c6 n+ V% W          ((= LAY "Ten")1 g( c0 B* {; }
            (setq LAY (getstring "\n>Nhap ten layer: "))7 M. ~! V) @% ?( V& Z6 T. W- f
            (cond
0 B) W; z) h9 K$ H9 \              ((tblsearch "LAYER" LAY)  (setq LOOP nil)   ); Q$ s) \# ]6 e4 S1 |
              ((/= LAY "")" ^* t& G! T4 a# L
                (prompt "\nLayer chua co trong ban ve. Tao layer moi? <Y>: ")
) @  H* x" P. y# ^                (setq ANS (strcase (getstring)))
  c2 f4 |( u/ G- P" b' H7 Z5 B                (if (or (= ANS "") (= ANS "Y") (= ANS "YES"))# r' D& J4 b6 m" T6 ^. N
                    (progn
7 h) q7 \3 p$ u( c& I                        (command "_.LAYER" "NEW" LAY "")+ Q# j  L9 h9 a# g. `) i- D; y' c
                        (setq LOOP nil)   )4 |5 C8 ?  H7 R5 r% L5 @, x
                    (prompt "\nLoi ten layer.")   )   )  )  )   ); u  w# F8 K5 Q+ i" b5 J# N
        (if LOOP  (progn (initget "Ten"). R' e9 o1 r4 S1 b% {/ ^6 s
            (setq LAY  (entsel "\nTen layer/<Pick doi tuong>: ")) ) ) ); while LOOP
4 P& [$ c5 B, H, e* v        (if (listp LAY)
" A) q& z8 u* L' E% U        (setq LAY (cdr (assoc 8 (entget (car LAY)))))      )7 e+ T4 O+ ~. S
      (command "_.chprop" SS "" "_la" LAY "")
$ [' r1 b8 h: M8 |$ F- G      (if SS  (prompt (strcat "\n" (itoa (sslength SS)) " doi tuong thay doi toi layer " LAY )) )2 |  G! W( a, Y6 Q$ x
      (if (= LAY (getvar "clayer"))
0 I! R9 a( d- O- \6 j1 f        (prompt " (layer hien hanh).")  (prompt ".") ) ) )  (princ) )
% S  [; W8 \0 Z% A& |(defun cAYMCH () (laymch)) (defun c:CLL    () (laymch))/ [5 J/ O! b  {

, A; Z0 P# ?2 K3 d; c;;; ============================ Layer OFF =================================
; @9 @8 p7 v$ M0 l; L" D3 v# z& K4 p! ?* S
(DEFUN CJ (/ SSET SSL ENT LAY I MODE)
% g; ?& }7 I9 D! J, T# X' z   (SETQ SSET (SSGET))) [5 [8 _: C9 e+ n2 m
   (IF (/= NIL SSET) : C9 e8 F4 J; u( K
    (PROGN
8 Q+ a  y% F0 Z9 T     (SETQ SSL (SSLENGTH SSET))" I8 t, V% Z# B2 h  J" O( o6 h
     (SETQ LAY "")
0 u8 o/ |; l2 ^. I8 _- t! L  o     (SETQ I 0), _: w7 r7 m; H! C& @9 Y
     (SETQ MODE 0) : Y6 c2 G/ D$ Z# H; t
     (WHILE (< I SSL)
8 o4 X5 t( I" ^! T                 (SETQ ENT (ENTGET (SSNAME SSET I)))! t" Y  w( N# K( W2 f8 ?5 y
          (IF (= (CDR (ASSOC '8 ENT)) (GETVAR "CLAYER")) (SETQ MODE 1) )0 n8 w% h3 |; @1 u* ^& l& o3 d
          (SETQ LAY (STRCAT LAY "," (CDR (ASSOC '8 ENT)) ))/ S; a+ C5 q1 F1 x
          (SETQ I (+ I 1))
  L* A1 Q; \: R2 K# _3 G4 d     )
5 u2 a) O% {# h0 L& l* k/ O- W     (COMMAND "LAYER" "OFF" LAY "")6 p$ s) o: K7 `1 @7 m6 I1 ^1 m: V. z; j
     (IF (= MODE 1) (COMMAND "") )% E) z4 I3 j. Q
    )
% Q7 j! s; J" i9 y8 |4 \   )
# S/ |  v& \# `5 X2 {   (PRINC)% f/ g& q  l0 J2 P# F  s
)
5 |* \6 K7 J* y2 L5 N% @4 e$ K: Z# c6 w
;;; ================================ Layer ON ==============================3 S  f& T$ G) b: I; o- f: d: d
, h% O: o9 T- X8 y( b9 y3 a( y
(Defun LAYON ()  (setvar "cmdecho" 0)
+ M8 _/ h. w1 m$ ?+ l. U, |! [ (setq Lay loff1) (setq Loff1 Loff2) (setq Loff2 Loff3) (setq Loff3 Loff4) (setq Loff4 Loff5) (setq Loff5 Loff6) (setq Loff6 "0"), B1 @" c1 F/ _7 H9 ^4 L
  (Command "LAYER" "ON" Lay "") (princ (strcat "\n      Layer : " LAY " da ON."))  (princ))9 |3 v, X/ F/ l8 |7 W* s5 [4 |
(defun cAYON () (layon)) (defun c:LOO   () (layon)); y; [+ [  G; w& `; L; e( f7 w
(Defun C:LO () (setvar "cmdecho" 0)  (Command "_.LAYER" "_ON" "*" "") (princ "\nDa ON toan bo cac Layer !") (princ))
+ a3 b. J6 b: V5 t; \6 F( W" o0 m; s- `) I! \3 ^2 v
;;; ============================== Layer Freeze ===========================% x1 |) o1 Z- Q! ?3 A2 X
# @$ }, v5 ~/ D$ X
(Defun LAYFRZ (/ LAY TEMP)(setvar "cmdecho" 0)
; x4 s- J$ N! n# n(prompt "\nChon doi tuong tren layer(s) muon FREEZE: ") (SETQ SSET (SSGET))
( z2 }- q. V( F- K9 c' G% X (IF (/= NIL SSET) (PROGN
+ O) J% Y- G+ I8 N$ g3 I     (SETQ SSL (SSLENGTH SSET))  (SETQ LAY "") (SETQ I 0) (SETQ MODE 0)
. ]# T" M% A, w, n7 i  ?     (WHILE (< I SSL)* O: u( P4 y3 O6 u
       (SETQ ENT (ENTGET (SSNAME SSET I)))
6 z. f% V& f, j) o8 p       (IF (= (CDR (ASSOC '8 ENT)) (GETVAR "CLAYER")) (SETQ MODE 1) )- A( H0 h1 ~8 m. Y! U: I
       (SETQ LAY (STRCAT LAY "," (CDR (ASSOC '8 ENT)) )) (SETQ I (+ I 1)))
+ u  m$ M2 e2 g+ C; x4 i     (COMMAND "LAYER" "FREEZE" LAY "")+ K/ ?5 J& |' H) ?/ h9 f1 w0 _
     (IF (= MODE 1) (COMMAND ""))))
& Q$ W! u  ?! U9 }! X3 \7 E) L (setq Lff6 Lff5) (setq Lff5 Lff4) (setq Lff4 Lff3) (setq Lff3 Lff2) (setq Lff2 Lff1) (setq Lff1 LAY)+ G9 v: o$ K! Z2 R& ~
(princ (strcat "\n      Layer " LAY " da FREEZE."))(setvar "cmdecho" 1) (princ) )
) f0 N1 p3 m4 k9 A# v$ j2 d(defun c:LAYFRZ () (layfrz)) (defun c:LLF     () (layfrz))
6 d! \# U  |; L# l, @/ [: {) d+ d8 Z3 s1 a- k, w
;;; ============================== Layer Thaw ===============================
! Y) U- o( X) K  o0 {* S- a; x8 A5 P; ]1 o+ a9 p
(Defun LAYTHW ()! u  m$ M9 n1 g* B# o& I2 s) R
  (setvar "cmdecho" 0)
8 u9 U! {# M& O3 j (setq Lay lff1) (setq Lff1 Lff2) (setq Lff2 Lff3) (setq Lff3 Lff4) (setq Lff4 Lff5) (setq Lff5 Lff6) (setq Lff6 "0")# n6 W1 W4 v, J5 R  t3 E2 a
  (Command "_.LAYER" "_THAW" LAY "")- P# U' u$ ~- z2 B" a# ~4 [% q
           (princ (strcat "\n     Layer : " LAY " da THAW."))
0 s8 b8 Q$ v9 e. Y           (princ) )% }# j, }" V% d7 S1 h
(defun c:LAYTHW () (laythw)) (defun c:LW    () (laythw))8 X" z' e3 U! s' L5 u: {% R: s
6 v- T* h5 W' w
;;; ============================== Layer Lock ==============================8 [: Y  x% f6 ?7 ^" P

7 O/ V9 e4 v! ?7 u(Defun LAYLCK (/ LAY)
% e# s1 n7 g, U. B8 Y; G' x" p7 ]  (setvar "cmdecho" 0)/ @' ]" X9 b  p6 C6 Z) M/ z
  (setq LAY (entsel "\n>Pick doi tuong tren layer muon LOCK: ")). Z" w  o- n1 L6 K" n
  (if LAY
+ \1 V9 K# ^: K5 A+ ^- e5 U    (progn
) L6 x/ b# X2 U. Q4 g$ O# e      (setq LAY (cdr (assoc 8 (entget (car LAY)))))" a( g6 n" b7 s" ^: Y8 a4 ?* Q
      (Command "_.LAYER" "_LOCK" LAY "")
$ q) ?+ F; o& E' P& u      (princ (strcat "\nLayer " LAY " da LOCK."))    )  )  (princ) )
; w/ k) {( Q- z. l# t4 X(defun c:LAYLCK () (laylck)) (defun c:LK     () (laylck))* J: H6 _& T  F( \

- t, [: ]/ b& j3 q* I! }$ o7 @;;; ============================== Layer UnLock ==============================( |6 }) u6 V2 I3 r+ j; m' i7 {7 I
' ]  i. E5 c" R# w
(Defun LAYULK (/ LAY)" Q2 G+ U0 T* F5 ~
  (setvar "cmdecho" 0): u4 p3 i2 e7 ~
  (setq LAY (entsel "\n>Pick doi tuong tren layer muon UNLOCK: "))2 `' F- X$ Y3 V, @% m+ ^
  (if LAY8 z8 y+ t# O1 r4 F
    (progn4 H) B. R4 c( d# Q" @+ G1 ?9 g
      (setq LAY (cdr (assoc 8 (entget (car LAY))))), j  B5 I$ t; f8 U: @) h4 S1 J
      (Command "_.LAYER" "_UNLOCK" LAY "")" Q5 w7 ^3 G0 R2 H8 o" R0 k
      (princ (strcat "\nLayer " LAY " da UNLOCK."))    )  )  (princ) )) ^" C' T; B! x4 V  Q- S
(defun c:LAYULK () (layulk)) (defun c:LU    () (layulk))" D" u, d2 y6 J8 M0 X
/ e$ ]3 J# B1 w* ]* Z
;;;===================== Delete all objects of Layer ========================
; ]2 c5 l- Z$ F! c. `! i1 [: ~5 Y8 B: B  Y0 M. l( e
(defun DELAYER (/ ocmd L S)
$ j8 U% w) {! @! I  (setq ocmd (getvar "CMDECHO"))
* r2 q3 D5 q7 T2 t  (setvar "CMDECHO" 0)
% I+ j* b- m8 `6 T& j  (setq L (strcase (getstring "\nLayer(s) to delete: ")))) b7 g. p( Q5 b  t. f  w
  (setq S (ssget "X" (list (cons 8 L)))) & J( ]; e, H8 K. o+ D& p
  (if S ' Z  S+ E5 ?3 d5 f
    (command "ERASE" S "")            
& e1 `, Q/ @- ^( e' s( N; f! P    (princ "Layer empty or not a valid layer name.")  )
/ ]/ j3 M1 C  X( l$ [  (setq S nil)                        3 n& ?' ^* ~% Z7 o, }! e+ R
  (setvar "CMDECHO" ocmd)            
. J5 x1 H: @9 h- M9 x' u  (princ) ) 8 J. Y' ~/ E. [/ c" u: p; J
(defun c:DELAYER  () (delayer)) (defun c:DELLAYER () (delayer)) (defun c:DEL      () (delayer))
3 \9 K) r1 n) k3 V' x3 \& K
( c5 K' A+ {9 o+ K;;; ========================= HET CAC LENH LAYER ===========================
6 F( _* B- K* J/ n. b. L
1 b/ a4 a0 e; W; e- [;;;====================== EXTEND NHIEU DOI TUONG ===========================2 x$ B$ O5 u, F# K0 G" Z% q

9 ?3 E# u% n# H" o7 t% C(Defun C:EET ()
$ I5 p! _& l$ G$ V) h  (Setq CVAR (Getvar "CMDECHO"))  (Setvar "CMDECHO" 0)9 K- P- }) T/ O
  (Prompt "Chon doi tuong dich cua EXTEND :")  (Setq CUTEDG (Ssget))
+ o8 n6 ~" s( `; |+ I4 e  (Prompt "Chon doi tuong de Extend :")  (Setq SS (SSget))  (Setq LEN (SSlength SS))
: b0 d) X+ [. t7 g3 N" i  (Setq I -1)9 o& a2 D, q6 Z0 L
  (Setq SIDE (getpoint"Chon phia de EXTEND"))  (Command "EXTEND" CUTEDG "")9 ~  H: a! x: \! T7 P
  (Repeat LEN
% q' Y& \+ ~' m0 f, a   (Setq I (1+ I))
4 E* I, }$ V- }, P   (Command (List(SSname SS I) SIDE))  )  (Command "")
2 ]# G; q" i; u, [9 Q0 _' c6 e  (Setvar "CMDECHO" CVAR)  (Princ "Da Extend xong moi ban lam tiep")  (Princ) )
4 t, {# M: w9 ]7 O" z' x( D. ^+ X0 @5 [& @. A" z
;;; ===============  EXTEND 1 DOI TUONG THEO KHOANG CACH ===============
: s: u3 i0 e( w* V7 \# w9 Z; d# e9 p2 ^1 Z* w4 w
(defun c:ETT ()  (setq os (getvar "osmode"))  (setvar "osmode" 512)
1 _* ~$ q, B* D! L5 ~7 q  (setq pt1 (getpoint "\nKich vao 1 dau doan thang can EXTEND  "))- Z. ~- @! W! {* s7 b' @
  (setvar "osmode" os)
2 M# W7 E$ E; U( B1 j  (setq dis (getdist pt1 "\nKhoang cach can EXTEND :"))
. F+ [  C! \; W) @  (command "circle" "endpoint" pt1 dis)  (command "extend" "last" "" pt1 "")  (command "erase" "last" "") (princ))( ^: S+ K( e" m+ @) ^, Q4 f! [
1 W/ Q& r( v, o! R6 _! O
;; ================ Change width of polylines =========================# `& w1 q, Q5 V0 i2 l( D

! X5 I" N9 C1 [5 M* ]9 {" d(DEFUN wp (/ a b sophantu sodem list1 ha:wid)8 v* x8 o2 z+ k7 b( e8 O- f
(PRINC "\n         Chon doi tuong can thay doi do day (Width) !")
( d. h' b  X$ a (setq b (ssget))
# O/ q/ C% z7 o0 [  ?3 J (setq sophantu (sslength b)) " K' I) b3 C/ @* L
(if (null ha:wid) (setq ha:wid (getvar "tracewid")))* m4 t1 v1 L2 l1 m
(princ "\nDo rong polyline <")
0 \9 t( M9 t) a& ?. M- ~ (princ ha:wid)
  |  ?9 s. _2 V+ {7 [: s8 B (princ ">: ")
. @6 ]0 a1 [8 u1 `9 K( L( O (initget 4)3 a4 ?3 H; H! y4 a9 O1 f
(setq ha:wid (getdist))  R1 u3 P7 G/ M8 |, l* _# {
(if (null ha:wid) (setq ha:wid (getvar "tracewid")))
* m! E+ |. c& f/ w: Y4 h; w. j. O (setvar "tracewid" ha:wid)4 \8 i) I( ~6 C& d1 {) h( i
(setvar "cmdecho" 0)( j, V' u- e! ?2 t6 i9 s' N& G. f2 E
(setq sodem 0)
( B) A2 T+ n" s0 J9 o7 `: ^ (repeat sophantu
' K6 G7 ~) S' {. t  (setq a (ssname b sodem))
$ v& k# B+ c+ ?1 a4 ?  (setq list1 (assoc 0 (entget a)))) F1 j8 J9 e. v8 G
    (cond1 h, H) m/ u1 ]) O, e" k$ @
     ((= (cdr list1) "POLYLINE") (command "_Pedit" a "w" ha:wid ""))
* n( y" k7 {2 i* C     (PROGN (command "_Pedit" a "" "w" ha:wid ""))    ) ) P6 a# s! D0 I7 o( u' t: Z
(setq sodem (1+ sodem)) )(SETVAR "cmdecho" 1)(princ))/ H' l% l4 u0 S- f" _8 P* g; z
(defun c:wp () (wp)) (defun c:pw () (wp))
, [: m* V( ~. o
9 X) m7 q7 ~0 ?* X;; ================ Change radius of circles ==========================
3 k0 ]1 n( f( b2 X4 T4 e9 q
8 g2 z# Z( U3 K* P(DEFUN C:CHR (/ SSET SSL M RD I)   (PRINC "\nSelect Circles :")   (SETQ SSET (SSGET))8 b% ~5 t, x! i1 I
   (IF (/= NIL SSET) (PROGN  (SETQ SSL (SSLENGTH SSET))  (INITGET 4 "")  (SETQ RD (GETDIST "\nNew radius : "))7 S1 w; [7 f6 ~7 H
   (IF (/= RD NIL)  (PROGN (SETQ I 0)
3 y; c5 g/ \3 n  G, N4 L   (WHILE (< I SSL) (SETQ M (ENTGET (SSNAME SSET I) ) )" E$ \+ }' L9 J
   (IF (= (CDR (ASSOC '0 M)) "CIRCLE") (PROGN
; i0 u0 L: z: i8 E' x5 v  (SETQ M (SUBST (CONS 40 RD) (ASSOC 40 M) M))  (ENTMOD M) ) )  (SETQ I (+ I 1)) )      )   ))) (PRINC) )2 x& U6 g! R- L6 j, I& L, I
: K& Y- w- `3 T7 @& ?2 v
;;; ============================== TEXT Hight ===============================1 b1 h9 X+ v4 ~
, A, {: M8 l  D. S5 J
(defun texthght (/ ent hght)/ i4 \* b: C) ~) z' q, u
  (setvar "cmdecho" 1)9 @0 ^* B% c& W. `6 p
  (prompt (strcat"\nSelect text entity with required text height"))
2 ~  K4 d9 d0 u/ B* D6 X6 a% [0 e) P  (prompt (strcat"\n."))& f8 o. h' k1 M" D# W
  (setq ent (entget (car (entsel))))
8 `: j8 g  q( r5 r( m  (setq hght (cdr (assoc 40 ent)))
0 f# K# E+ k; D3 e0 u: k+ h7 T& ^. \  (prompt (strcat"\nText height now set at "))(prin1 hght)
2 l: T0 p& h2 K. z, z1 s  (prompt (strcat"\n.")) 9 p" H1 ?. k% B2 A
    (setvar "cmdecho" 1)
/ ~& a# K6 `: L' P    (command "DTEXT" PAUSE hght "") ), \* C* u' j7 k9 A- `2 ]
(defun c:teh () (texthght))  (defun c:texthght () (texthght))
/ p0 T+ n# l/ k) ~# M' J
" e: l, Z2 O  ?, N, ]: p;;; ================ BAT -TAT CHE DO GACH CHAN TEXT =================
" \5 L/ F% P8 W5 S' H
. h6 `: M" h4 M" ~) y(defun c:tuu ()  (setvar "cmdecho" 0)
6 J& X" L* _- S# L6 P4 n    (prompt "\nHay chon dong TEXT can gach chan ")) l/ s, {* L' a
    (prompt "\nSelect objects: ")
& a* ?& t5 z3 i: F- q* b6 r/ C    (command "select" "au" pause)
) @2 c- q" v; @* i4 F8 t  b    (setq sstxt (ssget "p")
7 A" t4 {- j7 D0 `: ~0 V1 D6 T5 P          sslen (sslength sstxt)8 H! s9 N/ g, d0 Z8 m) E
          ctr 0    )
5 y% j3 F$ m. K0 o+ |7 D    (command ".undo" "mark")1 m( y  ~8 A1 W4 x4 g9 H/ D
    (while (< ctr sslen)' v5 Z0 g/ g) v$ p
           (setq listxt (entget (ssname sstxt ctr))
0 b, [; n$ y$ e                 txttxt (cdr (assoc 1 listxt))0 z# [3 G# q/ W) C3 o5 }- c
                 enttxt (cdr (assoc 0 listxt))   )# I, S* I  S, S4 H0 g
           (if (= enttxt "TEXT")
& G( E7 P, J: N* L+ e; ]% u               (progn6 z( ^0 ?# ]* }+ B* H. ^% s
                   (setq testxt (substr txttxt 1 3))2 T6 v, m$ q! Q' ]1 n
                   (if (or (= testxt "%%u") (= testxt "%%U"))6 ~9 P; r# B" N( N% F, K- J% h( W2 n
                       (setq newtxt (substr txttxt 4))% T1 r* w8 z1 C7 x. g. n
                       (setq newtxt (strcat "%%u" txttxt))    )/ d9 Q' [  t" j$ S% m
                   (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))2 V% ~+ q" y" i$ Y+ p0 w% R
                   (entmod listxt)                ) )0 D7 f2 C" k$ H% B  d3 l
            (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))
, J8 t; p( b$ v! l. @: z7 s  n. a. p
;;; ================ BAT -TAT CHE DO GACH CHAN TEXT =================
, ?; d3 r- r$ K# F
8 n! W5 k/ _& p( p5 r$ v. _(defun c:tob ()  (setvar "cmdecho" 0); r$ u3 H9 H6 \" N
    (prompt "\nHay chon dong TEXT can gach tren dau "): B4 S3 i7 p0 y- q5 Q: Y+ K5 j/ y# x
    (prompt "\nSelect objects: ")8 S& Z0 u+ i* ]' L4 O2 u+ Q
    (command "select" "au" pause)
2 i* Y; `0 o) U. e, E    (setq sstxt (ssget "p")
: E/ J+ d9 {. k; `; U( {$ n+ T1 B+ Z          sslen (sslength sstxt)# V: @9 w4 l0 ^0 A
          ctr 0    )* z# k1 {- p0 Y
    (command ".undo" "mark")
- t: C% {0 n' z3 }1 @. Z: X    (while (< ctr sslen)& [5 Q5 n1 b* F) J
           (setq listxt (entget (ssname sstxt ctr))0 v0 d" x3 @+ M- S& J. g
                 txttxt (cdr (assoc 1 listxt)), X! ^) T# D/ V5 u( F$ K- @7 n# F4 \
                 enttxt (cdr (assoc 0 listxt))   )0 F7 X" G! M  v3 T* y& k
           (if (= enttxt "TEXT"). |, v* f) S) X% e. n3 B( O' L' m
               (progn
5 k5 \: g* n2 d6 h+ a! A                   (setq testxt (substr txttxt 1 3))
- T1 ?$ v4 T6 G8 _! b3 q' n                   (if (or (= testxt "%%o") (= testxt "%%o"))7 |4 m  c6 X+ b% U7 R
                       (setq newtxt (substr txttxt 4))
( n' t5 H1 Y7 e0 d! s                       (setq newtxt (strcat "%%o" txttxt))    )
. Z, p* l! |$ ]3 ]                   (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))
8 N  G! Q  |( T$ \; G                   (entmod listxt)                ) )
% f& k! u$ F# w4 I$ |( l1 I  w* F* ]; ^            (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))6 Q* X4 F! M) b

5 f" O4 S9 [/ p+ K: F% Q;;; ========================== Tim & thay the TEXT ==========================
9 S. K$ ]; H+ C: V* \) [! e" r) L2 T! `
(defun frstring (str search replace / str1 str2 index find); N6 j0 ^+ D% V+ l9 u! I& T
(setq index 0) (while  (<= index (- (strlen str) (strlen search)))  (setq index (1+ index))) }; x+ R4 c' z
(setq find (substr str index (strlen search)))  (if (= find search) (progn    (setq str1 (substr str 1 (1- index)))
' p2 Y/ d  `- @6 F. ](setq str2 (substr str (+ index (strlen search))))  (setq str (strcat str1 replace str2)) )  ) ) (setq str str))
4 q5 o/ T& D& b6 f(defun hai (/ dial)
4 G) s1 P( Y. j: `3 i$ w' b8 z) n$ F' G (setq dial (load_dialog "hai.dcl"))       ;;goi dialog
* p6 U  z. ]" F2 I (if (not (new_dialog "find" Dial)) (exit)) ;;
! E. E$ \" w' b: r+ B! N; `: Q  u (mode_tile "find" 2); Tao dau nhac tai hop thoai5 y1 ]2 @$ k6 Q
(action_tile "find" "(hai1)")& v& w1 k% [! k3 `4 \  [9 @) W
(action_tile "replace" "(hai2)")
1 F% s( e1 {0 D2 s8 I) a0 u+ m" U (action_tile "cancel" "(done_dialog) (exit)")3 ?& F6 L4 ]4 V6 p# B# `3 F
(start_dialog)      
. l- F6 W5 m& u; x' | (unload_dialog dial))
. c* i. `, z: A(defun hai1 () (SETQ str1 (get_tile "find"))). E; t, g# l6 @$ {* Y& Q9 P& n
(defun hai2 () (SETQ str2 (get_tile "replace")))
0 f/ w+ @4 R" E. ~7 i4 j) r" f& H. f6 y1 U3 {
(defun c:TTT (/ a str str1 str2 newstr taphop sodem)
  S  l) [; h4 p2 |: l (hai)' f$ Z& Q' |% T! B8 ?6 P
(if (or (null str1) (null str2)) (princ "\nDu lieu khong hop le")
+ N% e' E, T) `& Z6 F6 q  (progn
* V- N8 ?1 `; A% D& W   (setq taphop (ssget '((0 . "TEXT"))))
3 t% V! S4 ?, B, l* a! b/ e   (setq sodem 0)) F% E7 B" P# u! {; ]: y& \* a+ S
   (if taphop& J; I5 O4 m* u
    (progn8 o$ I3 q! M" E+ N
     (Repeat (sslength taphop)' G- k: q- H) P. r7 I0 q. [
      (setq a (entget (ssname taphop sodem)))- C" L# Q+ R! J3 [3 j* N. `4 L
      (setq str (cdr (assoc 1 a)))
3 N( Q* V1 ?# t4 u' T      (setq newstr (frstring str str1 str2)): p. P* A0 A( C6 O( P! R, A
      (setq a (subst (cons 1 newstr) (assoc 1 a) a))
" q# c. H  I0 d6 }: l0 _8 `2 Z! _' }      (entmod a)( M3 x" U: h/ e" O& h+ L' A
      (setq sodem (1+ sodem))     )    )
  o7 z$ n0 l. I( u    (princ "\nNone "TEXT" selected")   )  ) ) (setq *error* olderr) (princ))
/ C! Z" [: n7 k* I" ]+ H2 t$ d: [( [0 C4 a
;;;=============================  CHTEXSTY.LSP =============================
% F3 h/ f' N, M/ u
8 |. b) ^% k4 `6 B: i) h(Defun C:TXS () (Setvar "Cmdecho" 0) (Initget 1 "SE ST "): s/ }/ m# Q2 L# j
(Setq G (Strcase (Substr (Getkword "STyle/<SElection>:")1 2)))4 |5 i7 H( g8 v& o9 ^( h8 S
(Cond ((= G "SE") (Setq A (Ssget)) (Setq B (Sslength A))
* n5 Z& E" S$ P- h(Initget 1) (Setq C (Getstring "\nEnter new text style: "))5 z1 ]9 ^5 T0 ?8 M( o# b
(Extang C) (While (> B 0) (Setq B (1- B)) (Setq D (Ssname A B))
- G9 N/ t9 M% y7 J+ M3 k7 V2 Z(Setq D (Entget D)) (Setq E (Assoc 7 D)) (Setq F (Cons 7 C))- }/ H! B2 \8 W& ^( a, j$ E
(Setq D (Subst F E D)) (Setq H (Assoc 51 D)) (Setq I (Cons 51 J))
& |1 X: m6 F' j. O" v- O(Entmod (Subst I H D))) (Setq A nil)) ((Or (= G "ST") (= G ""))
5 B+ H' a- t- t) D' J2 L9 W  ](Initget 1) (Setq A (Strcase (Getstring
+ X4 d8 g- A8 ]  m"\nEnter text style to change: "))) (Initget 1)
: O+ V9 q. d4 L' K, d& d(Setq C (Getstring "\nEnter new text style: "))(Setq D (Entnext))
' n. a; F+ r. S; Z! K( D6 `(Extang C) (While D (Princ ".") (Setq E (Entget D)) (If/ s4 U0 v2 Q3 t9 b2 f& t" [6 m0 d2 O+ {
(And (= "TEXT" (Cdr (Assoc 0 E))) (= A (Cdr (Assoc 7 E))))
3 [" |2 [& @" v( r% }* T0 [(Progn (Setq F (Assoc 7 E)) (Setq G (Cons 7 C))  r( @; ^( ~- \  }$ M9 U
(Setq E (Subst G F E)) (Setq H (Assoc 51 E)) (Setq I (Cons 51 J))
, G2 \. h2 E5 B(Entmod (Subst I H E)))) (Setq D (Entnext D))))) (Princ))
! ~/ _& ?0 y/ W& v4 x% E8 a
1 c9 H8 O" x5 H- m) Q(Defun Extang (A) (Setq A (Tblsearch "STYLE" A))
6 K3 \' W+ ]  `. {% s7 {(Setq J (Cdr (Assoc 50 A))))
& z$ H" o7 L# O6 M# \7 V3 N# P! a& E
;;; ============================ DRAW CLOUD =============================
- u" \5 L7 {$ X* O8 }1 x, P# g: h: D/ t# c- V: @3 }+ t  L
(defun CLOUD (/ pt1 pt2 arc1 cnt ss la)    (setvar "cmdecho" 0)
: V/ _1 z) R4 `0 T. }    (prompt "\nVe cloud (may) khong khep kin - Tu khep kin ve diem dau!")6 C2 A8 X, c# C4 \: c
    (setq la (getvar "clayer"))
- ?. ^) U$ b* b4 d1 W: }: t    (command "layer" "m" "cloud" "c" "5" "" "")7 O) x* \9 O" f$ h
    (setq pt1 (getpoint "\nEnter first point of Cloud: "))
9 ?1 H  s0 I. ?5 |, R- X) |8 F    (if pt1 (prompt "\nProceed in a COUNTER-CLOCKWISE direction..."))
# R6 `9 ]( |- R- r% a" N9 e4 F    (setq cnt 1 ss (ssadd))" p# t. a; f) x5 R* c' i& x3 ^
    (while pt1 (setq pt2 (getpoint "\nEnter next point - and close: "))
0 Y7 ]7 X9 |+ |" h    (if pt2 (progn (command "arc" pt1 "e" pt2 "r" (/ (distance pt1 pt2) 1.75))
' |2 Z/ _- P  R+ P0 b    (if (= cnt 1) (setq arc1 (entlast) cnt 2) (ssadd (entlast) ss)) ))5 q. a) e! l# k7 {4 x+ X& s- x* J
    (setq pt1 pt2) ) (setvar "highlight" 0) (if (> (sslength ss) 0)5 ]2 q: H$ U( O
    (command "pedit" arc1 "y" "j" ss "" "x")# B$ t8 \9 l4 G/ j( {7 _2 R  _; Z
    (if arc1 (command "pedit" arc1 "y" "x")) ) (setvar "highlight" 1), L; w+ c, f- K, M' t
    (command "layer" "s" la "")    (setvar "cmdecho" 1)    (princ))  " [  X) V6 S+ L
(DEFUN C:CLOUD () (CLOUD)) (DEFUN C:CLO () (CLOUD))
. ?: ^. ^. L( `! O- c
, [  a% F9 w( _( f5 c;;; ================================ Funtion-Dulieu ========================6 \% o( h( O# G. o
;;; ================================ Funtion-Dulieu ========================
8 R' {9 d6 F2 q8 w# b$ G;;; ================================ Funtion-Dulieu ========================  [% F8 c3 Q2 l5 G

: }9 J0 s( A9 T7 O8 S(defun ha:nhap (kytu thamso) (princ kytu) (princ thamso) (princ ">: ") (setq key (getint)) (if key (setq thamso key)) (princ thamso) )/ g5 q" x5 t6 A5 q) `1 ^
(defun ha:thoat () (reinit) (setq Temp "Da thoat khoi chuong trinh"))
3 {* u- h1 `% [% L  n(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))
9 s, I5 U2 \3 g6 B0 `9 X(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) ), y0 i0 g2 U/ D5 ?' H; H8 p" i
(defun hauon (hauon1 hauon2) (command "fillet" hauon1 hauon2))  _$ Y4 P# r4 g! C
(defun init () (setvar "blipmode" 0) (setvar "cmdecho" 0) (setvar "angbase" 0))
0 e5 d/ A6 M1 O. s" y" P5 K8 f% `(defun reinit () (setvar "cmdecho" 1) (setvar "osmode" 0))
0 U, P2 T4 ^  @& w- w(defun tichvecto (vecto1 vecto2) (apply '+ (mapcar '* vecto1 vecto2)))
/ \% ]$ v) ]: }(defun vectophap (v01 v02 / vectochiphuong) (setq vectochiphuong (mapcar '- v01 v02)) (list (cadr vectochiphuong) (* -1 (car vectochiphuong))))
7 J8 w# @% y& ~* \6 G. p" |(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)))- h: F! Z0 n: Z% Q( I
(defun dtr (dtr) (* pi (/ dtr 180.0)))/ I) H+ J2 f% ~* q' I6 E
(defun rtd (rtd) (* 180.0 (/ rtd pi)))8 P% I2 W* g/ p' O4 }; R

! s8 P' ^% D$ D" z;;;==============================PROGRAME===============================6 l) Y: H3 Y; S6 X$ C
;;;=====================EditDiM Hien Hop Thoai Dep======================
' I, H( d' [7 V;;;==============================PROGRAME===============================& Z+ v" A) j* J! W) V

; p5 O. Q% D3 Q$ C; p% \5 O;;Dth Edit Text, Dimtex & Attributes(Chu Co Thuoc Tinh)
$ I/ l! f' k" [# y! w;;Chay Cung Du Lieu.Lsp & Hai.Dcl
* X! |) C) q- M4 w, j% ~) X2 i8 X(Defun Hai_Edim (Chon / Dial State Str Oldlis Dimdefault Pt10 Pt13 Pt14 St Ang Dis Pt Hc)* s9 w* }  e" D6 Q, b; b% d
  (Setq Oldlis (Entget (Car Chon))- `5 H) @' K9 w; W9 x
        Pt10 (Cdr (Assoc 10 Oldlis)). p5 d# f/ Q4 Q$ j6 ^# G4 R+ b
        Pt13 (Cdr (Assoc 13 Oldlis))5 v# A- L' R0 i
        Pt14 (Cdr (Assoc 14 Oldlis)). A- e! G0 ^% R& d. [. D
        St  (Cdr (Assoc 70 Oldlis)); `$ S" R# m  G7 Q$ Q
        Dimdefault (Cdr (Assoc 1 Oldlis))
4 f  [9 Y/ g; S: Z* C" k" |        )
' N8 i/ s% q$ H2 b3 J  (Cond
; g& z4 L# J) Y7 J& P    ((Or (= 32 St)(= 0 St)(= 160 St)), v/ f1 T3 G  y
     (Progn
" `% f: N4 j) E" H# I- S( _       (Setq Ang (Cdr (Assoc 50 Oldlis))
# \4 q3 }+ X2 s9 @2 q  w             Pt (Polar Pt13 Ang 500)! Y5 g. f. q/ D3 m* m, N8 F, [6 y# T
             Hc (Lay_Hinh_Chieu Pt10 Pt13 Pt)! G: O$ G  ?: f3 h2 `
             Dis (Rtos (Distance Pt13 Hc))
3 h  L$ s  Q2 d8 ]- d             )/ G$ D/ k$ D3 t7 V" ?1 a) l
       )
) N9 D$ @- S( S9 Z6 d- M     )) g! V7 ]: o' u6 v0 k# {
    ((Or (= 33 St)(= 1 St))
# X4 `- {- |- w$ f8 N  @) |9 o     (Progn(Setq Dis (Rtos (Distance Pt13 Pt14)))))2 u7 Q& y; Y6 p3 Y0 {
    );;End Cond
+ o% [3 B3 r# c& x  x  (If (= Dimdefault "") (Setq Dimdefault "<>"))
  Y! N8 {6 n- e! R( O" l9 b# w  (Setq Dial (Load_Dialog "Hai.Dcl"))
8 r+ C% Q: K; p* P! N( c  (If (Not (New_Dialog "eddim" Dial)) (Exit))2 m" ^6 l3 X$ W  m5 B3 H
  (If (Or (= 32 St)(= 0 St)(= 160 St)(= 33 St)(= 1 St))
5 R1 s9 L! p8 J) r7 X2 \: D5 c3 V  }    (Set_Tile "text" Dis))
+ R' M% G: P; g* [' [! O  (Set_Tile "ha:edim" Dimdefault)
5 Y, L8 x( o% C4 d  (Mode_Tile "ha:edim" 2); Tao Dau Nhac Tai Hop Thoai2 |; A7 W/ Q1 N/ m; J% x( }( ~
  (Action_Tile "ha:edim" "(Setq Str (Get_Tile \"ha:edim\"))(Done_Dialog 3)")
: O9 p+ l$ m9 U2 p/ g' {! c/ a  (Setq State (Start_Dialog))(Unload_Dialog Dial)5 ~; X) c7 N5 P* S% `
  (If (And Str (= 3 State))
4 r7 ~+ z" A/ i8 G4 Z    (Progn" m& W& J# g  D
      (Setq Oldlis (Subst (Cons 1 Str) (Assoc 1 Oldlis) Oldlis))(Entmod Oldlis)))
6 \* `" w- H/ d! ?" _9 {  )$ j6 y% S* z* n: G# a3 t
(Defun C:EH (/ Chon Name )1 }8 Y- ^7 v# v
  (Defun *Error* (Msg)
& [: J9 l$ v( y7 ^7 ?3 {) v8 e- w( L% Y    (Princ "\nerror: ")(Princ Msg)(Princ "  ")( m1 Y% E, g# G
    (Start_Dialog)(Unload_Dialog Dial)
- L  C6 T, G& h' i  F4 a    (Setq *Error* Olderr)(Princ)
) S$ v% s0 n+ T    )- U: L# f6 Y' |6 x% g1 \, H
  (Setq Olderr *Error*)& C4 t; u& t8 B  B: H6 z
  (Setq Chon T). X2 k" b0 W) T2 H) {
  (While Chon
& b3 [3 Y1 B) B# H    (Setq Chon (Entsel "\n\n\nSelect Text, Dimtext Or Attributes To Edit..."))
7 [0 ]) t% j' x) l8 u8 l    (If Chon
$ D5 b7 ?& a4 X, `* ~1 B      (Progn
' }; }+ V* G+ }        (Setq Name (Cdr (Assoc 0 (Entget (Car Chon)))))  i) J: a7 A+ A1 `4 J1 A$ R
        (Cond# R! I+ s: \) ?6 k* G
          ((= Name "INSERT")(Command "Ddatte" Chon))6 S% U8 I5 O9 r" i9 |0 a
          ((Or (= Name "TEXT") (= Name "ATTDEF") (= Name "TOLERANCE") (= Name "MTEXT"))(Command "Ddedit" Chon ""))
9 Z( D3 L' q- K          ((= Name "DIMENSION") (Hai_Edim Chon))
: S1 X7 L* p! [+ ~' \" m          ), B& i6 r  D/ E* b; }# @
        );End Cond: d' ~3 b4 }  r: s; O; E
      );End Progn. p8 P: N0 j4 }# y( v$ n- R
    );End While' C* W6 ^8 h1 k( H' g# _7 ?
  (Setq Olderr *Error*)(Princ)6 ~  I: K9 _5 p+ m1 f/ j3 r2 a9 T* s
  );End Program
/ @: n1 o4 h' ?8 Y1 F  k# v9 R. X5 X% ~* x
;;;====================DDeditDim=====================
. F8 }0 ^6 `1 _2 [, N$ Q- D# g) I7 ]* H;;;=====================Hai.DCL======================
! f/ N3 K& H& v;;;====================DDeditDim=====================0 {$ O6 M; Q: s7 T2 y9 w  @' y
# w: y+ c; P, h/ O' L( C  _: M
;;Dth Edit Text, Dimtex & Attributes(Chu Co Thuoc Tinh)( Z, d$ F4 Y% a8 b0 t: q( z/ @. y9 g
;;Chay Cung Du Lieu.Lsp & Hai.Dcl! F% P. [/ D/ n4 C/ f$ w) u7 i& Y
(Defun Hai_Edim (Chon / Dial State Str Oldlis Dimdefault Pt10 Pt13 Pt14 St Ang Dis Pt Hc)
+ S5 U8 `& Q* B+ I- l" p! D& s  (Setq Oldlis (Entget (Car Chon))
' o4 Z" A+ g5 Y, u6 l) {4 r        Pt10 (Cdr (Assoc 10 Oldlis))
2 I8 F5 Y8 W, l$ b/ a& x+ F        Pt13 (Cdr (Assoc 13 Oldlis))
" G* s) C5 H4 h6 o2 [% ?2 [% X        Pt14 (Cdr (Assoc 14 Oldlis))
/ r6 @+ [2 P5 B, p5 `, T7 K        St  (Cdr (Assoc 70 Oldlis))
5 [3 X, E# O! U' C6 k8 R( D8 [        Dimdefault (Cdr (Assoc 1 Oldlis))
  a; b/ h% H7 k2 L        )+ [# I. s. I% s; B
  (Cond; J% @( y" d* a6 m5 a
    ((Or (= 32 St)(= 0 St)(= 160 St))
( F2 F5 e3 w  O: D     (Progn
+ i1 g6 j4 l* U3 G+ L* F5 L2 q7 M. C       (Setq Ang (Cdr (Assoc 50 Oldlis))4 L' @" E! I& c, s$ w" I
             Pt (Polar Pt13 Ang 500)9 p$ O# J- t- ~8 ?8 p+ [
             Hc (Lay_Hinh_Chieu Pt10 Pt13 Pt)- i; h; I+ A2 o* r$ \1 P
             Dis (Rtos (Distance Pt13 Hc))
6 K1 \- k( c' ?* M( f& i4 l1 g. u8 u1 j" L             )
6 b4 S) G' h9 X" n, }       )
5 X1 X6 S: g3 d9 e& }' g2 Z: B     )( x* a  u" W/ f: @
    ((Or (= 33 St)(= 1 St)). c+ |) V1 t6 B, q9 w# i7 H
     (Progn(Setq Dis (Rtos (Distance Pt13 Pt14)))))2 m* s6 ~- R4 R8 P
    );;End Cond
5 M& M* e- A8 g) o$ |/ d2 s. J  (If (= Dimdefault "") (Setq Dimdefault "<>"))
( Q& h. B3 v$ J( Q4 g/ u( j  (Setq Dial (Load_Dialog "Hai.Dcl"))  {6 B  K- L1 M+ h/ Z# [! t
  (If (Not (New_Dialog "eddim" Dial)) (Exit))# p. `# m1 `# K1 b5 X0 _7 h& Q2 ^( X
  (If (Or (= 32 St)(= 0 St)(= 160 St)(= 33 St)(= 1 St))
6 _  T' Y9 _4 K$ B6 R' A    (Set_Tile "text" Dis)): C. B3 u  j! y. G% [8 o4 @
  (Set_Tile "ha:edim" Dimdefault)" u5 w" m. g. h
  (Mode_Tile "ha:edim" 2); Tao Dau Nhac Tai Hop Thoai0 a! ]" d) ]" _2 Y6 b3 l2 u
  (Action_Tile "ha:edim" "(Setq Str (Get_Tile \"ha:edim\"))(Done_Dialog 3)")% m2 `* W+ v) K
  (Setq State (Start_Dialog))(Unload_Dialog Dial)* s5 V0 _% U1 H* N
  (If (And Str (= 3 State))! ]9 ?' i% V, c2 |# F* n
    (Progn' j6 K. U7 x9 I# ]. w
      (Setq Oldlis (Subst (Cons 1 Str) (Assoc 1 Oldlis) Oldlis))(Entmod Oldlis))); Z# u5 |: }2 Y% f& P* B
  )$ Q, |- x2 B8 z8 S" w$ p
(Defun C:EH (/ Chon Name )
% W/ e0 V3 U0 ~2 ?
3 a0 G: S6 w& j2 Z6 D;;;********************Du Lieu********************) }9 Z3 ~5 \$ v) |# E4 P% u
4 D) z+ K' L4 g1 X, N" S; C4 X
(Defun Ha:Thoat () (Reinit) (Setq Temp "Da Thoat Khoi Chuong Trinh")). _# J' Y% D8 J: I/ y" j0 S
(Defun Hacat (Hacat1 Hacat2 / Hacat3 Chon)* }1 j' g8 U, B
  (If (And (/= Hacat1 Nil) (/= Hacat2 Nil))
5 s! [% ?& n' C( S% }, h: y    (Progn
. C: Z" T  ^! w: i; {9 _# _      (Setq Hacat3 (Polar Hacat1 (Angle Hacat1 Hacat2) (/ (Distance Hacat1 Hacat2) 2))): ^& |6 q/ c" N0 d( v
      (Setq Chon (Ssget Hacat3))
2 U2 R8 H* h4 ?0 C: J      (Command "Break" Chon Hacat1 Hacat2)
& s2 j6 P. m  [% a, w: J$ I8 a8 c      )
; ?: c5 S: {0 z6 |/ e    )1 Q1 K7 Z! |9 P3 h0 ]
  (Princ)& b2 }$ ?+ f1 r  f6 m
  )
; [: L' w" ]0 U5 X;;
; \4 Q7 q3 q/ z1 P(Defun Hauon (Hauon1 Hauon2)(Command "Fillet" Hauon1 Hauon2))
* b: z* i; f, }8 r- `;;, K& [  L+ D( ^* U3 v9 w1 Y
(Defun Taolop (Mau Lop / A)(Setq A(Tblsearch "Layer" Lop))(If (Null A)(Command "Layer" "_N" Lop "_C" Mau Lop "")) (Setvar "Clayer" Lop))5 |4 l* A* w8 j  v
;;1 |: G  T& `# B! R. b, b: c
(Defun Init ()(Setvar "Blipmode" 0)(Setvar "Cmdecho" 0)(Setvar "Angbase" 0))
1 R( b! B1 \# E% [$ ]9 w, T;;. |% R( X: |% R  G: N+ z
(Defun Reinit ()(Setvar "Cmdecho" 1))
6 {4 x9 G, `! X' F;;+ [* R% Q- O, G7 W  k" o" \
(Defun Tichvecto (Vecto1 Vecto2)(Apply '+ (Mapcar '* Vecto1 Vecto2)))
' f4 v3 ^. h# A9 P3 e;;
9 a- S  G+ s6 w) b8 V;;Cho 2 Diem Tinh Ra Vec To Phap
6 a0 c* k2 R* V2 n1 H% P(Defun Vectophap (V01 V02 / Vectochiphuong)(Setq Vectochiphuong(Mapcar '- V01 V02)) (List (Cadr Vectochiphuong) (* -1 (Car Vectochiphuong))))6 c. n: k. \, G
;;Xac Dinh Vi Tri Hinh Chieu 1 Diem Len 1 Duong Thang0 [: q( `9 A, I8 Z# D
;;Da Biet 2 Diem Thuoc Duong Thang5 f6 P5 X" Z" R, T6 Y4 Y. y/ J1 ?
(Defun Lay_Hinh_Chieu (Dc1 P1 P2 / Hc Dc2)" N- v8 W7 ]% ~3 Z1 }
  (Setq Dc2 (Polar Dc1 (+ (/ Pi 2) (Angle P1 P2)) 100), ^7 U2 J9 J" j. E4 E9 z! F
        Hc (Inters P1 P2 Dc1 Dc2 Nil)))2 v3 m, S4 e. ~* Z6 L8 D# D. _
;;Xac Dinh Khoang Cach Tu 1 Diem Len 1 Duong Thang* \% b& @; r$ y. T4 f' ^' j4 h
;;Da Biet 2 Diem Thuoc Duong Thang9 B- N6 z4 d) j* p" P$ _* D: |
(Defun Khoangcach (Dc1 P1 P2 / Dc2 Hc)/ E% @  N! H. K$ S7 Y2 [
  (Setq Dc2 (Polar Dc1 (+ (/ Pi 2) (Angle P1 P2)) 100)
, q' M1 a2 Z) Q        Hc (Inters P1 P2 Dc1 Dc2 Nil))
# ~+ f4 i& Q. v4 m; p% `  (Distance Dc1 Hc)3 j/ r$ b- M  s$ I0 K% x& L- P, l
  )
3 t1 V, b; b" C8 N8 |  F(load "nhapcua.lsp")' r6 y. e. z2 K. w3 Q- ?
  (Defun *Error* (Msg)
1 [' i0 x" t( S! m# U9 |    (Princ "\nerror: ")(Princ Msg)(Princ "  ")* E) L6 {2 b# _: [; ~
    (Start_Dialog)(Unload_Dialog Dial)
# K) _, \8 ^" |# F6 K& Z9 G6 m    (Setq *Error* Olderr)(Princ)
1 A5 _) s! l1 i9 i  S5 u# F    )
' Z, C9 I6 z2 n0 G2 S; O  (Setq Olderr *Error*)
( ^8 h  V' r' [& B# V$ h2 k  (Setq Chon T)1 j+ U- S8 w+ {( Q  _$ W, }0 c  B
  (While Chon
3 m  w" O9 f& c, s; [1 r    (Setq Chon (Entsel "\n\n\nSelect Text, Dimtext Or Attributes To Edit..."))% ^; {& v$ `% y/ Q5 {; {1 C
    (If Chon
6 r3 w& m; V( j0 @      (Progn
: g8 |, d* w/ Y0 M$ |) V        (Setq Name (Cdr (Assoc 0 (Entget (Car Chon)))))
; [% O: K& t' j( Z: [6 |" F        (Cond
/ s; `! ]% F; ~$ x4 H3 \          ((= Name "INSERT")(Command "Ddatte" Chon)); K! ~5 o6 G9 ~7 B& v
          ((Or (= Name "TEXT") (= Name "ATTDEF") (= Name "TOLERANCE") (= Name "MTEXT"))(Command "Ddedit" Chon ""))
( e3 Q" O) o/ f9 W8 k          ((= Name "DIMENSION") (Hai_Edim Chon))/ n, S( |" K; G
          )
4 A4 P6 J/ U# P1 P+ V0 V- O        );End Cond
/ R  @+ v+ f; M3 y- i      );End Progn' X$ K6 ?4 j, z( j- q
    );End While, e) ?. p0 }4 `# ]
  (Setq Olderr *Error*)(Princ)0 C2 l9 W6 l7 M
  );End Program7 v2 S- h& l$ D0 ^/ @
- h5 m% C- |% s

' q% u4 x( i. x! q3 F: }/ F) p1 D- u/ J
;===================HAI DCL Nhapcua.LSP De chay Hop Thoai EditDiM===================- ]: i( ?- e% w. @( }2 k# H
;====================================Nhapcua.LSP====================================( a, u# G* f5 b" v% x
;===================HAI DCL Nhapcua.LSP De chay Hop Thoai EditDiM===================; c) g+ P% @. E6 C
6 t  W2 c0 a* ~- \& i0 A3 y" G
;;; ============================ Ve Hinh chu nhat ==================================
  C0 I* A, S; d$ N, o(defun HCN (/ olderr ocmd oblp pt1 pt2 pt3 pt4 l w)7 F. F( g* d/ I- {' ], [0 _+ b
  (setq ocmd (getvar "cmdecho"))7 n! F; T4 {6 x5 E' O+ K2 L
  (setq oblp (getvar "blipmode"))5 |% ^6 _3 P: y, |+ X$ a! N/ B
  (setvar "cmdecho" 0)" M8 z2 a# D# \
  (initget 1)                         ;3D point can't be null4 c9 K# }, A2 [7 t
  (setq pt1 (getpoint (strcat "\nCorner of rectangle or square: ")))
6 g9 S, y& q; X: J0 {* I% d; H  (setvar "ORTHOMODE" 1)
9 E( J5 `2 `, m: j5 S$ Q  (initget 7)                         ;Length can't be 0, neg, or null
+ O2 t/ {' d- L* v% Z  (setq l (getdist pt1 "\nLength: "))
6 B0 N2 M- d8 v2 R! ^) \* ~% h  (setq pt2 (list (+ (car pt1) l) (cadr pt1) (caddr pt1)))
/ ?" a8 D! H1 l8 ]1 R  (grdraw pt1 pt2 2)
# V0 Y9 D5 D. i. B3 R) b: m  (initget 7 "Square")                ;Width can't be 0, neg, or null
$ d+ A' B! a' R# u0 z7 V2 ~  (setq w (getdist pt1 "\nSquare/<Width>: "))3 D( j* e, c. U
  (if (= w "Square") : P& ~( M' B8 g# ]/ I9 f
      (setq w l)  )2 P# W( m5 ^, [5 q" N
  (setq pt3 (list (car pt2) (+ (cadr pt2) w) (caddr pt2)))/ N+ U; M8 ?2 }6 n3 S
  (setq pt4 (list (car pt1) (+ (cadr pt1) w) (caddr pt1)))
& e9 n3 N# M/ O% w  b8 ~  (grdraw pt2 pt3 2)  F0 G5 {  c/ l" N7 A
  (grdraw pt3 pt4 2)
, B! X% ~% a6 Y: W9 W$ j  (grdraw pt4 pt1 2)# B0 L0 `" v/ B) }3 B
  (setvar "ORTHOMODE" 0)
  B0 w4 O+ w8 n* D# |  |, q  (command "pline"  pt1 pt2 pt3 pt4 "close")& t* [6 g  B0 Z' r
  (setvar "cmdecho" ocmd)
) W) Z  i  b0 E& r" P& l  (setvar "blipmode" oblp) (princ))* l) S" Z6 P6 v0 ~3 n! k
(DEFUN C:HCN () (HCN))
- q3 b& p5 K( W! J4 [3 b" ^7 q& s) v9 J; V) k8 X4 L( w: ~  Q
;*******************;*******************;*******************;*******************
1 }$ d2 ?4 }3 ^" E2 W;****K E T C A U****;****K E T C A U****;****K E T C A U****;****K E T C A U****
' z. U, M0 ?/ ?6 H3 M! C6 [;*******************;*******************;*******************;*******************
; O2 r! ?0 Z8 ?9 T; K1 Z: Q% @5 Y
;VE HINH BINH HANH
; X. S6 l$ [  i. s* P# B
+ P! U- N' F5 y% @! ?4 }. ^$ R(defun c:binhhanh (/ p1 p2 p3)  [! `; `: B& ?  x9 ]$ I. A
(setq p1 (getpoint "\n Nhap diem thu nhat:"))
8 J( n4 O9 G1 @7 Q  T( @7 @ (setq p2 (getpoint p1 "\n Nhap diem thu hai:"))
7 _- e2 a- n6 ?4 b6 \9 I) I5 Z(setq om (getvar "osmode"))
4 W7 j5 s; O, C7 ~(setvar "osmode" 0)
, |% c: H8 B+ k4 ]' w (command "line" p1 p2 "")* I' @$ d3 P$ x; l# v3 G
(setvar "osmode" om)
7 M9 U7 o0 F" A2 x (setq p3 (getpoint p2 "\n Nhap diem thu ba:"))" \, d  P5 \* ]7 j9 Z( i
(setq a (angle p2 p1))
( E& r$ G* n2 P: }3 j (setq d (distance p1 p2))
5 a3 E* F: Z5 t (setq p4 (polar p3 a d))
6 h# o/ Q2 s* W8 `( T. R (command "OSNAP" "none")6 N: n/ i: C+ J! ]$ O6 ]
(command "erase" "l" "")
0 L, s, u  U% r (command "pline" p1 p2 p3 p4 p1 "")
$ a) U8 T- W: {/ M+ n(setvar "osmode" om)) A+ O& w( u1 `' y' ~0 U
), j0 v7 }8 ^5 x: [
8 N$ @& k' i& l) q% `
;VE LUOI COT
' T( ~& M8 D" T  Q( n- D* p( N$ A( n! j8 w* w+ @; m: J8 g
(defun c:LuoiCot ()
  E# h0 z6 L5 A* W% `! ?& _. C(setq om (getvar "osmode"))
3 P* i, P0 F6 M" d(setvar "osmode" 0)
3 l& ?+ x0 A  a (setq tile (getreal "\nCho biet Ti Le ve 1/x, x="))8 f) s/ `0 r# A; _2 c, ]' f) B
(setq p0 (getpoint "\n Chon Basic Point:"))! q+ G; M' P# g7 O. e
(setq nc (getreal "\n Nhap chieu ngang cua cot : "))1 `& x% q" r6 x1 W0 f
(setq dc (getreal "\n Nhap chieu doc cua cot : "))' T# H$ F' I2 I" q: p
(setq p1         (polar         (polar p0 pi (/ (* nc hstl) 2 tile) )    (* pi 1.5)    (/ (* dc hstl) 2 tile)  )  )/ N7 s& _& _6 i4 u
(setq p2         (polar         (polar p0 0 (/ (* nc hstl) 2 tile) )    (* pi 0.5)    (/ (* dc hstl) 2 tile)  )  )9 g, d; C/ i$ {( l: A
(command "rectang" p1 p2), h( V( h8 r* P
(command "hatch" "solid" "l" "")8 L: _$ |) `: J/ P. H$ n* [0 G
(setq bcn (getreal "\n Buoc cot theo phuong ngang : "))' t6 e2 A3 g0 ~7 c( X! X
(setq nn (getint "\n So buoc cot phuong ngang : "))1 t1 y+ }9 J- d* D6 M9 \3 Z0 x
(setq w1         (polar         (polar p1 pi (/ (* nc hstl) 2 tile) )    (* pi 1.5)    (/ (* dc hstl) 2 tile)  )  )
- Z' ~" Y/ c9 F  [: Z. p; X3 Z8 I (setq w2         (polar         (polar p2 0 (/ (* nc hstl) 2 tile) )    (* pi 0.5)    (/ (* dc hstl) 2 tile)  )  )
& v  z) V4 I1 u: }4 c; s  J3 D (command "select" "w" w1 w2 "")/ y2 u( x5 W. {6 \6 e0 t$ [
(command "array" "p" "" "r" "1" (+ nn 1) (/ (* bcn hstl) tile) )" E$ e  _7 l+ I& c2 o' Q; @2 F
(command "line" (polar p0 pi (/ (* 1000 hstl) tile)) (polar p0 0 (/ (* (+ (* bcn nn) 1000) hstl) tile) ) "")% V- N7 ~* E* ]$ r
(setq w1 (polar (polar p0 pi (/ (* hstl 2000) tile)) (* pi 1.5)  (/ (* hstl 2000) tile) ))
7 n/ E$ Q& r- _ (setq w2 (polar (polar p0 0 (/ (* (+ (* bcn nn) 2000) hstl) tile) ) (* pi 0.5)  (/ (* hstl 2000) tile) ))
# Z. \  A6 ]) s9 q! F (command "zoom" "w" w1 w2). [: C' p9 {  x5 Q5 e& i4 h' ~. _8 A
(command "select" "w" w1 w2 "")% o" Y" x( u: i
(setq bcd (getreal "\n Buoc cot theo phuong doc : "))( v# p" o4 J5 _) M
(setq nd (getint "\n So buoc cot phuong doc : "))' X. s$ N* T- s$ j. Y
(command "array" "p" "" "r" (+ nd 1) "1" (/ (* hstl bcd) tile) )
- p* R" d) m% c& N0 ]: n (command "line" (polar p0 (* pi 1.5) (/ (* hstl 1000) tile))  (polar p0 (* pi 0.5)  (/ (* (+ (* bcd nd) 1000) hstl) tile))  "")
0 c8 C+ }4 r% x' X- e (command "array" "l" "" "r" "1" (+ nn 1) (/ (* hstl bcn) tile) )
! K3 ]6 Y1 I. u0 [ (setq w2 (polar w2 (* pi 0.5) (/ (* (+ (* bcd nd) 2000) hstl) tile))  )  ' T" z1 V5 Y4 j7 {3 T& c
(command "zoom" "w" w1 w2)
' s, d+ X0 h/ j  i, f4 W* S(setvar "osmode" om)
+ R2 z" q$ z7 L+ j)5 n* L, Y" L& ?; @  q2 f! {
4 Y) x: |4 A/ b* M5 E7 x. h
;VE CUA DI
# j! r+ _7 C1 w. r; M* c
; `4 n$ a! M% l" M& D; Y" @(defun c:cuadi ()- x3 x- ^6 ~. Q" b: a% h8 ~' }; R/ U
(setq om (getvar "osmode"))
- u' ^' b2 n: T0 c(setvar "osmode" 0)7 F/ m3 l: o- {8 D. u
0 D  Z/ U/ F+ C2 e. G6 l
(setq tile (getreal "\nCho biet Ti Le ve 1/x, x="))
! J' Q/ @4 l- S2 m7 |( O(setq b (getreal "\n Nhap be rong cua : "))
! R, P$ X8 q- |* ^9 S/ ^(setvar "osmode" om)* F5 w5 i/ z8 E" h9 c
(while (< 0 1)
0 N6 c* `* Z6 W  p' [, u5 I( m (progn
$ Z5 ~) j' m  A. _3 F7 `+ T (setq p0 (getpoint "\n Chon Basic Point:"))
' C: e5 }. D( P2 R' F% J (setq p1 (getpoint p0 "\n Chon diem de xac dinh huong cua cua:"))
# ?& P2 p1 }& P  x (command "osnap" "none")
; K3 \' g$ V7 L5 Y3 ? (setq p2 (getpoint p0 "\n Chon diem de xac dinh huong mo cua:"))
3 d& u# N% |  `# M (setq a1 (angle p0 p1))  U- Q+ e; O* A' [8 l
(setq p1 (polar p0 a1 (/ (* hstl b) tile)))
, X$ ~! J' ?+ k/ `7 M' }  x (setq a2 (angle p0 p2))
2 E& T: J7 d4 ` (if (< (- a2 a1) pi) (setq a3 (+ (/ pi 2) a1)) (setq a3 (- a1 (/ pi 2))) )
- q) Q: J" e  M8 F8 Q* m: Q4 P (command "pline" p0 "w" "0" "0" p1 (polar p1 a3 (/ (* hstl 40) tile)) (polar p0 a3 (/ (* hstl 40) tile)) p0 "")
+ Z0 D8 i2 z% P* [6 O (command "rotate" "l" "" p0 (/ (* (- a3 a1) 180) pi))2 E) a% y6 |; s  Y% w- O
(command "arc" "ce" p0 p1 "a" (/ (* (- a3 a1) 180) pi)) / |( k+ z1 c. E  B& p; ?
(setvar "osmode" om)) W* U+ f5 [7 i8 l9 a4 H8 t
))( S0 j1 A" c' |. l4 b9 w; B6 C
)
6 e2 m# ]$ B; f3 I) O/ A
! c' C! I( P/ x; q6 Y2 v5 |;VE CUA SO6 W. l2 Z) f) ^; \

+ B* V9 n& C9 h8 H(defun c:cuaso ()5 r' q  A2 a( {% ~
(setq om (getvar "osmode"))  S! ]7 J3 y6 w% s
(setvar "osmode" 0)
% n1 x3 D( `2 W: ?/ q" K1 i. r) E3 ?# `
(setq tile (getreal "\nCho biet Ti Le ve 1/x, x="))( _! }+ C' d  ~0 Y) L! _; _# S
(setvar "osmode" om)
. I: j9 e7 G' H  f9 h2 r0 b3 F7 |% W(while (< 0 1)( w$ s0 p2 \+ P: z8 \+ x
(progn3 E, t. M& l- L" k* y0 N
(setq p0 (getpoint "\n Chon Basic Point:"))4 R$ x, B1 w. H5 J$ G
(setq p1 (getpoint p0 "\n Chon diem de xac dinh be rong cua:")); Q, n, V. Q8 B& h) ^6 o
(command "osnap" "none")6 \! n! L8 s) J* @
(setq p2 (getpoint p1 "\n Chon 1 diem o trong nha de xac dinh huong cua so:"))
6 ~. B5 M2 c/ H! l: h" D (setq b (distance p0 p1))0 S2 g' e4 T1 q- Z" \2 Q, u) ?' B+ M
(if (< b  (/ (* hstl 600) tile)) (setq du 50))
5 F7 E' o; m2 M; }$ ]1 J (if (> b  (/ (* hstl 600) tile)) (setq du 150))% H5 B& x6 r, T' |0 \" e* |
(if (> b (/ (* hstl 1800) tile)) (setq du 200))
+ D2 c; U9 A9 X! Y/ r" x+ d (setq a1 (angle p0 p1))* s0 S( o- V& v) y
(setq a2 (angle p0 p2))9 m$ U6 K2 O0 w& ^* d# ?* H* i. \
(if (> a2 pi) (setq a2 (- a2 (* pi 2)) )  )& K* c- O4 a, d0 {2 P* |
(if (> (- a2 a1) 0) (setq a3 (+ (/ pi 2) a1))  )
+ |4 h6 o; j- `: |7 X (if (> (- a1 a2) 0) (setq a3 (- a1 (/ pi 2)))  )
8 I7 D, M, \5 a6 K (command "pline" p0 "w" "0" "0" p1 "")
. v) s! Z! K! @9 x  @ (command "pline" (polar p0 a3 (/ (* hstl 50) tile)) (polar p1 a3 (/ (* hstl 50) tile)) "")/ x( ~; p8 v" g6 o& {
(command "pline" (polar p0 a3 (/ (* hstl 100) tile)) (polar p1 a3 (/ (* hstl 100) tile)) "")
: F6 G9 I! ?( _8 Q (command "pline" (polar p0 a1 (* (- du) (/ hstl tile))) (polar (polar p0 a1 (* (- du) (/ hstl tile))) a3 (* -100 (/ hstl tile))) + k6 p+ ]) w; Y, E. u( m
                (polar (polar p1 a1 (* du (/ hstl tile))) a3 (* -100 (/ hstl tile))) (polar p1 a1 (* du (/ hstl tile))) "")
, m6 R* \/ R4 a2 m5 b! H6 D(setvar "osmode" om)" Q. J4 ?  Q- I, P; N( a* ]
))
5 R6 x, `) }0 Q0 H' t9 d)
1 z2 [$ f# _6 b) V% V$ r1 B/ b* T# R3 @) m+ {: f- n9 A1 t
;;;=== General Utility Functions ===
  u( z# r7 `% C% D' p; P* @
8 R! `' D* e. l5 S% N; n;   R12 compatibility - In R12 (acad_helpdlg) was an externally-defined # p- c, s6 J6 \) A; X2 I; E
;   ADS function.  Now it's a simple AutoLISP function that calls the ' k: m% x5 x# \% h) q' Y& ~
;   built-in function (help).  It's only purpose is R12 compatibility.  5 A" B3 I: @2 @! ?
;   If you are calling it for anything else, you should almost certainly
% T" d3 k* n& h0 ]4 q$ C- }. R  i;   be calling (help) instead. " V$ S! b4 ~- n! l, H

/ z# p0 P' x5 b8 J, J(defun acad_helpdlg (helpfile topic), e6 f# [& Q) R& |3 J
  (help helpfile topic)0 j  j3 Q$ w0 E. ?! ]& L" u
)  m9 \1 G7 h1 Q% D6 D; B$ e

, T0 G2 g( Z0 K8 ~
7 e# I. i" Y" G% `3 A! b(defun *merr* (msg)
) J8 V2 w3 {9 L! U  (setq *error* m:err m:err nil). N0 \; f3 p# @
  (princ)  [$ S5 y8 N- T
)
0 R2 T; X" I7 m8 y3 g2 }/ \. b+ @/ i
. @' F& `) a6 Y/ _/ k! p( X(defun *merrmsg* (msg)# a+ P' T; T0 g  z9 w$ y4 {- w
  (princ msg)& j8 V# \( z  u  q
  (setq *error* m:err m:err nil)& G% w( Y/ S, `0 Q
  (princ)2 m' U9 R) S# Q. Y
)
3 f( y8 {3 l; n5 N- B' N" {, c/ H0 \
;; Loads the indicated ARX app if it isn't already loaded
/ P8 ~: h8 I3 c2 N;; returns nil if no load was necessary, else returns the
  n7 \7 J6 k2 z: ]. p; Z;; app name if a load occurred.( }0 t, C9 g% j* _) ]/ @
(defun verify_arxapp_loaded (app)
, Z# e! l5 {, y( z. a4 T# F  (if (not (loadedp app (arx)))
1 E+ A6 _: b; o3 `      (arxload app f)
2 J. F4 k1 \2 O  )6 n8 Q6 L4 r" Q# |6 @+ a% A+ R
)
/ `/ j5 U, t% s  J4 Y
8 q. W; @* R8 ];; determines if a given application is loaded...
& @, T: |, g  a: p: n$ `;; general purpose: can ostensibly be used for appsets (arx) or (ads) or....& h3 @/ U' R% {' n; O6 \( ]4 Q5 t
;;7 g0 t: `+ R) o
;; app is the filename of the application to check (extension is required)
) J7 _" h/ `& y3 ^;; appset is a list of applications, (such as (arx) or (ads)0 a$ G. t9 O" `6 C6 S+ X
;;
+ S! g1 q# ]9 e0 K/ H3 p;; returns T or nil, depending on whether app is present in the appset
6 n( ^; K9 l8 z  z& ~4 G;; indicated.  Case is ignored in comparison, so "foo.arx" matches "FOO.ARX": W. F6 b" y. z$ G. |
;; Also, if appset contains members that contain paths, app will right-match
* W4 ^, j. \! `% e1 Z;; against these members, so "bar.arx" matches "c:\\path\\bar.arx"; note that
! O- h: }% Q, q% w;; "bar.arx" will *not* match "c:\\path\\foobar.arx."
2 H7 s) @  G* M! z+ |(defun loadedp (app appset)6 G; B! N* n/ H9 Q
  (cond (appset  (or : M* T3 k& l7 H
                     ;; exactly equal? (ignoring case)# D8 [7 N' b9 |1 t
                     (= (strcase (car appset))1 l) S/ m; C1 \$ K2 g! q1 L/ d. r9 J
                        (strcase app))
0 E% [# v( a1 z& S                     ;; right-matching? (ignoring case, but assuming that; i( i6 R; K$ H% X$ w/ `
                     ;; it's a complete filename (with a backslash before it)$ U/ m0 G+ A: Y4 _1 _  l
                                         (and
9 w, n4 j: Q6 {! b                                             (> (strlen (car appset)) (strlen app))* ~1 v: Q8 L! G) O1 [% F/ p1 p* a
                             (= (strcase (substr (car appset)
, O+ Q8 A/ |6 _& I. ?+ m                                                 (- (strlen (car appset))
! z/ X' [, f2 i. X2 W! O                                                    (strlen app)
8 w  U! f5 z0 \8 h                                                 )
: H7 D! s" K  w7 i- a% X1 a4 }                                         )
, c3 x! C; ^. i4 [' l4 f                                )
- @4 ^; y& @' N% S' |2 w$ G                                (strcase (strcat "\\" app))
8 d: [4 h4 D# P( t0 O- q6 h                             )- l& M; A: O2 T9 w+ Z
                                     )
1 V4 Q2 s$ G8 P8 g3 R9 N9 w2 R$ `/ G                     ;; no match for this entry in appset, try next one....4 y* n- s6 o+ e8 |. D* {
                     (loadedp app (cdr appset)) )))( @- G+ b7 a1 N5 E
)
2 e& z1 X+ N& H# V  n
6 K& _" m, f+ k7 j: C) K- O
8 {, b2 J" M. L;;; ===== Single-line MText editor =====
' b" F* ~5 I: U4 s" m(defun LispEd (contents / fname dcl state)
- b- a4 d& Y/ {+ g/ t0 ?6 Z8 {  (if (not (setq fname (getvar "program")))! ]) y' ^" ^" a; s
     (setq fname "acad")
0 L/ q: o5 a- G) {$ ~! n1 `  )2 @' p8 z8 i, ~' {
  (strcat fname ".dcl")
5 o1 J- k8 p5 P* ~  (setq dcl (load_dialog fname))! c( {8 b. {+ k: a- K
  (if (not (new_dialog "LispEd" dcl)) (exit))- h; P. N: o0 ^+ P
  (set_tile "contents" contents)3 v" O+ I! ?/ c7 ^; D  a
  (mode_tile "contents" 2)
* O1 c) I$ w8 c: o1 Z  (action_tile "contents" "(setq contents $value)")
- d5 G" t# H- t5 E- X0 t  (action_tile "accept" "(done_dialog 1)")6 \0 E$ H. Q* t, h! V
  (action_tile "mtexted" "(done_dialog 2)" )1 I7 W& j1 H( s- f8 N3 R
  (setq state (start_dialog))( W* B; f5 n7 {- m
  (unload_dialog dcl)
! j8 n8 g3 m: n" F  (cond
, ~* j% h* g+ S; e% s6 J    ((= state 1) contents). ]' M% H4 q; y+ O$ y
    ((= state 2) -1)
  }/ a9 I$ ~6 Z  ~    (t 0)" z* j. I) o# E$ r' b  l2 j' n
  )
& ]( `, M. F  z7 n0 j; S)
- a+ M9 m5 t8 H" a
5 p2 D6 w' Y8 K6 W5 m/ D4 e7 };;; ===== Discontinued commands =====) K6 @" ~. X* ]& q- R
(defun c:ddselect(/ cmdecho-save), v- J5 g( B( C" v" t- |' o# e
  (setq cmdecho-save (getvar "CMDECHO")). c, y  E4 |" T) W2 U% c) @4 X) V
  (setvar "CMDECHO" 0)
/ g2 k7 E, m. ]8 g  (command "._+options" 7): [7 G  b8 V$ y4 m- }0 d: @0 w
  (setvar "CMDECHO" cmdecho-save)
% ]7 k3 [/ H; ^& M9 ^  (princ)# @) R# {% S/ m  V. N* j7 R1 H
)
8 F' Y7 ^' c2 r6 r8 A2 l" }( @" P3 m+ c
(defun c:ddgrips(/ cmdecho-save)
( f; I1 h) J" h: R0 c& d! ^  (setq cmdecho-save (getvar "CMDECHO"))
( t( Z- S2 f/ ^: M8 ]& z  (setvar "CMDECHO" 0)
, H( a  ?  p9 |, ~  (command "._+options" 7)1 i$ y6 @4 ?: p$ h  R5 ~
  (setvar "CMDECHO" cmdecho-save)
9 |8 g/ T8 A, \5 ~' u: _; ?: j  (princ)
- M2 a2 L7 W6 m7 X/ N)
# G- U  f5 C& A0 N6 E. _6 }+ u0 f3 `$ a) [
(defun c:gifin ()
: y# b9 c5 [; H5 N* F8 L  (alert "\nThe GIFIN command is no longer supported.\nUse the IMAGE command to attach raster image files.\n")7 p. Y/ h. l, G4 Z
  (princ)
1 j, Q/ g7 l1 c1 s; _/ Y)+ Z8 C; Z* b. D0 H1 G+ x9 S3 M

% ]3 \1 T' l3 Y+ z) z4 O' f/ _* q(defun c:pcxin ()
2 S$ y/ p8 I& U; z  ], Y  (alert "\nThe PCXIN command is no longer supported.\nUse the IMAGE command to attach raster image files.\n")6 b. R8 R+ D! E5 @! x( |! n
  (princ)& ?6 u$ L" x% e: ^% c+ L1 i
)7 W+ X/ P/ q5 z6 Z
7 y* z; _+ Q2 J1 t5 H# d9 W
(defun c:tiffin (). l" t: X9 J* u7 A; K, S4 S
  (alert "\nThe TIFFIN command is no longer supported.\nUse the IMAGE command to attach raster image files.\n"). p) R3 M+ p4 N: M! I
  (princ)
3 ]5 U4 r8 Z6 j' ?# O$ r)% q& G0 l! E& x' G) R* V6 V

0 @1 ^; T. l3 m) I3 `5 W3 i(defun c:ddemodes()
+ d+ ?% a! E8 m  (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.")
# l" k. ~# g0 b( L$ S- P  (princ)
) U7 p8 q' \- P1 Y5 C)
+ l7 d5 W  d- [& G: ^& u' |  v- H# K4 [- h! Y6 i  b
(defun c:ddrmodes(/ cmdecho-save)
3 O2 x* B4 p: ]: B  (setq cmdecho-save (getvar "CMDECHO")); S# s' P) _* ?; d
  (setvar "CMDECHO" 0)  L) C) m! c. W6 {( i
  (command "._+dsettings" 0): \8 v, I& F/ m3 U8 c$ ?! V+ w
  (setvar "CMDECHO" cmdecho-save)# W, z' P8 e  B: h# o" X' k, V3 B
  (princ)" |, x( H7 q$ r$ Y+ a
)- }4 D$ x/ g. ^$ E
- C1 _$ g9 u! g' [: s% X
;; HPCONFIG% t+ g2 n  Q1 N
(defun c:hpconfig (/ hlppath)0 q. e0 q7 A, `0 ]: j1 r4 q* ^
  (if (not (setq hlppath (findfile "acad.hlp")))
& e8 e. ~) d  `    (setq hlppath ""))% ^% M2 {% e' ^1 U
  (help hlppath "hpconfig")8 Y- j# p1 g' G" x& N8 l* d) U+ p
  (princ)2 q; {4 F8 V3 S; T- E- M' s2 k
)# p* q, a5 Z  X; _+ \9 a! g3 K
1 [. b0 R: Y, }0 q
;; OCECONFIG
0 d: N. {" S7 b( V. l(defun c:oceconfig (/ hlppath)
/ O  ~3 K5 D) {; \  (if (not (setq hlppath (findfile "acad.hlp")))
, E+ b# D; @3 D" O    (setq hlppath ""))* [: R) y0 G3 y: V# q! [
  (help hlppath "oceconfig"); s6 X4 S  Y: _
  (princ)  k5 M* A& y4 a
)
9 c! G6 ?, {% H0 S
$ {3 |" q! h9 G: Y: a' s& p;; CCONFIG
' \( B$ J3 Z0 S1 V3 j* g( ]6 V" f(defun c:cconfig (/ hlppath)! Q* F. v6 X8 t2 ^/ X
  (if (not (setq hlppath (findfile "acad.hlp")))
. V4 W- \! [  j    (setq hlppath ""))* |' u) j! g' U$ r  ?
  (help hlppath "cconfig")
' v% w' L0 F9 n. M  (princ)" x  `( j  ~) [6 K/ `, S/ [* {
)  j" L: O: ?! \8 e5 h1 U' s

- b- C$ t: y. p) z! g$ Z- E$ g7 Q;;; ===== AutoLoad =====
8 l& i6 _. o) g. t) H- G% g' r& C; Y, o0 i
;;; Check list of loaded <apptype> applications ("ads" or "arx")% S7 V" g: k4 a5 P1 i
;;; for the name of a certain appplication <appname>.
- }& `6 H9 Y/ I& ];;; Returns T if <appname> is loaded.
0 F) G! J8 b) I- M. K# z( n) n
1 Q! A: x6 d$ m8 |& y5 p(defun ai_AppLoaded (appname apptype)- ?1 P; _$ V+ Q' `  {0 X
   (apply 'or
5 A- z% e' J/ D      (mapcar ' M. z2 c1 C) M1 g: A+ J
        '(lambda (j)5 E5 ]: g8 d* [8 l. M' A
            (wcmatch5 g& {1 P% }  c" j
               (strcase j T)
, c; E9 A/ ^8 p  ?' T7 V( P3 Z' C2 [               (strcase (strcat "*" appname "*") T)
0 m$ f& g' U% C* U1 C            )   
, @( l0 P% a3 m# f         )7 T% g6 }: F1 ^# T% |' f
         (eval (list (read apptype)))$ v" W; u: j- y0 F6 P
      ): G/ q1 ?7 ?# o3 t5 X; j
   )
0 c+ Q) d5 m. y( q8 U0 l)4 y! J% c5 {/ ]6 y) }7 f( x) m8 L

' w  [6 \* ]6 P- A;;  
7 x, f: T$ |: T; ]/ ?) n/ J# ]# ?: X;;  Native Rx commands cannot be called with the "C:" syntax.  They must 6 s8 L# r  K9 x/ X# n' y
;;  be called via (command).  Therefore they require their own autoload
+ r5 U3 t) }) q2 V;;  command." r+ M2 V  k: X7 Y6 L

9 T3 t' J* c1 a+ ]# y- q(defun autonativeload (app cmdliste / qapp)
# t. G$ W2 w% W9 K1 {8 C! \  (setq qapp (strcat "\"" app "\""))
: l  w0 j5 l( {) {. p: m  (setq initstring "\nInitializing...")
% \: D( K+ c3 q* b) n/ C  (mapcar
" U( J' Q* a: d2 {   '(lambda (cmd / nom_cmd native_cmd)" d  }/ r; L) J" g3 |
      (progn
7 x) [; E' N  B* x: |9 ?& {; c, m% w        (setq nom_cmd (strcat "C:" cmd))
3 o- \4 K  J8 [' O+ r3 Z! `        (setq native_cmd (strcat "\"_" cmd "\""))
2 l% ~3 {  L; _        (if (not (eval (read nom_cmd)))
6 r& _3 ?: H1 r8 J            (eval1 D& m. k& w( j7 M7 ^4 v+ @* G1 ~
             (read (strcat8 o" T3 }" a; z1 ]5 U+ N* G
                    "(defun " nom_cmd "()"- G6 }( n3 N: _8 n' |
                    "(setq m:err *error* *error* *merrmsg*)"4 P& s& n4 S& H* f
                    "(if (ai_ffile " qapp ")"
8 d$ `' J" r) x8 Q+ s! c' j/ N+ L                    "(progn (princ initstring)"
% n9 M9 j6 h( ]7 [, v7 s7 R1 l                    "(_autoarxload " qapp ") (command " native_cmd "))"
) e/ [/ |* g( {, K                    "(ai_nofile " qapp "))"0 e$ M8 D+ V' R' o% V4 c
                    "(setq *error* m:err m:err nil))"
* K1 o" |) z. Z- _/ m. u                    ))))))8 T5 L, ?4 b2 Y  y( M2 e
   cmdliste)4 V4 S9 t4 T8 {, i( }+ h
  nil
- |" ~2 f0 p' Z: R)
* Q* Y3 V+ f& b5 \# z
1 Y) B2 k3 K- X(defun _autoqload (quoi app cmdliste / qapp symnam); u1 c+ `) `$ e. y
  (setq qapp (strcat "\"" app "\""))
* V% c% G6 X! z$ J  (setq initstring "\nInitializing...")' E/ Y" q( N, F% y* G
  (mapcar( G, P: M1 x3 [% y
   '(lambda (cmd / nom_cmd)
. ^  \  e& ^5 I& O, W4 f2 s      (progn* ]; @5 \' e: F6 y7 ~
        (setq nom_cmd (strcat "C:" cmd))5 Y. q7 `# K; a- K$ T
        (if (not (eval (read nom_cmd))). q! X0 a& s, }8 V! t0 w9 [7 G) y
            (eval; M3 }5 _/ q/ m
             (read (strcat
/ G' n6 }% U# D" L2 [: [* e                    "(defun " nom_cmd "( / rtn)"
3 T( ~! v, C6 J                    "(setq m:err *error* *error* *merrmsg*)"
8 l0 I( p+ a$ A                    "(if (ai_ffile " qapp ")"2 ?3 `* T$ z- M
                    "(progn (princ initstring)"
3 H0 a3 Q% E1 b                    "(_auto" quoi "load " qapp ") (setq rtn (" nom_cmd ")))"
6 w9 Y: m3 v( a- }* k+ \                    "(ai_nofile " qapp "))"
+ E$ a5 a) x; q* X/ [) S) ^                    "(setq *error* m:err m:err nil)"8 i' u- X* Y3 l, H% c
                    "rtn)"
; V: q2 |9 b9 h, F% U0 ~3 Z+ J- D                    ))))))
2 U' o, y  P) b9 k4 ]  }+ g% e$ S   cmdliste)7 M! ~2 l: O+ _& D5 l3 @0 u7 [
  nil
% r1 x* L( {3 p7 x)
9 l5 f( A- i9 c
4 W3 f8 y( [" b8 M. O(defun autoload (app cmdliste)
9 H2 _& [* I1 C' O; E$ d  (_autoqload "" app cmdliste)
# t' t% c, x; p; ]7 t  ]$ b/ {)
2 l  l) w& v; E: g. P2 ?; R$ [! d" r4 [& M8 N# E* g5 I' w9 ^+ _
(defun autoarxload (app cmdliste): k  t$ r& ?! f/ ^. k  y$ S
  (_autoqload "arx" app cmdliste)
  H* Y' E+ r: S# c9 Y6 S# V& z)' Q6 G. ]( u- e4 ]* r5 j

# l/ E5 S  A, D7 K/ _7 o# f0 o9 z- |(defun autoarxacedload (app cmdliste / qapp symnam)
% ?! Q) O  D& i/ T" M  (setq qapp (strcat "\"" app "\"")): M% k3 I: \  \+ E
  (setq initstring "\nInitializing...")' C4 E' i& @7 T1 q2 a
  (mapcar0 \8 a" L: P, U5 n2 s
   '(lambda (cmd / nom_cmd)
- C* m: x- ~. P3 ~* p      (progn. I" |  A  c7 F  `; |* m
        (setq nom_cmd (strcat "C:" cmd))% ]! M0 X7 r9 k' F0 w3 \1 n
        (if (not (eval (read nom_cmd))), m# l0 E6 i) M0 w2 C* `* S/ d: V
            (eval
# i# J# [2 r3 m, _. p  ~8 d$ P             (read (strcat
7 M6 x) q8 W: j                    "(defun " nom_cmd "( / oldcmdecho)"3 j( m, T% e1 J* h- `! {
                    "(setq m:err *error* *error* *merrmsg*)"& A: q' ^6 W# J) h7 _
                    "(if (ai_ffile " qapp ")"( O0 W0 d5 I2 X1 W7 A2 _
                    "(progn (princ initstring)"
. r* ~" ]) R$ M$ t0 h) R( B- {* ?/ k, b3 h                    "(_autoarxload " qapp ")"
$ D/ E& b3 w! f0 o                    "(setq oldcmdecho (getvar \"CMDECHO\"))"# O" R- [! ^( r; A8 A
                    "(setvar \"CMDECHO\" 0)"
3 H; F6 h* i  l% G9 R& I; s( _9 j                    "(command " "\"_" cmd "\"" ")"
- n& O) ]* n# s# g% C  r                    "(setvar \"CMDECHO\" oldcmdecho))"
* s+ j: q6 b9 R* D8 o4 v; f# H                    "(ai_nofile " qapp "))"
8 t3 f5 o7 B; ?; n6 |) k# H" v! E                    "(setq *error* m:err m:err nil)"" v; o$ x+ }. y* {, H# G6 W& V
                    "(princ))"
% \2 J+ n' ~0 s9 f3 L1 K* k; Y                    ))))))
$ ^4 D7 K( d$ k, F8 C3 j   cmdliste)
( v: Y6 b* V7 g% P0 a: |. p2 t  nil+ ^) M/ T) @" h6 n6 ^! @3 ]% ^
)
; ?, `! k/ _! W6 c0 F/ d# x$ V' n( E; A8 @4 l  {2 ?
(defun _autoload (app); R9 e6 H- w. ^
; (princ "Autoload ") (princ app) (princ ")") (terpri)% `8 H( a! r* b  Y7 z
  (load app)
" c- o1 V8 H( f& k" ?' r6 o)
7 G6 G; \7 Q$ d; d1 ?; i. m$ S) H- ^, S& K
(defun _autoarxload (app)
2 i4 m5 t2 W2 N  v* C; (princ "Autoarxload ") (princ app) (princ ")") (terpri)0 v; _0 k, c) y, D1 c8 H( }
  (arxload app)+ b2 F& W0 Y; Q7 B! ]& V, ]
)
9 N9 x1 Y; V* i) o' q6 q
' A$ M+ H5 F/ R& M, g: y' }; q1 k(defun ai_ffile (app), O* P* G; j* U0 Y
  (or (findfile (strcat app ".lsp"))3 r3 r* T  a8 L; |! V
      (findfile (strcat app ".exp"))) i8 L$ y4 L$ H
      (findfile (strcat app ".exe"))
0 S2 A# Y" \0 K) f0 M9 e; X5 z      (findfile (strcat app ".arx"))
( Q! m( U% q; l( J2 L- k& z7 s      (findfile app)
- S! o" g. ~9 d% y! W) E8 ?  )
& f$ k% p; O4 u" O- V)
+ A; i$ m* A9 B, R1 `& q+ f! n) V) B3 h5 P
(defun ai_nofile (filename)
8 m' b0 s( o: N  (princ1 I3 h8 x( q# i, X1 x  q
    (strcat "\nThe file "
6 Y' a7 M0 n: _$ Q  O2 y            filename3 P; h+ P# K$ \7 y8 U+ z- D
            "(.lsp/.exe/.arx) was not found in your search path folders.". G8 J% o. ?+ v/ k& V/ L  Y7 R
    )
0 Z1 e# h* @' @+ n! V& d  )
" E3 e* E4 u$ N/ [- I/ O  (princ "\nCheck the installation of the support files and try again.")
4 D- Z' h6 y# K) y; L  (princ)  ]5 F- ?+ ^' I& `
)5 H; c) F" M( s2 X0 [6 X" e* M' u! {

, S) T/ ?8 C/ H& U. R$ \: r: g  S1 A, y! H9 A
;;;===== AutoLoad LISP Applications =====; X8 j$ o. M- A4 f, P
;  Set help for those apps with a command line interface
$ f" h( e" `# `3 ?) ]6 S+ G9 i& {# f5 `  j3 t
(autoload "edge"  '("edge")). r. Z8 I# J: B7 H+ n7 j2 x0 E
(setfunhelp "C:edge" "" "edge")* w8 Q9 H6 ?3 \$ Z
/ f/ f# Z- t4 H; l$ P
(autoload "filter" '("filter " "filter"))
* }$ p. o" N2 i" u& x% B/ {3 o' H
/ Z4 Y9 F' N1 \3 E$ j1 r6 D(autoload "3d" '("3d" "3d" "ai_box" "ai_pyramid" "ai_wedge" "ai_dome"4 u) A# O$ z3 v1 D
                 "ai_mesh" "ai_sphere" "ai_cone" "ai_torus" "ai_dish")/ C, \" {) E9 z/ c) V$ f
)
; ]$ U3 o7 ]/ o6 q5 t1 o(setfunhelp "C:3d" "" "3d")
6 ~6 H3 s9 m2 }, y" R; y(setfunhelp "C:ai_box" "" "3d_box")
0 g6 M' [) _/ H(setfunhelp "C:ai_pyramid" "" "3d_pyramid")
8 F- C, m2 x1 @3 Z( a  U; `. X(setfunhelp "C:ai__wedge" "" "3d_wedge")  A3 m5 Z2 B6 i
(setfunhelp "C:ai_dome" "" "3d_dome")
8 P$ z5 v7 M4 U4 _' p(setfunhelp "C:ai_mesh" "" "3d_mesh")7 n: J2 u; W' o, S5 J
(setfunhelp "C:ai_sphere" "" "3d_sphere"). ^, D, ]9 e+ J+ o$ q
(setfunhelp "C:ai_cone" "" "3d_cone")
4 P' W* R, p2 z3 a. q' R/ O1 [/ h(setfunhelp "C:ai_torus" "" "3d_torus")
0 F5 `5 f$ k7 `. y4 r(setfunhelp "C:ai_dish" "" "3d_dish")
) d; v9 a3 E* f- ?! Q: m2 u
+ F( Z7 r$ m5 R7 a( Z' u(autoload "3darray" '("3darray"))1 n2 s  R; s. J8 m. N- L
(setfunhelp "C:3darray" "" "3darray")2 [" ~! Y6 `7 H" z

3 j0 J. {8 i& S4 U(autoload "ddvpoint" '("ddvpoint"))( P/ `$ Z0 ~& y; ~2 `+ G
7 f! G! f1 {+ n4 u
(autoload "mvsetup" '("mvsetup"))
5 R9 F4 f! n# p. U: `(setfunhelp "C:mvsetup" "" "mvsetup"). R2 h( a' o- ~7 E' W3 z" G; Z
* o" r+ y. N8 D
(autoload "ddptype" '("ddptype"))
8 z  z; U2 k3 N5 R- w1 k
& |! m8 D3 C# y, n7 r6 Q0 U  ?(autoload "attredef" '("attredef"))' u9 y( L- w6 N
(setfunhelp "C:attredef" "" "attredef")
+ C+ e. O. k# `- W5 _- T# a8 {# f: K& Y: J) r% I7 E. y
(autoload "xplode" '("xp" "xplode"))
7 |/ e, P* o! _3 E1 J6 ]/ J(setfunhelp "C:xplode" "" "xplode")8 V0 B  l) [# A

% g6 L( n1 U  V& ?$ M% v# b3 j(autoload "tutorial" '("tutdemo" "tutclear"
$ p% |" V# r8 J2 F7 \  T8 v                                       "tutdemo" + l$ o& U& q4 _2 o# t- v
                                       "tutclear"))) V% U+ C- f* T6 S$ h

9 y: N6 e# ^& {6 `4 L5 c;;;===== AutoArxLoad Arx Applications =====1 U5 [; d/ ^& X, W2 \6 |2 k

7 O0 a: z6 j! _, i% Q(autoarxload "geomcal" '("cal" "cal"))
: ~1 L: ~: r' W3 q
6 |6 ^0 a$ F  K4 @: a( L(autoarxload "geom3d" '("mirror3d" "rotate3d" "align"* `1 E5 ]4 U$ Q6 w5 v' N  e
                      "mirror3d" "rotate3d"
, T2 V" {8 w; `3 ^; {7 G, i4 S                                 "align"))
+ \% N# m2 k) o2 a( i  s/ ]/ `6 T! D3 b+ }/ u, b

" @! k' F6 ^% o; K  b8 N;;; ===== Double byte character handling functions =====
) y6 M8 [7 i, b0 `+ I$ ^
6 k, C* q- ?' C1 Y) ?(defun is_lead_byte(code)  T. a3 S, H8 A% v! `/ t
    (setq asia_cd (getvar "dwgcodepage"))+ k1 H: w3 a) `: T, j
    (cond
& a; q! ], q) @. V! B2 ~2 E2 G        ( (or (= asia_cd "dos932")6 U2 X# G& {1 Y
              (= asia_cd "ANSI_932"); t5 f5 C6 y/ j( }  k% I0 ?$ m
          )
- d. i& o' S, l1 j% i, `+ Z" c          (or (and (<= 129 code) (<= code 159))+ V7 r3 L6 n9 O# _: j' p+ T
              (and (<= 224 code) (<= code 252))
& u: m% E6 S  }! d% N          )
4 k" O$ l, I/ j" e        )
3 d5 w( m( k/ x0 L+ u3 X. s        ( (or (= asia_cd "big5")
- e+ c3 w7 E- M' V% `3 S              (= asia_cd "ANSI_950")/ q- B6 U  x4 Q% ?  x0 ^; A
          )$ c2 [5 }% J# H6 Z4 j$ q9 B% H
          (and (<= 129 code) (<= code 254))
+ v" O+ d0 E- |, A        )
$ Y' [' M" E' f6 r- V3 k# B& e9 N        ( (or (= asia_cd "gb2312")# F9 }. ^- ^8 U+ D* _
              (= asia_cd "ANSI_936")
; R8 S" O( ~- p, r          )" O$ E( k- O- ]4 ~
          (and (<= 161 code) (<= code 254))
2 W* x7 }  Y/ T; |# j$ e/ J# v        )
/ V& s: {; ^$ Y" T+ ^        ( (or (= asia_cd "johab")6 i* x4 w; F+ y2 h; d- t
              (= asia_cd "ANSI_1361")& N! n( R; A4 K# c+ d  Q% ^
          ): g' z3 S& q% |' v3 |) [; W& H
          (and (<= 132 code) (<= code 211)), @9 G& v! s& H* J7 n
        )
. ?$ y. I( b+ C$ u8 V) {        ( (or (= asia_cd "ksc5601")
/ z3 ?6 O) @7 K3 D" X              (= asia_cd "ANSI_949"), ]: w3 O) i: m1 F/ Y1 C  U
          ). {7 y. b, ^* i! P5 @
          (and (<= 129 code) (<= code 254))
5 m4 Z; f% O/ l; w$ o        )
) s7 r/ D* Q% F3 @' x" x- C    )
4 E5 x! U" e: J9 V$ x( I9 i, @6 X)& k" s4 {9 @  Q( e% b6 c. k
7 g: P# Y( g8 F8 `. }: ]" i( q2 b
;;; ====================================================
5 y6 X/ B+ k) F# O5 W/ r& E, [% u; P. o. p+ f  E7 ~! V

6 O; K% K( e- R" K/ i4 I;;;
( _7 W! d" A% b) l  V" P# U;;;  FITSTR2LEN6 ~+ f9 V0 S7 b' d( s2 H; a5 h" `; |
;;;
8 p, N) r' r4 N;;;  Truncates the given string to the given length.
' @% B7 {6 T0 o6 Z1 F5 ?;;;  This function should be used to fit symbol table names, that  Q* T$ e- }+ c, ?' P* l" a; f
;;;  may turn into \U+ sequences into a given size to be displayed0 a( J8 m2 i3 ]) r2 o2 q
;;;  inside a dialog box.; e/ H* w) F: @$ F6 j5 N( Y
;;;
% H( f( N3 u( K$ U* ~5 k;;;  Ex: the following string:
, ]1 I% S* W. l* _4 D;;;
4 d8 @7 X5 W+ o3 P& {;;;      "This is a long string that will not fit into a 32 character static text box."
/ F! ?3 C4 ?0 x  t2 T/ `+ O;;;
9 {$ B! J1 J( E4 [9 p;;;      would display as a 32 character long string as follows:
4 r# g6 n  E+ f+ P& U0 D( E- H;;;
! b' |6 U2 o! e;;;      "This is a long...tatic text box."
! m+ V% N0 I( F% S5 \  B;;;" j6 F$ h* P2 k4 c0 {" k$ @3 N. V
' ]9 u' L3 w% W# B% H- o: O
(defun fitstr2len (str1 maxlen)
5 i4 n1 Q) ]& x- W# b: e. \3 @9 R
( [4 c/ Q( M3 M) @7 N; @    ;;; initialize internals
# x/ u; F7 h- l2 Y, D9 x/ U& I    (setq tmpstr str1)
- r# p- F5 w) B9 X6 u    (setq len (strlen tmpstr))/ Z0 _& `- g# p& X. n- z
# f  a6 l3 O: m4 \7 L
    (if (> len maxlen)
: r* n4 V6 ]% e! B         (progn
/ a2 L% t2 `7 l) \1 p5 T: ]            (setq maxlen2 (/ maxlen 2))
6 P4 q; ]* z2 q, ~5 M+ k8 o            (if (> maxlen (* maxlen2 2))3 K6 C4 l- X5 J- m
                 (setq maxlen2 (- maxlen2 1))
8 C0 E) x0 \( U) m3 a. d1 y& X' l            )
! ?3 |4 B3 b+ N9 D- G6 U, P            (if (is_lead_byte (substr tmpstr (- maxlen2 2) 1))
, g3 @" }2 U+ K! n$ |                 (setq tmpstr1 (substr tmpstr 1 (- maxlen2 3)))
3 H; p# }1 M' ~  f# G- r                 (setq tmpstr1 (substr tmpstr 1 (- maxlen2 2)))
7 z3 G3 U. i* h1 S( v9 \            )( C1 I' d: W5 ~8 y: a
            (if (is_lead_byte (substr tmpstr (- len (- maxlen2 1)) 1))$ F! u8 x) k3 Z6 z; N# V& `
                 (setq tmpstr2 (substr tmpstr (- len (- maxlen2 3))))+ r3 Y; [4 [  N' J+ d: Z' S4 V
                 (setq tmpstr2 (substr tmpstr (- len (- maxlen2 2))))8 m: z/ V$ D- a0 i# ]
            )4 Y) |, M3 ^* U- G7 s
            (setq str2 (strcat tmpstr1 "..." tmpstr2))
: n9 i4 r! Y; k         ) ;;; progn6 Z4 k0 W: d- e9 _. [
         (setq str2 (strcat tmpstr))
6 _9 V' h$ [2 J/ \. ~2 o    ) ;;; if* b" t- p& I3 ?) Y9 n; I
) ;;; defun
" A/ R+ C& H9 w9 `. m. S) a; d9 k( q, [1 x$ M7 ^
0 I9 r, S2 G) p. g& c
;;;
+ t5 o% U/ H. X* C2 I;;;  If the first object in a selection set has an attached URL/ H$ Q8 G. A& w6 F
;;;  Then launch browser and point to the URL.
3 A1 ]. u9 e5 H  M5 S- G;;;  Called by the Grips Cursor Menu# E. A  m- f* T5 O
;;;
$ b% L$ H8 X9 V2 H% _3 t7 P3 R& g( T0 L& p& z8 V) X% q
(defun C:gotourl ( / ssurl url i)) w: T; F; k  y7 J
   (setq m:err *error* *error* *merrmsg* i 0)
. n" ~0 x1 w) h% a4 M
+ @! \1 ^+ g$ f: O8 X& K; if some objects are not already pickfirst selected,
) D) P$ |; v" |" \  m1 m; then allow objects to be selected
$ e2 @5 l$ Q: z, G5 n7 p1 i
) |" o7 K0 K1 i2 Y8 n  (if (not (setq ssurl (ssget "_I")))0 J# t. }7 v# l3 |1 g4 A
      (setq ssurl (ssget))
9 j+ `0 S0 n+ R6 p! i$ x. A9 N% }  )4 V7 M. s- U8 J! L$ B

4 r" ^0 y: d) B# D- S; if geturl LISP command not found then load arx application- w8 r5 p7 Z) D; s/ l

+ F/ K" ~3 V$ a$ Z' J0 J  (if (/= (type geturl) 'EXRXSUBR)1 }8 _" H% e, O3 Z; ]
    (arxload "dwfout")# R" y$ G  h0 Y  ^6 R2 ~% F9 P1 u% C
  )
7 \- {& J2 I' M4 G$ O6 B6 w% }! d/ y( J. q" Q9 X1 m4 l
;  Search list for first object with an URL; W' t0 D' i* t: B  J
  (while (and (= url nil) (< i (sslength ssurl)))
4 w' K( Q3 Y+ S& O. Y    (setq url (geturl (ssname ssurl i))- \! H/ G- B$ ^% a2 T4 b* k
          i (1+ i))
/ `. l4 e! C6 v+ z/ [4 V  )/ f& I1 j$ D8 [
& o) ?  t5 W7 t" v2 l5 J
; If an URL has be found, open browser and point to URL+ A: o  \: J0 X6 Z
  (if (= url nil)
4 Y* U8 M- u" G" G    (alert "No Universal Resource Locator associated with the object.")6 m- t, t* D( v! q9 K4 @
    (command "_.browser" url)7 g- Y& P- A0 }+ a  Z0 n
  )
1 j) D$ C# f5 L0 ~2 ~9 X
. P& x/ D1 u& |7 Q* E) D  (setq *error* m:err m:err nil)- a4 m$ I1 B) z" ~' i2 y
  (princ), ?  s4 ~# L( y/ m' w4 W) t+ l

7 h. k8 }  K( L)
: J& w$ k" R, d- P; }5 S4 k8 Y  ]+ t: z0 p6 g; R
;; Used by the import dialog to silently load a 3ds file
# v- ?& V8 x' c. ]2 P9 g. z+ K(defun import3ds (filename / filedia_old render)
; }$ d( Y, t/ ?1 E  ;; Load Render if not loaded
( J5 E5 \6 c  `4 P' n5 b$ z# B4 Q  (setq render (findfile "acRender.arx"))
  J" l7 g4 A8 t5 U  (if render
, a3 Y/ g# r) i5 I+ x; k. z( D6 \    (verify_arxapp_loaded render) ( L" u, @0 o+ j' p* h. j  o
    (quit)
" c3 a8 P; O  l; o( u9 A0 @  )
' X) m, u; g; O0 w3 F# {; ~. g% q, n$ {+ [  R
  ;; Save current filedia & cmdecho setting.
& D( Z# W/ q4 u2 I  c  (setq filedia-save (getvar "FILEDIA"))
5 c, E$ f% O: d: ]  (setq cmdecho-save (getvar "CMDECHO"))$ s$ ~. q; u# h# s  H5 c
  (setvar "FILEDIA" 0)4 q) A: J* n3 r$ L8 w8 ?$ ~
  (setvar "CMDECHO" 0)
# O' z. e' z; [2 f; w9 y
. U9 p% @. g) W$ ~  ;; Call 3DSIN and pass in filename.
/ J4 T& h0 F6 h# S* S6 ^; |  (c:3dsin 1 filename)
) K' u2 O* s6 j# W6 x3 t5 L' P, a' _3 |- k; T+ R7 o' m
  ;; Reset filedia & cmdecho
" s& s1 V* O/ C2 Z' X% L  (setvar "FILEDIA" filedia-save)
( ?" ?. N* M. o1 t4 Q8 e* O) W, S  (setvar "CMDECHO" cmdecho-save)
/ l4 A9 p7 G4 W: R2 D+ ], e% g  (princ)
4 [0 O  C5 ~) \, I( e! \$ I& t)! [  j; S# t9 x: i+ e
+ \, H0 `! a& f: V1 H) u2 ?

4 @! N) V$ h6 b* J, {$ F;;;=== Menu Functions ======================================8 m& s4 v& h5 O" S" ^  d2 Z. W
/ C8 b4 z' M( B3 M' c1 K: [3 l
(defun ai_rootmenus (). p6 y* L9 J/ |: n* A% c) x. i
  (setq T_MENU 0)' L: [% {. Q  @; l0 Z" J
  (menucmd "S=S")
) t- N% h/ f+ m3 N  (menucmd "S=ACAD.S")" w& g+ s/ I3 W; Q6 w( n% \3 k
  (princ)% Z7 |4 h, W, y; t
); B# G* l7 y$ o+ i' x& m$ @8 u
! T1 Q$ J  p0 n9 c" g$ V
(defun c:ai_fms ( / fmsa fmsb)
: |7 z- w- n/ Z4 G, C  (setq m:err *error* *error* *merr*)
# N6 p- X8 I' s5 C  (ai_undo_push)  b& b; x5 V' \. R5 S; w, b( l5 O2 m
  (if (getvar "TILEMODE") (setvar "TILEMODE" 0))
+ Z9 Y0 E5 p4 T' E$ q2 @) ]  (setq fmsa (vports) fmsb (nth 0 fmsa))$ p  G$ a$ R$ \& e7 ?# U6 e
  (if (member 1 fmsb)
: f  m4 x0 K  p( T# u  I0 z  ?    (if (> (length fmsa) 1)0 w4 o( H, A( O! ^% p+ N/ v2 v
      (command "_.mspace")$ z7 d6 |$ o( M* Z4 y
      (progn; _2 G# Y! }3 |$ }* R1 a
        (ai_sysvar '("cmdecho" . 1))5 a9 ^5 K+ a5 C3 Q3 a5 p3 S* Y0 e& y
        (command "_.mview")
7 W. c( N% N) {4 l& C        (while (eq 1 (logand 1 (getvar "CMDACTIVE")))5 D! C5 h1 b6 d* v9 I$ z$ U* e9 ^
          (command pause)- r- J! Q0 E& L' f6 n
        ); u+ P' i* ]" n1 }( a5 i; c
        (ai_sysvar NIL)
2 e) n0 T8 }# T        (command "_.mspace")
: Z5 r* \& Z7 U5 k      )4 G& j# z# f; ^' V# N2 c
    )! t! e- S$ L. j6 q& p
  )
0 M1 N% T! p% K5 Y$ p' t  (ai_undo_pop)
  s6 g, B; f1 M" ^" ^! _  (setq *error* m:err m:err nil)' q4 ^9 j% x) S
  (princ)
* _: P: w. {* m+ i5 _+ m)- B3 v, ^- j9 y1 C

7 m% ^/ K( c: i/ t/ \7 O(defun ai_onoff (var)
1 F7 U4 c; M$ X  (setvar var (abs (1- (getvar var))))
/ u( w1 o. C4 o  l1 r, z, G, g  (princ)# L- _# b: t0 u' n' X
)
8 V" A  e8 [6 }4 }1 `% K& S9 ]5 i2 z
% H& P& I: m" @& u- d9 T- C5 t;;; go to paper space
7 a, L4 f3 _4 J2 D! r8 D9 L(defun c:ai_pspace ()
1 _3 L/ q" g/ a. F: i( Y  (ai_undo_push)
1 X# b$ f- @7 H- x, |4 ^$ U  (if (/= 0 (getvar "tilemode"))
  e9 G2 z# o. {. B& e5 I: P8 p  _" i    (command "_.tilemode" 0)
6 w3 N( {/ t2 I" f, I  a  )
$ b/ ]$ c, t0 v, p7 X4 F  (if (/= 1 (getvar "cvport"))
$ x2 @! k- @/ V% t    (command "_.pspace")& w) M/ m( G0 c' ^1 `
  )
+ C9 R0 O. w  ^9 ~7 W  (ai_undo_pop)
) x% [' C! v5 [5 W' ]0 J  (princ)* j5 _; e" e' c0 M( G# P) @
)
4 L9 n3 ^0 D" @& }! l5 R7 X
4 B* z8 ~# C/ x$ S9 \;;; go to tilemode 1& j1 a- _/ M; ^
(defun c:ai_tilemode1 ()
& h' `5 X$ _6 y$ z1 S  (ai_undo_push)
8 j' i  s4 p  X+ n1 Y  (if (/= 1 (getvar "tilemode"))
. t& k1 t5 U7 v/ M! h8 [" n$ s" U    (command "_.tilemode" 1)* A6 \6 D2 I: X; p& ^
  )# l: T( I8 s1 K: M% j4 w! x' L
  (ai_undo_pop)' e4 F1 |, t5 e. L
  (princ)
  B; t: _7 D& A9 f+ y: ?4 g, F)
1 b  y! p+ P: e: S1 G8 X' t1 U, B
;;; Pop menu Draw/ Dim/ Align Text/ Centered2 G5 M" `4 e: L7 M4 |
;;; Toolbar Dimensions/ Align Text/ Centered* i4 c* X8 I$ u. V# s
; d7 g# u# ^  {. Q! r, Z
(defun ai_dim_cen (/ ai_sysvar ai_dim_ss)
4 O/ `& N+ ?; _$ O. Z  (setq ai_sysvar (getvar "cmdecho"))
/ K7 H- V: b/ s1 L2 g3 S  (setvar "cmdecho" 0)6 `( y- W% W+ C: ^; ~
  (cond
4 ?  a% e6 J! o& E    ((setq ai_dim_ss (ssget  "_P" '((0 . "DIMENSION"))))  H6 M* S, H5 [1 }, q$ j  @
      (command "_.dimoverride" "_dimjust" 0 "" ai_dim_ss "" 4 o0 j3 N8 v; p4 L* y- p
               "_.dimtedit" ai_dim_ss "_h")' u; B  R6 }- ^2 e
    )6 Z$ P7 ^. P6 z  v8 q
    (T nil)) q3 p: ~6 f; t2 O+ k1 b, N
  )# U7 o6 J) T" |4 t
  (setvar "cmdecho" ai_sysvar)8 m) s9 j% F8 D- @, q
  (princ)
) Y7 y7 R7 V0 r)& n4 L( a; o( u! H
: T, N7 C" i; j$ }, I4 T
;;; Shortcut menu for Dimension Text Above - k* D: v# C( U7 P/ D  x

8 S3 K# ^1 f' l9 v: }2 K4 L(defun c:ai_dim_textabove (/ ss)
0 H  u: y' }- Q! t  (ai_sysvar '("cmdecho" . 0)); A) x& H7 E- B) G' R! G. f
  (if (setq ss (ssget "_I"))
& V2 U; a  I7 d2 X& i    (command "_.dimoverride" "_dimtad" 3 "" ss "")1 B- `  n$ C: u  a4 T2 G: x) v
    (if (setq ss (ssget)), |( K( z! G. |5 t8 Q
      (command "_.dimoverride" "_dimtad" 3 "" ss "")
4 z4 E) ]: ?: g4 E1 s- R    )' L3 X7 J/ v% S  \4 k' E9 h- C) m
  ), b& D2 u9 F& A
  (ai_sysvar NIL)* Q1 k9 c1 n  H: K5 q4 \
  (princ)
/ s# M# x% G3 N& f) {; P7 m5 q5 W)9 d, a7 F; o+ `3 x
2 V/ i2 u/ z% |7 l0 n4 @. u% H7 Q- C
;;; Shortcut menu for Dimension Text Center 9 J# g  }7 ^& {" Y  r( j3 _

- F1 T/ o5 U* U/ q(defun c:ai_dim_textcenter (/ ss)2 e  d( g3 i" a' J; k2 o4 G
  (ai_sysvar '("cmdecho" . 0))
' b9 r5 C( t4 [  (if (setq ss (ssget "_I"))
2 {$ t( u1 ?3 w, N    (command "_.dimoverride" "_dimtad" 0 "" ss "")
0 g3 O1 e7 J: }6 U    (if (setq ss (ssget)); L1 n& x* I. g  d: A7 ]! D" P2 F
      (command "_.dimoverride" "_dimtad" 0 "" ss "") $ P, U7 u2 Z- w0 h. s
    )" |/ o2 u3 N5 n+ L
  )# ?( y4 I! T( i0 H% E$ P
  (ai_sysvar NIL)
! H3 `" j, g. \' T  (princ)9 Y. x9 B9 z# i( F+ v  `
)/ D. F7 D" n( H5 f* q
9 a, E9 ~  W' ?4 }- x/ n+ u
;;; Shortcut menu for Dimension Text Home . W8 i6 `3 k: B$ C
& \5 I6 [( ~) ]& ^( B; c0 N
(defun c:ai_dim_texthome (/ ss)
9 Z5 ?+ R7 v7 H- t! ]+ N  (ai_sysvar '("cmdecho" . 0))
! ]) U! q. h5 Q6 o, O( ^  (if (setq ss (ssget "_I"))
( ~4 a/ I" j, x6 ^1 v5 m( i    (command "_.dimedit" "_h")- x* N1 J" ?4 A  L( R; {+ n% K* ?
    (if (setq ss (ssget))3 k# [: `& U* T8 @$ P6 U
      (command "_.dimedit" "_h" ss)1 L$ o+ B( b  [2 L2 I
    )
. G6 R% _# K: F4 `! i; ?# v" n  )$ \" i- w( z  _2 W  {, o1 d
  (ai_sysvar NIL)4 L5 T( W) k, x+ v
  (princ)8 v2 f# U3 \( X# Z) `+ Z
)( F2 [3 k- ~# C6 F; I: S/ O% d, u

8 S: B+ z9 {4 Z
- _# {% t* u; u) q# y;;; Screen menu item for CIRCLE TaTaTan option.
6 M- E/ p: @9 @/ I4 W;;;     first, get points on entities
/ k8 D' _8 G6 Y5 H' s  |# x- X(defun ai_circtanstart()) d  N" b6 K, ~: X) w
   (setq m:err *error* *error* *merr*)
7 ?  Z2 T% l) v+ m  f9 n   (ai_sysvar 2 o& G! R$ r" e; d' T! h& `4 g' y8 ?
      (list '("cmdecho" . 0)  P* `6 r: O% A; t) \2 \( q$ P6 X* _
         ;; make sure _tan pick for CIRCLE gets same entity
5 w, Q5 u+ A2 z. f- r         (cons "aperture"  (getvar "pickbox"))
! S* f- o3 E% j& e! \          )( r7 p3 |2 `2 ~9 F7 f* p' _! q
   )
( W- }% ^8 [4 _! F) i# s   ;; prompts are the same as CIRCLE/TTR command option6 y+ E& Y, q5 t9 T! |5 a
   (setq pt1 (ai_entsnap "\nEnter Tangent spec: "  nil))) A( O- h/ v( \
   (setq pt2 (ai_entsnap "\nEnter second Tangent spec: " nil))7 i+ Y& U1 p4 t3 C3 t( S! I
   (setq pt3 (ai_entsnap "\nEnter third Tangent spec: "  nil))" h$ K$ ]1 I+ x! H
)
$ I) {# W; M, x3 u6 h/ O9 J  s;;; Command-line version- {8 r8 w' o- z) O
(defun c:ai_circtan (/ pt1 pt2 pt3)
6 ]% C6 P; o/ a4 z9 a4 m   (ai_circtanstart)
# {5 R, d2 u3 ?
1 `9 n" w3 J0 I, U& G0 J   (ai_sysvar '("osmode" . 256))
/ Q* X& w3 H8 f* }, v   (command "_.circle" "_3p" "_tan" pt1 "_tan" pt2 "_tan" pt3)8 e) ?+ n; C, v3 m1 q

) _: f' b8 O: Z/ i' L9 m* W   (ai_sysvar nil)
, I% ]* @/ F  ~# K   (setq *error* m:err m:err nil)* j' E! z8 }9 {4 B% N, Y- ]- R
   (princ)
6 T5 }" w2 B- w' l, t( ?' W: _)
6 S+ K7 \$ r+ s;;; Use this if CMDNAMES == CIRCLE* L% [0 |/ r0 ~# g& N) g3 I
(defun ai_circtan (/ pt1 pt2 pt3)" F5 S( f2 M8 s9 K' d
   (ai_circtanstart)6 `0 {# g8 G4 c0 e& p; V/ R

7 L5 P, D+ L. P2 r, S   (ai_sysvar '("osmode" . 256))
1 s9 C5 `# P# D9 m   (command "_3p" pt1  pt2  pt3)! X/ Y. L3 k7 V6 [. x. i
- y+ A/ D+ u8 n2 \  c
   (ai_sysvar nil)# `& }. G5 D& G- u+ \5 c' G! G3 C
   (setq *error* m:err m:err nil)
& G* U* j  B& h+ D$ @4 h   (princ)8 s7 T! [  ^1 X- h+ |
)
1 O: a3 o2 a7 d- r, x
. u2 _9 b# f$ M  Y1 e6 p' j" w
9 U. z5 S- Y% g/ k/ \! c  [0 ?4 c' E3 V  y* E( Z
;;; Shortcut menu Deselect All item.
( N# U0 w+ j8 G! a" i. K6 n; v4 _. s
(defun ai_deselect ()
6 [! Y3 U, C9 y* G( ]5 |2 e   (if (= (getvar "cmdecho") 0)                        ;start if
- f2 B* _  l3 W6 G7 j, N3 J       (command "_.select" "_r" "_all" ""): n8 a0 R/ I' b; M0 T" s1 n
       (progn                                        ;start progn for cmdecho 1
7 C  X; P7 I  R7 M1 F           (setvar "cmdecho" 0)
# T, |: B! I- x% i" }1 N           (command "_.select" "_r" "_all" "")6 H, ~; T4 `, j
           (setvar "cmdecho" 1)
0 k% ~; G5 r1 r3 ]! |* _       )                                        ;end progn for cmdecho 1: s, z6 s; t# G3 @7 @1 Q8 Z
   )                                                ;end if
" B5 w  g) f: z6 k# n4 f5 b6 d' U   (terpri)
9 J8 c5 k4 m/ D% w+ ]   (prompt "Everything has been deselected")
; y+ j* Q- p! Q6 P' n, a' N- T% d" q   (princ). C5 a/ L6 @) _1 j: k& w, @. C
)
4 ^. p8 h# q9 z& [7 x2 o. Q( ~8 `- w1 a8 J% L
;;; Command version of ai_deselect to be called from the CUI
- O8 a) L6 s, F: h" w;;; so it gets properly recorded by the Action Recorder
( O4 @  ^- y# p! U# `2 r;;;
+ n( b. U2 ~; P8 E(defun c:ai_deselect ()" y+ K* E$ V* o2 o0 P
  (ai_deselect)
- h5 e$ ^% o7 L4 C/ @/ r& N  (princ)
# g5 y0 f' c' Z6 b5 z)1 l' b& b" ?8 }! `
- i2 c* F( J- K) o1 H$ T8 p
;;;
3 T  `. c0 V) t+ S/ U: }7 ^' c;;; Enable Draworder to be called from a menu; o& k4 |; W3 ~7 d) V. G
;;; Checks for Pickfirst selected objects
  \8 ~- @4 [4 w# z) M, X+ K6 B;;;
0 ]& k: }- x3 Y+ m' {1 V8 {/ h% P0 i9 o' M% l5 d  C+ \) J
(defun ai_draworder (option / ss )
: ?2 r5 }" N. U& c$ G/ b2 ?" |" k$ n( Z% B
  (setq m:err *error* *error* *merr*)" I% |$ r7 w% d- V' G6 L* H
  (ai_sysvar '("cmdecho" . 0))' Z8 k# F$ X( J( t' {+ x

! m9 B$ o! C1 }3 ]  (if (setq ss (ssget "_I"))& ~* G1 j  w$ l; v9 z
    (command "_.draworder" option)0 k1 O2 f) Q# n" C
    (if (setq ss (ssget)), D. \& H  e4 k# }4 F' T
      (command "_.draworder" ss "" option): _& L2 P7 u. N
    )
' J8 ~2 s/ c! d( v/ L  )4 [9 g' W+ I% q% V
  (ai_sysvar NIL)
8 h8 ~2 q5 _: s& ^% e- W  (setq *error* m:err m:err nil)
4 i+ {- J& J( X' f  k5 f, ^( G$ O! X$ t, h. [, L; V2 N
  (princ)
" X" Z4 ?8 v3 s5 ?)
7 R6 e0 m: t5 F; E- d$ ?" h& \; }. L+ W& ], Y, Z* H& T! ^
;;; Command version of ai_draworder to be called from the CUI
3 ?  t: D8 Q* l' u;;; so it gets properly recorded by the Action Recorder, x. W' U% @6 z
;;;2 c  R4 O! S! t( Q0 O1 ?
(defun c:ai_draworder ()
4 P7 I0 k$ q5 Z/ l  (initget "Above Under Front Back")
6 h5 Q3 K. v! q  (ai_draworder (strcat "_" (getkword)))
: d7 q  p( ^9 n. `' n4 W  (princ)  v/ @0 _+ Y# _" X$ B
)+ i7 U. V7 `0 s3 m0 I

1 I8 Z& c/ @* C9 H6 U% ](defun c:vlisp ()# n0 l6 ]# W. }, v3 d$ o9 N
  (if (/= nil c:vlide) (c:vlide))
* [; |8 C9 I, M)
/ f% h' [% Y! n* n8 [" Y
& G% ]+ ]( D9 I$ e(princ "loaded.")# S  a: t! O. i/ M; w* `$ f

2 U% v7 p  v) l  ^0 T;; Silent load.7 a; D5 T! f0 w! D
(princ)/ t9 b5 k. }, _9 F/ I) o
0 `3 n9 d" l6 G# e0 a9 l

4 `) q5 c* ]& g
' h# {! d7 i4 n+ S;;;----------------------------------------------------------------------------
7 {& n1 K. x5 o) d. @;;;
) ~  |( o" r  w8 }9 c5 B;;;   DDCHPROP.LSP   Version 0.5
. J( C0 k$ T5 S! Q, |" S# Q  f;;;
. t7 h7 w  s: Y" h7 a6 d& _;;;   Copyright (C) 1991-1993 by Autodesk, Inc.
) m2 ~8 f7 B3 F; n" M;;;
2 M/ ?6 T( m& U2 ^9 N;;;   Permission to use, copy, modify, and distribute this software' f4 t1 q; n- }. S3 ~1 l
;;;   for any purpose and without fee is hereby granted, provided
( z/ E; K, k. j;;;   that the above copyright notice appears in all copies and that& l1 _9 c$ ~6 D! r8 s( F5 n
;;;   both that copyright notice and this permission notice appear in$ e! p! Q7 u4 n; Q0 M
;;;   all supporting documentation.& @, U' K; i  u5 l7 G) R9 I. X7 I
;;;2 P8 h; E. \  A  D: Z" i# o$ x
;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED, j% d3 L7 f2 k2 @! b
;;;   WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR; p% a5 X. _1 B! P
;;;   PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.1 r( v% r$ v5 v) X& @
;;;
3 Q/ P7 |6 U1 Q! e+ s;;;   2 February 1992# C6 x5 x: e+ A; }; \" D  @, A3 q
;;;   " d/ L" H. f$ u
;;;----------------------------------------------------------------------------8 k! Q0 T, ?# _( f/ o- Z
;;;   DESCRIPTION
3 X5 m4 d* {! c( R, L  z* m;;;----------------------------------------------------------------------------
$ e; V* S0 _. Q;;;   C:DDCHPROP is a dialogue interface for the CHPROP command.* ]/ I2 N( ~* O+ H6 f# M) C
;;;4 ~5 U7 @  @/ w+ P9 {
;;;   The command looks similar to DDEMODES.  The main dialogue has an image * M- G, o; g: A
;;;   tile, 3 buttons (layer, color, linetype), and an editbox (thickness).   
) x4 Y3 \4 v. C7 D7 k! };;;   The 3 buttons each launch a sub-dialogue containing a list and edit box.  
0 q2 q& M) P4 J8 |3 e8 a2 [, g;;;   The dialogues are all defined in the DDCHPROP.DCL file.
3 b$ B- ]+ X6 [0 T4 b. a4 C7 x;;;( f/ j6 J% H% Y2 ~( ]* U( ?/ Z' y
;;;
1 F8 A5 g5 F' V- ]- Z;;;----------------------------------------------------------------------------
9 y( D# L; B( I;;;----------------------------------------------------------------------------
, \0 \8 q4 a% u7 {. e: V" {;;;   Prefixes in command and keyword strings: 5 z& \& c; d  i  a* @. Q& ?& [" B
;;;      "."  specifies the built-in AutoCAD command in case it has been        
& D8 S" j# q, L;;;           redefined.- P1 |& f9 Z) e4 y6 {
;;;      "_"  denotes an AutoCAD command or keyword in the native language
6 i/ W6 U6 z# h6 e. S4 n9 R& X1 f;;;           version, English.
) U$ n8 ^1 M* {;;;----------------------------------------------------------------------------
, F6 l% \1 I* w8 C* J' e;;;- l: |  n& I! o4 `3 E3 f
;;;8 f$ m" A9 i2 J3 P
;;; ===========================================================================" w, f/ C6 T  y
;;; ===================== load-time error checking ============================5 d& l& Q8 g1 b% ]2 l0 J$ D; J
;;;: d) f+ Y2 O/ v1 R
+ w1 v( g* y- e0 w
  (defun ai_abort (app msg)
. T$ q, Y# X4 ^. T% q* Y     (defun *error* (s)
5 v# _4 n3 N+ Q, }# _        (if old_error (setq *error* old_error))
0 c" b; m+ ~, `. d: e' N  U        (princ); {, V' {5 Y" w, n4 y
     )
/ a. N2 Y0 T! U6 r% d0 R. C     (if msg
6 O* W0 H: C3 }3 f) t# Y       (alert (strcat " Application error: "2 V" [) _' t" b  ?5 L( w
                      app" B) D6 t  n! C5 ]4 @
                      " \n\n  "
# S2 G6 L8 d3 k4 r8 ?5 A% {                      msg# H  i  ]8 Z: o) {  e. `' ~* M
                      "  \n"
0 s- `% _' V7 F& r  m  }              ), [0 ?! b' h+ t
       )
9 C1 J) B- p- O& n0 k     )
( N0 ]  h2 T( `# M     (exit)1 v* x& j, x7 ~1 `" h- Q
  )/ }% ^: [; K  u$ l+ g

4 x0 Q5 G( u- {9 N& o;;; Check to see if AI_UTILS is loaded, If not, try to find it,6 b- H; E/ w( j4 V) N2 E5 B
;;; and then try to load it.) l1 W( ^  B; ^* }9 D6 r
;;;
6 T3 R1 G$ {: ?8 `4 E1 D0 @7 E. h4 X;;; If it can't be found or it can't be loaded, then abort the
8 X& \& m' g  O/ t;;; loading of this file immediately, preserving the (autoload)! d' b, H' p8 M. `/ E) v- K6 F( N- N
;;; stub function., W" f4 R- K( k- u: `3 O
; q% D& L* y/ P
  (cond3 r! g+ M; K% M' S- G7 x& h
     (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.5 u/ s5 k! j; r% N0 ?5 V' @
* T7 \& _7 D% l9 x9 }/ ~, z
     (  (not (findfile "ai_utils.lsp"))                     ; find it  F6 Q% _1 I. e7 u' B  W" y& z6 Q9 H
        (ai_abort "DDCHPROP"+ ^$ a9 t9 E0 }' L2 {
                  (strcat "Can't locate file AI_UTILS.LSP.". i/ `4 A1 I; }+ ?$ g
                          "\n Check support directory.")))
" I8 Z# w' W+ }, L! _
# g! b* Y9 Y5 k6 _% t9 [     (  (eq "failed" (load "ai_utils" "failed"))            ; load it
9 K' l& y( z" n" M( T7 M        (ai_abort "DDCHPROP" "Can't load file AI_UTILS.LSP"))
) @9 _5 ~  e: M$ f  )
2 P. H, i+ d+ _4 u3 m( B+ t! t( \9 b: k. d) D0 }( M
  (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
0 V0 \# Y0 d, R1 I( X, j      (ai_abort "DDCHPROP" nil)        ; a Nil <msg> supresses8 R6 P7 W& J# W  V1 ]" |
  )                                    ; ai_abort's alert box dialog.
/ r# n7 Q* K# U1 ]( X/ ~+ h3 X
% ^9 `# T! }7 C' A* B8 C;;; ==================== end load-time operations ===========================
# v+ e5 \- j, M4 d  j
# t2 b5 C4 n; ^' o;;; Initialize program subroutines and variables.
2 ]$ v2 g5 U' b4 @4 o9 B2 U  K/ r  P# T* B9 Z
(defun ddchprop_init ()7 s! M8 |( X* a4 b3 @. U) b

% u0 N; ?3 Z8 e3 Y( v. J  ;;
" L; y! a  O0 ^' r4 K. \% W$ ^1 F, A  ;; Define buttons and set values in CHPROP dialogue box
9 w+ |& P# u+ Y( k) \/ v+ N  ;;
( F# ]% c; W" i) w3 N  |$ ]) d  (defun call_chp ()" u* U- l. ], I; b& p2 I
    (if (not (new_dialog "ch_prop" dcl_id)) (exit))$ w: |: x+ k* N/ y5 Q% V; v
    (set_tile "error" "")
, g0 C) F3 }" d" L: |    ;; Set initial dialogue tile values
" a/ m1 K) t& T& J3 ^. ?    (set_col_tile)8 g3 e3 {% V/ \0 _4 ~" G2 E  @6 K
    (if (= lay-idx nil)0 X. s3 g4 D$ i! ~$ ]
      (set_tile "t_layer" "Varies")$ N7 f6 J( J8 r8 Q; d5 M9 O
      (set_tile "t_layer" (nth lay-idx laynmlst))
: F* n0 h6 E- d) c( y    )0 w' r( V% c) [4 s- u
    (cond
) z( v7 [$ G7 K% T# }& [      ((= lt-idx nil)& ~$ A& F" l3 P8 C4 a
        (set_tile "t_ltype" "Varies")
0 a% ~+ h: {% T0 t- e      )' k: _/ b3 G/ [1 n" U5 w5 O2 d
      ((= lt-idx 0) ; set tile "By layer & layer linetype"
( j8 m( z9 p2 ]! `        (set_tile "t_ltype" (bylayer_lt))5 h% n  s* C( z) l
      )! v' Z0 U* S: [! O
      (T
1 y3 k, ?" q; k- G$ Z! b9 G        (set_tile "t_ltype" (nth lt-idx ltnmlst))5 l' R3 A- k1 l5 O5 ?* N* O' A- g8 P
      )
0 ~" u* p  c0 m- T    )" x; Q# X+ H# l0 j/ Z4 ?1 g  C
    (if (or (= ethickness nil) (= ethickness "Varies"))/ L" S5 \% g$ L: p3 k# ~" v0 g8 Y+ v
      (set_tile "eb_thickness" "Varies")$ P) E% U0 l7 F2 g  A( y. z
      (set_tile "eb_thickness" (rtos ethickness))
/ p; \. z( a/ m" d6 a    )
9 s, F; B, g. L5 T" r* H( l( X    ;; Define action for tiles7 p7 K/ w, t+ h- ^! C3 Y% ?3 w
    (action_tile "b_color" "(setq ecolor (getcolor))")
! r& e, m! g" B' q( c, n5 B    (action_tile "show_image" "(setq ecolor (getcolor))")
. h8 k7 V, o0 J3 X! a+ x( P+ Z    (action_tile "b_name" "(setq elayer (getlayer))")
# Z' r4 J. d% B8 q7 p  |    (action_tile "b_line" "(setq eltype (getltype))")
( u1 s6 U$ z6 `' b+ u    (action_tile "eb_thickness"  "(getthickness $value)")
' P$ y3 ?* N9 X% n$ U% N5 ~    (action_tile "help" "(acad_helpdlg \"acad.hlp\"  \"ddchprop\")")
- s0 b9 A; f" e# M. T( R    (action_tile "accept" "(test-ok)")  w6 R2 c- H! G+ m( x! X
    (if (= (start_dialog) 1)- M1 J7 c6 r0 Z- Q2 U
      (progn
/ Y" u( g9 S' |2 J& {6 r) D        (command "_.chprop" ss "")% X0 L$ c- t' H
        (if ecolor' P# f' Z+ y) Y4 D& n
          (progn
$ O) [4 I" z% d8 J* `( y  ^            (if (= 0 ecolor )   (setq ecolor "BYBLOCK"))" w; l4 m, r/ @& X4 A6 S1 z
            (if (= 256 ecolor ) (setq ecolor "BYLAYER"))
& v! o5 p* d5 V2 h+ ^+ F& h: Y0 m            (command "_c" ecolor)
! Q1 N2 a9 v4 V2 U          )$ R' N+ M: o' ~1 M0 d6 I* d2 L
        )
" o1 G! x7 X5 D4 P1 M        (if (and (/= eltype "Varies") lt-idx)5 \5 r- \/ f: h7 X& l/ w
          (command "_lt" eltype)
. T: B( N' O3 B* Z        ), G/ k: e  _" _. M% ?$ t! {7 {9 H" m* b
        (if (and (/= elayer "Varies") lay-idx)
/ Z1 X7 b+ q6 @+ \( i: ?1 i) B          (command "_la" elayer)
  A; b6 {% n# i& Z3 }6 b        )' U# |; M8 [' h. L+ R% t
        (if (and (/= ethickness "Varies") ethickness)
# @& X8 d6 A0 K, e1 M" f& D0 V          (command "_t" ethickness)8 A$ X  D6 M: f: p/ T1 d
        )
; V# R. \( X  o; a2 E6 s) Y" C        (command "")- C- g. }( ^! Y1 M  p$ w$ v
      )1 w8 C% V( `% Q# c
      (princ "\nProperties unchanged")) |2 }; H4 C* w" F( o0 }
    )
& J, b! p9 }& ~# d" f    (princ)
0 d, `% N% J5 s  )  i1 ?$ h" P. t# l
  ;;9 R* e2 ~# ]- H. _) C+ m0 c
  ;; Function to set the Color text tile and swab to the current color value.3 H" L& u3 a4 M  i# J5 D. r
  ;;5 q' V' n9 W3 W1 o8 ]2 c  r
  (defun set_col_tile()  [1 Z- W: v$ o
    (cond / t1 D$ B. w% m1 X) z8 G
      ((= ecolor nil)
0 ?  ^" W5 Z3 K) L! r+ _        (set_tile "t_color" "Varies")
/ Y8 \  F4 m  ?* E4 t        (col_tile "show_image" 0 nil)$ e' O5 k8 Z# N
      )
" f8 a8 x% {; T* ~; l      ((= ecolor 0)  Z- o. I( O! {1 s* ^# B5 K9 R& z0 W; ]
        (set_tile "t_color" "BYBLOCK")  i" ]3 i8 ]3 Q0 v
        (col_tile "show_image" 0 nil)3 h2 a/ v: D4 q3 G6 H
      )7 a3 Q! x1 S7 ~- l
      ((= ecolor 1)1 {1 F% W! Q$ D# P
        (set_tile "t_color" "1 red"): q4 @) g( Q& j
        (col_tile "show_image" 1 nil)# k6 s$ D( u  Y2 i# W' N3 v
      )5 S- }5 z, n; G. B
      ((= ecolor 2)
  }$ E( X0 [+ Q5 @  x& m. ~        (set_tile "t_color" "2 yellow")5 Y5 Z3 V3 N. g! r- q6 ^4 H0 O# L. r- D
        (col_tile "show_image" 2 nil)
: M$ h* A& t/ f5 u  v4 ?1 e      )
6 \. K% D0 H) f5 ]# \      ((= ecolor 3)
# D4 `+ l) m% I8 r3 U        (set_tile "t_color" "3 green")
+ H7 F3 `# J% D! ^/ i! V3 |& ]        (col_tile "show_image" 3 nil)/ q! p# w$ Z6 A! d
      )% _2 S# o$ M' Q; a" E' F
      ((= ecolor 4)
( D. e2 Z, y# J, x$ Y, s  \        (set_tile "t_color" "4 cyan")
: C' X; q1 w# |. f        (col_tile "show_image" 4 nil), w, A9 Q/ E) \0 B, u
      )
% m2 _" O: ?, s! w7 ?6 `7 S& ~      ((= ecolor 5)
9 B, i% u7 O* [3 y$ }        (set_tile "t_color" "5 blue")4 t' H4 A% s, Z6 a
        (col_tile "show_image" 5 nil)
- U& f5 D8 ^  a/ ~4 Z      )6 d0 [" P& o' c4 N
      ((= ecolor 6)! C1 f- ?+ {. ]$ u5 j( y& _7 T
        (set_tile "t_color" "6 magenta")) Q' g0 L. G( A; m1 e
        (col_tile "show_image" 6 nil)6 ~% U. z" C5 @% i) X
      )
2 i8 ~# W- J" z" i7 ?( Q9 u& a      ((= ecolor 7)
) {! r( X; x) Z* a9 |        (set_tile "t_color" "7 white")
2 y3 _: o$ W1 `4 U+ r4 B        (col_tile "show_image" 7 nil)2 B$ v& ?4 j9 ~
      )2 Q( M! z3 `$ A0 L8 P3 }
      ;; If the color is "BYLAYER", then set the tile to
  a# D: ]3 J" v, s/ @      ;; show it's set By layer, but also indicate the/ q* g: a# ?; u- d
      ;; color of the layer - i.e. By layer (red)
) [, f5 @; |/ I- F$ r      ((= ecolor 256)
# L8 L; g% Z/ M$ p7 D0 }  M9 Q/ d& {        (set_tile "t_color" (bylayer_col))
4 O% v1 r4 N5 k        (col_tile "show_image" cn nil)/ }7 B& P6 l4 `% i! |/ d: A* |
      )
/ ?( t0 U% n' j6 g      (T 5 B8 Y! ?  p1 _6 ]1 ?0 d
        (set_tile "t_color" (itoa ecolor))
+ j7 F6 a+ S5 _. B        (col_tile "show_image" ecolor nil)4 l) K; g$ f2 f
      )  u4 H4 ]  \8 n4 M  o9 \5 i
    ): L/ Q8 I5 ^( ^) r: Q+ G
  )% ^9 b5 L8 }$ p
  ;;
; \! v; G8 m2 h" p6 h/ r  ;;  Function to put up the standard color dialogue.
  O. _) B  O% E/ Z1 N' |6 G/ a: i& E  ;;
, j4 Z3 l( ]0 U* {" I  (defun getcolor(/ col_def lay_clr temp_color)
- s9 t( Q5 o& P  l0 k5 |" d7 s    ;; col_def is the default color used when rq_color is called.  If ecolor
- d& f4 ]+ F6 s$ O- o0 y    ;; is nil (varies) then set it to 1, else use the value of ecolor.
) f$ |2 z& c8 V2 p: L1 h2 L    (if ecolor
( m+ a9 \& j/ A3 C0 c" O* R      (setq col_def ecolor)" d( U6 u6 `. ^
      (setq col_def 1)2 p, \* g# @4 g* L; [& `& w
    )' Z4 D# ?: F% j
8 E  \7 ~& T! g5 F" j* u
    ;; If we're working with a single layer, get its color3 w( ?1 K+ m2 K4 T( T/ V
    ;; for use in the color swatch if the user selects color BYLAYER.' }( q4 J0 u: e8 v5 q+ T! c
    (if (/= elayer "Varies")) h& }2 S! S$ j/ x* j
      (setq lay_clr (cdr (assoc 62 (tblsearch "layer" elayer)))): I# Y2 F& t3 m# ~
      (setq lay_clr 0)
! y7 L! \  }/ k* W0 l% t    )
9 G( O/ [  A2 F! `9 S% c4 o    (if (numberp (setq temp_color (acad_colordlg col_def T lay_clr)))  d! `$ |  w- T0 j, [5 E: J5 n- `
      (progn
2 q5 W" ^8 Z# g- Z        (setq ecolor temp_color)
, z( f1 D9 N8 ^; {        (set_col_tile)
# C! O( {  N( |# ?( O        ecolor
! q. }  Q2 ]" A! k      )! ~$ z, F' l- d9 k" g% Z* {0 j7 u6 V
      ecolor3 `+ B. i$ m* h
    )  
: V: ~) ?$ Y' m( l: e  )$ T, M! K9 b2 O
  ;;' X, A+ ~3 X! A2 K
  ;; This function pops a dialogue box consisting of a list box, image tile,
2 w5 P9 I' [0 U) X- q8 O  ;; and edit box to allow the user to select or type a linetype.  It returns % N6 q0 n7 v+ h. k
  ;; the linetype selected.2 C  T: @; Q( D8 `. A1 r. K% X
  ;;
! r) o& ?# T, j) {/ q' N* C' J$ e  (defun getltype (/ old-idx ltname)( \2 t& o. m) {% w" h! E
    ;; Initialize a dialogue from dialogue file
! H! G3 Z# x4 y4 H3 F! v* G) @2 X, t    (if (not (new_dialog "setltype" dcl_id)) (exit))' P3 ~( ^9 y  I8 s$ K
    (start_list "list_lt")
5 b0 ~, k4 N, B$ b. s    (mapcar 'add_list ltnmlst)         ; initialize list box8 D2 r7 m' k" W" H( A# }/ l% r( ]' R
    (end_list)
& p4 N; \9 S6 Y9 }5 A    (setq old-idx lt-idx)
' V% n' j% t5 D" S    ;; Show initial ltype in image tile, list box, and edit box
  o5 f1 A) @: v    (if (/= lt-idx nil)
) c) F; v( z2 R$ Q  w# _      (ltlist_act (itoa lt-idx))0 f, F, U, k' V7 }' {5 K: `' n
      (progn3 E" D: i+ H+ Y9 [
        (set_tile "edit_lt" "Varies")
0 x4 S; q; ?" P. ^3 y6 O        (col_tile "show_image" 0 nil)) b% C: p8 r, ?4 H, M
      )% b8 |  ^0 d. D
    )
2 F! Y' ^+ b. v, L3 H/ Y+ |    (action_tile "list_lt" "(ltlist_act $value)")
7 O3 [2 ?) R! x/ A    (action_tile "edit_lt" "(ltedit_act $value)")/ j* z$ ^" L# {* D
    (action_tile "accept" "(test-ok)")3 [% y) ?9 d6 q4 x) D+ S* J" j5 x
    (action_tile "cancel" "(reset-lt)")
3 l9 f" k2 s2 z0 l* U+ a    (if (= (start_dialog) 1)           ; User pressed OK
8 l9 ^* v2 a8 |/ |6 l8 a( {3 ^      (cond + q3 \( F& C  w! W; q9 m4 ]$ O
        ((= lt-idx nil)
) K4 d+ [  A6 Y          (set_tile "t_ltype" "Varies")
/ @' _0 p8 C* g- ?9 F# m          "Varies"
* ]8 o4 @! N5 R7 m7 [        )
" {9 h  Q! G# H3 p* N/ s7 E        ((= lt-idx 0)
. q! e& e+ J. L. S5 s. o          (set_tile "t_ltype" (bylayer_lt))
" F/ b! P/ d: Z9 V          "BYLAYER"% t# o$ u; \) B/ l. ~  l! k1 m' }
        )
' f% t7 f: z0 ~# B        ((= lt-idx 1)) G# r# a1 h2 ?. b! g
          (set_tile "t_ltype" "BYBLOCK")2 Z8 H0 a& b4 m; N
          "BYBLOCK"9 ]2 _/ v+ S) E8 B
        )
" I3 w1 n3 F& f( I        (T  ( W$ V* o) `9 w5 T, p4 e
          (set_tile "t_ltype" ltname) & Z: Y2 X7 c0 \2 E1 r
          ltname6 k6 A+ k9 V  I) x( C2 w7 {
        )
# \, u* M& @0 ]  Z7 @, Z$ \% @0 m6 o3 h      )9 Z; r  J4 U- T& Q  v
      eltype
, Z$ S; v9 l+ z# i( a    )
2 n  ~8 I1 k- o3 a( a& u4 p& `7 u  )' o5 o  k, i0 T6 J: f, M
  ;;
+ F9 E8 C7 Y6 g7 A, T# w8 a" e  ;; Edit box entries end up here( W" ~2 O" l2 J: t
  ;;
- u0 U; K7 r/ H* q  (defun ltedit_act (ltvalue)! q7 U. L" }  ]! h( ^
    ;; If linetype name,is valid, then clear error string,
9 Q6 \8 C9 i" K: u8 t    ;; call ltlist_act function, and change focus to list box.
- q0 o, |/ g: \" P/ [9 S( I# Y5 Q4 S    ;; Else print error message.1 h' O( {/ d9 N2 V4 _
    (setq ltvalue (strcase ltvalue))% E  q# U  D4 j5 a
    (if (or (= ltvalue "BYLAYER") (= ltvalue "BY LAYER"))
, U7 H7 W6 J1 R8 ]6 K" {6 J% c      (setq ltvalue "BYLAYER")
9 h2 M" S3 x) ?; y2 n! P    )3 l" V: ]# V( t- _
    (if (or (= ltvalue "BYBLOCK") (= ltvalue "BY BLOCK"))2 i9 n) o. J1 l! J
      (setq ltvalue "BYBLOCK")
3 M9 Q& Q+ t; P$ D    )
$ y% F" }: k: l, n; h% X    (if (setq lt-idx (getindex ltvalue ltnmlst))+ ?: Y& h" a6 e5 z4 D
      (progn$ R! L# _" u1 K$ U  n+ j
        (set_tile "error" "")
5 P, T. X8 c6 F1 z% g        (ltlist_act (itoa lt-idx))
7 F6 z. m7 I1 n5 r. D        (mode_tile "list_lt" 2)
1 x8 P, h$ [2 ]4 \6 D      )2 X( [9 j( Q" N; P- f
      (progn. v1 Y) y, x  @5 V* \' B# B5 N3 g* `, B3 ~
        (if (/= ltvalue "VARIES")
- {3 {! s! A; F6 l4 _( @          (set_tile "error" "Invalid linetype.")
8 M" S9 f/ U6 i6 ?; E. L        )
/ V3 v' ~; F1 H        (setq lt-idx old-idx)
0 q* p6 P7 `8 \1 |% e; P( j2 O      ) . h+ l0 d3 j2 y& ^
    )
2 I5 v! F& z9 y2 E, W  )
- J( t9 P2 s3 {: i; }# ~6 B  Y  ;;5 P$ _; y3 I& [6 X& U( ?
  ;; List selections end up here
- P+ w: {9 i* D3 z: Q' }: r  ;;
. T% E% ^& @9 m" O  (defun ltlist_act (index / dashdata)) k1 |1 n; ?% |, b2 `) e
    ;; Update the list box, edit box, and color tile
' {( U+ W. \2 C: r& _/ C, Y    (set_tile "error" "")
: W9 C2 u* e$ {$ J) @    (setq lt-idx (atoi index))9 T' a6 n/ [' g  M
    (setq ltname (nth lt-idx ltnmlst))
! o$ A6 k, C+ F7 E, T# I% P    (setq dashdata (nth lt-idx mdashlist))
+ V8 Y- t. V4 q5 A3 }    (col_tile "show_image" 0 dashdata)
; s3 u6 `* C) p; k& P3 j+ J2 a# _    (set_tile "list_lt" (itoa lt-idx))4 s; W" l* V; E5 J% `
    (set_tile "edit_lt" ltname)4 D2 u0 [) x5 n. T
  )- ?& j0 i! p+ A
  ;;
0 n8 e# U* S+ M! S9 H0 k" g" _  ;; Reset to original linetype when cancel it selected
, T2 W5 J( Y* Z4 [  ;;
2 I* O7 W$ i7 Z5 I( I8 |; @( u/ k  (defun reset-lt ()& o( S0 C3 N) f1 }" G) d$ `
    (setq lt-idx old-idx), v: o: h, B0 K( K3 x  _( p& C4 O
    (done_dialog 0)
: k2 C( C6 ]. V0 p- @) G. L0 E  )% m+ Y) h: B. `# Q% r
  ;;
& z) ]' H$ D0 _% y7 ~  ;; This function pops a dialogue box consisting of a list box and edit box to 3 J* V8 }6 I2 f' V5 G
  ;; allow the user to select or type a layer name.  It returns the layer name
2 c+ q! A) H5 [/ o& _  ;; selected.  It also the status (On, Off, Frozen, etc.) of all layer in the " @+ R$ |2 \) ~* ^
  ;; drawing.
1 N. V" ]" o) S9 _) x7 y8 C& N9 }8 b- ]  ;;6 d& ]; O1 P5 Q$ L; f
  (defun getlayer (/ old-idx layname on off frozth linetype colname)
. w1 Q, g8 ]) x6 O, C5 Z    ;; Load a dialogue from dialogue file
$ k2 F) E0 W9 H    (if (not (new_dialog "setlayer" dcl_id)) (exit)). Y' f- E- Q  p- ?9 i. f6 x
    (start_list "list_lay")3 \+ {$ Q/ A6 H* f5 P* U
    (mapcar 'add_list longlist)        ; initialize list box
8 Y* _- Q5 Z- g$ i    (end_list)( e7 [3 z- ?8 t& D7 y+ t$ a/ @
    ;; Display current layer, show initial layer name in edit ' S$ S  b1 y& A) G0 `. j
    ;; box, and highlight list box.9 y7 L. ]& Z# e
    (setq old-idx lay-idx)* }3 S4 M: h& }' c" E* N! T; x1 y
    (if (/= lay-idx nil) (laylist_act (itoa lay-idx)))
! k9 c3 i9 y5 [, P    (set_tile "cur_layer" (getvar "clayer"))
) a/ f+ `/ z" I5 l+ k! K2 }    (action_tile "list_lay" "(laylist_act $value)"): R5 t( q0 U& L& l% r& _4 t% J
    (action_tile "edit_lay" "(layedit_act $value)")
0 S( A+ B$ R0 e3 H8 {* Q0 I  z    (action_tile "accept" "(test-ok)")
4 f: ~1 z* t& W# @% Y    (action_tile "cancel" "(reset-lay)")
% P! J9 S' P2 y- O3 t    (if (= (start_dialog) 1)           ; User pressed OK9 Y1 ?! W9 U' P. n, x8 }' v
      (progn
9 Z+ b6 w' y9 \" d        (if (= lay-idx nil) (setq layname "Varies"))
& ]: f( ?' Y7 k3 ~0 `1 {+ l        (set_tile "t_layer" layname)
5 ?7 I! s8 \( C4 p6 u$ y/ w0 s) F        ; If layer or ltype equals bylayer reset their tiles2 q6 }( c1 d/ u) h
        (if (= lt-idx 0)
, p9 w7 W8 z* v. `6 F: Q          (set_tile "t_ltype" (bylayer_lt))
9 ^" w$ ]( f& z; c1 N+ w        )( @% x) M* U1 i5 a
        (if (= ecolor 256)
, O, J4 W4 @( W( s- P8 \          (progn- E& Q- B" G( U; @
            (set_tile "t_color" (bylayer_col))# `$ C( f* W7 y4 Y6 }) y; H
            (col_tile "show_image" cn nil)
: l- Q9 e# R- n- n* x+ _          )
! ~& X' x  K' G+ w        )8 k3 l. F" Z5 S, ~- ^2 P" U
        layname
( N% O2 b% z  E9 `  z* q      ): _) f4 L' Q* D" D
      elayer
% K# }, ~3 V6 k! Y" P# q2 y    )/ M# D! V0 d( O
  ). S1 ^  m# s4 `- H" W
  ;;
$ }$ G7 u) z) _) }; J  ;; Edit box selections end up here
# K2 o0 ~" Q0 G" N2 m' g( j  ;;
& ~* K3 k0 \1 ^! u  (defun layedit_act (layvalue)' L, T, n% u) B/ p! I& \8 g
    ;; Convert layer entry to upper case.  If layer name is
* ?, Y$ H( L0 _) n& ~9 G: b! }    ;; valid, clear error string, call (laylist_act) function,/ E1 L, f8 ?, v/ g
    ;; and change focus to list box.  Else print error message.- X5 W# _: L# j" |2 }8 }4 z- i9 M
    (setq layvalue (strcase layvalue))# c) N: B8 J% f5 j6 C8 C/ `2 a
    (if (setq lay-idx (getindex layvalue laynmlst))
8 q; @+ Q/ J5 l0 `* }/ d0 B      (progn
( ]8 G8 u. a# Q) `' ~, Y8 \        (set_tile "error" "")
. E$ H9 n0 L" K2 Z+ U/ U& c        (laylist_act (itoa lay-idx))' ~4 [+ k& {" S5 y, w% L) M1 [8 s
      )% u0 K3 \2 \4 K+ b6 a) U
      (progn
/ z! g6 x, ]  B+ X9 ]7 N4 U        (set_tile "error" "Invalid layer name.")
6 B) m% b% ]+ D/ G) j0 _        (setq lay-idx old-idx)3 F: }: l4 ~# P" Z: q
      )+ F! {* D0 O/ a$ z
    )
# h0 B! J) B1 Q" q  )2 ?& `' k: g7 {+ d1 g9 O9 D
  ;;/ m/ j, D" B. I$ A* ?
  ;; List entry selections end up here# m) ?9 G/ l) \" X$ m
  ;;( `0 g4 d" W  c8 C: z' }  i& G
  (defun laylist_act (index / layinfo color dashdata)
. F, ^. }  C  ~6 f  {    ;; Update the list box, edit box, and color tile
1 B' x% O( c( v% x+ x: K8 H    (set_tile "error" "")2 f2 ~; U  f9 S8 o6 m
    (setq lay-idx (atoi index))8 J. s9 I; x( i2 ~
    (setq layname (nth lay-idx laynmlst))
1 Y4 L* J. u1 A/ R    (setq layinfo (tblsearch "layer" layname))* E/ [% G& W$ r# J  G9 L
    (if (= (logand (cdr (assoc 70 layinfo)) 4) 4)
& ?& y; M+ j$ D  U, h+ f2 H# J      (set_tile "error" "Cannot change entity to locked layer.")% z! P2 @7 N" S) b! g, e$ D; y
      (progn
. s* _+ t8 m; x7 H% O" N        (setq color (cdr (assoc 62 layinfo)))( B" P9 m! e% s8 R3 |2 a
        (setq color (abs color))
9 ]+ f1 Y" n' g, e) ?5 \) M- z5 |        (setq colname (colorname color))% O# N5 H/ }1 q( K, W4 S. h8 H# M" N
        (set_tile "list_lay" (itoa lay-idx))$ F0 E& g, u) Z/ X0 ~9 n3 P
        (set_tile "edit_lay" layname)$ l: f1 x/ n/ O$ g
        (mode_tile "list_lay" 2)
8 \; m' m8 K- ^1 k/ z- P# v8 {0 W* Q      )
# R  U+ W) l& D9 N, Q5 K/ O    ), W8 A  X) t0 ~( q; N: q: A' p
  )
1 F5 T4 R: h- U3 \7 L: _' e5 \5 `  ;;
' S+ R6 H) V& ~; ~  ;; Reset to original layer when cancel is selected$ i6 F( j; S3 `8 G
  ;;" [4 E4 }! G3 X0 {
  (defun reset-lay ()
: x- I3 m! j' R) H. P' ~    (setq lay-idx old-idx)
3 ?: `% w  `, ?9 s    (done_dialog 0)
& ~1 {8 ]4 q. l9 ~% E) W+ D2 G  )5 Z9 P$ U, P. L& ~2 D1 m
  ;;
( `4 ^9 F0 L1 w+ B  ;; Checks validity of thickness from edit box. Since (atof) returns 0 when a ) `3 y2 O& i7 ], f0 C
  ;; string can't be converted to a real, this routine checks if the first
1 g% x4 J  E% I/ O, i% R$ _0 _* P  ;; character is "0".  It also checks to see if the value equals "Varies".
+ A9 D  N9 s2 a" L, A1 b  ;;' J: j' R- y5 [9 T" E, D9 h6 m8 W
  (defun getthickness (value)9 K+ `, H( R& b8 @
    (setq value (strcase value))
5 G+ m  p- I3 l! `    (if (or (= value "VARIES"). L1 D4 \1 e$ @8 z. e3 D
            (distof value)
- `) Q8 F0 Z0 N/ V  U        )
2 H0 o. N, ], V" k      (progn. H% `7 w: |& X
        (set_tile "error" "")
. A" O: \& P8 z4 P        (if (= value "VARIES")/ v  g# D; V' }% G. p( U9 ]
          (progn
2 K2 [  b' v2 ]8 o) R            (set_tile "eb_thickness" "Varies")
6 u$ V1 I: T, o1 a6 M/ j; s* F            (setq ethickness nil)
7 m7 F' O5 Z6 N( Q' Z          )# p4 ?3 r& v6 J# h4 Z/ D( D  E; y. ?7 ?% v
          (progn
4 E* s: p1 h8 i8 i3 m8 ~# ~+ K            (setq ethickness (distof value))
1 V- k3 C9 |$ Y3 e            (set_tile "eb_thickness" (rtos ethickness))
8 g2 Z2 Y" D; K- }7 k0 O1 [, _( s            ethickness3 w% C- A0 u% M+ C4 ]3 H
          )0 E+ @2 r+ C3 G
        )
' f/ O  Y5 f' a, F) j3 h0 W- ?& Z5 Q      ), }% ]* z/ X/ G, G+ _! n; H* A
      (progn8 }, C' G2 u$ _% r* r3 F
        (set_tile "error" "Invalid thickness.")
) p0 u9 f( K5 I/ |7 I+ z6 A        nil
. B, ^; {! u4 R/ W( Y% i/ N7 X      ); ^' F( n+ s0 P# ^5 `
    )
1 n* e! o' {1 W. u, _' E  )
* h- V$ A- ?3 E0 [2 ?  ;;) |9 ^, D" C) }$ l( q; t! ~
  ;; This function make a list called laynmlst which consists of all the layer : T7 X- c) i3 [; ^  F3 o5 ]( [
  ;; names in the drawing.  It also creates a list called longlist which
7 ~2 Z  @. G8 N  z  C) o  ;; consists of strings which contain the layer name, color, linetype, etc.  , ^5 `) N: p; m& i; Q. q
  ;; Longlist is later mapped into the layer listbox.  Both are ordered the
$ d3 x  Q7 G; V1 s2 K  ;; same.8 n/ W% u& l7 W& G$ }+ ~1 u
  ;;
" m& I0 B" _+ l, F8 \+ r  (defun makelaylists (/ layname onoff frozth color linetype vpf vpn ss cvpname
5 L' V! P( E* T+ C( M4 t                         xdlist vpldata sortlist name templist bit-70- f0 R6 n" R7 K* T2 t. Z
                      )
7 R  b; C/ t- l# [    (if (= (setq tilemode (getvar "tilemode")) 0)
& t) s. {3 m+ h6 C$ h      (progn
5 K& E, ^0 U! `0 o        (setq ss (ssget "x" (list (cons 0 "VIEWPORT")/ t1 D& K+ n8 @3 z  N' q
                                  (cons 69 (getvar "CVPORT"))
( b8 J/ K: u* F3 `  X( \# g- y                            )$ U* I' @, I4 X. _
                 )
) l' I5 L9 _; F, P4 t        )     
1 x- J% x! J1 v. K; r        (setq cvpname (ssname ss 0))" |& H5 J$ R. Q
        (setq xdlist (assoc -3 (entget cvpname '("acad"))))$ ~8 a3 E8 Z0 \0 q
        (setq vpldata (cdadr xdlist))! E, P: {) V. P3 @+ r
      )
# g6 J; Z( }, x4 v    )
2 m3 u. r( A! ?! T* m    (setq sortlist nil); o0 ^7 L5 }( G: i! |: L
    (setq templist (tblnext "LAYER" T)): i6 z  m, u' a4 v  }: `
    (while templist8 o, v+ a/ X+ C2 ^9 H9 j: ]5 }
      (setq name (cdr (assoc 2 templist)))# g1 M8 X! `# |, q
      (setq sortlist (cons name sortlist))
+ D; b7 X/ M. e; S. P      (setq templist (tblnext "LAYER"))
$ _9 z* R. X9 t0 m1 Z    )
2 ?. E9 s. z9 X6 j6 c5 f0 v    (if (>= (getvar "maxsort") (length sortlist))
: N- @# H3 m) R. }2 u      (setq sortlist (acad_strlsort sortlist))
7 P4 G+ T  d9 `& C! V, Q7 O, y7 x, ]      (setq sortlist (reverse sortlist))8 e7 s6 O1 q! @9 t  g: C0 Z4 C) E
    )
  m0 _9 `7 ?; A    (setq laynmlst sortlist)
) w4 ]! U! t/ j+ n    (setq longlist nil)! g$ p5 U0 P: w+ R
    (setq layname (car sortlist))
- n. _2 w$ x. B. I  m    (while layname
/ A9 v( P7 R2 k- I5 j: o- J$ J      (setq laylist (tblsearch "LAYER" layname))
: V& \& K8 E8 b* X      (setq color (cdr (assoc 62 laylist)))2 T+ n# }3 ]; r! t3 }
      (if (minusp color)
7 P' [6 u6 B( S9 l- V        (setq onoff ".")
- a2 h5 S: {* I4 E* Q$ m2 F5 h        (setq onoff "On")
) h" L1 u0 p& O: a, I2 w      )
# ^4 [1 H8 ]3 }3 h0 X      (setq color (abs color))
% ~5 {: v( J: p$ }8 v/ h8 T      (setq colname (colorname color))
, @' r, b4 d, N7 w      (setq bit-70 (cdr (assoc 70 laylist)))7 G# g2 _" `9 b/ O
      (if (= (logand bit-70 1) 1)3 J4 D4 Q9 j/ `2 }6 u0 J
        (setq frozth "F" fchk laylist)7 C3 ^# j" K/ ~5 R
        (setq frozth ".")$ `% W% H) f( W# F* r  o# q
      )
5 `( X7 t3 Z/ Q. y) z" r      (if (= (logand bit-70 2) 2)3 h5 V$ `* n4 B7 |1 F" {5 Y) S! U% u! `
        (setq vpn "N")
- b" F% X/ u( H" J' X9 i        (setq vpn ".")
8 O' g& w! P  U% |( e      ). w  `6 _2 ?7 L( V& O- ~2 X7 `
      (if (= (logand bit-70 4) 4)) Y) ^7 q- m+ q. c# D
        (setq lock "L")+ U: ^  y6 x) i) N1 W
        (setq lock ".")
9 p, v, o- l  e1 w' i% ]$ x$ F: L      )
6 K3 ^4 ~, o$ o6 p9 L) B2 E) G      (setq linetype (cdr (assoc 6 laylist)))
: Q, L* A& f" k9 X) H8 u      (setq layname (substr layname 1 31))
* @( {! G0 b, T! @      (if (= tilemode 0); f% s" u% s# f6 D$ n
        (progn
7 R( X; c% u" G. ~          (if (member (cons 1003 layname) vpldata)
' Z2 Z0 V5 p3 j5 h6 E; k            (setq vpf "C")2 B. w( o6 H1 x. w& X
            (setq vpf ".")2 t) C6 @" a! ?% z  _: R) P+ {  ^3 H
          )
- L, W! `# a; U3 h        )" K  N8 X  W3 Z: d/ v' B6 E
        (setq vpf ".")
8 g0 z/ P0 L9 _      )
( W; \; _' D5 g& [      (setq ltabstr (strcat layname "\t"
$ Z7 `) |% {) D                              onoff "\t"3 k8 j. N5 g* @$ z- [; ?
                             frozth "\t"
( p% P8 L: Q5 L$ Q8 M9 M                               lock "\t"
2 F( E0 S! [; c) ?                                vpf "\t"
2 q8 A. l  y* f2 ]+ I" Z                                vpn "\t"
# D, t7 K* {% r, @$ E0 O+ Y% d4 o4 T                            colname "\t"
0 P' R3 u. _( A' ]8 k& D2 ]                           linetype, O! X& k4 |/ w4 I0 q9 ]1 u
                    )9 _. U! d: D9 G1 s5 C7 |
      )2 j+ _0 R. Q, j& I3 e
      (setq longlist (append longlist (list ltabstr)))* W' U/ x( I) V& l. _% J. [# k
      (setq sortlist (cdr sortlist))
% m8 I. }8 v- u9 N- l# D% S' [      (setq layname (car sortlist))) }5 z& J% W) S
    )! g$ q; h5 C2 s  z6 E
  )
. f0 z2 v5 u. l* v  ;;+ {/ b5 f- V" T. o0 j
  ;; This function makes 2 lists - ltnmlst & mdashlist.  Ltnmlst is a list of
8 l! y8 X1 E0 `4 q0 O# p. Y* e  ;; linetype names read from the symbol table.  Mdashlist is list consisting ' T$ R% h4 }" i+ l* h) F' C: u
  ;; of lists which define the linetype pattern - numbers that indicate dots, & i* y& |2 l9 A1 e- I+ y
  ;; dashes, and spaces taken from group code 49.  The list corresponds to the
7 j$ e" ]' ?$ ^- o7 u& Q6 n; v- c  ;; order of names in ltnmlst.
% x/ @" k2 c, c4 n) }! ~  ;;, {4 T+ ^- [/ W8 {
  (defun makeltlists (/ ltlist ltname)
) _$ ^5 ]3 y8 o    (setq mdashlist nil)
3 |1 u  e- Y, v$ a( s. }    (setq ltlist (tblnext "LTYPE" T))
: c7 Z1 H& l& k) e    (setq ltname (cdr (assoc 2 ltlist)))- j3 t9 `  s) ~& q! `" f
    (setq ltnmlst (list ltname))
* W4 b0 T- ~) t  ^3 N1 G" G
% Q9 N% M! w6 J- o    (if (= ltname "CONTINUOUS")
% N0 y" Z% q( m7 |( F7 W3 Q" T; k      (setq mdashlist (list "CONT"))
! `5 z& d5 _- ^* q' m+ K- V; e      (setq mdashlist ! Q/ G+ A: t4 i) }/ W6 q. Y
            (append mdashlist (list (add-mdash ltlist)))
8 e7 B, ]+ r0 F" ]      )2 g. M! q6 X2 ]9 s3 d2 Z9 P% D
    )
4 X1 T( r: ~$ `0 A, z* I' H    (while (setq ltlist (tblnext "LTYPE"))
2 o% N" z1 ?9 h9 x           (setq ltname (cdr (assoc 2 ltlist)))
, z8 n0 P6 m( u# b           (setq ltnmlst (append ltnmlst (list ltname)))
4 u" o& l; u5 S' M5 o; P           (setq mdashlist $ {& ^' {% \" T2 N* B" J
                (append mdashlist (list (add-mdash ltlist)))% e+ @' b) k( d) G* e
           )
: B6 P: B7 S- ^( S* {( |% z; m4 b    )
% {+ O* F) `  ~; }' `    (setq ltnmlst (cons "BYBLOCK" ltnmlst))
; J( x* C  n% W/ p" P  L    (setq mdashlist  (cons nil mdashlist))
7 r' I8 g/ L: H9 d9 L& g$ x, |& i    (setq ltnmlst (cons "BYLAYER" ltnmlst))4 ^! O" C& i+ S- E) o' J- A
    (setq mdashlist  (cons nil mdashlist))
& ~1 }7 r  ~  @, _; K  )6 W' P8 C+ Q9 M( G* @9 ?
  ;;
0 k+ [" P  M8 U  ;; Get all the group code 49 values for a linetype and put them in a list 2 j5 _7 u4 Q  @6 T# R& ^  }
  ;; (pen-up, pen-down info)  i& L! L* Q4 i+ E
  ;;
/ t: o2 P* i' @- t) W' C  (defun add-mdash (ltlist1 / dashlist assoclist dashsize)2 d; o+ f5 J* L; C
    (setq dashlist nil)
3 ]* R: T9 Y2 P* c" ]- A    (while (setq assoclist (car ltlist1))" ]0 u' U8 G) K9 z, @( w+ F2 K' u
      (if (= (car assoclist) 49)
- a; I' Z9 t* E) Y) {" s% W) j) g        (progn
5 o- t6 Q% U! k, {/ ]% C* o0 c- z8 p          (setq dashsize (cdr assoclist))
0 e. O  [. b, R          (setq dashlist (cons dashsize dashlist))
+ T& @# s) ?$ ]9 M# N. T9 h        )) F" Z, L% n' x8 p; a5 f. r8 t
      )
0 ?* L7 I& e9 U& W      (setq ltlist1 (cdr ltlist1))
1 `# {5 O& v8 i  x* C    )9 T% `" d$ R  R- _/ Q) p0 T4 z
    (setq dashlist (reverse dashlist)), e; M7 O+ y- P$ v7 e; f9 X* ]
  )
1 q: e& e9 j5 r# g9 j  ;;
& L5 V3 r. }- [% H  ;; Color a tile, draw linetype, and draw a border around it, `1 k+ X/ \, [3 U) g! x( h
  ;;
4 C1 _1 e, d4 M7 ?8 c& P  (defun col_tile (tile color patlist / x y)
' z/ f) q4 u. r  m    (setq x (dimx_tile tile))
0 B" [+ C7 z# S' S- e6 q3 }    (setq y (dimy_tile tile))1 o0 e9 ]" @# b/ G4 O
    (start_image tile)( B) a- D9 j  U2 T8 ?  |" ~$ E
    (fill_image 0 0 x y color)& |% ?# o: Y4 }0 e
    (if (= color 7), h- z, s* `/ v8 ^. |& [
      (progn8 R1 J# b; f; N! y' ?
        (if patlist (drawpattern x (/ y 2) patlist 0))0 J# p+ V6 q7 ]
        (tile_rect 0 0 x y 0)
* |2 ?* M3 z+ A4 g& U' C& e      )
5 m! R3 ?+ Q4 J) A$ I      (progn% G2 o& `% `( e4 `" L
        (if patlist (drawpattern x (/ y 2) patlist 7))
7 E) C8 H; Y  M        (tile_rect 0 0 x y 7)- M7 ]4 I7 {9 d( g' Z7 q* p& A" N3 K
      ), O) m2 I0 t  K1 j0 _
    )
- T- t8 X3 m- F$ ?" D8 j% Q    (end_image)" d; [: R, V6 |9 W
  )
* y  f( ]2 P$ l. f9 M& {- l  ;;
  D3 r. r/ }. M. x8 x2 H+ q  ;; Draw a border around a tile7 j# M+ J& U8 \7 H3 y) x
  ;;
, q! p$ Y1 ^  k  (defun tile_rect (x1 y1 x2 y2 color)6 V& M+ _* g5 d9 d
    (setq x2 (- x2 1))
1 a. Z8 c$ b  h: E. v    (setq y2 (- y2 1))
& O* E% Q% z, }    (vector_image x1 y1 x2 y1 color)6 w2 R% L$ I! v" S  V9 p, {$ o) l
    (vector_image x2 y1 x2 y2 color)
# i" n) H% m# A' y5 @    (vector_image x2 y2 x1 y2 color)
: Z% Z* G6 }. C  p    (vector_image x1 y2 x1 y1 color)# W  \; P0 V7 T7 y5 J1 ^
  )
- [# e. U9 Q& l7 r+ Q  ;;3 N; B5 R* w$ W
  ;; Draw the linetype pattern in a tile.  Boxlength is the length of the image
# x0 F1 g' x0 i+ Q  t  ;; tile, y2 is the midpoint of the height of the image tile, pattern is a & |$ o) f: @2 R- s
  ;; list of numbers that define the linetype, and color is the color of the
6 N- B# {. f6 R' V; q  ;; tile.
. X' U- J, w- W5 a  q$ a  ;;" s' I. `1 w' a2 `: C  @' X
  (defun drawpattern (boxlength y2 pattern color / x1 x2
. O& ?/ H. [* w6 Y9 K                      patlist dash)) p! [8 X" C* A- z( L' v
    (setq x1 0 x2 0)
  V0 |3 O: X$ f& v) h5 W( @    (setq patlist pattern), X! d. C! g! b8 o9 z; V3 M' O
    (if (= patlist "CONT")  V3 ]7 j7 d5 r+ N( Y) W
      (progn 2 ~, j8 I3 y( x9 u
        (setq dash boxlength)3 g% w4 a+ u8 ?, ~" n$ G: O
        (vi)( U5 I" y, _8 ?9 c8 N0 \
        (setq x1 boxlength)
- P4 \) m% \/ B4 s      )
! H  T6 ^( h9 ?0 D% H    )& q1 ^( H) V- \7 J! n" l: J3 ^$ a! Q
    (while (< x1 boxlength)( G, K- [' m; C
      (if (setq dash (car patlist))
" z# B" y" x: H        (progn* m% p+ o& D% K3 f1 y& `
          (setq dash (fix (* 30 dash)))) |3 s- m  G3 |1 j
          (cond 5 _5 R& H3 ]. G8 ^9 e
            ((= dash 0) & q6 A; k% ~9 O) B# R7 t% s
              (setq dash 1)
( C2 {# J  k4 z/ j% U$ t, w8 C$ Q              (vi)
! m. p: ?, I' f  k  P! z. S" w            )
- S# ]) t3 ~0 I7 i            ((> dash 0) # t% W! ?% L7 q
              (vi), d. ~2 H. y& S) Q3 Z  O! j
            )
7 |6 d" k. e! {3 ^* [! _4 t            (T
1 x( I5 h, u. W: N# R- E              (if (< (abs dash) 2) (setq dash 2))1 u2 f4 w! Z7 p* A
              (setq x2 (+ x2 (abs dash)))
' A+ I( o# l+ w  n& p            )- H$ o6 N: G0 T; Z9 I  c
          )
+ Y1 e7 ~" z, l1 u, K          (setq patlist (cdr patlist))
# a; y9 ^) T( p) p          (setq x1 x2)5 ]7 b+ O& @& \" V0 A5 t: _3 j
        )( S  |6 [) H+ k/ {
        (setq patlist pattern)
4 |5 a! o* z- u0 {3 E/ X' X, j      )
4 M; C" u1 ~; Y, J- M    )
0 v4 T( H: b6 F  )
( U/ U+ I& ]- U- x0 Q! H  ;;4 Q! _/ L5 h4 t
  ;; Draw a dash or dot in image tile
5 P8 d5 C: N* x. _  ;;  v, A+ v# v9 F# W& z8 V3 b$ ^
  (defun vi ()
# R" \, O4 G" _( x7 n    (setq x2 (+ x2 dash))8 c) s! A8 e, p" t# u% i, W" P2 G
    (vector_image x1 y2 x2 y2 color)
2 o5 p3 C) [) L- `  )9 r* A/ g% Q6 b* b9 w2 ^/ ^, L
  ;;( N3 ?( L! k& k3 N% `1 L
  ;; This function takes a selection and returns a list of the color, linetype,
7 d& M5 L9 i# p0 M" [4 n8 A  ;; layer, and thickness properties that are common to every entities in the, Z* V* M: l8 s* {, `0 u7 ~3 y
  ;; selection set - (color linetype layer thickness).  If all entities do not
9 {9 g+ t+ E  _1 A5 C* V5 ?+ }  ;; share the same property value it returns "Varies" in place of the
: b2 w+ F# Y8 }8 O* ?+ C2 F+ _* n  ;; property value.  i.e. ("BYLAYER" "DASHED" "Varies" 0)
& e7 ?7 X1 Q' u  ;;
0 L7 i# K1 k& e4 Q4 y+ r  (defun getprops (selset / sslen elist color ltype layer
4 `5 u% t9 R3 ~5 g& Z0 w( l3 K                            thickness go chk-col chk-lt chk-lay chk-th ctr)! d1 X4 S) @4 ~
    (setq sslen (sslength selset)). z. g% y( P: g9 G2 O( X5 B) C0 S
    (setq elist (entget (ssname selset 0)))
; V/ g; l+ x4 b! }9 F    (setq color (cdr (assoc 62 elist))). m, Q  f- V6 J  b, y  }/ D. P
    (if (not color) (setq color 256))
  h# V5 U* `$ ?- |& o/ m% `    (setq ltype (cdr (assoc 6 elist)))
4 R2 H4 y( ~5 S/ j2 T    (if (not ltype) (setq ltype "BYLAYER"))
6 B3 ]" F  ^0 ^; ]    (setq layer (cdr (assoc 8 elist)))
: s9 _9 ]6 @4 ~4 q- o    (setq thickness (cdr (assoc 39 elist)))% A( V2 N' ~5 n9 i% F0 a1 [! h, y
    (if (not thickness) (setq thickness 0))
& f( g/ a' A- e3 G8 ]    (setq go T chk-col T chk-lt T chk-lay T chk-th T ctr 1)6 U1 `, y4 u+ Q3 ^3 p

1 F* e" E6 E& P' J! K& v    ;; Page through the selection set.  When a property
4 }3 B  O3 `+ ?    ;; does not match, stop checking for that property.
  h  A; a; ?- X( y# U    ;; If all properties vary, stop paging.& E1 |+ |( Q' ~, j, J) E

% r# n* c/ s8 q% g    (while (and (> sslen ctr) go)
2 @5 T. W+ h$ \% \$ i+ `      (setq elist (entget (setq en (ssname selset ctr))))
3 m% q$ p1 M) ?      (if chk-col (match-col)). a% I5 T2 d6 o' ]8 ?. }$ m
      (if chk-lt (match-lt))2 p2 w2 W4 B, o# K
      (if chk-lay (match-lay))
  e( a6 T+ c8 J% c  {5 a/ H      (if chk-th (match-th))0 R* Z. m& t  U0 x4 q
      (setq ctr (1+ ctr))5 R/ ^: o2 H1 Q
      (if (and (not chk-col) (not chk-lt) (not chk-lay) (not chk-th)), M% F9 l+ d9 j4 {. G1 ~4 T
        (setq go nil)$ z$ z0 @! s- d
      )6 U; v! h, X% e# o
    ); W  w, u0 K8 l* T
    (list color ltype layer thickness)
; \* l3 C2 M) C4 h  )
# p+ m* a- [7 c9 ~% Z
- @/ o8 F! U! K" N0 k0 x; ~+ Y  (defun match-col (/ ncolor)
, B* O" x7 }/ O$ g  N9 Y# I    (setq ncolor (cdr (assoc 62 elist)))
, D$ ~) s. U. B1 j; d/ G/ {    (if (not ncolor) (setq ncolor 256))1 M6 Q6 H% s* s
    (if (/= color ncolor)
, D6 H; Q4 b0 O4 H6 Z7 j) A      (progn% j# i* q7 C* i* j4 [/ t
        (setq chk-col nil)& {" q2 \: G! Y
        (setq color nil)
' }; Y/ x" D6 N0 L5 j. ^3 S, O* H      )
2 J$ ^; ?) c' H    )" E+ e  q2 k) I$ s$ p
  )" z- n" u/ A; a+ J
" |8 q! i/ r1 ~) K
  (defun match-lt (/ nltype)
0 S2 @) }2 |/ t+ M  G+ V    (setq nltype (cdr (assoc 6 elist)))
: I6 A: j( b/ H4 p1 Y    (if (not nltype) (setq nltype "BYLAYER"))" G  Q0 W: `% S! T, {/ C
    (if (/= ltype nltype)
5 _0 J& ^( w! s- A( w& \# Z      (progn
% I; c4 ?# v& @9 z" ]1 p        (setq chk-lt nil)
( i' d( _( v* c( z- q9 M        (setq ltype "Varies")
, n0 X0 Q& a) I9 S+ h9 H      )
  \2 x! _% E3 s2 P  I* q8 r    )0 B: E0 U) e% U' b( g) J2 Z3 F
  )
/ J' w, y% t6 ]" U& J* C' a0 P& s; p5 z. p5 _
  (defun match-lay (/ nlayer)$ g! f: `' E% }1 I7 \' p8 E  X
    (setq nlayer (cdr (assoc 8 elist)))1 p4 ]9 h; n1 q% h, V5 M6 E; h' W
    (if (/= layer nlayer)8 Y; \0 t" y/ I' G
      (progn
9 b/ C9 I6 s# A        (setq chk-lay nil)
$ W- W( M5 G9 J" U- j+ F6 B. c        (setq layer "Varies")( B1 d' _- Q# i: g5 f. q
      )- x$ h' y% Q1 I; N; N
    )/ @0 P# H, i$ z* N
  )
. A/ A+ J( k( J7 {7 i. |
6 J; O9 ]: O$ [9 C, m  (defun match-th (/ nthickness)
8 i8 U! w; c7 f5 x4 _  u    (setq nthickness (cdr (assoc 39 elist)))
. y  j, R$ }: v' M    (if (not nthickness) (setq nthickness 0))
0 j* s3 K2 f. W& G8 d0 Z3 ]    (if (/= thickness nthickness)
- p# ~) l% N% ]' p% x1 G  q      (progn1 Y  c# @6 u5 j
        (setq chk-th nil)
8 a7 D& E* B  Q7 J3 b1 g" }8 V        (setq thickness "Varies")0 z3 ]% [) b1 m- c  h2 d& `% f
      )
3 k! A+ x$ Y5 d: V    )! z7 E5 \! T/ F$ F
  )2 \5 G% T. Y% ?$ B9 u
) T3 T8 U$ `0 x0 T3 m3 C
  ;;8 C5 Y, |6 ?; c! B; x1 z
  ;; If an item is a member of the list, then return its index number, else
" m, ~0 u5 A! E2 S, ?) i2 r  n. `  ;; return nil.
) N2 D2 ?0 `% C8 y0 W3 L7 y  ;;9 L$ N" g& L* R& o( i' e
  (defun getindex (item itemlist / m n)2 [; w! |  U2 V' k$ U
    (setq n (length itemlist))' W( ?7 m) J" G' y+ g9 f6 O
    (if (> (setq m (length (member item itemlist))) 0)
, t6 ~8 |/ `& T        (- n m)
9 v' K$ _. l8 u0 k        nil
8 n# h: ?: w1 C' R6 X3 h! @    )4 s) U* N7 [! B7 f7 X6 p; s
  )( X: {4 [- E2 n% e0 H
  ;;
; X  e6 ~: s7 ?; ~( o  ;; This function is called if the linetype is set "BYLAYER". It finds the 6 q* E' \% e, n2 v2 u( Y& ]" G
  ;; ltype of the layer so it can be displayed beside the linetype button.
! f, A' _/ B/ M4 Y  ;;
. Q. ?+ k6 e! F& `) a* H! n: T  (defun bylayer_lt (/ layname layinfo ltype)
3 @7 @( l! }, f' t+ D3 B    (if lay-idx
. X' G7 E7 ^  H0 r1 P8 t* B      (progn
5 @- z& i, m  k, y' C6 P# I+ V        (setq layname (nth lay-idx laynmlst))1 l! K; [! P: H5 E2 M) k- h
        (setq layinfo (tblsearch "layer" layname))( W/ ~, S9 C6 s& h: S
        (setq ltype (cdr (assoc 6 layinfo)))2 R* R7 \" F7 o# {
        (strcat "BYLAYER (" ltype ")"). b* k- h+ o! J' N& X0 @
      )4 N% A) A, S! M, G' ~, B
      "BYLAYER"# ^" S1 D$ @3 q1 B: P5 Z
    )
# s, u% |, R4 B/ Z9 N5 Y$ g9 X  )  N: t. K7 O- a6 a8 L6 P" s
  ;;( F' X' [& o9 q* s9 p/ m# F# u
  ;; This function is called if the color is set "BYLAYER".  It finds the 4 k  ]& f) ?! Z3 K
  ;; color of the layer so it can be displayed  beside the color button.
6 @  w0 R1 S) a# e: d  ;;
  I, x. H: u9 Z# ^8 w1 R! Q2 ]/ l  (defun bylayer_col (/ layname layinfo color)7 D+ B2 W+ A9 ]
    (if lay-idx! [' O" Y4 j1 ~- q+ u4 B
      (progn
+ T" s+ a' Q9 ~: |( w9 Q1 p        (setq layname (nth lay-idx laynmlst))
2 Y1 u% \% I  |9 G( X: q        (setq layinfo (tblsearch "layer" layname))& a  H8 \' P+ v3 |9 O3 Z
        (setq color (abs (cdr (assoc 62 layinfo))))
) \# }$ i" \% I% ]- {        (setq cn color)( ?( A) H1 u( I6 a
        (strcat "BYLAYER (" (colorname color) ")"); {/ @: ~/ T7 w( k
      )( k1 \* U0 N, f1 p* n5 R$ ]  l
      (progn
8 n$ S% w, h1 P* T2 \        (setq cn 0)
6 @$ i: W1 h" L2 S5 |* H% q  t        "BYLAYER". a0 G. g% k/ f/ x, y% K
      )+ f! J" V- f1 ?# T
    )0 g/ M" I, y% V: R' s# [9 \8 |
  )
% \! X9 Z. M2 ~  I3 p/ M  ;;
3 a( g7 [5 C& [; F. g  ;; If there is no error message, then close the dialogue  m8 g+ t" o5 W; @. I# |
  ;;6 l( e+ t. q% x3 m/ A. `5 t. ^" j9 ?
  ;; If there is an error message, then set focus to the tile
5 P, q! |0 x4 v0 }6 K, \# U  ;; that's associated with the error message.. w6 g7 y/ }# D$ c' ~
  ;;4 ^* g/ |" k2 ^. W( b0 j# y3 c
  (defun test-ok ( / errtile)- R) G( M$ C" J, X
    (setq errtile (get_tile "error"))
& A, c$ v! T' H1 {; C    (cond" N$ W9 F4 f7 Y. D
      (  (= errtile "")
# e: m) Q! o. s         (done_dialog 1))* F1 E( {9 @1 B8 b% n/ b6 o
      (  (= errtile "Invalid thickness.")
8 M9 q1 ~; e" w) n         (mode_tile "eb_thickness" 2))
/ l) `5 ?1 d& Q- i) L    )! J+ c, j$ n- F4 `5 Z
  )
/ B4 z9 i' t3 f# p% ^  ;;7 i' s2 o$ X6 O; J
  ;; A color function used by getlayer.( Q  ~( }3 p3 @5 M) J' Z
  ;;* o; K% @: P4 |" x/ K+ Y
  (defun colorname (colnum)
2 B2 b( q; e3 H* Q6 }) P    (setq cn (abs colnum))  |( A9 s9 s. ^  `/ n) L
    (cond ((= cn 1) "red")
/ B3 D  a+ N7 P6 [9 X          ((= cn 2) "yellow")8 |4 r0 q  Q. x2 S+ c: P
          ((= cn 3) "green")
" y! m) j- T+ }8 Y) E+ r' }          ((= cn 4) "cyan")- N# a) n$ @( e! z# r
          ((= cn 5) "blue")
. n7 a0 M. y# m3 W2 w          ((= cn 6) "magenta")
5 ?& i- }8 F- m7 I, a          ((= cn 7) "white"); e5 {. F& u) u% ^& ?' f
          (T (itoa cn)). J5 L/ W" }  l3 m: `" O
    ), {" K/ R; @4 ]" g: \$ ^
  )3 g( r0 R$ O0 a* ^, A' @$ G# y
- ]# k5 I. a* N3 [1 J; {6 P7 N
;;; Construct layer and ltype lists and initialize all0 j8 a5 U+ O) f& `, v
;;; program variables:$ B2 K; o6 `2 ]2 k6 R2 b& E, [6 H9 [
2 Q" `2 G( Y) t
  (makelaylists)                     ; layer list - laynmlst3 |9 a8 B& K1 }6 r: a6 w! W
  (makeltlists)                      ; linetype lists - ltnmlst, mdashlist0 I- w3 f% b- ]$ E. E9 i. w7 W5 X
  ;; Find the property values of the selection set.# ?# m# u+ f/ `) J! _' ~
  ;; (getprops ss) returns a list of properties from6 k( P' x# M8 @: i4 t$ U
  ;; a selection set - (color ltype layer thickness).
+ n; ^2 g' x" }) f" D  B) ~/ v8 m, T, {  (setq proplist (getprops ss))
9 h7 {" N; l1 v9 U# |& \  (setq ecolor (car proplist))' h: J4 Q- I, S3 n1 A! z
  (setq eltype (cadr proplist))$ _% q7 e- q. v6 X
  (setq elayer (caddr proplist))) k! s7 P2 k1 d- L1 s; e. c/ d  N
  (setq ethickness (cadddr proplist))
# @2 A7 T! E4 o# t  ;; Find index of linetype, and layer lists0 F3 }; X0 Z& n/ K9 P9 p
  (cond  y# V3 X( \+ e- l- R( j/ C" s
    ((= eltype "Varies") (setq lt-idx nil))
& ?" P! p, Z% M! k1 `: o# r* m;   ((= eltype "BYLAYER") (setq lt-idx (getindex "BYLAYER" ltnmlst)))
" e# m7 v# s9 v8 x# `0 a6 G* D;   ((= eltype "BYBLOCK") (setq lt-idx (getindex "BYBLOCK" ltnmlst)))
% I  F( ~! |" U( N    (T (setq lt-idx (getindex eltype ltnmlst)))' P$ a- P! c" r. `& l- Q' a5 Q
  )
8 D# p2 j% m7 h2 t, f6 G( w  (if (= elayer "Varies"): _, n. _: j# d( ^$ K6 {) O# L, {
      (setq lay-idx nil), w- i$ _% k. u9 `# u
      (setq lay-idx (getindex elayer laynmlst))
% q, F9 g1 A# U& k  )
0 [! j1 T8 @2 z5 e  (if (= ethickness "Varies")! @$ t+ g' O$ ]# t9 w% L* b
      (setq ethickness nil)
3 _$ a" {% Q# _1 N# \- X( b  )
! t% R( K6 c( b1 \5 p3 c# s& J4 ^/ p
)   ; end (ddchprop_init)2 h$ _2 \8 ?/ J7 g- ?' [
$ ^+ @2 f& v9 {" v) }/ S
;;; (ddchprop_select)1 {( ]' ]) U$ k+ h  |% ^4 P
;;;  |9 E% z8 i3 d
;;; Aquires selection set for DDCHPROP, in one of three ways:$ E6 f. J4 ]: ^; w
;;;$ h5 v+ s7 g9 ]5 }+ W' n& t* H
;;;   1 - Autoselected.
, O$ ~( `6 v8 Y  f  ^( d$ T) R, D/ @;;;   2 - Prompted for.2 e" _7 j5 f* _7 s5 G( J9 R1 [- D  G4 C; I
;;;   3 - Passed as an argument in a call to (ddchprop <ss> )% J1 I6 S8 _4 W# f0 t
;;;
- {& D8 w- T" ~1 w5 ]! ~& o;;; The (ddchprop_select) function also sets the value of the( S; U3 c( N# `1 {+ ^3 J
;;; global symbol AI_SELTYPE to one of the above three values to
- M! }. `9 m# M;;; indicate the method thru which the entity was aquired.- \3 y0 ]5 R# k3 p# B
7 \7 l$ a- b# V- \4 z4 X

, v! u9 r7 m) |. \# h/ h(defun ddchprop_select ()
- D: ?3 p  ?" H! \1 t   (cond! H- j5 d5 y! Q
      (  (and ss (eq (type ss) 'pickset))        ; selection set passed to
2 q6 ?# t4 L5 ?: k  w         (cond                                   ; (ddchprop) as argument3 j* E5 g6 s/ V
            (  (not (zerop (sslength ss)))       ;   If not empty, then6 j: s( z+ c4 Q4 y. E1 u6 t5 I
               (setq ai_seltype 3)               ;   then return pickset.
8 n* ^3 V* v, I0 e; N" U               (ai_return ss))))! `6 n6 [' T" d+ [

0 D0 [4 y$ _% C, \- ?) R- h& E      (  (ai_aselect))                          ; Use current selection
, l: {* c$ X0 E$ E/ o$ O                                                ; set or prompt for objects
. w0 e% f5 {" w+ C% T. L, W8 Q7 G; a+ ^, D+ S4 _* p. G
      (t (princ "\nNothing selected.")  j/ `% ~; X5 C. Z' ?) F( L/ r  W2 s
         (ai_return nil))+ ~6 r0 z; w( {
   )
3 J2 W8 C. X6 h5 `5 E)" T3 `: c5 e5 A1 ?8 C! R# S

2 m. R3 _: g* I/ k8 ?/ o8 `;;; Define command function.9 e" ^1 [0 H9 k1 S
5 Z! A6 i+ G0 e6 B. l' E( {
(defun C:CH ()
! e/ v3 e; {, E: p   (ddchprop nil)8 r6 ]' j$ g( b
   (princ)5 U. b' [2 \" f- v2 {1 p
). ~( [6 }. R6 p# W7 B( D
. A. U! s. }# H) a- s* s6 }" C
6 |7 O+ O- }" {" o; C) i6 y! ^3 [! I7 y
;;; Main program function - callable as a subroutine./ `9 @+ d4 K& T7 D5 r' ~
;;;: L, u8 I2 P' d
;;; (ddchprop <pickset> )
# ~, @7 Q6 @9 F4 B. C' d) \;;;. u/ D  n" v3 \' C" Y" S) i
;;; <pickset> is the selection set of objects to be changed.
  B. T6 j, w7 N( O1 v- A& |+ p1 g;;;
7 H! y+ U# I! y# o& L4 V;;; If <pickset> is nil, then the current selection set is
2 G& M' d0 z* ^; J6 x0 P; C. ^;;; aquired, if one exists.  Otherwise, the user is prompted1 a4 U- S# L8 S. W2 s. w' _1 @
;;; to select the objects to be changed.
7 S7 l7 D3 k# l- K3 t8 |;;;& ^6 h9 L! C  [
;;; Before (ddchprop) can be called as a subroutine, it must! X4 w& F0 z' G$ C( `) J& W1 P
;;; be loaded first.  It is up to the calling application to7 V# x( x5 X0 A2 j( A
;;; first determine this, and load it if necessary.
2 T1 @& |. Z- w, d' M7 F) M. B8 w9 h
(defun ddchprop (ss  /
( T$ X4 r. M" X5 r6 [8 N$ \
. H$ ^  {' d! G# t  ~                  add-mdash      ecolor          ltedit_act      s3 P* B! z* y. W% l+ N6 [
                  assoclist      elayer          ltidx           selset# s9 Q" A) @( [5 m% x7 \
                  bit-70         elist           ltlist          set_col_tile& T  s2 A; t# ]* b8 k8 e+ h
                  boxlength      eltype          ltlist1  y! ~, X  e9 s
                  bylayer-lt     en              ltlist_act      sortlist% O7 y& Y7 t3 {* m# e9 \
                  bylayer_col    ethickness      ltname
1 i' y3 Z" [$ k: G. j" ]& A  t% ^) J; E                  bylayer_lt     fchk            ltnmlst         sslen0 s8 D& R$ Z1 j5 |4 g% `% s
                  call_chp       frozth          ltvalue         templist
; O  B  X, e! u, }' M                  chk-col        getcolor        ltype           temp_color
# H# T( n! z4 b                  chk-lay        getindex        m               test-ok6 F4 j# C! q4 {  O7 b/ n. A
                  chk-lt         getlayer        makelaylists    testidx
& _: X) {" w& l' x7 A2 n                  chk-th         getltype        makeltlists     testlay
0 x8 B  B6 X2 G7 Z, K! `                  cmd            getprops        match-col       th-value5 U* s. S9 W8 x5 T. n# y1 E" h! b
                  cmdecho        getthickness    match-in        thickness
1 |4 Y; K5 ]3 s" _2 Z0 U                  cn             globals         match-lay       tile
3 g4 m; t. t1 J5 O6 O                  cnum           go              match-lt        tilemode
7 E' O$ s6 O# R  l. v2 Z                  col-idx        index           match-th        tile_rect
5 g4 I9 m0 F0 X3 P                  colname        item            match_col       vi
. u; n& l  w+ _5 b! C                  colnum         item1           mdashlist       vpf( j( H: p/ v9 a2 L2 \8 N' S, b' w' x
                  color          item2           n               vpldata
4 N, W# D7 U0 H  c& t( v, Q; f. S                  colorname      itemlist        name            vpn
# Q* e1 t; U  g! r) Z) ~                  col_def        lay-idx         ncolor          x! j# L0 Q- [! B( X7 E, _
                  col_tile       layedit_act     nlayer          x1" l' ]7 E' o0 x) o& X: |" U2 T
                  ctr            layer           nltype          x2
, f( ^; J6 t9 {' @- ~                  cvpname        layinfo         nthickness      xdlist
- z: e' n$ @% s& z: ?3 j  P                  dash           laylist         off             y9 [* a* H' _- w
                  dashdata       laylist_act     old-idx         y10 y: ], `* {5 g+ K% P
                  dashlist       layname         olderr          y2
  T( W, d8 m5 G8 e                  dashsize       laynmlst        on              undo_init
6 V/ V0 t0 B% z) [. m$ m% N                  dcl_id         layvalue        onoff
+ r2 z) ?* g4 q                                 linetype        patlist" U* z- m; W4 ~+ j
                  ddchprop-err   list1           pattern9 I4 a1 z* G6 Z' L" R
                  longlist       proplist, {, ]7 L( ~# c1 z
                  lt-idx         reset-lay/ G6 d. s! |2 Q0 E
                  drawpattern    ltabstr         reset-lt
8 z. W8 {, p0 X4 j9 m' D$ }                )& |* A+ \7 ~& b3 `, m

( g' @$ H8 p( n9 A  a) W  (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho1 h7 `% t! Q6 z8 |; \
        old_error  *error*            ; save current error function
& s3 `  m$ O+ x- e( k& Z8 i        *error* ai_error              ; new error function
/ G8 z4 }8 r$ a- c' v2 N  )0 B1 K/ Q. r! A

) V$ |1 w2 L4 i; g  (setvar "cmdecho" 0)# K+ b; ^; \$ M: z8 D( m  \
% P' f; }7 I1 Z# Q' N# T
  (cond
* [" y4 ^# L: P8 r9 c     (  (not (ai_notrans)))                      ; Not transparent?0 X( O' o& R" X( X3 x  ?4 G, q
     (  (not (ai_acadapp)))                      ; ACADAPP.EXP xloaded?7 l" V1 @+ m8 Z- f! {+ D
     (  (not (setq dcl_id (ai_dcl "ddchprop")))) ; is .DCL file loaded?
  u* |+ a4 N3 E/ z1 \9 n     (  (not (setq ss (ddchprop_select))))       ; objects to modify?2 G1 f* a, |/ h. d

4 N6 h0 W2 J1 m; k0 W) d, ^* a% ^     (t (ai_undo_push)( ]* }' L8 z1 j5 H5 `9 Z
        (ddchprop_init)                          ; Everything's cool,
* {, {$ S1 J, w* b. r        (call_chp)                               ; so proceed!1 T7 b- a6 N) _
        (ai_undo_pop)& X1 N/ U' a+ P% O$ O* u2 r
     )
: W' p  s, M2 \. [/ l- c  )2 z! Z6 m6 f: |* s! x# E
# K* v% g% |, ~2 x
  (setq *error* old_error) 3 b9 ^# M, y& ]: {4 P
  (setvar "cmdecho" old_cmd)
* Y* A4 @6 W) O  (princ)
. r3 Q8 b- K0 M% b: u" x)4 X. e  e6 ]- a7 |8 {

. `& F" E9 a: S% C0 T5 G;;;----------------------------------------------------------------------------, Z6 Z0 y, g! n/ p! k
# l* P* j/ r/ \9 v* z
(princ "   DDCHPROP loaded.")
8 V$ F9 O( [7 \/ B8 N1 a3 p" Q(princ)
: ~. E& F1 O4 ?- G2 e% _
& \* S0 Y) H3 z* Z9 @2 S" _;;;----------------------------------------------------------------------------
/ Y# ?' V8 `" ]7 t; F3 b6 m  p1 s8 ?4 W8 p6 f  H4 e6 h) T9 x
;--------------------------------ddmodify.lsp----------------------------------" J) V% T& ?! X/ @
; Next available MSG number is    1114 }5 y) t  ?4 W7 M  ]7 _
; MODULE_ID DDMODIFY_LSP_
( o2 B9 A7 g; \/ S' F;;;----------------------------------------------------------------------------
1 T7 V+ f5 |  X% b6 O% b;;;    DDMODIFY.LSP' b: k5 {% h7 T& s# M
;;;( a2 S% Y, b  Z3 z& h, {8 O
;;;    Copyright 1997 by Autodesk, Inc.
' e/ v1 U' e9 r;;;$ I# d3 S- w  ?+ X
;;;    Permission to use, copy, modify, and distribute this software
. b  O! o6 W- ^6 K5 y  X  L;;;    for any purpose and without fee is hereby granted, provided1 f6 ]6 H  r, C! r( G
;;;    that the above copyright notice appears in all copies and
% t/ R& j2 ]! x;;;    that both that copyright notice and the limited warranty and3 S6 b3 M7 L! u" L2 |; c
;;;    restricted rights notice below appear in all supporting( b' E$ g6 f, E% M9 w# K
;;;    documentation.
4 m4 \8 }8 W; k$ Y" V;;;
# K- }5 R% E) i! c8 o) Z;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
2 {1 }7 u- F& m+ Z$ O1 g0 e6 a;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF% u# R2 `# P  v' k3 w1 O
;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.% ^" Y# A1 M; ~' C; k: N
;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
$ s2 ]/ W$ S! T;;;    UNINTERRUPTED OR ERROR FREE.
9 h' d' p9 O- W4 q;;;) w" a0 O/ O  J1 P1 R6 {
;;;    Use, duplication, or disclosure by the U.S. Government is subject to0 ?2 G  {3 G- ~. X$ J% R
;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer7 B+ c7 D! G, }2 P" T
;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)* w: U9 B0 M/ O: }
;;;    (Rights in Technical Data and Computer Software), as applicable.
& n8 ?' @( N" z9 ~0 o( a" z& P) ]/ w;;;+ [2 E. H7 l+ L
;;;., \6 m* |) T( i6 V% W& V# J
;;;
  f& \( x: q/ m;;;----------------------------------------------------------------------------
/ Q( O" R7 G8 H4 E' j4 J6 b& b' P;;;   DESCRIPTION. i0 C7 y5 q- k* ?" z! \
;;;2 N! R9 c) h/ J0 Q7 ~; F% V" ^( U
;;;   This function allows the user to get a listing comparable to the LIST
" N8 J! c* w- i' I2 U. f# U;;;   command for most objects.  In addition, most object fields in the
7 j/ y) a! D6 z7 T3 R' b+ R1 S7 m;;;   dialogue box are editable.  Points can be specified dynamically by
. e7 g& |7 ^/ s1 c;;;   temporarily dismissing the dialogue box.  Each object has a unique( q: ~  u1 P3 z; L3 z  ?
;;;   dialogue.3 @6 g) ?. W  L
;;;+ j+ B  i  S8 C  {0 W* I2 `
;;;   Naming conventions; a( v; N/ P2 O
;;;   Long function and widget names may use an underscore "_"
/ ]7 t/ f/ D5 H) [* v;;;   in their names to make them easier to read, long variable
4 L3 Y' x0 }, y6 I;;;   names use a dash "-".
1 b  Y9 L2 T: q' Z- K;;;----------------------------------------------------------------------------" M/ y; G- S* S" l6 \9 v2 R
;;;----------------------------------------------------------------------------5 q# F5 N' v9 t; I' Z
;;;   Prefixes in command and keyword strings:
9 s0 F. v8 c# G8 o;;;      "."  specifies the built-in AutoCAD command in case it has been; i; Y  n: _4 l& b
;;;           redefined.# R+ o. `) l) y' i+ P) v( k
;;;      "_"  denotes an AutoCAD command or keyword in the native language
% S6 l, M1 c* k3 W6 x;;;           version, English.
7 H( ^  p6 u, n;;;----------------------------------------------------------------------------
- ?1 H, R7 d- o: v;;;
4 S% c" v4 Y1 Z$ c% K;;; Avoid (gc)s on load to improve load time.
& Q+ d6 N8 r/ z0 s, s;;;9 y/ z# n" z1 W; n6 ~* Y* X' _
(defun do_alloc (/ old_allod new_alloc)
' P  l3 n7 |4 `/ u5 e2 X# E$ p  (setq old_alloc (alloc 2000) new_alloc (alloc 2000))
" g" {' e7 @5 b$ g, V  (expand (1+ (/ 17000 new_alloc)))* \- v' V6 `7 S$ z$ Y7 N
  (alloc old_alloc)0 o9 ]( A$ a% H( X
)
& M5 _' _2 j* C& W(do_alloc)
) H1 X; B* D- j5 i2 [4 T(setq do_alloc nil)% o( k3 Z, E8 H# T1 `! e1 E
. M/ A  A$ `! g* n& b0 N5 W) \9 C
;;;
+ x2 P1 V0 b0 t6 H;;;6 w. V. k: R- ~
;;; ===========================================================================! e+ y2 U" [8 Q0 t4 {  K, f
;;; ===================== load-time error checking ============================3 `7 O: U+ ^0 y( l: s1 G; K
* N5 D/ t9 ]( W4 m, `2 `
  (defun ai_abort (app msg)
1 X. T2 `  _5 s6 x( b+ y' V" b: p     (defun *error* (s)
" [' G4 H1 J' h4 W( ~        (if old_error (setq *error* old_error))
% A* }; W5 _- c0 x: _9 ]  M        (princ)
, h0 Q/ P& l) D% `% p  w0 W     )
1 f  v/ S1 x* @4 s" ]3 o     (if msg6 k/ _4 [, f* m" x0 @6 e; h
       (alert (strcat " Application error: "
& Z/ R6 H; G2 I4 o' q                      app7 g) P/ @1 K1 P' N, S$ t& {1 X
                      " \n\n  "
/ y- Z" C$ ^. g8 P2 W- k3 N: y                      msg
) ]" C0 l& V: C) q4 A, g$ G                      "  \n"- {  c. @9 c5 M* |& b
              )* k# C. d' d4 e8 r' q% [
       ); s; s! y" l2 d' E0 M
     )
+ i5 i3 M( x5 c( i/ o- e3 K     (exit); Z, }* p/ M0 t3 S2 x
  )- r; `. \- t8 {7 @- I! f
% g5 B: z" E+ X
;;; Check to see if AI_UTILS is loaded, If not, try to find it,
6 g' i3 G( L; P1 @- V) G4 t/ R9 p;;; and then try to load it.  If it can't be found or can't be7 _2 a1 A5 E. k* u; q( ?  _/ D
;;; loaded, then abort the loading of this file immediately.
9 |, A; V+ E, W% U1 T% @+ s
9 T. {, `6 V' r2 P( P7 U1 d* A  (cond" D3 b6 U( d1 K' A  j
     (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.% I) _) |: n' g- g) [) z

" X+ x7 T9 t- Q1 V$ o# X' a* F     (  (not (findfile "ai_utils.lsp"))                     ; find it
- h% |2 ~6 K+ \8 y$ P8 L0 n- i        (ai_abort "DDMODIFY"( w  {9 Z& U+ W1 {5 g2 _
                  (strcat "Can't locate file AI_UTILS.LSP."
9 _, E0 L, O6 R' E. n( q                          "\n Check support directory.")))
$ s, W( s( D& }
6 ~) M; J* k4 c2 O. H     (  (eq "failed" (load "ai_utils" "failed"))            ; load it# i1 {! I1 X" J8 a  Q- f
        (ai_abort "DDMODIFY" "Can't load file AI_UTILS.LSP"))
4 n5 o" g4 w! Q; u3 t% K6 _  )! }" r1 Z3 I) P- U7 B

3 L! `# y/ \1 s+ O0 H# r$ T;;; If we get this far, then AI_UTILS.LSP is loaded and it can% V5 x% f& ^6 L( T) q$ Q
;;; be assumed that all functions defined therein are available.
- h/ |" D* f+ W& s, t' m# U" G; o) e! Z% j: Z7 r# Z+ D: W
;;; Next, check to see if ACADAPP.EXP has been xloaded, and abort
& e9 t" V( I  c* @;;; if the file can't be found or xloaded.  Note that AI_ACADAPP
/ ^& o/ X9 [4 ~0 h;;; does not abort the running application itself (so that it can, y: L8 e" K# e1 W5 Q
;;; also be called from within the command without also stopping
3 d5 Y4 B% |; S;;; an AutoCAD command currently in progress).
% G3 n7 a9 ^+ n3 _( R9 j, M$ b4 K0 N3 F6 f9 _; p% u( E# W
  (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP$ Q; b" M/ O5 k- c2 N, t9 d
      (ai_abort "DDMODIFY" nil)        ; a Nil <msg> supresses% ~* Z8 e# x" N2 p6 }) s: @( a+ m
  )                                    ; ai_abort's alert box dialog." ]& H( p1 `/ A  w$ e+ [' P# Z

  `5 F* v  x& {8 ~  ];;; ==================== end load-time operations ===========================$ Z# q  V/ c+ L6 l% Z( e' A
* N  @& R5 P' S) ~$ p! N& Q& H" \% T5 F
;;; global variables' [6 M# r: F: j, A% h* c

$ D+ j; e- k- _- \) f(setq hatch-elist nil), w2 M* l3 g7 x$ Y. C% k1 {

0 A3 Y* R! C  u& _( t8 _3 [;;; If we get this far, both ai_utils.lsp and acadapp.exp are
2 I8 v8 n' i9 n- K5 W0 ]$ w;;; assumed to be available.
" R! C( _3 `7 T& R+ w, w, k9 o. o' a" q* I; |; W+ T7 q5 b3 f
;;; Define and encapsulate all subroutines that are declared& `0 l9 c' {2 C3 i; e
;;; locals of the (ddmodify) function.
7 m" W. m& s# D6 [8 z+ p$ t7 f% t$ P4 ^! U; ]9 Q
(defun ddmodify_init ()
  X5 n3 s  l- e" V: F  ;;
8 _! C$ d3 }$ F! E# v* A  ;; These three functions modify the enitity list for common properties.  Since
% a( }* b- T4 Y/ _0 M3 T4 v8 `  ;; color, ltype, and thickness are absent from the object list when they are- @6 O  W- b5 e7 F3 n$ U% q
  ;; set to their defaults (i.e. color = bylayer), a simple substitution using
8 s+ x' `; R% v" u& Z1 U  ;; SUBST is not possible.
3 Z! U+ O" {, h4 E- G  ;;+ Z! m5 }" w% h
  (defun modify_properties (): U3 o8 _0 o4 ]; k# z
    (emod ecolor 62)
8 @& V2 ?2 s4 H& C' P# Q% [    (emod eltype 6)
0 d2 R' X. V7 z    (emod ethickness 39)
' q9 a, j3 Z- J# X4 A5 L    (emod eltscale 48)( D9 n, A1 e6 V% r; H
    (tempmod elayer 8 nil)4 A0 L* s0 B) u
  )
& @! _. f  A$ F! e  ;;
2 b3 M# f) D6 {- O0 r' d  ;; This function is used for modifying common properties of the ACIS& h$ h. B0 ]$ E6 R7 B7 B
  ;; based geometry objects. Thickness is not valid for these objects" ^$ T: v- a- N' ?& f2 E
  ;; so it is left out., i6 e9 W; E$ W& m( m
  ;;
' z* Q/ |7 e0 o. J! Y- h  (defun modify_prop_geom ()/ ?  ^, s. ~2 O0 l, L/ L& C
    (emod ecolor 62)5 N9 Z( x3 ?, i& u6 I# u/ f5 c6 D
    (emod eltype 6)
. U+ I4 F% A$ w7 D. |7 ~    (emod eltscale 48)
  [+ ]! i& R# P  \( F. V    (tempmod elayer 8 nil)
5 `) @( g$ _9 j+ T% W+ |7 J  ): l6 Z! s( O, [4 q; Y, H  }# S
; N2 O, k* c) u1 R
  (defun emod (value bit)/ C' m# |9 i- U4 l. Q* {1 p
    (if (= bit 62)& G1 L# ~+ n- Q/ T
      (progn0 ]5 e) m7 E- F! g% M. ~! B
        (if (or (= value "BYLAYER")# L0 m, C9 L8 y7 W& ?- @
                (= value "BYLAYER")) (setq value 256))
3 z( h0 G- ~# T' B- M6 E+ f        (if (or (= value "BYBLOCK")
5 Y6 T4 x2 X2 y' g% W. ]                (= value "BYBLOCK")) (setq value 0))
8 l2 Q: q0 O; V+ t% j# [      )
. D* t- [' u/ Q& V, w3 O    )
4 {8 {2 U( D- x3 v$ o3 X3 _- h+ K    (if (setq oldlist (cdr (assoc bit elist)))
4 x* |1 c0 _  i) R6 u$ e) i7 o      (tempmod value bit nil)
6 G2 ^6 H$ p% j; n2 ]+ n  C      (setq elist (append elist (list (cons bit value))))
" K  P( G6 w5 b' `( m, Y    )
& n  s" J. q, |  f  )
7 M. g9 V9 ^: u$ ^  ;;
% ~9 N; B) y  c  ;; Resets object list to original values.  Called when the dialogue or% I8 e& @7 w4 |
  ;; function is cancelled.
1 f. ]* H: f5 t  ~) J9 G+ c8 G5 _+ @& m  ;;
) ]  ?, g# f3 h' c  (defun reset ()
2 i* ~0 G" y0 z, }& P% Q    (setq elist  old-elist$ I! H% G1 H) i, J: c+ {" ]
          ecolor (cdr (assoc 62 old-elist))
4 [+ x% }* c! p# ^% |          ethickness (cdr (assoc 39 old-elist))' N8 z' G& L! X9 m3 \
          eltype (cdr (assoc 6 old-elist))6 l) m) Y' M  f" w, E6 q) B
          elayer (cdr (assoc 8 old-elist))8 ^: D1 W' m7 m7 z
          eltscale (cdr (assoc 48 old-elist)); L7 O# L0 O4 ?
    )
  Y+ |# I7 f. \" r3 t( o    (if (not ecolor) (setq ecolor "BYLAYER"))4 r* ?- i) O+ o* U" L* w# G4 T
    (if (not eltype) (setq eltype "BYLAYER")). O+ m* L! H1 W+ x  b/ z
    (if (not ethickness) (setq ethickness 0))
. q8 T7 Y+ a5 A9 ]4 d7 }: v" E    (if (not eltscale) (setq eltscale 1))* I+ G& W' Z! K% g0 k% X
    (modify_properties)# X8 x- {) }' l) E$ n3 ?: h- K
    (setq reset_flag t)8 h  Y  a" w/ @6 ]
    (entmod elist)
) Z& v3 p9 P# K# Q7 b, r  )
( t% y+ [$ S/ u" y0 R* S  ;;
( F* b+ z* t7 A; J, x  ;; Modify object when dialogue is temporarily dismissed to reflect latest
' m9 ^# S1 x$ Z3 L$ C  ;; settings of dialogue.  It converts the point from current UCS coordinates to
$ ^* \, t$ |8 q, h" }" J! O) e6 w: h$ W  ;; the proper object coordinates (world or object).
) o' G4 F/ H( {! S8 J* e  ;;& |' [  h1 |% e/ N- ]9 ^3 [
  ;; Arguments: value - in current UCS coordinates
: a5 f7 X3 V" J! x; d  ;;            bit   - object code (i.e. 10 for start point)
- M  t# u0 L3 |5 \+ F  ;;            ptype - point type  0=world 1=planar% v  J0 Q( u1 r$ v
  ;;
) s, H- Z( @( s* N5 G0 p- ^. R0 {* l  (defun tempmod (value bit ptype / newpoint): I. U2 P, l) {2 x- k7 M" n! ^
    (cond
0 I3 U# v' T# C8 M: B      ((= ptype 1) (setq value (trans value 1 ename)))
7 w0 Q, s7 r+ @. c      ((= ptype 0) (setq value (trans value 1 0))). d" r8 z: \' u7 ^% r
    )* {) E) w7 W2 s* `
    (setq elist (subst (cons bit value)! {' z- z$ M0 k- D
                       (assoc bit elist)
1 Z$ n( Y2 u  w* J2 n- `                       elist! M! S% c( n7 E
                )
0 c9 ~7 O4 r- ~; m$ a0 x; w" y    ): k) H0 o0 i; c& j: S6 V
  )6 C) ?# H4 Y9 n, u! [4 w: Y
  ;;
2 c( p* d1 M% w  {' D  ;; The following functions are called after a dialogue has been temporarily1 e% u4 N2 x) U, Y: ?# ]8 h' x0 i
  ;; dismissed and the user is selecting a point.  If a point is selected the
7 q7 I/ H( V  Y% K9 _  ;; object list is modified and new X,Y,Z values set.  If no point is selected
7 }" W8 H" f4 u  z  ;; (null response), then the point is reset back to its previous values.8 J+ y" v9 Z" n+ c* q: ~2 y1 Q
  ;;7 w4 ]3 `# {# N
  (defun ver_pt1 (ptype)$ b) C1 k" z) B+ c+ m1 I
    (if pt10 q9 C4 q6 c5 `$ F6 C! q  v, B
      (progn( t; p2 t9 A' z  o1 _, X
        (tempmod pt1 10 ptype)2 s7 l( |4 ^9 K" e7 Q
        (entmod elist)
4 W9 U0 R9 A- W( N0 i      )
7 U! D$ v" Z4 }1 ^0 j2 m  X      (setq pt1 (list x1 y1 z1))0 a* j4 I* ^4 W
    )
8 M' s- p" o  D# _* W  )
2 X- L# A4 ~/ F, `* D
+ @+ Z, R& }4 t; c; Q& P  ; (move_pt1 <ptype> )
; ]2 R, J. t& @  F" X. Z  ;* `; {5 O% r! Q9 o: j
  ; Called in liew of (ver_pt1) to translate block insertions which
- e" F3 ?2 V; r  }2 S  ; might have variable attributes attached to them.  If the distance
7 C. l* [! `5 ]7 x" S# k( X% m  ; the block is to be moved is < 1e-6, the move is deferred./ `0 }1 ]1 `5 t& n* o, K. ?1 H

/ Y) F* n8 n- Y( k, Z  (defun move_pt1 (ptype / basept hi)
  C9 t# X+ o' F& N$ M) B9 n    (setq basept (trans (cdr (assoc 10 (entget ename))) ename 1))
" Z' h6 t5 d& |0 Z2 }1 A" `5 g    (cond
! m) d5 V+ @0 b: K       (  (not pt1)
% b, T9 n7 {3 e  @          (setq pt1 (list x1 y1 z1)))4 w3 _$ q% C& d/ _. S
$ A# A  E( l' J& \
       (  (> 1e-6 (distance pt1 basept)))
' n, }9 |8 t  o3 _# e
) g1 `" V6 b* h8 A& ^       (t (tempmod pt1 10 ptype)' \  S5 Y6 X: a' @* N5 H/ z( C: u
          (setq hi (getvar "highlight"))# z4 {' N. |6 o$ p5 d
          (setvar "highlight" 0)/ ~$ ]3 [  k/ m
          (command "._move" ename "" basept pt1)  h' [% V0 [1 T/ ~% A
          (setvar "highlight" hi))( @7 Z  h) Z; j2 t; m, K+ H* L8 F
    )
  M% x5 u) X1 a: J  )
0 G2 e$ m) I, j2 D% `' `
8 g" F3 p; M+ m6 }7 n  (defun ver_pt2 (ptype). ?% c5 Y! }( p6 X
    (if pt28 n8 u# L6 i5 F' e7 O" A/ X4 P
      (progn. j. ^- d# L0 g. Y
        (tempmod pt2 11 ptype)/ v9 X1 R9 [) `  F# N! B
        (entmod elist)
7 `1 I1 Q8 l) s0 {$ I: c0 A; d      )
  l. H5 b2 T' n. l/ l      (setq pt2 (list x2 y2 z2))! L' W% `( ~$ c7 H% f3 j9 \3 Y
    )
2 {% _# ~" r2 W' l. @; s0 a" B  )
. z7 x( h2 n8 k0 H! h* h. C* G. B. l7 d) O8 u2 d* U
  (defun ver_pt3 (ptype)! u  j9 y* V9 E) ?, W  n
    (if pt3( D. }( q! l9 z" w2 ~& e# ]
      (progn' I# ]3 D  m6 i& {5 \; X' G
        (tempmod pt3 12 ptype)
4 V7 ?! T/ _- `7 g5 h  \: I        (entmod elist)
( ]' w% @- t/ t; o" P      )" w/ Q6 W6 a* m" v( d/ K* N
      (setq pt3 (list x3 y3 z3))
1 `, X1 m6 @# K; K4 m+ l    )
) e6 s* E. [- |5 M  )1 J: Z! k5 z7 [) B) h! @
' y. @# X6 x" S8 c2 X
  (defun ver_pt4 (ptype)
: q* j1 {4 c3 j    (if pt4
4 {5 D7 C# b6 w5 a2 |1 l* x0 q      (progn
: n) _  ]9 }+ p, G5 Y* r        (tempmod pt4 13 ptype)
$ [" u2 e8 G/ X% e4 q; r$ {        (entmod elist); S9 U) _  B* w# n7 H1 V2 q. b
      )* Y* C/ N( Q& U  l& Q8 \
      (setq pt4 (list x4 y4 z4))- Y4 _! y/ ~8 ]4 \+ k* Z
    )
( a' P2 J- f6 i( S. b0 l" n% e  )
5 P$ K0 B' b7 C  ;; Xline/Ray6 \( z2 ~  v" @: S* v$ K) \
  (defun ver_xline_pt1()
3 x. A: m5 m  }( l9 |" K4 d    (if xline_pt1
" r7 a4 \! Q. G8 w      (progn  z2 ~& ~! Y! a
        ;; convert to WCS., h) H+ P+ l; G9 ]# Q& K$ m
        (setq value (trans xline_pt1 1 0))
0 P7 i4 p5 u6 p  g' i4 H        (setq elist (subst (cons 10 value)# q+ B+ ?2 |" G9 y; ?
                          (assoc 10 elist)1 b, H; j, T' d* n
                           elist5 J1 ]0 S9 a3 ^
                    )
: e6 d# F3 G* M0 @/ b" k        )3 s" G' C: C* _, Q& ^
      )" f- L. x; m% Y& [+ X2 D9 j, t( W, }& H
      (setq xline_pt1 (list xline_x1 xline_y1 xline_z1))
8 Y- I2 a$ K% ^/ K5 a    )
. Z* y7 L* w  g' i* g' s8 q; ]. l; Q  )( y5 ]$ _* s2 j& l2 G( U+ j

" Q1 r' G0 L, w+ w4 y6 p- o2 Y! H  (defun ver_xline_pt2()
) |, D1 j' l9 s8 ]7 f! K    (if xline_pt29 ~. X5 c. k5 p6 _  l! Q  V* h- j& ^
      (progn
4 }* V5 e$ Y8 k* g. b# `; K+ q# _    ;;, O% Z& `5 `3 b/ |3 s
    ;; Calculate new Direction Vector WCS
8 T2 b: H8 S/ {$ c/ ?, j    ;; x / (sqrt ( (x**2) + (y**2) + (z**2)     ))
: z& h. r# a: J7 q; g( }" f3 @- G    (setq temp_dir (trans xline_pt2 1 0))
% B5 C& u2 i# P4 T! A    (setq temp_dir_x (car temp_dir))  d8 J3 y% g9 R- o; f  \3 _
    (setq temp_dir_y (cadr temp_dir))
2 w5 R! i! d# B- o6 j/ R* j* [9 G    (setq temp_dir_z (caddr temp_dir))
& b' p+ i; g" K# R( S  t( Q" y/ t$ I0 r/ S
    (setq temp_xline_pt1 (trans xline_pt1 1 0))
5 I+ G* e. L* X, [( N% X8 s0 s    (setq temp_xline_x1 (car temp_xline_pt1))3 U9 t, S8 F" F) p
    (setq temp_xline_y1 (cadr temp_xline_pt1))
; h& |2 h+ K" Z7 g    (setq temp_xline_z1 (caddr temp_xline_pt1))8 I+ b- o, o5 D% c  w, M

8 w6 F8 z3 f, q9 w" c2 {; q    (setq denom (sqrt (+ (expt (- temp_dir_x temp_xline_x1) 2), T* G# {* t5 _2 T
                         (expt (- temp_dir_y temp_xline_y1) 2)
% ^5 K# }( ^1 [) h  [                         (expt (- temp_dir_z temp_xline_z1) 2)
& O+ _& \* B# H' M! r7 q/ j5 K    )))2 [( E$ t* W  i% d1 C0 Q$ f
    (setq temp_dir_x (/ (- temp_dir_x temp_xline_x1) denom))
: c, S3 G2 o9 X" O+ R9 N    (setq temp_dir_y (/ (- temp_dir_y temp_xline_y1) denom))
( t! w( a% h, b2 @    (setq temp_dir_z (/ (- temp_dir_z temp_xline_z1) denom))
' k  k  B4 L" q    (setq elist (subst (cons 11 (list temp_dir_x temp_dir_y temp_dir_z))
# S' Y# }- j$ [: N4 ^) K                       (assoc 11 elist)
, R/ G7 X: P$ ?5 {                       elist: P9 z6 ^) X' ?7 S  T
                )
8 A% N3 U! ?+ e1 G1 D1 T. Q    )8 A8 ~% }' d+ {% a  s
    (entmod elist)
0 A6 f. _- c2 E3 j; W        (setq xline_x2 (car xline_pt2))4 C8 i8 Z' ]7 f7 b/ }4 W
        (setq xline_y2 (cadr xline_pt2))3 `1 S- @) r  w- n& C: y7 m8 \
        (setq xline_z2 (caddr xline_pt2))* n! u# C4 I* _# x; ^& d
0 e. W- P& c5 e" X$ [2 V

1 F* j# C8 a( {& \% k      )
& Y' e- e( V, ]9 k1 O0 {  S1 c      (setq xline_pt2 (list xline_x2 xline_y2 xline_z2))
9 Y, C! t$ q1 B; B    )
% q- d2 q1 Q( M! a* D3 P  )
* N( a# F9 M. D$ W2 j, K/ L% ~
( ^. P! r7 O* B1 z0 A* ~  ;;* E& s3 J9 K- d- k5 G/ `& W
  ;; Common properties for all objects
, h3 W" N, T1 A$ Z  ;;
  R* i8 p, z4 x) D) G  (defun set_tile_props ()1 U$ g. }, K& ~( ^# H; Y
    (set_tile "error" "")4 b* h9 x" `0 X9 h# N) ^' B
    (setcolor)8 ]9 O1 F7 p3 B/ ?
    (cond+ k& C7 N9 s  d5 K. l' h2 j" K9 P
      ((= eltype "BYLAYER")
4 D7 L9 o! r. b! T: N! i         (set_tile "t_ltype" (bylayer_lt)))
- v, K6 f. b) w  h. P) h% n      ((= eltype "BYBLOCK")
. Y% a9 n6 d$ @         (set_tile "t_ltype" "BYBLOCK"))0 j1 L8 r' }- g; J; t" D3 c
      (T (set_tile "t_ltype" eltype))$ g% L' i: b7 i2 f
    )
4 R! b1 P* `' c8 W0 S    (set_tile "t_layer" elayer)
. Y5 a( {- v" t8 r) {+ {    (set_tile "eb_thickness" (ai_rtos ethickness))! D$ Y+ W8 ]2 @
    (set_tile "eb_ltscale" (ai_rtos eltscale))8 p0 Q5 x0 F) p; ?
    (setq which_tiles (ai_common_state etype)): v: x: G3 I  L$ f3 E
    ;; Disable tiles if need be...& C: E% k4 b' ?" q5 o

" d( |* f9 j0 v2 x' w    ;; Layer Button and Text Field  R0 I2 I. A1 M7 g* s
    (if (/= 1 (logand 1 which_tiles))7 g. E/ ]/ m; U, I" M+ J5 ^
      (progn5 c6 U) l- ~6 v% T
        (mode_tile "t_layer" 1)  C- h! v+ V, I* h2 l9 a& B" L
        (mode_tile "b_name" 1): s  @, \+ E8 ?- n) R6 q7 l
      )
' a" I% c+ d+ f) N/ p    )# R- K( o5 A2 \
    ;; Color Button and Text Field
- J& Y8 I8 ^2 q4 Y, h, q9 L* \    (if (/= 2 (logand 2 which_tiles)). `! F/ j% k; k7 b1 {
      (progn
6 @' p- _+ S. e0 A4 V        (mode_tile "t_color" 1)5 q1 ^& M( i/ w
        (mode_tile "b_color" 1)
8 p. V* j- q6 Q( q" T' c7 q        (mode_tile "show_image" 1)
' o! ?! V+ X3 u      )% q( L; c, @1 w* W/ N
    )1 X( k  l. _& X
    ;; Linetype Button and Text Field
4 L, e. U& `* A  t# ~# G2 t8 X; b    (if (/= 4 (logand 4 which_tiles))
, j& v- Z4 [. b, }      (progn$ \8 E4 e, P4 B' p% c4 o8 _
        (mode_tile "t_ltype" 1)
$ y: P* @/ i7 a6 a9 ^1 [        (mode_tile "b_line" 1)  `0 B7 j+ B; n6 Z$ w% [
      )
5 L8 g& b" N# k" c$ Z    ): C6 @" T6 |+ |6 @2 F; ]6 E
    ;; Linetype Scale Edit Field0 E3 m7 N: V9 S) }0 M
    (if (/= 8 (logand 8 which_tiles))
* D3 W+ }9 b* x, g) U+ Z2 `      (progn
/ @" C; N1 @. S7 |" a0 Z. y        (mode_tile "eb_ltscale" 1)
0 u& u4 w/ e. k4 v: f% y- i1 s      )# S) X, ]/ q' j: G7 ]
    )
/ F: H5 i9 W% X$ z+ q! i% K7 u, U9 o    ;; Thickness Edit Field.
. o' E2 s$ z. M3 B, ^% H- d( C$ F; Y0 y    (if (/= 16 (logand 16 which_tiles))
; U0 P. q' _% R3 M      (progn
! |& @' Y1 S- i3 d8 a! s        (mode_tile "eb_thickness" 1)/ u  ?4 ~" O% S
      )
9 y/ a4 n6 v. R% z, z  [    )! R6 Q" w: S' h0 Z. l4 m0 `
  )1 N; b1 ]& C. V, j  \8 U" c
  ;;0 k7 b. j2 e( h4 Q
  ;; XYZ Point values for all enitites" Y; e0 ]( b2 G( B5 @4 c
  ;;# [+ W$ {+ G0 x+ _! Q! s; k0 u
  (defun set_tile_pt1 (ptype)
, Y$ d9 h- J+ w- \6 \    (if (= ptype 0)* _8 ~& f5 F2 k/ m. Z
      (setq pt1 (trans (cdr (assoc 10 elist)) 0 1)), u  i( w* u1 a4 O: M
      (setq pt1 (trans (cdr (assoc 10 elist)) ename 1))
. N) L& e1 a% q: {' ~    )6 Q& X" _" H1 h1 n- j% d
    (set_tile "x1_pt" (ai_rtos (setq x1 (car pt1))))
% S" {' b6 f$ E' r+ z    (set_tile "y1_pt" (ai_rtos (setq y1 (cadr pt1))))' k+ n; D8 J/ |3 j
    (set_tile "z1_pt" (ai_rtos (setq z1 (caddr pt1))))
1 i' W1 R/ d! g+ K5 q- x4 \  )- T/ u  f# Z7 {$ q
  (defun set_tile_pt2 (ptype)
% z" }  q- [* v6 c* F- O    (if (= ptype 0)5 p- i1 U2 G! ~+ l; R
      (setq pt2 (trans (cdr (assoc 11 elist)) 0 1)): }5 a- Z. `: O, G# R
      (setq pt2 (trans (cdr (assoc 11 elist)) ename 1))
) s' M5 C7 N! _( T: g    )
& O- b; |$ H0 m2 J9 D    (set_tile "x2_pt" (ai_rtos (setq x2 (car pt2))))
9 X& R6 ?  T, |# K5 u    (set_tile "y2_pt" (ai_rtos (setq y2 (cadr pt2))))3 V$ w/ c2 F2 ~2 K' E0 B# C' b
    (set_tile "z2_pt" (ai_rtos (setq z2 (caddr pt2))))
+ `+ j: D5 A- [( U  )# k! _7 S8 U; \8 [2 }+ |
  (defun set_tile_pt3 (ptype)% x: S7 a" |, @" L
    (if (= ptype 0)
7 Z' g- r2 J! {" F      (setq pt3 (trans (cdr (assoc 12 elist)) 0 1))
7 {$ t9 C- H. F& W      (setq pt3 (trans (cdr (assoc 12 elist)) ename 1))
" `" s9 C. d% Z    )
+ ], S" M+ n8 g" M; t    (set_tile "x3_pt" (ai_rtos (setq x3 (car pt3))))
$ F; G8 a4 n* s/ i" |    (set_tile "y3_pt" (ai_rtos (setq y3 (cadr pt3))))
$ C* M0 ?$ s1 y% {    (set_tile "z3_pt" (ai_rtos (setq z3 (caddr pt3))))
! y5 h3 ~7 G' \8 m  )$ E5 r8 M" e6 a* d' J; N
  (defun set_tile_pt4 (ptype): a  ~( V% y% d0 e! H, w: p9 B1 R
    (if (= ptype 0)$ Q6 ?( N) S+ F8 h! K+ ?
      (setq pt4 (trans (cdr (assoc 13 elist)) 0 1))
' T8 b" p7 L5 i1 @1 R; l      (setq pt4 (trans (cdr (assoc 13 elist)) ename 1))# L6 ~' d/ i7 P7 O: B
    ): M6 y0 c0 O, J0 Z- z  h5 e
    (set_tile "x4_pt" (ai_rtos (setq x4 (car pt4))))
& \) L  p9 S3 M- o2 ]    (set_tile "y4_pt" (ai_rtos (setq y4 (cadr pt4))))
6 Z7 c8 t6 S" S( L4 u- G    (set_tile "z4_pt" (ai_rtos (setq z4 (caddr pt4))))
" c3 Y0 a9 B: Y% g" j  )+ v" u9 b" o1 D9 p2 g1 ~7 i
  ;;7 ^6 c4 n  s/ P4 ~# ^2 }0 o
  ;; Xline/Ray
" m  p' L# W4 a7 c  ;;
( o6 f: ~3 v) K. b  r  (defun set_tile_xline_pt1 ()  j* {; d+ O5 H  K, u; w
. |0 Y7 Z/ u" u( W
    (setq xline_pt1 (trans (cdr (assoc 10 elist)) 0 1))
) Q0 e4 X: T9 U% D. l; v- ~
: p- U3 A3 y. R    (set_tile "xline_x1" (ai_rtos (setq xline_x1 (car xline_pt1))))- a/ o' c6 I3 {" W; A8 R
    (set_tile "xline_y1" (ai_rtos (setq xline_y1 (cadr xline_pt1))))
8 U8 t% j' a, I! W    (set_tile "xline_z1" (ai_rtos (setq xline_z1 (caddr xline_pt1))))% I( }- }7 W! k! K
  )
$ ?4 W3 g( ~: _4 w3 O' [  v4 T  (defun set_tile_dirv ()
) {( F# A- w2 f) n        ;; Convert 11 group to local UCS (displacement)
' w$ z4 ]( A# l9 |. C# H/ N* ?( W) i    (setq dir_pt (trans (cdr (assoc 11 elist)) 0 1 1))+ p5 O6 p% |% {( k! u0 }

( @7 _) ?+ ^/ N4 t; @/ ^( _7 f6 }    (set_tile "dir_x" (rtos (setq dir_ptx (car dir_pt))))
2 J. g1 @1 A: |+ n/ e- U# U' k+ `    (set_tile "dir_y" (rtos (setq dir_pty (cadr dir_pt))))
5 N" _. V( Q# C    (set_tile "dir_z" (rtos (setq dir_ptz (caddr dir_pt)))), F3 i1 j# O# H: C5 d% w/ L% t
  )
2 N3 |, O; U7 v# j: \% d  (defun set_tile_xline_pt2 ()
$ j' M" r# T2 s" r    (if (not xline_pt2)
4 k. W: v+ n, B& d      ;; Initial second point is Root Point + Direction Vector  K  T. O! T& U$ _) A) l7 V, z# U) |( }
      (setq xline_pt2 (mapcar '+ xline_pt1 dir_pt))
: V0 N6 o$ j: ~: M7 o9 F( W" Y- c5 n    )! |' I* f3 q& M/ g4 W- E
    (set_tile "xline_x2" (ai_rtos (setq xline_x2 (car xline_pt2))))' K6 j7 A. I7 k
    (set_tile "xline_y2" (ai_rtos (setq xline_y2 (cadr xline_pt2))))! c  J6 @: o6 r' n
    (set_tile "xline_z2" (ai_rtos (setq xline_z2 (caddr xline_pt2))))% @# _1 ~+ c- q; }- O& K0 A
  )
5 M% A' U1 s8 E7 H2 F* o1 P
1 ~0 \, m2 u" I4 ~1 S$ p9 D; u  ;;
! A+ h6 g, K( D" B0 N  ;; Handle for all objects* @8 ~9 E8 M# U# k8 _7 m
  ;;
5 s8 `6 t" x. @4 D. d" E  (defun set_tile_handle (), k( s1 R. Z$ T- v
    (if (setq hand (cdr (assoc 5 elist)))
/ H4 G7 q; J6 O$ h7 d3 \& k      (set_tile "Handle" hand)( U: a! t9 w! Y: Y7 e! U+ T
      (set_tile "Handle" "None")
3 P5 g, I; r  t  z+ v    )1 j) Y8 V6 p/ W: \" j* H8 X  o
  )
/ V" G4 K, R% z5 p2 n  ;;
. E. i9 X; M3 s. {- C1 |2 `' P, H  ;; Radius for ARC and CIRCLE5 P7 c2 C/ x5 Z& `1 H9 L  a
  ;;
5 }+ d" P2 t. ]- t% k  (defun set_tile_rad ()
$ _' d, ?9 H* n4 y% b" `    (setq radius (cdr (assoc 40 elist)))
) D% a9 _$ {$ E8 |* e. z    (set_tile "radius" (ai_rtos radius))
. y0 b7 p5 O4 h  )! ~6 i% ?3 S9 y2 T$ j; `8 [
  ;;
; N) N1 _4 M0 N3 h  ;; Start angle for ARC; ?* F+ y6 ~* o* y( T# t
  ;;2 d! t2 x/ {8 M
  (defun set_tile_stang ()
0 d3 k  L1 U: y6 X; K    (setq st_ang (cdr (assoc 50 elist)))
- Q, J; p2 K. s0 j( C; v    (set_tile "st_ang" (ai_angtos st_ang))9 v% G) \  h, Y. E* p
  )
9 i: v9 ]1 y8 z+ L5 g$ A% |  ;;3 n- X( v$ ]6 x1 q9 E
  ;; End angle for ARC
4 K/ r' c$ b" Y( e4 D+ ?) i' i  ;;
$ ?; Q1 i9 ?+ y. ]! A/ o  (defun set_tile_endang ()
4 g- H) Z5 ]$ m. r4 i7 o    (setq end_ang (cdr (assoc 51 elist)))
. D) [' Z7 F5 b) V    (set_tile "end_ang" (ai_angtos end_ang))- |5 x8 ^' t' e4 n; m
  )
5 y# F& h! r3 p6 Z3 P% h! k; O" k, \% E  ;;
1 o  x+ H9 r8 D# i  ;; Rotation Angle - Text, Attributes, Block insertions and Shapes
1 r# X' ?( s7 z  ;;
6 J8 v# v+ |3 k( E$ c  (defun set_tile_rot ()8 z: w7 w1 `" ?
    (setq rot (cdr (assoc 50 elist)))
* a& y5 O5 Q, Q+ }' E    (set_tile "rot" (ai_angtos rot))
0 ^% ~7 f- S7 \( f2 c  ); U- }$ [$ L1 R
  ;;
9 F7 [/ c4 N, R* `  ;; Height - Text, Attributes and Shapes
' n, P1 _# A0 A3 x  ;;
$ M% W) h' b. Y; f" Y2 m6 K  (defun set_tile_hght ()
8 `* S  D. P1 k) n, h    (setq hght (cdr (assoc 40 elist)))
# u! J) d- T( E$ P' Q$ \" [    (set_tile "hght" (ai_rtos hght)), A2 r, C! S& @7 J( Q. o
  )
' ~" r+ f0 T9 Y. C& C4 ]1 U! {  ;;
! L$ l4 T+ D1 V5 i. `; n: p  ;; Width Factor - Text, Attributes and Shapes9 b4 X/ h! w; t  @" H
  ;;0 X( c" m' w6 C# s# o8 D7 x
  (defun set_tile_wid ()
0 u% r' q% r  M& w    (setq wid (cdr (assoc 41 elist)))& F- h6 A$ {. f# w) ?3 Q, b* ^
    (set_tile "wid" (ai_rtos wid))# M3 P: |1 T3 i# j4 }( J% \5 D  ?
  )
: d. Y: H6 E7 v* s% ^& `  ;;- n7 b4 h. h& |% S; c2 @; I
  ;; Obliquing Angle - Text, Attributes and Shapes* f2 L6 o4 k: B7 ~: W" o6 h: S6 x
  ;;
' s6 h' Y( }; C* ^: Q* y9 I( ]* M  (defun set_tile_obl ()
1 c; V3 F/ C5 L1 N  `    (setq obl (cdr (assoc 51 elist)))% m+ t' \0 W1 N4 J; ?
    (set_tile "obl" (ai_angtos obl))/ c' t% p& _+ @- V
  )
, O8 `6 F8 i1 \/ s# A  ;;" ^. l3 r1 y+ v+ h0 N
  ;; Text string% t, ?5 ~6 k( G1 B
  ;;: Q& [( A9 k5 y0 O1 h# d
  (defun set_tile_text ()
4 {" H+ |, H# h& r    (setq text (cdr (assoc 1 elist)))4 H# D1 K3 p4 x4 H4 l
    (set_tile "t_string" text), Q) Z( {5 |4 B4 u
  )# u/ e' m, n9 T5 j
  ;;3 z) }. h6 D9 `% g; N+ @
  ;; Attribute Tag, }1 z- v9 a  c1 ~# x* W
  ;;
4 |0 X& D. N, |  (defun set_tile_tag ()
! a$ r9 k% `3 {+ \' ^    (if (= etype "ATTDEF")7 a" w3 T5 |( P3 g, S8 R' k$ [
      (progn
2 M! d+ }7 c3 X6 ~        (setq attag (cdr (assoc 2 elist))), Z' i. H3 d& G# s: @& P9 ^
        (set_tile "tag" attag)/ J! J3 I$ G1 q- L4 x7 N$ b
      )8 F" e' n8 V+ @, H
    )
) P9 d5 F  Q  l3 j  )  L, ]4 |( b4 N2 p9 f: e, ^
  ;;; x9 A! P' a& x. y
  ;; Attribute Definition
& f, z+ h3 y# ?* m- N: w; y  ;;7 m5 @( v0 `' W' g
  (defun set_tile_prompt ()  a' }  x+ ?7 ]5 o  P
    (if (= etype "ATTDEF")! X2 D  ^! G! g3 b  i/ W7 u3 s
      (progn
+ P+ I6 w0 s5 ?        (setq atprompt (cdr (assoc 3 elist)))- \$ x( \% H0 m/ C# H
        (set_tile "prompt" atprompt)
4 R: m3 E; u' ~  z' y& E" `4 Z      )/ Y. {  `& c4 [
    )
& X+ E* `7 ~; O; c6 g' `& l- x  )
! p/ ^7 t; H* b1 V  ;;7 w* Y' ]1 S, ]
  ;; Justification setting for Attributes and Text.  Initializes8 n9 K7 x, v  C% L5 b, T
  ;; popup list box
) T9 h( X4 r$ W8 z2 I  ;;; o8 M% F0 k/ c' c
  (defun set_tile_just ()3 T3 f/ a! E6 u3 y; G: Z6 i
    (setq ha (cdr (assoc 72 elist)))  ; horizontal alignment+ h. R7 ~$ `! \& Q" k' G
    (setq va (cdr (assoc 73 elist)))  ; vertical alignment- ~' @8 ?& c( P* v% X3 u2 A! W1 Z
    (setq ha-prev ha)5 F9 i% e4 ~$ D. ]9 {0 W
    (if (= etype "ATTDEF")% U( b+ I% K$ U
        (setq va (cdr (assoc 74 elist)))  ; vertical alignment
" m/ o2 Y0 Z2 G* T% G! K& M7 M    )
( f9 _% S( R, l% g    (setq jlist
* o0 Q+ a, f% p          (list "Left"        "Center"        "Right"5 {1 w8 W5 b) Q0 o1 S- n- l
                "Aligned"     "Middle"        "Fit"
6 M0 T! q0 d; f+ A. @) l                "Top left"    "Top center"    "Top right"
" x( `" b: `/ g3 o9 r                "Middle left" "Middle center" "Middle right") e" Q0 a9 t3 |
                "Bottom left" "Bottom center" "Bottom right": }6 a+ j/ L4 F5 H, _7 D% a
          )
* O. `( x6 ]- I% d/ @. |    )) T2 M/ h$ ?: n$ d
    (start_list "popup_just")6 g! Z1 U$ Y' s
    (mapcar 'add_list jlist)2 v6 C3 B' c( J* p& k% S) z
    (end_list)
) d* _5 H. N- D# F: ]" }! n8 o6 x    (set_just_idx)# C9 ^3 N# Y; T; d9 t
    (set_tile "popup_just" (jlist_act just-idx))
) b/ A; Y$ f4 A  )
# P2 I0 H# S( M6 ?0 Q  ;;" y6 n/ z0 c9 |
  ;; Style setting for Attributes and Text.  Reads symbol table for popup list* m2 r4 Z# l, _+ V% ^# J
  ;; box.2 y4 X- w! ?) U6 e
  ;;7 p# [9 b: j; T7 R; F5 A& V
  (defun set_tile_style (/ sname style-idx tlist)" `$ t+ ~- M( W2 z/ |- i& K2 C: j
    (setq tlist (tblnext "STYLE" T)( C0 |+ _" Y- u1 R# B
          slist nil)
6 a" H: h- Q3 Q8 M- _3 q. d    (while tlist/ g! Q$ P2 K, b# G7 F, _! v
      (setq sname (cdr (assoc 2 tlist)))
; i5 j7 ^* q3 ?: k: `! ^7 l5 W0 L      (if (and (/= sname "")! Y3 O2 f' Q7 q$ \1 e) j; ^
               (/= (logand 16 (cdr (assoc 70 tlist))) 16))- B, g) K% d4 T3 s2 `$ E
          (setq slist (cons sname slist)))
$ ^9 `8 I% h2 C' }  {% q2 L      (setq tlist (tblnext "STYLE")))
* y9 J# ?% l$ }2 b1 S9 U7 v. U- W    (if (>= (getvar "maxsort") (length slist))% m4 x4 J5 N/ y8 B2 M  t) B
        (setq slist (acad_strlsort slist)) ; alphabetize style list
5 R. y& Z- p% a( E* [) E      (setq slist (reverse slist)))     ; or reverse it to put it in DB order
! K- V& i4 e1 W4 r) @  t/ [+ Y2 e! O. |4 k7 V, ]
    (start_list "style")
! q- ?5 {( G5 u3 ^$ `% S% t    (mapcar 'add_list slist)
- `$ V7 k+ }7 J, F2 F+ k6 {    (end_list)& S* P5 j! S' @4 I
    (setq tstyle (cdr (assoc 7 elist)))
  b8 t! D- K! I3 `4 c    (setq style-idx (getindex tstyle slist))
/ b; U: e* N& T' m/ o    (set_tile "style" (itoa style-idx))3 f! N! s) g4 D+ Q! W* d2 r
  ), H: P' x8 r! k* A8 l
  ;;# I/ V) D% T6 U7 F; J
  ;; Text and Attribute setting - upside-down, backwards% H: s. o6 k; h1 d
  ;;
% Y, F" {9 V1 T: K5 w/ T% @  (defun set_tile_bk-up ()
* \% L7 f8 {6 p! |1 N6 o) ]' p    (setq bk-up (cdr (assoc 71 elist))). o) `* P4 D( h9 W4 D* P  _
    (if (= (logand bk-up 2) 2)7 H6 D+ A) a2 F$ R! q" t/ A
      (set_tile "bkwd" (itoa (setq bkwd 1))), q) M  x) ]# f; @; t
      (set_tile "bkwd" (itoa (setq bkwd 0)))7 i. D% @' N- d) v8 q; P8 T
    )
+ E; V# ^9 D# l( I    (if (= (logand bk-up 4) 4)0 Z' b1 y& f1 O" L
      (set_tile "upsd" (itoa (setq upsd 1)))
1 a+ f6 s( c/ f, V      (set_tile "upsd" (itoa (setq upsd 0)))
1 l$ r$ Q" ]$ ?! b/ U    )
2 z  c+ F# K, S$ x! ]  )7 I0 E! U/ g8 K1 |% I3 Y5 n
  ;;
* {: ]/ C+ |4 e' Q3 @  ;; Attribute setting - invisible, constant, verify, preset" b+ n. o$ _# W( R
  ;;
3 ?) q# H( t. W1 q4 A8 f/ T  (defun set_tile_icvp ()1 h- h8 J4 \  H  {1 h& h# E
    (if (not (setq icvp (cdr (assoc 70 elist))))
- k/ D- f& n0 h. l+ b      (setq icvp 0)
& [, p: E) c+ h0 s    )
* @& I, g$ f- I9 H    (if (= (logand icvp 1) 1)
- Y* @5 d& `9 R# E; o      (set_tile "inv" (itoa (setq inv 1)))+ H7 c& J5 A! |7 s1 V% W  K
      (set_tile "inv" (itoa (setq inv 0)))7 v- D6 x3 }9 i% r( r
    )
$ Q3 p3 U6 K, D# J# C/ ^    (if (= (logand icvp 2) 2)0 |5 O) q0 z; W0 |
      (set_tile "con" (itoa (setq con 1)))9 X. {8 @" }# b+ ~- K; L
      (set_tile "con" (itoa (setq con 0)))* v/ d5 \! u, ?& S6 G
    )! d3 I* f7 Y/ v
    (if (= (logand icvp 4) 4)
6 D* V4 K2 C7 }" {      (set_tile "ver" (itoa (setq vfy 1)))7 j1 b( i' @; [5 r
      (set_tile "ver" (itoa (setq vfy 0)))* r; h5 ~( [( t1 ~7 ]& N
    )
0 V9 D$ s$ t( n; O0 c+ B" R    (if (= (logand icvp 8) 8)
7 ?# e' \1 V6 o0 f0 u3 |      (set_tile "pre" (itoa (setq pre 1)))( _& _: ~; u* J$ v# Q
      (set_tile "pre" (itoa (setq pre 0)))
7 F" O* H5 ]/ V+ ]    )4 I! T% O: C& e! J" m& X
  )
+ ~5 u. N, p& Z  ;;+ q/ H& B/ s/ w7 }
  ;; Scale factors for block insertions
3 K9 C7 }* F/ V; o. U  ;;  Q8 D! F$ m! T8 t$ b# q# m
  (defun set_tile_scale (/ temp)) A- \8 W& e/ K9 ?9 Q5 @
    (setq temp (getvar "LUNITS"))8 j# @" E8 `6 t% J5 P* J: n+ K
    (setvar "LUNITS" 2)% f& ]. f( U( E, x* b+ [6 g9 g& B
    (setq xscale (cdr (assoc 41 elist)))
' O/ w% M5 M* ~- q. z6 H% r# K% c, s    (set_tile "xscale" (ai_rtos xscale))
+ o  z; ]* i$ I2 O1 w; ]* \8 e    (setq yscale (cdr (assoc 42 elist)))1 Q' F5 n9 u0 O3 Y
    (set_tile "yscale" (ai_rtos yscale))
- h, \9 D; q! ~$ P8 e% o    (setq zscale (cdr (assoc 43 elist))); \5 G  g) v0 b
    (set_tile "zscale" (ai_rtos zscale))
/ Z" J% B4 ^' k    (setvar "LUNITS" temp)
8 _4 I& S" j. v; K  ): R' v+ i5 B+ \& C  y4 \% l# M
  ;;( S& b) Y& {$ l1 e! K9 `1 n7 r! x
  ;; Rows and columns for block insertions& d. w  B$ {& U* |+ T& u
  ;;3 Z6 T* \! C' M/ h& w
  (defun set_tile_rc ()
$ L" ]/ Z0 A( U7 `0 _2 ?9 ?5 }  M    (setq columns (cdr (assoc 70 elist)))5 W0 ~2 X2 T2 e% V0 ~8 @' [
    (set_tile "columns" (itoa columns ))
" G# }. ~' H: ~# Y    (setq rows (cdr (assoc 71 elist)))
8 A7 h- S5 G0 o( L    (set_tile "rows" (itoa rows))
: S9 r+ K6 b- {) p7 ^, n4 d    (setq col-sp (cdr (assoc 44 elist)))
2 b/ P' Z4 z9 `, }, w3 c& Y    (set_tile "col_sp" (ai_rtos col-sp))
9 a* ~& l% [, q( k# ]    (setq row-sp (cdr (assoc 45 elist)))& N  X2 _; h" O7 f' ]' t
    (set_tile "row_sp" (ai_rtos row-sp))+ f  a/ j! p! D: k" d& C
        (if (/= hasclip T)+ h' s  h0 C+ r- r# ?$ Z
                (mode_tile "xcliponoff" 1)
$ ?+ m6 A" c/ d4 B, d7 n                (set_tile "xcliponoff" (itoa xcliponoff))9 h" A! N/ R: F* V) j
        )8 v* v" @: F7 C7 \
  )- Q. F; E$ K" `- ?5 ?
  ;;
$ W- u9 @$ m5 n9 Q  ;; Invisible edges for 3DFACE
" F" j$ U1 T. J" {  ;;3 p5 Y5 b. B( f1 S8 O3 C
  (defun set_tile_edges ()
# E( h7 b' w/ I% n* G" w( n4 x; p    (setq f-vis (cdr (assoc 70 elist)))
7 n8 a5 [4 x6 f    (if (= (logand f-vis 1) 1)
2 c5 V! C7 }9 S7 v( J      (set_tile "edge_1" (setq edge1 "0"))
( x1 `$ L# Q. v$ u      (set_tile "edge_1" (setq edge1 "1"))
& v' Z- N2 C( h) i7 M/ |* T    )! e3 n3 |* x9 A1 @+ p# s- W
    (if (= (logand f-vis 2) 2)8 Z- v" L+ a: s( L# Y9 K
      (set_tile "edge_2" (setq edge2 "0"))4 b. i  _8 Z5 _& k2 {4 b
      (set_tile "edge_2" (setq edge2 "1"))0 t$ x7 W; n& p
    )
/ v- m" R! f: {) X6 ?$ Q8 e    (if (= (logand f-vis 4) 4)
3 y& @) i% {7 m  c      (set_tile "edge_3" (setq edge3 "0"))
3 D) ^6 Q8 `) |$ ]: T& G% C7 H      (set_tile "edge_3" (setq edge3 "1"))
8 Y7 [* W6 R- ~    )7 c4 J# Y: C1 ]/ L- `8 r
    (if (= (logand f-vis 8) 8)
; r) S! F3 P) A. g! ?      (set_tile "edge_4" (setq edge4 "0"))
+ F* P, m8 G0 W      (set_tile "edge_4" (setq edge4 "1"))* f8 I" @9 B% T
    )8 Z3 ^$ q: X1 A8 T5 o
  )
- X) Y% G2 ~/ _4 `* j  ;;4 ]4 A! V- \& s) S$ N" a7 m
  ;; XYZ Point values for polyline vertex
8 o5 I  F3 u$ s' o$ z* a  ;;
5 I0 b% V+ C% I1 C6 z. T  (defun set_tile_vpt (ptype)" e/ h. G% o) {& e. _2 ^
    (if (= (cdr (assoc 0 vlist)) "LWPOLYLINE")
) f7 o) m2 d* I- z' y) v+ q        (progn
+ d3 Y7 B* [) g: X# L  U            ;; ctr is 1 based, vertices are zero based." |1 T' k) k* I( |4 u; f
            (setq vpt (cdr (getLwVert (- ctr 1))))
( N& C' Q; l( P7 P/ Z: J            (set_tile "xtext" (rtos (setq x1 (car vpt))))
, M! |' x9 ]0 B+ H( V/ Y4 k            (set_tile "ytext" (rtos (setq y1 (cadr vpt))))3 M& G; ^6 x2 C9 @% @
            (set_tile "ztext" (rtos (setq z1 (caddr vpt))))
$ d/ `. ~6 s: t# O! q+ C1 Z        )
. R# n9 K3 w' J" ~        (progn% o; L; |( c  M' p7 C) [1 s: K
            (if (= ptype 0)$ Q) C* l( W4 A; |
                (setq vpt (trans (cdr (assoc 10 vlist)) 0 1))
! \, N+ K  \7 w& c, D                (setq vpt (trans (cdr (assoc 10 vlist)) ename 1))
  a$ R3 U# j0 v            )4 [6 Y* |( k1 ^# b4 g$ r2 C1 @

1 J7 j6 e/ y9 y  Q            (set_tile "xtext" (rtos (setq x1 (car vpt)))), }3 V0 F0 N" E- P6 B9 m0 i) }! v
            (set_tile "ytext" (rtos (setq y1 (cadr vpt))))
& n: T4 m+ h  b5 L8 I$ L' V' u            (set_tile "ztext" (rtos (setq z1 (caddr vpt))))
$ O3 h% H/ ~! v        ); E3 y8 @- S/ J
    )
4 l) H( `# K# K& g: X, f! c' `9 }% s( w* C3 o/ r8 W
  )
( V" }; k& u7 h  ;; This is the equivalent to doing an entnext on the heavy weight
5 S2 j. R/ O8 Z% E+ U/ Q% `* ?% r, \  ;; polylines. The hard coded '4' below allow stepping over the
# \3 |1 V6 e. x0 N/ [  ;; 40 41 and 42 group code information. The while loop finds the
6 M) Z! \, y# {# C, c  ;; first vertex which will be used as the starting assoc in the4 b$ _% w) K5 c
  ;; call to nth.4 ^( }& E( D$ _6 Q5 T/ q
  ;;
6 T: ]4 Z( d5 v- e; i9 t: V# [  (defun getLwVert (tmpctr / count tmp)0 o2 R) b6 y! \: i# T/ j
    (setq count 0)
3 C, h& N* G+ y# q8 |9 s1 R    (while (/= (car (nth count vlist)) 10)
5 Z; a6 ~9 f; _# u* [! F        (setq count (+ count 1))) J- F, _* l% U* i) w
    )1 B5 Y  N0 L, B
    ;; If the counter reaches the number of vertices,
3 r0 N, r9 o9 L% F: r    ;; reset ctr and tmpctr to zero again.
! r9 o8 o3 {8 G; \3 s' z/ b4 F9 ~: J    (if (= tmpctr (cdr (assoc 90 vlist)))
; @8 r% h: a8 W/ u' v5 s        (progn
, @! ?! ~. X/ K        (setq ctr 0)
) M- r. o* T7 H' P2 R/ D% i        (setq tmpctr 0)7 _( M( G' D- s6 a# T( ]. E: O3 T6 X
        )
) ~* k/ E. K# V. s4 G7 \2 W    )' Q& P/ U8 h' R7 @
    (setq tmp (nth (+ count (* tmpctr 4)) vlist))
/ l. O% q% x& T5 ~& V. y0 T0 f; `: g" w    (setq tmp (append tmp (list(cdr (assoc 38 vlist)))))6 s+ x1 N( {5 n- n4 R. _
    (setq pt1 (trans (cdr tmp) (cdr (assoc -1 vlist)) 1))
- i1 e( j7 _; S: j    (setq tmp (cons 10 pt1))- b6 Z. a( g2 B3 y1 X) ~# {; e
    (setq tmp tmp)
7 N/ w. a: C0 F  )
6 r) _% ^3 w9 U$ P& \: X  ;;' ]1 C0 |: G3 x0 w+ n% K
  ;; Set tiles for Spline properties. If the spline is rational then we  b- T" F( A4 K/ [) D5 J- p
  ;; need to display the weight values of the control points, so set' d& |9 K7 q9 k* s: l( O2 g
  ;; flag to 1.. c" _' O" U, u. Y8 i0 x5 K# E" A
  ;; 1 = rational spline
5 t! \( D. @/ Q6 d' J) m$ C5 u  ;; 0 = non-rational spline
" i" h6 u7 _1 B5 ?1 V) g0 ]  ;;
& X; O) y1 N! A  (defun set_tile_spline_props (): m) P9 E$ S3 ], }# T5 i
    (setq rational_spl_flag 0)      ;; initialize rational spline flag# C* ?3 s; Y& f* b% m( ~4 |9 |
    (set_tile "Degree" (itoa (cdr (assoc 71 elist))))
0 W4 Q3 r- W2 g8 N    (setq bit70 (cdr (assoc 70 elist)))
* t3 n0 b/ f. q3 D    (if (= (logand bit70 1) 1)
) f# k. x- `) F* j) y" q        (set_tile "SpProp4" "Closed")
% ^5 H7 }, H0 ^/ c$ U        (set_tile "SpProp4" "      ")
6 N( W' Z% g1 s    )
- H% @( F6 L" {0 h! E$ ~    (if (= (logand bit70 2) 2)7 n, a0 a7 C9 l# [% @
        (set_tile "SpProp3" "Periodic")
. f/ l$ N# B8 i8 N" _: J        (set_tile "SpProp3" "Non-Periodic")- d6 \1 ^$ j( M' t" \( P
    )
" y: N/ J0 ~: E5 X) `. l    (if (= (logand bit70 4) 4)3 ~& g; Z- I, h7 N" u5 F8 T3 m) [
      (progn
) w4 k* _) J7 o5 |7 b) k        (set_tile "SpProp2" "Rational")
$ p" w! \0 l% P1 D( U2 e3 i* @        (setq rational_spl_flag 1)      ;; this is a rational spline1 b% F0 k4 c' Q0 G" K
      )
' R; k" Y$ U( y5 I# @        (set_tile "SpProp2" "Non-Rational")
1 i2 F2 s5 D4 [- w# q" [, w! W& Z    )
2 X& c4 h0 i4 Z. O* k" K    (if (= (logand bit70 8) 8)
8 [; [+ e. c& k& f  L+ Z+ k        (set_tile "SpProp1" "Planar"): s& m1 q5 V5 c5 ]+ a( i1 z
        (set_tile "SpProp1" "Non-Planar")
3 K8 D" [8 p7 b+ i$ x    )- I7 G! D& x9 @: ~1 I. V
    (if (= (logand bit70 16) 16)( F" g. L5 Q: _& h$ b2 [4 }$ l# y6 f7 J( t
        (set_tile "SpProp5" "Linear")
  L3 m& J0 l$ Q2 g6 O        (set_tile "SpProp5" "      ")
' s  z, e, M9 |/ ~    )3 g+ i" e) H3 a8 K3 l
  )8 }% x- B* L0 ]
  ;;
# w6 I/ @3 `4 ^  ?: ~3 t4 B3 J0 h  ;; XYZ Point values for spline points+ V0 g) c/ h) r6 p6 \
  ;; Need to account for WCS/UCS" J6 D% O  j# J" X
  ;;) X8 b! e  f6 }! ?9 F, q, h
  (defun set_tile_cntl_pt ()
6 E; A# {  A2 O    (setq cntl-pt (cdr (assoc 10  elist)))
; b; I: r- v, J7 b! {- Q, s& n    (set_tile "xtext" (rtos (setq x1 (car cntl-pt)))). Y# D+ m, N  A# w8 ]1 u
    (set_tile "ytext" (rtos (setq y1 (cadr cntl-pt))))
9 `, O5 X7 Z0 s; H- v4 C9 J" |* f    (set_tile "ztext" (rtos (setq z1 (caddr cntl-pt)))), b. k. T7 \& g. l# I
    (if (= rational_spl_flag 1)      ;; if rational spline: L7 c0 K( Y" P0 ~$ l* y/ K
      (progn                         ;; show weight
) F9 |8 j1 w7 D0 h2 x, Q        (setq weight (cdr (assoc 41 elist))). z& n  ?2 [& a" m' v
        (set_tile "weight" (rtos weight))
2 h' E* ^  e- D      )                              ;; else! O' V+ {1 i- O/ y
        (mode_tile "weight_text" 1)  ;; disable weight field/ P  R/ A- h  \2 n% v& Q
    )
7 G5 G, s- V% {% L  b0 d. |  )! c0 I! T& C1 I. J3 ?- o
  ;;% j5 `0 ^, p9 E
  ;; XYZ Point values for spline points5 g5 J# e/ w' U
  ;; Need to account for WCS/UCS9 U$ a- T  ~0 h
  ;;
: p& z* d) F* m$ |( g  (defun set_tile_data_pt ()
5 A7 b5 V7 d3 M6 g: J    (if (not (assoc 11 elist))6 K" p! y" i# g
      (mode_tile "data_pts" 1)
, A: M$ |2 Y4 _9 n, i5 d; E      (progn
! [8 Z4 m$ d3 a* T* d+ r. o         (setq data-pt (cdr (assoc 11  elist)))& l- f1 i4 i6 M! d6 K% F
         ;; display points with current precision.
- }$ n$ f( o% F0 e5 A2 \         (set_tile "dxtext" (rtos (setq x1 (car data-pt))))' E9 o7 L( q+ Z$ s$ O; S
         (set_tile "dytext" (rtos (setq y1 (cadr data-pt))))( N5 v$ k  B7 I/ P# F  q! ~. C( u% C
         (set_tile "dztext" (rtos (setq z1 (caddr data-pt)))), B4 J0 i8 A5 L" s$ O+ [
      )
* ?+ ]7 p0 e& l    )
! U# }9 V! v2 x3 b  )
9 W5 S* ~( K: T( W0 {& L) k3 ^  ;;! m% |; @6 S8 k4 j! o% K) n
  ;; Fit curve, fit spline, or smooth spline surface setting- e' A" a( i0 W2 ?5 c
  ;;7 F* q& Q. D% a+ j# _8 ?: r( R
  (defun set_tile_fitsmooth ()- E' r) k! z+ x$ h0 ~
    (cond% y3 F# E& G9 S5 ^3 h: S$ B
      ((= (cdr (assoc 0 elist)) "LWPOLYLINE")
: ^1 ^% k( \. [" T8 i/ ^        (set_tile "none" "1")
- D; T3 ?  X9 D+ n: Q      )/ j2 n$ Q2 t+ i/ [
      ((= (logand bit70 4) 4)4 p! P  u0 }) m6 ~- ^# o
       (cond$ }+ R3 [+ U/ |: ~% k
         ((= bit75 0)
: [" W: x- I3 Q7 t# e. N7 H           (set_tile "none" "1")- J# U& F+ b8 M# M$ U
           (setq spltype 0)# d+ f" A1 }3 J' L3 `
         )1 \) q" T3 P. J( d
         ((= bit75 5)
+ @4 |) p0 H' V           (set_tile "quad" "1")
/ ]. X, M0 ]7 U. A7 M! s& O           (setq spltype 5)6 B  f6 d1 u4 e& C# Z; J
         )2 |5 Y9 x+ D2 }' @) v; K. U
         ((= bit75 6)
* {- B4 b  ?( e4 t$ D+ \           (set_tile "cubic" "1")# {  |+ O& p* ~' F- s  I
           (setq spltype 6)- N) I, B* n" @# n
         )* R9 C0 X: R$ y& @  Z
         ((= bit75 8)
% b9 p( V4 ?5 c           (set_tile "bezier" "1")
' A' K) p1 M# I           (setq spltype 8)
, q$ T9 w* @+ q3 c6 G- B# d; n) O         )
% j" d; T" n0 M& y8 n7 O       )
! S* I" x: l, G      )- k0 o' t+ T' D4 o5 Q- ?
      ((= (logand bit70 2) 2)- N: y4 u# h' H/ x' u
        (set_tile "fit" "1")5 r! M4 {! {8 n: n) a( ?% y
        (setq spltype 1)
9 o* E& k6 l+ L! P9 O. ~' l      )/ Q- B1 y: C7 E4 Y# G) m
      (T (set_tile "none" "1"))
, g2 o  a" T0 b/ W    )" U0 T6 a$ P$ z; T' Q8 Y
  )
+ G/ u* ^, [& I) v" B  ;;& G. K! S3 q% m& a
  ;; Closed or Open mesh and polyline setting0 p3 K3 S% ]" s2 ^8 l9 Y
  ;;# r* c- \. s% H/ A% d& \3 i1 T
  (defun set_tile_closed ()
; h$ y  o3 `1 [7 t' M1 d+ e3 L/ ?      (if (= pltype "3D mesh")7 O& I4 z4 `8 j) t, Z9 r( T0 \
        (progn- Y, q9 h  c$ n+ @0 V# _
          (if (= (logand bit70 32) 32)/ A, M0 z& l( {. Z0 u
            (set_tile "closedn" (setq closedn "1"))
* P- D7 [! v% V0 P            (set_tile "closedn" (setq closedn "0"))3 L0 V0 L6 ?: b" h# A1 X1 m! K
          )7 i, N0 t: T) d1 l- b" ^
          (if (= (logand bit70 1) 1)4 N. T6 {1 C5 v2 M: w
            (set_tile "closedm" (setq closed "1"))
& ?, c. R/ o# K7 y, f5 ]: J( w            (set_tile "closedm" (setq closed "0"))
1 U) d, N& ^! R5 X' ~! u          )% {$ S( \+ k& v* `
          (setq old-closedm closedm old-closedn closedn)  v5 B1 A8 `2 [$ K& Y1 J3 b( n
        )
* X6 b& O& ^$ K      )% o( f) N& `+ i' a2 F& Z- K
      (if (or (= pltype "2D polyline")6 q2 B8 a1 T) c5 {' A
              (= pltype "3D polyline"), g# ~( E+ [3 {1 ?9 G' q
          )
5 W: L- ^: j6 C* i1 Q6 L        (progn$ F0 [4 f2 j' C4 N
          (if (= (logand bit70 1) 1)! [6 o; |) d# {7 |4 U/ ?
            (set_tile "closed" (setq closed "1"))! a  n! n. F4 L. j) q
            (set_tile "closed" (setq closed "0"))
# u. [2 v. A) g# o7 X6 M; I          )7 X: F: y6 p2 L2 V/ p; ?
          (setq old-closed closed)/ l7 b4 f) h9 g0 m  c
        )
" O+ h+ H* K9 i4 Y! ]. E      )4 B  i6 H: E8 d* w* K9 r
  )( A( I0 K6 J. W$ S
  ;; Set common action tiles
* k  o3 I( w6 x. s  ;;2 n1 `4 _# [0 ?
  ;; Defines action to be taken when pressing various widgets.  It is called
* \+ M+ s$ O3 p5 A  ;; for every object dialogue.  Not all widgets exist for each object dialogue,6 Y# [* u% h* J- h! i: Z
  ;; but defining an action for a non-existent widget does no harm.
9 N7 S. a3 p& I( o9 \8 I  (defun set_action_tiles ()
- F; u4 G) T3 o& Z    (action_tile "cancel"       "(dismiss_dialog 0)"), l2 z6 P/ I2 ]6 H! L
    (action_tile "accept"       "(dismiss_dialog 1)")
$ [/ t, ^3 \8 |2 V5 O    (action_tile "help"         "(help \"\" help_entry)")
2 }$ x: W, s1 c  [3 V# d    (action_tile "b_color"      "(getcolor)")- x* a! f$ C* b1 x3 x* U1 k
    (action_tile "show_image"   "(getcolor)")0 Q$ b  Q& E$ K$ ]5 p
    (action_tile "b_name"       "(setq elayer (getlayer))")
0 U' M& c# r. E$ ^; L' r( A8 C    (action_tile "b_line"       "(setq eltype (getltype))")
0 i/ U, @" B: i6 ]5 L4 P$ w    (action_tile "eb_thickness" "(getthickness $value)")
0 A) a( H8 p5 _$ W    (action_tile "eb_ltscale"   "(getltscale $value)")8 j6 N; E+ B/ D
; q% n4 Y2 S8 l$ U1 F, h% K
    (action_tile "pick_1"       "(dismiss_dialog 3)")
+ d7 I' j! w( U$ C( z" Z# R    (action_tile "pick_2"       "(dismiss_dialog 4)")
$ m6 M/ D. ^/ W9 k0 \7 c5 V    (action_tile "pick_3"       "(dismiss_dialog 5)")7 a# Q; x1 X4 n6 P* o( x
    (action_tile "pick_4"       "(dismiss_dialog 6)")  k1 p  S1 L4 {3 w1 }
    (action_tile "x1_pt"        "(ver_x1 $value)")
) Y! b0 C! Q, e) I9 ~& c" a* v* n    (action_tile "y1_pt"        "(ver_y1 $value)")" I# x6 |- b) h+ i0 T, u
    (action_tile "z1_pt"        "(ver_z1 $value)")
# \- C1 x/ E! v8 a! L) h# M1 H    (action_tile "x2_pt"        "(ver_x2 $value)")4 M9 _: W' y  y+ [- v
    (action_tile "y2_pt"        "(ver_y2 $value)")
0 v' Z% o6 D. [" j  F    (action_tile "z2_pt"        "(ver_z2 $value)")
$ u- [4 u# c8 L# h    (action_tile "x3_pt"        "(ver_x3 $value)")9 V/ t, f- ~9 F, p" ?4 R" z
    (action_tile "y3_pt"        "(ver_y3 $value)")
! w! U1 @% i' W7 W5 t, f6 ]) O    (action_tile "z3_pt"        "(ver_z3 $value)")4 h- X& g  y! J
    (action_tile "x4_pt"        "(ver_x4 $value)")
" H6 w6 M' ~% q( u9 H    (action_tile "y4_pt"        "(ver_y4 $value)")/ {/ ~& z7 z& R$ @* O$ r
    (action_tile "z4_pt"        "(ver_4 $value)")
! M4 c. y% x  |, f
1 D. T' E% s" W, R3 L    ;; Action tiles for Xline & Ray) g4 q8 |  P. H3 }+ D; w$ ]. @
    (action_tile "xline_x1" "(ver_xline_x1 $value)")2 u3 b1 ~+ U1 {  y4 c8 _$ n( }
    (action_tile "xline_y1" "(ver_xline_y1 $value)")5 h; L1 S. z7 v1 W$ u6 w
    (action_tile "xline_z1" "(ver_xline_z1 $value)")
% J/ a  `# r3 r& |/ w3 ^  y6 v    (action_tile "xline_x2" "(ver_xline_x2 $value)")
; ^& O( M9 N. M- {    (action_tile "xline_y2" "(ver_xline_y2 $value)"), P, K& U3 L  l
    (action_tile "xline_z2" "(ver_xline_z2 $value)")5 R; D; `2 e) `- R+ {4 A1 E8 q

; o' J! e; h/ f% V    (action_tile "edge_1"       "(setq edge1 $value)")
/ i" u9 ?1 |; a( E) \, M    (action_tile "edge_2"       "(setq edge2 $value)")* D$ {. R/ F- v! T0 y
    (action_tile "edge_3"       "(setq edge3 $value)")+ [8 O2 X" \& x; n1 r7 r  g
    (action_tile "edge_4"       "(setq edge4 $value)")# U% d, F* y+ [2 |/ z
( ^& f. a8 _% ]* O: c% Q
    (action_tile "radius"       "(ver_rad $value)")- X" _0 n" Y7 ], S2 B" y
    (action_tile "st_ang"       "(ver_ang1 $value)")
5 N, G3 m5 s! x8 @; ~6 e3 \( g. J    (action_tile "end_ang"      "(ver_ang2 $value)")
0 N+ ]1 ^7 o" s2 O6 Z    (action_tile "end_eang"     "(ver_eang $value)")7 O0 f/ P/ k" F1 @" j
    (action_tile "minrad"       "(ver_minrad $value)")+ P' {2 X: N* i5 s
    (action_tile "majrad"       "(ver_majrad $value)")
1 O: O3 ]2 b* R. p( s" W' o# e5 G) {$ Z/ Z1 I! t8 }# S
    (action_tile "xscale"       "(ver_xscl $value)")) a2 O$ K, c/ {: F
    (action_tile "yscale"       "(ver_yscl $value)")
/ E* t& G3 O; W, g    (action_tile "zscale"       "(ver_zscl $value)")3 r2 {- m  p# ]1 y2 d+ R5 w
    (action_tile "rot"          "(ver_rot $value)")
& W1 M% P' l# B/ B9 X! G    (action_tile "columns"      "(ver_col $value)")
! U0 ]: i8 j" v5 J" S    (action_tile "rows"         "(ver_row $value)")
: I3 o" O" M: C4 U1 M    (action_tile "col_sp"       "(ver_colsp $value)")! j3 T9 c% x1 r, x  F, {7 f* A; T
    (action_tile "row_sp"       "(ver_rowsp $value)")
# C- o6 L- O6 |7 \) ?, ]' s; @4 @( |% z8 |( Y* H$ }
    (action_tile "hght"         "(ver_hght $value)")
$ Y+ l: L" D5 j1 Y    (action_tile "wid"          "(ver_wid $value)")
& \& w' c2 q$ [! a    (action_tile "obl"          "(ver_obl $value)")7 U" f, p/ }; s( c$ z8 X
    (action_tile "style"        "(style_act $value)")2 |$ w$ m& `  L' |

4 W$ X1 m  Z  J9 X$ U    (action_tile "t_string"     "(ddgettext)")! I+ V* R6 s8 C' _1 ^- i( J
    (action_tile "tag"          "(ver_tag)"): S( }- B$ c  ?
    (action_tile "prompt"       "(ddgetprompt)")6 D/ Z! L1 c! {6 w8 y' ?" k6 q
    (action_tile "bkwd"         "(setq bkwd (atoi $value))")
! E% M* t) h5 v; Q9 j, Q% E7 e3 O    (action_tile "upsd"         "(setq upsd (atoi $value))")
! W) S4 w5 D' w# x6 f7 @; k    (action_tile "inv"          "(setq inv (atoi $value))")# b1 e# N/ Q( x% e6 ]. U+ T! y8 m
    (action_tile "con"          "(setq con (atoi $value))")9 P4 N: k2 K- r% n" o1 b% Y
    (action_tile "ver"          "(setq vfy (atoi $value))")
' |$ I8 F: l. h  @1 @. i: q    (action_tile "pre"          "(setq pre (atoi $value))")
; `" d8 n: v7 z6 e    (action_tile "popup_just"   "(jlist_act $value)")
+ a8 C- y7 L' u4 U
, m& W* B& j8 a8 G/ U    (action_tile "closed"       "(setq closed $value)")
1 W- d  k  T2 l/ L/ ~3 R& d: A    (action_tile "ltgen"        "(setq ltgen $value)")
: p. g& A$ W% [( b0 |    (action_tile "closedm"      "(setq closedm $value)"), G, U( m6 u: Q+ D# W/ M( N2 m5 M
    (action_tile "closedn"      "(setq closedn $value)")
" j; f' C" L% c' `7 _; |$ Q. d    (action_tile "next_v"       "(next_vertex)")! j* i! v0 y2 u& ]5 L; T
    (action_tile "xcliponoff"   "(setq xcliponoff $value)")
9 w% E" {6 y  l
! H9 t; s3 G2 a) n    (action_tile "next_cntlpt"  "(next_cntl_pt)"); J% f- J, a) f( \# ?3 s; t. G
    (action_tile "next_datapt"  "(next_data_pt)")
; ^8 |, [8 @8 K- k, i8 S0 m7 P7 C/ b
% h$ j+ L/ E! p; o8 [8 j8 c7 m    (action_tile "none"         "(if (radio_gaga \"none\")(set_uv 0))")* E/ _# ^& `* ]( @+ W0 i
    (action_tile "fit"          "(if (radio_gaga \"fit\")(set_uv 1))")! o" s3 B. A& O3 c
    (action_tile "quad"         "(if (radio_gaga \"quad\")(set_uv 5))")
6 q: k5 h, w: ^7 b/ ~  p$ z. F    (action_tile "cubic"        "(if (radio_gaga \"cubic\")(set_uv 6))")  H( E9 I9 D! F1 `
    (action_tile "bezier"       "(if (radio_gaga \"bezier\")(set_uv 8))")
3 \" y# P# I0 S# Z. Q! q4 W8 c* I; d8 z6 `9 ]1 R( y
    (action_tile "u"            "(ver_u $value)")2 `! O9 n* p. W& |' B
    (action_tile "v"            "(ver_v $value)")  e# Q  q4 H4 n; h% |  [; w% {
  )7 z& o2 I8 B* @& X9 v
: Q/ R0 B* H# Z, ?, O6 ~  J6 S0 I' O
  (defun ddgettext()- n! e$ ~' x3 Q2 X, A' V' T
    (setq text (get_tile "t_string"))
3 ?- o; h8 S( a, o  e& }5 b  )
& y6 p" j* x3 I( n) g- Q2 U$ Z+ B. O( e! k3 T' M3 D2 f- W' v
  (defun ddgetprompt()
& z6 |8 l: p6 Z: U: w8 o    (setq atprompt (get_tile "prompt"))
8 c) Q  r) x4 N/ s4 I  )/ G2 Z9 P  w% ?7 L" F: r
$ U9 V3 j1 E7 b  O; Q
  ;; As OW doesn't support disabling of individual radio buttons within
/ q2 l) q; w  h5 `* k- c2 m  ;; clusters, a check must be performed as to the legitimacy of the
3 ~. ?/ v0 q( M  ;; button pushed and reset if necessary.8 |2 X+ Z4 `- G
  (defun radio_gaga (pushed)
* X4 T* y8 u( Y* q6 }+ E) E    (cond
1 |1 c& v& `# Y+ I* q      ((and (= pltype "3D polyline")
; j/ m2 K! `% U# U4 v( n' Z            (or (= pushed "fit")  I; Y) N0 ?5 h5 K' j# e# |
                (= pushed "bezier")
! E$ s' y0 I5 T8 J  [" g  J            ), ~+ `7 h& N$ Z( X) J
       )% p' Z- x# k9 c2 e: U. Q" }/ w
        (set_tile "none" "1")
7 O: v0 y, E/ a" K# a9 ~! I3 f% |        nil
  D3 }0 ~; b' i6 N      )7 {# f1 ^% R' L% \% s. K
      ((and (= pltype "3D mesh")2 Y. ?7 T* g$ E9 [
            (= "fit" pushed)  h" J0 |3 l. d5 d6 E2 c+ K) f
       )+ K" {' @( ^' D+ T5 p) h/ b  D, `$ B; P
        (set_tile "none" "1")
: f0 a3 x  O7 d, I( P: d        nil
1 L9 r" p( ~: v) I: b      )7 A4 Z0 k1 C) ~6 T
      ((= pltype "Polyface mesh"), R8 [/ k2 n' n/ s# K& f# c
        (set_tile "none" "1"), r; R' @. K% p7 G3 R9 S" ?
        nil/ h0 E3 d; Z' R0 _; |, O. A
      )! d2 X% u6 K0 m- j- N
      ((and (= pltype "2D polyline"). u, f$ @) k5 Y$ U0 h, n% K& t8 r4 H
            (= "bezier" pushed)
, A0 U6 Q- M0 }) {3 M/ |1 Z       )
, }1 H3 d1 x2 P& y2 F" n9 I        (set_tile "none" "1")
. M) h* d* T2 A# H5 |& c. E2 p        nil" n3 m& B3 z4 W
      )0 ]1 ^% J5 M$ n
      (T)7 m$ k' Q) s+ A
    )
: I/ s+ C2 y, A. P; c- ^9 a  )
, H+ X' u4 z7 V5 T  ;;
2 b0 L# }0 ~3 _* l- p  X! k  (defun set_uv (type_n)  l1 K/ D9 I$ m3 t4 s, f6 b
    (setq spltype type_n)
0 V9 X% B1 U8 d; h! L( G9 n    (if (= pltype "3D mesh")
8 b" M  e' z  m      (if (= spltype 0)4 z- e3 k: S- ]! C
        (progn
8 i0 L* _) p# i& j5 y$ t3 T          (set_tile "u" (itoa (setq u 0)))9 V# {) s0 I" d. |8 G; f
          (set_tile "v" (itoa (setq v 0)))8 z1 ~6 f9 V7 O1 Y
        )1 m8 V# }3 p; F: I5 z' b/ w- f
        (progn4 A* l9 U9 _) r. K$ @5 B4 d" `
          (if (= u 0)" ]9 z' x" W( i: L9 v
            (set_tile "u" (itoa (setq u (getvar "surfu"))))
) d+ B$ ?' c6 g2 i- [          )
  o' r2 ?: [$ \$ ]( Y8 E/ I+ B; X& |          (if (= v 0)
+ m# V) f5 q5 s( u: k5 g            (set_tile "v" (itoa (setq v (getvar "surfv"))))6 S, o4 i/ H; W2 M, K
          )
  m$ f9 x5 i( p' q/ U. J  _! t; ^        )
0 C4 O% G4 h' Z5 q( _7 V* W. t9 i      )6 s0 D4 E3 h, v. J1 W  `
    )" i! J3 R7 K+ M
  )2 \) _; W) L4 I+ k5 ]

9 r4 {  ^% _: b& {$ U, y& Z" I7 ~
4 _3 {1 [+ _3 b. W4 o3 |  ;;( H) l; u$ \9 N3 ]+ |# ]
  ;; Verification functions
8 _2 K4 Y/ I7 a# V# w4 H* s! D' F3 c  ;;; F' k6 X# L9 Q9 [) e6 i
  ;; Verify distance function.  This takes a new X, Y, or Z coordinate or: ^6 C# n( u! R" w. c) l( H
  ;; distance value, the tile name, and the previous value as arguments." p/ Y, ?( d% ]9 Y6 L  n- f
  ;; If the distance is valid, it returns the distance and resets the tile.+ u0 u) F+ Y$ P  k1 K
  ;; Otherwise, it returns the previous value, sets the error tile and keeps
. N& L, D) k% N) b4 V1 X7 g2 z  ;; focus on the tile.  Shifting focus to the tile with invalid value can
/ y" A" c$ ^  Q  O5 H6 Z  ;; trigger a callback from another tile whose value is valid.  In order* C& \, [3 k# n5 i
  ;; to keep the error message from being cleared by this secondary callback,! Z) }! b8 L, U* h
  ;; the variable errchk is set and checked.  The last-tile variable is set7 Q! X& p3 T2 Q$ |
  ;; and checked to ensure the error message is properly cleared when the
( c. g0 Y, r6 R9 o0 }, Y  ;; user corrects the value and hits return.
8 x; M5 G* s. o; S1 c  ;;
0 Z1 k- `! s" |/ y- t  (defun verify_d (tile value old-value / coord valid errmsg)
# _. w  E7 c# _4 t, S    (setq valid nil errmsg "Invalid input value.")' d9 b5 s: F+ @; `( A6 x+ c/ e
    (if (setq coord (distof value))! k0 N) ?) Y* Q9 i8 b% E
      (progn
) W$ m7 E7 l* O8 K! u2 c7 n        (cond7 n" b: H, A7 ^# [! j2 m
          ((or (= tile "radius")
/ y! z( E/ p5 {               (= tile "hght")! u9 p6 y6 M( J% m. a2 R+ o3 }
               (= tile "wid")4 ^# Z0 P) G* j' |. j
               (= tile "majrad")
1 A; k% g6 A" E- c               (= tile "minrad")
/ P5 ^9 j. B- [  q/ C6 \& b               (= tile "eb_ltscale")
3 j& k* P! ]3 o* n$ A           )' Z) S8 ?9 Z, X+ A
           (if (> coord 0)
) ?! N# `/ f# }1 B3 |8 R  i             (setq valid T)
, b; i! O$ ~. q9 K- Y+ [             (setq errmsg "Value must be positive and nonzero.")* R/ `! A5 n. K5 X9 \
           )
3 S1 U' X5 H& c          )
% _. Q. ]# x% l+ c          ((or (= tile "xscale"); \/ ]: c8 ~0 d3 P/ v( S4 B* \
               (= tile "yscale")" d. E) @) h* ~4 j
               (= tile "zscale")8 a) {9 H8 j" ]: x
           )! g$ @$ H0 B( A6 V5 T
           (if (/= coord 0)
& z7 f. S: Q5 T5 r' y" A# A/ ?             (setq valid T)
- W9 u" q# ^2 f# I7 K. k& d5 F             (setq errmsg "Value must be nonzero.")# G" u, ?- f2 K9 @( k1 `7 ^
           )
9 Y* j1 {7 D" P2 V+ R' `          )3 {8 k1 o3 m; Y  {
          (T (setq valid T))! t# B* w0 t3 I% `& t8 C! M
        )0 h$ L: X! t" g- G! t5 s1 H
      )3 X. A; z: X. u/ Q
      (setq valid nil)8 @, i/ Y+ _9 i1 Z+ ]0 s, \* q
    )6 |& b* Z. B. M6 l. S# o
    (if valid- k, S6 a& d8 f8 B+ f2 N  E
      (progn
9 o4 @8 W4 F- V- l, c2 E$ X# p        (if (or (= errchk 0) (= tile last-tile))
1 r; g4 n/ n( I7 ^. c          (set_tile "error" "")3 T. l: @4 m1 Y7 r5 O1 S+ I
        )
8 z: w* R+ Y9 n# w$ p. k7 t3 r' c        (set_tile tile (ai_rtos coord))
$ ^  ~+ n2 Z- X5 \6 r! a: m# Y        (setq errchk 0)
. q/ v- Y1 T) l# n& N        (setq last-tile tile)- F; k% W4 e8 y+ u1 I
        coord
- E+ x( E$ C6 y$ ]1 F/ {& U2 u: d      )
7 n1 u$ {' p- H/ i4 s0 e! @9 v+ S      (progn
9 g8 S; V" ^6 ]        (mode_tile tile 2)            ; Move focus to offending field
+ c2 ~3 G& L' Q; R# V0 h; Q4 ]- K        (mode_tile tile 3)            ; Select offending text0 `; P# I" S/ X- m
        (set_tile "error" errmsg)  M% Q/ E! y+ l. t$ h' R
        (setq errchk 1)8 u/ M& z5 s8 S3 d7 J& T& e
        (setq last-tile tile)
+ y! t3 \: K$ j/ w        old-value
. ]3 O3 m6 g; {& x$ _      )
; K) n$ P( g4 X6 k0 j( `    )
" s9 \3 K8 z1 p2 |5 Z! ]4 a  )4 ]: |! h0 H$ a6 |* H
  ;; Function for Xline coord edit box checking.2 Z% H: k' R" ^8 r0 f7 Q
  (defun verify_xline (tile value old-value / coord valid errmsg)' e$ V" v1 A6 K9 A, U, L
    (setq valid nil errmsg "Invalid input value.")4 ]  `% s6 g) t" [6 B
    (if (setq coord (distof value))
2 M, b+ A8 R2 U% X" B+ t      (setq valid T)3 c0 N' a  x9 K/ I1 p/ `$ C
      (setq valid nil)
$ }; W/ p% u$ e. u; j    )
/ ?0 z) E; F. X    (if (and coord) z; D% x: z9 L2 X; F* n
          (and (= (atof (get_tile "xline_x1")) (atof (get_tile "xline_x2")) )
' F  P) X/ K+ c# d0 y8 }               (= (atof (get_tile "xline_y1")) (atof (get_tile "xline_y2")) )* g" y7 K2 J+ t" n& W* K( z! f
               (= (atof (get_tile "xline_z1")) (atof (get_tile "xline_z2")) )
5 |+ Y6 O: t3 j6 ?0 o          )9 i2 V6 N4 _* r
        )# q7 H1 I0 L! m- X* D: h3 E
       (progn
8 m1 y6 |4 P8 O' t, i, m3 P         (setq errmsg! s1 f8 E9 }; {7 \& x1 \' |
                  "The Root point and the Second point cannot be equal.")9 W6 z& [; o) z" O9 N8 E' @
         (setq valid nil)  d  i4 S+ z' U' Y+ F& }, K
       )& t# Z% z) ?+ ~6 o$ A: m
    )
0 Q  M  J! a' _' t8 N$ i    (if valid
  H8 l$ a: Y$ Z+ L. |1 }0 B      (progn
8 }2 s3 A2 \/ X& ^        (if (or (= errchk 0) (= tile last-tile))5 D+ p9 q) X4 C- `6 d
          (set_tile "error" "")* m5 y+ ?* s2 ~* a$ b
        )
* f3 G2 u( e6 U  Y' [( `7 r. N        (set_tile tile (ai_rtos coord))
# l) |5 @/ y2 }" t2 E        (setq errchk 0)
4 k8 s5 w0 h, Q* E( A1 O, C! B        (setq last-tile tile)
0 I/ T- h) M1 c* Q0 i7 ^        coord% H& @3 Z2 V# o9 O" Y7 s& n7 E
      ); `5 U( Q, Z( C
      (progn
; N: F, J/ j# {  M6 ^; e        (mode_tile tile 2)            ; Move focus to offending field) D/ o, r3 g) V: e# Y' ?
        (mode_tile tile 3)            ; Select offending text
: O  u# V: |7 o        (set_tile "error" errmsg)
! c. e. c7 W4 u* b. Y        (setq errchk 1)
# g; M( K- T) M& ]- j; s        (setq last-tile tile)
, O8 t+ E/ }+ b        old-value
+ r# T8 t* e) H0 X. e      ), Q+ B5 v; Y3 U- v6 t: c1 J6 |! E
    )) x% I  t; @, R
  )  v, u) j8 {6 Y8 s- {( B

; J2 `6 ~. `* Z  _  ;;
& J, c2 V; o# `& P$ v  ;; Verify angle function.  This takes an angle and a tile name as arguments.: ~# E2 W% S7 O* y( ]
  ;; If the angle is valid, it returns the angle and resets the tile.
$ v. f9 S" n7 z- s0 z3 t  ;; Otherwise, it sets the error tile and keeps focus on the tile.4 X- S$ J0 Y4 a8 D$ `3 d( K1 {
  ;;
- O9 F  R/ `. r2 ?, u& G; T0 c# M9 `  (defun verify_a (tile value old-value / ang valid errmsg oblqmax)
' h+ c9 G. b2 O    (setq valid  nil
0 G! a: H/ V& C6 L          errmsg "Illegal input value."
: j# K, j& b/ u( g; c0 r    )  `) W4 U5 E) E- Z! e
    (if (setq ang (angtof value))
& p- p9 J- q$ [: j      (cond+ K1 `7 J3 F5 u. y9 f0 a$ q* e
        ((= tile "obl")               ; Restrict obliquing angle) e4 S, |, ^: a; |
         (setq oblqmax (+ (* (/ PI 2.0) (/ 85.0 90.0)) 0.000001)), A2 ^& `' _" W" ^4 r8 C
         (if (or (<= ang oblqmax)
+ d( \+ }- V8 \                 (>= ang (- (* 2.0 PI) oblqmax))$ k4 T% x8 \/ d+ E. N$ t! O) t
             )+ @* H' B; [3 t
           (setq valid T)
* W2 m3 T! x9 \1 @/ g: j; h2 T           (setq errmsg7 s: X) q' p* ?; T& U7 k& v
                 "Value must be between -85 and +85 degrees.")
# B6 y. S/ A- V$ H         )5 G( Q  x/ w- k0 ?% X
        )& S: F; v7 k, |7 o
        (T (setq valid T))            ; Other angles not restricted
: ~) {$ t: S1 y, Z) e& L$ Y  ]& ]* b      )
9 H$ g0 M" y7 v% {9 E      (setq valid nil)                ; Invalid angle input
: Z7 j' n) o# r1 V. W: B    )1 q) i# m6 z; I
    (if valid
3 y' l0 i" N  H% e' c" |& t3 G      (progn
9 R. Y' L# l$ V8 ?! t8 E+ z        (if (or (= errchk 0) (= tile last-tile))9 j" \- U5 U3 r) R
          (set_tile "error" "")
, D$ e3 t, L% I* k        )8 q5 a* j+ G7 R$ Y( p2 S/ _
        (set_tile tile (ai_angtos ang))8 ?/ T" U3 E0 e: V  c
        (setq errchk 0)
, `" A$ P" Q8 Y$ ]        (setq last-tile tile)1 H  i1 v) K, e/ V* D1 _
        ang
% r! I0 J3 m) o. Z      )3 N8 T" S! |5 q  ~0 O8 ?, u4 g3 |
      (progn6 B) V& v8 v4 H7 C2 |
        (mode_tile tile 2)            ; Move focus to offending field' u1 Z. L3 A$ x' l+ k0 S
        (mode_tile tile 3)            ; Select offending text
( }% y# O; C* n/ g        (setq last-tile tile)
3 t& O/ l: U' m6 P- G. q: N% y3 o        (setq errchk 1)! n, Y1 D0 a+ G  |
        (set_tile "error" errmsg)/ r8 y8 V4 v3 l7 l
        old-value) L# n& o, k  |3 b+ D- G# L
      )+ G! h; N/ z" Y' ~+ J5 ~& f
    )
' w! z! v8 R$ r* R7 V% z  )
; E7 I. j. s  j: O' H9 }8 r1 }  ;;
/ b! z+ [+ a0 D! W% y, Z6 S  ;; Verify angle function.  This takes an angle and a tile name as arguments.
; o) {6 y; R7 h: k" I  ;; If the angle is valid, it returns the angle and resets the tile.  C5 H4 z/ r0 E( g5 o# t
  ;; Otherwise, it sets the error tile and keeps focus on the tile.
; _' \5 a/ W5 P8 W) d1 M  ;; This function is specifically for the end angle of the ellipse object. If
) n& E! F' j* l8 h- Z  d  ;; the end angle resolves to zero then we want to display it as 360.
0 K2 c5 p  H+ U: D$ o0 O  ;;, C- y6 V: U5 _4 d& r. q5 K  P
  (defun verify_ae (tile value old-value / ang tempend)
% J2 q9 _3 c" ~: J  {8 X( s    (if (setq ang (angtof value))
' U4 y7 F7 ~- J: p; a# d      (progn# k$ Z8 W( e+ i$ ~: O
        (if (or (= errchk 0) (= tile last-tile))
- f/ G  x: O& o$ W0 E# I          (set_tile "error" "")2 f( k+ q0 h  F1 I, \+ `; B
        )
5 b* p% G) `$ S5 K, m8 P1 {* s        (setq tempend (ai_angtos ang))$ M; i7 k# L1 W
        (if (= tempend "0")1 B; L8 @, p& }  h4 A4 Z: {
           (set_tile tile "360"): C/ g, `, g  h0 |
           (set_tile tile tempend); |, I# q, I# t9 D5 {3 o
        )1 g: V  Q$ j6 H& @' D
        (setq errchk 0)
% l1 f! C7 C$ ]  J* j2 K1 h, U( t        (setq last-tile tile)* [& i8 I6 r+ \
        ang2 o/ M7 T- S) ?5 o+ q- S0 M8 e
      )# `, m3 e6 _5 Z* n' I7 w1 v+ P
      (progn; P* V# a% X% E' e" E, N& H4 o
        (mode_tile tile 2)            ; Move focus to offending field
- H- b$ o! {/ y' W8 ?# _        (mode_tile tile 3)            ; Select offending text4 }9 t" z* t0 ]7 v7 u1 s% a1 \4 o; ^
        (setq last-tile tile)
/ W, A% K) w+ C- q        (setq errchk 1)# x1 P- b/ a: B- P) @) l8 Q
        (set_tile "error" "Illegal input value.")# Q, g0 q# x8 p8 L8 Y0 c- s
        old-value
  |+ U( z1 }2 h4 Z      )+ Q& o2 w. }% e, u4 A  c, z1 x& c* V$ k
    )
% s$ j! Y( f$ ?: |  )! e8 e& h% u) U$ |* h( x6 K3 g
  ;;! E& J) Z2 m. N8 S! p+ r! C
  ;; Verify integer function.  This takes an integer and a tile name as
# C5 S4 W, R1 Y  ;; arguments.  If the integer is valid, it returns the integer and resets the0 L; d' Z! }. ^4 a9 x
  ;; tile.  Otherwise, it sets the error tile and keeps focus on the tile.
; M7 X+ [: u! _2 D) n8 Y2 f& a9 m  ;;7 h* d% i( w3 z4 M; }9 D
  (defun verify_i (tile value old-value / int valid errmsg)* @- `) G" Q+ ^9 e
    (setq valid nil): A, z9 I% j3 o$ o
    (setq errmsg "Value must be an integer.")+ M/ C( _8 [6 T2 L4 f( `
    (setq int (atoi value)). z  |: Z& Q& Q
    (if (setq intchk (distof value))- Y& K; A% P, q# @: f6 N
      (cond
' x- p, }2 t4 B3 j        ((or (= tile "columns") (= tile "rows"))
8 Y/ z- C. }( g9 B         (if (and (= int intchk)
' U% K" X( v2 x; X3 I- T8 x( [                  (>= int 0)9 @. F3 X$ e2 o
                  (<= int 32767)  ]8 V: z9 O& f8 v# X
             )! R+ x% A# x  ~! E5 G. C
           (setq valid T)
) f3 ^/ Y! |" j" R* _( V0 d           (setq errmsg "Value must be an integer between 0 and 32767.")' y  G/ E( X, z6 H
         )3 x# j* ^5 S/ Q, _2 |# J
        )8 l4 A0 B$ P. V0 _+ V- u! x
        ((and (or (= tile "u") (= tile "v")))
# U0 b4 W+ i' r1 f: @         (if (and (= int intchk)
( N3 W+ O: R  h) e7 \. _: v                  (>= int 0)
( v/ K# f% D# Z. e' I* U2 x! B! X                  (< int 201)
9 u( {2 i" y9 y! D             )
! ?9 a! A; R7 Z+ A. o6 I           (setq valid T)
0 g  R$ B2 y& `# R9 Y% {           (setq errmsg "Value must be an integer between 0 and 200.")7 C9 G( X! R( ^9 M/ u/ M
         )6 w) E% n$ o4 }% ^* Q$ A# I* v
        )* G6 `$ _( P" {: c& _
      ): f5 ~  h) t& b4 C( ?# u! K! n
    )
# L- R# B. `- `, {    (if valid1 B8 p9 W$ I6 L
      (progn: y9 u' ^" G  X  K  e6 s
        (if (or (= errchk 0) (= tile last-tile))
: S) O* _- F9 j2 U  I9 c! e            (set_tile "error" ""), i+ P, ?$ E1 J/ Y' f
        )& f# |2 N5 ]2 v- d; W
        (set_tile tile (itoa int))% G: _8 ?( D+ t+ x# E6 a# Y" J
        (setq errchk 0)
9 O! n* l. J( z. ~: X8 P1 T5 F        (setq last-tile tile)/ W7 e2 j* R% \1 ^
        int# X  T3 `  }6 S2 G8 ^7 y
      )
- a- O" i3 K  H      (progn, _# |" f2 B. F6 o. R0 A
        (mode_tile tile 2)            ; Move focus to offending field
2 M* x$ s1 Y# p8 d+ }/ P: e        (mode_tile tile 3)            ; Select offending text
% E. Z& _. i* }" T8 P" p        (set_tile "error" errmsg)
$ `& j. b! c& m3 U7 M: a3 f, Q        (setq errchk 1)5 t9 C7 T$ n4 o6 L# e
        (setq last-tile tile)/ V4 S3 B3 Z) Y8 t
        old-value0 |7 o! w+ }' }0 }% I7 _0 ~5 Q& ]
      )
' G+ s/ x; ^" w' \6 |: B, a$ p    ). a# W& C: a' _& _0 f
  )
$ k) j; ~6 X9 }* P3 s  ;;
! S1 x9 k; l# P  D  ;; Functions that verify tile values for integers" A1 e9 b! o/ k, k9 V; u* N
  ;;& I% {+ F! z5 U) T  \' @/ J
  (defun ver_col (value)
7 U5 j3 r# `1 k# O4 ^* t    (setq columns (verify_i "columns" value columns))6 w: `3 g+ Y0 u4 n( L. B
  )
/ h: ?4 t, O4 L) l  (defun ver_row (value)
- R, m# N7 x5 ~    (setq rows (verify_i "rows" value rows))4 m0 D7 J" N. Q+ G$ q' |* m
  )
$ [  x7 s+ J5 p0 D% c  (defun ver_u (value)
# D# X9 J1 A! I; G9 c" P    (setq u (verify_i "u" value u))2 o; L! ?) c5 u8 K
  )
8 q" w& r' i; t. U3 s8 ?  (defun ver_v (value)" O4 Y2 L9 C! \' \
    (setq v (verify_i "v" value v))/ ^1 Q% i/ E4 B. K, T2 }3 ^7 a  O
  )% C1 p0 {6 o, q8 D! W# N
  ;;
/ h: o% B4 i3 H* b# }  ;; Functions that verify tile values for reals% H* N" ]' c1 E1 O  S& }
  ;;
6 x: @- D  O7 N6 ]" O- z! H  (defun ver_x1 (value)
* b5 C1 o; Y' U& s; \5 P    (if (setq x1 (verify_d "x1_pt" value x1)) (calc))
4 S7 _/ v' ^9 K/ D: }% O  )
1 O7 z& d3 g' [: t+ b( }! v* N  (defun ver_y1 (value)
/ Z' q; k8 N$ e- u. v    (if (setq y1 (verify_d "y1_pt" value y1)) (calc))$ y! V8 C9 }  |" G  i
  )
. ^% K$ P8 J0 `" Y  (defun ver_z1 (value)
, T2 ?" i1 a$ s/ u# F9 B    (if (setq z1 (verify_d "z1_pt" value z1)) (calc))
* W. J* G, ]" S  A  )) n, `  f, T& m  d! h! }
  (defun ver_x2 (value)) W4 k4 h3 |* J" i
    (if (setq x2 (verify_d "x2_pt" value x2)) (calc))
4 s. U- B. h& V- d  ); \- O' [8 v3 H
  (defun ver_y2 (value)
* I/ ^" L+ S/ d( [* X+ h    (if (setq y2 (verify_d "y2_pt" value y2)) (calc))
& Z2 _* ^5 W- }, F  )
' O% l: |) ]" F8 W1 p) _) w, @  (defun ver_z2 (value)5 I. \' [# P( P
    (if (setq z2 (verify_d "z2_pt" value z2)) (calc))
1 V9 b6 n% V1 `) h+ l6 B! o2 C, a  )
% z) f! a, }( D/ R  (defun ver_x3 (value)7 j# I" w' r" b  `( [* t& f
    (setq x3 (verify_d "x3_pt" value x3))
# ?' o' s- m9 k* S/ A/ p  )
  p, V( p& ], a! N  (defun ver_y3 (value)2 E/ R: O) W9 F8 K& }+ r# D
    (setq y3 (verify_d "y3_pt" value y3))$ s) k6 s7 Z& n# g" v2 R- H0 A$ `; S/ `& w
  )- N2 D; B# m% ?  r8 ]+ w
  (defun ver_z3 (value)
& ]5 |' D/ O. P5 f; E7 ^( v' n    (setq z3 (verify_d "z3_pt" value z3))& y8 e0 Q. W3 I' {
  )
& c1 H0 E* {3 Y  (defun ver_x4 (value). t2 ~% K+ S! i; ^# [& u: W
    (setq x4 (verify_d "x4_pt" value x4))/ |# A7 D% I) u# X- ?; I/ l' Q
  )
( D: o& g- p2 K+ P4 y  (defun ver_y4 (value)* }9 f2 N1 N( S
    (setq y4 (verify_d "y4_pt" value y4))& [2 g# y; M% \3 b1 z7 i3 Z7 U
  )
, I- n; E% h/ {  (defun ver_4 (value)
% l' B" N6 O/ G/ X    (setq z4 (verify_d "z4_pt" value z4)): b3 c4 D# A) \. ?( _" e1 i" I
  )- g( h/ o2 m% ?% z) Q% d
  (defun ver_xscl (value)
; Z/ o, h, y4 e: S/ u& {5 [    (setq xscale (verify_d "xscale" value xscale))
4 G$ u# U0 d  J  d- ~0 E, C  )# F* s5 _  v0 ~+ X7 C
  (defun ver_yscl (value)0 y0 T' p9 f8 s% z4 S1 E2 C
    (setq yscale (verify_d "yscale" value yscale))2 s: T+ D" {$ M6 e
  )- o$ [) g9 d, X* @9 b
  (defun ver_zscl (value)
1 R: v# e* q; F8 G) B    (setq zscale (verify_d "zscale" value zscale))/ T9 G/ X: ^. f2 w+ V
  )1 ~9 V4 Q# Z' V# ~
  (defun ver_colsp (value)  f: o" M2 ~' ?: {/ t3 K
    (setq col-sp (verify_d "col_sp" value col-sp))
5 t3 h1 \" {0 a# o  )& S4 j" O5 A" `( B5 Q+ m: [( m
  (defun ver_rowsp (value)
" K1 f; M( [! V4 S' H- W, ^4 ~    (setq row-sp (verify_d "row_sp" value row-sp))
9 l# N) ^1 ]5 i9 P% Y. _. p+ {  )' G6 R! a$ @; N
  (defun xclip ()
5 L, O' `8 J, j) l+ i. V    (setq xclipmode t)
  j9 p* ?9 F0 W' S    (if (= xcliponoff "1")
: o6 k# E2 ?  z5 Q% F8 ~# X9 `      (command "_.xclip" (cdr(assoc -1 elist)) "" "_on")
+ a" I% C; G; b- Q5 `* @  q      (command "_.xclip" (cdr(assoc -1 elist)) "" "_off")7 r2 w: V/ X3 @! ?- b& W' o+ \" ?, f
    )5 u! l8 A4 C% W: P2 ?/ A( p
  )! p2 t8 i5 G$ v: G: f" f8 i) z, H
  (defun ver_rad (value)
& i' r/ a# C  Z8 ?    (if (setq radius (verify_d "radius" value radius))) k9 g2 D4 ^& k6 K1 N
      (calc). K) y! G3 ~: C' ]9 t
    )4 L6 {/ M/ O6 |6 k1 U0 S
  )
; E1 d" |- T9 Q/ M  (defun ver_majrad (value)
- l4 ~2 B& i  R    (if (setq majrad (verify_d "majrad" value majrad))# f. z1 e$ h( ~' \: D% ?2 n7 j
      (ell_calc_newval "majrad")$ }( t. ~$ N1 m# d. g" i
    ); h: [, s6 C" ]3 w8 q' t
  )0 G- a. J5 j4 a/ ^1 O8 g
  (defun ver_minrad (value)
9 _- Y; u6 m8 ?: r    (if (setq minrad (verify_d "minrad" value minrad))
1 T* j! R5 G1 }' l1 W$ E" ]# C- f      (ell_calc_newval "minrad")
( A1 w0 B* }- g; b2 m: g( t    )
- L! ]3 o3 }% o3 ]% _$ U( n. x  )) \! j0 x/ @; ^' Q
  (defun ver_hght (value)
2 l0 Q. t& O5 w5 @; x( T    (setq hght (verify_d "hght" value hght))3 M2 V# Y5 m3 u  J/ e
  )1 X4 x5 T9 ]6 k" [
  (defun ver_wid (value)% B) X5 U! o0 j/ `) V! }) t( |6 q
    (setq wid (verify_d "wid" value wid)); H" G- m% M! q3 ]
  )0 D  L  l3 m! v; U
  (defun ver_xline_x1 (value / temp)
  X  j% A% ?* i( ]# z5 f8 g    (setq temp xline_x1)  r2 h4 U+ f# x) Z$ S0 o
    (setq xline_x1 (verify_xline "xline_x1" value xline_x1))
" w' K- r! s+ n' A0 O/ _0 B    (if (/= temp xline_x1)
$ c& j# E. a) |+ ?( s  Y# r      (progn (modify_xline 0) (set_tile_dirv) )
! E% k' A' I7 R1 p    )
7 \; u1 s7 A3 m, |6 B  )! C+ p; ?$ A& l( {
  (defun ver_xline_y1 (value / temp)/ V8 t% V8 e2 G$ j3 [# J  f
    (setq temp xline_y1)" R" q6 a  A, R% b2 g! V2 k
    (setq xline_y1 (verify_xline "xline_y1" value xline_y1))5 F* \/ G$ }- G5 o5 @
    (if (/= temp xline_y1)) ^/ }& i) @1 {( _9 `' h# _" @
      (progn (modify_xline 0) (set_tile_dirv) )% ~8 z( v" X+ B. i1 b; G5 D
    )
6 n/ m( o! b9 K* H4 S1 X  )& [  p2 `2 p  D. p7 L7 G8 {$ {; E7 ?
  (defun ver_xline_z1 (value / temp)
) a. a9 w! `5 h    (setq temp xline_z1)
4 w9 N+ J7 z" c1 n* v    (setq xline_z1 (verify_xline "xline_z1" value xline_z1))
$ r- Z' S4 }* H) A* l    (if (/= temp xline_z1)
) A2 v% B9 z' X2 X      (progn (modify_xline 0) (set_tile_dirv) )" E# ~1 ~! r0 E  ~# p$ ]
    )
0 ^5 t) y  N5 _' U% i; N; _/ O7 l! G  )
0 {: ]  d( s7 n9 w; b  (defun ver_xline_x2 (value / temp)
) I1 L. J6 }3 j    (setq temp xline_x2)
1 Q  S. k6 v: ?8 v; R9 T# _  V    (setq xline_x2 (verify_xline "xline_x2" value xline_x2))& }) @4 ~7 O; Q$ }
    (if (/= temp xline_x2); P7 J# M9 S$ Q3 _
      (progn (modify_xline 0) (set_tile_dirv))/ C+ s, Q4 a  q3 n; h9 n3 K
    )3 ^* v4 v# A6 p) T4 v% {
  )2 c$ B2 o( G# g, J, f
  (defun ver_xline_y2 (value / temp)" J% ~8 L9 j1 l! J: J- c' i
    (setq temp xline_y2)/ ~5 l, {/ z0 p
    (setq xline_y2 (verify_xline "xline_y2" value xline_y2))2 d( b# G' A7 Z7 z7 Y
    (if (/= temp xline_y2)& u+ V+ P* X9 ?. u
      (progn (modify_xline 0) (set_tile_dirv) )& I& {' H* E; l  ~* a. K8 w( b
    )
2 d5 j; J& S) D9 k% l  n  )( }# a+ D$ m7 x0 m
  (defun ver_xline_z2 (value / temp)' u; `) h: D8 e) w. d4 S( g
    (setq temp xline_z2)
( w5 s' t  Y5 h7 c* p: l6 f    (setq xline_z2 (verify_xline "xline_z2" value xline_z2))
. }1 Z* |; U1 y0 C2 A    (if (/= temp xline_z2)
% [. C% J0 j- x' K- f/ B- c; H9 c      (progn (modify_xline 0) (set_tile_dirv) )$ W( `' L4 O3 C  Q8 I( @
    )
, L3 _, U4 x( ?  G8 b8 b) T  )- r! ~5 e' q, _1 q( h8 {
  ;;
" H; c5 T2 Q, x+ l- n. B  ;; Functions that verify tile values for angles! l/ l4 [3 U. q) w% s1 p0 e! [0 q
  ;;
, H1 a: w8 ?6 E, n, M# u  (defun ver_ang1 (value)' |/ B7 D" ?5 ]" |+ e
    (if (setq st_ang (verify_a "st_ang" value st_ang))6 k* d1 _+ x; X& U- D" r' `
      (calc)
7 r1 `' u6 G% ^" c    )) U# s1 w$ t& D  k7 E
  )  K' `8 `2 u: }1 y
  (defun ver_ang2 (value)" w+ X$ p- w7 ]7 M4 @! E/ j
    (if (setq end_ang (verify_a "end_ang" value end_ang))
& c6 W- J& g0 u& i      (calc)
6 f! L. s4 }. ]  G4 J5 ~    )& r' j( D, I4 I/ E" m' q( e) i% R8 ^
  )
/ o5 T' ]% [4 |  ;;
% Q' j! q; O0 X# W! ]  ;; Verify tile value for ellipse end angle. Handled slightly1 I- W: r) D) V1 P* x
  ;; differently than the other angles.
, M* ?: j7 e2 l; f1 Q  ;;
* g+ g2 i& |/ \$ w- N6 q3 c9 ]  l  (defun ver_eang (value)
' b( Z& t; W; A6 u8 f( B2 C- `    (setq end_eang (verify_ae "end_eang" value end_eang))
/ V! n2 m" G1 ^9 y$ `" P  )
8 e5 A4 t6 x4 ~. h3 g: Z' A  (defun ver_rot (value)# V' a, H, r7 c% [; E& h) p* e/ y
    (setq rot (verify_a "rot" value rot))! |4 r3 K) g) r" X# b) G
  )
  M3 O- f/ Y+ k! O) Q  (defun ver_obl (value)
8 |& ?0 u$ g) m% V3 {4 K    (setq obl (verify_a "obl" value obl))- p! A. U5 d6 y
  ): f* K! w" @  q8 B
  ;;2 c8 R8 T4 d  H8 ]" {" I
  ;; Function that verifies attribute tag field for null string,1 s( E% x  }( ~
  ;; or a string that contains one or more spaces.  Tile value2 W3 U3 X: x2 P- C9 b0 j
  ;; is also converted to upper-case as well.
8 D1 e1 Q6 R1 P% M2 V0 y& s; f) X- f  ;;5 b! z9 i$ }) C0 ]$ J2 E2 E5 ?" e5 F
  ;;$ w% S9 G+ n( ~- e1 E
  (defun ver_tag ( / tval)& F9 N* [* P+ X9 X  a) j
     (setq tagval (get_tile "tag"))
. M; T7 c% ]; `     (set_tile "error" "")
! {; O, C: o, ?- d7 K1 Y- S$ u     (cond
+ t2 W4 Z+ T8 Q  ?        (  (or (eq "" (setq tval (strcase (ai_strtrim tagval))))
) `7 x1 A# o& [" u0 S% z               (wcmatch tval "* *"))
* K$ j+ F  k  K           (set_tile "error" "Invalid attribute tag.")' |: o6 F9 ]$ Z3 `
           (mode_tile "tag" 2)" b# }5 r1 w7 V1 s# x/ o
           (mode_tile "tag" 3))  z# R2 L8 a1 K
        (t (set_tile "error" "")
  I2 n* T7 s* q5 ^% k5 V! k           (set_tile "tag" tval)
. {1 b! X$ O9 N2 b: d7 V           (setq attag tval)))) v, V4 C/ y& J' Z) H. a
  )
2 }; V* Q, m, K- Y; c8 R  ;;& [. q* N7 k* o
  ;; Calculation functions+ X# O% k6 U$ J2 D' ^% u
  ;;
6 c0 p8 @- k! K8 w0 V7 p  (defun calc ()+ m+ `' J: L1 N! }* U" l# C
    (if (= etype "LINE") (line_calc))3 J- d+ B8 \+ q1 m. t% v6 K% y
    (if (= etype "ARC") (arc_calc))
0 @5 ]8 e, q- s: h2 g4 y- O$ _1 ]    (if (= etype "CIRCLE") (cir_calc))3 W8 t& e6 B" l$ D. v8 H* ?
  )) b' l4 E" C6 K3 }# p4 h8 a
  ;;
8 E1 @- c7 {5 f1 W) H  ;; Calculation functions for lines, arcs, and circles
( A3 T+ N/ R% ^: ^  ;;
8 ^( Z2 a( y) T6 ], U) g* t  (defun line_calc ()2 b- ?* v  D8 Y" m" h5 O: c
    (setq stpt  (list x1 y1 z1))+ U2 u+ ~- E1 n! \, V$ B- Q- Q& l
    (setq endpt (list x2 y2 z2))5 }% n; e* e( n( j# j% }4 Y( d
    (set_tile "delta_x" (rtos (- x2 x1)))
" V" b; h6 Z5 e7 s6 R) e, D2 i    (set_tile "delta_y" (rtos (- y2 y1))). J- c- N. _2 c7 `, L7 U
    (set_tile "delta_z" (rtos (- z2 z1)))
* ?1 m( Q% }% Q( P9 L1 O    (set_tile "l_length" (rtos (distance stpt endpt)))
6 ^. Z# ^# W" @, J" p. s; z    (set_tile "l_angle" (angtos (angle stpt endpt)))
4 W$ @7 J( S. V  ]; W- f  )
- J! T7 V/ M- u, \  e5 s% f+ _& X' R, {0 l0 |4 Y+ @% @
  (defun cir_calc ( / area units)
4 C; x/ K% c; ?' H/ }        (setq radtest radius)- O9 _! o$ p' q: O8 p& g( ?
        (set_tile "Dia" (rtos (* 2 radius)))
+ C' D% `; |" R! U6 c4 g- Z        (set_tile "Circum" (rtos (* 2 pi radius)))
# }$ _2 ^( J. C% L$ J        (setq area  (* pi (* radius radius)))1 U- m6 v2 Q6 w0 g
        (setq units (getvar "LUNITS"))* E, }' l& U  ^$ z, F
        (if (or (= units 3) (= units 4))
0 O  u! e# \% R- S+ ~8 ]0 x. s            (progn
" h' d- i. Z# y; }; a8 ?& U               (setq area (/ area 144.0))6 G1 `; s% [; ^! K! t3 [2 C
               (set_tile "Area" (strcat (rtos area 2) " square ft"))
; A$ @# ]8 K0 F& r. o8 h/ c            ): O7 k" o, V) k) o) G8 e! x
            (set_tile "Area" (rtos area))
4 V8 x! S) S# N0 }) i( m        )5 Z+ M) ]: x5 I) e
  )
- U; a. t4 p2 k, r1 ~% }
0 C2 f6 M  t+ c) f' h  (defun arc_calc ()
( D$ a8 t: d% Q6 [, ?  m    (setq totang (- end_ang st_ang))7 y& p! E4 A) x5 f& O: ^+ H
    (while (< totang 0)6 ~6 m9 c9 L0 B, [. o4 [, w
      (setq totang (+ totang (* 2 pi)))
. [4 |* J2 M$ V3 }    )9 @% S% g3 m. H/ i" Y- L
    (while (> totang (* 2 pi))& F0 c3 \' o) ~4 c  b% w
      (setq totang (- totang (* 2 pi)))
5 c4 k* L6 G4 P4 ]: @7 I    )5 F) [" L+ z2 q7 V( R! G' }
    (set_tile "tot_angle" (angtos totang))1 o  }: N4 j5 h
    (setq arclen (* (* 2 pi radius) (/ totang (* 2 pi))))
/ y4 E4 n% _. Y# a    (set_tile "arclen" (rtos arclen))) a! l# |5 g, F0 h9 u
  )
7 H7 L: d1 Y9 [  ;;& C! Z9 d0 i2 d( u% p8 W/ @
  ;; Calculate the major radius, minor radius, major axis direction.
9 v8 N& S% m1 ]6 m  ;; Get radius ratio. Convert Start, end parameters to start and end
! B  ~" l9 H5 k! O/ I. F  ;; angles. Save Major Radius value in "old_majrad" in case the user
% H0 l- q/ Y+ Y9 U0 V  ;; chooses to input a new Major Radius value later. It's needed to+ @: I+ J0 R9 ~) u
  ;; calculate a new Major Axis Vector value.
9 w5 i, B& C, S: G0 t3 N  ;;
* R8 y  W4 d8 I, u7 U  (defun ell_calc ()
/ `" X1 _# K- s( L' e        ;; Get major radius from the major axis vector.. _% U, U5 a- |
        (setq majaxis (cdr (assoc 11 elist)))
4 h# Y, k$ O$ F. g$ e' `        (setq xx (car majaxis))6 c; I+ T$ i/ Q1 P7 m' s, V
        (setq yy (cadr majaxis))
  j& X2 F4 B+ `        (setq zz (caddr majaxis))
' ?; @# U8 L% E2 ]9 G6 o1 L        (setq majrad (sqrt (+ (* xx xx) (* yy yy) (* zz zz) )))
4 M8 Y2 T6 |3 [        (set_tile "majrad" (ai_rtos majrad))
# D& O- I* [8 [" i3 P) w        (setq old_majrad majrad)
- c+ {$ D# l+ h2 W3 d6 W        ;; Get radius ratio4 K  ~+ u; e" B! N2 P. Y0 N
        (setq rrat (cdr (assoc 40 elist)))9 _+ m/ s. T' N/ R
        (set_tile "rratio" (rtos rrat))
1 v1 B& K0 \; {; i' a$ N        ;; Calculate minor radius4 r, O# F1 x, _5 U( T& t8 L/ A9 q
        (setq minrad (* majrad rrat)). Z, @2 g& Q1 @+ Y' ~* [- v
        (set_tile "minrad" (ai_rtos minrad)); B+ G- c! q# _: m* n
        ;; display major axis vector
2 q% s; ]) T7 g" Q2 J        (set_tile "Majraddirx" (rtos xx))4 Q( \3 _% T. O" ]
        (set_tile "Majraddiry" (rtos yy))
# i+ F9 t; H: f0 c7 m9 @        (set_tile "Majraddirz" (rtos zz)); H8 K- j8 a* G. h  A5 ~# E/ j% Q

8 _# Y: d7 w  a4 c        ;; Convert start parm to start angle
; N6 @4 h: s6 u& w/ F3 U2 u        (setq stparm (cdr (assoc 41 elist)))
; l1 e5 g4 C! _, L        (setq vecx (cos stparm))
3 Y$ H6 V6 v' l+ E% B8 X        (setq vecy (sin stparm))* B1 l: G2 e) Z
        (setq st_ang (atan (* rrat vecy) vecx))  |# n1 R0 R5 H5 S, U! i
        (setq tempst_ang (ai_angtos st_ang))
/ _. n3 n" x* \, @  E3 t4 ]6 g& W$ F" V# f        (set_tile "st_ang" tempst_ang)! b6 x  m1 j: A9 R
        ;; Convert end parm to end angle. If end angle evaluates to 0( n7 L: D2 _3 ^. x9 J
        ;; degrees then display it as 360 degrees.
- U$ q" j0 ?& q+ N8 c3 C; N        (setq endparm (cdr (assoc 42 elist)))
5 G/ v* D) K, T/ G. m* u4 N9 v$ ?4 w        (setq evecx (cos endparm))/ T8 X; b3 e$ }& V, G2 r5 i# w
        (setq evecy (sin endparm))1 E5 @% Z% I$ W& z( y
        (setq end_eang (atan (* rrat evecy) evecx))$ W. f6 j9 u( f. |
        (setq tempend_eang (ai_angtos end_eang)), ]5 Z/ d" S* B( a" T
        (if (= tempend_eang "0")
1 o# ]0 b6 ^3 g/ ]' E            (set_tile "end_eang" "360")5 c* [% c% H* Z( k3 B) q9 \
            (set_tile "end_eang" tempend_eang)
$ T! d8 y$ w" H- W3 p        )
$ r! K' Y; Y, p; ]        ;; Get area of the ellipse.# y3 u# Z6 _) K; ]+ a. p5 y
        (ell_calc_area)
4 J# v+ X$ P5 u, k  )
8 a2 |0 c* V: t: y. B$ p9 v  ;; Calculate area of ellipse. If it is an arc then8 B8 S- U& r9 F8 l! f, A
  ;; grey out area display.
# K0 l  P- K9 P2 U  ;;
( m7 C* L, b0 l; ]  (defun ell_calc_area ( / area units)! H9 e1 C4 f6 N
     (if (and (= tempst_ang "0") (= tempend_eang "0"))
6 C0 P; A( s) `7 l1 E& Y" W         (progn7 g  K' {+ ~3 m) u9 P* \
             (setq area  (* pi majrad minrad))
, J. H& S# R) E8 d( [* j             (setq units (getvar "LUNITS")); B! f7 K( `- J
             (if (or (= units 3) (= units 4))
; Z7 X! C+ V+ u% U                 (progn
2 ~- e5 R4 G5 j. q8 ?5 S                     (setq area (/ area 144.0))% }" Z2 D5 ]8 p  i& e9 u
                     (set_tile "Area" (strcat (rtos area 2)" square ft"))7 @  A6 J* {0 b- `2 ?, }
                 )# f7 H8 A9 O8 i8 Y5 D! H# b
                 (set_tile "Area" (rtos area))" Z; z5 _2 K3 o! G0 p9 X4 H
             )
+ {) ^; S4 X; L4 a. b4 }% I, z5 ^         )
, |. z0 C$ A5 ^3 ?" B. Q: ]6 C% {, \        (mode_tile "Area_text" 1)
' n' t( `( z$ Z) V; R$ G) n4 G     )# N* \' ?7 T- M
  )
  M$ ?0 }1 y6 O$ ^0 b. L& F  ;;# W/ R2 I$ v3 ?7 `8 J1 Y: L
  ;; Calculate new values for ELLIPSE9 }: G; t! [6 a: E. Y1 T
  ;; Minor Radius, Area( ~! o5 b$ m; S) J( {4 ~, x$ r3 Y
  ;;
% S: U$ @/ h4 S2 U' i5 B  (defun ell_calc_newval (ell_tile)4 p  h+ J3 N" g% P" M6 E; E
    (if (= ell_tile "majrad")' s3 a3 C  T$ |- Q7 [" D1 c
      (progn
7 D. b* R0 z! R& R: _         (setq rrat (/ minrad majrad))! Y, \" _3 ?1 u! h) B
         (set_tile "rratio" (rtos rrat))
2 G) Y! l1 I0 S: A. p         (ell_calc_area)
6 E* _/ @3 P, D" H7 \; A9 @* m( ^      )
, @. }. z8 q5 s. P, B; a  P, g. m    )
! P- O. K* F9 W" l    (if (= ell_tile "minrad")/ K3 E1 g, O$ J; ?% X/ t# _
      (progn% o, w, G: ^' r
         (setq rrat (/ minrad majrad))
4 w+ T; P* Y- n8 K" b5 G  {         (set_tile "rratio" (rtos rrat))
! X0 [' Z- `2 w6 _2 u* X( E) c         (ell_calc_area)$ b  u. v8 d# i/ N
      )
) v4 A  P: ~+ a& i* @; c3 r    )
$ p# J+ F1 e( F" P5 d  )
1 A3 v+ ]3 Q2 F, J+ N2 \; e7 e0 m" s7 h  j
  (defun set_dimen_props (/ loop a stl txstyname)
/ Q; \. B6 Y* X9 Q' \2 ^8 c. J0 I/ `
$ \8 |& ^. c+ J5 h) N3 [    (setq stname (cdr (assoc 3 elist)) ; get style name
8 _" K1 o0 y: ^4 M  E1 i          stl (tblnext "DIMSTYLE" T)6 A% q# [3 U3 z6 L
          stlist nil)
& E$ }6 n/ A! M" S# c    ;; Get all style names and list them in alphabetical order6 P6 O2 P- Q- e8 W4 h4 f" X  }
    (while stl
% f' |; z3 f1 T" D% `      (setq sname (cdr (assoc 2 stl)))
, g% ]; i* m3 k/ P      (if (/= (logand 16 (cdr (assoc 70 stl))) 16)) m% x  e$ U+ J, E
           (setq stlist (cons sname stlist)))& a: t& G6 |2 e7 A+ ~" a+ Q1 W  |
      (setq stl (tblnext "DIMSTYLE")))0 E! r/ N  k7 `+ g0 m3 M

/ M: J7 x. j7 L# K* L! `    (setq len    (length stlist)" Z% c9 F. E6 q. O* p
          loop   0
% n; G6 C3 B7 o          dimsty stname
) q- N1 e$ \0 n1 B% c: }# ^% v    )
& M3 T) d$ [3 C" X7 [7 w
7 W, ]1 x3 |2 |0 X# E    ;; alphabetize style list, depending on maxsort
) c4 T' ^; N# ^, y) T& h    (if (>= (getvar "maxsort") len)4 F  D' Y0 j( s6 e& [8 `; _: G$ h
        (setq stlist (acad_strlsort stlist))
  H0 b8 B2 c) I0 B' q- `9 v  a5 u; |      (setq stlist (reverse stlist)))/ }! U9 Z& w( ]
9 {/ n) t) y1 V% u' B
    ; *UNNAMED style (dimsty = nil at this point) is replaced with
; q; d) [4 ?4 v  O3 m, E    ; the current style.  After R13, we require dimensiosn to have a
& V8 N7 Z" L" L; M! Z. W    ; dimstyle, so we plug any holes where we find them.6 _) V) B" Q2 m( _
    (if (null dimsty)
5 U' [5 k, l$ D! n" ^      (setq dimsty (getvar "dimstyle"))6 T* a3 z3 {7 F! E) h8 j
    )$ \9 ^% c# t: A. p
    ; Show the styles in combo box
7 F: K4 Q9 L6 A) \; A6 D5 @    (start_list "mod_style" 2)  P  s) Z9 [3 l; Z$ c/ F
    (while (< loop len)4 s( T/ p9 v: q& B( Y, L' h" U
      (add_list (nth loop stlist))
( F. c8 J: Z2 q9 g7 \, K      (setq loop (1+ loop))
0 M8 j  n5 k3 s, V) V    )) w. I3 E# O0 ^0 R
/ _* M1 Q! e( X8 @
    (end_list)7 t4 m- w  V8 j) i6 }- a

6 Z/ Z6 D: t6 }    ; Hilight the style name of the selected entity
: [* ^. \4 @5 r  r    (while (and (< 0 loop) (/= dimsty (nth loop stlist)))
/ R1 B: \2 M7 r- g      (setq loop (1- loop))
8 }3 K# S- H$ S( Z, q' g    )
. g  S( b9 p, k/ f' w    (set_tile "mod_style" (itoa loop)). I0 P, U& \8 [+ o5 d, c. x
+ y: [5 }* D5 Z7 O# n7 `/ E
    ; The following is the list dimvars. It must be sorted in the same3 ?5 e( M6 |& n" P0 u
    ; order as the resfub returned from DDIM (ADS module).5 X. S+ U! T9 r

& l  j( b2 \7 i- K  _0 Q  R5 B# a0 @    (setq dimtbl (list "DIMSTYLE"  "Style name"  "Standard flag values"
" P( q, R4 z; B% f. n0 r        "dimpost"   "dimapost"    "dimblk"    "dimblk1"    "dimblk2"
! q. U) j+ f* \( h- Y: g9 Z        "dimscale"  "dimasz"      "dimexo"    "dimdli"     "dimexe"5 }; a- t: n: p
        "dimrnd"    "dimdle"      "dimtp"     "dimtm"      "dimtxt"
; @" I1 O2 g& B' O" F        "dimcen"    "dimtsz"      "dimaltf"   "dimlfac"    "dimtvp"/ `5 v$ l! }4 j) L* b: Y+ {" N
        "dimtfac"   "dimgap"      "dimtol"    "dimlim"     "dimtih"
: d- m( I1 M" o; h- \        "dimtoh"    "dimse1"      "dimse2"    "dimtad"     "dimzin"3 X8 P; P# X! r8 r0 ~& R9 \6 n! G
        "dimalt"    "dimaltd"     "dimtofl"   "dimsah"     "dimtix"& {4 u+ F7 K3 ]) j
        "dimsoxd"   "dimclrd"     "dimclre"   "dimclrt"    "dimunit"( U  {( j9 q5 N* L- v; ]/ i/ j
        "dimdec"    "dimtdec"     "dimaltu"   "dimalttd"
# _! ^: b$ Y) P5 V        "dimaunit"  "dimjust"     "dimsd1"    "dimsd2"     "dimtolj"
$ r$ ~, p; R: C* c, S. N: I' o        "dimtzin"   "dimaltz"     "dimalttz"  "dimfit"     "dimupt"$ m/ x3 h% k/ Q; K( a
        "dimtxsty"
3 ^9 W8 Z0 L- V- P: l3 z    ))& b# ]6 J  x7 X7 u$ s: r6 V* o
    (progn
1 R% [. f8 P2 z2 w        (setq sv_dvlist (ddimen_getostate dimsty)4 F1 D+ M& R' Q# ]+ L( f
              txstyname (assoc 340 sv_dvlist)+ d& J( Z! ]! t; I1 c$ i
              sv_dvlist (subst (cons 340 (tblobjname "STYLE" (cdr txstyname)))
5 A6 M/ W& g' q: P                                txstyname sv_dvlist)
* P- S$ Z% A! v$ ?              dimlist sv_dvlist& U5 K5 X3 N. [+ R
        )% G  u, E4 a: X
    )
+ E6 |- v+ A6 i. [1 r0 Y3 B    (if (= dimtype "DDLEADER")/ _- ~9 r: j5 C: _5 t
      (mode_tile "mod_format" 1)
+ U2 A4 N2 e) V    )
3 A( y2 X2 |) A1 U2 v( Q    (action_tile "mod_style" "(setq dimsty (ddimen_style))")# a' N; u" M9 p$ C
    (action_tile "mod_text"  "(done_dialog 4)")8 m) G' r5 _8 r8 Z
    (action_tile "mod_geom" "(setq dimlist (ddimen_dlg dimtype 11 dimsty dimlist))")
) J& @8 W4 r% s* }3 G$ e) T    (action_tile "mod_format" "(setq dimlist (ddimen_dlg dimtype 12 dimsty dimlist))")9 b7 }0 }4 E3 M  A: L" S
    (action_tile "mod_annot" "(setq dimlist (ddimen_dlg dimtype 13 dimsty dimlist))")
+ t- o+ j  C  x5 e9 A& f# H    (action_tile "accept" "(done_dialog 1)")
$ R& \% e0 b! Y2 j6 H& z1 x  )
6 M& N. B1 i- U# A  ;;. T% R! K5 w: d: X
  ;; Get dimvars that have been restored.  y3 M: R/ k1 d0 k9 ]+ w: {0 T5 q" m
  ;;! S+ M1 R- r3 E' u- k/ D% R
  (defun ddimen_getvars (/ elm dvlist dv i)
2 _" c3 ~" b6 a$ v3 F8 d+ e    (setq i 35 m. A4 x3 {, B" r* y
          dvlist (list (cons 0 "DIMSTYLE")
8 Y$ z1 o, f' x$ g, I0 ^3 A- N9 X( y                  (cons 2 (getvar "dimstyle")) (cons 70 0))
6 ]7 N, N. f4 X8 G2 K% \$ o    )6 t8 T# }, i7 s4 i
    (while (setq dv (nth i dimtbl))
  S& o! u" i& J3 Z+ k, q) M" T      (setq elm (getvar dv)
5 Y* P- I0 j1 `1 o3 X8 U+ }            dvlist (append dvlist (list (cons dv elm)))/ k: V3 H! D6 f- s& u
            i (1+ i)8 R  l' M% m. T% G
      )0 K# M8 g. D7 G" C
    )* K; Y0 @, p& L; Y8 ?
    dvlist
8 s/ [" Y- s, x9 ^+ c; j5 E  )0 y4 H, |6 }. W- B7 C6 _9 V  }
8 x  y" J, e; m
  ;;
; q+ v- B, A; R- J6 ], e  R1 i  ;; Get the original states of dimvars. This is for DIMENSION entities.
1 Q/ |7 }+ Q8 G% H# Q2 t  ;;
/ f5 D2 S# q& v. R1 b2 W4 W6 d  (defun ddimen_getostate (dimsty / dvlist elm i dvvars)
0 G) v1 t! q! a8 U    (setq dvlist (tblnext "dimstyle" T) ; Get a skelton list
: C$ V- T3 }; q) {( T3 c' M          dvvars (ddimen_getvars)       ; Get dimvars for that entity! K: \: ~' [: n: q* f) W" G3 v8 p
          i 1% ~: S, k7 y) u' I
    )0 q& h, Q2 u/ d& f. ?+ A: i% Z# T

" w; K) b1 t* a- |7 T9 ^: n    ; Create a list that contains values of the selected entity.. ~- C$ W& Q. H
% s3 a9 i/ G" c
    (while (setq elm (nth i dvlist))4 R. ^* y% g1 h8 a# x! c
      (setq dvlist (subst (cons (car elm) (cdr (nth i dvvars))) elm dvlist)
- y$ Q6 Y  h+ t- s3 M            i (1+ i)
  \# W& Y! t& w* S& m6 `5 K      )9 Y9 p9 p1 E+ Q4 u% \. E
    )* I' X" z4 z& v* A8 y" `0 y8 ^& h# m
    dvlist
" d) T7 U- r8 {3 A1 T9 P  )6 i6 J2 n  G8 Y8 y0 y6 v9 D

: `( c$ [/ k- ~& V/ l" s0 d  ;;+ @+ I, x, y9 J! R0 e* i
  ;; Restores dimvars of the selected enity.5 t4 [% W" G$ H) c: l) L
  ;;
1 \( f5 e# Y$ n  (defun ddimen_dimsty_restore(/ dimtbl dimsvcurset en)2 y( g/ W6 _0 l; s2 R3 L$ m# P
    (setq dimtbl (list "DIMSTYLE"  "Style name"  "Standard flag values"
& U9 ^" q1 }+ K; C. G8 j        "dimpost"   "dimapost"    "dimblk"    "dimblk1"    "dimblk2"
# B4 e/ U* e% v2 I7 B        "dimscale"  "dimasz"      "dimexo"    "dimdli"     "dimexe": m; s& f% w3 ^" h
        "dimrnd"    "dimdle"      "dimtp"     "dimtm"      "dimtxt"
: J4 A* _' d0 I        "dimcen"    "dimtsz"      "dimaltf"   "dimlfac"    "dimtvp"9 Z4 X2 \& ]9 G  i( f+ C( i# G' c
        "dimtfac"   "dimgap"      "dimtol"    "dimlim"     "dimtih"
5 F8 {) V1 x  o5 D% r# F, s* f        "dimtoh"    "dimse1"      "dimse2"    "dimtad"     "dimzin"
9 ]' x+ p1 u) q$ S4 g2 l        "dimalt"    "dimaltd"     "dimtofl"   "dimsah"     "dimtix"
2 H9 ?2 i8 z& z% y' R! r        "dimsoxd"   "dimclrd"     "dimclre"   "dimclrt"    "dimunit"
# L+ G0 @" T' S% m) h        "dimdec"    "dimtdec"     "dimaltu"   "dimalttd"! h5 ^( h; N# C4 q* m  ]/ {8 M
        "dimaunit"  "dimjust"     "dimsd1"    "dimsd2"     "dimtolj"- r. B2 s8 N; u4 c% ~: E
        "dimtzin"   "dimaltz"     "dimalttz"  "dimfit"     "dimupt". ~9 Y" |5 E9 N3 C2 j9 `
        "dimtxsty"
; P7 R% ^2 Z* d: y% N7 ~# h5 o; D    ))
# x- U8 Z; ^7 L    (setq dimsvcurset (ddimen_getvars))  ; Save current variable settings3 X! y" K- E1 p7 m- _
    (progn
4 Y! J* q* @3 O9 G4 o3 f* ]$ ]. r: d# A* y        (setq en (cdr (assoc -1 elist)))* ]" y# k+ D3 ~6 k! |  }9 `( k1 I
        (command "_.dimstyle" "" "" en)+ U7 z1 d1 y6 {1 T
    ): |! Y: b% p3 K* j; f
    dimsvcurset3 y. W% N* {; r7 S
  )! M  M7 L1 @, Y- i1 j/ |, s5 H1 {
  ;;0 r/ X+ _1 U' G
  ;; Modify Leader
6 p9 K7 v& d6 O" Q, {, Y, Q7 {  ;;
3 J- m' P3 y; _" W  h( @" }8 W  (defun ddleader (/ dtypebit blkname bename sublist a  stname n dimtbl) O8 m/ E, N+ s& K
                   dimsty dimlist dimtext svtext dimovr sv_dvlist stlist2 j, j0 j$ T4 Q; h% v1 s
                   dimtype dimsvcurset)$ d+ N. |; j4 Y0 i# N
    (setq dimtype "DDLEADER"
, x! z% k' }, d& V4 n" R9 U- a3 m          dimsvcurset (ddimen_dimsty_restore)
. W' O9 X2 O! q& F+ x    ): f* Z# |& ^- t" C. O7 u$ A9 R6 Z3 u
    (if (not (new_dialog "ddleader" dcl_id)) (exit))& E6 N, I: m3 F* X; T
    ;; Set initial tile values6 R. ~9 W5 y5 D2 }9 U' I
    (set_tile_props)
( A1 \! W6 W1 ?  b    (set_dimen_props)+ h" `# b1 W6 l
    (set_tile_handle)0 }0 U: V/ q; K7 B
    ;; Define action for tiles
+ B0 X0 s( A; o8 i/ C4 Y, ^    (set_action_tiles)6 |- d3 t, p- |" Q7 Q
    (mode_tile "mod_text" 1)
  m. w, [6 f; G- u" Y8 L% O. k0 O/ e; J. N6 ^
    (action_tile "mod_style" "(setq dimsty (ddimen_style))")! ?7 c$ x) X7 g9 T2 N) L
    (action_tile "accept" "(setq leadtype (get_tile \"s-s\"))(setq arrow (get_tile \"arrow\"))(done_dialog 1)")$ b) _+ C4 `6 N: {
    ;; Get ARROW and TYPE.
* A' m, b! X1 ]9 \) {    (if (= 1 (logand (cdr (assoc '71 elist)))) (set_tile "arrow" "1"))
& S$ j# S$ u4 z; @) R    (if (= 1 (logand (cdr (assoc '72 elist))))$ K/ K, Q0 h' r( j. @
      (set_tile "s-s" "spline")
& r3 B! t- Y- H      (set_tile "s-s" "straight")1 Q, R+ s. K' g& M) {: s" R
    )
) S, u% b1 W  b% Q    ;; Start the dialogue.6 v5 o- a' |  Q" p) g
    (setq dialog-state (start_dialog))
$ L* f! |! K9 t+ v  P    (if (= dialog-state 1)) R( a, `0 s) b, R0 t. t
      (progn
0 {) Y: i& j* q+ D        ;; update the style
  ~$ p2 D$ v* n        (if (/= dimsty stname)
6 X5 X* r+ ^: i' S4 u5 f          (progn
) _+ I2 L: R6 V            ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case+ P2 \5 Q5 d6 T0 r0 h8 S9 U
            ; doesn't have it.: Q  p  |, E- N; B
            (if (null (assoc 3 elist))
; x. w5 a+ P* K- m/ p; c              (setq elist (append elist (list (cons 3 dimsty))))
6 i7 ^; @) b  [8 s) \6 M& ?( E              ; else just replace it.
" H5 S# w; B8 ^. j! T              (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))) G1 l+ P- v4 S5 ]" ]2 ?3 a
            )* v& ~2 j* b5 W( a
            ; refresh sv_dvlist with new dimstyle., _0 F9 n' L: A- L
            (setq sv_dvlist (tblsearch "dimstyle" dimsty))
7 [. @( ^+ K- S2 l7 O          )) i3 o: l6 `& f+ g: U1 M
        )
3 m: i3 d  C# V1 ^+ l' g* R# n        (if (not (null dimlist))   ; attempted to change dimvars$ C. ]. F+ k" I1 R" o
          (ddimen_complist sv_dvlist dimlist dimtbl)
4 f: G5 H0 f# \4 o0 F  [+ h5 A        )
. x: o! U! U* d7 m        ;; update for ARROW.
9 f2 \% J2 t  n; }* @+ n        (if (= "1" arrow)
( e% \6 Z/ D# ^2 B          (setq elist (subst (cons 71 (logior 1 (cdr (assoc 71 elist)))) (assoc 71 elist) elist))
7 n* v/ \4 B* ?          (setq elist (subst (cons 71 (logand (~ 1) (cdr (assoc 71 elist)))) (assoc 71 elist) elist))
- e$ @: |5 T) J1 N7 T/ _- F( R( {        )7 |! k* r+ K, C; ?0 N. I- M
        ;; update the TYPE.6 e) C2 a5 J# s$ H& z1 b
        (if (= "spline" leadtype); e& d! g% E8 `* V
          (setq elist (subst (cons 72 (logior 1 (cdr (assoc 72 elist)))) (assoc 72 elist) elist))
$ k) \8 Q! }# S  l  j8 ~$ M) u4 q          (setq elist (subst (cons 72 (logand (~ 1) (cdr (assoc 72 elist)))) (assoc 72 elist) elist))+ O% E/ I  i% \4 R
        )
0 R6 {+ e% |: l* f        (modify_prop_geom)
, d' z1 k$ w+ Y5 ]2 y& k3 d7 Q4 y) A        ;; update the Color
+ x, v6 H% w  Q+ G( T* G        (setq elist (subst (cons 77 ecolor) (assoc 77 elist) elist))! N! P; _  q5 K. _% F
        (entmod elist), \% Z1 J) p1 j% E& N' i# B
      )5 K& ~) u* v+ \, `7 A! s
    )7 n4 z3 y) N! D3 T2 s  r) e! w
    (ddimen_setvars dimsvcurset)      ; Prepare to exit7 M* P6 B+ Y5 [0 s
  )- Z) ^) J. n) N3 U) V3 V8 D

# P3 Q' q( r% [! X  ;;" r# N% ^% T4 k
  ;; Get dimvars of a dimstyle with overrides.9 u5 z; `! J' q  w0 w8 r
  ;;
! o" `8 U4 D+ A) |8 `& r5 |) }' Q1 M9 U. C4 l
  (defun ddimen_getdimvars (dimsty / dimovr dvlist elm i)
0 o  |: [1 d: ~5 h2 l, M7 T
& Y: P% p2 l  {7 I" f. F. ?8 j    ;; Get override information for the specified entity.
3 q2 p9 f: I  B; g5 t; ~( }) u    ;; Leader/Tolerance cannot be restored by DIMSTYLE command, so we" D7 t- u) O9 Z' \
    ;; must obtain override information through this tedious operation.: x+ O9 w5 V* J% b( F
    (setq dimovr (car (cdr (assoc -3 (entget (cdr (assoc -1 elist)) (list "*")))))' @9 k) V5 l; N% f; W# p7 H+ r
          dvlist (tblsearch "dimstyle" dimsty)
5 e9 Y2 f. k6 w* |1 _  j+ i          i 2
  V" k: T' v% x, A    )
9 W! ~+ C% e: s% m( H$ n6 H
5 T( {3 b2 P# j7 W; W    ; Update the list with overrides if overrides exist.
; u+ S+ y! I2 ]" b8 \/ e) Z
; F) f5 h- a: p2 Z! L7 i9 W8 H4 s    (if (and dimovr (= "DSTYLE" (cdr (nth 1 dimovr))))" ]6 X9 Z& L! w! ?/ M" ?0 E
      (progn$ `# Y+ J* f6 c  t
        (while (setq elm (cdr (nth i dimovr)))* t* L6 r9 I5 y' {
          (progn! A4 ^: d# I! @. p% f' b9 P
            (if (or (= elm "{") (= elm "}"))
2 F, A. S+ z# H5 U              (setq i (1+ i))
% F+ g1 P% @; _* H- @3 r) h              (progn: G6 g) O) \, B! J6 P
                (if (or (and (< 180 elm)
# k, \" Z9 l  k/ Q                             (< elm 190)
. B8 a; f0 a7 e) z4 D                        )
3 B. ~! m& M/ r4 Y. j                        (and (< 80 elm)  g3 N, k" V% x: R: T. x
                             (< elm 90)
6 y" m0 _2 |# y5 j8 z8 \                        )! x" m! G. ]. K9 |8 A: c& F
                    )
# w5 y; q+ e& l# s1 V                  (setq elm (- elm 10))
1 b7 w  M( w0 S4 e. N                )
1 t% p  ~. |4 y- J+ W* T- `  H                (setq i (1+ i)
! L* B. m! s) `1 P3 q) d. x                      elm (cons elm (cdr (nth i dimovr)))
8 k" }) P9 ^; D( d                      dvlist (subst elm (assoc (car elm) dvlist) dvlist). Y# H6 S* C- Z0 w4 I
                      i (1+ i)
  ]/ S6 c5 y8 k' X5 n                )
7 T( f. g2 J0 [1 O6 F6 L              )
" e& M/ f5 p0 W, O            )3 v9 [3 x. X/ B
          )$ U- x7 y& k( k6 i  H" A  j
        )
4 j. f* ?" C7 D$ l. b      )9 c) [- D% b7 M+ I9 o; q. L
    )
% c. f( ]/ s; B" q( M, ]+ ?6 z- s' J    dvlist
4 `- k- }1 A& k: J% Q2 Y9 c  )
6 D/ }+ `# x& A# ]' H: ?% q
5 P4 I; I: Y8 @, K  ;;1 M! y% ?) r2 E8 \
  ;; Modify POINT
, K/ X' m; y' b! \1 u$ t  ;;, |/ y3 P( ~) T8 }
  (defun modify_point ()- ^( S) F* c. v" F' n
    (modify_properties)
1 S, U+ @" L6 K& {- I) ^    (setq pt1 (list x1 y1 z1)), \9 J& q! z- `7 v; e! n, R( \
    (tempmod pt1 10 0)
" B" R' p. x6 w) C% H    (entmod elist)5 Q$ T5 W0 S6 M" Q5 H3 L3 [+ _; P- h
  )* r% t+ L  q! T' i, a. X& K0 _
. B5 G0 _9 K' k$ Z
  (defun ddpoint ()5 m0 B6 a' s9 f$ R# ^0 Z, `  ?
    (if (not (new_dialog "ddpoint" dcl_id)) (exit))
( i! i9 y6 i4 W, U* F    ;; Set initial tile values# B) {0 F/ n& Z9 Z5 g5 t
    (set_tile_props)
: J+ r0 u7 I) ?  f- o    (set_tile_handle): p( w. ^" ]1 M- p( g/ h: f
    (set_tile_pt1 0)
1 n( w7 a0 x5 [: U    ;; Define action for tiles' X  L) E9 p$ j% |  l8 |
    (set_action_tiles)! ~; t' P8 J0 j
    (setq dialog-state (start_dialog))
0 I) r8 L/ ~/ W3 I    (if (= dialog-state 0), D# i! W# n/ x& p% C
      (reset)
+ {) R1 ]- K8 U/ s  e    )
. [/ v7 T" U6 O( x$ @( V9 D, F    (if (= dialog-state 3)
: e6 g9 B) V8 Z6 j0 T% y. B7 w      (progn$ w+ N' A, W+ u" @% r  G  T
        (modify_point)4 s7 [6 V! M( c/ @
        (setq pt1 (getpoint (list x1 y1 z1)  "\nPoint: "))% ~/ [4 q' e! I2 j
        (ver_pt1 0)
. ]- Z2 F; [' L8 o$ N        (ddpoint)' l: n4 ]7 B( G, z  T3 G9 E2 k
      )
* J$ Y- F- s- e0 o5 U$ Q1 a    )6 t8 g' p4 d" e/ G
    (if (= dialog-state 1)
8 P. z& C9 u$ k! |8 O9 P      (modify_point)
: z  \- P7 Q7 h    )7 z" n  U7 Y/ A# ^9 F2 j
  )
* E& y+ d3 ^" u6 T  ;;
+ O( O  q* V1 M2 j  ;; Modify LINE5 x% s, @) H( I5 i4 w
  ;;
9 [& N2 s, n- }  (defun modify_line ()- a* _9 ~+ A8 f9 n; L9 Q0 [$ n
    (modify_properties)7 ~9 r% |/ y3 J. R& ^0 ^
    (setq pt1 (list x1 y1 z1))# b: O( Z( Q& V4 f5 Z
    (setq pt2 (list x2 y2 z2))
: s/ f" O. D" X8 u- [* x0 q) x    (tempmod pt1 10 0)/ R+ B6 G1 o, E6 O
    (tempmod pt2 11 0)
/ x: R& i& z$ E3 O- o7 j, s0 D    (entmod elist)
1 }% z) |: C- m+ t  )4 L' v' [7 D1 i9 ?. }. R; d+ W3 j
  (defun ddline ()
. H1 w) O+ p: x2 `    (if (not (new_dialog "ddline" dcl_id)) (exit))
0 L& T9 k) \9 l, m, q/ M2 C    ;; Set initial tile values$ N: K7 e. W; ~; d; G7 N
    (set_tile_props)
! G8 v# K0 S: i. _    (set_tile_handle)
2 E  W7 w. c; N: R1 O+ {  [6 w    (set_tile_pt1 0)
- u( ?, R/ e& }: C5 I5 e    (set_tile_pt2 0)0 K1 w; D, }1 N6 ~. X3 Y4 Y
    (line_calc), E' u9 }& Z1 ?& `4 [$ R
    ;; Define action for tiles
$ E& a- ~/ ^, D8 Y* N    (set_action_tiles)
' Y! ?8 i* [3 L) }" Q) i0 a& ~7 Q    (setq dialog-state (start_dialog))
: I3 V) t9 q4 `$ N" N( E5 q    (if (= dialog-state 0)
+ }& ?% z6 i5 X/ }% K( q      (reset)
& B- N5 `0 [9 `& g% h    )+ f+ f( H! c9 f+ H
    (if (= dialog-state 3)
3 q6 D1 |) v/ T, ]. W      (progn# Y) `: J$ f* D3 W6 s
        (modify_line)
4 d- h; [4 G- t. w) c        (setq pt1 (getpoint (list x2 y2 z2)  "\nFrom point: "))9 T1 v6 d* S  w7 H* ^. ?
        (ver_pt1 0)
- w; R' N. U# O# b% t        (ddline)" S3 R! K" P# Q+ n
      )% ~' C) Q. Q5 d; n
    )
- t/ k/ M8 \' A$ C' r9 \5 x' ]/ j    (if (= dialog-state 4)
9 Y: G# w, _* S. \; }' S9 H      (progn# a4 t' D; I9 i, p; [
        (modify_line)7 G# C3 K* {$ m# a' T
        (setq pt2 (getpoint (list x1 y1 z1) "\nTo point: "))
3 D# d7 S: r2 h9 Z; |        (ver_pt2 0)
$ K2 _1 s0 W) @* e. ?3 Y" w9 V9 _        (ddline)2 v2 V0 W; \7 L, g5 f* M, {
      )
) b7 X! z2 n& O5 }# X$ [    )
! v; A" Z& o$ u1 R+ }- f    (if (= dialog-state 1)) K0 F( `( V' {4 F
      (modify_line)
/ B+ I" E: Y) u% n+ J9 ]    )( H* p2 v& T1 U5 M. A& M
  )
& }% c7 y6 j+ Q3 r8 S  ;;/ ]3 I( }) I0 P
  ;; Modify MLine
+ e8 a# B6 Q2 l- [/ c: ]. I  ;;
: w7 |/ F  Y) k9 ~; e" l5 I' U! L4 _  (defun modify_mline ()5 |9 E' R: z. x
    (modify_properties)
. B' X8 {6 N, A  {8 _    (entmod elist)
7 v4 g% {% q. u/ g; I  )3 I3 q' h; y! V/ A
  (defun ddmline ()( x0 w! K* V+ V# z
    (if (not (new_dialog "ddmline" dcl_id)) (exit))
/ b& N3 a# X0 ~9 v6 W    ;; Set initial tile values* m. `1 a! d& j7 {) B7 G
    (set_tile_props)5 `. L6 a8 Y" {. ^. v
    (set_tile_handle)( `/ a3 x- t1 A6 {( ]
    ;; Set mline style text field.2 C2 N/ {/ G& i/ B6 ~5 Z
    (set_tile "ml_style" (cdr (assoc '2 elist)))
9 q8 O* G; J: A, O9 g5 Q7 r4 n
    ;; Define action for tiles
- e, S) _/ J  a; @( f! t    (set_action_tiles): ?7 q% n3 Z: v% Q. {6 T
    (action_tile "ml_edit" "(done_dialog 3)")- M' c. W3 F# G& x
    (setq dialog-state (start_dialog))
8 ~5 u5 C0 ^0 t7 s    ;; Dialog cancelled, reset to original values./ U( _6 [$ }. `$ v
    (if (= dialog-state 0)
  k7 f8 q6 g/ ^  d2 A; e      (reset)
; N- q  I; X, K    )  l$ |2 P, X2 Y$ j7 b, d
    ;; Dialog OKed, update the mline.
: g; [1 b/ L2 V) ~9 u9 l    (if (= dialog-state 1)0 R0 y0 N+ p4 V9 Y
      (modify_mline)
& S( V  w# H& g* i; p7 p; }' E  \  d    )* @2 y: n" }6 I. A$ O4 ]
    ;; Edit Mline, call MLEDIT.
; H2 q0 I( V1 r    (if (= dialog-state 3)8 `+ E7 k, J' @  @! f
      (progn+ h. @  z6 F' c1 r$ |
        (modify_mline)3 M/ F9 z9 c) b" Y
        (command "_mledit")5 {/ C6 v6 t. `% G
        (ddmline): Q! G- Q) J& F& x
      )1 i% c3 |$ q5 i- Q
    )
6 W1 v! A! M/ `: E) W( K  )
) `0 ?7 M6 b7 C) a. a  ;;
. w( I/ b) H# g: S  ;; Modify Xline, ]& f2 B2 [0 y" E* h
  ;;" q, \- G, @8 |$ [, r
  (defun modify_xline (flag)
, Y/ n9 l3 h$ u2 |    (modify_prop_geom)
  U/ g8 V: z2 G1 w( z) Y( S& c    (setq xline_pt1 (list xline_x1 xline_y1 xline_z1))
% P  p( }1 s1 |9 U    (setq xline_pt2 (list xline_x2 xline_y2 xline_z2))& X5 ?( r  n, `$ H5 a7 p, I0 {
    ;; Update the Root point.- l. `: b6 \1 P; p$ x
    (setq elist (subst (cons 10 (trans xline_pt1 1 0))
1 P- g6 r& |) l& C/ X* p) z5 H# F" Z4 O                       (assoc 10 elist)
% p3 T  v: _9 |6 S& U                       elist6 r: W/ n( }$ u* ]6 P
                )4 R" b1 b4 o" `- b  [) B
    )
) b! Y* ^- {& s: N- A9 W% W" o$ c0 N    ;;
/ g. n. b8 F: ~4 d% c4 C    ;; Calculate new Direction Vector WCS
6 e) x( _& K. F( [    ;; x / (sqrt ( (x**2) + (y**2) + (z**2)     ))0 V4 l  [7 L+ E) ^& F+ r
  H7 G% F1 _) N2 l" f8 k
    (setq temp_dir (trans xline_pt2 1 0))
1 D: g* l7 M" K1 }5 x    (setq temp_dir_x (car temp_dir))
; v2 u2 {9 ], Q- @& H4 D: T6 @    (setq temp_dir_y (cadr temp_dir))
) m; B" }! u# s+ I    (setq temp_dir_z (caddr temp_dir))
$ y2 ]9 a& H0 q  x/ _% P% H" }- R7 t- o* L$ l7 h9 c) o
    (setq temp_xline_pt1 (trans xline_pt1 1 0))  m9 s+ s, Z- R5 h0 {
    (setq temp_xline_x1 (car temp_xline_pt1))
" ]" M, W, I/ l# a, [    (setq temp_xline_y1 (cadr temp_xline_pt1))
- b. n/ X. \3 Q6 m; i    (setq temp_xline_z1 (caddr temp_xline_pt1))/ l' e! W; n/ R# ^

; n, I5 a3 Z/ {  u& W* C    (setq denom (sqrt (+ (expt (- temp_dir_x temp_xline_x1) 2)
6 t1 b2 k8 |* j+ m                         (expt (- temp_dir_y temp_xline_y1) 2)
1 H- X) A! J) [: h9 U                         (expt (- temp_dir_z temp_xline_z1) 2)5 [/ z4 I8 f2 R+ N
    )))
4 N1 ]; H; y' C  X- F1 P    (setq temp_dir_x (/ (- temp_dir_x temp_xline_x1) denom))
- `9 M, x7 w$ u7 u: S8 I+ M$ C    (setq temp_dir_y (/ (- temp_dir_y temp_xline_y1) denom)); g! d2 c0 v; h5 m6 w) j9 `* q5 D
    (setq temp_dir_z (/ (- temp_dir_z temp_xline_z1) denom))% k: P& D/ Q6 `) G3 B
    (setq elist (subst (cons 11 (list temp_dir_x temp_dir_y temp_dir_z))
: i" D+ E. y2 ?% m% ~/ v3 S" K2 z                       (assoc 11 elist)
* Z1 f$ v+ S, {                       elist) f3 W0 m& D, A# [' g
                )' t$ o& Z1 R9 E1 B
    )/ z3 G, D% H$ \: d. K' }4 V
    (if (= 1 flag)
3 D; e3 |. t1 ~2 h      (entmod elist)' N+ [  u1 d8 _' |0 h$ T' B. F
    )
( m# N& p+ T, k) \5 u  )
3 N0 P7 R6 z; W6 b- o2 {) y1 n4 f6 V1 h8 ?4 x7 e) A
  (defun ddxline ()
/ ]3 k/ @( g& Q+ v2 W1 S4 H3 ~    (if (= etype "XLINE")
: `3 W* M4 h, ~      (if (not (new_dialog "ddxline" dcl_id)) (exit))
# r2 |* X2 K& ^6 n      (if (not (new_dialog "ddray" dcl_id)) (exit))
* v) `5 Q5 M. @" v& q    )2 j( y9 K8 X0 q3 O- f, S  q
    ;; Set initial tile values
, z0 W0 ]. h% E; {    (set_tile_props)
8 `- @4 g" U& \, S3 G2 [* b; c( e    (set_tile_handle)
1 m, z9 o8 g) A; L    (set_tile_xline_pt1)8 }+ O/ C  @! r0 ~
    ;; Convert to UCS and post Direction vector.
( N) J5 z; ^2 ?) D    (set_tile_dirv)9 T, ~- q' N1 [: A
    ;; Calculate second point by adding Root Point + Direction Vector./ S+ e7 ~  {  {8 X2 @9 Z
    (set_tile_xline_pt2), Y+ k  E7 S# c( v# E3 t5 w
    ;; Define action for tiles
2 i/ {0 _- L5 m    (set_action_tiles)
; Y9 E- y: o! v+ |* f    (setq dialog-state (start_dialog))& z: v) @0 L# l7 p
    (if (= dialog-state 0)! W$ d$ |8 U5 |4 q- b: B
      (reset)3 g2 |, }* A7 R. P, [/ M( [* K! [
    )) A  G0 B) d2 _9 ^
    (if (= dialog-state 3)
9 }. h  w8 n0 W7 n5 s- B9 j      (progn3 T- |  B* n0 y; C9 R; x
        (modify_xline 1)! w: ^& \) a( [& e! |! b0 i1 k
        (while (equal xline_pt2
$ ^* \, n& y3 o7 C5 A9 S          (setq xline_pt1 (getpoint xline_pt2 "\nRoot point: ")) 0.000001)# X: |0 G; \: q: x
          (princ "The Root point cannot equal the Second point.")
4 X+ E" e) V. a! H: x0 U        )8 K! }7 N  `4 z+ L" |1 F3 @4 r: W
        (ver_xline_pt1)
8 U/ u9 C9 n! O* M  K        (ver_xline_pt2)
/ i5 ]* `: `# C$ D; Q( Y  d(princ)3 Q: h7 M5 W0 }5 [( _; n2 w
        (ddxline)7 U, {' r) t) l% T# T9 v' `
      )  B7 `( @# y" ?, O" u. [" F
    )
! w7 q4 N+ R% Q: o8 g# v1 C! \- h; s    (if (= dialog-state 4)
9 L5 ?( V+ I. @! H, R      (progn
9 c7 o0 \, `1 w; _; U* ?5 H- N        (modify_xline 1)
- r4 R/ {3 Y$ T* q. j& J) t        (while (equal xline_pt1, C/ Q9 Y- g8 B2 a* h
          (setq xline_pt2 (getpoint xline_pt1 "\nSecond point: ")) 0.000001)  w+ q' j1 x2 R" N
          (princ "The Second point cannot equal the Root point.")/ A4 K- ~& X; t. x4 B! }
        )9 i1 Y6 C* P3 g! f5 o( `
        (ver_xline_pt2)1 ]; @4 c- o0 q6 U6 _" U# K
(princ)
9 E, r& J, \4 Y+ ?, y3 u        (ddxline)
- m1 a( z8 k6 B6 E0 g0 u4 Z" ]      )2 d$ R+ U% u3 B7 I; d" x' V
    )
: ^9 u' l4 Z. K- v( d0 [! Y1 U    (if (= dialog-state 1)& H/ i% v, C2 X
      (modify_xline 1)
* {  u: J1 q: l. x* ~4 H    ): D' Z2 f4 g% s' Y$ B$ h
  )
: D( _8 i3 j! O3 i  ;;, U  F6 L  d* q7 S' X7 h, R6 h# P9 ]
  ;; Modify ELLIPSE5 A. q3 h2 F# m2 L# X8 }% a
  ;;
" ?" J; R) k' f) X& T4 H  (defun modify_ellipse ()
- @  i/ O' O: u' L- E# @    (modify_prop_geom)  w" k- P1 t, {  U) D6 E
    ;; Update Ellipse Center Point value.5 C1 Q4 F( H6 F0 n
    (setq pt1 (list x1 y1 z1))+ M0 i- @5 I& c. q# f( `
    (tempmod pt1 10 1)
  F1 g! M3 y$ N, L/ W: U    ;; Update Start Parameter value.
) z3 y. w# ?/ u) ?1 R4 H    (setq y_val (sin st_ang))
8 s: s' }( S) s3 t7 y. ^( C    (setq x_val (* rrat (cos st_ang)))% {2 G: }7 _' Z1 {2 ]$ l, a
    (setq stparm (atan y_val x_val))
0 O' Q+ \) @: H- g" E! \    (setq elist (subst (cons 41 stparm) (assoc 41 elist) elist ))# b( g- J0 v* j
    ;; Update End Parameter value. Normalize it, if it's less than( ]0 O' y  q4 r1 R
    ;; the start parameter.$ c/ |6 o% a: o
    (setq y_eval (sin end_eang))
9 Y( x" I/ W7 K1 w' m: c' O    (setq x_eval (* rrat (cos end_eang)))% }, D; S6 S4 ~; T4 _
    (setq endparm (atan y_eval x_eval))
/ u; ^9 Q' |) X8 E+ r    (setq diffparm (- endparm stparm))
9 ?( b5 C8 Y+ }$ p& X1 q    ;; Epsilon of 1.0e-6 radians for checking a zero length arc.1 w3 s/ X# b: ?
    ;; Since zero length arcs are not allowed - construct the full
+ K, c( ?& @' g, q    ;; ellipse in this case.
* b9 s! E+ p( V8 ?* g/ j: P    (if (<= (* diffparm diffparm) 1.0e-12). z* z% ~: Y8 M. T
        (setq endparm (+ stparm (* 2 pi)))) V. E) r5 ^4 f5 E% c9 F- F7 ~
    ), o8 [/ N! s+ w7 C: s+ L
    (if (<= endparm stparm)! G5 E) N& }5 [* B
        (setq endparm (+ endparm (* 2 pi)))
& }3 ^- z& x6 c3 ^7 S, ^    )( A6 X4 \9 n; x# F
    (setq elist (subst (cons 42 endparm) (assoc 42 elist) elist )). y1 f* r/ y) t1 j4 o
    ;; Calculate the Major Axis Vector by first calculating. {: e( e5 R. L# t! K3 ^2 j
    ;; a unit vector using the old Major Radius value. Then
. p% `7 l4 E' {3 [% f% T    ;; Multiplying that by the (possibly) new Major Radius
$ t! f4 `% h4 J% _$ m0 k4 ~    ;; value to get the new Major Axis Vector value.
: D( g9 R8 b% Y- S) ^    (setq unitxx (/ xx old_majrad))
' D" U$ l6 [6 i. P) q  [    (setq unityy (/ yy old_majrad))
% \% o6 @$ C  m6 d    (setq unitzz (/ zz old_majrad))$ M/ r  g" ]6 Z" b: W: E$ V
    (setq newvecxx (* unitxx majrad))0 X% I' b) y. z& m" F: X' ]
    (setq newvecyy (* unityy majrad))
, \  Q8 t( e  f0 K7 o5 p+ E    (setq newveczz (* unitzz majrad))
9 I  _, Y/ \0 w5 a. G; I    (setq newmajaxis (list newvecxx newvecyy newveczz))
" d3 u; P, c: _    ;; Update Major Axis Vector value9 K* D& Z. t" P9 b7 ]" i
    (setq elist (subst (cons 11 newmajaxis) (assoc 11 elist) elist ))
& k0 J( a& X8 z, z5 y    ;; Update Radius Ratio value
6 D6 R* l- C" U4 t  y    (setq elist (subst (cons 40 rrat) (assoc 40 elist) elist ))
! ~6 J: x8 C7 v3 m! O0 p    (entmod elist)& b6 M$ H; x  K1 g- U! A
  )
+ N' L' T/ V! W( U2 n' w: P7 {1 F9 P  u6 I
  (defun ddellipse ()" b! h( ?4 |0 d6 S+ q
    (if (not (new_dialog "ddellipse" dcl_id)) (exit))* L, P" r, ?8 ]: V! r, y- X0 y) b6 X
    ;; Set initial tile values+ I* _3 g# }8 H) k
    (set_tile_props)1 z, x" _9 Z9 N' y6 m
    (set_tile_handle)" U" j2 c8 }$ t! o
    (set_tile_pt1 1)
4 H. }/ s/ u  x9 H' ~6 u0 e    (ell_calc)8 j6 F& |1 N; D
    ;; Define action for tiles% m( h, g! c+ Q6 i6 A: @1 G
    (set_action_tiles)7 v, x1 x# u. \. A8 R" K, Z
    (setq dialog-state (start_dialog))
  c) J- [8 s# {; g+ g' g; O- B    (if (= dialog-state 0). `+ ], R, {) y1 F5 p4 g; ]# q3 e
      (reset)6 e: I* `* J, d: w0 t  U+ t
    )
; o; j& p& {5 |+ v    (if (= dialog-state 1)
8 |6 \4 f5 x0 `6 L      (modify_ellipse)& h: k- n, r  W2 \# k
    )
- ?  E2 e" @4 ]6 n" L; n    (if (= dialog-state 3)
6 R$ H1 [! u# ~+ N      (progn
. D  t' I8 S$ N. x4 d        (modify_ellipse)  V7 Q* C5 [/ ~* V7 L; X7 l. j
        (setq pt1 (getpoint (list x1 y1 z1)  "\nCenter point: "))
. A3 A  R# \8 H* f8 J        (ver_pt1 1)
/ l0 \' L  h2 n' U        (ddellipse)9 x" E0 m6 I: _( Z& V
      )
# d- Z& c9 ~3 k2 E% A1 e8 g. E    ); x& }7 A3 S2 ^* U; H  @
  )' |3 q( e& p  |, ^; h1 z) l% Z
  ;;
% L  \% t/ O2 I9 s1 Z/ E& ^  ;; Modify REGION
( n# J1 b8 i2 s/ m  ;;- p) Z0 D9 ?0 F5 o; T2 J
  (defun modify_region ()+ q6 `- r8 I! e
    (modify_prop_geom)
" X  P' d) P7 U! o6 K2 _3 c    (entmod elist)
2 Q, }2 J4 F/ @4 N  )+ s' c* i$ S8 o0 x
8 H% T+ k' a. f; h
  (defun ddregion ()$ ?9 m" Q' ?: v. l: L8 Q
    (if (not (new_dialog "ddregion" dcl_id)) (exit))
( S: T: j1 D  z1 C; h6 _    ;; Set initial tile values6 N6 x, l* l( _) L
    (set_tile_props)
6 ~( H0 ~5 L5 E, T5 I0 }$ u    (set_tile_handle)( o, f; ]  L% g0 F
    ;; Define action for tiles
: W- q0 |4 y% p7 N8 x0 `8 B+ y    (set_action_tiles)
( |0 K1 V: ^* [+ _" m2 x0 p& ~    (setq dialog-state (start_dialog))' T7 P  z0 ^7 W
    (if (= dialog-state 0)! J% `  T* Q" n! _, h7 @: C3 A0 W
      (reset)3 U! L4 H+ B7 l! f: [5 n
    ). J- R$ r; M# b- }3 t( t
    (if (= dialog-state 1)8 |( z- @# a; y' v- t
      (modify_region)
& D0 z- V* F9 {% k5 u    )# U' I% ?+ n* }; j+ i# w
  )+ y$ }, u% R2 m* D- u* g- Y
  ;;0 f  f: m) I- [2 y/ J& j
  ;; Modify 3DSOLID
. ?9 d7 \  V8 x# u: P9 x9 W  ;;
. f: }4 X* d+ [0 S4 H3 z+ }# V0 j1 h' G  (defun modify_3dsolid ()
  V5 `; M) ?8 {  N/ n% a    (modify_prop_geom)* q0 D7 Z  b5 H$ y0 g6 K9 ^
    (entmod elist)9 G5 f0 J9 f1 e( C" q6 N2 ]
  )$ R4 f: U! G# F8 g  p
1 d) J* ?5 g1 }: Q+ E
  (defun dd3dsolid ()
5 ]0 N+ T' i1 ^  x1 z4 t- z    (if (not (new_dialog "dd3dsolid" dcl_id)) (exit))
! _; ], k, D, I. Q  u    ;; Set initial tile values) x! z( n6 A. @. Q
    (set_tile_props)
- U7 `. B% _  Q0 s7 x3 X    (set_tile_handle)
% ?3 z+ }, R0 v7 A& g6 S    ;; Define action for tiles
; a( v- @4 a9 ?9 X7 {! E* q2 \1 J    (set_action_tiles)
: y  ~" s" l# f7 ~& ^! T& U    (setq dialog-state (start_dialog))
% m3 f8 H; B- e9 a    (if (= dialog-state 0)
- b& {3 F  M7 Y% z% ?      (reset)
# k  [& j! o2 M( @8 W( V    )
+ u2 J+ n9 a9 Z  h) F. W    (if (= dialog-state 1)! C, f3 e! K. c* a4 p; g1 y
      (modify_3dsolid)+ T2 S- f- V- D# o  U. H
    )) q3 F$ j4 w- c5 Q' s
  )
5 f5 Z4 e) @! F# P/ P9 p  ;;2 [5 d9 \2 q2 m5 P  K- V$ q  T
  ;; Modify AcDbHatch
; Z' [' b: e* _4 `6 w  ;;5 Z/ n9 Z7 _0 }5 ~$ j, D6 G
  (defun modify_hatch (), J! y$ N; f% k& d; v$ R$ Y
    (modify_prop_geom)- I  y+ `6 [* J) l% s
    (entmod elist)4 x0 F$ G4 m3 T1 `
  )
0 b8 S1 T, l$ s1 @
% I; T& H4 _9 W7 I. ]! p  (defun ddnewhatch ()
( x$ W5 N3 A: L; J* _# m    (if (equal hatch-elist nil)' W0 l& z) ]7 B8 e7 ^5 G$ O8 r
         (setq hatch-elist old-elist)( n+ ]" m. W, c. N
    )
# k$ H. z6 z+ \( S. C9 R% D
% D- l4 ^' @& r0 j, p# L4 t! B    (if (not (new_dialog "ddnewhatch" dcl_id)) (exit))
9 z( l4 G: J& X$ E$ a* e2 d+ G( t) {7 I, |7 R3 y! I# G
    ;; disable the thickness tile# P8 ]/ S4 U1 N/ C- ~
    (mode_tile "eb_thickness" 1)
% }% S+ o% F- L* D0 K; H    (mode_tile "e_thickness" 1)' R( M9 g0 z$ V" Y+ W( p4 D$ Z9 U( x8 n

! y! |4 c7 A9 w) G5 [" Q8 t    (setq help_entry "modify_associative_hatch_dialog")- N! n. f" W) ^, {- c, o; H3 ^( R
    (set_tile_props)/ H6 {; Y, K$ v& U, U' d
    (set_tile_handle)
1 C1 b3 R! H& g% I0 n5 p, d8 j$ q
3 m# l1 q) W! h! l* \# u    ;; Define action for tiles2 D" t* B/ ^, C) t) a7 c3 r
    (set_action_tiles): e  Y+ z- g5 _. n' }, Z6 t* y
    (action_tile "b_hatch" "(done_dialog 2)")
* J; P% d2 R! b  r! x    (setq dialog-state (start_dialog))
; V3 J& h) a- H+ W1 f, {$ X. v/ k/ X! Y    (cond
3 \  C( s3 P, l2 W       (  (eq dialog-state 0)
" W$ k" X0 ?& r6 i+ G% u& }          (setq old-elist hatch-elist)
3 F0 R# _7 ]/ k          (setq hatch-elist nil)6 l( A/ r1 H! k& Z. {. Z  _
          (if (= (checkforlockedlayer ename) nil)- K. }  [% g3 @/ v' S: D* }
             (reset)
, {/ y9 a" P. n2 B! r% I             (progn         ;;; special handling for locked layer reset
9 Q6 Y2 _2 g; E% W0 T* A                ;; unlock the layer
1 w5 i- A' l8 T% r6 Z* @                (setq layername (cdr (assoc 8 (cdr (entget ename)))))9 b$ s4 [2 f% u# E$ k
                (command "_.-LAYER" "_Unlock" layername "")
4 Z4 v2 x! |, A1 L+ f; V, L                ;; reset modifiction2 |5 O( v8 ~4 M# {8 w: H, w$ \% H6 D- y
                (reset)
6 u8 X. n/ ~/ ]6 X4 k8 i& c                ;; lock the layer again) y6 f* q# }) y4 U# _9 P
                (command "_.-LAYER" "_Lock" layername "")! F3 e$ s7 u1 V& Y$ s
            )/ F1 a* Q: T  r2 `: a+ @# b) L# N2 N
          )1 ]# G" j$ Q' N9 m+ k5 w$ w
          nil       ;;; makes (ddnewhatch) return nil for Cancel0 j2 w. A2 V* Q  @$ H
       )
, D; h8 H# `( u7 v  ]       (  (eq dialog-state 1)) B8 d3 B: k+ B" A4 S2 b
          (setq hatch-elist nil)' X6 E3 h8 h4 c$ W" a8 z
          (modify_hatch)
: N: B7 E5 h  b$ ~  P' Z* Q; ~          T         ;;; makes (ddnewhatch) return T for Ok7 ?# y: N2 ~1 Q) \
       )
6 A# T7 T7 T' Q0 ]) {) Q       (  (eq dialog-state 2). e8 G0 L  T% D; V" l

; V# _. w" D6 a, e& e# s          (if (= (cdr (assoc 70 (tblsearch "LAYER" elayer)))0 N4 C! ~0 F8 R, S
                 4
. q! M/ B" r" ^8 ^- ?- i              )             : P& F, M1 g2 ^5 A7 _4 y
              ;;; new selected layer is on a locked layer; H, ?1 f- p, ]0 I8 D' H& x3 Z
              ;;; we can simply modify the hatch properties/ ^% U3 \* g; I9 j, G
              (modify_hatch)
, J7 n9 u/ O7 B              (progn
% s( v% |# O6 ^( s  m/ ?$ G                    (if (= (cdr (assoc 70 (tblsearch "LAYER" (cdr (assoc 8 (cdr elist))))))
' w4 n- P* A- \                            4& K3 p1 P; W! x
                        )           3 e" Y+ Z0 v. l( m: O
                        ;;; We changed the layer previously and now the hatch lies on a locked layer.
) `6 ]. v, K4 c5 q3 B: h6 o' }( r                        ;;; We have to unlock the layer forethat we can update the hatch properties.
$ O8 j1 L' r& _1 s( Y                        ;;; If we don't do that (entmod) fails to update to the new layer.
% L" w7 j) S  }  q8 a                        (progn
0 N7 ~  a$ `# j+ U                            (setq layername (cdr (assoc 8 (cdr elist))))( n( e& A6 t  M* x, ?$ t; f
                            (command "_.-LAYER" "_Unlock" layername "")     ;;; unlock the layer' z% l9 ]6 Z5 U* y% S7 H  s
                            (modify_hatch)                                  ;;; update the properties4 Y# Z; z7 o4 v
                            (command "_.-LAYER" "_Lock" layername "")       ;;; lock the layer again
2 g+ ]% Y+ h( _. _6 s                        )
) Y9 y7 Y' R: m7 p                        ;;;  All other cases we simply update the properties9 i6 t1 |4 j7 x5 K/ i$ L( Z$ j1 U! M
                        (modify_hatch)
% m  Y9 Y( U; `7 t, A' F                    )% m2 b7 R  h6 m+ j
              )
0 }: P" G: g2 y& h6 J4 @) W! {          ) & U8 _- A/ W" e
          (if (= (checkforlockedlayer ename) nil)
9 c; A' O# ~5 x& E) P# W0 }              (command "_hatchedit" ename)) ?8 C8 H' w9 m5 T; g) y
              (alert ;|MSG111|;"The hatch object is on a locked layer.")' I2 f" u) l& ]2 g  U
          )
$ X  d. j- ^! z( l* _          (ddmodify ename)/ C6 L6 M; m0 z
       )6 I, _1 |9 [7 \; Q+ E
    )
" E: z" `/ ~) Z+ K  ); |# J+ i/ q9 l- B  A6 Z
  ;;
; h2 n$ V6 u& l# y  ;; Modify BODY0 T# d; d2 _% X2 Y* K4 @8 v1 h
  ;;
$ L5 J& r/ ^" U* S  (defun modify_body ()
+ G% f: g, _( z    (modify_prop_geom)
1 X1 b7 `6 b" A7 N1 j) E$ I6 v    (entmod elist)+ V$ ?% M& T' f% ~0 \
  )# H. g. D, [6 V: N, g/ Y# S

$ m- Y" t/ @. d  (defun ddbody ()- t) ]$ N% w% r) R; c
    (if (not (new_dialog "ddbody" dcl_id)) (exit))' _8 q! W' u0 q' F" j. o. J5 P
    ;; Set initial tile values
5 p6 p$ q. K- k    (set_tile_props)) N9 Z2 [3 ]; }3 p' F' A" g7 y
    (set_tile_handle)6 d: x3 I$ c/ e0 k
    ;; Define action for tiles
( E5 n" P( W$ a; _( |7 G8 V9 U1 G    (set_action_tiles)! P2 }1 M6 C9 B2 v6 e9 p6 L: L3 X
    (setq dialog-state (start_dialog))/ p# ]+ V6 v: b- R( `3 X& Q
    (if (= dialog-state 0)& p! a- G7 X& `& C/ }# }
      (reset)8 A# l2 u; }% n
    )! ]$ _# q7 D, @/ p
    (if (= dialog-state 1); k+ W" y( _3 M% C/ C' p
      (modify_body)
& h! w4 s8 K2 Q    )' S: T& K% n) E- l2 F
  )
" [. F* o2 Z7 c1 i  ;;
4 s" e/ E$ X& S6 C) r7 J  ;; Modify CIRCLE
8 y  B# J4 i- D7 C; E  ;;$ T7 X0 F7 s1 F! O
  (defun modify_circle ()
0 e8 O9 G3 w6 [2 U  d    (modify_properties)5 P  `) u2 h7 L/ Q) J
    (setq pt1 (list x1 y1 z1))
& y* _4 o+ y, i& m2 A( Q% N: [    (tempmod pt1 10 1)
- [0 K5 M& E' n4 f) W! S5 J6 K' @    (tempmod radius 40 nil)
0 `. W4 r, y6 \4 E  l# |    (entmod elist)
& X* @4 v) `  i1 B4 b) j  )
) [0 x( S' e" z; U( u- n  z% o) e4 v$ l- N% S7 m
  (defun ddcircle ()8 z) A- b/ E" l# }% L9 C  X$ U( X5 P
    (if (not (new_dialog "ddcircle" dcl_id)) (exit))
0 C9 [  H, x: Y    ;; Set initial tile values
. _3 ^  o, ^" d& }# c5 X    (set_tile_props)) K- l  _% j  V3 k7 G, w* [1 C
    (set_tile_handle). s8 \* `1 g, s: U. l! {3 F6 L4 m
    (set_tile_pt1 1)
. r  k  o( J/ V    (set_tile_rad)0 u# Z' W# B: c7 D
    (cir_calc)
- b+ X8 S8 `! e; U! _0 H    ;; Define action for tiles
% q5 D1 y" g' m) c2 V. M7 E    (set_action_tiles)
  r; ^" j% ~3 a, _    (set_tile_pt1 1)+ s* {  W/ h% y  Q, z2 x' F
    (setq dialog-state (start_dialog))
0 u5 F. j5 E: Y8 @5 _! W    (if (= dialog-state 0). G. X$ Z  M6 A
      (reset)
5 f) s2 r2 v6 c5 ]2 L& q2 Z    )
7 D9 D3 K, w0 ?- g: B    (if (= dialog-state 1)
- y5 I" E1 H) B- j8 q( F* D8 N      (modify_circle)
9 ^! D7 G* R  y: v5 G7 _    )
" I9 @2 K( Q$ X/ M! `% ^3 O    (if (= dialog-state 3)
4 r5 D4 x! C, U  W2 n4 a      (progn
( u; n" i7 B& _- c2 _* h* Z  }6 P        (modify_circle)
3 N) K3 M: g( N$ I* F# Y% {        (setq pt1 (getpoint (list x1 y1 z1)  "\nCenter point: "))0 d, K' K3 t$ _
        (ver_pt1 1)& y) ]& ?! L9 q' x, l5 V
        (ddcircle)9 X. R* O1 v/ [" z" N- D+ R
      )) n9 {3 i& J' h0 ~
    )
4 \: i5 i% P9 \  )
7 D& Q2 |# [) q$ J& e  ;;
, E1 ?: Z7 r" Q4 t5 T  ;; Modify ARC6 E5 l7 h5 [! ?/ E* q
  ;;" Q3 V: [  p0 U* Z  f0 w2 R
  (defun modify_arc ()+ ~+ T0 z3 M- r/ d; b/ V
    (modify_properties)) I2 G4 q* J1 V* T& q' p( [
    (setq pt1 (list x1 y1 z1))/ b, V1 T8 Y2 K: K
    (tempmod pt1 10 1)
2 F) G+ S% R% M4 F& Q3 @    (tempmod radius 40 nil)
$ }* j# z3 q8 {" z3 ^. l) E; _    (tempmod st_ang 50 nil)
, E+ q' J# m$ j; J) f) r% ?    (tempmod end_ang 51 nil)
+ W. d: g5 }3 w0 L% O! J, F6 p; r# T    (entmod elist), I' ]+ a$ {* X% l) ?
  )
1 Z8 k* t. ^/ f  (defun ddarc ()
& j, E6 F- ^( D$ e$ I# u& R2 ^    (if (not (new_dialog "ddarc" dcl_id)) (exit))
" f* a) M2 V( C5 N+ w    ;; Set initial tile values3 g5 F% {2 [/ j: m: g; F& j* J
    (set_tile_props)$ g* l! Y9 q5 f. A, G9 X. M$ V7 D
    (set_tile_handle)
$ e6 G* Q5 e7 L6 @7 G/ b5 ]  F    (set_tile_pt1 1)! Q3 `/ T8 C  _! t) X; A
    (set_tile_rad)
& ^$ [) x/ ?; A    (set_tile_stang)
% R( H+ ^; l1 T$ Q  |1 I    (set_tile_endang)
( V5 a5 r% L5 t2 _' j" S- F    (arc_calc)
! T2 Q8 n0 @4 k3 ^0 {3 ~) ?$ {    ;; Define action for tiles
" b+ _  M' R5 D% a! R" r    (set_action_tiles)2 _- i9 @2 P- |! s0 I6 D7 O
    (setq dialog-state (start_dialog))
: S, `5 F+ v% U. i3 a) U, Q    (if (= dialog-state 0)" k6 v. `# n8 e, P
      (reset)2 G! c! S& b: N
    )6 m0 J0 X1 o) T. y
    (if (= dialog-state 1)
* W6 E3 Y+ d% ]* ?( ^5 q      (modify_arc)' y2 Y8 u$ w% T6 j
    )/ z7 e' C& H/ t' ^
    (if (= dialog-state 3)
# J1 }0 c6 {! y$ z      (progn
7 A+ V) w' T  `8 v$ o        (modify_arc)( a8 o; t7 U& c; S' p, e
        (setq pt1 (getpoint (list x1 y1 z1) "\nCenter point: ")). H. e  x2 z8 \1 }5 z: y( Q
        (ver_pt1 1)9 l$ @4 D5 f" I/ r
        (ddarc)
0 G- j% A' y9 X5 |; i8 v6 G      )
+ O0 W2 t2 Z$ r    )
- b9 F1 n$ ~0 x! l2 O& Z+ u, K  )& j9 \$ `4 Q, G! t, U8 I  V
  ;;% k) b+ }" I( \0 \( y4 Y; [
  ;; Modify SOLID or TRACE
3 n" V0 S( r; }# r; B; K  ;; Note the Z value of the object is determined by the Z value of the fourth
/ b4 U- r7 V2 d  ;; point - code 13.  Changing the point values of a solid or trace from a UCS
2 V+ ]+ t% f: D* N  b. w  h( E  ;; that is nonplanar to the UCS the object was created may confuse the user.
5 O% H$ H9 O! ^7 j6 F  (defun modify_solid (); S* u1 p+ c% o/ @) Q0 U
    (modify_properties)
2 `8 a1 B9 h$ t: Z    (setq pt1 (list x1 y1 z4))
& a. z* v  b1 y" X# h% W    (setq pt2 (list x2 y2 z4))3 b: D2 Q0 e, u$ r$ X
    (setq pt3 (list x3 y3 z4))
/ C7 X2 q3 }4 I% Z/ u% D. e. t    (setq pt4 (list x4 y4 z4))
% m  C6 {0 E# }    (tempmod pt1 10 1)( U$ ^! b$ D& P$ M% x# {* F
    (tempmod pt2 11 1)
2 p2 r+ Z* g1 l* I6 m5 h/ }. e( [. h    (tempmod pt3 12 1)3 w" j' d( W  J1 @+ V# }1 s! s8 D' ~
    (tempmod pt4 13 1)4 o; R- |+ U! Y6 v8 J( J* l
    (entmod elist)0 p- @+ f/ V! ]- o
  )
/ [9 P; f! \) ~/ ]; }/ b4 z+ Q
5 R: [7 l: @( h- A9 m" h0 J  (defun ddsolid (): L) h* @' x8 X; E
    (if (= etype "SOLID")9 n- x9 Z* i6 N' P
        (if (not (new_dialog "ddsolid" dcl_id)) (exit))  e9 V+ p7 O+ c0 `
        (if (not (new_dialog "ddtrace" dcl_id)) (exit)), r# X* h% e) Y2 W! f
    )/ i" a; ?7 d5 P
    ;; Set initial tile values
3 J% y: ?+ }' S' u( K. k! w    (set_tile_props)
+ }" _, \9 C% _" r    (set_tile_handle)- r+ Z# k0 ]2 B7 g: K2 d' v
    (set_tile_pt1 1)
. X: \" a1 \1 v# L    (set_tile_pt2 1)
% F$ l0 P/ E7 ]( V5 L7 N$ }3 P    (set_tile_pt3 1); U" J: Q' a% B" _- p. M; j+ ]
    (set_tile_pt4 1)2 s# w3 U1 P4 `$ G0 N! j
    ;; Define action for tiles7 e! B2 \+ a/ c# r
    (set_action_tiles)
6 R) P6 W( o. P' M    (setq dialog-state (start_dialog)); S9 |0 h" j3 B3 {7 E
    (if (= dialog-state 0)# @3 [' h4 V4 C" \, s$ \) j+ l
      (reset)1 P7 Y- l/ d/ ?. T! ~7 S
    )- J0 j! T, a/ u% v; D
    (if (= dialog-state 1)
# J0 S& `+ L3 z. w8 [7 y1 N6 _      (modify_solid)$ n# p9 x0 g% I2 Z+ \2 r% a' s3 e
    )4 s. m/ Z& F+ U5 I1 A) g# l' S
    (if (= dialog-state 3), N' U  S. z0 E1 ?
      (progn* V  \3 t, g4 C7 y+ s# U
        (modify_solid)
, o  L2 d! K$ H4 O6 R( R( Y9 h7 t        (setq pt1 (getpoint (list x1 y1 z1) "\nFirst point: "))
# |: c% {- q5 e% A5 e- I% |        (ver_pt1 1)
' y' k. w1 C+ H8 k2 w5 t% q        (ddsolid)7 a. @" b& }  ?  U- k5 B' W
      )/ a4 l! ^" m, z6 G1 [2 j
    )
: \" }$ `- H& T& d! r3 P- v    (if (= dialog-state 4)
& c0 _: \% @! f7 ^. f1 m9 Q, \      (progn
- R9 l, s) x: G2 [5 G) b        (modify_solid)2 x' s! P2 i% t/ B
        (entmod elist)
7 C9 |5 v0 |# _        (setq pt2 (getpoint (list x2 y2 z2) "\nSecond point: "))* J. j: h1 J- u& Z+ J" B6 r3 a
        (ver_pt2 1), g$ D) d/ n9 y6 g, C* J# O: [1 C
        (ddsolid)
9 A( r0 ]% x# E7 P$ H6 [9 M      )+ E8 ^' H! P7 z8 p; i
    )
) f- |9 _- w: x' D8 g    (if (= dialog-state 5)9 W  u3 S* Q2 J+ H! [9 R9 d
      (progn
9 I$ J, t! `. X/ @. H  I: t        (modify_solid)
# F5 T+ V  l3 Y8 _6 P2 f; `6 l5 S        (setq pt3 (getpoint (list x3 y3 z3) "\nThird point: "))7 _  ]1 i8 E+ x
        (ver_pt3 1), f/ p1 v- H8 u* i9 a. x! f. H
        (ddsolid): N6 g+ B+ f( u. |
      )9 E2 b- x* S2 c& C# g) o3 e7 K
    )
% |, r" C. E  Y% w    (if (= dialog-state 6)9 }: v4 }7 |1 T
      (progn
' J% W4 M5 I( y3 Q' }; f  j( z        (modify_solid)1 \8 }2 j; y% w
        (setq pt4 (getpoint (list x4 y4 z4) "\nFourth point: "))$ n6 X' t8 t1 N5 `% j
        (ver_pt4 1)
; B0 ~- N2 T7 j        (ddsolid)5 n0 ~& h1 v) K9 u
      )% K- e7 e2 T1 ?- A, Z6 r
    )- Z' o8 @4 ~0 ^3 ?6 @3 K1 |! g
  )
% |+ ]  \& P  b4 H0 D& }' y# R* b  ;;
6 s& U( V) @3 o  ;; Modify 3DFACE" |/ k" k6 o2 p+ @" _4 S
  ;;; X, N1 S- Y8 X, l
  ;; Check visibility of edges
9 d2 d1 L- \, j) g9 G, i* q' ~" ~  ;;+ U6 y, o5 g7 s* J! o0 H) C/ j
  (defun edgetest (/ bit1 bit2 bit3 bit4)1 b) ?3 n  c) F. S0 c
    (if (= edge1 "1") (setq bit1 0) (setq bit1 1))
% E  n  c+ R$ _% _/ e1 L- V0 |. X    (if (= edge2 "1") (setq bit2 0) (setq bit2 2))# F' G$ N  q; n7 b/ k3 a: a' `7 t* B
    (if (= edge3 "1") (setq bit3 0) (setq bit3 4))
/ u7 B% I- D( {% \' ?* e: R1 P) z    (if (= edge4 "1") (setq bit4 0) (setq bit4 8))
' O: `9 \2 B; w$ Q    (+ bit1 bit2 bit3 bit4)
: p' J2 Y6 o2 o& n+ E* G  )
7 N& U! n1 D0 T% p$ \$ D. O; X
4 k0 a3 z' X+ X9 X0 z* y  (defun modify_3dface ()5 Q8 Y7 W4 A% A7 j3 T0 r
    (modify_properties)
1 l1 b$ @0 z$ H; M0 n" S$ O    (setq pt1 (list x1 y1 z1))
$ ~+ Y% x) E8 V& t5 J    (setq pt2 (list x2 y2 z2))
: c/ I0 I/ G( A8 G* r( k' ^1 P    (setq pt3 (list x3 y3 z3))3 R0 [* C* _, V
    (setq pt4 (list x4 y4 z4))6 q6 m+ Q, m& l4 m( L8 A
    (tempmod pt1 10 0)
+ z7 p( J1 G. v7 Z2 U5 w& R    (tempmod pt2 11 0)
4 a0 O8 v$ }( B2 ?, ^' T1 [    (tempmod pt3 12 0)+ \" }: ]' w9 l* P) `5 e  _9 t% w8 f
    (tempmod pt4 13 0)
9 g5 d. Y! w) D; N; r1 Z6 D! b    (tempmod (edgetest) 70 nil)7 Z( W& A. O: }) {
    (entmod elist)! @" z% n6 t. s& H
  )8 A* }) x& J5 P. x# \4 Y% ^
4 \- _; V- G6 h) M" O& s
  (defun dd3dface ()
6 n; [. f2 u; {$ r, o. s    (if (not (new_dialog "dd3dface" dcl_id)) (exit))1 ^1 r8 Z9 ^& X; E
    (set_tile_props)
3 o7 y2 N0 C% F% Y  r: X    (set_tile_handle)
" O/ V0 e& ?2 J    (set_tile_pt1 0)  B" ]8 ]0 D; A" b; P& v
    (set_tile_pt2 0): Z  O5 P# b$ k" ~+ d6 }! T0 ^
    (set_tile_pt3 0)( g" Y% M/ @$ Q, ]4 K
    (set_tile_pt4 0)
: J5 R% ~- L* Q3 f4 j; x) p    (set_tile_edges)4 X, n3 |+ A$ _( }/ k
    ;; Define action for tiles
3 q% s# c1 z. M1 d. @7 Y    (set_action_tiles)( f( f: v4 L) V# R; T
    (setq dialog-state (start_dialog))7 @5 v( z2 K5 a' d, Q
    (if (= dialog-state 0)  B6 a& W: `5 r! ~# W. k: z4 U" L
      (reset)  v! P" H/ S% b! p7 H. P
    )7 x: @+ D1 j3 b; p  F' \1 A
    (if (= dialog-state 1)6 z- l7 z9 |+ ]& K/ J. i
      (modify_3dface)
/ V  u* Z+ x6 f% i- l    )# H: [, w' N6 F, ^' J: O. |
    (if (= dialog-state 3)
2 q0 X# p( S, U! `3 `; Q      (progn0 W- L& G) }0 s* T" B
        (modify_3dface)
2 H+ W9 o6 x$ d! K4 Z8 z  F1 N        (setq pt1 (getpoint (list x1 y1 z1) "\nFirst pt: "))0 f, G& ^7 X1 g) j0 p+ K* \
        (ver_pt1 0)
, U9 L6 H2 @  h        (dd3dface)
) Z9 O; M6 v1 q( r$ f      ): ], M( n: P' @+ B! ^
    )2 s. E- Z! ~& c7 Q' A
    (if (= dialog-state 4)0 F  n) h; L3 t8 h) O( c
      (progn, x/ `( C7 E5 h5 s9 A
        (modify_3dface)
, B3 \* k: N( a0 p9 \- d        (setq pt2 (getpoint (list x2 y2 z2) "\nSecond point: "))
6 b/ L0 G) K# Q        (ver_pt2 0)- E$ C: ~6 B  {& p3 n
        (dd3dface)
2 c: B3 f% }+ g" z  i+ r. n6 T0 O      ); z( |  Q4 p" `, k6 p: e! w$ n
    )
. k1 `5 R' x& _' i; w    (if (= dialog-state 5). l7 M% p6 z# U- B* e  M$ U/ B7 ?) q
      (progn% Q7 u" f5 v; |7 b  J+ m
        (modify_3dface)
8 }/ f5 e% ^: v8 |1 _% |2 L        (setq pt3 (getpoint (list x3 y3 z3) "\nThird point: "))9 r( T: o, U  U9 ]- ^
        (ver_pt3 0)! p. D( a8 H. d$ L, d' v8 s
        (dd3dface)
3 V" J  S/ O& c: w. E) j      )6 ?& N, A5 _) }9 A7 |
    )8 c5 z% r0 s. X6 q( i
    (if (= dialog-state 6)
1 c" _* `2 @9 K! x1 O      (progn
1 P9 O. M+ e4 t0 k, N2 g        (modify_3dface)% S  a' `5 U+ M) |9 }
        (setq pt4 (getpoint (list x4 y4 z4) "\nFourth point: "))
: `' r: O8 @8 z& Z: U* F# d! f        (ver_pt4 0)
* ?" {; N1 y4 m. S4 L' K        (dd3dface)  c: I6 {: [& i, k
      )
) {/ d& _- o- X  S) \9 e- J    )
# E5 t: ~! k& x7 n, Y! Y: M( i  )7 Q$ |: v- {0 K! s4 G

% ^8 L: l* L% [' g! M6 n  ;;
6 X% j' ~7 m7 T5 f' ?/ S  ;; Image functions
/ d+ p0 n, h( y; e/ t7 K+ d3 c9 H  ;;
( b( \; D& p2 U2 `2 r( M. h3 n  (defun image_scale (/ upixel en n userscale temp)6 L1 r( F2 o, [9 X% o" w0 D1 `
    ;; Calculate the size of an image pixel in AutoCAD units  N) |! D# A% L' k) N
    (setq upixel (distance '(0 0 0) (cdr (assoc 11 elist))))
3 r! A' n; ]8 r5 _
9 K8 S5 Z; O" V  K2 R6 l    ;; Retrieve the user scale3 J. m1 M9 ^0 y& f
    (setq en (dictsearch (namedobjdict) "ACAD_IMAGE_VARS"))5 p1 ~" n3 p; |$ e
3 r$ h. r3 w4 v$ o0 e2 M2 D
    ;; Next, extract the image units and pixel resolution
8 C/ `0 \4 ?" N$ _/ s    (if (or (= 0 (cdr (assoc 281 image:olist))) (= 0 (cdr (assoc 72 en))))
3 _% b, {' s% S4 ^+ Q      (setq image:scale (* (cadr (assoc 13 elist)) upixel))
) \0 J% d: M3 \. m8 W0 e! n      (progn
; H1 I* v; e/ c0 h' P5 M7 d        ;; Convert the user scale to the proper word0 A' \% r% b' H, C  `) m0 b" \
        (setq n (cdr (assoc 72 en)))
9 ~  ~* [) ~1 [8 o        (setq temp (getvar "LUNITS"))
) i- j2 a& \' b& N+ M9 j        (if (and (/= n 0) (or (= temp 3) (= temp 4))) (setq n 5))
1 M. _' g3 o. n& k1 @! a7 ?        (if (= n 1) (setq userscale "Millimeter"))* p# |8 Q- ?. E6 p: B3 i
        (if (= n 2) (setq userscale "Centimeter"))' Q* X) o( D& m9 |. L9 x6 \) v3 B
        (if (= n 3) (setq userscale "Meter"))
1 {9 Z( g' a7 }        (if (= n 4) (setq userscale "Kilometer"))) }8 E9 V1 w& F  o
        (if (= n 5) (setq userscale "Inch")), @& b: S7 ?8 L% s8 {' }
        (if (= n 6) (setq userscale "Foot"))
$ x* y9 H  }& [% g# z        (if (= n 7) (setq userscale "Yard"))4 _6 R7 z, ^$ r! z2 F& t
        (if (= n 8) (setq userscale "Mile"))0 Z; A: N3 K* F& ]' C7 D2 E
        (setq image:scale (/ upixel (cvunit 1 "Millimeter" userscale) (cadr (assoc 11 image:olist))))0 S* u! ~  {1 i
      )
) a2 q: N0 u% J+ o9 X    )
0 B/ m2 Y6 D5 O/ f  )9 ?1 d9 t3 D$ q2 a

5 h+ z4 _7 P0 O2 t9 p  ;;& t0 A, I- k2 ]1 ]/ ?0 ]8 k6 A
  ;; Scale factors for block insertions) n0 l% z. T; F1 f2 K
  ;;
5 J. {1 i0 }; n' b! h# V  (defun image_set_tile_scale (/ temp)( }# V, F) w/ ^& L
    (setq temp (getvar "LUNITS"))/ _5 w. O; D4 \
    (setvar "LUNITS" 2)  R1 i7 O9 H0 M. Z- E% x
    (set_tile "xscale" (ai_rtos (* image:scale image:mult)))1 Q4 s9 e# o" Z! }  b, ]: l: T/ _
    (set_tile "wid" (ai_rtos (* image:width image:mult)))) L: R' G' C5 Q+ M1 e
    (set_tile "hght" (ai_rtos (* image:height image:mult)))
5 W$ {4 s, E* H2 z' c" K1 \    (setvar "LUNITS" temp)
. d$ M& V" w9 e/ ?- \9 a" g9 ~  ). t& _9 q- f! w! y9 x) a: {1 Z
  }) H3 n( D: H$ Q* f2 S
  ;;
. q0 Q! X5 m' n( q  ;; Set the scale, width and height values appropriately.) @1 p' ?3 c8 o* ^
  ;;7 ^" l3 Y" z# d
  (defun image_update (field value / orig_value new_value mult)
7 g  K* }9 Q6 M% |6 S    (if (= field "xscale")+ b5 J3 F2 `7 d# P
        (setq orig_value image:scale), N* P( K6 B/ o+ P
    )
) u4 j. e1 j7 y9 p8 B& `8 ?; ?) p    (if (= field "wid")7 t; D' I" z2 H9 b# d
        (setq orig_value image:width)+ F1 ]  Y3 }4 G! A2 L& r
    )2 P' H4 d4 ^. A0 r3 g; O% Q
    (if (= field "hght")
3 M' [& G6 A) w$ A* c        (setq orig_value image:height)
. \& A& V& E9 r0 X    )
  M1 Z1 S! _% P8 B1 G    (setq new_value (verify_d field value (* image:mult orig_value)))
  `" `! N* J# L8 i* ?6 J. \5 _    (if (/= new_value old_value)
8 U: T! X% b  f' t) L( P' c      ;; Make sure the user has entered a sufficiently large value
" @3 L$ I* x& E. ~: D9 q# M      (if new_value
+ L% X- x% p; N- f* [9 R# x3 {        (progn
, R) Y& k. T8 [% E6 c          (if (< new_value 1e-8)
3 a* Z8 `; B5 s. ?" c            (setq mult image:mult)0 i/ C; h' r% z+ ]- W! P+ s$ V: h* X
            (setq mult (/ new_value orig_value))
5 u1 x/ T, x9 d+ r$ X1 z1 ]6 m- R          )
4 Y" x' b( v$ [$ b* s          (setq image:mult mult)
8 g- \$ z8 A& A* V% B          (image_set_tile_scale)- l8 n) d: l5 V# ]$ y+ K) @
        )! f- {6 U) o' W* g* x; D
      )" }- x* a+ l% t
    )7 C# |& X7 |/ u# z1 }
  )7 |. D0 R6 ^4 f& t* X0 k0 I+ q( a

+ K& [0 y9 P3 a/ t; ~5 S  (defun image_disp_opt (bit)" f8 d" F6 W2 O3 T2 q$ z5 y
    (setq image:options (Boole 6 image:options bit))  G3 E7 Y: W! `9 K% g2 h
  )4 A+ v( w4 v, z: F+ Z+ ?* P

! K7 V4 Z1 ^1 b% r7 G9 \  (defun image_modify ()
- x% n' D; U9 g5 Y    (modify_properties)
0 r3 x9 V+ {( @* N, J, u    (setq pt1 (list x1 y1 z1)): o7 }2 X' i* z# q! H$ }$ f6 v; i
    (tempmod pt1 10 0)1 o1 f+ q1 }+ D, D+ H
    (entmod elist)
* ~  D  Y; n0 E  R  )  L# M4 O* l' f4 d+ t; l! G
' p% j$ X! {+ _& \, ~% ^% X
  (defun image_clean_variables ()* Z" l) X4 T5 e  B
    ;; Clean up global variables used here
' X/ i2 m6 L% ^/ C    (setq image:scale nil)
' `3 K8 c3 z# N5 g" |    (setq image:angle nil)
/ E9 J' \9 V' C  k    (setq image:width nil)
0 j! c! X* U7 s4 K- w    (setq image:height nil)1 ?9 n, ^. N5 U6 l; U# K
    (setq image:options nil)
  a3 L0 t9 w  e( D7 [    (setq image:oname nil)2 k8 F% _# `! g6 i# b* u
    (setq image:olist nil)
/ `3 s9 ~1 P3 r% v1 ~2 m3 M    (setq image:mult nil)
6 k/ }" b5 Y2 O: D/ t    (setq st_ang nil)
& c6 ^# e/ z- O  )
( m8 _) r# G& ?2 e" T) R% H
- J) \$ i  e& F$ s  (defun image_scale_vector (v1 value)- W( B- s: f% p  x; k* m
    (list (* (car v1) value) (* (cadr v1) value) (* (last v1) value))9 L3 P  x9 M. _* C6 u7 c" S- \' ?
  )
  {* E" T) E" o7 x" b% [$ ^& K( g4 Y2 `6 x
  (defun image_cross_product (v1 v2 / vx vy vz)
2 x+ P8 ^$ j, {5 Q# Y8 o# a    (setq vx (- (* (cadr v1) (last v2)) (* (cadr v2) (last v1))))0 W4 ]4 I( N; Y, |6 Z) U
    (setq vy (- (* (car v2) (last v1)) (* (car v1) (last v2))))$ L: e- Y9 b" X, M# I8 a
    (setq vz (- (* (car v1) (cadr v2)) (* (car v2) (cadr v1))))4 o4 E$ w! f% `3 ?0 u+ b. l
    (list vx vy vz)8 `+ j' {/ _4 }& Z6 `
  )
& b4 e1 W$ {: t( E; C5 F9 \, |8 U7 C' D5 J
  (defun image_dot_product (v1 v2)$ G' Q7 W1 o% e7 S, U
    (+ (* (car v1) (car v2)) (* (cadr v1) (cadr v2)) (* (last v1) (last v2)))+ c/ \' j8 l3 d- p' Y, b
  )9 ?3 R; E  |7 q) @

4 I. S( A2 l- J+ c  (defun image_add_vector (v1 v2)# [% H' r$ q8 O' j" w) S0 t4 i4 S+ Y9 r
    (list (+ (car v1) (car v2)) (+ (cadr v1) (cadr v2)) (+ (last v1) (last v2)))  e5 U* D: J' W& `. N
  )0 }: }: R+ n( ~/ H4 `- |
. x& t2 m/ T+ B% t/ r3 Y
  (defun image_subtract_vector (v1 v2)4 ~; t. r2 X, r% p2 b
    (list (- (car v1) (car v2)) (- (cadr v1) (cadr v2)) (- (last v1) (last v2)))
( V- A8 C' S7 ?9 H  )  g& Z  O( e* }; j2 o# e, m

2 q# R4 e5 f' V$ y1 U1 ?. f1 _" z- k  (defun image_normalize_vector (v1)( J( L( x5 v; B1 @
    (image_scale_vector v1 (/ 1. (sqrt (image_dot_product v1 v1))))
$ u  `% [' V  ~; [# o  )
( Q2 N# G  I$ j: w- o
; r/ K8 [7 s' a) J% ^# a% e  (defun image_rotate_vector (vector angle axis / along_axis axis_x_in_rot_plane axis_y_in_rot_plane in_rot_plane)
6 W9 K( _/ j3 j1 C3 q4 s+ S    ;; Normalize the axis
4 c5 I- S1 r! L2 `. P* c7 t    (setq axis (image_normalize_vector axis))
1 ^; R! s* _8 @2 p    (setq along_axis (image_scale_vector axis (image_dot_product vector axis)))' W" Z* U9 d9 d" j4 M1 \
    (setq axis_x_in_rot_plane (image_subtract_vector vector along_axis))
8 p$ y3 l% s# N) m$ L6 f$ v6 f    (setq axis_y_in_rot_plane (image_cross_product axis axis_x_in_rot_plane))+ x$ T  l- T) G! x8 ?7 n1 U% w1 d
    (setq in_rot_plane4 P. G) p, Y5 D% E4 A; X3 \; o
      (image_add_vector% y2 V% @/ q( ]* l
        (image_scale_vector axis_x_in_rot_plane (cos angle)). ?" O( t% g6 d8 B
        (image_scale_vector axis_y_in_rot_plane (sin angle))
4 \* @/ n( }# B. F( R; g  r, K      )
: A8 L" w$ l. a1 E% H( v* O2 U6 t3 p' B    )
3 G) g0 t* u, s( u* g    (image_add_vector along_axis in_rot_plane): t& y8 A$ H6 u3 x; l/ \* x3 f! Z
  )& K5 K: _0 Y0 J: y+ n% e

4 x3 R$ s" m, r" x9 t2 y  ;;
, h- p5 b7 v. `4 e  ;; Calculate current rotation angle if appropriate.
2 F( @( T7 D' x2 t2 @5 K- g0 G  ;; If not, grey out the rotation field.
, b, T- `8 ^2 b$ f  B! K. F  ;;
6 x7 [2 V# x+ i9 s  (defun image_rotation (/ normal rlength zlength sqrt_tolerance)
* Q" K4 `" ^. V" F    ;; Determine if image normal is codirectional with
1 S2 x& s% V/ t6 C! }& z3 {    ;; the current UCS Z-vector.
) b8 l5 A; f' g1 c    ;;& t. o3 K& z0 }: x1 ~- ?6 k
    (setq normal (trans (image_normalize_vector (image_cross_product (cdr (assoc 11 elist)) (cdr (assoc 12 elist)))) 0 1 1))
) }* \- x2 I1 ~    (setq rlength (+ (* (car normal) (car normal)) (* (cadr normal) (cadr normal))))
9 p0 W5 ^4 y8 M: y* t3 B    (setq zlength (* (last normal) (last normal))); r( r5 w+ Q$ p7 L
    ;; Note that the value .0001 in the radians is approximately 0.0057 degrees.
3 f" K% G( C# [' ^- x, N6 C( |) U    ;;
6 P4 l5 i8 h: ^! D% b2 K    ;;                cos(.0001)^2- x& b0 c. D# f. I
    ;;   Tolerance = --------------
$ r/ b' I7 }3 ^( H4 C( ^; K" Y    ;;                sin(.0001)^25 [1 P- U5 i9 @# Q) t: J# p! T/ S
    ;;
& O, B; y' k9 u' l    (setq sqrt_tolerance (/ (cos 0.0001) (sin 0.0001)))
3 v: o6 C# _9 O, y    (if (and (< (* rlength sqrt_tolerance sqrt_tolerance) zlength) (> (last normal) 0))) R* r1 L$ |. D6 R# w  E' q( F
      (setq image:angle (angle '(0 0 0) (trans (cdr (assoc 11 elist)) 0 1 1)))' \) ]# m; ?) L! D9 I
      (progn2 V' s* K7 F6 t# T2 Z+ _
        (mode_tile "st_ang" 1)4 F4 v: W' v+ Z/ c$ U+ }
        (setq image:angle 0)/ E3 F4 c0 I7 ~5 O8 h6 |
      )
5 |& h2 m% R3 B% r, p  X    )0 [+ L! P  J5 ?/ D8 ~
  )
  B; u2 P# l, M4 L# t: z
- _8 X1 c# y# X- l0 G7 ^5 K; a' B  ;;2 f1 d' G% d) D( {: d5 Z
  ;; Modify Image3 M5 o1 ]; D" T$ x: r) I* F
  ;;
# I: }- j% h% B) V: o) J" A- P; }  (defun modify_image (/ u_vector v_vector z_vector)* H# b% y8 v$ ^
    (modify_properties)/ {, v+ ?& ?$ {
    (setq pt1 (list x1 y1 z1))
2 R6 T7 _/ p' R    (tempmod pt1 10 0)2 i' ~1 c6 m2 w" }
    ;; Make display option changes to image
2 @/ M2 e# G& n1 y. x7 c6 `- @9 j    (emod image:options 70)
" A8 n( g# R# F8 D( l0 K5 `    ;; Get the u and v vectors6 `) d8 Z$ v; S: s; s* E3 X0 ]- D
    (setq u_vector (cdr (assoc 11 elist)))2 O) Z2 N. c+ w) d
    (setq v_vector (cdr (assoc 12 elist))). y  P+ A3 j7 {5 G) h. ?

& g* R% p( {4 H7 x1 W    ;; Make scale changes to the vectors4 n, m; D5 d, X2 F. j! e+ Z) L: L
    (if (/= image:mult 1), |0 `" i$ S5 m$ w
      (progn8 n3 e$ r# G- F6 A
        (setq u_vector (image_scale_vector u_vector image:mult))
  n1 V; I1 L/ [8 _+ D  d        (setq v_vector (image_scale_vector v_vector image:mult))+ l7 Z. i" d; o5 |$ J1 N9 q
      )
5 k) m: |3 x3 k    )# ~: R9 n7 r8 O
    ;; Rotate the vectors
" }2 [3 @5 k& t+ g& c    (setq st_ang (- st_ang image:angle))
) K" B0 X- {) K4 V    (if (/= st_ang 0)+ c9 H/ X1 y5 n. k% u5 n+ B
      (progn
) ^+ p: o. i" {$ m        (setq z_vector
) n3 V; g6 ]" ]          (image_cross_product  P& L* A2 W  }& E9 V
            (image_normalize_vector u_vector)/ d# S0 l( b, `& Z4 I
            (image_normalize_vector v_vector)0 h$ \6 }7 R) G
          )- H  Y& p  `5 d; S, m- R
        )) j) \7 x" l! W5 K( M
        (setq u_vector (image_rotate_vector u_vector st_ang z_vector))
% p4 b' [  s$ l& q) ^        (setq v_vector (image_rotate_vector v_vector st_ang z_vector))5 a' ?- p! v& b, L7 o
      )9 N% b* u* M* Z- K
    )
5 v3 F( z, ?$ H8 O$ y    (emod u_vector 11)
$ ~  K; j! J! v+ u    (emod v_vector 12)0 M& f  _  s. I
    (entmod elist)
% ]2 ]2 q9 {4 s1 p, r: q# R  )
) w! \- Y) B3 t
" ?2 Y% l9 k0 `# X6 a7 Y& X& T  ;;
* ]6 P/ ]1 ]: X  R9 t  ~; t4 V  ;; Run imageadjust on given entity, working around possible! c1 ~. c9 K+ ^4 i0 j% V
  ;; re-entrancy problems
6 t& [1 J6 Y8 Y9 f5 v. s; i  ;;' s* K8 F( p5 \* y! v7 e5 o
  (defun image_adjust (ename)
6 L  |. l- W, M# r+ M    (verify_arxapp_loaded "ism.arx") ;; make sure it's loaded..." Q3 {) }, d3 S" z4 W) c- G
    (imageadjust ename)5 K1 V+ I# q/ U3 m$ C7 p; m
  )8 V9 z% W$ Y4 F' ]
. ~1 H2 O" |0 O' v8 B
  (defun ddimage ()
1 m% _& X# x2 U5 M/ T! m  L& V( ]: d    (if (not (new_dialog "ddimage" dcl_id)) (exit))3 R) N7 F8 u1 z5 W5 n
3 ?- N' I, ?, I6 }1 y2 z
    ;; Grey out the thickness field.
: |$ Z5 f' w3 K/ d: x$ C    (mode_tile "b_thickness" 1)9 E6 {$ Z5 v( Q; O/ j, S1 N
    (mode_tile "eb_thickness" 1)
. }  M9 F* G) d, Y+ ?# z6 Y% e! W: U# b* K
    ;; Get the associated def object.
$ O- R# q2 `8 O9 n    (setq image:oname (cdr (assoc 340 elist)))
6 ]5 r# C. k" J. }" i7 e2 E9 R    (setq image:olist (entget image:oname))
8 j* Q6 ?* B8 b0 ^. }( W9 [2 R: p& `1 p
    ;; Set initial tile values8 R+ O! S. s) ~+ @
    (set_tile_props)
4 [/ \, A% \  A2 }    (set_tile_handle)9 }' [9 x. o. c* \
    (set_tile_pt1 0)! o! e8 w5 g; A' G
    (setq image:scale (image_scale))
. I5 F; Q2 \& C: Z  n    (setq st_ang (image_rotation))
5 X' H( `3 `# A! }7 K$ x: O    (setq image:width (* (distance '(0 0 0) (cdr (assoc 11 elist))) (cadr (assoc 13 elist))))
( Y% ]. b! L5 l% G! l/ P9 k    (setq image:height (* (distance '(0 0 0) (cdr (assoc 12 elist))) (caddr (assoc 13 elist))))
2 T4 }7 b% `( N, Y# j    (setq image:options (cdr (assoc 70 elist)))
( f8 b2 f/ S/ l" M- U2 X2 @" I. e
- ~. A/ g: |. x& s; E: |3 b    ;; Record the last multiplier for use in image_update function! [: ~% {4 ]- Q  A; w
    (setq image:mult 1)( h. l2 V! R9 j7 Q1 Y8 t9 P! F
5 r9 z6 M3 }+ {/ W( N  e2 M
    ;; Retrieve the image name
- ?! c3 V, H  E: u( J$ s& o% l$ J- {    (setq fn (reverse (dictsearch (namedobjdict) "ACAD_IMAGE_DICT")))0 G  i% F+ c8 ^6 u0 V# u
    (setq flag 0)
* F2 m* s! X; J    (foreach n fn
6 h9 {) v' `" K; v      (if (= flag 1)" e6 G: K- A5 U7 S% ~0 n& D4 Y
        (progn
, G* q7 q0 r7 a; ?( a          ;; Display the image name
; G% g2 @' k; J          (set_tile "image_name" (cdr n))" ]( L. B/ N4 O7 T1 A
          (setq flag 2)
: o7 h# ]9 ^% Y. j5 u7 S) d        )( P- e( w5 d: ?* f# |+ y: H
      )
6 x* c1 E1 \$ O2 N: L# M$ b      (if (= flag 0)2 R. K6 U/ J1 J
        (if (equal (cdr n) image:oname) (setq flag 1))
3 g, S3 P: n. ?6 J% V      )
6 ?: S3 S1 H& d+ L$ p+ ~- k2 h    )
: @! ?" }: [/ P6 {8 O8 r
5 e) V' u. C( c# @    (set_tile "image_path" (cdr (assoc 1 image:olist)))- t7 S5 ~8 t6 B, i
    (set_tile "st_ang" (ai_angtos image:angle))
: N4 L1 j: g6 v  ^7 Q    (image_set_tile_scale)
# ?8 ]* F$ @5 [" W* |
' h% z1 p2 F' T# ?0 @* Y# ?    ;; Check the appropriate boxes
6 D1 U$ K3 W8 |$ A9 {7 Y. Z    (if (/= (Boole 1 image:options 1) 0) (set_tile "image_show" "1"))& W4 W* C9 y. o1 H/ |" r
    (if (/= (Boole 1 image:options 2) 0) (set_tile "image_non_ortho" "1"))! [( L* d+ q2 s/ v% l. r" M/ P8 u
    (if (/= (Boole 1 image:options 4) 0) (set_tile "image_clipped" "1")): A" Y6 x4 r7 V# ~
    (if (/= (Boole 1 image:options 8) 0) (set_tile "image_transparency" "1"))
! R" W0 m7 a, ?( s
! c5 r, q+ _7 c8 B$ U9 u    ;; Define action for tiles# `0 w5 @" U5 p" D9 K: W. G
    (set_action_tiles)
2 a0 w* p! S+ C3 y; m. n    (action_tile "xscale" "(image_update \"xscale\" $value)")1 n6 m+ j0 Z* V- ?7 t) S# f& w
    (action_tile "st_ang" "(ver_ang1 $value)")
) v9 n2 x; G0 E/ w    (action_tile "wid" "(image_update \"wid\" $value)"): v) ]" m2 R2 {3 L8 S, F
    (action_tile "hght" "(image_update \"hght\" $value)")9 l5 C5 q, c3 `9 b% a8 n
    (action_tile "image_show" "(image_disp_opt 1)")
( D- r. F$ d: V$ E1 L( n% s    (action_tile "image_non_ortho" "(image_disp_opt 2)")
# G# D( }! T  T& l    (action_tile "image_clipped" "(image_disp_opt 4)")5 v( @2 x* _& i( m
    (action_tile "image_transparency" "(image_disp_opt 8)")
" u3 |  Y$ v% k6 X/ J4 ?    (action_tile "image_adjust" "(done_dialog 4)")# f! a# x4 x) y* o) y

0 x! L/ X& \) j2 _- J/ W( ^, L    (setq dialog-state (start_dialog))( _4 p% x. z9 p, Q% h9 {# B. e+ A0 I
    (if (= dialog-state 0)
& P0 [/ M1 E2 g      (progn
7 s5 y9 r9 Y0 p+ y1 z# g        (reset)6 W/ C6 a$ z" W. h4 [2 O* E
        (image_clean_variables)
+ U3 V, `+ {0 L  I2 Q/ R      )8 Y# [# }8 R% E
    )" R: e2 v0 y8 T. S
    (if (= dialog-state 1). k& T" F& F1 `% ]& R6 E
      (progn
! o& ~- M" f7 L1 i        (modify_image)
3 B  T; W8 }) ^" N$ ], c0 w        (image_clean_variables)1 ?4 v' h! _- ^! u8 f
      )8 y: |3 m( a" I, v  y
    )
3 U; E2 X/ X, i3 o7 k3 E: w7 D1 Z# F: ^    (if (= dialog-state 3)
) c/ G7 n# V" N& t8 {+ u      (progn. U( K( L" e6 T; j, i+ w0 N
        (modify_image)1 |% Q# V3 p" Q, C0 c3 O$ @  n: k; T
        (image_clean_variables)0 P7 T+ g! N" C& O4 ^
        (setq pt1 (getpoint (list x1 y1 z1) "\nNew Insertion Point: "))
) H6 o( O% ]! U        (ver_pt1 0)7 N+ S9 p8 z! c. z$ Y/ G# g
        (ddimage)) M1 n  A8 h9 M; G7 r) S- s
      )
/ C8 B/ I9 u' G" U    ): |& b9 U6 z" ^* Y" [" G
    (if (= dialog-state 4)
: }% c: [/ r& P/ k      (progn
$ x  K9 ?2 g0 h7 D0 y        (modify_image)/ f! I' B$ G8 G. C8 e- C
        (image_adjust ename)
# J; b2 e; a2 i' k* t9 F8 v# K0 s        (setq elist (entget ename))
) F! Z  L5 E% a( m5 X- L$ G6 T7 l% k        (ddimage). e" P  o  y  F: @' }- _
      )
8 e' w; q. i- A; k; |, E    )
* Z/ V; [2 _8 }6 P  )
6 c; l9 Y! p2 h* n
  a  t$ Q# ]; f# _+ `- w! ?! B: o( C4 L  ;;7 ]2 ?6 K' v, }2 }4 X. r6 W5 n* x6 n! V' ~
  ;; Modify BLOCK (and its Attributes, if any)  H) \) z2 o) x$ G+ J$ U
  ;;
) V# d4 [, D+ D+ u0 k' b( r  (defun modify_block ( / el en2 p1 p2 oldp1 oldp2 new_hgt old_hgt attr  M' F- x6 u6 O! C. d
                          new_wid old_wid old_rot scaling old_scale
8 o* q. z$ d. @. {" c' M                          xdelta ydelta zdelta xbase ybase zbase ipos)' c0 H1 @* X/ O3 B6 l9 D" t
    (modify_properties)
6 Z# Z6 u$ C" W# q# v4 J6 O, X  S: \
    ;; First, translate and scale the Attributes, if there are any.. p: h' T4 n% n
    (setq old_rot   (cdr (assoc 50 elist)); v$ c! U- M7 ~- Y: |8 b
          old_scale (list (cdr (assoc 41 elist)): @# S" U' P' V4 v
                          (cdr (assoc 42 elist))
  s. [- O4 O' o- f* W6 A0 Q. `' j                          (cdr (assoc 43 elist))
* }- U, R: u; J4 F, _3 k                    )/ P; x1 m- Z( q3 W: j3 S
          scaling   (or (/= xscale (car   old_scale))1 y# ?8 n; `4 x5 b2 g& u
                        (/= yscale (cadr  old_scale))9 c/ C- |3 `; K- G  i3 ~7 G
                        (/= zscale (caddr old_scale))
) f+ z1 I/ H) R- G! v* p/ I                    )
0 S  u3 }' y, h& k% b- x2 f          attr      nil               ; No Attributes modified yet
, j' d& g7 e' [' ^    )9 k/ Q$ K, s& c, n' B4 C+ {! E
    (if scaling7 T. a* u4 N. J# H3 f7 [
      (progn
" K: J' w/ I# j: ]+ A        (setq xdelta (/ xscale (car   old_scale))
; U2 Q5 G8 z* P              ydelta (/ yscale (cadr  old_scale))
* A5 a! y2 {$ t4 ~              zdelta (/ zscale (caddr old_scale))
& i1 Q) ]6 \- G# V. S& b              ipos   (cdr (assoc 10 elist))- f5 ]& s$ }5 c4 y: u8 G
              xbase  (car   ipos), }: C: }7 o3 ?# t
              ybase  (cadr  ipos)
2 m2 J8 T; i7 M: E              zbase  (caddr ipos)
3 ?# u9 O% R$ c& }) W              en2    (entnext ename)  ; First Attribute9 G- U; Z3 v! [6 W& H: `# i
        )6 w% |6 t' R- M: n9 f9 Z

, u8 s/ p3 m7 R. h' d# Q6 e  r        ; If the Block is rotated, temporarily un-rotate it, along
# L! X5 {, h7 T4 ~        ; with all its Attributes, so the scaling/translation of the
; y: p2 r# Q* D/ Z6 B9 Q, y        ; Attributes won't have to take the Block rotation into account.: x" E/ t9 d& y/ o; m* Z
        (if (/= old_rot 0.0), u+ Q5 A. S7 D5 B$ M; p  n. U2 ?6 e
          (progn) `% {) m. x6 H( c  D3 t. v+ I
            (command "_rotate" ename "" pt1 (ai_angtos (- old_rot)))
* _; x- \6 f0 g            (setq old_rot 0.0: L; [5 K( v3 C* L
                  elist   (subst (cons 50 0.0) (assoc 50 elist) elist)
% T$ Z' p& R$ P            )
  w4 r8 D9 Z) ?& m# k  w$ }1 }          )
9 m' Z6 t" n) I, h/ x6 a) m        )$ F3 r5 x+ r. H. k  I& [3 W
" v  T  D7 s5 ~3 Y$ ]
        (while en2
: v! ?8 b+ ?5 c8 v- F! m- |- Y; q          (setq el (entget en2))
2 I1 t; q! u" R; c! k! D5 [          (if (= (cdr (assoc 0 el)) "ATTRIB")9 F+ z. O% y. t: i) s* {$ |  b
            (progn
/ O( Y! f, d: X- l' g4 D) u              (setq old_hgt (cdr (assoc 40 el))  ; Height
+ B% n- s. o% o                    old_wid (cdr (assoc 41 el))  ; Width-factor* u, B3 c& ?" z8 k9 `
                    oldp1 (cdr (assoc 10 el))  ; Generation start point. X' V- a! ]8 O" u" P
                    oldp2 (cdr (assoc 11 el))  ; Optional alignment pt( z2 M/ J1 v& n
                    ha    (cdr (assoc 72 el))  ; Horizontal alignment
7 Q& s% B$ |' |( p% d5 h: ]/ M                    va    (cdr (assoc 74 el))  ; Vertical alignment, W, {/ ]) R4 [
) m  \; i' ]1 X1 U( j
                    ; Translate gen. start point: H6 Q* b+ U6 s
                    p1    (list (+ xbase (* xdelta (- (car   oldp1) xbase)))+ X* h+ c; _$ ^) g
                                (+ ybase (* ydelta (- (cadr  oldp1) ybase)))/ E1 E9 k6 n# d7 U& n
                                (+ zbase (* zdelta (- (caddr oldp1) zbase)))
# L( m$ Y+ R* @$ k                          )
2 v5 u' I! r; F, H- [                    el    (subst (cons 10 p1) (assoc 10 el) el)- h1 q$ `' w7 \6 m  m# z+ j1 D, {
              ); }# Q8 N; F& K1 w  v

7 z2 Y0 i8 Z3 p  J, c! O              ; Translate alignment pt similarly, if present and applicable
$ v% m2 g+ q1 S* j% [0 n, z              (if (and oldp2 (or (/= ha 0)3 j7 C( Z% O' [3 \' J
                                 (/= va 0)
% u6 E! L+ o' F% ]                             )" u1 p' j' P2 X  c, d3 b
                  )+ S5 E3 s  U5 b/ w! q8 v) J- u' u
                (setq p2 (list (+ xbase (* xdelta (- (car   oldp2) xbase)))
& A- s, G" L0 n# R1 N. A                               (+ ybase (* ydelta (- (cadr  oldp2) ybase)))
! |) d; H8 c1 p  l                               (+ zbase (* zdelta (- (caddr oldp2) zbase)))6 e2 d0 p. u. i& _! _
                         )
, N0 |7 H$ R6 b9 l$ F0 I                      el (subst (cons 11 p2) (assoc 11 el) el)
; L- e6 p* E# o; A! C0 W4 j' Y                )) x- j6 g7 k! X0 x% X) R+ Y8 J' m
              )
% _- n3 I8 w4 Z- g  N3 O. c) V. C5 R0 L5 h( {
              ; Each Attribute's height and width-factor were computed3 v7 {2 C6 ?& Y
              ; based on the Block's scale factors.  Adjust them now,$ P7 k% {3 w' M
              ; by first reducing to values for 1x1 scale...2 q# G( J% }' g- q/ m
              (setq new_hgt (/ old_hgt (cadr old_scale))
* w$ @# C# `+ J                    new_wid (/ old_wid (/ (car old_scale) (cadr old_scale)))
2 r$ B* }  _) ]+ ^0 M( O1 a- t% ~) Q              )
& W: x5 X, X" T9 [# V& N6 c              ; ...and then rescaling.
: b( G0 Y3 o8 x              (setq new_hgt (* new_hgt yscale)4 ]# w. Z3 T, ]* E9 D
                    new_wid (* new_wid (/ xscale yscale))
4 O& G9 R& ^) N2 f# U: Z: w6 E              )( A. c- s7 g( P
              (if (/= new_hgt old_hgt)
& j; W. s* L/ x- P5 j                (setq el (subst (cons 40 new_hgt) (assoc 40 el) el))! m1 K: t! m/ i6 ]6 i
              )
1 F5 j/ Z" ]4 b4 j+ @! {              (if (/= new_wid old_wid)% J7 G& u4 z. d* d) r6 j2 \" a4 r0 b
                (setq el (subst (cons 41 new_wid) (assoc 41 el) el))
) g6 {0 V7 n* U2 Q              )) g, Y" u0 ]1 s$ }3 V
              (entmod el)
4 S4 }; Q- Y# D( h3 p& c1 Z  t              (setq attr T             ; At least one Attribute modified$ O' F1 n) }& W7 n) j
                    en2  (entnext en2) ; Next Attribute
- w7 S, o# _- h) H              )  R* \% x3 p( ]
            )
. Y, w9 i5 z- \" ~0 {            (setq en2 nil)          ; No more attributes9 o1 M& |2 E. P/ K4 D  H
          )
3 |7 u- `+ A8 X        )
) g% q1 f" ?' a# v      )$ K' h# F6 m% `. Z
    )5 F5 F' e& a$ M# O, X4 e
9 Y! _6 H+ U  c7 [' u: U( g: j5 F' W
    (setq pt1 (list x1 y1 z1))( Y# G0 i! c# G
    (tempmod xscale 41 nil), F8 ]0 s2 Q7 @2 o. n
    (tempmod yscale 42 nil)
) G7 c7 x9 W: O: c  x& U# V4 A    (tempmod zscale 43 nil)
% J& x  G+ H# M/ Q8 e3 t- |    (tempmod col-sp 44 nil)  d  Y/ ]; N6 q2 H7 b, a9 H0 E
    (tempmod row-sp 45 nil)
2 E/ `1 q) y, v2 X: M% |    (tempmod columns 70 nil)
% w! X7 g8 R$ p7 R' e    (tempmod rows 71 nil)
1 d* X6 Y' K# d" f: n    (if (= xclipmode nil)8 }0 H9 \5 F% V' H; i7 y' ]! G+ H- ?9 `
       (entmod elist)- u# e; ]+ t  z+ ]5 R# @* T7 N+ Y
       (setq xclipmode nil)1 n) I3 `* V0 Q: y* p
    ); [. C8 l  @/ A& j
    (move_pt1 1)
5 d' J$ M9 T3 l% Z( |0 X; X, z( I3 s* o. j1 c
    ;; Now do the rotation with the ROTATE command.4 F4 Y$ Z4 S  ]# g6 [7 j
    (if (/= old_rot rot)2 q- T+ y& `& j: ?+ [$ B
      (command "_rotate" ename "" pt1 (ai_angtos (- rot old_rot)))7 [, J& T- e3 W, C
      (if attr                          ; Else, if attributes were modified,
, o/ p* j% ^7 Y        (entupd ename)                  ;   just regen to force attrib display
4 d8 p5 f+ S$ O5 |4 e$ O3 }% u      )
. \# Y. M  P4 o    )" L0 P7 _4 |* U9 V/ Z
    (setq elist (entget ename))* b+ ^1 R( F5 _+ [2 I* [
  )
# v, N/ |" l" A  (defun ddblock (/ temp temp_xclip newhatch blkname blklist blktype program xrefpath)
5 J% |2 B4 B7 X* d, F0 S4 o    (setq newhatch 0)
  r- |; n) A0 s    (setq blkname (cdr (assoc 2 elist)))
. x8 _8 r& C; t. }8 G; A    (setq blklist (tblsearch "block" blkname))
$ q. i% W7 Y/ h8 w    (setq blktype (cdr (assoc 70 blklist)))
4 m# W: \$ O5 |! t7 I    (setq xcliponoff 0)
# c3 o5 e# I2 a1 s    (if (or (= blktype 0)(= blktype 36)). K) C! l: S+ i  t
            (progn
& z" M3 z9 [3 x/ y              (setq xcliponoff (xclipon elist)); N$ `7 v9 R  e% i% u  j
          (setq temp_xclip xcliponoff)
& H) @: o6 T% z' s1 V        )
2 f& Z7 L! N$ m3 i8 [2 c    )
) G$ N% W8 H) k    (if (= (logand blktype 4) 4)
6 e4 w9 c- E+ }# X* m      (progn
1 s( d) X, P2 W2 S6 A$ m* i. o        (setq xrefpath (cdr (assoc 1 blklist)))4 F) o, L+ u+ u% U: G
        (setq help_entry "modify_External_Reference_dialog")
5 x9 l! ~" \3 q        (if (not (new_dialog "ddxref" dcl_id)) (exit))6 s8 N5 ^# P7 S3 [7 Z5 z/ P
        (set_tile "Bl_name" blkname)# o- k' x% S' c- E0 A9 ]
        (set_tile "path" xrefpath)
, h& O& a8 \3 ]& Q1 @% h1 _      )
1 Y; d+ P; a! r' f      (progn) K1 Y* d" p6 Q+ T
        ;; Get program name for use as Xdata app name$ B4 y# X# m3 F- n: D6 I
        (if (not (setq program (getvar "program")))
7 w5 z1 g, {6 H6 c. p           (setq program "acad")! \* c( d6 @) t( y( I
        )) m1 x  J9 {! t* ?' M
        (if (and (setq temp (assoc -3 (entget ename (list program))))
0 g8 `" c* l' J. Z9 r# P# ]& i                 (= (cdr (assoc 1000 (cdadr temp))) "HATCH")5 c  N7 b5 _7 H% Q  X
                 (assoc 1005 (cdadr temp)). i9 Z' @0 L* ]. o* o# h
            )! w& l' B5 U$ ~
          (progn9 N8 m! P' I, A/ h' r6 S2 b$ X( u( F
              (setq newhatch 1)* {+ y$ D7 x  p, s" G; g; v7 N
              (setq help_entry  "modify_Hatch_dialog")) g2 p! I0 f/ N- {
              ;;; convert the object into a new hatch6 K3 t7 Z, [7 J" I1 n: h* V
              (ai_undo_on) ;; enable undo
. _- f0 z+ K7 R; X! m% {              (COMMAND "_.UNDO" "_Mark")& W  z" n1 x% ]" ^6 P) G
              (COMMAND "_.CONVERT" "_Hatch" "_Select" (cdr (assoc -1 elist)) "")+ F; h3 O- W  `( g  w. A4 F
              ;;; suppress nasty message from convert command7 }6 G  J1 O% I
              (princ "\r                                                                      \r")
7 ~9 S* A. b0 h5 [  l2 X              (setq elist (entget (setq ename (cdr (assoc -1 elist)))))% m- h+ R6 X, f! F
              (setq old-elist elist)
; r- T3 e. F+ ?1 j5 g7 [) P, Q              ;;; If we have cancelled ddmodify; `7 T: V2 Z0 o% I1 Z
              (if (not (ddnewhatch))      ;;; (ddnewhatch) returns nil for Cancel or T for Ok
( I5 S* E9 |# M% E+ }                   (command "_.UNDO" "_Back")
. c! w; g4 b5 b2 q% k              )
: ^; U- T3 }, H! h) ~8 K7 y              (ai_undo_off) ;; restore undo state
' K( `8 Z- k! {1 c          )" {! W* o. i- J5 f$ s7 `' k+ C$ ^
          (progn
" X3 a& l0 C  q+ {* [6 L% R' Q4 P: b            (if (not (new_dialog "ddblock" dcl_id)) (exit))' o9 x' ~; b  C# \* t/ H8 q/ }
            (if ( = "*" (substr blkname 1 1))
/ r$ p. j, M8 Y/ r' c              (set_tile "Bl_name" (strcat blkname " - Anonymous block"))
) g! F3 x# L' ?7 q3 H              (set_tile "Bl_name" blkname)
9 S, V  \2 O5 ]            )
, Y0 Z4 L' Z: u            (setq help_entry  "modify_Block_Insertion_dialog")
2 g* x- [; o' _$ |          )# d4 p  c9 {; g6 r
        )1 D2 l* M2 S8 p5 Z
      )0 d( N7 Y( U  d6 b& M9 U, R; {6 X
    )% G1 w" {: [1 o0 O6 G( S
    (if (= newhatch 0)
: K4 k! O( j! ?      (progn% _6 B( f3 n& |
        (set_tile_props)& E  |+ N+ J8 u8 G
        (set_tile_handle)# x5 u$ e, m, z5 J* R
        (set_tile_pt1 1)
: W$ w/ W" ^5 u, ~" R: M        (set_tile_rot)$ I/ a% p4 v# {4 X/ _2 h
        (set_tile_scale)7 k% X6 }. j% [+ ~
        (set_tile_rc)  H) E0 |+ y5 Q8 V9 w$ ]1 c
        (if (= (logand blktype 1) 1)$ J5 y" I0 L! u+ x1 `6 K5 c5 g
          (progn: ~: j$ r* d2 X' S$ A) q8 j! I& `
            (mode_tile "xscale" 1)
; J( U1 h/ [9 A6 V/ d            (mode_tile "yscale" 1)# T4 W5 A1 R9 Z0 i& N" o! o
            (mode_tile "zscale" 1)3 e9 T( E$ d' k' k
            (mode_tile "rot" 1)
$ H0 s/ T( [7 O7 t* \- w: ]            (mode_tile "columns" 1)9 e" d. y2 j. O1 K1 Q" e
            (mode_tile "rows" 1)8 x: s( Z" J" t' s
            (mode_tile "col_sp" 1)5 q( ~; ?8 U% S  a# g) Y
            (mode_tile "row_sp" 1)
$ k' X& V+ g! R% j+ V) T. P          )9 X, s+ c6 G( y7 d1 m8 B
        )1 T& ]- m! D4 o2 ~9 i" [4 M; \3 I
        ;; Define action for tiles
- m3 X7 K- m# b" p2 L- f        (set_action_tiles)! o( r) o1 Z/ z* g' c( U  C  g
        (setq dialog-state (start_dialog))' f' @" U$ c5 a( n
        (cond9 |+ a, I' n" P5 S
           (  (eq dialog-state 0)( u& {' k) l/ }* }8 h6 |
              (setq pt1 (trans (cdr (assoc 10 old-elist)) ename 1))8 x9 Z' N; s% D. s/ K( V
              (move_pt1 1)
7 b+ @: B( v1 Y0 u# {( j& C, K% x; X8 j              (reset))
+ v2 ?' v. Z$ U           (  (eq dialog-state 1)
  c0 }- ~% l6 T3 i+ V6 G              (if (and (/= temp_xclip xcliponoff) (or (= blktype 0)(= blktype 36)))8 g" S) d( {, ^3 q$ `) [. g
                (xclip)
. u. K/ _& k; `: D              )7 t* f( L! I% N' E) Y
              (modify_block))
8 d% o/ T6 H! E7 c1 F           (  (eq dialog-state 3)
% U9 M1 c6 ~  N! }. _              (modify_block)
* ^/ q7 ]" y  r& S              (setq pt1 (getpoint (list x1 y1 z1)  "\nInsertion point: "))
, u% Y  k# b# J4 V              (move_pt1 1). ?" ~7 l/ m' G# \, ?" _# \% k3 ^
              (ddblock)). X" H3 H  \% D1 Z+ a
           (  (eq dialog-state 4)8 F9 J: q  Z9 {# e( ~
              (modify_block)
+ o# {6 M( g* l& t              ;; Get current handle.
1 p5 J* c  b( l+ S0 @, h              (setq hand (cdr (assoc 5 elist)))1 A: f6 f: L  H% L! Q' u
              (command "_hatchedit" ename). }9 C9 ~5 z0 A
              ;; If OK in hatchedit, a *new* entity is created and the old one/ a1 B5 O! ^* N8 B
              ;; is deleted.  So if the old one exists, it must have been a# V! q3 h- P* u+ h1 h
              ;; so rest the entity.0 W9 I! ]3 V' ^. P0 j
              (if (entget (handent hand)) (reset))& |! Y, j2 L4 a) s$ f
           )! l; a3 |) x* Q
        )/ E5 `* `1 p4 c) s) i
      )
  [7 T- G" G; \2 V    ), b6 P  s# K- {# a5 m. S% C) h! u
  )! K# m' i( t7 f4 i' @* Z$ b
  ;;3 l# ^, O3 F- i) |
  ;; Modify SHAPE
) x* w0 B0 {$ b1 Q4 u: q  ;;
$ ?' Q. X  _$ N: A  (defun modify_shape ()
. A. C6 z; ]$ J    (modify_properties)  J& I  ?' p1 ^: k
    (setq pt1 (list x1 y1 z1))
* S5 Y' w! G; a    (tempmod pt1 10 1)
8 y1 n) [2 M0 l: ^    (tempmod hght 40 nil)+ U' ~( E4 Y, D8 @# u# U
    (tempmod wid 41 nil)  U+ i+ L1 s% L0 u
    (tempmod rot 50 nil)
4 M- H7 a% G: U# r* e+ e    (tempmod obl 51 nil). q3 c4 Z1 ?; o6 @
    (entmod elist). t/ `# D2 i; z$ i5 y: l: }; x% N
  )
' u0 R/ x; Z' O$ D. u, }5 c# U% F6 V0 k0 n3 J- G
  (defun ddshape ()
* d, `6 }! h$ G0 J    (if (not (new_dialog "ddshape" dcl_id)) (exit))
, ?& b  Q, M9 h. a! ~; r5 |7 ~    (set_tile_props)9 B2 [4 S, Y* O( x0 ^( c
    (set_tile_handle)
7 x& }! b6 A5 C! V( ?    (set_tile_pt1 1)! x, Z( [* c" x. l- r
    (set_tile_rot)! S) o/ d# D2 v+ m  O& o+ j
    (set_tile_hght)
2 ?5 C' z# h) X' _# V9 T    (set_tile_wid)
& }/ ~. P0 ^  W$ @    (set_tile_obl)
7 F; b, f+ H2 X* R' l) r" }    (set_tile "sh_name" (cdr (assoc 2 elist))), m# v" R7 z+ H+ V4 I4 b* c
    ;; Define action for tiles! {* G& Y9 j8 H" d3 I& d& Y- v' `
    (set_action_tiles)+ R. I7 [* s8 @  f1 x7 C
    (setq dialog-state (start_dialog))
3 X( z8 W: x+ Z    (if (= dialog-state 0)
  n0 ~- ?, Q1 r+ e      (reset)
. ]8 y3 |" [2 w    )9 z5 _" p7 G# m
    (if (= dialog-state 1)' L7 R; `, V% R) p/ [
      (modify_shape)5 w) h2 L3 m/ `1 [
    )  N' C7 j% z, t" }3 T4 x
    (if (= dialog-state 3)+ E% q0 O* Y. O' c9 d) L) W
      (progn
8 x& h$ s: B4 O0 M+ v: q2 B! ~        (modify_shape)
  A: h9 o% s" S0 ^( q1 s        (setq pt1 (getpoint (list x1 y1 z1)  "\nInsertion point: "))
. B$ l" V8 v5 K        (ver_pt1 1)" f! n5 @3 O5 V5 @+ T# _
        (ddshape)* M7 d1 A  N9 d/ D  a) T
      )
* j5 i3 I+ T+ \* s    )
3 A! K8 h2 t; Q+ U- y* _$ h  )
' w  ^7 w/ q" t( w( V2 G  ;;
3 P% Q: O" T' d; U  ?& a  ;; Modify TEXT or ATTDEF
: C! _" C( G( @8 A- n. X. N  ;;; t* }: t6 o5 g) z9 n
  ;; Set bit code for upside-down and backwards setting
& f* `, _7 t3 X8 X2 b7 ?  ;;$ s, q) k+ D* ~
  (defun code_71 ()
! q( J# w- |% t, g2 t( }    (cond ((and (= bkwd "0") (= upsd "0")) 0)
1 d8 @  g/ A. _. W          ((and (= bkwd "1") (= upsd "0")) 2), n3 O3 j0 q. r; ~
          ((and (= bkwd "0") (= upsd "1")) 4)* Q) o. s2 H6 b2 M; }( l* U4 `( L# N
          ((and (= bkwd "1") (= upsd "1")) 6)
) d/ l, X; n8 }% Z; t/ j    )) P  o0 `5 j$ o4 |: z2 r
  )
/ n/ [) I  ]. K6 p% e. |  ;;+ Z: P/ w+ ~+ l- U2 x9 ?5 H' q1 g$ W
  ;; Style action.  Reset widget values to style defaults4 r5 n1 F) n0 c$ g% V
  ;;
) V' v. q! l. _! z  (defun style_act (index / style-list)2 [  U/ O6 G6 Z& m( |
    (setq style-idx (atoi index))3 Q4 M$ H1 q4 m# Y+ ^4 U
    (setq tstyle (nth style-idx slist))" z- L2 o0 F: S: Y: F; ?; E
    (setq style-idx (itoa style-idx))
4 T; h; K  \  E+ `# c7 A    (set_tile "style" style-idx)
$ a3 u  r8 b0 X  W0 `    (setq style-list (tblsearch "style" tstyle))
% e5 V' X1 j* I9 a    (setq shght (cdr (assoc 40 style-list)))3 k; v; X1 `3 B0 h  }
    (if (/= shght 0)/ H% J4 w4 H+ F7 k& Q" b
      (progn
% C& r1 \4 Z8 `% C( B' r        (setq hght shght); r: n* q+ \$ d  x; G
        (set_tile "hght" (ai_rtos hght)): i, V- P" ?2 W" ^; |7 C# ~
      )
% u9 b! ~6 T8 {% h# o; l    )& O" u0 O  @' C9 E& n  I3 U' n
    (setq wid (cdr (assoc 41 style-list)))6 x; G1 t3 U9 P2 O/ v: O+ r
    (set_tile "wid" (ai_rtos wid))
- d# D/ v$ I" i# E& o    (setq obl (cdr (assoc 50 style-list)))
' r' P, k$ Q) b! J    (set_tile "obl" (ai_angtos obl)), J, v( L* s( o
    (setq bk-up (cdr (assoc 71 style-list))). b" S8 w/ \/ `) G: `: o& H
    (if (= (logand bk-up 2) 2); @$ E$ g& k' Z
      (set_tile "bkwd" (itoa (setq bkwd 1)))
% N+ `5 ^" e% G" m/ M2 _2 M8 \      (set_tile "bkwd" (itoa (setq bkwd 0)))% [+ U$ @' u2 H) D, l0 r$ x
    )( ?! f1 @- P' @8 ?7 j9 H5 U3 X
    (if (= (logand bk-up 4) 4)
0 b6 B4 s# C4 d. @0 }      (set_tile "upsd" (itoa (setq upsd 1)))
' ^7 n* H% w% g" d' P6 f      (set_tile "upsd" (itoa (setq upsd 0)))
' @7 C3 _& s6 \  [    )
* ~; U- _# T2 ]  )
$ U0 T; t% T. x5 m. C  ;;
/ ]8 N7 X! Z& I2 v  ;; Justification action.  Set vertical and horizontal alignment variables,
( ~3 E0 L* Y+ h5 x2 Z) s2 F  ;; grey out rotation and height if alignment = "aligned", grey out rotation8 x' h+ A- x7 a. Q" p
  ;; if alignment = "fit".
) d# r/ W0 C4 ?/ ^  ;;4 X& C% Y$ a, t" V; @& ^7 S: r/ _" Q
  (defun jlist_act (index / templist)
' U/ M# o' n. @! p0 e    (setq just-idx (atoi index)), y, s  B( Z) B& V9 `$ G
    (cond
/ q5 N. B3 }4 Y: T+ x& q      ((= just-idx 0) (setq va 0 ha 0))
1 }% D$ l0 ?& L: V4 L      ((= just-idx 1) (setq va 0 ha 1))
  T9 c# a! T7 e! |$ |      ((= just-idx 2) (setq va 0 ha 2))3 F& Y1 P; Z: c  U- g5 m9 _% U
      ((= just-idx 3) (setq va 0 ha 3))0 c3 L8 ~6 |! k# |" y, B  w0 E
      ((= just-idx 4) (setq va 0 ha 4))
5 S0 S9 V+ J; e* L      ((= just-idx 5) (setq va 0 ha 5))
+ \  P, b0 N  f" y# C      ((= just-idx 6) (setq va 3 ha 0))
8 ]- r* j" `9 j. Q, ?( m2 U      ((= just-idx 7) (setq va 3 ha 1))3 k- ?# p+ f% A8 p
      ((= just-idx 8) (setq va 3 ha 2))
% k9 z4 O+ L4 I: q      ((= just-idx 9) (setq va 2 ha 0))6 {3 l! L. u! p% s5 x% L2 Q
      ((= just-idx 10) (setq va 2 ha 1))! W- }" N9 _1 u7 P2 U( z' [
      ((= just-idx 11) (setq va 2 ha 2))
, Y; G' j, L" s9 `      ((= just-idx 12) (setq va 1 ha 0))
' m2 c  A( {- e( U      ((= just-idx 13) (setq va 1 ha 1))
4 C, W# H3 X: @9 z      ((= just-idx 14) (setq va 1 ha 2))0 \9 v7 V6 Q# D1 O. P& `8 e
    )' B1 e! X$ ]# s
    (if (or (= ha 3) (= ha 5))  ; If Aligned or Fit text( P1 m' V, P8 x2 _* N
      (mode_tile "rot" 1)/ H( C% i0 e- Z' V4 x/ J
      (mode_tile "rot" 0)
- P8 J& n  [4 H& T4 e1 I    )
2 ^; r7 M+ B3 h8 |- A# W4 z    (if (= ha 3)                ; If Aligned text
; O( F2 U( @5 T1 {: l      (mode_tile "hght" 1)7 n5 r8 n1 P/ X# J
      (mode_tile "hght" 0)
/ v; t& Q$ r) o  y: c& r! M8 M    )
4 ^' o0 m& T# v: ^    (if (= ha 5)                ; If Fit text! e8 M/ J# y$ _6 _/ F9 ]
      (mode_tile "wid" 1)3 }" q7 T6 b( r' s
      (mode_tile "wid" 0)4 F/ p& w* p# @/ e: W7 P
    )
: D9 c# D2 D& V! l/ a' P5 M$ {    ;; Reset rotation and height if changing from aligned., L% s8 F% d: u
    (if (and (= ha-prev 3)  (/= ha 3))
$ W  P3 y4 C) |$ n1 _; T/ P. q0 ~      (progn
7 ?* r3 j% m4 V  E; l$ v$ K# I        (set_tile "rot"  (ai_angtos (setq rot 0.0)))' W" d; ~. U# G. T: h" I5 z' P. y; W
        (set_tile "hght" (ai_rtos (setq hght 1.0)))
- W% G) e4 s1 e% \  ?  V# @      )9 w+ S6 t' ?( e& B3 m6 I. Z
    )
' Y4 v/ J; U& c! Y' M% T# v
/ K$ H  h- q" {3 `2 T    ;; Reset rotation and width if changing from fit.4 f- k( u/ C+ ?% m# E% s. k: {
    (if (and (= ha-prev 5) (/= ha 5))1 u' T$ N3 F- f6 k2 Z" r9 S1 b
      (progn
. W9 {6 f% B- ]6 y1 j        (set_tile "rot" (ai_angtos (setq rot 0.0)))7 h$ [% n) P* p# N/ N$ l7 ^& |
        (set_tile "wid" (ai_rtos (setq wid 1.0)))
. {" d1 d* {! v+ P/ O. r$ e      )
0 H8 V( f. \8 u0 C7 r    )2 U. V/ r# U5 o( m3 T( s
8 L4 p' z3 i% l6 n' L' n, A
    (setq ha-prev ha)           ; update ha-prev for next time
: g$ W# B; y- w$ Q, P    (setq just-idx (itoa just-idx))
- `* Z7 z7 K$ X  ). S' i8 _$ v) u/ J7 E  d/ U' a
  ;;4 D) `$ H/ |1 `: m$ ?/ c% J: v  J
  ;; Set intitial alignment setting based on vertical and horizontal alignment
) j" A, y5 W! S3 j, I4 g  ;; bit codes.+ u6 N* S/ ?2 P8 D) _9 H- g
  ;;; r2 J9 }1 |8 ~0 n7 f  o
  (defun set_just_idx ()5 Q7 P! P) U& U; ^- v9 r6 A& ^/ Q
    (cond* y% n2 P0 q% Z7 ^3 n1 d" O" L2 j
      ((= ha 0)             ; Horiz alignment = Left
- x: ^; [* A. h4 u8 v1 ?- p* u        (cond
3 N/ k4 E% \6 [4 N          ((= va 0) (setq just-idx "0"))
1 t5 b: Y8 ?0 K9 Y8 Z5 s          ((= va 1) (setq just-idx "12"))
% g7 v3 @) `9 L) l& a; y  J          ((= va 2) (setq just-idx "9"))8 d8 w! A5 ]! p6 C) U+ U
          ((= va 3) (setq just-idx "6"))
" M; w. J2 a8 T% m' x3 u! B        )
- ~* i* B/ o' u- y  S8 H- E      )8 J) k. I9 {* D! @, H8 ?- _
      ((= ha 1)             ; Horiz alignment = Center' i# D) k) L5 R: h" |' P7 s
        (cond% N4 X5 _3 F$ F; j4 H
          ((= va 0) (setq just-idx "1"))% {9 ]* [% v7 `9 B
          ((= va 1) (setq just-idx "13"))
7 H* ~: W0 M: _1 X% s% ~, T# w          ((= va 2) (setq just-idx "10"))
% S8 p: C! ?% j- z; u          ((= va 3) (setq just-idx "7"))9 E# i3 h  f6 |9 ]8 E3 ^2 n" z( R
        )4 H. D4 C& }; z  Z( K$ c
      )- Z# V: S% w* T- F. d" L" D
      ((= ha 2)             ; Horiz alignment = Right. n% j+ c8 X6 p% ?1 r
        (cond
6 l- \: G1 a9 X- A          ((= va 0) (setq just-idx "2"))
0 r: C) W; b4 S! Z          ((= va 1) (setq just-idx "14"))- h8 W% d. i# V/ n
          ((= va 2) (setq just-idx "11"))$ R( s$ A! t+ v, p6 ~
          ((= va 3) (setq just-idx "8"))' H" K% F! C; E2 i( H# ~
        )
; P8 }0 I: x9 V% x' V      )
: e' p& l4 s4 f! y0 x& F- d      ((= ha 3) (setq just-idx "3"))   ; Aligned
" y4 n# M  I- h      ((= ha 4) (setq just-idx "4"))   ; Middle0 f1 |4 W: ?. t
      ((= ha 5) (setq just-idx "5"))   ; Fit
. ?: K% e1 K/ e9 c9 X/ l0 J! m      (T (setq just-idx "0"))
9 B% R+ L. |+ ^# p" H    )% W' H, F( `+ v
    just-idx: G. m2 K7 y4 j; `9 x: r5 G2 a
  )
1 O4 I) d! Y2 @! l8 S/ f& O) t" g
7 a9 V6 l* N" ?$ R0 C$ A) `  (defun modify_text ()% R) x2 s+ k. H* Z' L- ~
    ;;  insertion point
+ O) E: K3 n( A# \2 y% }    (setq showpt (list x1 y1 z1))
" k- Z' w; E5 u, c7 P! z& a    (setq bit-10 (trans showpt 1 ename))
2 v, U6 i3 N  `! k/ e    ;;  alignment point- n) D; ]7 o* [$ Y- \
    ;;  for 'Aligned' or 'Fit', alignment point must be different
4 [; L# u! n+ m    ;;  for all others, use insertion point3 }# y& w- M  y; J) }) \7 z
    ;;  (ACAD will recompute insertion point)# U+ x- c8 j! |. Y# M% _6 f4 x& l1 h
    (if (or (= ha 3) (= ha 5))
* X8 |5 C; v) E8 c      (progn( `( B3 f& ?& u
        ;;  if no alignment point, fabricate one; _# b# t3 e- @! `1 w
        (if (not alipt)
) t0 j3 B3 V* }3 u8 h          ;;  add text width to insertion point
: K( |# a9 C$ b6 g6 r          (setq alipt
" x1 j" [+ W1 _2 F3 B            (list (+ (car showpt) (car (cadr (textbox elist))))9 u9 j# \+ |6 v* o* F
                  (cadr showpt)0 H* \5 L' A2 g7 [. y1 S5 f0 }" p* z
                  (caddr showpt)
/ C7 n8 y& E( v# y            )
! B! N, J0 S4 B) e; g          )6 m# e( L: E3 y8 {
        )
% N& W3 z6 o( x( Z6 N9 ^        (setq bit-11 (trans alipt 1 ename))
- @8 n$ @% {% f* [1 a5 o" r& X- h      )( P+ \& ~% K0 T, s) ?5 `
      (setq bit-11 bit-10)
# `/ ^7 o* p' |# r2 H" l    )
) P( K% M8 U; ?5 `% v0 n& M    (modify_properties)
" c' ?# ]. G& W% A0 W    (tempmod tstyle 7 nil)
4 D% |. M. J& S8 I    (tempmod bit-10 10 nil)
7 u( Q- L3 U5 c0 L% o; _; A    (tempmod bit-11 11 nil)" O4 I2 a3 P( Y: q* s
    (tempmod text 1 nil)8 v: g+ W8 S" `1 h6 I( `5 ^+ S
    (tempmod hght 40 nil)
* Z5 v; v, s1 \    (tempmod wid 41 nil)4 v* Q5 V4 F( b; i: u1 I2 A
    (tempmod rot 50 nil)& c, i5 F- e# ~* I
    (tempmod obl 51 nil)- s7 d: x8 v3 v9 n* D. }+ O0 |
    (setq bk-up (+ (* bkwd 2) (* upsd 4)))3 q4 i; J% Y! J$ N
    (tempmod bk-up 71 nil)
) G+ L3 b$ r  p; u1 t" b: }% Z6 i. p    (tempmod ha 72 nil)
. t6 X% ~& `3 F/ E5 J3 P8 g    ;; Attdefs use 74, text 73! l9 K" ^9 T5 [& D, i( C
    (if (= etype "ATTDEF")/ X* F1 B' A3 v5 S
      (progn
8 H6 P* }; _" V/ P; v        (tempmod attag 2 nil)
+ H8 C2 K) @* |0 m        (tempmod atprompt 3 nil)
. g$ C8 [7 Y) B, R* K% k' Z        (setq icvp (+ inv (* 2 con) (* 4 vfy) (* 8 pre)))
" K) `- h# g" j, o/ L* F        (tempmod icvp 70 nil)2 ]) ?( G+ M, q
        (tempmod va 74 nil)) R8 w# V; }4 o' X# s
      )3 @+ z2 W" H1 h* f, Y* c4 `
      (tempmod va 73 nil)0 W# K9 q+ T8 t: L
    )- Q" _* \  g* n$ G: W9 _) f
    (entmod elist)
4 A* G% }0 O. x" Y1 H  )
$ i" c, y, @& y5 J: @' \: h/ I6 t
/ ?* f- G' A* u8 |! v6 H1 h9 u  (defun ddtext (/ 2ndpt slist i)2 |4 A" P' w0 Z* b. K% o# x0 C
    (if (= etype "TEXT")
( m4 ^# o% M: Z      (if (not (new_dialog "ddtext" dcl_id)) (exit))
2 n+ `. I1 o) G. |9 h4 p1 ^, a      (if (not (new_dialog "ddattdef" dcl_id)) (exit))
  d' @. N6 f. u' {    )3 ]1 H5 q  o* w( t
    (set_tile_props)5 q* `0 o- s% r6 n) _8 V" j
    (set_tile_handle)
* Z7 F  l3 ?- M! B7 o/ v    (set_tile_text)) y( F5 ?# |" G2 B8 i3 k3 z( }
    (set_tile_tag)
! E& _! ]6 \( w* O+ A5 }    (set_tile_prompt)
- P9 L" @8 L  ^: L) b    (set_tile_hght)8 A1 Y: c" C6 i' D& r5 H! ]
    (set_tile_wid)5 N/ m' D: y2 r! `+ W8 z
    (set_tile_rot)
7 K) }6 j* O0 n# M( \* M  W% j    (set_tile_obl)
$ g) h, v) W9 k. O; e4 j4 a    (set_tile_bk-up)
% a( ]' P2 d. E    (set_tile_icvp)" |/ t8 [0 g6 S4 p% U4 C$ y
    (set_tile_style)
0 k9 ?6 i+ x0 k* c    (set_tile_just)
$ ~  h9 n& Q, w) n/ z    (setq pt1 (trans (cdr (assoc 10 elist)) ename 1))  C  f: D+ L" [, _! s1 y
    (if (not (assoc 11 elist))' k7 s" r' P3 ~. K# y4 V
      (progn (setq pt2 pt1), p7 N5 E4 [# @8 @$ ?7 q
        (setq elist (cons (cons '11 (cdr (assoc 10 elist))) elist ))0 x$ w0 X' f: _; E
      )
; L2 B( l1 H: V9 I;;(trans '(0.0 0.0 0.0) ename 1)), |2 z, H( Y, }; Z' M
      (setq pt2 (trans (cdr (assoc 11 elist)) ename 1))& C6 L6 @( V' s4 P% [# E
    )8 b- y) m0 @/ U' Y$ O
    (if (or (and (= ha 0) (= va 0))
" v2 G  ~. w/ p- g% a' x7 \            (= ha 3)+ ^) B1 o  ?$ ^  s( w
            (= ha 5)2 s8 Z6 Q9 B1 h7 K( O, C. t" p9 J
        )8 J# R2 h+ {  F" O: r4 s7 b
      (setq showpt pt1)
  P/ F0 v( w5 @* n+ l- f! g      (setq showpt pt2)
5 `9 l8 f, i( [5 `6 n    )
* M7 e, I5 m' Q& b  D  o. L9 o    (if (or (= ha 3) (= ha 5))
, a1 A7 n7 l5 {+ R- j' y9 J      (setq alipt pt2)7 |6 w! V' _8 u+ C1 A9 U
      (setq alipt nil)5 o& z4 E, J0 _1 C; P' a
    )4 r1 q8 N- C3 @) X) G" s- s" g
" D1 q! h4 L% G8 T/ [% i
    (set_tile "x1_pt" (ai_rtos (setq x1 (car showpt))))
; |. {9 M4 W( n    (set_tile "y1_pt" (ai_rtos (setq y1 (cadr showpt))))
. \* e8 m7 G7 v# D, n6 ?% c4 R: C8 J    (set_tile "z1_pt" (ai_rtos (setq z1 (caddr showpt))))" }: D" |* Z( w/ O: f- Z( j  |
3 j) W$ x3 Z2 }
    ;; Define action for tiles; N, o3 U: c! ~/ w3 B$ h
    (set_action_tiles)
& l& {$ M$ _$ q) V0 W* {3 {% N+ _    ;; Set focus initially to the text edit box.
; N# N% P/ u2 T: |    (if (not i) (progn (mode_tile "t_string" 2)(setq i 1)))
' x; ]% L9 N2 i% x5 `  v    (setq dialog-state (start_dialog)): N4 y/ U' U7 w1 d0 P5 [# T
    (if (= dialog-state 0)
9 P) h$ U- Y- ^      (reset)4 F7 c( M. a3 N( p
    )
' c9 N% M) }0 ?0 D; ~    (if (= dialog-state 1)% s& m2 R' [  b) }3 B: i
      (modify_text)
  z/ m! x& R) C2 e    ); I3 F$ r( W- @
    (if (= dialog-state 3)* m( R7 l1 F  A" d( z
      (progn* @' @* ]& E0 C, |3 G
        (modify_text)
3 D. \, r# s! ~2 |0 O        (if (or (= ha 3) (= ha 5))
- i% G! e, v; Q5 ?. r( ?& P/ P  n          (progn
/ T  l% M+ G: {  t3 ?* q. }            (setq showpt (getpoint (list x1 y1 z1) "\nFirst point: "))
) l1 \0 }4 C' D& X7 m$ C4 M            (if (not showpt)
4 I% l& C* s* r! z* S              (setq showpt (list x1 y1 z1))
  i1 _5 i1 u  G4 z$ |1 o            )
+ n& e: V# f7 L  F! j3 h            (setq 2ndpt (getpoint showpt "\nSecond point: "))
; W( O/ K" l: g" [            (if 2ndpt" b7 Q& o$ j5 z2 k! Z* n0 l
              (progn
, D$ k" ?/ u: L6 \& b                (setq alipt 2ndpt)9 [4 @5 @, [( K/ t* p& w  n, d
                (tempmod showpt 10 1)
1 e7 y( d+ B. Y( z                (tempmod alipt 11 1)
- h2 P& W0 W6 b* }% g% h+ \                (entmod elist)
6 d% Q, T5 Y' B, h, @' {              )& x, x; b8 X% x2 A3 N. v9 ?
            )5 W/ v: ~; M: {" F; w8 ~
            (setq elist (entget ename))
! b5 L1 H% }5 ^. `          )
& B7 R8 N: A( {) |  }6 ?& Y          (progn3 }. K4 K* ]7 J' W- z
            (setq showpt (getpoint (list x1 y1 z1) "\nInsertion point: "))
. M3 C: C$ Y& O            (if showpt
% w7 o. |( R: Q( P% c              (progn
" e1 {1 ~% w' z$ d0 X5 U/ x                (if (and (= ha 0) (= va 0))
$ l8 Y6 k* P7 D* }/ ]' C' m* G& _8 V                  (tempmod showpt 10 1): k& Q9 I4 t; d; G! s" c. R) k* a
                  (tempmod showpt 11 1)! ~* ?' k# n; V: D5 _
                )
# q' n6 a/ Z, G. [3 p                (entmod elist)
9 I. G" N7 C0 v              )4 \1 Y1 z& W, f9 c
              (setq showpt (list x1 y1 z1))( v/ A- h+ |5 k- T
            )
: }% C) N7 y) ?$ t, U4 F- P! w          )' I7 [; \# @, X6 [% L  ^9 w
        )
& \' h* |, _. V. X+ Z' B& A        (ddtext)
/ K# O8 X( x& j9 s7 ]      )& B4 c0 E- L  D. E0 k3 u# D
    )
% X) w! W7 B: Y# t  )
$ y  ?# S9 h1 R8 p, \# f9 N3 b6 ~
  ;;8 N, t1 \, ~) I4 ?4 p9 U* k
  ;; Modify MTEXT
/ C! K0 Y& }; L1 y6 j0 F9 J  ;;6 b" ~0 s. C1 D0 }0 C% y. M7 {/ W" @
  (defun modify_mtext ()
3 L3 t/ q: i6 Q" }. e- h    (modify_properties)8 l( y, ?6 }1 J: K& |
    (setq pt1 (list x1 y1 z1))  [; g6 B' D- ~3 g5 d3 K
    (tempmod pt1 10 0)- F" W9 q1 G5 H" d
    (tempmod text 1 nil)( Y2 D( H! H8 K3 e
    (tempmod tstyle 7 nil)0 W4 [# P0 {' z
    (tempmod just-idx 71 nil)  Q& j: f6 {6 P0 ~& ^: w
    (cond
  g' i7 B# c$ l- W" m      ((= dir-idx 0) (setq dir-idx 1))
! a8 Z/ P7 u. f/ _      ((= dir-idx 1) (setq dir-idx 3))/ k3 {. E7 t$ O) [. g9 F
      ((= dir-idx 2) (setq dir-idx 5))
* u; T$ x  ?. l7 N      (T (setq dir-idx 1))
4 G7 L# m1 [( w    )
  {, `" B. x7 h7 N1 d! a# |    (tempmod dir-idx 72 nil)7 V! d; H% S! e/ f2 U+ a, w0 H9 a$ `
    (tempmod hght 40 nil)- C6 {' i+ o# F' W1 A3 F
    (tempmod wid 41 nil)2 c; q) I2 [; Q; ?6 ]0 h  o
    (tempmod rot 50 nil)
4 m% R; b4 `3 z' N9 _  q+ `* y    (entmod elist)- R/ {& I% }8 ?" w3 b, r: C
  )
. M9 F- W4 A8 {/ I: o  I2 N5 V. l7 E/ I+ |. [5 ]5 I; d7 E
  ;; Set MText text style
- J0 j4 t( ^- s0 N% b  m! ]  (defun MText_style (index / style-list)
! r& D! p* h' q* F    (setq style-idx (atoi index))
% u% S- B0 [/ Z! G6 W3 K    (setq tstyle (nth style-idx slist))
, R5 s/ N9 L8 Y* j$ S! B    (setq style-idx (itoa style-idx))
* ], V- J, Z: L2 [    (set_tile "style" style-idx)1 f5 d  P/ l: W4 h! Z
    (setq style-list (tblsearch "style" tstyle))) S' G7 b9 r; A/ r! R' e( Z
    (setq shght (cdr (assoc 40 style-list)))) \  F. w; E7 u9 f6 D
    (if (/= shght 0)
8 M- p/ k7 ^2 ~- F2 @; d      (progn
3 Y6 f0 _3 N6 U: n0 ~        (setq hght shght)
; G) t  F1 P. J) G7 D: ?        (set_tile "hght" (ai_rtos hght))% b" |) k5 n5 W0 P- [7 z
      )( Q4 g) }, U9 p; _: `
    ), `% |* ?' s; f2 Z
  )
5 R: v, C/ S) J; _; u% S- j
& G9 d8 _* ?/ X) O* v  ;; Run DDEDIT on given entity, working around possible re-entrancy
' A* A  d8 N- X0 Z  ;; problems with MTEXTED
. V, H; q4 h. V  u& k  (defun safe_ddedit (ename / orgMTextEd work)
% o. m% W+ b$ S( [4 f, r, U    (setq orgMTextEd (getvar "MTEXTED"))
. M- Y  _8 d, G    (setq work orgMTextEd)# J# E0 U. r" S
    (if (= ":" (substr work 1 1))0 d( A/ F7 v  m0 A& r: ^" `
      (progn9 `. ?( k0 C9 u2 G
        (while (and (< 0 (strlen work)) (/= "#" (substr work 1 1)))
" J$ L5 d4 |" h  x3 H          (setq work (substr work 2))
0 @# c* X% R, T% l, C& O! y, {, b        ), ?7 H  ~6 _5 U' p, B4 R! V: C! G
        (if (= "#" (substr work 1 1))$ z) f1 M  E* L" F  |
          (setq work (substr work 2))7 i, j' a) i/ j$ F) E0 q
        ): m9 T$ Q. z* _; y5 z6 f: z
        (setvar "MTEXTED" work)
. Y  a9 t" W( C6 j. _9 [$ e      )' B6 i9 x. c9 K! Y0 B/ [% X5 u
    )4 X" S: j: H) q3 z* D
    (verify_arxapp_loaded "acmted.arx") ;; make sure it's loaded...
$ C+ @' T6 F; I7 Q    (command "_DDEDIT" ename "")2 U/ |! R0 f" v: k
    (setvar "MTEXTED" orgMTextEd)% [; Y) g1 r/ t# P1 J
  )
4 i) b7 R8 H! T; k; k3 u- `: U, \! B5 P+ o! g% X
  ;; Verify MText object width
6 I. S7 c9 |8 a8 T  (defun ver_MtextWidth (value)! L& l) s& c0 l8 z
    (setq value (distof value))* E' P' l5 G; o0 j" D$ u
    (set_tile "MTextWidth" (ai_rtos value)). t0 c. z( n  S$ }. `  p
    (set_tile "error" ""), w: |" L# a; [2 c; \, d# \
    (if (< value 0.0)
5 y# `2 o2 ^; D5 h      (set_tile "error" "Value must be zero or positive.")4 G2 R" U  V) y% S4 R( A
      (setq wid value)
. ]/ d+ A. H, R1 O    )
3 y$ m# I( F" [& F0 M2 i7 i9 [  )
! }+ s6 f7 ?3 [5 M2 |- r
; ^0 Q6 C) g1 i7 h& p6 E" N8 p  (defun ddmtext ( / gc3): ~2 I: f+ U/ d! ~! l. ]' a) T
    ;; Get dialog; F; X4 k, L$ ^; C: {9 p1 z' F2 ^
    (if (not (new_dialog "ddmtext" dcl_id)) (exit))& Z) p) t! e  N9 x9 a

. l4 H2 ]# a$ o$ @3 L    ;; Load list boxes
5 [2 F1 r# E  r, @" _  d    (start_list "MTextJustify")
' Q# n. K! H& O8 {    (mapcar 'add_list '(
8 z" m9 ^1 ?5 u' ~" }' c6 ^4 P                        "Top Left"1 d4 M( n5 ^) g+ D7 j
                        "Top Center"8 K7 ^1 d0 Y8 B: \+ G! p1 H
                        "Top Right"* v  x" I; u7 w0 W. J. t9 q; ]$ n/ a, S
                        "Middle Left"# t# ~/ z9 _5 w6 R( G& e
                        "Middle Center"
3 C! A0 k1 t! E; [4 x                        "Middle Right", l+ U* x. \) w+ V* ^
                        "Bottom Left": Q7 S2 V+ r, Y0 L2 G, U
                        "Bottom Center"0 T) _8 s* @+ ^" y, ?9 y) `$ E( U
                        "Bottom Right"
0 [" T& S2 e% u* U" }- \; t                       )
* @, M3 k8 Z) ~0 |) |    )
, B& I7 H3 M4 V, r5 `/ y; O    (end_list)
# o6 F  q' |& f# q" h- e6 x" |1 S. j6 f5 z
    (start_list "MTextDirection")
8 q( z6 z; y( o& o, `    (mapcar 'add_list '(
; }( o! a) T2 y( v+ q" m' ~* ?/ N                        "Horizontal"
# z0 k" \8 I+ S  V9 w8 m- Y                        "Vertical"
" F: S- {2 h" ]7 m4 g                        "By Style"
! V( C. |& Q* R8 f                       )6 r. a" N5 W( {8 o; ~+ ~
    ): O' ~9 k, K" {, \8 b( t, `) I3 d
    (end_list)7 R- R) Q2 Z) n" H' }* _" `& @

1 d# z- T; R2 g9 S, b8 K    ;; Set initial tile values$ k, S. F; G5 x( {" R. t
    (set_tile_props)) e2 k; c$ R# f$ E3 J
    (set_tile_handle). @7 l6 V  v) m' [3 ]4 y# K# ~3 m
    (set_tile_pt1 0)# g! C5 @- z2 u" r: z- l9 E) H
    (set_tile_style)
7 r+ U4 z& ]" Q: f    (setq just-idx (cdr (assoc 71 elist)))3 J- G3 {$ W2 ?" }4 {% L
    (set_tile "MTextJustify" (itoa (1- just-idx)))
* W- t  ]/ {  I4 P4 h0 O    (setq dir-idx (cdr (assoc 72 elist)))
6 _& H7 f3 O9 o( T) r4 @( P4 M    (cond/ q9 F. q: |; v9 M  z
      ((= dir-idx 1) (setq dir-idx 0))
5 ]& S2 Y5 _3 y" _# F      ((= dir-idx 2) (setq dir-idx 0))8 T6 d. ]5 s: v  y/ S+ x
      ((= dir-idx 3) (setq dir-idx 1))
2 C8 f8 @* U3 H  |& g$ n# e      ((= dir-idx 4) (setq dir-idx 1))# x- Y3 m& i" m7 M+ A7 e# `' B
      ((= dir-idx 5) (setq dir-idx 2))' Z- Z  {# L. I  k# O  z3 C& ~7 l
      (T (setq dir-idx 0))
# J% {9 _% ~/ l; h    )8 h8 u  z  o! H- ^
    (set_tile "MTextDirection" (itoa dir-idx))/ j( {, S* w4 E, B- |1 \
    (set_tile "MTextWidth" (ai_rtos (setq wid (cdr (assoc 41 elist)))))
# ]9 f" `( W; v    (set_tile_hght)8 p( M5 D$ _2 {) y. X( T
    (set_tile_rot)
* `) f& Z5 I- a. z, G. O& ]. v
6 E- G4 x& Y7 q8 H" ~; g! C    ;; Set edit box, disable if too long
' F6 H& r. A& }9 ~' e, E' [" j$ J    (setq gc3 (cdr (assoc 3 elist))) ^) z& b! w9 p6 s
          text (cdr (assoc 1 elist)))% k0 E" T. S, H; Z9 x
    (if gc3
2 r) m" I5 }" v0 N& e      (progn  ;; Text is over 250 chars, disable edit tile
* ^+ Y9 \" _! a        (set_tile "t_string" (strcat (substr gc3 1 25) " ..."))$ ^; n* g! I# g% Q
        (mode_tile "t_string" 1)
$ N, R% Y2 s( z" U0 o      )
; I1 P; H' o% ^' j2 R* y1 ]  {% P      (if (> (strlen text) 80)
9 T1 V) N+ W  |        (progn  ;; Still too big
7 S' j5 c! _) }7 B2 z* W          (set_tile "t_string" (strcat (substr text 1 25) " ..."))
2 X0 n0 U6 S7 w+ r          (mode_tile "t_string" 1)$ T: O/ o1 K# w' ?7 j
        )
$ L, Z3 n* R8 n, E" k        (set_tile "t_string" text)
+ J( h' u9 w' g' R$ V      )
  }4 l7 l/ N, z5 k3 i0 b5 |    )
8 j4 v1 W& v) [) v8 _0 `$ U7 @0 n8 Z- M' R
    ;; Define action for tiles
1 @5 t/ ^) R1 k& i6 {3 T8 f- v    (set_action_tiles)
( K' x8 G' w; l& x    (action_tile "style" "(MText_style $value)")# X2 X* r* f: v" Q! N2 K1 f
    (action_tile "MTextWidth" "(ver_MtextWidth $value)"); O# G: C4 ?4 W' i  J' f- A
    (action_tile "MTextEdit" "(done_dialog 4)")0 }8 z8 s5 ^2 \, r7 R/ h6 l
    (action_tile "MTextJustify" "(setq just-idx (1+ (atoi $value)))")
& |, E' w1 Z. Y# t$ `    (action_tile "MTextDirection" "(setq dir-idx (atoi $value))"); N; c& o5 g2 m4 c
6 w, n- x9 N  Y- E0 d* Q( M
    ;; Set initial focus to text edit box.
  t% C2 h) h8 J. a1 N2 ?( f    (mode_tile "t_string" 2), }1 p% |" K; D! f0 U: B1 @8 j1 ^" [5 Y

0 A: b, `% ~* A3 @1 A6 @2 s    ;; Run the dialog
+ _2 d: b5 [' `: A6 T9 M" T6 S    (setq dialog-state (start_dialog))
$ s/ _* a( M. [& l- |8 w6 q% J! y    (cond
% j: Q0 v' P1 R$ |8 w. r      ;; Cancelled - restore saved data
; }# U6 F6 L" I% J6 M6 a- d8 m      ((= dialog-state 0) (reset))' I* P' C) j# B( R; O* E7 |* P8 A
      ;; OK - save new data
7 k) O( i* R" G      ((= dialog-state 1) (modify_mtext))9 N, g8 Y$ t) S1 j* o8 o
      ;; Pick new insertion point
' z2 `/ X3 n" b/ P      ((= dialog-state 3)2 i) C4 b4 k& h2 V% }; j
        (modify_mtext); Q! ~1 x" r: s, g! r2 F! f  y0 ]
        (setq pt1 (getpoint (list x1 y1 z1)  "\nNew Insertion Point: "))" f9 k% C% V" f" W. z
        (ver_pt1 0)
  @' s4 R3 m2 t- v% y0 j: O! g, p        (ddmtext)8 K) {+ d2 T7 s2 `6 j  `$ C5 ~
      )
1 P; y6 q* m# [7 k      ;; Run full editor
; g6 p  V% v' V, [      ((= dialog-state 4)
' B% @( T; [6 p" D" r        (modify_mtext)
# t" h5 r$ t5 j4 a; v9 k3 J  z        (safe_ddedit ename)
8 m4 K- U3 K+ i( j( C        (setq elist (entget ename))' [. o+ ?3 t$ {) {
        (ddmtext)# b& w8 p& y4 a5 v0 k9 |
      ); g) l9 I, _, A8 i
      (T nil)
( ~) s* n) v& ^    )
/ Y0 A! Q# I9 ^  a& T- ~  )
0 ^: E" j1 T& W' d0 g! f6 t" q
( P' s6 B* y6 |$ {$ Z  ;;
4 y  V( M8 J- g" h  ;; Modify VIEWPORT
+ y# c& A, u" h  w! F  ;;% _: v' M7 e9 R& s
4 v! J6 _/ t' S. s6 o
  (defun ddvport ()7 h8 L+ i& e- C0 j2 T
    (if (not (new_dialog "ddvport" dcl_id)) (exit))
" u6 @$ R) L& E; k# I, V1 O    (set_tile_props)
' O( S/ j2 W7 B; j4 V    (set_tile_handle)
6 ^( {' u' q6 R9 c$ q9 k    (setq vpt (cdr (assoc 10 elist)))
4 J$ [( P7 ?  D- W" b* {    (set_tile "xtext" (rtos (setq x1 (car vpt))))
/ H5 A" p) j! Y" x: ?    (set_tile "ytext" (rtos (setq y1 (cadr vpt))))
& A/ A3 {& T* m' `1 \    (set_tile "ztext" (rtos (setq z1 (caddr vpt))))
& B2 V& p5 C, {6 P% H    (setq wid (cdr (assoc 40 elist)))2 `" s. t5 I" ?% `, |1 L5 U% b
    (set_tile "wid" (rtos wid))
) L8 v& u  f9 w4 F    (setq hght (cdr (assoc 41 elist)))
8 @& p% i+ O3 t* ~5 k    (set_tile "hght" (rtos hght))
1 E8 |2 B6 y+ L8 j* T" }    (setq vpid (cdr (assoc 69 elist)))
1 x4 q- S) F7 c# e    (set_tile "vpid" (itoa vpid)), o/ n$ Q- G' k" S  t% n6 e$ l
    (setq on-off (cdr (assoc 68 elist)))0 r7 D: w% `8 `2 n. T" B
    (cond: r  K, S" o: d8 d* c
      ((= on-off 0) (set_tile "on-off" "OFF"))
4 g2 |' T# Y- ~      ((> on-off 0) (set_tile "on-off" "ON and Active"))
- w5 x# Q; a6 x: {      (T (set_tile "on-off" "ON and Inactive"))
5 c$ J8 R9 L# s0 i! @- m' V    )
* k) f5 D/ U8 A" c9 T2 x  n& l
9 c* {7 u; W. x3 b& z; U+ s  l1 J    ;; Define action for tiles( l7 k1 a0 _3 d9 i
    (set_action_tiles)
# G  j( l  V8 Z! L! }3 W
" g  k& \) N' U' }$ `! h3 C    (setq dialog-state (start_dialog))/ }# |9 d3 H2 Q6 G- g3 i
    (if (= dialog-state 0)2 j7 I% l" Y' u3 G# b' u
      (reset)
/ s, m4 V6 ], c3 P5 a    )
0 V$ m5 \+ p8 F7 [' F! R. X# r    (if (= dialog-state 1)! L* W( j4 b  x- _( b" u$ X$ {
      (progn
+ S: f- M" k9 l+ }1 K/ X        (if (= ecolor   0) (setq ecolor "BYBLOCK"))
, U) h' x$ O$ a        (if (= ecolor 256) (setq ecolor "BYLAYER"))5 J3 W9 l' {( H, b/ |9 F
        (command "_.chprop" ename ""
/ ], J* u2 K( P                 "_la" elayer
; B" b0 \" O8 G# g+ N: @% K4 f                 "_c" ecolor ""
, `$ o0 i1 H! n6 G, q+ e        )9 o9 c3 J6 L* A  T
      )
* W0 V! G" l( M5 z' t; v5 f    )! \$ I0 T' [0 o, ]5 ]0 S
  )- }0 a7 r- L8 U* v  m: X" _$ \
  ;;/ d5 e+ J9 p% r0 C
  ;; Modify POLYLINE
$ ]4 z$ Y! h  q! O& d  Y  ;;* F; N5 r+ \* C' l& n) J
  (defun modify_polyline ()2 ~) q! v$ R8 D. ?
    (modify_properties)1 D) l  n  Y% F8 T; r/ S- R
    (if (= ltgen "1")
+ O5 p& z. ]9 _3 E# D5 v7 @        (if (/= (logand bit70 128) 128)
: c# {' T5 o9 Z: V: {: G; R            (setq bit70 (+ bit70 128))
0 [6 ?+ G% h9 x/ m8 X5 c: M        )" N4 W+ F# l+ a4 e" P; E: B
    )
6 K; U7 d) x1 m" V/ |* u    (if (= ltgen "0")9 C; D. t6 A; N- ]0 s" p6 F
        (if (= (logand bit70 128) 128); J; O9 ?  q1 v  M- o+ e* C
            (setq bit70 (- bit70 128))% n) \) L: }. P: L
        )
4 v5 h. I9 x7 s3 X; _% w" A& V    )5 {( l1 f$ {0 c( X3 r- S! k
    (setq elist (subst (cons 70 bit70) (assoc 70 elist) elist))
0 E% g) ^& E7 @5 P    (entmod elist)+ ^1 _. Y5 j+ l0 j+ c* ]
    ;; Added to take care of updating Vertex information for color) I& m7 z3 r' t2 {- k  D7 O
    ;; and linetype.
: ~1 W1 r6 a- ?; X9 C$ u4 m" B) D6 A    (setq save-ename ename save-elist elist)
2 X# |; ?3 N& \) [. F+ Q    (if (= (cdr (assoc 0 elist)) "LWPOLYLINE")! }; d0 F* M- W" z7 i# m$ y# N
        (progn3 z7 \3 O7 J4 m& P9 `
            (emod ecolor 62)
! G. r1 n* |5 `- x7 J% H" @/ A. q2 R            (emod eltype 6)
" ^; X7 V6 E7 |! [. k            (emod eltscale 48)
4 a, n, P0 X/ C. p0 A            (entmod elist)
2 E9 E! ?# Z" g& R: @7 i& C& f        )
, }+ U. @6 ~7 H# k        (progn
% m# @) z$ c4 O8 Y            (setq ename (entnext save-ename))
2 p4 Y% q) N9 O. O* c0 @, B            (setq elist (entget ename))
# Z( y0 m$ O6 B* F$ e
5 J+ |6 X5 z+ w            (while (not (= (cdr (assoc 0 elist)) "SEQEND"))9 N+ |2 p! c1 z# h; U6 k
                (emod ecolor 62)
: g  W7 i/ A4 F; q                (emod eltype 6)
2 d: y! E, f% B5 |$ V% E$ s7 e                (emod eltscale 48)1 _7 k1 T' O' n# Y2 D; B0 {
                (entmod elist)
* W$ J% h- ]/ w2 o; K7 n9 B. I                (setq ename (entnext ename))  K( |* N& [& l; F+ O5 _
                (setq elist (entget ename))
6 h0 k% r6 D- E            )$ P9 t% K: _% ~$ w
        )
) M! T/ D4 p" R8 g* F2 v/ z4 E; N    )
3 t" |- R' ?0 }- x: s; o8 c3 y    ;; Update the SEQEND, c! E+ r' ]: P3 D6 @/ c
    (if (= (cdr (assoc 0 elist)) "SEQEND")
4 n% O! P$ v; j4 _+ ]( ]; H      (progn
2 C; P. f6 K' k+ @# L! r% s; K        (emod ecolor 62)& t' I' @2 R2 P( [6 V
        (emod eltype 6)7 A4 P! h% Y7 [+ m! V5 p$ h
        (emod eltscale 48)
6 [. d/ q, s2 f- @; J. \        (entmod elist)1 U0 ^" P; K# ?& f$ f9 H8 M
      )/ l& H9 [# c5 J) f
    )
# }$ t* i# C5 l: [1 U. |    ;; Go back to header.$ c$ E7 y' x! r  Y, k
    (setq ename save-ename elist save-elist)
# b0 K2 a  H; ~7 S# Q* l8 X' ~# f  k" b* _4 n" l7 i1 U
    (entupd ename)9 |5 F$ @$ u0 F, v0 G9 `3 A
  ). _0 J, m; h8 o3 c
) m! O2 A4 A  G7 m
  ;; Increment vertex.  Set tile values to next vertex
6 i* m' N. ~8 [- ]/ D  ;;' U  }1 ~( U1 V: o5 M, P
  (defun next_vertex ()4 B3 e5 \5 l, Z/ x
    (if (= (cdr (assoc 0 vlist)) "LWPOLYLINE")
" p2 W/ O8 j+ ?        (progn
  A/ E+ f2 U$ }            ;; If the counter reaches the number of vertices,
5 [9 X5 |' s$ U  Q  ~            ;; roll it over to zero again.& Y& g- w6 q3 _( x
            (if (= ctr (cdr (assoc 90 vlist)))
" w% J' F+ \+ W' v" e1 k$ M                (setq ctr 0)) Y2 l/ w" I& P* [8 F3 w
            )
2 \# o* l# D5 K! g                (set_tile "ctr" (itoa (setq ctr (+ 1 ctr))))
& D. `' }0 V/ @, m$ X2 }+ N( j            (set_tile_vpt pointype)/ I" M: Q4 `8 m* _/ ^; z
        )) T2 v: `8 p$ F9 J) V8 E
        (progn
& I  Q/ z4 Z, \* ]' f$ a7 S            (setq vname (entnext vname))
5 l' b  U6 ^) ]8 x8 ^" {            (setq vlist (entget vname))
! V9 {* s) |1 s" y/ P" ^            (if (= (cdr (assoc 0 vlist)) "VERTEX")% `$ b' S0 D& y% [8 K8 @4 B3 g4 Z# e
                (progn, r6 ?0 L6 L# l% L- i9 L6 a
                    (set_tile "ctr" (itoa (setq ctr (+ 1 ctr)))). u0 K3 @- [; E9 [+ R
                    (set_tile_vpt pointype)' h, ?6 S, c& [& s( z1 D" \% Y
                ), z2 i  v4 h  K; h: [& C! H4 }# f% n
                (progn( Y$ l* q6 r& \" ~2 P9 `( Q3 \9 w* }
                    (setq vname (entnext ename)); Y. p5 \6 }: f$ L. J3 e1 a
                    (setq vlist (entget vname))' _+ o# t9 E6 m; Y/ ?: ?# g- e$ I
                    (set_tile_vpt pointype)5 x$ N4 C+ X. [% g; [1 ]6 i
                    (set_tile "ctr" (itoa (setq ctr 1)))
- R7 ]( \+ @( ^0 r3 r                )) S- H2 |8 w5 O5 c
            )
- ]$ l( z8 X8 _& t        ); N, m5 e. P7 t, X! M4 ]
    )
; u; Z8 T$ ~# H  )
3 Y7 p1 X  w: k* V) E; L8 D& F+ W2 G: d& `9 \
  (defun ddpline (/ oldecho)
+ }0 T1 l( P. L* X: C8 |& X  t    (if (not (new_dialog "ddpline" dcl_id)) (exit))
) Q9 P. P" `8 L7 L+ b( X    (set_tile_props)
* C! u# i: t2 K4 S% j+ j" ^! L+ U2 K    (set_tile_handle)6 v. {4 z' P4 H# t; m& M( D! [
    (setq bit70 (cdr (assoc 70 elist)))2 B: f, v$ Z* t8 O1 `
    (setq bit75 (cdr (assoc 75 elist)))
2 k0 ]! v4 R1 P' `5 q" @( E2 w    (cond
' L! I- }0 h/ k, Z# K6 l      ((= (logand bit70 8) 8)   ; 3DPOLY
, d) |  |- f; k  J. W        (set_tile "ptype" (setq pltype "3D polyline"))
' X+ K& j6 u" E6 J6 e        (setq pointype 0)       ; WCS or ECS point values+ {- Y: v5 J1 \6 r9 y2 g
        (mode_tile "fit" 1)
9 I: g6 v; H6 j" _8 |* u8 {        (mode_tile "mesh" 1)
9 ]; ^1 i6 V6 d; c: J        (mode_tile "bezier" 1)- E# f9 ~6 D7 E) b; y- f
        (mode_tile "ltgen" 1)
5 Y) ?. m# F9 l' r2 e        (set_tile "none" "1")
% K& g% P$ r' p* Y7 `$ U2 M7 r        (set_tile_closed)
7 c1 E7 e* K3 B9 h* `) \: g+ ?        (set_tile_fitsmooth)6 U! M1 o  c7 W' \
      )
' G0 _9 E/ o( J. I9 g+ y      ((= (logand bit70 16) 16) ; 3DMESH8 ^& B( Q4 X- _: c6 E
        (set_tile "ptype" (setq pltype "3D mesh"))' i) s5 \; N/ \
        (setq pointype 0)- g1 U( `- E8 q
        (mode_tile "pline" 1)
/ W# i) B/ p: i        (mode_tile "fit" 1)  t9 u& Z' u' X1 @
        (mode_tile "ltgen" 1)
+ Q+ W6 _8 J* g8 U        (setq m (1- (cdr (assoc 71 elist))))$ p8 k& k! V! s1 u* S' {# z
        (setq n (1-(cdr (assoc 72 elist))))
; o8 m% O  Z) @  i1 B' l        (setq u (1- (cdr (assoc 73 elist))))
9 j- p6 J7 ~9 m        (if (< u 0) (setq u 0))
2 k% d/ S! P: k        (setq v (1- (cdr (assoc 74 elist))))7 T! v+ m7 p2 Y" e7 y, O. C
        (if (< v 0) (setq v 0))3 a7 @) K: |, B: L6 e; D8 z& m
        (set_tile "m" (itoa m))
. c) r/ N4 B( u/ j: O* \        (set_tile "n" (itoa n))
9 t, Q1 O/ p0 C1 O        (set_tile "u" (itoa u))2 }2 v- M2 }1 b: B2 p7 e
        (set_tile "v" (itoa v))! u! u3 a9 C0 T, p; J3 f
        (set_tile_closed)
+ n$ H" w7 \% ]        (set_tile_fitsmooth)
9 ]. w, |; b- m      )
  _: _+ V; w( k: l4 x      ((= (logand bit70 64) 64) ; POLYFACE MESH+ _$ m" O, F; H. Y( h& t0 K
        (set_tile "ptype" (setq pltype "Polyface mesh"))
8 F- h; H6 u. F+ c5 X: H        (setq pointype 0)
4 e; m7 g- P! d" U& `        (mode_tile "f-s" 1)
( B0 N9 u2 m; Z        (mode_tile "mesh" 1)
& }8 ]% [. K9 n        (mode_tile "pline" 1)
  T) X) F- [$ l3 m4 K      )' {7 u. X& W* i: T- j
      (T                        ; 2D POLYLINE
( A/ f3 p& Z: c6 y* M& X        (set_tile "ptype" (setq pltype "2D polyline"))
. R. S! G# A; Q( P        (setq pointype 1)& N  k. U+ e2 p
        (mode_tile "bezier" 1)
, s& y: S5 w) V7 H  G) L& [7 f        (mode_tile "mesh" 1)
; \+ t4 \7 E5 M8 i8 B        (if (= (logand bit70 128) 128)! v7 C% c4 H1 A" E: s/ b) p/ z+ {
            (set_tile "ltgen" (setq ltgen "1"))
0 V9 [; w/ ^8 @% R1 d) H( S/ Y        )2 c) C7 J7 z9 D6 f& Q2 l9 H. v" J- m
        (set_tile_closed)
1 G6 _- n9 V7 A  S        (set_tile_fitsmooth)8 E/ r* M4 r( w) C) F
      )
% n, y" r3 c" x) P$ q    )
( B. X! M2 ?+ `0 v( _/ D
$ }0 Y6 F1 m& A. k1 T7 I! p# I    (if (= (cdr (assoc 0 elist)) "LWPOLYLINE"): R& \2 c: A& s  j+ Z
        (progn
, _! f2 z# p0 A8 x- g1 |% ~# e( q$ h            (if (not next) (setq vname ename))0 |5 \+ U8 q, B+ i# Q
            (setq next T)
( g: `/ F+ q" t0 y2 h            (set_tile "ctr" (itoa (setq ctr 1)))) p! `/ D5 \( n. s4 w- }( N, [$ H
            (setq vlist (entget ename))- E! i* U5 _# R' Q9 w- v" l
        )
- C( Q) \9 A/ w, y4 P" H4 m' O* ~        (progn) t5 G1 W$ Q7 D) U: H! I' _
            (if (not next) (setq vname (entnext ename)))
' z& z2 T# y. k8 \9 ~. m" N! y# h3 X            (setq next T)/ Y9 W0 _. M5 a2 G+ L/ d9 ^* l
            (set_tile "ctr" (itoa (setq ctr 1))), I) ^3 M. L! I/ l/ Z/ w7 K1 w: R
            (setq vlist (entget vname)); p) J5 \; q$ K! @
        )
) K- `( r, N' v) o6 h7 x    )$ ?1 y. f# Z3 |" i% k
    (set_tile_vpt pointype)
3 I! q! A  l7 z! w( I' p6 A+ E    ;; Define action for tiles' o/ D) y. U& A8 L+ O
    (set_action_tiles)& z( n) M0 @& u5 Y; Q9 N4 a
    (setq dialog-state (start_dialog))3 g# `$ Y& g) q, N5 t
$ \: i' \  b/ b) }/ V! G, `
    (if (= dialog-state 0)1 x! V4 `' V; h; c$ m# x
      (reset)
: L& R1 L+ I  F" s    )
5 f' D+ i. ]" Y+ m    (if (= dialog-state 1)8 _4 x7 I! x. D6 a+ ^
      (progn  G! u! s* H" |" O: U; O
        (modify_polyline)( G8 a6 R- D, \: |( V7 O
        (if (or (= pltype "2D polyline")& f) i3 H+ L; S
                (= pltype "3D polyline")
2 i& i2 N( x* p, S            )
! E/ B5 Y8 ?; r2 q! P: ?$ A' a5 q          (progn8 Z" O! O$ M) F3 p  G9 a
            (command "_.pedit" ename)! K, n2 Q# V, E9 p9 H
            (if (= spltype 0) (command "_d"))
6 G% m& U: _, Y6 R, n            (if (= spltype 1) (command "_f"))
4 x4 J6 _& S* N3 ~            (if (or (= spltype 5)
  C/ `: O# I/ n* S# z                    (= spltype 6)2 h; {# j- @7 m7 }; _4 E
                )+ r. _, U1 g& g: f& H/ J
              (progn' a+ ^, H0 d$ [: }
                (setvar "splinetype" spltype)4 o* c; W2 @$ f. ]- l
                (command "_s")9 }& Y; q0 K4 U: \# F
              )2 i4 Z5 L$ E3 l2 y6 ~* Q* V" a
            )
2 x9 b1 X- `; p# e8 ]  a            (if (= closed "0"); n3 p9 v7 f( v! ]  n; |* ?
              (command "_o"). J7 q) G) k! H! P/ w* E. Z  K
              (command "_c")7 `4 a( D/ `# Z' R2 \: G* {( t
            )
% z- i1 C2 u! L1 |% u. A            (command "")
* o6 {$ s2 u1 h: X5 E4 ~" M
  g7 s# M& y+ V' p) ?1 g            (if (= spltype 0)
# V& f- @& ]( }  w4 M4 O" C5 j$ q( c                (progn
0 L4 r5 }* d- Y                    (setq oldecho (getvar "cmdecho"))
6 _* m% f8 n- P! B: [; O                    (command "_cmdecho" 0)
$ n; H- ~+ b' s9 V                    (command "_convertpoly" "_light" ename "")7 F8 o; M" C. L+ \5 p
                    (command "_cmdecho" oldecho)
: z# w# J- F' Q1 W                )
, q& E+ U- ?& J0 o& d5 e4 s            )
7 F. C; ]1 }9 \) _, U9 M          )
$ D! n3 R; e. l- B* T' B, ^) c% A9 \        )
: z) g; P$ {6 Y" R5 a        (if (= pltype "3D mesh")$ t/ m0 X' ^* W6 v
          (progn$ B3 v* s7 q! |7 K0 ]$ ~- t
            (command "_.pedit" ename)
- `  ^/ v( K3 z  Q  L            (if (= spltype 0) (command "_d"))* N  U; W6 }6 k7 O
            (if (or (= spltype 5)
' n2 e/ K& e1 h- H7 |' Z                    (= spltype 6)/ j' i, U2 K2 f: @8 l4 r' w5 x+ f( @
                    (= spltype 8)
3 W( ?1 G8 H! }9 I                )9 Q3 b$ [! R. J) D& h* R$ X
              (progn% N  j& F1 ]' M
                (setvar "surftype" spltype)7 i' l) {5 D! t$ n  X+ n1 b
                (setvar "surfu" u)
& C7 o9 i; r4 [# U$ T6 A                (setvar "surfv" v)
3 t6 {  D) _, H; E0 w                (command "_s")
" R7 p# \2 }/ b+ {              )4 U& h7 Y! x* x( T
            )# b& p# z5 H6 ]/ }3 p: S
            (if (/= closedm old-closedm)
, g' L4 E  X" U$ g/ n( W              (command "_m")4 }6 m) H' L7 A8 I, L
            )
3 _  w- i4 h* r4 l! N' |            (if (/= closedn old-closedn)7 J9 g4 t2 t' T6 p! e' [
              (command "_n")
/ W$ M6 Q& k  d! F; s: u            )+ X; W+ O0 ^/ S0 p- n! L. t/ I  L4 y" B
            (command "")
' c- M$ z) I+ k          )& k) D( E' n( p1 m/ A8 a& q
        )
2 K9 ~1 I0 r: V: F      )5 ^. `6 j" U) c6 m/ Y; x+ V
    )
3 B( H7 y& x* @# i% ~: `* V8 b$ A/ a- `  )" b& d+ M( T. h. e& Z
  ;;
8 z; b8 k' ?0 {) E+ K  @  ;; All the spline data is contained in a single elist. We must do some
( o5 m' E; c; A6 O! Q4 w& n! M' m  ;; tricky list processing to loop through the elist in order to display' C6 k  ]0 `5 ^+ L& ~1 K( y
  ;; all of the control points.
) n1 E, G# G& ~/ _7 c+ {  ;;
2 g. M; p. \1 y3 h" ~) {/ x  ;; The structure of the elist is different for rational and non-rational+ |% y" F8 i7 P" s( Y
  ;; splines. Therefore, we check the rational spline flag.
  l3 Q: u. z( m9 K+ F. g# ]! s  ;;: X. R# t/ Z3 L3 M% l! v1 R- F# p- K
  (defun next_cntl_pt ()
; Y( [, j$ B' f& e7 W    (setq elem-no 0)               ;; elem-no = element counter
: [0 k; K4 V3 G! U1 q    (if (= first-10-time 1)        ;; If first time, find location of first
- l, w* F9 G/ K: N        (foreach list_item elist   ;; cntl point element in elist+ e  k4 {7 a; A: g+ [6 F
           (progn2 y# {3 V9 H9 }+ R. }9 |
               (setq elem-no (+ 1 elem-no))
8 T/ C) @3 p7 @0 Q               (if (= (car list_item) 10)8 T6 t9 c5 K' w. G4 f
                   (progn
1 C# N3 X' g3 v                       (if (= first-10-time 1)- g7 d/ o3 g3 H( ^
                           (progn
' c& w- _8 p/ A8 s; j                              (setq first-10-rec (- elem-no 1))7 w9 e+ m# B; a3 I2 [& F; \
                              (setq first-10-time 0)
3 m2 b  a' \. R7 B: i: Y4 W7 Z                              (if (= rational_spl_flag 1) ;; if rational. s( F! D/ J7 M) U+ _1 S
                                  (setq cur-10-rec (+ elem-no 1))
! {# g1 ?& u# h2 c6 c, P! q- S: N                                  (setq cur-10-rec elem-no)$ Z* m- F5 ?2 J
                              )9 L6 s& J2 _! ~* w
                           )& V% t) w& ?! c' {
                       )0 f5 z/ }# L3 j, `3 r+ w
                   )
+ z1 C+ e/ I+ f  U1 i! W5 b+ y2 W               )3 C1 @/ U2 A" J. m! ?) d! \3 E
           )
7 w9 h" X, H5 C. I        )
# T- a9 B+ K; k, W6 d$ p2 ^% I    )9 `2 C. u3 ]; ?# x' u
    ;; Now we know the location of the first "10" record; it's stored
$ h& M" a, I" K2 d% T8 ^/ V    ;; in first-10-rec. The first 10 record was already displayed when) O3 g8 W" w% X
    ;; the dialog first came up so let's display the second one when3 W1 I* B9 H) P0 a$ ^: r/ ^) U
    ;; the user presses the "next" button (the first time through).% h: ]( O( l* m, k1 z' ^
    ;;1 e: K! q, v8 v8 j( y# r
    (setq temprec (nth cur-10-rec elist))8 u, p7 f$ r9 R' B- E! O3 ?* A8 J
    ;;' M! k3 i, f) F4 s  S3 u8 |0 s+ n
    (if (= (car temprec) 10)   ;; if 10 record; f6 v: K7 u6 g2 ?6 ^& u8 l
      (progn
: g* V# }& l" T4 e) D        (if (= rational_spl_flag 1)    ;; if rational spline
4 L, E& I- l; U          (progn& b0 i2 ~2 _1 a. d
            (setq tempweight (nth (+ cur-10-rec 1) elist))
/ P8 Z4 @6 F, r+ t* n            (setq cur-10-rec (+ 2 cur-10-rec))
9 \. x& K5 `& M. ?& k+ _. k          )
1 b+ {. \7 ~% Q          (progn                       ;; else
/ U; C1 N) o1 ?3 C# W: q            (setq cur-10-rec (+ 1 cur-10-rec))( T" ~0 F! e0 {7 u" m
          )5 i& M- j/ Q0 y8 y- I  q
        )
4 [6 \, o3 r/ C' a- w* N; E4 W* h      )                                ;; end if rational spline
2 M1 p7 K3 ?; r3 A3 ^5 `  d" }      (progn                   ;; else reset counters" O' L- x1 L1 }. a9 |
        (setq temprec (nth first-10-rec elist))  ;; get 1st 10 rec
$ W, o. u0 x- _1 F/ F+ b0 {% k        (setq tempweight (nth (+ first-10-rec 1) elist))
3 ?$ K; l1 \- N2 n& F( F        (setq cntl-pt-indicator 0)3 o+ K' V$ D0 |$ _1 E: t
        (if (= rational_spl_flag 1)             ;; if rational
; W4 S* H6 Y3 d9 F; h- B            (setq cur-10-rec (+ first-10-rec 2)) ;; point to 2nd 10 rec' ^2 n" Q# d5 F3 \7 K# ~0 y
            (setq cur-10-rec (+ first-10-rec 1)) ;; point to 2nd 10 rec
$ i% e1 A* |3 y$ Z  I3 P  @        )
  n: \9 P/ M/ r/ K      )5 O3 x* x# S  k2 ?6 Q4 L. q$ g
    )                          ;; end if 10 record
( b8 }3 F0 L5 K/ P! v! R0 A8 [3 o# Y& \- @9 E
    ;; Display cntl point, weight and ctr. Increment ctr.1 i+ b! y0 o; R5 F) H; a
    (setq cntl-pt (cdr temprec))" Z( S2 B  Y4 A# ~+ m% |
    (set_tile "xtext" (rtos (setq x1 (car cntl-pt))))
$ ?, O& L0 C+ \' n# S, X1 P( r    (set_tile "ytext" (rtos (setq y1 (cadr cntl-pt))))
, F; h* u: @2 e, y. U8 w3 K    (set_tile "ztext" (rtos (setq z1 (caddr cntl-pt))))
9 R  o7 @9 a& l    (setq cntl-pt-indicator (+ 1 cntl-pt-indicator)): d9 c0 U2 W' i" Z* w5 j
    (set_tile "cntl_ctr" (itoa cntl-pt-indicator))
0 n! d$ I/ H& o1 O    (if (= rational_spl_flag 1)                     ;; if rational) z6 h2 t& r! ]( q7 J) K, `
        (set_tile "weight" (rtos (cdr tempweight))) ;; disp wght# m. z5 Q: E/ i
        (mode_tile "weight_text" 1)                 ;; disable wght
) N# r2 O( w- O6 ]+ f# D    )
6 ]4 G$ k2 R" U+ p- v. j( ?  ); X! J6 |; x+ r0 t& E0 y! ~; A9 W! A
  ;;
" s7 U' F4 n- _  ;; All the spline info is contained in a single elist. We must do some. V5 g8 E& j8 L
  ;; tricky list processing to loop through the elist in order to display  C" ?; I6 I5 T" U  k
  ;; all of the user data points.( V5 t4 Y8 c4 ~1 G  o7 |
  ;;7 i1 R; f; \; n6 G+ C
  (defun next_data_pt ()0 @5 k, u) o" ^& o  h# C6 m' @
    (setq elem-no 0)               ;; elem-no = element counter' Z. x2 `4 b# ]
    (if (= first-11-time 1)        ;; If first time, find location of first
. j. i1 @6 M  E) Z0 q5 t. A* n        (foreach list_item elist   ;; data point element in elist
0 {6 x: t( Y; [; F1 q; f           (progn
# ]6 B" ^  J! `* s) ^               (setq elem-no (+ 1 elem-no))
) Q5 j. O. h8 M' V5 `               (if (= (car list_item) 11)1 v0 h% K* n4 w/ I9 x. K
                   (progn
6 t* {1 j7 r5 S6 @5 X3 p! A1 q! j                       (if (= first-11-time 1)
8 i) }1 l, a& O3 n+ s: \6 H                           (progn
4 U4 l8 @" Z6 B0 o4 \7 R2 @3 D" {: P                              (setq first-11-rec (- elem-no 1)): `3 ?/ |4 n$ |; [
                              (setq cur-11-rec elem-no)9 b; N( q- C( n
                              (setq first-11-time 0)
& e6 K0 O/ r1 h. S1 V                           )7 A1 |) t! R8 b5 Y  T, h
                       )6 \) g+ l1 t9 c( @- ^. n3 a
                   )
- s) _" o8 y# `8 O5 h               )& L" D6 {# @4 m% r; a$ d% \+ k7 O# D
           )
: [+ ]* A$ q9 m1 S/ `. L        )
8 C' y0 o' E+ I- H/ w' M8 k    ), N& q0 Q* |* {# `& k2 e; p
    (setq temprec (nth cur-11-rec elist))% f/ ?7 @8 X, ^& \
    ;; If it's not a DXF "11" element then we've gone past the last' t0 ^" p* }0 H. Z% ~* h$ l
    ;; "11" element. Go back to first "11" element. Reset counters.
! `. B8 X4 W: Y+ F    (if (= (car temprec) 11)( j& p/ u- w, l1 v% ~$ @
        (setq data-pt (cdr temprec))
8 _4 e, }5 E* j) N        (progn                           ;; else( a+ a7 m4 K5 q9 X! m+ |9 }, d
           (setq data-pt (cdr (nth first-11-rec elist)))
8 y2 r4 I2 ?1 ~5 i2 k9 e, j) i           (setq cur-11-rec first-11-rec)
- {- \7 d$ ^0 R5 v% m9 i           (setq data-pt-indicator 0)
8 _8 j3 a2 I* x1 y        )
; Z" _, c5 V5 Z, H$ }    )
% v: O# o1 w6 E4 U4 q    ;; Display data point and ctr. Increment counters.! F5 d) c+ U4 u" T2 Y- q. v
    (set_tile "dxtext" (rtos (setq x1 (car data-pt))))
* w2 C& u' b2 w3 o% B  _1 ~    (set_tile "dytext" (rtos (setq y1 (cadr data-pt))))/ i+ b7 w5 w& }, g6 Y
    (set_tile "dztext" (rtos (setq z1 (caddr data-pt))))
2 X2 Q/ G# c4 k    (setq data-pt-indicator (+ 1 data-pt-indicator))
9 C$ r/ I' x) M0 n9 |9 z9 v    (set_tile "data_ctr" (itoa data-pt-indicator))
! ]7 @4 z" v3 D( b& Y    (setq cur-11-rec (+ 1 cur-11-rec))
( T! a  M! K- @- |' H8 \/ E( k, o  )
9 v' `. X+ M" @( C2 k/ Y  ;;
) U, N- C9 f6 L3 \  ;; Modify SPLINE
& s, R6 g- |( |1 N* V$ R7 n+ {  ;;$ u9 j4 G! }" A9 g
  (defun modify_spline ()
2 ?3 O/ m: ]7 l" z    (modify_prop_geom)
$ M( J& Z+ T/ Q, A, i    (entmod elist)& ^2 p+ o  A' Y# Y; V
  )" N. y% U, G) z% u5 p
5 Z* B( W% l+ B3 R% Z/ F
  (defun ddspline ()
4 i  T& l. z6 {* S# x    (if (not (new_dialog "ddspline" dcl_id)) (exit))( Q6 b* e, l1 `& j+ s- K8 X4 e# j
    (set_tile_props)7 x, ]7 [" c9 V* b2 h. Q' M
    (set_tile_handle)  G) w7 Q' S$ u8 [( D$ r$ E
    (set_tile_spline_props)
/ q* |" J9 b: X    ;; Display first control point
9 t5 [' P5 V3 F$ x; ]8 h. e" v" O    (set_tile_cntl_pt)
" J$ Q: Z  s. C, z# [9 _$ K8 X    ;; Display first data point) y* c  \2 o$ d* T" `' _
    (set_tile_data_pt)
8 [. B0 y# v% e- L& U& p+ y: B7 X* h/ Q( _4 u( J
    ;; Initialize flags to indicate first time through the dialog.
' j/ a1 y- T' ~" X& k/ M5 w    ;; For control points and user data points the "next" buttons
2 ], V; o! `5 }: }4 g- ], ]9 r    ;; in the dialog call the appropriate functions.+ K) P5 c) c& ~
    (setq first-10-time 1)
4 q( f) K& K5 g5 S6 R    (setq first-11-time 1)
8 g7 F9 d7 D: ]$ s6 H    ;; initialize control point number counter
( D( s" f7 c& l8 o5 i! x    (setq cntl-pt-indicator 1)
, ^8 b8 J! f$ h5 l, ~    (setq data-pt-indicator 1)
' J2 n$ v9 L, a, _/ Y1 i; v    (set_tile "cntl_ctr" (itoa cntl-pt-indicator))( X/ m' u/ E% n& [* W/ W
    (set_tile "data_ctr" (itoa data-pt-indicator))
7 x: e% x( z( N. B! x8 m    (set_action_tiles)* V# n' h9 |' O+ G/ |+ N4 G5 \
    (setq dialog-state (start_dialog))
0 @5 H7 Q8 _- i6 ~9 T
- S' F% Y2 O: S. _) `    (if (= dialog-state 0)
9 o9 l2 _' I% t$ a) u% t4 y      (reset)* S( B/ E5 [  X6 s, r. O" b: c! F
    ), E6 k! @: O: h1 e# W% d
    (if (= dialog-state 1)
$ \; Z* g* ?7 W$ U1 P$ O4 U' Z      (modify_spline)
* S+ M4 W  \2 B9 W    )
" q1 p( |6 W4 P# P1 a2 ?  S& x' h  )
, S% Z1 f, T. k, E+ @% Z' H1 R; s1 U' ?  T5 J

! w5 d% f% R# D2 O' L1 j; j- L7 L8 l. w4 V5 F; ~7 P
  ;;
, \$ }0 i$ K1 p! s5 z  ;; Modify DIMENSION
4 n* z( v# D) s  T$ ^& l, p& l  ;;
: N3 x& x' a5 [% x# Y+ g  (defun ddimen (/ dtypebit blkname bename sublist a stname n dimtbl
" ?: d9 ]# @' d3 K* d- ^( b                   dimsty dimlist dimtext svtext dimovr sv_dvlist stlist0 N6 n9 J; d  I( J$ A% P' Z9 Q8 S/ u
                   dimtype dimsvcurset)
0 C+ u# ?# W) P. t   (setq dimtype "DDIMEN"
6 p! n- w" Q0 z0 ]; i( {          dimsvcurset (ddimen_dimsty_restore)
# c7 m/ g* T; g7 {) g3 A    ): D" q  U8 V5 H& [  |
    (if (not (new_dialog "ddimen" dcl_id)) (exit))5 ~+ Z) z% ]8 ~6 b& D6 v5 @
    (set_tile_props)
; e5 E; {0 e$ ^3 l& b& g" b5 O1 b    (set_dimen_props)% z) k# s, E3 t0 L) t% e
    (setq dimtext (cdr (assoc 1 elist)))( c- G4 J( V* o# V$ T
    (set_tile "t_string" (if (= "" dimtext) "<>" dimtext))
5 U( U" A) b3 C; Q    (set_tile_handle)
# e' u  N) O5 K! X1 V8 M7 u    ;; Define action for tiles
# d1 x6 \0 }  F" `9 U    (set_action_tiles)6 i3 c- x8 w" H3 u
4 j) k# G/ c  @
    ;; Set initial focus to text edit box.7 X. Z5 B8 X6 h* s7 ?
    (mode_tile "t_string" 2)4 h/ |6 l& J; m- P
4 I# ?4 ^- ?# r7 y( C0 T7 ?$ Y
    (setq dialog-state (start_dialog))4 V8 A$ F' a3 k7 W: b/ f/ V5 g
    (if (= dialog-state 0)
+ i5 J# a: L9 e0 }, ?$ k; S/ f      (if (= ddimmt 1)
$ P" N1 i( L# Y( }( k/ }3 I7 h        (reset)
# T+ `- w) k7 \& ]/ R      )  v5 n6 V. N- w$ U
    )7 R4 M, u. ~& {+ _4 {, d) Q
    (if (= dialog-state 1)" L7 ^& K; l3 q1 B1 [! H* [
      (progn
* D' |7 q* [! q% j0 n" y: f        (if (/= dimsty stname)
2 [$ n  o6 K6 N0 \$ R. H- a' W- R          (progn/ R/ x9 O: _) h
            ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case
* V9 j2 @% ]  k) l6 d$ I            ; doesn't have it.
9 D. Z$ P5 `7 L' B5 ^3 j            (if (null (assoc 3 elist))# g) l4 T% L7 y* H$ o1 Y4 r8 ~/ z8 r
              (setq elist (append elist (list (cons 3 dimsty))))
5 h# j5 K2 d8 t              ; else just replace it.% `) i* F: l: V, H2 R" T; _
              (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))
  [; a3 Z/ L7 {7 n            )
/ f5 q/ s1 r6 k4 t' \            ; refresh sv_dvlist with new dimstyle., D$ K: `+ C0 O" v, G3 ^- ?
            (setq sv_dvlist (tblsearch "dimstyle" dimsty)), P4 ]* k; y4 G& U
          )
6 z" C8 t3 o, V2 [        ), P8 w$ [5 i2 C. }7 R' z
        (if (not (null dimlist))   ; attempted to change dimvars
' G/ y6 H+ S7 |" o- U% R4 f2 \  C          (ddimen_complist sv_dvlist dimlist dimtbl)
  ~( z4 p+ B/ ~' M9 G( _; g        )3 k+ {- ~$ `1 d3 Y: |
        ; Modify dimension text
# B2 [% i: d! w( T) S) y        (if (/= dimtext text)2 k% G0 b4 X; O, ^, G9 n! w3 a
          (progn
+ g5 p8 a3 ?4 |6 w, N  V  `            (setq dimtext (if (= text "<>") "" text))
  D4 `/ R- f, Q+ v: W            (setq elist (subst (cons 1 dimtext) (assoc 1 elist) elist))
. w0 i. V  i- l+ o( ]          )
2 M/ ?- b' K5 l; s5 |2 \# V        )
( k, K) X$ V' |' J$ h. u        (modify_properties)+ t4 i( F4 A0 R: }( S! @4 C# [% t# S
        (entmod elist)
0 D1 G( t& H1 q+ F- J      )
: p: z7 ^( e* E- t    )
' Q5 k) p' m9 ~    (if (= dialog-state 4)
& R7 X0 M+ d; Y      (progn. R; F6 t  H& S9 W4 ?
        (setq ddimmt 1)- Z3 [# K2 g$ B: x  \
        (if (/= dimsty stname)
" @! z1 t* r5 o          (progn
9 @6 O3 o1 L- t$ h+ Z* s6 L            ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case5 \( w+ ^+ L" R- R( u2 M
            ; doesn't have it.2 m6 E& s; J- P) Y, q
            (if (null (assoc 3 elist))0 ]2 [, S+ x8 t7 g. p' p
              (setq elist (append elist (list (cons 3 dimsty))))
; H$ y1 z) y" a' S% }8 `              ; else just replace it.8 m' {( \4 S0 a2 B/ r
              (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))) u1 g/ X/ \* F: d; B; g
            )( t# A7 ^0 {" A: Z5 S# Z' m
            ; refresh sv_dvlist with new dimstyle.0 H1 y* I; M" q
            (setq sv_dvlist (tblsearch "dimstyle" dimsty))
: U; U; M$ \; [2 I. v$ e          )
$ m# |& i' O% l& U1 F        )
6 G0 R/ W0 w4 `        (if (not (null dimlist))   ; attempted to change dimvars: O7 Y' O+ Q8 ]  W2 j+ a5 j/ z; w
          (ddimen_complist sv_dvlist dimlist dimtbl)4 \4 g8 f, s3 h9 P! l/ s
        )& y% C9 Y  n0 `4 H* p
        ; Modify dimension text
1 X. c, d0 Y; H* V' Y" ]& t        (if (/= dimtext text)
7 g0 S$ Y, }8 k0 T3 A, Z: w          (progn
( s: Q  i0 Z- X2 ]4 Q" j# L            (setq dimtext (if (= text "<>") "" text))
  I# X, v, L$ v5 e  `  D, y            (setq elist (subst (cons 1 dimtext) (assoc 1 elist) elist))
7 n% o6 P* i3 R          )# z& v; {) m5 s  |- R$ A
        )$ N+ v0 c& i4 q4 M
        (modify_properties). d2 B" t2 t" O: Z5 f
        (entmod elist)) S! ~3 m0 o- m" \9 w* H! I5 F
        (safe_ddedit ename)
% f! o9 ^! f+ D        (setq elist (entget ename))
8 S% T2 V, c/ b" F7 p+ m. b( k) X/ K        (ddimen)
, M: f/ S% w0 l      )1 f9 K9 {0 ]# D  U' c& c7 M3 Q! n
    )1 I9 n- W6 m! f( K6 s
    (ddimen_setvars dimsvcurset)      ; Prepare to exit3 [5 ]& `4 Z9 o/ c4 T
  )
2 f$ L7 q( X5 }
9 ]  C& }7 a$ ]# G$ Y  ;;( V. O  Y. F" n, i6 a- [' o
  ;; Modify TOLERANCE/ p$ Y' e. f/ w* \# t. K
  ;;
2 L- j) F" E6 R6 d  (defun ddtolerance (/ a stname n dimtbl
$ b# T0 _6 \9 @5 M# ^                   dimsty dimlist dimovr sv_dvlist stlist dimtype  r  J4 E8 S# t$ ~
                   dimsvcurset)
) l8 {! \: W2 a7 a, e    (setq dimtype "DDTOLERANCE". F- h7 a% B0 q
          dimsvcurset (ddimen_dimsty_restore)8 C! D2 s- y3 X7 |3 E: l
    )3 J. j" T" t" e. T. @
    (if (not (new_dialog "ddtolerance" dcl_id)) (exit))
% u) N( v' A/ n    (set_tile_props)
9 }: z+ M. j: i0 I' l    (set_dimen_props)
' a+ ^8 P9 e, p/ S    (set_tile_handle)9 C) s: X3 z1 d0 g  I, B7 i5 ]
    (set_action_tiles)
4 H/ Z8 ^& ]- U9 [; v    (setq dialog-state (start_dialog))! K7 z9 h# W. W, Y. _
    (if (= dialog-state 0)/ f3 w) n7 n5 F; A6 |% Y1 Y
      (if (= ddimmt 1)% o+ @! `/ w9 \# k
        (reset)1 d+ I% ^& J- F# ^7 Q
      )
) d5 j% |' o( A  C8 v# d    )" c/ t4 F# b; b8 Z
    (if (= dialog-state 1)
; K. Z$ v( W. w* E# C* l, P( n      (progn
3 A' {+ @+ s' w8 }' U        (if (/= dimsty stname)
5 G6 X6 C' a7 g* S( P          (progn0 m& F% w/ [! T3 U
            ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case) v1 N: q# [* v2 `( t: b) X7 o
            ; doesn't have it.
" c* t# x& N- b% F* k! }2 @            (if (null (assoc 3 elist))0 b+ {8 r) g: L5 R
              (setq elist (append elist (list (cons 3 dimsty))))& |( E7 f) U4 y& x; l
              ; else just replace it.
4 h5 g+ Y! E/ k* s              (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))
; T& g% W; m5 B3 I# c8 `9 T( w- Y  z            )9 E3 P& K% o$ P, _4 U: B/ F* v
            ; refresh sv_dvlist with new dimstyle.
& @) V7 C; f! \) v2 o* \0 h3 x            (setq sv_dvlist (tblsearch "dimstyle" dimsty))  `5 g% ^6 I7 k2 E1 o
          ), `' i( P- S- A  ?
        )
& H  w) e$ q% W# H) V* A        (if (not (null dimlist))   ; attempted to change dimvars
' J" `9 G9 A2 y* v$ \          (ddimen_complist sv_dvlist dimlist dimtbl)" a% Z# I4 V, f# l8 L
        )
0 A1 J# T/ k" @        (modify_prop_geom)
/ ^! ^* q' t2 u2 ^        (entmod elist)
  N- @1 _7 w9 Q0 u      )
6 c/ u  a, c# l/ W8 U( [, {    )
- g5 Q2 A, Z" O1 t    (if (= dialog-state 4)6 {5 M$ A9 T' N
      (progn+ Q0 u2 ~% l7 E0 f: c9 z
        (setq ddimmt 1)' _. }0 U& x; r/ E
        (if (/= dimsty stname)1 L5 [# n# B6 ]$ Y1 E% W
          (progn% @) ]  S! w2 W1 W1 b1 s; r$ r
            ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case/ f" V( _5 c# \0 w# \3 Y* G
            ; doesn't have it.: b* Q3 x* @7 q6 v9 s6 ^+ {
            (if (null (assoc 3 elist))/ {8 @1 l+ Q! G: N' n
              (setq elist (append elist (list (cons 3 dimsty))))
" n' m1 |5 j- s6 n  _              ; else just replace it.; a4 C/ ?: E6 }: M; o. l0 M
              (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist)), r/ I8 R( w8 z+ G: ?
            )
" P* a: P( T! B- M$ h            ; refresh sv_dvlist with new dimstyle.0 n" G* T+ L+ V# W* N0 V' d
            (setq sv_dvlist (tblsearch "dimstyle" dimsty))& Y$ p) s$ F  ?; J
          )! c2 S. B3 l& ^6 U7 e# V/ k) F
        )* k+ E& @- U3 ~6 ^" u0 r
        (if (not (null dimlist))   ; attempted to change dimvars& c/ l2 k1 I# C5 N2 z  n
          (ddimen_complist sv_dvlist dimlist dimtbl)
& _9 E2 P& C$ j- ^' X* H        )
" Y. ~2 a3 C4 x! O        (modify_properties)2 ^* ^  H$ m9 i7 V2 Q: A
        (entmod elist)% I! n) n* Y8 Q+ L7 f0 H
        (safe_ddedit ename)7 w$ P' Z1 Q9 k& M$ E- D% A5 y9 `
        (setq elist (entget ename)), l( ]9 a* V4 X. T% V
        (ddtolerance)
+ [9 o3 l9 ~/ _3 |* n      )4 m* E4 G# w* q6 h4 m
    )) k8 x$ O/ ~+ p9 p' o, C
    (ddimen_setvars dimsvcurset)      ; Prepare to exit
1 C0 T# L% b8 x4 c3 h5 M5 \)
' l, ?- \" @1 F7 W% V+ x+ x2 A- |. w9 g' s# E3 b* F( V/ b  v
  ;;$ l& \$ c1 {( I% Y1 _* y
  ;; ddimen_dlg - jump to ADS ddim module
/ ^/ H- l0 V1 b; L  ;;9 j! q0 _' |7 d% ^  X' \

% P0 X: U  R9 X! j* ]' `( \+ ?  (defun ddimen_dlg (dimtype tile dimsty dvlist / dimlist)- a6 F0 ^2 I  x# ]0 W
* P5 F# n6 B  Z4 D+ ~* y+ F4 c" S
    ; Jump to DDIM with overrides if any.
0 Z; |! a, H2 P) L9 ~1 X5 K. E    (cond ((= tile 11) (setq dimlist (c:ddim "DDMODIFY" dimtype tile dimsty dvlist))) ; Geometry
7 m& w& b6 W$ {          ((= tile 12) (setq dimlist (c:ddim "DDMODIFY" dimtype tile dimsty dvlist))) ; Format
% x' \" f+ s0 Z5 ~' X: u          ((= tile 13) (setq dimlist (c:ddim "DDMODIFY" dimtype tile dimsty dvlist))) ; Annotation& Q8 W3 U& F) Y
    )! U% E( r3 c! Q
  )9 X- q+ J1 a2 ^5 C  d* q+ G3 ~

+ Y3 J3 ?! d: ~; N, S  ;;
' J" i, u6 h) O3 @; L6 y( }  ;; Dimension variables updated are stored as overrides.4 y8 [! o  g9 P% m) |
  ;;
, N- Z- Q& F8 d# ?/ C- \1 P( ?$ G2 Z$ o! f. w
  (defun ddimen_complist (dimolist dimnlist dimtbl / i odvar ndvar- n- a3 t& u1 A8 }3 c
                          dv dime commandIssued)+ c3 w! D6 h3 ?$ l2 l: f
$ y  F. O: G: Q( k+ A3 I- N7 k2 H0 w
    ; Here we skip the following first three items:+ n, |, u' a) w% Q8 {
    ;   (0 . "DIMSTYLE") (2 . sylename) (70 . 0)
5 q1 t2 I# b' ]$ h, O    ;
7 ^+ ]; P+ h, F4 H: }    ; The list comparison immediately begins with dimvar.8 Q; }6 Q4 k& f6 e
    ;
: X5 [0 v) X( o6 \; ?( V6 A4 b. \7 U- E    ;  dimolist - original states of dimvars
$ B: A9 h8 G9 u$ [    ;  dimnlist - new dimvar list which is of the resbuf's
0 H& D1 j; C' t2 \# @8 i    ;  dime - entity name for the dimension$ p1 B6 K/ c' K3 a
    ;  odvar - value of dimvar for the dimolist1 n; z* _$ Y1 r1 J) ~, i/ Q
    ;  ndvar - value of dimvar for the dimnlist
4 @/ |% F# P! _0 w! y
! S% |' p  `1 ^( U1 g" I& ?" h    (setq i 3
9 e' l) V. j, ?# t/ w  b/ T          dime (cdr (assoc -1 elist))
5 G: F/ i+ V. _    )& `0 o  Q3 z+ k* E' \: i+ l5 I6 R% `6 O
    (while (setq odvar (cdr (nth i dimolist)))2 r5 _  @7 ]* z! U( f4 b
      (progn, f) A* N4 r; _5 o1 F
        (setq ndvar (cdr (nth i dimnlist)))
0 U/ r8 P! g- o  Z        (setq dv (nth i dimtbl))
8 r: J1 u0 ?6 N5 i% b$ C- L7 c2 Z        (if (eq dv "dimtxsty")
) X* f+ L8 T6 a( E            (setq odvar (cdr (assoc 2 (entget odvar)))
& J! H+ ?  R2 P. b  i4 `& b                  ndvar (cdr (assoc 2 (entget ndvar)))( n5 z" d, C! J. V
            )
8 N2 X0 @! r6 t! y; N( B+ E7 z$ s3 ?+ H        )
6 F5 ^7 |2 h: P& k# w2 V+ A( S% F6 R  a+ Q+ @
                ;: e: v; `- I+ ~: X
                ; In order for DIMOVERRRIDE to operate correctly with string
1 J1 d6 S5 o2 C/ Y4 j  h- N                ; based dimvars, we must pass "." versus NULL strings.; A( ]3 ^# T0 U! b6 `' S& I
                ; In this case ndvar is the new dimvar value the user wishes
8 p: e# j1 _. w0 K                ; to update on selected dimensions.5 o7 Z/ z' a! u6 v/ Q& u8 l: Q
                ;/ ]# k1 S+ M0 d2 M; ?5 ]0 y2 J
            (if (/= ndvar odvar)
* [- ^# F, m3 p/ u2 i* `              (if (= 'STR (type ndvar))
5 `; ]* o4 W: ]; v# b                (if (= ndvar "")" D* f/ ]6 f  b6 \, P( c
                      (setq ndvar "."))))
- z* l* C1 h) j: v1 P# }) I7 Z+ ~0 k- c; M* O5 W
        (if (/= ndvar odvar)/ T9 [/ S; v8 G7 ~
          (progn% P! c0 f' {8 ~2 Q# u
            (setq dv (strcat "_" dv))
- H. W9 r7 g8 D            ;
2 q$ x" @, c- F: B. m            ; Start the dimoverride command9 W" m* I, F9 G1 b  L
            ;! X' \7 ~' L# p6 ~9 N# \
            (if (not commandIssued)* D  {. L+ ^4 K( }  E  Q; J
               (progn$ w. V4 @* ^! }7 H& m) J/ R( x
                 (command "_.dimoverride"), ^0 ]" v: G' Z! N" j  {  \
                 (setq commandIssued "T")
; n7 l. `7 j) l) ^               )
0 ~! V. I1 ?) x2 @            )
; `' T. Q% l) T  ~7 Y& F            ;  P# @3 K) n# ]7 {
            ; Issue dim overrides
8 Z  ]8 x( V$ f( o  F5 t; I  L) n4 D            ;7 s' T2 y' r% ], ?# f' r! j% D
            (if (and (or (= dv "_dimclrd") (= dv "_dimclrt") (= dv "_dimclre"))
7 t6 V6 s9 M4 {+ u2 i                     (or (= ndvar 0) (= ndvar 256))
  _3 R% J3 Y7 B1 \7 Z                )5 Q$ k8 S% _' [5 _4 ]" Q
              (progn1 Y% Q. ?2 B$ x1 I- x5 v
                (if (= 0 ndvar) (command dv "BYBLOCK"))
8 @6 n' m! Y  M$ R                (if (= 256 ndvar) (command dv "BYLAYER"))8 c% _6 t0 o" x. ]- S
              )
# R/ B: i/ g- ^$ U' }# n# ~              (command dv ndvar)$ S# v. |, }+ a2 T1 V( V
            )6 u- L8 ?$ h& L0 j- f
          )7 C% s0 {# b/ T: ^: x4 x3 m7 t
        )1 D- B! T9 |, ~8 R
        (setq i (1+ i))
" l* w( x' z: M4 Q      )* b  J' |& o- ~4 }& P! A. d6 l  C
    )' m3 p6 G" N& M
    ;
& [5 \2 r6 P' o! O    ; Select Entity and terminate command8 R/ E  \9 L2 E% L5 D- u. Z" t+ [
    ;1 f' s; N7 T% d3 h1 d0 A4 G  g
    (if commandIssued: w" d9 _$ _# G% X% }
        (command "" dime "")+ t2 E- y) B$ M/ Z4 Y/ X( A# _8 ^
    )
2 v- K- N, }( b1 u  )
. I' T3 _5 F3 q; u1 `3 ^: x& ]
9 k: M; K% U6 A4 F# _  ;;
2 X/ j; |& B0 H% i9 ]6 Y  ;; Get style name currently selected style name.
! t: w7 l$ b! d6 l/ b  ;;
* O  g# H8 x# I3 g0 @+ ^0 b4 w  J6 y& n$ t
  (defun ddimen_style (/ dimsty)7 p2 x# m5 i% P  ^0 A1 v0 R
    (setq dimsty (nth (atoi (get_tile "mod_style")) stlist)' y$ r4 P) u( |, S! C8 P2 P4 L3 ]" c
          dimlist (ddimen_getdimvars dimsty)# G: e) P8 ?4 Q& H9 n: g' U7 }" Q
    )" w6 L, u8 w4 u# o6 C- ?$ N
    dimsty
% i' \3 ^7 ^$ k; v  )
; u# y6 C% z8 z  U) s% c$ J5 j
- l" |  n! G( w# }8 [( l  ;;
/ E9 {! o% j5 W- `9 l0 K# g  ;; Set dimvars  q( H+ z0 e' _+ t% |3 \' p4 u  d5 z
  ;;2 e- L6 h6 L) g. u0 ?' r( r
  (defun ddimen_setvars (dimsvcurset / dv i)
8 g: o% N2 v4 |0 v: \* W    (setq dv (cdr (nth 1 dimsvcurset)))& X! |& S+ X/ `8 p" y
    (command "_.dimstyle" "" dv)
" X  j# |8 R! p* g0 e# x" K    (setq i 3)
7 \/ ?8 ], q* s) F    (while (setq dv (nth i dimsvcurset))6 @  d% `  c& W9 V# Q3 \
      (progn( d4 h' c7 k' c$ S! ?6 t- q: C3 s
        (setvar (car dv) (cdr dv))
* Z  o- v% M" W" F/ G0 ~9 v        (setq i (1+ i)); D( `+ y  X& t3 A5 q0 ^
      )) J) M" u6 s- `
    )
2 O* u2 m; o# K1 a; y  `  )
7 D7 H5 A: p% M& ]  ;;# F  R7 x) Y; G+ }! Y  T( [
  ;;  End-of-dimension& D0 ^4 g2 u, {5 ~* v6 M
  ;; ==================
: O: `  [  w# _0 w; k( E% X% ]% X, P; X0 W" c8 i1 \( g
  ;;
. \- z: m% `' J" @4 }* L7 b' F  ;; Sub-dialogues for properties.  Common to all object dialogues
/ r) f3 ~! Q$ y& {4 ~" a$ M  ;;
( b  y6 J6 i' I/ W- \4 q" q  ;; This function pops a dialogue box consisting of a list box,image tile, and5 w& ]- Y' a, s) W0 B6 H% i
  ;; edit box to allow the user to select or type a color number.  It returns, N( {2 D6 K/ G( t  A0 V
  ;; the color number selected.
, Q2 o" x2 V# T1 C% q  (defun getcolor (/ old-idx colorno cname lay_clr)
" r/ E6 \0 ?2 {, \( g# W. k* z! _    (if (= (get_tile "error") "")
3 ?9 m& w" ^. O/ n4 e5 V2 m" W      (progn7 e  W0 c# F1 ^0 A0 e2 i1 ^
        ;; Get the color associated with this object's layer, for use' f+ b3 B, q% h! D
        ;; in the color swatch if the user selects color BYLAYER.' I0 _! ?' L: e- ~4 R0 ]
        (setq lay_clr (cdr (assoc 62 (tblsearch "layer" elayer))))( J9 F, L- Q' q3 \6 K7 V; L; a
        (if (numberp (setq temp_color (acad_colordlg ecolor T lay_clr))); U$ Z6 n- |8 {* s& R
          (progn  r3 s3 J& |$ U$ B4 l$ z; M
            (setq ecolor temp_color)
* c- }; D. U. j' q& L# {            (setcolor)7 E8 H4 @7 M  y$ u; ^6 p2 c/ o9 m
          )$ s9 L0 d* D" V1 \# O/ y3 {
          (setq testcolor temp_color)
) J1 k) P- V& |% ?        )( }! f# [7 w5 p, N
      )
2 `0 K' z; b4 I1 K    )
2 y8 n' ]3 S0 C    ecolor. ]4 ?. ~  d8 F6 t+ F
  )
( F! L6 B& O5 V) h4 P4 n  ;;
9 U% s& z' t# H; G! J  ;; Function to set the color tiles.8 ]9 [2 \8 @; M9 {" l( h4 E
  (defun setcolor()
$ K' z1 W" n6 A$ D, }2 C+ U    (cond# u7 C$ x! g: P* E! o+ ~/ v
      ((= 0 ecolor)
$ l; a/ @$ m7 h; J" t9 K        (set_tile "t_color" "BYBLOCK")
, m$ ?& p+ ?* a! H5 H; f& X& h1 K. }        (col_tile "show_image" 7 nil)    ; show BYBLOCK as white( y& Z" b8 L9 L6 N$ n0 T1 J0 `
      )( e& I/ R8 U4 K. f5 {
      ((= 1 ecolor)
1 I' A1 Q0 |# Q" h' m$ W. }1 n# [4 J        (set_tile "t_color" "1 red")
. b) J& s0 r) W( y        (col_tile "show_image" 1 nil); y$ ?* [, a: R0 y0 }: g
      )( T4 b4 Z1 L9 K7 S9 i
      ((= 2 ecolor)
  \5 E9 s/ U; l0 ]        (set_tile "t_color" "2 yellow")
& r$ f7 g+ T  Q& F        (col_tile "show_image" 2 nil)
8 n; n) K- ^& p, G; W      )& }7 F7 Q. _/ U7 g: p1 N% x% M
      ((= 3 ecolor)8 u: \+ x0 J7 E/ w$ E8 k
        (set_tile "t_color" "3 green")
; z4 X5 \3 l3 p7 _% |. K' J% g5 d        (col_tile "show_image" 3 nil)
. U  e/ _8 k6 Q* [$ Z1 f      )
6 K* ]$ a+ ?1 h% {& ]$ e  a1 _      ((= 4 ecolor)
5 \; X, l  w! w7 N        (set_tile "t_color" "4 cyan")
, }% D  ]( V+ I) g( \/ \2 I        (col_tile "show_image" 4 nil), ~7 b1 Z! X! B
      )4 |$ }1 V# h9 x( I" Q
      ((= 5 ecolor)
3 o  M+ t# [" U2 h; H, y4 K        (set_tile "t_color" "5 blue")( U" q' V6 X/ [" G" A, ?! j
        (col_tile "show_image" 5 nil)
3 o% q; `: W* M      )3 C, \# ^2 F/ F$ ]
      ((= 6 ecolor)
6 x9 T0 f+ Z; g# P/ a: L        (set_tile "t_color" "6 magenta")
. L7 a) t/ q" _$ @% Y& z        (col_tile "show_image" 6 nil)
0 E7 q5 w" Q9 @$ C$ S      )* v, N  x9 h% C
      ((= 7 ecolor)
, _8 |* X8 g: y3 E        (set_tile "t_color" "7 white")7 Q5 v+ P, G1 I- u+ {- k) y
        (col_tile "show_image" 7 nil): d: H3 e( F# m
      )
% N3 a- y# H$ U9 Z5 G& Q      ((= 256 ecolor)
# K0 [7 b$ I5 k        (set_tile "t_color" "BYLAYER")5 I% k/ ]  f6 \
        (col_tile "show_image" (bylayer_col) nil), [0 O: P; p# }$ p! G8 W- B% _
      ): j! A  P4 Z6 Q$ a4 D6 }
      (T: j# ~. ~/ i5 Z' W. {3 ~
        (set_tile "t_color" (itoa ecolor))" a" W9 J2 A6 U
        (col_tile "show_image" ecolor nil)
' F7 F0 E( f: `* i! F. @      )
: ~0 h+ D6 a5 w    )
6 G5 Z* b/ A1 z6 f* s: F  )
6 k3 n- x. Q/ c$ X  ;;& R/ W- i# o9 e: P' T3 \+ |
  ;; This function pops a dialogue box consisting of a list box, image tile, and/ ~' j5 W, H3 }
  ;; edit box to allow the user to select or  type a linetype.  It returns the
, y$ X" U1 L9 R  h9 J  ;; linetype selected.* A$ X. v6 c/ ^: W. I5 m4 b
  ;;2 ~1 p  ]: F( N! n& E: n
  (defun getltype (/ old-idx ltname)
' D* d9 ]% Q1 Z' L    (if (not lt-idx)* h' e$ y- T# v7 z2 h, z( e7 M  c
      (progn: r+ ~0 R% U! O, v. M
        (make_lt_lists)             ; linetype lists - ltnmlst, mdashlist
& J! T* [4 X( L        (cond
( Z( l( w* X% @' y          ((= eltype "BYLAYER")
6 p, C8 H* X+ W/ t: g3 Q; U             (setq lt-idx (getindex "BYLAYER" ltnmlst)))3 U1 R* g' O* W- [0 w5 W) R
          ((= eltype "BYBLOCK")4 D" a! F  J/ j
             (setq lt-idx (getindex "BYBLOCK" ltnmlst)))
! i* p( j+ Y1 Y% E          (T (setq lt-idx (getindex eltype ltnmlst)))
/ n7 i, p& U  T9 a' F6 h        )% ]: z, @) M( L8 n. x: ~
      )' \( o  c1 c% _7 L( Q
    )# b4 |( T0 m; T2 s4 {
7 {3 J7 X2 y1 E  x4 m  A5 {
    (if (= (get_tile "error") "")
& T% J9 F, ^. b5 C; f, \4 R     (progn$ }1 v% N, p: D& ~
      (if (not (new_dialog "setltype" dcl_id)) (exit))% e% m' h# A) A( K
      (start_list "list_lt")
5 t9 O' ~3 y! }. r0 D      (mapcar 'add_list ltnmlst)  ; initialize list box" o8 L1 w! R5 \1 c
      (end_list)* j' B( p* g; n# C5 o. w/ }- s9 I
      (setq old-idx lt-idx)
1 A/ ?4 s  H2 ~7 v      (ltlist_act (itoa lt-idx))# b0 V/ ?% j; D1 w! i# f9 X1 R

  d' r. E* }; i) g  {$ X      (action_tile "list_lt" "(ltlist_act $value)")2 f' e+ X, z* N
      (action_tile "edit_lt" "(ltedit_act $value)")9 F! l9 Y% O) x+ r9 _7 H6 V
      (action_tile "accept" "(test_ok)")
9 f1 u- {$ C8 A5 K      (action_tile "cancel" "(reset_lt)")
$ B8 t# r7 f2 N3 l. Y; |  n5 ^3 B, ~
      (if (= (start_dialog) 1) ; User pressed OK3 ]& o% l+ N# D  K; `& {# Y) W
        (cond* `9 ~& v+ \* r( V2 K% A6 S* O, o. Q
          ((= lt-idx 0)
3 M# K0 z7 R/ R, X! v1 s$ _9 W& T: r) l            (set_tile "t_ltype" (bylayer_lt)); h; B7 O8 ?2 G7 k( e0 y8 r& t
            "BYLAYER"
: _3 u' d) @1 Z$ e7 B# V& l, d          )
# O. e6 r# x& e9 o% D          ((= lt-idx 1)4 g/ P( }# c" i/ r, ]7 K
            (set_tile "t_ltype" "BYBLOCK")
3 y. Q1 T8 O* F$ ]/ x            "BYBLOCK"
4 S6 S+ s5 Y% S# R( }( @          )
% l7 I( {1 W9 C0 u; F/ C5 n          (T  (set_tile "t_ltype" ltname) ltname)* ?/ H( s* F! v8 y" {6 Y
        )
5 U% J! b$ U' d$ b! M        eltype- }3 m4 n8 X1 W, u" p7 ?
      )
3 D1 s) ~! d4 W; M     )2 V% [4 E2 E0 T9 v' {! j
     eltype: C+ i- N3 t7 {9 B  r% d
    )  z; v3 b% r. I- S  @: ?2 q9 s; H
  )
7 C/ a- }. q* z  ;;( l% Z5 u2 _! m/ u
  ;; Edit box entries end up here
) L1 {& l! M* Y( L! M. |  @  (defun ltedit_act (ltvalue)
. I, o8 q5 B/ R& P0 ?    (setq ltvalue (xstrcase ltvalue))
# L5 Y) i5 H6 ]& _0 M# [0 w" n    (if (or (= ltvalue "BYLAYER")
" X* p: v6 P' Z) [! g9 E& d            (= ltvalue "BY LAYER"))9 I$ l6 B4 O+ H0 Y7 k# Z. m
      (setq ltvalue "BYLAYER")/ o+ E4 o$ {1 L5 Q- {+ F
    )
3 {+ k6 e* i; \. s9 p9 ~# P3 S4 M    (if (or (= ltvalue "BYBLOCK")
0 L) l) A8 e. S/ R$ _            (= ltvalue "BY BLOCK"))# |. o& r" S/ ]/ H( C$ Y
      (setq ltvalue "BYBLOCK")
0 {# x" u, U8 r0 K    )& r. T% ?7 y0 ?0 n( e3 [2 q1 \/ i
    (if (setq lt-idx (getindex ltvalue ltnmlst))0 o' M" ]; a  ^. S6 a
      (progn
" b+ U5 _6 ^9 H        (set_tile "error" "")+ k! f; o6 y$ `& W
        (ltlist_act (itoa lt-idx))2 ~8 [' h4 m$ O" F( c- A9 v
      )6 ~& _- Y8 H) d2 w8 G! ^5 h5 _
      (progn" F% C' A% `1 [/ I4 K) {) q; p  S% R
        (set_tile "error" "Invalid linetype.")
1 N# M% q4 {, V( M/ z        (setq lt-idx old-idx)9 D- |, n7 a' K# P
;;        (mode_tile "edit_lt" 2), L- L7 j2 z4 U
;;        (mode_tile "edit_lt" 3)4 D+ E1 @  q7 B$ Y
      )
/ |1 M9 h1 A8 e( R* @) A! {    )
% Z) W3 i. r& f) ?) k+ o  )
0 w! ?/ t+ Z# E* C( R' `  ;;/ a' e# r7 ]1 o  R$ V+ Z" T, S! _
  ;; List selections end up here.  Update the list box, edit box, and color
2 y0 S% A! f6 _5 `  ;; tile.$ }, h6 Z* |% d' g) \, H# w
  ;;
6 l$ ?9 j* l3 f  (defun ltlist_act (index / dashdata)
* I" o+ `! h% ]" F/ L/ q    (set_tile "error" "")
& P! N. e$ d0 a/ ?9 i% v# T, h    (setq lt-idx (atoi index))1 |& ^- @/ _; [% a, O& y1 v
    (setq ltname (nth lt-idx ltnmlst))9 G& {, i& _6 w; E# w
    (setq dashdata (nth lt-idx mdashlist))" B) Z6 Y3 z9 ^
    (col_tile "show_image" 0 dashdata)
4 \" {  R, j( y* C% W" f    (set_tile "list_lt" (itoa lt-idx))
$ p* H/ C/ j( C1 j, ?. i* y8 f    (set_tile "edit_lt" ltname)2 t( j9 Q- f$ T. z3 g- g' C. y
  )! W/ y# i+ t3 @; {+ R
  ;;
0 S: Q# D! ~# Q. A4 H  ;; Reset to original linetype when cancel it selected
! j! f1 m, ?/ o  ;;' f: \3 Z9 l' x8 V% P
  (defun reset_lt ()
7 M5 Y" U- Q0 ?: a    (setq lt-idx old-idx)4 y. w+ z; P8 _. |+ ?4 q" m! Q* n1 A
    (done_dialog 0)+ e5 N7 |1 m" N) {9 ]" k5 T
  )
0 \; w! C- m: u* R/ Y! c6 P  ;;  G6 w! A0 L4 d2 e) Y) ^0 N( a
  ;; This function pops a dialogue box consisting of a list box,image tile, and9 s1 ]: q9 V# N4 \: x/ a
  ;; edit box to allow the user to select or type a layer name.  It returns the1 k3 r/ F* p4 Q/ h. \
  ;; layer name selected.  It also has a button to find the status (On, Off,) }# z# ^. G; g  C/ }$ m% c
  ;; Frozen, etc.) of any layer selected.
  E: `  ^: s4 L( I6 ^  ;;
& j% C5 C5 o# P  S  (defun getlayer (/ old-idx layname on off frozth linetype)
1 h* D' |2 l+ t    ;; Create layer list the first time the layer( F8 Y; Y3 l. M0 s0 y. u
    ;; dialogue is called.9 a; p+ a. t( }% F# e0 A7 c
    (if (not lay-idx)0 }3 i. F. i. }  \
      (progn
' P; ~; Y/ O4 M" Q: V        (make_lay_lists)
# l( N' F* n) g" z6 p" D" Z        (setq lay-idx (getindex elayer laynmlst))
6 h* m$ G& ?3 {; u5 _% ?# M6 Y/ @      )
/ o6 w% f6 L' E: h    )
9 `7 @0 t- v# [! L) t# x* w3 h9 p1 x5 F& d* h
    (if (= (get_tile "error") "")  _3 G0 }$ H0 e7 F' Q- H
     (progn# K" [1 ^, `* K  b1 V( h4 _
      (if (not (new_dialog "setlayer" dcl_id)) (exit))
+ d. n9 W& C, q# n      (set_tile "cur_layer" (getvar "clayer"))
/ c: g7 o4 B( d/ v! }- n      (start_list "list_lay")4 U4 {8 K" \* M. f) S8 |
      (mapcar 'add_list laynmlst)  ; initialize list box! _3 M8 l' I% k- V. G  F; ?
      (end_list)( T& C* S& x0 J) ]
      (setq old-idx lay-idx)
+ H6 q, w- }4 `5 b4 r- [4 n1 {' R) |      (laylist_act (itoa lay-idx))# u; r1 k$ m" j; F
      (action_tile "list_lay" "(laylist_act $value)")
) j0 }% f  G, A* ]5 L+ ?      (action_tile "edit_lay" "(layedit_act $value)"). e' e& l- o2 u$ D7 V# g+ J  e
      (action_tile "accept" "(test_ok)")0 N- r2 T  Y8 i9 Z
      (action_tile "cancel" "(reset_lay)"): U1 J8 ~3 ?+ X. u+ o
      (if (= (start_dialog) 1) ; User pressed OK
% M( {0 f. U0 B6 S( H        (progn
& n$ P+ b) s7 ~8 _+ ]$ z          (set_tile "t_layer" layname)
# t  D! S% u- P          (setq elayer layname)6 K& X: P" q2 C& e( Z; `$ u
          ;; If layer equals bylayer reset color tile4 d  f+ j4 r. z6 i& w9 S$ \
          (if (= ecolor 256)
+ q% T3 e% h; f- _3 b  A' M2 a1 A            (col_tile "show_image" (bylayer_col) nil); y2 Y1 {# o2 s/ F
          )
! I8 l; e7 l+ V  L# o+ @          layname
4 m( n: Q7 H# [        )
) f. P# |& P7 q, L        elayer, H+ R- J1 o, d# p/ C
      )& n. U% D& b6 e' P4 t/ T  z# o
     )/ S! V$ u. y! u+ y: B( D- d- \
     elayer# O$ X5 y2 S) R6 ?' u7 P
    )7 P0 L* H* V- F" H2 `) L
  )
0 \! h  N! o- O: H  ;;
: v& _. p" P9 n- m; u* p& r  ;; Edit box selections end up here.  Convert layer entry to upper case.  If* i; h4 ?, j1 x9 B" m" c2 I
  ;; layer name is valid, clear error string, call (laylist_act) function.' C8 \2 w4 C2 _0 ^- f
  ;; Else print error message.
) A( E3 c; W/ b+ s9 ]+ z  ;;1 p" b) {. X% o9 R
  (defun layedit_act (layvalue). `4 u- Z/ A4 y' v
    (setq layvalue (xstrcase layvalue))
% x' n. ?- x! Q, a* M    (if (setq lay-idx (getindex layvalue laynmlst))
+ D1 j: ~/ v; V      (progn2 x0 D8 {. j/ Z
        (set_tile "error" "")  f! H; r( L3 s  l
        (laylist_act (itoa lay-idx))
. X( q- J' E1 e7 ~2 r& r      )  m# a9 d6 M/ S* T3 P
      (progn
( _# y: x. W1 B( t4 J" @; p        (set_tile "error" "Invalid layer name.")
3 }0 s4 ^; y7 N% ^& h" f;;        (mode_tile "edit_lay" 2)
* O  E' J  F3 ?# X6 G;;        (mode_tile "edit_lay" 3)
; x0 b. r, Z+ G  s0 @* R$ Z        (setq lay-idx old-idx)
2 ~0 O, U1 j9 }& B5 C      )3 j: b2 P4 o, K$ d
    )
  Z, Z* L& d& y% G9 b  )! O$ ~$ f# V& Z* H1 _4 q* x2 ^
  ;;
# @% b+ z, h5 @9 k5 l1 P  ;; List entry selections end up here.
9 A0 L& O  h4 p/ }  ;;
6 x$ r' ~& K$ c3 p  (defun laylist_act (index / layinfo color dashdata)
0 Q- W% j0 a7 T. k- O    ;; Update the list box, edit box, and color tile.$ ?4 J. A& a" ^) Z
    (set_tile "error" "")" k0 R& f: e# O5 A1 X
    (setq lay-idx (atoi index))
4 ~( T3 e* N8 O0 _) S$ s* t' V    (setq layname (nth lay-idx laynmlst))
6 p' y1 p& m( m9 h$ M    (setq layinfo (tblsearch "layer" layname))
4 g. ^: i/ J4 N- k9 i% z/ e% _/ x  V" E    (setq color (cdr (assoc 62 layinfo)))
+ n) [* b- {2 `8 b; R    (setq color (abs color))
  h, }! e% \3 Z) {4 ?( {, q4 J9 E2 h    (setq colname (colorname color))' B9 }/ X7 _  d# D' b/ j, G
    (set_tile "list_lay" (itoa lay-idx))
$ d/ g4 B( R# G, W9 _4 R  H5 z    (set_tile "edit_lay" layname)" l. `& E2 K9 i0 Q/ J: J9 g; J* B, r
  )8 i! }+ j) l" f( J- i+ n
  ;;3 s1 c5 k5 \+ R; e
  ;; Reset to original layer when cancel is selected.
( m$ K: I/ \$ M4 B7 h! f  ;;
, E& B* D$ b1 L: P0 z  (defun reset_lay ()
6 f  S) D% x6 S# h; y7 s7 ^    (setq lay-idx old-idx)
, w8 M) J: U' o; z; Z1 o/ {    (done_dialog 0)$ v$ a; n. i3 p1 K, l; [4 l
  )
( B" F3 K5 y% z  ;;1 t/ v8 O7 A) P/ ~. ]0 P
  ;; Checks validity of thickness from edit box.7 _8 Z% y' L$ g6 j! z
  (defun getthickness (value)6 `% O. ]* q9 I7 E1 P# C  ]
    (setq ethickness (verify_d "eb_thickness" value ethickness)): o( s0 H( A) d( X! h- ?- T- t
  )/ i( D, U' R, s
  ;;, E6 z- Y3 O# x5 N
  ;; Copy of (getthickness) for ltscale.  If more, make this function
9 N$ H7 `0 v) _$ U" r# K  ;; generic.1 a# Q# i! ~5 Y* ~! d6 t
  (defun getltscale (value)1 C- {0 e' [$ v
    (setq eltscale (verify_d "eb_ltscale" value eltscale))0 Y' Z. R1 w5 p3 X$ p' w
  ). _, z1 W. _1 o7 n' `0 T. t; L" c
  ;;( U& _5 v/ T! n/ R: a
  ;; This function makes a list called laynmlst which consists of all the layer
' Z+ F8 o7 z) W* ~6 ?  ;; names in the drawing.  It also creates a list called longlist which
4 W' u4 {/ t3 Y: @6 O/ h  ;; consists of strings which contain the layer name, color, linetype, etc.
" s. g/ w6 J/ g& |+ P! q, x3 }  ;; Longlist is later mapped into the layer listbox.  Both are ordered the: N$ W. l1 i% r$ Y/ a
  ;; same.5 c8 [0 {# }' s" b/ t  k5 O
  ;;
# H0 L/ j& {# T+ G% t0 F8 c. J  (defun make_lay_lists (/ layname sortlist name templist layer_number)$ [$ a9 y3 k# L$ r' a( {, k+ \* d
    (setq sortlist nil)+ s+ T0 @, k8 N$ y. o2 L1 l
    (setq templist (tblnext "LAYER" T))
% t( l) r2 H" D# Y2 H! k4 w    (setq layer_number 1)) s8 x' p# y6 ~6 A- i1 i
    (while templist& z% F; w# h$ m6 G
      ;; No xref dependent layers, please., u0 X" M/ G6 F1 n. w+ b7 @
          (if (/= (logand 16 (cdr (assoc 70 templist))) 16)- E3 g1 d9 a$ p3 ]) y# J* Z
            (progn
; i9 Z! u9 O" C6 B( F              (setq name (cdr (assoc 2 templist)))
  k. \7 M9 F' D1 p- J, H# r  L4 A% b          (setq sortlist (cons name sortlist))) C" K8 ], j# K* d
        )
4 i1 |3 O3 `" c& k% e  r  R4 G# J          )
# }  B( \8 _! Y* B& X          ; Get the next layer.
6 G, r+ p7 v/ M' v3 f* F      (setq templist (tblnext "LAYER"))" o# f( @1 n0 M! ?
      ;; Not dead message...
: }3 a& t# \9 t( F( U5 L      (if (= (/ layer_number 50.0) (fix (/ layer_number 50.0)))( I& p: r. a6 _$ F0 j
        (set_tile "error" (strcat "Collecting..." (itoa layer_number)))
0 M6 l( a5 w" ~( ]3 D7 N7 C( g7 |      )$ Q' H* i9 M" _3 u" a3 C
      (setq layer_number (1+ layer_number))
+ S$ Y7 a, }: f8 ^( x: z    )- C# R- L3 H! e/ }4 z# h8 S. I
    (set_tile "error" "")
1 f7 q7 F. F+ `/ V$ j+ A    (if (>= (getvar "maxsort") (length sortlist))6 s8 M- e3 B8 t: x
      (progn! r; k7 j8 k6 x' {$ }5 g
        (if (> layer_number 50)! h4 _+ M5 b2 I% o# B' v
          (set_tile "error" "Sorting...")
: w, G0 N1 j3 M2 w9 e7 B9 b+ l        )
. s# T$ K! U9 b5 M7 V! b        (setq sortlist (acad_strlsort sortlist))
" n- J7 ?6 t: Q. t      )
. A% m7 e+ K- C: G+ z+ Y' _: F, Y      (setq sortlist (reverse sortlist))3 A1 v% A9 r6 ]& `, w  w7 K0 @
    )
+ g  ~: {" Z) c7 V5 l5 U    (set_tile "error" "")& [: q" s9 Y/ R0 A1 [9 y
    (setq laynmlst sortlist)
" W: B/ E; L! F; r% }' j& t  )+ o+ L- A1 t$ n/ t, k& E5 {
  ;;
: q6 W3 _* @' w- l- D  D$ S0 z  ;; This function makes 2 list - ltnmlst & mdashlist.. h6 a% F1 u1 p8 C" |& h- ?4 n
  ;; Ltnmlst is a list of linetype names read from the symbol table.  Mdashlist* Y- o. ?" w, d  a5 |
  ;; is list consisting of lists which define the linetype pattern - numbers8 h' S" z2 h& T" u1 ?  N
  ;; that indicate dots, dashes, and spaces taken from group code 49.  The list
" l! d0 U- \0 P' G' @6 W+ k5 t  ;; corresponds to the order of names in ltnmlst.8 r* O) t, u6 d+ j2 h) h
  ;;
% [' C' v+ b6 G0 T" j  (defun make_lt_lists (/ ltlist ltname)+ @/ @: d3 I1 h+ Y
    (setq mdashlist nil)
, ^/ Y; y7 y1 v        (setq sortlist nil)# m4 ^& P9 Q: |, j! J0 E) E
        (setq ltype_number 1)
% G: S' V, X- p9 r    (setq ltlist (tblnext "LTYPE" T))
* h+ m2 y" _) x7 B+ s2 a2 S: ^6 l2 W    ;;(setq ltname (cdr (assoc 2 ltlist)))/ s3 l2 J! W: f4 [" e7 j2 J
    ;;(setq ltnmlst (list ltname))" `' c0 R$ ^3 s( R" j
    (while ltlist
* U3 [9 h; p) O, H! J( A          ;; No xref dependent linetypes, please.
# A" u9 _2 _# R2 r9 @; \+ F  Q          (if (/= (logand 16 (cdr (assoc 70 ltlist))) 16)
, ^. }! Y/ K& H6 D# ]  v            (progn. E/ h1 B0 ^# ^3 H1 }  @2 D6 U4 d
          (setq ltname (cdr (assoc 2 ltlist)))
' s9 g8 K; T. Z0 w# Y8 Z          (setq sortlist (cons ltname sortlist)), A$ x' z1 q$ l8 I
            )7 W. v* r, j" i) p' v( b& ?
          )( K+ W6 c! _1 h5 |0 _! V
          ;; Get the next linetype.6 l7 E4 _" e3 ?. r
          (setq ltlist (tblnext "LTYPE"))
0 f/ K+ X9 s+ f( l
6 B) ~2 {9 p9 A! D0 U          ;; Not dead message...: {9 Q7 r0 b! U) I/ q
      (if (= (/ ltype_number 50.0) (fix (/ ltype_number 50.0)))
4 j& [# p5 s4 J        (set_tile "error" (strcat "Collecting..." (itoa ltype_number)))
+ a$ D9 L+ d* S7 @4 |2 _      )
, }& _4 U* w  d7 U' C      (setq ltype_number (1+ ltype_number))  ^! m2 w: b4 q, N) }
1 Z2 n5 Z: R2 s+ S8 P/ L# c2 L
    ), X- N- O% E# V
: C6 b4 z6 R# U( e& W1 M; o
        ;; Remove Collecting message.6 L6 E! r" r$ ]+ T) a
        (set_tile "error" "")5 t1 f9 @/ @2 @. I) y0 Q8 L; x! }
3 i, g+ i; h: \( H& S, q
    ;; Sort based on maxsort.8 `4 V, C. Y$ c4 ]; e( T
        (if (>= (getvar "maxsort") (length sortlist))
0 Q/ Y" l' A5 n- J, F! o      (progn
: F( @# n  Y1 ~6 H- O' E        (if (> ltype_number 50)
5 i; Q& a9 P7 c0 A, N3 l          (set_tile "error" "Sorting..."), A. }/ S9 B* Q- n, C. E  d
        )
2 b% Y7 l- t, x" [  a        (setq sortlist (acad_strlsort sortlist))
' e4 g0 u# D, W8 L0 i3 }      )- g  C5 ]3 v7 ^, E0 X
      (setq sortlist (reverse sortlist))# L8 S% d1 y* w' u
    )
3 j6 g# u" [! t% A. [6 c    (set_tile "error" "")
5 x! p8 U+ _  H% }+ ~* U    (setq ltnmlst sortlist)* M8 ?. z3 X4 _4 s6 E

* o! P3 T5 k1 D7 }+ X    (foreach ltname ltnmlst
# n1 p- M7 ~+ q% H. q4 T      (setq ltlist (tblsearch "LTYPE" ltname))/ d9 c. x  M+ Z, Y' G
      (if (= ltname "CONTINUOUS")* ^1 q, [  J3 v  x
        (setq mdashlist (append mdashlist (list "CONT")))
& ]# n$ I0 U5 Z; r! O        (setq mdashlist
; O2 h, z1 S9 b" `# G$ T% |% x            (append mdashlist (list (add_mdash ltlist)))
  v' |0 V' ^- m# d( o* }/ r        )
& h2 P: `% O5 s  k+ e! s; _& ^      )
4 m/ G4 Z+ g; p8 i- e8 @    )
5 i9 x# Q  M$ ^7 }! ?    (setq ltnmlst (cons "BYBLOCK" ltnmlst))
2 b5 H9 L- T- V  q! l    (setq mdashlist  (cons nil mdashlist))
$ O$ @+ i/ j+ Y7 C    (setq ltnmlst (cons "BYLAYER" ltnmlst))0 G) c: P/ B; d' c( Y) f9 A( N& H
    (setq mdashlist  (cons nil mdashlist))
0 t8 c/ K. z% v  )$ J# z+ K' T; |
  ;;2 t6 H' s9 b* w1 Q  J7 N
  ;; Get all the group code 49 values for a linetype and put them in a list
2 U& F+ U2 a0 i( y# ?+ J  ;; (pen-up, pen-down info).
0 t. T0 F% H0 ~! X- q* L  I" W# B  ;;* n: T* w# _9 U# b
  (defun add_mdash (ltlist1 / dashlist assoclist dashsize)
4 q+ [9 f, {4 h- o: [/ F    (setq dashlist nil)
4 H/ y) q" \7 ~$ o* w+ `    (while (setq assoclist (car ltlist1))4 y. o; ]" s+ l6 D" _7 G+ {
      (if (= (car assoclist) 49)& [* w4 R; y. y$ p4 L
        (progn
7 w& K6 d& v* b8 `6 \          (setq dashsize (cdr assoclist))' r9 b* q8 b+ P$ C  k
          (setq dashlist (cons dashsize dashlist)); e' h# P; J0 ?; w3 g( ^: d- |7 G
        )
* s  u3 t8 M( i9 }& N5 v      )# ~: S$ u! y% F
      (setq ltlist1 (cdr ltlist1))8 G& ~1 s* t9 q& s, e/ G7 l% e  k7 B
    )
, S- y3 ?9 D1 x7 x2 h* t    (setq dashlist (reverse dashlist))* I# ^: N1 j' E
  )
4 s4 Z' W0 \# D+ @( j/ t  ;;: W# i; `& v( Y* t! }' V7 u
  ;; Color a tile, draw linetype, and draw a border around it
5 r! O* y' ?- l* u$ z9 r- @. V. m! n  ;;/ v) Q5 U* ^5 a( {) c+ O
  (defun col_tile (tile color patlist / x y)
/ C7 \3 l4 s( G8 b    (setq x (dimx_tile tile))! h  u6 z7 a; N) R5 ^
    (setq y (dimy_tile tile))
. }  z5 y3 u8 j) g    (start_image tile)4 e$ S9 D2 _9 a) s$ Q
    (fill_image 0 0 x y color)2 `0 r- g2 G1 [1 e7 p8 ]! F
    (if (= color 7)- ^- g, u1 j* S5 A$ a
      (progn0 d$ W: ?5 t: h3 C# T
        (if patlist (drawpattern x (/ y 2) patlist 0))5 S5 g, N9 f3 O
        (tile_rect 0 0 x y 0)' {- d8 J* ]/ G
      )
( y0 w' V- G- X2 \1 W4 E      (progn
8 N  x4 {6 V. b# ?        (if patlist (drawpattern x (/ y 2) patlist 7))
: ?" b# v5 @! @. n        (tile_rect 0 0 x y 7)
, ?' }1 a6 Y4 n2 w& w- ]      ), Z( r! t5 x, j( I$ n
    )! h1 H( q  T$ L* l9 E5 F
    (end_image)
5 a, ^5 N+ K( y/ K  )) B' W  d  R$ R
  ;;4 T# {& k. K2 \# h! ?0 _* G
  ;; Draw a border around a tile2 X+ o5 L# }( w/ D4 z9 r
  ;;
9 S; V3 @$ @: Z! {  (defun tile_rect (x1 y1 x2 y2 color)
" w( ?9 m- X$ A2 q    (setq x2 (- x2 1)); g$ Q7 x: A9 v' T4 ~! ~& q
    (setq y2 (- y2 1))- ~! j7 r3 W7 q  A8 q
    (vector_image x1 y1 x2 y1 color)
0 f4 g7 [) p6 K+ k3 @7 u: g    (vector_image x2 y1 x2 y2 color)
6 G# V+ h; g. M$ H& u5 Y+ [    (vector_image x2 y2 x1 y2 color)- ^4 x% n4 r4 i: N% X
    (vector_image x1 y2 x1 y1 color)9 R1 N. J+ l! P: v
  )0 [8 A: y) g. X( E/ F0 d! U
  ;;& T- ?7 n. u- r  J7 {" e0 r8 j- p
  ;; Draw the linetype pattern in a tile.  Boxlength is the length of the image  C. N7 s3 B1 b3 U
  ;; tile, y2 is the midpoint of the height of the image tile, pattern is a
/ ?7 a4 J6 O8 E" G( V( m' C  ;; list of numbers that define the linetype, and color is the color of the
( C8 e5 @+ H$ K  z+ y, S& P# _* ]& y  ;; tile.
! E; ^; t# D* k& {9 T. j  ;;
& C6 Z7 @* a. G' }. `  (defun drawpattern (boxlength y2 pattern color / x1 x23 U, H& n7 \6 z+ B0 b
                      patlist dash)
$ T) e8 h7 G$ L" B, X9 _    (setq x1 0 x2 0)
& }4 J1 a- G5 K. N& k$ X    (setq patlist pattern)
. s" h5 g4 I9 h1 g! m    (setq fx 30)# E; A9 W( a# a& m+ v, o
    (if (= patlist "CONT")( C7 Y1 k6 z/ o% W+ F# M; t
      (progn (setq dash boxlength)
4 |. ?8 _, N1 u* l8 x3 I% J$ e        (vi)
, p7 t- c" O! ]4 @7 G1 ?        (setq x1 boxlength)" \9 y/ S3 U) R: B
      )
0 ?2 r/ R% a3 f: a- ?9 Y% H      (foreach dash patlist% z: `5 i$ B& T: z6 ~& I
        (if (> (abs dash) 2.5)3 t% ?/ t, @+ Q, ~7 \
          (setq fx 2)1 R- w1 }; t& ]$ u9 X
        )2 s/ Z- z3 S8 n: ]1 s3 g; q5 [1 `
      )
  d: p( |8 R! w% ]3 l, D    )/ q  H5 R) L" b; D
    (while (< x1 boxlength)
  U4 f# W; ?6 J; H4 H      (if (setq dash (car patlist))
7 }* S& B/ n- J3 w6 `: J        (progn1 M) H) l" w+ V0 c  V: g
          (setq dash (fix (* fx dash)))
/ i# D# @8 ?% }          (cond
  y5 @5 n# U! T$ z# t% M            ((= dash 0) (setq dash 1) (vi)), Y0 v" ~1 g8 H$ D( Z- i/ n
            ((> dash 0) (vi))% S/ K( Y5 e; ]6 v( ]( |' y- p
            (T- m0 p0 o/ `! t
              (if (< (abs dash) 2)
3 T1 C) w3 T2 O$ P1 `  X               (setq dash 2)
) r1 ~# W- X5 @8 @) C+ H              )4 Q0 T7 i( \& I- J3 l& c
              (setq x2 (+ x2 (abs dash)))
$ b; q& t. A1 b2 ]0 E            )( m; R/ W7 _- Q' B
          )' |  U5 ~- I* |2 v/ G+ W
          (setq patlist (cdr patlist))2 P4 `+ w) i2 y2 n) k" t8 h
          (setq x1 x2)$ ~& {! S+ N! s% T
        )
  {' n( n3 H4 S6 `: w. c        (setq patlist pattern)
+ c! o2 X7 x" Y      )
' O; i5 J3 b: O  W$ q6 F( H0 O    )
  O- ~$ e7 @3 H' c+ p  )4 B% Z8 l& x" z9 R
  ;;5 v# D' u3 {2 \( p
  ;; Determain state of xclip
  M- ^( ^! _! C: G) W  ;; Returns the group 71 value of the spacial filter dictionary.: Z/ ^5 C( Z( {% Q9 Q* R
  ;; If the entity doesn't have a spacial filter dictionary, this
, \9 v5 i7 S% t2 g# A  ;; returns 0. If it does it will return 0 or 1 depending on the: v' t  G  A: [  ~& U
  ;; current setting of the state of the clipping visibility.# a( S3 L: [' k! `3 N3 A
  ;;+ I  W; F1 B! f
  (defun xclipon(elist)
' S6 a7 n* b& }6 t' J  F, n; f    (setq hasclip T)6 E0 X5 [" K9 Y
    (if (/= (assoc 360 elist) nil)
- z) d( A9 r+ j! @9 _* L3 d      (progn% e9 s3 n8 i# k$ Q& R# Y3 ]1 t
        (setq tmp (entget(cdr(assoc 360 elist))))
- @& z4 A7 s! i' E! k$ z' q6 w        (if (/= nil (assoc 360 tmp))
: _) e5 [$ v5 F# C$ r# Z          (progn
* x- b& s0 O( X6 s8 z            (setq tmp (entget(cdr(assoc 360 tmp))))+ Q- L% h) u% x$ M
            (if (/= nil (assoc 360 tmp))
6 u4 C3 X/ S9 I5 Y- t              (progn
; Q: S" z7 ]- \- X) E                (setq tmp (entget(cdr(assoc 360 tmp))))
* d8 B9 K" V+ H0 A                (if (/= nil (assoc 71 tmp))% r9 u1 o1 f1 |' t/ [0 X4 R/ D
                  (cdr(assoc 71 tmp))6 ?6 Z* w# @- @2 r
                                  (progn
+ F/ n# {; F2 W1 d  W6 {                                        (setq hasclip nil)
4 V- x4 K! U9 R0 P9 Y+ m                                        (eval 0)( j2 ~2 G0 K2 e1 q, _
                                  )
7 Y. O* c) \$ t. D( q* Q5 ?8 o- M                )
3 n+ Z1 u# a2 l              )
+ @: j$ s) [7 [) a, ]0 I                          (progn & B% y. k! l* p
                                (setq hasclip nil): {9 d, y1 b+ K$ |( T# o$ d
                                (eval 0)
1 m# s7 G# b" A! O7 H                          )& E9 ], I& A- d7 c8 V; ~3 M
            )
  i" Y) l  }* |6 l4 Q/ O          )
7 y8 g$ n. j; L9 P2 m                  (progn
- ]% p4 y! D' r9 d8 Y! ?                        (setq hasclip nil)' x# Y, q% s0 j+ |; g
                        (eval 0)
; X, K" s/ C) z2 B8 M' z# j: \                  ): W; ?, n/ t1 K5 \% z( z& t' o
        )
+ D+ E5 R. r, M  _      )9 c) T- F! [. L* s# V7 A& k3 }, g4 }
          (progn
* x+ N* p  h" D9 i" j* f                (setq hasclip nil)
2 \/ Y' {: G) F9 i6 M; E% T, z; m                (eval 0)) r! ^. m# z+ D4 _+ Y
          )
, ^3 K$ B! J+ n, U    )
# `* F, G1 \) E- z) `" O( |  )
5 X8 D# N, ~& [9 N& h4 b+ P  ;;
. v0 c* Y/ j5 Q, f  ;; Draw a dash or dot in image tile
, {& R8 i  ?- i5 }. K! V# l  O  ;;
& }; m( N) E8 w- X1 K# j  (defun vi ()
: q! M/ S. g  A2 G* A    (setq x2 (+ x2 dash))/ A' R& y: W* z+ [  @
    (vector_image x1 y2 x2 y2 color)% X( \$ K" Q& M
  )
8 Q1 |/ i' F* q3 N4 m7 j5 U2 }. r  ;;9 O/ Y2 `$ s- \
  ;; If an item is a member of the list, then return its index number, else- h4 Q5 m# k! ^, i
  ;; return nil.
& ?$ W- p) z, Q9 G& C6 |4 b  ;;
( F% r6 J8 _8 A5 ]1 P/ D* r  (defun getindex (item itemlist / m n)
' v# l  G% J# m& J# Z    (setq n (length itemlist))7 B0 ]: M2 I$ n3 u3 Y) A. f: \
    (if (> (setq m (length (member item itemlist))) 0); ?4 O4 t1 k+ g& p/ o5 M
      (- n m)
8 ~) V9 s2 O9 ~8 o      nil2 p& y; ?& c! j, g
    )4 o: d9 P- d! y  a9 d  M! u
  ); Y. W0 z( W/ Y
  ;;
8 R6 }+ X8 u- R$ n! L2 M  ;; This function is called if the linetype is set "BYLAYER". It finds the
( G8 {( {" r/ v: U5 ]' k# E  ;; ltype of the layer so it can be displayed  beside the linetype button.+ Y: F) j. s0 d7 g4 \9 h
  ;;
3 z& A/ n8 r% k1 b; n  (defun bylayer_lt (/ layname layinfo ltype)9 P9 z5 `# W; Y, L' F" S3 V/ O
    (if lay-idx! E" i- e, ~/ j3 L' N
      (progn
. w5 C: R& L6 u! ~5 j1 y' E        (setq layname (nth lay-idx laynmlst))
7 W3 H/ n; n3 t9 z! u- i, `        (setq layinfo (tblsearch "layer" layname)). T! O& S' F( c8 m" v5 e
        (setq ltype (cdr (assoc 6 layinfo)))
6 m$ ]4 v1 {& r, d- `4 ?# l2 V        "BYLAYER"% k/ N. R" b7 i, ]: o/ h
      )7 d2 B# z0 {7 ^. a9 x
      "BYLAYER"$ m/ c5 P4 @0 {5 v
    ); |5 W/ }) U% U
  ); h+ y( a( T/ [) i2 h3 H- b
  ;;
) x& d, Y, E( [, C& g% u2 T* y  ;; This function is called if the color is set "BYLAYER".  It finds the color# z  E2 }! c% U
  ;; of the layer so it can be displayed beside the color button.6 T# D3 o5 D' @" C) A% E
  ;;
* w3 b* l0 ~# C  P1 P, w  (defun bylayer_col (/ layname layinfo color)$ N$ M) V* u* g& M3 b: Z
    (setq layinfo (tblsearch "layer" elayer))
) Y' P+ y! `& l7 t    (setq color (abs (cdr (assoc 62 layinfo))))8 l# {; N. A! q7 T- J. l
  )- G$ K2 e. }/ d! }& }* \! j
  ;;
8 {3 x3 e( F/ O+ B/ d( k8 z# _" Z  ;; Used to set the color name in layer subdialogue.% p4 `6 J" y+ _
  ;;
# M$ r, E( [+ h8 W' W: G  (defun colorname (colnum / cn)# ~& Y, [/ F2 ~0 J
    (setq cn (abs colnum))
+ u0 A# A9 u; R# J5 z6 B/ h8 `2 Z    (cond ((= cn 1) "red")
8 |1 |9 g( b3 a          ((= cn 2) "yellow")- q5 X# [9 m; U* a3 Y% U5 a4 ^, y+ @
          ((= cn 3) "green")+ D7 g/ S  @9 ], N: H5 {% n
          ((= cn 4) "cyan")
& s" h) P2 C6 q( z" U          ((= cn 5) "blue")
+ L& y) {$ x3 @3 s% e! D  c          ((= cn 6) "magenta")
. F7 P9 z/ h) D          ((= cn 7) "white")
3 l! P% ?$ a6 ^          (T (itoa cn))
3 k- g5 S; ^4 c    )% ^$ I8 D+ n0 w. h+ ~: C7 |: j2 m
  )$ x$ b3 l/ }6 W& X# ?0 _$ D8 v
  ;;
7 n& D1 u' b" v  ;; If their is no error message, then close the dialogue." M! U9 h8 }9 _2 r. ?% p$ b  s/ U& ?
  ;;& @7 }. q2 I' V5 I4 R0 K
  (defun dismiss_dialog (action)
: V" s" @# I- t0 ?8 S+ n3 P    (if (= action 0)9 ]% I0 L+ M% G7 h. X( w0 x+ y
      (done_dialog 0)
) R: G$ D2 d+ v, K9 t! g) s5 d      (if (= (get_tile "error") "")
. p# s+ u  R! ], U        (done_dialog action)* p: v5 U$ I: i! k$ ~
      )
+ G; }( T$ g  {* w: I& z) Y    )2 ]( q4 U' e$ G- F* B% C+ v
  )1 N$ d+ ?! W$ E, b! U, m
' ^! J# B4 M/ A) S# M" v4 @
  (defun test_ok ()! x$ R6 Q/ f5 b& n
    (if (= (get_tile "error") "")
" k$ K' y) y$ L9 q      (done_dialog 1)! b) |2 N& _. b: p7 |+ P
    )
# O7 L+ |3 i5 v0 ]: u+ {0 y+ L  )
4 |. e: r" A2 R; w- ^, q) L
/ V8 A. i, E4 |( `# U  (defun cancel ()
( W) H# K+ u( M- J$ P9 i. Q    (done_dialog 0)3 U! o. q. x* ]3 b
  )- l: A7 k( i- ^8 B7 @/ K; [$ _* u

5 P6 s, p9 H4 S- D7 J( J  J;;; =======================================================================$ b3 X3 B! `; D5 K* I" L' `
;;; SETUP layer and linetype lists for application, and initialize all7 c5 ]6 X2 D$ C
;;; program variables.! w# n7 f- v& Z; p0 F
) E; w' U' I& N6 i( m( I  p
  (setq elist       (entget ename)
1 J( o$ t% M5 ]) V        old-elist   elist' S. M+ {+ r4 E6 z7 K/ O* Z# ^8 T
        modlist     elist, Y5 {- Y6 a4 a. L+ q
        etype       (strcase (cdr (assoc 0 elist))); m, A0 |4 s4 P: {
        ecolor      (cdr (assoc 62 elist)), H1 i: K+ T" T2 \" y8 V
        elayer      (cdr (assoc 8 elist))
0 q5 ^( S  [8 t& n: I# x  p; k, C        eltscale    (cdr (assoc 48 elist))+ i: c  q/ I! P: ]7 o4 L/ X
        ethickness  (cdr (assoc 39 elist))+ b/ J, a( |# Q
        eltype      (cdr (assoc 6 elist))$ ]- j* |; |6 z1 ^
  ). I+ `6 W- I1 I% B  I% L7 S
  (if (= (assoc 210 elist) nil)
8 w3 C- R+ I: e% C1 H1 ]5 j# X    (setq extru (list 0.0 0.0 1.0))
- h4 Y& o7 m: z$ G    (setq extru (cdr (assoc 210 elist)))9 |* }- y; N! E* T" k6 f4 n  C' d
  )
6 L) m4 S- p! q# l1 u
4 E; m  @3 \; H0 D8 F6 |  (if (not ecolor) (setq ecolor 256))7 f- ]6 E5 ]6 [* M' D. A
  (if (not eltype) (setq eltype "BYLAYER"))
4 k5 [& E  B* P  j& _/ I  (if (not ethickness) (setq ethickness 0))! S% y8 \& n  ~) c
  (if (not eltscale) (setq eltscale 1))2 \) d2 w6 c/ `  D9 F% T' A
) ; end ddmodify_init5 d/ h6 l9 p; V+ |  j4 W' z* t/ \: v
* m5 h7 V3 V. \8 B: e/ p
;;; --------------------------------------------------------------------------
/ l; v9 @8 K  T+ x' W3 y# w4 w" `;;; Function: DDMODIFY_SELECT& G, z7 F; t0 M7 _
;;;7 `* s1 }. k- U8 x
;;; Object aquisition function.
; `; _2 h; D- l8 W. X;;;
* I* \1 [7 I( G7 m;;; (ddmodify_select)
0 u+ Q+ n: W  ?' l2 x;;;# [6 N7 n9 K& c" G
;;; Obtains object to be modified, in one of three ways:* s3 k2 Y: x6 O3 J, b/ b8 d* A
;;;
9 ~* c4 y( I6 K4 h5 t! Y' d;;;   1 - Autoselected.' E0 _3 o0 X: x
;;;   2 - Prompted for.
' `& a. M* `9 Y$ m% Y4 k;;;   3 - Passed as an argument in a call to (ddmodify <ename> )  h4 W8 e5 M) q" Y* V! I' S, g
;;;$ {+ [& Z3 P% M1 B% x- a2 P: J
;;; The (ddmodify_select) function also sets the value of the% S# A# X2 x  i8 V9 K( l+ B
;;; global symbol AI_SELTYPE to one of the above three values to9 c: \8 t, C) }  A. T8 f# ?! D
;;; indicate the method thru which the object was aquired.( t" i; q! @; P/ D
;;;# ^! W. K. R; G) z" y
;;; This value can be useful to applications that want to RESTORE
( ?: u& V% \3 q8 {;;; an object that was autoselected to its previous selected state% m  G0 a1 R8 I/ V
;;; when they terminate, although there doesn't appear to be any
" r+ e+ ]# S/ P# g; O; O; N;;; way to do this right now.: e) M, q/ D' h" F8 ?

3 \5 J1 M$ _* s1 I- A7 ~(defun ddmodify_select ()
: w( U, u7 u7 M4 |   (cond
( [; G( g3 z$ b0 n0 N7 e5 {      (  ename                             ; (ddmodify) was called
+ x: U; G$ F# \         (cond                             ; with an <ename> argument
) }1 s& D& w/ b( O) N" E& {& f            (  (entget ename)              ;   If object is non-deleted, s" q) x1 o. h- G
               (setq ai_seltype 3)         ;   then return its ename.
. D& }$ ^  L3 M# f3 q               (ai_return ename))))2 g9 y$ o; R& A( z! c& J. H

* \3 U0 ?) A0 T, ?; N# K% j5 f      ;; return auto-selected , see ai_utils.lsp+ G& G1 m. z5 a: y
      (  (ai_autossget1 "\nSelect one object to modify: "))
( k, y( Y9 j. J/ ?; m# b& g7 w* t
& J! ?) q7 T, c2 K& p      (t (princ "\nNothing selected.")0 a0 E  o9 A5 B& s/ M
         (ai_return nil))0 v. g# @9 E/ l: k- E
   )1 K# t# v! {, Y4 X+ \4 O
)) W1 g3 Z  Q+ Z
* T0 `4 f) Z4 X* V1 i8 e
;;; ============= Command line interface function =======================
8 }1 D0 H$ T' U% ~
' v6 h3 F5 Q8 A(defun C:MMO (), y3 p4 J4 G- i9 K3 E* R. v# B; I
   (ddmodify nil)
- j2 v3 m# E4 C   (princ); O# s$ J6 x$ @1 f
)0 [. z, v% u5 j1 d+ {% ]- [
8 v& S* k6 N" z8 {
;;; ================== (ddmodify) - Main program ========================
0 v( a4 R' O. i8 x;;;' B" z4 k. C3 Q
;;; (ddmodify <ename> )
8 \1 J- s( q9 G6 N/ R" W0 ~( @: H;;;% Z1 F* |' o2 O& u1 c( e- C
;;; Main program function, callable as a subroutine.% c; a+ [( u7 R: |
;;;
* p: _$ _; k( F;;; <ename> = object name of the object to modify.
$ E6 y/ V7 W' O1 Y+ T$ i* X;;;
( z+ G/ h' a9 c2 O& Y3 h;;; If <ename> is nil, then user is prompted to select( H9 f6 J6 D8 s. M
;;; the object interactively.
& U) z% O5 k0 {/ z% V+ p;;;
5 c3 l+ W" q+ W9 c+ };;; Before (ddmodify) can be called as a subroutine, it must: I' \$ {( f5 G# a) A7 m
;;; be loaded first.  It is up to the calling application to' ~/ O& h4 h6 A5 b! p
;;; first determine this, and load it if necessary.  _, _! E1 t% m2 i, |9 \
8 u1 I. S' q6 d. |( `' _$ H
1 o; ~- c/ v8 ~
(defun ddmodify (ename /, n9 D% g2 W6 p/ H( f# R5 @& l+ `
2ndpt              ell_calc_area            move_pt1               templist
& m) ?- Z8 y8 e# \6 v% cadd_mdash          ell_tile                 n                      tempmod! n, d4 e) v% d, x
alipt              eltscale                 name                   tempst_ang5 G: ?% A4 P% T+ J( y- ~
ang                eltype                   newpoint               test_ok
; x/ x# `( w) varc_calc           emod                     next                   text, K4 M$ f2 @: R) Y+ T6 h
arclen             end_ang                  next_vertex            th-value0 R1 a" g/ W2 I. F& Q
assoclist          endpt                    obl                    tile
/ B3 v( l% q2 t( R; R5 Batprompt           errchk                   off                    tile_rect, y. t9 M5 Y# V9 m* O5 R
attag              ethickness               old_majrad             tilemode" S: A9 Y3 W6 _9 J  d* ?2 d
attprompt          etype                    old-closed             totang- T% Y: b! |0 l+ y" f
bit                extru                    old-closedm            tstyle
. Z4 F# ~  E' m" U7 Lbit1               fchk                     old-closedn            u" M: M9 r/ c( V8 |' t1 K% g; M: c
bit-10             first-10-rec             old-elist              undo_init
$ z: _  J: Q9 z( ]bit-11             first-10-time            olderr                 upsd8 J5 N1 ]. b! I2 k. z1 S$ H: o
bit2               first-11-rec             old-fit                v8 A- G/ E* B: H, \* p' E
bit3               first-11-time            old-idx                va
: R' u& \, u; T$ t9 Nbit4               fit                      oldlist                value
0 l% M* N' A( z3 e- _9 N5 ^+ d" `: tbit70              frozth                   old-spltype            ver_4
. W' ~! `+ n$ L8 L+ L0 tbit-70             f-vis                    old-u                  ver_ang1
6 j1 d8 V2 a0 Nbit75              fx                       old-v                  ver_ang2
5 Z. V. @& ]0 d6 ^bk-up              get_color                on                     ver_col7 b$ d$ l  i6 M: Z+ E
bkwd               getcolor                 onoff                  ver_colsp
4 h. e* I, {% Wboxlength          getindex                 on-off                 ver_eangle# d* e  h! Z( {8 q3 }$ [  i* F# a
bylayer_col        getlayer                 patlist                ver_hght
( J$ u  E7 K% j+ |0 M5 M& v2 `! Zbylayer_lt         getltype                 pattern                ver_majrad
- t8 S6 n. d$ T4 q. X, scalc               getthickness             pltype                 ver_obl
) v6 W& K" o* {& g3 L- v8 ?/ ^cancel             globals                  polytype               ver_pt1
& T) U1 }$ p4 r! [9 z, icir_calc           ha                       pre                    ver_pt2
0 @" J' Q/ C8 u1 w6 }: O4 hclosed             ha-prev                  proplist               ver_pt3. C2 Y) o' }# X; G" [% m& ]
closedm            help_entry               pt                     ver_pt41 P. Q) X- w  K7 N
closedn            hght                     pt1                    ver_rad
# s$ u, f6 E" v* f. ^cmd                icvp                     pt1_eq_pt2             ver_rot
+ l) q: G$ X5 x/ ]cn                 image_add_vector         pt2                    ver_row
" V# R) e9 h) ^) l0 F3 i3 Fcname              image_clean_variables    pt3                    ver_rowsp5 p7 }' `! m- U/ C
cntl-pt-indicator  image_cross_product      pt4                    ver_tag
8 ?5 i8 v. N( M: Y4 G+ X) I+ `4 [code_71            image_disp_opt           ptype                  ver_u
' R$ V1 u# D8 N. ~" g2 Ycol_tile           image_dot_product        radius                 ver_v
9 P% l0 m/ ?5 h# d, v* Kcol-idx            image_normalize_vector   rational_spl_flag      ver_wid: X7 c9 Q3 \  h
colname            image_rotate_vector      reset                  ver_x1# f3 v0 K& T* k
colnmlst           image_scale              reset_flag             ver_x2
9 h5 M, B; ~2 ^% e  Z5 @2 mcolnolst           image_scale_vector       reset_lay              ver_x3% B2 p. l& J7 w) U3 b
colnum             image_update             reset_lt               ver_x4: b' t+ T: D* i" \; C
color              index                    reset_uv               ver_xline_pt1
1 q4 J  Y# ~% s) g7 [# i% qcolorname          inv                      rot                    ver_xline_pt2
* x0 O3 }; h4 scolorno            item                     rows                   ver_xline_x1; B, o' C9 h6 @. q' S/ h
col-sp             item1                    row-sp                 ver_xline_x26 b1 w8 v! j, _. \5 |
columns            item2                    rrat                   ver_xline_y1
5 z& T& u0 y# p8 Z: J# G0 econ                itemlist                 s                      ver_xline_y2
, E. {" B' I! n8 A% o' hcoord              jlist                    set_action_tiles       ver_xline_z17 s. z8 o2 o+ m! e
ctr                jlist_act                set_just_idx           ver_xline_z2
$ z- T7 V+ h  O% [2 x# b4 e$ J2 m+ @cur-10-rec         just-idx                 set_tile_bk-up         ver_xscl" X( o2 _& K0 J
cur-11-rec         layedit_act              set_tile_cntl_pt       ver_y1/ P, ~4 p( c7 Z0 @" z7 V* w# C7 ~
cvpname            lay-idx                  set_tile_data_pt       ver_y2
* i% X' F3 D& x- U" W# tdash               layinfo                  set_tile_dirv          ver_y3
8 d& N' Q0 @8 b% C' k  v) A4 Idashdata           laylist                  set_tile_edges         ver_y4
, J  s& U# J7 m0 @! |7 |dashlist           laylist_act              set_tile_endang        ver_yscl3 K# t. n3 H$ q: ^6 s+ K
dashsize           layname                  set_tile_hght          ver_z1
+ q9 j9 i% d5 O" b! k- zdata-pt-indicator  laynmlst                 set_tile_icvp          ver_z2
0 |& u% i) p& ^2 _dcl_id             layvalue                 set_tile_just          ver_z3! I1 F7 K) y+ g8 p
dd3dface           line_calc                set_tile_obl           ver_zscl
# k; e4 R+ w3 B4 }5 y) y; rdd3dsolid          linetype                 set_tile_prompt        verify_a. W1 X3 \9 X! F0 Z; w6 R
ddarc              list1                    set_tile_props         verify_d! G  ~, H0 h. R, W
ddblock            longlist                 set_tile_pt1           verify_i
5 h9 A6 z; r  _4 n' D$ J# o( Xddbody             ltabstr                  set_tile_pt2           verify_xline
  U3 D+ z7 p3 K0 W7 z. R' uddcircle           ltedit_act               set_tile_pt3           vfy( Z- x6 l, {$ A0 a% b( ~
ddellipse          ltidx                    set_tile_pt4           vi
& [6 D6 a1 n: U( p: n5 Z, A# p  Vddgetprompt        lt-idx                   set_tile_rad           vlist2 C; v0 g5 Z" n+ E
ddgettext          ltlist                   set_tile_rc            vname
( V; X$ @' D' O9 Lddimage            ltlist_act               set_tile_rot           vpf
+ d1 R% t. E' B7 K+ P: U8 T1 E# oddimen             ltlist1                  set_tile_scale         vpid
6 k0 ?( {' q; k6 [. v/ n- {! e! jddleader           ltname                   set_tile_spline_props  vpldata
" ]% d5 K" z) w# q: v# Wddline             ltnmlst                  set_tile_stang         vpn+ c- ^9 \) t8 G3 Z, \; L
ddlist             ltvalue                  set_tile_style         vpt( D4 L2 b1 d/ V  `$ T
ddmline            ltype                    set_tile_tag           which_tiles
& g; f) w/ P; |5 b4 Z0 S+ N7 yddmodify_err       m                        set_tile_text          wid6 d7 ?' t5 X. y$ F8 Q' \: W
ddmtext            majrad                   set_tile_vpt           x
! G$ }0 H8 w+ d& H# wddpline            make_lay_lists           set_tile_wid           x1
! m) ]5 J* Y. e4 B. x& t% r9 \5 dddpoint            make_lt_lists            set_tile_xline_pt1     x21 w/ ]# |% x+ R
ddray              mdashlist                set_tile_xline_pt2     x3
; ]4 ?8 p0 a6 {5 Rddregion           minrad                   setcolor               x48 s- V2 k2 x* f) L; m  z% l# c
ddshape            modify_3dface            shght                  xdlist
4 b' H2 H7 I; G. B, c4 xddsolid            modify_3dsolid           showpt                 xline_pt1
/ b, R& A5 v, iddspline           modify_arc               size                   xline_pt2
. l4 [9 T  u$ vddtext             modify_block             slist                  xline_x1' v, @4 O. ~* C) c# Q
ddvport            modify_body              sname                  xline_x2
2 I  l  P1 h1 C- \2 Z% ?ddxline            modify_circle            sortlist               xline_y10 Z$ {, N9 R6 ^& v
denom              modify_ellipse           spltype                xline_y2
: |  r. s* h0 ]; I! Z, }5 _dialog-state       modify_image             ss                     xline_z1
! k; d; [" b$ k) _" W& Vdir_pt             modify_line              st_ang                 xline_z27 r7 R5 Y4 b+ h; s. G1 X4 U% u! j' T
dir_ptx            modify_mline             stpt                   xscale% _4 ?" C6 l! O/ z5 ?8 ]
dir_pty            modify_mtext             style_act              xx
4 b$ i- e. g- o% b& |  [; Ldir_ptz            modify_point             style-idx              y6 O& e9 l4 K5 N
dismiss_dialog     modify_polyline          style-list             y1
( Q" v! ~& W' o' R- J7 ydrawpattern        modify_prop_geom         tagval                 y2
7 e' @6 g5 Y" t8 }0 W/ techo               modify_properties        temp                   y3
# p$ S9 ]2 i8 q7 S) I# Y" h) z4 qecolor             modify_ray               temp_color             y4: U0 P) k4 |" b; H: _, B: B5 S; l
edge1              modify_region            temp_dir_x             yscale7 w! b7 w$ T0 ?3 u7 w1 a6 E' z) s
edge2              modify_shape             temp_dir_y             yy& V* k% N% r9 g5 |5 a; E# |
edge3              modify_solid             temp_dir_z             z1
: w2 E9 a. L$ E9 ?7 r) Nedge4              modify_spline            temp_xline_pt1         z2
( A) U* y' d; F7 p  Gedgetest           modify_text              temp_xline_x1          z30 v$ P/ P7 M& U. r
elayer             modify_vport             temp_xline_y1          z4
6 K  l/ ^) S( o6 a4 @5 P+ ]1 Selist              modify_xline             temp_xline_z1          zscale7 P% ?# X6 f5 B
ell_calc           modlist                  tempend_eang           zz0 V+ k. e% [3 `" T, a" e
dir-idx            safe_ddedit              ver_MtextWidth         xcliponoff
9 o% n" C4 S3 m) r4 B5 w, m$ t& jMText_style. W8 w' V. y4 M
  )
% `3 G( T9 G  w; M7 a
: c0 A. R9 t3 A8 l' B  (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho
( e  m7 b2 v+ J% [        old_error  *error*            ; save current error function
  H& Y' O0 F1 z2 f# j6 S        *error* ai_error              ; new error function
% j( C9 f- d9 W0 X* J) a  )
4 l' E2 o* R  M8 q9 T/ P* S  ?' y( k! b! t- e
  (setq old_pickstyle (getvar "PICKSTYLE"))          ; save old pickstyle* l' U& w5 g6 @0 Z& }1 k" ^. Z: n* I8 a6 Q
  (setq new_pickstyle (logand old_pickstyle (~ 1)))  ; turn off group selection
2 _+ s! M; J/ _9 a+ Q  (setvar "pickstyle" new_pickstyle)                 ; bit and set to new value
8 p8 S8 J/ y8 T6 Z3 h4 b3 k4 x0 c1 w
& M9 T  u3 }. q0 b7 X  (setvar "cmdecho" (cond (  (or (not *debug*) (zerop *debug*)) 0)
8 O! u8 a; Q; A; G% c                          (t 1)))
# g/ K/ O$ U8 p( E3 s  (cond% v$ ~7 {# t! B& D" N6 n
     (  (not (ai_notrans)))                      ; Not transparent?) E+ V7 l% w- n
     (  (not (ai_acadapp)))                      ; ACADAPP.EXP xloaded?) u; X2 I0 S/ K! m. I. i4 U! c4 Q
     (  (not (setq dcl_id (ai_dcl "ddmodify")))) ; is .DLG file loaded?0 L  s) t+ I9 p: ]6 D
     (  (not (setq ename (ddmodify_select))))    ; object to modify?1 ~* _: X9 r2 z$ j4 y5 J" Q- ^
: C. w: D# l4 j; J5 j4 A
     (t (ai_undo_push)' r! L, d0 F$ M5 D) D, f  h
        (ddmodify_init)                          ; everything okay, proceed.4 P+ r# U. h, u* k
        (cond
3 y! U; `  _3 m7 D" ]           ((= etype "LEADER")
: a8 z0 j9 G, o5 ?2 R             (setq help_entry  "modify_Leader_dialog")
2 W5 ^# x  @+ g4 u! a! {* }* ~             (ddleader)8 p& u' }, G: j+ }! J3 a+ ~# F
           ). Z% q9 K2 @/ x% Q6 h2 b  b" m
           ((= etype "ARC")+ E' a9 C$ J) \, z1 |! H1 t* N
             (setq help_entry  "modify_Arc_dialog")5 N( e1 z0 L* N/ `! t& ^& r' Y
             (ddarc)  {. S5 L" I. c& Q
           )
1 k" p# \0 u" l  c* D           ((= etype "ATTDEF")
, t, |( a# d" g6 D5 _0 E             (setq help_entry  "modify_Attribute_Definition_dialog")
3 l' G3 Y- K  Q8 R  U             (ddtext)
! ]& i5 P+ _3 ]& a/ u8 S& N           ): C' U- @4 I2 e/ F! X- {
           ((= etype "CIRCLE")! {1 S0 V' F" Q5 V
             (setq help_entry  "modify_Circle_dialog")4 _; i! c$ R; J
             (ddcircle)( A! ^- T0 n; h# I  k7 Z. O
           )0 N. t. E. w. j% u
           ((= etype "ELLIPSE")
- u' D+ D+ V1 {) {) r6 b: n. T             (setq help_entry  "modify_Ellipse_dialog")
  h$ r' G3 ?$ n3 u             (ddellipse)
2 F, ~7 H! B7 l5 d* z           ), W- W2 C! I6 @+ d; B6 r" h
           ((= etype "3DSOLID")
) S" ?( c0 L1 x' M; f             (setq help_entry  "modify_3d_Solid_dialog")
8 I  R* `2 a0 ]1 K             (dd3dsolid)
+ X6 u6 Z  N4 R! W           )4 _" o0 k0 e9 C8 m/ K
           ((= etype "BODY")
; ^4 _4 K' e( z. p             (setq help_entry  "modify_Body_dialog")
3 b7 Y4 U! i0 o# E             (ddbody)
, S! f! \( M9 f           )
( e( V. O. g/ \# c           ((= etype "REGION")2 H2 s( m3 g$ \4 q- Y$ n; Z/ `& Y
             (setq help_entry  "modify_Region_dialog")
2 P, v8 d4 X+ V4 z             (ddregion)
4 T* ^: D. ?4 i  @% a  @           )
$ g- A; \% Q( A$ T  ]           ((= etype "HATCH")
- g. `7 R1 D3 R4 a) V0 {             (setq help_entry  "modify_Hatch_dialog"), ^4 g) ]( m% V
             (ddnewhatch)
% o' U" T5 P( w/ A9 l           )
, ~! z" n& \* e: ?5 m           ((= etype "SPLINE"): ?: ^5 U+ q0 f
             (setq help_entry  "modify_Spline_dialog")
$ {( T; V4 {7 H+ j6 y             (ddspline)$ [: z- ~8 w( j
           )( E; }7 k$ \$ i* H5 h3 W: w9 u, E
           ((= etype "INSERT")    ; see ddblock for help_entry
& c5 B# j% s* l2 y/ I2 ]. [" U             (ddblock)
' s3 {, m/ R" a2 B, J' f6 _           )
" D* r' G- m" f. w* ]5 @) O0 m           ((= etype "LINE"): i+ v: Z6 J* P6 {3 |8 q5 Z
             (setq help_entry  "modify_Line_dialog")2 }; r7 z" ]& @* U- z  b
             (ddline)$ s3 |7 {! {4 |. V5 F" @5 Y
           )8 F  l( d+ Y+ f/ R) Z( X
           ((= etype "MLINE")
9 Q% d& N% t) N, @- n' E1 y2 Z             (setq help_entry  "modify_multiLine_dialog")% @, u6 W- m. a* q' E9 o! I/ q1 n
             (ddmline)
, ]. }9 Q# ^( T. A           )+ z  y! [( i. }9 K( m
           ((= etype "RAY")
9 W' ?7 C* m( K3 C2 `; {             (setq help_entry  "modify_Ray_dialog")5 T5 H( i1 s" B4 n
             (ddxline)% l7 o. w& Y4 O% ]6 B
           )
0 E+ c! r$ `. T           ((= etype "XLINE")3 @1 Q- j( [  M
             (setq help_entry  "modify_Xline_dialog")% w$ u% T/ \0 f$ j' W5 L1 V
             (ddxline)
  ~  _- s* z1 V4 G           )
2 v4 Y/ b4 Y7 B3 ?- k* s           ((= etype "POINT")# t/ ?/ m; T& m7 z
             (setq help_entry  "modify_Point_dialog")
+ E0 ?  e4 f/ |0 J% `* t* |             (ddpoint)
' K( e+ n6 G# {3 C+ O8 [           )
- j6 A# _, p8 t  B: {' o           ((or (= etype "POLYLINE") (= etype "LWPOLYLINE"))  m9 b4 A2 M! C2 z* Z
             (setq help_entry  "modify_Polyline_dialog")1 N- M( R3 u! u( ?! V; L
             ;; If a 2D pline, check to see if it is planar to the current
( t% p% ?1 V% a6 a  p             ;; UCS, reject if not.   To see if the pline is parallel,
* h  r* b8 a1 B6 r: I             ;; the 210 group (WCS) is added to the current UCS origin (WCS)
. N3 y- N7 Z8 t1 z4 \$ K" m3 O             ;; and then converted to the current UCS and checked to see if* l! u9 k$ @3 t/ @/ \" C* ?3 E' e
             ;; it is equal to (0,0,1).& {& q" l- _7 w! ?0 I$ O' z7 l4 N4 K5 E

$ P& g0 \' c" l             ;; Incase the 210 is default and not in the dxf list.' I; p& }# h; R* H. j
             (if (= (assoc 210 (entget ename)) nil)
( Q# {" M8 P2 Y5 X; E* L6 a& w  i: c                (ddpline)9 `! [) k6 b1 F" V, x" L. e* L
                (progn3 Z( E6 ~$ f  [9 _! A
                    (if (and (zerop (logand 120 (cdr (assoc 70 (entget ename)))))
+ {2 L: Z# g6 g/ h9 l+ _0 J                            (not (equal '(0.0 0.0 1.0)
9 }. p0 R! F0 y: L                                   (trans (mapcar '+
# X" e1 g" U3 z% g5 i3 {                                             (cdr (assoc 210 (entget ename)))7 p" @4 ]8 m/ _9 d; `
                                             (trans '(0.0 0.0 0.0) 1 0)! g0 {+ V& }5 w7 s
                                          )1 L- {8 S3 p0 Q% m2 {6 y" @$ _
                                     0 1
  D2 o) ?) y. G7 N$ E                                   )0 ^& Z9 d/ V5 W- B7 [
                                   0.0000000001            ; fuzz4 Q5 O! U) j3 U( \; U
                                )
8 {, l6 Q8 a5 i3 D! s& p                            )
3 {  A  p, b2 K' E  c                        )
; `" z7 u( D1 X7 c- E& m+ k                    (princ "\nThe 2D Polyline is not parallel to the current UCS.")6 H/ v8 P/ K+ J+ c; u* l$ ]* c
                    (ddpline)
/ I3 m& r* D+ n$ C                    )
4 W  h4 H0 l& X                )
7 H, w0 r. F; U. T             )9 z% S7 v1 N. J/ W" V8 Z
           ), }3 S; I( U% L7 T% d# Y8 `
* g# g# C6 Z* s- Z- _5 L7 K" h
           ((= etype "SHAPE")9 F& m0 Y* Q& I: [
             (setq help_entry  "modify_Shape_dialog")
, a. ]0 q% E% q0 g6 z7 g- E/ E9 B2 h. P             (ddshape)
7 v( D2 X& \* a& j% Y           ); R% v* Z4 n& T2 u2 Y1 M0 N
           ((= etype "SOLID")* ]/ m( t" c5 @3 ~
             (setq help_entry  "modify_Solid_dialog")5 A4 {1 w5 t, }& u, v
             (ddsolid)
6 ^6 n7 F, n) R; r6 w- }2 x           )
7 Y( z1 O6 A* d! F3 y" C& m           ((= etype "TEXT")
- D6 t8 W5 C0 M5 D+ q             (setq help_entry  "modify_Text_dialog"); V6 z7 ?. x* y0 }
             (ddtext)
! U9 w  X7 J7 d% `& b' E           )& R3 V. h1 T& ?
           ((= etype "MTEXT")( s: p6 q/ w1 T# }! c- _
             (setq help_entry  "modify_MText_dialog"); g% V- d5 A9 L5 }7 ~6 l3 U
             (ddmtext)
( C( i3 ^' u+ o% S7 V           ): `% |! O" D# V, \
           ((= etype "TRACE"): E5 j& T! E1 x8 P0 Q4 _* e) u
             (setq help_entry  "modify_Trace_dialog")
- L5 C. X# @9 V& t+ H5 w             (ddsolid)# u! {/ x/ W; N: y7 e: j, v: ]5 e
           )
- T  A0 _3 g5 z           ((= etype "VIEWPORT")
$ Q' l9 ]2 h( s3 F' @             (setq help_entry  "modify_Viewport_dialog")) i: q' J" y- l
             (ddvport), b; S7 X) C7 S2 o
           )
& A$ a6 d7 O: x# R           ((= etype "IMAGE")
7 V9 s9 A7 \! {! n# s" o& y6 o( ^0 i! j             (setq help_entry  "modify_Image_dialog")4 f6 n" }& [. M" A
             (ddimage)
. l3 A" z( O6 s           )
9 |9 s( j3 X* ^, I% l& M           ((= etype "3DFACE")4 O: ^' f. w8 P# l, i
             (setq help_entry  "modify_3D_Face_dialog")+ U/ F6 ?8 k. I% D. F/ h
             (dd3dface)
7 h: s4 }0 `+ {           )
. P: E1 }. {! U+ h& w* B0 f           ((= etype "DIMENSION"). ]! I4 c8 R4 F' }* p* Z0 t
             (setq help_entry  "modify_Dimension_dialog"), M0 d6 l) T2 A, n6 I
             (ddimen)# o" W! |. W$ i2 J1 d! I0 z
           )
! a& _- b7 \! C' z" |: q           ((= etype "TOLERANCE")
7 j  C- W& U- x% O- E5 L1 A0 L. Y             (setq help_entry  "modify_Tolerance_dialog")* {; a+ ^, |/ f  _' l1 O
             (ddtolerance)
! l3 l5 \# F; B           )# `4 I- j, T/ y5 K" |& y5 H9 p
;; Fall-through condition changed by MCAD for MDT 1.1 release.
& ]( Q1 j7 g2 e( b;; This allows DDMODIFY to work on any custom object or any new object type# c: ~5 b2 b$ z& q8 U) f
;; that isn't specifically handled above by calling the more generic DDCHPROP.
3 j6 v* ^) \, C& M: E+ f: q           (t
- A# x. q7 H  j5 K             (if (and (not ddchprop) (not (load "ddchprop" nil)))
( r$ I  W/ }1 z) T2 j# H  E                (princ (strcat "No dialog support for object type: " etype ".")))! T1 a& S$ M% N9 k' [! Q7 h+ e
             (progn4 A1 f0 w3 G4 K6 R! }
                (setq tempss (ssadd ename))' M: Y: s& z! y$ h1 [: Z
                (ddchprop tempss)
1 \; i& ]/ u* s* T) M: j' K                (setq tempss nil)
% `7 c. |  L3 e             )# y& n+ Z! ~8 `8 Q
           )7 Y+ o' a8 W. n1 z
        )
  m0 I* B# I4 e/ ~;; Previous fall-through condition.7 S* j0 Q; z) N/ n
;;           (t (princ (strcat "No dialog support for object type: "6 R8 O0 u. C, F' N1 g' T5 A. v
;;                             etype "."
) G6 h" w8 [: g4 |% U' G; I;;                     )6 W' t5 M0 j0 {6 u
;;              )0 x% f  Z# L8 [8 x' M2 N& O) L
;;           )
7 k0 ]" k- B* U3 v8 |: q0 E/ [;;        )
. L3 S9 U. ]3 T  \% p4 ~        (ai_undo_pop)
0 a3 C/ E9 X, Z4 H% A     )
- n9 ~- o. v3 F$ q- I  )
! C& ~" `; [* h. s1 P5 J. L$ i6 D
; ~$ q3 J* M: P0 c! s  (if (eq new_pickstyle (getvar "PICKSTYLE")) ; if user didn't change pickstyle
. a/ {3 ^+ v$ }1 y- ]$ h      (setvar "PICKSTYLE" old_pickstyle)      ; transparently then set it back( N' R' W) N$ `/ v- ?8 R# Q* h3 ?
  )                                           ; to what we started with
2 K9 G. T  u0 |8 M$ Y
$ q" f, T# R! \5 Y9 m% r  (setq *error* old_error)6 L4 y. f" I! ?9 V! H% q6 H3 x
  (setvar "cmdecho" old_cmd)
: k% K+ R3 n8 x. _8 S  (if (not reset_flag)            ; if object was modified, then, b* A, q& X; `
      (ai_return ename)           ; return it's ename to caller" z/ ]6 D6 Z" L( l
  )# z4 R2 _4 _" ?( m0 {- R  M
)
7 j1 O. M! V+ _3 i" n" x! ?6 ~6 `- r# M6 u9 P2 T
(defun checkForLockedLayer (ename)
6 \% p+ {. y* @. m/ p+ k    (setq layername (cdr (assoc 8 (cdr (entget ename)))))
" V8 L* Z: p2 Z9 V( }( ^0 O. M2 Q    (setq layerflag (cdr (assoc 70 (tblsearch "LAYER" layername))))
3 J: D# F5 Z" R5 e% Y5 I    (if (= layerflag 4)# m8 {& x) \/ J) |: L! p& T4 [( O
        T
+ V$ i6 j. P! J' q; C2 V        nil. Z" G2 M3 w1 K2 f
    )" o) {  z& [$ W, M
)1 p( S8 r% [! {* J

3 \( h4 T1 V$ X# ~( ?(princ "  DDMODIFY loaded.  ")
/ y8 X5 W. k0 j( i(princ)
; B, N+ K3 S" A2 U. v9 d;;;???;;;---------------------------------------------------------------------------------------/ [3 f8 u* j5 H/ O7 Y# r/ }, k

6 o. J4 f; |4 _* C$ K; Next available MSG number is    8
3 X4 Z" c4 G. V7 K# F; MODULE_ID DDUCSP_LSP_- E3 s( a5 P! ?# G/ a
;;;) t& K$ i7 v0 w6 J& h1 b
;;;    dducsp.lsp1 n% J+ n9 g0 L+ _
;;;1 {  L. Z% G; ]+ A6 u1 E8 e
;;;    Copyright 1992, 1994, 1996 by Autodesk, Inc.
8 j1 e& y" l1 V+ Z7 `;;;7 @1 P2 B4 L" a* A; h' O/ s/ z
;;;    Permission to use, copy, modify, and distribute this software
: U0 c6 {5 U, g3 I/ D;;;    for any purpose and without fee is hereby granted, provided
0 ?$ u# C, x( |- f% p;;;    that the above copyright notice appears in all copies and
; _6 C+ D& D$ T* b* X  o( ];;;    that both that copyright notice and the limited warranty and* `. p- J! l- h
;;;    restricted rights notice below appear in all supporting% g! r% P/ i3 o8 e1 w" x
;;;    documentation.
% n- ]  Y! e) }% d* O- A& [' Q;;;, Z" d) d" H; o( d, x! A
;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
, y! @$ m! {* m- B5 F; a* k+ H;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
7 X& Q3 h& J7 q. g' ~& L+ o;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
  h, U1 m5 B/ d# A;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
2 K- Q# Z- M7 \' s7 m+ k;;;    UNINTERRUPTED OR ERROR FREE.
3 I8 t% O* F  [: B: S;;;
* u; l# K6 W6 m0 ?8 v/ Z; T;;;    Use, duplication, or disclosure by the U.S. Government is subject to
& D5 p# U' z9 z6 [( D;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer* V+ V% M2 b3 k, d3 V% Q9 Q
;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
8 {+ d. h& F' o& Y& [;;;    (Rights in Technical Data and Computer Software), as applicable.
& o2 H9 C7 p. v; l) G2 @, z;;;4 Z' Q/ m% v$ _0 [6 M4 V* D
;;;.
2 g/ G5 v* P1 z;;;   C:DDUCSP - User Coordinate System presets dialogue.
. b- Y3 R% A; g2 R/ N9 S;;;     
; D. U! F" }/ h8 z1 ]8 y$ U) s;;;              Uses DDUCSP.DCL for the dialogue definition.  The
3 a& O3 l( d5 e1 _# O;;;              slide images are in ACAD.SLB.
# \* {, t# X9 A;;;
7 p! C( r$ o; T, }, N5 ^3 l/ Q: A;;; ===========================================================================9 {9 t( E# R7 C! _
;;; ===================== load-time error checking ============================9 x$ [! }4 F" W5 g: e
;;;
( f/ b  ^3 }: ]+ O3 p& }5 a6 w
- f/ a! S, Y$ l3 h+ _& l& h  (defun ai_abort (app msg)# c6 g: u+ j9 Z; M" j2 i
     (defun *error* (s)
' G+ t; h# z+ X0 L        (if old_error (setq *error* old_error))- d' H( W0 n, G9 n' r- R' K
        (princ)
& D, g* h* U( S" D" h     ), D8 A- i" p" W" n+ o
     (if msg
  Y+ f) g% ]9 K& d6 B1 }: ^  e8 M+ p       (alert (strcat " Application error: ", z7 b# O8 z: e4 \9 M1 i& H4 {. `
                      app0 G$ u" u) q( N+ l1 M
                      " \n\n  "! h. h/ M3 {# ^% ~4 O
                      msg
2 `8 ?/ y7 M8 A+ q. h! p$ a' T                      "  \n"
: {( K( R2 K  w: T              )
3 D" E9 ?9 ~( u+ D       )
( R  E  W! z) Z. O* k. J     )
1 q9 M. }+ J! @: a2 w  X     (exit). M0 V5 A3 ?7 U7 k1 `$ ?1 ]
  )
4 D/ h* y  t$ f, [
! T/ ~1 E, M: n1 g: @8 c. Q;;; Check to see if AI_UTILS is loaded, If not, try to find it,
0 J) O' k' F4 K1 d" n;;; and then try to load it.$ F' e" P8 @$ B, L) `
;;;
! g2 r) q( A. T; k7 n. ?, U;;; If it can't be found or it can't be loaded, then abort the: Q9 ~5 _  K: {) t
;;; loading of this file immediately, preserving the (autoload)% {( U2 Z3 M; R4 v4 ]
;;; stub function.
: m  }3 }# t8 J; l$ N
0 n; C/ P3 p# K9 }8 Z9 d  (cond+ F) H+ {# v; ?1 |0 M+ ?" L1 o: ^# a
     (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.+ D. Q9 ]- b. x% r/ t0 R

) m8 \  e% i! u& G& K( G) D     (  (not (findfile "ai_utils.lsp"))                     ; find it- a6 `+ C) |, H' m
        (ai_abort "DDUCSP"
/ g+ {% C; s$ W8 @                  (strcat "Can't locate file AI_UTILS.LSP."
5 ?+ p/ x& K6 d% G1 p' _- ~9 \- J  [                          "\n Check support directory.")))
2 e3 O$ G/ |& P0 `; j0 o/ m9 @/ ~# ^0 c+ z$ u8 |6 q
     (  (eq "failed" (load "ai_utils" "failed"))            ; load it( h7 U4 ^9 D' m. `- D1 ?
        (ai_abort "DDUCSP" "Can't load file AI_UTILS.LSP"))+ U! Q; B/ @8 {$ N
  )" b. W6 D4 \1 h+ B' y
. _' I: m8 f5 J
  (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
+ q$ k" O3 @) V  ?0 W7 F      (ai_abort "DDUCSP" nil)         ; a Nil <msg> supresses
! w* a, O# M1 I  S  )                                    ; ai_abort's alert box dialog.4 h' }7 |2 N) i3 I" m% a' q/ C

1 f1 P% p) N$ E3 U$ G6 K;;; ==================== end load-time operations ===========================
8 W5 O8 `, r8 c( o
5 z: v6 l$ B! A7 b+ W(defun ai_ucsp_start ( / program)/ K( N2 X- a8 p" C9 x* r1 C: \
  ;; Get program name5 x7 y" x/ I, n1 m7 o9 G
  (if (not (setq program (getvar "program")))
, u4 @! T% i/ C9 F     (setq program "acad")
1 O  N5 T6 a& A  )5 D9 N8 r& V; v3 S# K( p6 O5 I
  (foreach v0 '("world" "left" "cview" "top" "front" 6 w9 }+ }6 s) \; `1 ~, w3 C
                "bottom" "back" "right" "prev")
/ R+ t1 s) M: ^, ]( \$ G    (start_image (strcat "ucsp_" v0))& c$ E( M( A6 v$ }5 r
    (slide_image" z4 ~0 }1 p, F- b
      0 0
, Z& P  t+ }/ J+ x7 \      (- (dimx_tile (strcat "ucsp_" v0)) 1) (- (dimy_tile (strcat "ucsp_" v0)) 1)# b+ M) m, r9 }- ~0 h! M
      (strcat program "(u-" v0 ")")
, k* Y$ N6 r! ~* N1 V! Z" g    )0 C3 P  x' w, a+ U0 v1 l% E+ `
    (end_image)3 P4 P. t4 H% M
  )
2 {& X! I5 \2 J" A% })4 b7 ?  V# @( w! U7 C9 D

1 E5 R4 o$ M( y8 _  I(defun ai_ucsp_set ()* s# r; D6 [- L
  (if ai_ucsp_sv1 n& k' l2 R7 L8 J2 i" J5 C) D
    (command "_.UCS" "_V")
1 n1 A  g( c5 g- r    (if ai_ucsp_prevs% E0 {4 }; k- ?) k! k+ Q; m
      (command "_.UCS" "_P")( X( ]" R& `1 [6 Z. g0 k
      (if ai_ucsp_chg
" c9 Q) p/ A% D, v        (progn( W4 ~& ^$ o0 _' Y/ O
          (if (/= ai_ucsp_a "*")/ ?4 u* t; N. d" f* w2 p$ i
            (setvar "LASTPOINT" (trans (getvar "UCSORG") 0 1))6 |! j4 i; c; Q
          )* H! z$ a) W: x  D9 [& R0 k5 M
          (if (< ai_ucsp_pick 6)
" |$ y1 I* f, f! T            (setq ai_ucsp_set0 "@")
2 Z$ @4 @- d8 e) \6 o: j            (setq ai_ucsp_set0 "*0,0,0" ai_ucsp_a "*")
3 {8 N, x8 R  \( N          )
8 ]3 c0 g9 {4 p7 ]& R          (cond ((= ai_ucsp_pick 0)7 K$ g5 W, X/ z% `
                 (setq ai_ucsp_set1 "0,-1,0"
, S0 L, q  s$ Y5 I8 c) o                       ai_ucsp_set2 "0,0,1", R& [+ J1 F2 b" ]2 P
                 )6 V2 \0 r2 W7 P9 J
                )8 x7 i0 b/ J/ o
                ((= ai_ucsp_pick 2)
) A' A, X  t% h- m                 (setq ai_ucsp_set1 "1,0,0"
3 x( J6 v0 {1 h4 T6 w                       ai_ucsp_set2 "0,0,1"+ S# U( A% A5 n, L; |
                 )
5 M: s+ {/ y/ I# ]# M5 {5 F                )
: x1 ?7 g! x5 ^, ^4 s                ((= ai_ucsp_pick 3)2 s" B& o3 C3 p6 A) Z7 C; M; P: C
                 (setq ai_ucsp_set1 "1,0,0"
; w1 |6 s& B, e+ J6 k/ d                       ai_ucsp_set2 "0,-1,0"& e" K3 q& h: y: p  F0 w
                 )2 K8 t: k% _' s+ ^  L
                )
' l- T6 y3 }& V3 M1 c* d# E                ((= ai_ucsp_pick 4)
/ p2 Q+ V" F  s+ D# t" a! S- H                 (setq ai_ucsp_set1 "-1,0,0"0 c" p% I5 M/ ^( N. c
                       ai_ucsp_set2 "0,0,1"9 l$ z7 H4 N- t0 z  T% [
                 )
4 L) D- f. s6 j2 |( r2 g9 f; x. d7 Q                )) X# h9 \) h  ]+ B* n
                ((= ai_ucsp_pick 5)6 I! g' o$ C9 `
                 (setq ai_ucsp_set1 "0,1,0"
2 H1 K9 l6 E. X3 l$ H/ F* R) X                       ai_ucsp_set2 "0,0,1"( n" j8 }8 `0 f) M* P, a, c
                 )
# z7 |" k5 L6 G# M7 S( T( u% S                )
  E9 k+ ^7 s$ @& Y, r. b) e                (T
( m: v% X3 }& n) w& }                 (setq ai_ucsp_set1 "1,0,0"
% b! _# _9 b5 e; i                       ai_ucsp_set2 "0,1,0"
- Z+ a- N* g. \2 U7 t" M                 )
  `3 W4 K% u8 z6 E; D                )
3 m* J* H+ O+ L1 n1 n          )
$ D8 C4 G  B/ S0 N6 k& O0 Y          (command "_.UCS" "_3P" ai_ucsp_set0 ! G. q8 p3 `# ~. h( ^% S& Y+ }
                   (strcat ai_ucsp_a ai_ucsp_set1)
- S  t1 u0 n' Z. H' ^  `; R8 Q                   (strcat ai_ucsp_a ai_ucsp_set2)/ D" S2 u  p& I2 H5 f7 h4 d
          )
6 q9 q! D9 i( f" X0 s        )/ a1 I: z; V" e, v' `, \
      )) Z* y( `6 D! t5 S% t
    )
+ m& b/ q, P) d/ W7 c9 z  )
, K* l# M; G6 v: h) h)
' n5 a: t, i8 d7 [: W1 V3 e
4 [5 v1 B: i% S6 e. r, _# G(defun ai_ucsp_p (val currtile)
; T& ~8 m; P5 u+ p" q  (mode_tile ai_ucsp_currtile 4)/ I2 M9 W( i$ A! U1 e
  (setq ai_ucsp_pick val+ L& E6 A% _! l+ C5 c
        ai_ucsp_sv nil
; ^1 p, \5 M. ]" D7 @, x7 X        ai_ucsp_currtile currtile
3 d  T( i2 g) Z9 Y& S0 F  )
' [+ t) W) F8 v. X  B6 a+ y( n2 n  (if (/= val 1)
$ K: M4 Y2 j, u+ U0 Z5 a( ^# r    (setq ai_ucsp_chg T)
6 [1 S, J/ J2 O5 ~' n( E) ~  )
( m  w& J( T4 W9 l- R& t" n  (mode_tile ai_ucsp_currtile 4)( u2 `$ s# Y7 i% ?2 X+ i* h
)! }6 Z5 J$ G. I/ |" ~/ W

/ H7 p9 s  w  `5 E% N(defun ai_ucsp_swcs ()
5 \/ k9 G  A$ e  H  (mode_tile ai_ucsp_currtile 4)
" Y1 i* q7 {3 c  (set_tile "ucsp_a_wcs" "1")2 x( i8 R' f$ q7 Q+ _( N. T
  (setq ai_ucsp_pick 64 m" \& R& ?% J' x4 Q6 X% z6 S
        ai_ucsp_sv nil
& G. Z- o/ ~! c: u5 {) B        ai_ucsp_currtile "ucsp_world"3 c1 q& I: c( v! i% K/ W; O+ X
  )3 t; T! K& A9 z' m0 B& m' l, ^0 L( `
  (if (/= 1 (getvar "WORLDUCS")). t/ Z, h3 e. Y$ X: N4 _
    (setq ai_ucsp_chg T)
( m9 g' Z6 z' ]- J" V    (setq ai_ucsp_chg nil)4 i/ a6 d- ^- t5 u
  )
% }" T: L1 n! n, r' X) ]  (mode_tile ai_ucsp_currtile 4)
" c2 T" Q1 @; J7 b)
( L# }. c9 Q+ X8 e6 c; r) o% H3 U1 v: e8 O, _+ V
(defun ai_ucsp_cview ()* }& Z. d: N% R+ C0 F: E6 _
  (mode_tile ai_ucsp_currtile 4)% J7 Q# W! m! t8 f5 L
  (setq ai_ucsp_sv T ! _  h2 W2 j- f1 G8 V& G
        ai_ucsp_chg nil
4 T$ z6 x  i5 X5 H; G+ _        ai_ucsp_currtile "ucsp_cview"
: ]+ W' O8 j# j' K, P  )) I& [$ S% S9 j2 D: e* m
  (set_tile "ucsp_a_wcs" "1")
# W0 V! N2 j6 X$ I( M  (mode_tile ai_ucsp_currtile 4)
. C) P& N0 T$ p; U' E3 a( r)7 O, q) k3 m* Y* e+ }9 O
: H" o$ h$ o% G2 Y0 l8 s0 W5 Y
(defun ai_ucsp_rucs (typ): ^) b; @& ?! Y2 p( @* [
  (setq ai_ucsp_a typ)& o6 ^' g' g$ v
  (mode_tile ai_ucsp_currtile 2)  w8 O7 m# [* R* ?: Q# d4 h- v% Z+ z
)) i8 M) m+ o8 c. S" F9 ?" n! r

6 |- k# `3 \* a* Y! K6 ~(defun ai_ucsp_prev ()0 J2 G% R5 \" J4 K" G
  (mode_tile ai_ucsp_currtile 4): E+ d8 P3 T2 V& n: w! r: o
  (setq ai_ucsp_prevs T, d  m9 T8 r( x- A+ q/ ?: f
        ai_ucsp_currtile "ucsp_prev"
% g1 ^% |9 w6 ]7 y) a  )4 ]# F( m7 T( [* F; B8 Q. L
  (mode_tile ai_ucsp_currtile 4)$ S7 @  b+ m$ J! S3 [( J* v
)7 X0 O2 |' R  ?5 x; W4 q) K, Z

8 L2 p2 f: c* t/ W! ]# Z/ B(defun ai_ucsp_main ( / ai_ucsp_pick ai_ucsp_sv globals)
! V9 j5 m  d% E" c! G1 v% ^  (if (not (new_dialog "dducsp" dcl_id))$ w8 y% x/ y0 H
    (exit)
7 c$ C. \# f0 }: b5 A  )
6 A. X- L6 W8 E) f$ K# t. `  }7 ?1 V2 h6 L. ^: Q
  (ai_ucsp_start)! P* q# A1 ]. d4 W  d% T2 |! |$ u
  (setq ai_ucsp_a "@" ; p3 p" z2 u. T% d. s, g6 X: Q
        ai_ucsp_pick 2; \0 ~: i. Y3 X$ o
        ai_ucsp_currtile "ucsp_top"' q) L4 u& @2 J6 Q
  )
. a* m- Y: g+ r& Y' p3 H& e  (if (= 1 (getvar "WORLDUCS"))
8 I! g% g) A1 F& G1 p( @' g& G    (progn5 R7 ]) g* U% Y
      (set_tile "ucsp_a_wcs" "1")8 P; X$ r' O! K, L% \- d% C" V
      (setq ai_ucsp_currtile "ucsp_world"), c* k" A0 z6 ]3 D
    )4 K3 b  ~6 z! l, {# i
    (set_tile "ucsp_r_ucs" "1")
1 q1 n5 O& c9 S) n! d  Q  )' k+ e& x% T. z5 }7 y! O
  (mode_tile ai_ucsp_currtile 2)! F' O, A& W" u& V/ \  H- \$ H
  (mode_tile ai_ucsp_currtile 4)# _% \. o% ?9 n4 ?
  (action_tile "ucsp_world" "(ai_ucsp_swcs)")! z  G# R; ^0 i8 A2 E
  (action_tile "ucsp_cview" "(ai_ucsp_cview)")* h' Q, Q6 G/ A; q
  (action_tile "ucsp_left" "(ai_ucsp_p 0 $key)")2 F) N& N  `4 `# t$ }/ s7 @! W
  (action_tile "ucsp_top" "(ai_ucsp_p 1 $key)")% H% [& s: [5 w. c* W* u9 d5 ?
  (action_tile "ucsp_front" "(ai_ucsp_p 2 $key)")1 i' m7 u' u7 ~" F9 l
  (action_tile "ucsp_bottom" "(ai_ucsp_p 3 $key)"): L9 B, i. Y5 }' i- @
  (action_tile "ucsp_back" "(ai_ucsp_p 4 $key)")/ K0 z' f! m' w' ?2 B! t
  (action_tile "ucsp_right" "(ai_ucsp_p 5 $key)")
2 l/ |9 [9 @' B7 C/ M0 f! E  (action_tile "ucsp_prev" "(ai_ucsp_prev)"). U$ w3 B7 [9 P" ]8 Z' k
  (action_tile "ucsp_r_ucs" "(ai_ucsp_rucs \"@\")")
/ d" z% {2 V! M$ D; M- ]  (action_tile "ucsp_a_wcs" "(ai_ucsp_rucs \"*\")")
. `3 P8 M! P9 n& J/ B% }0 P) b  (action_tile "accept" "(done_dialog 1)")  f% {2 s! Y4 ]7 h& M# n9 u1 t1 d
  (action_tile "cancel" "(done_dialog 0)")
  A8 t2 ~2 w7 F! T/ ^% p  (action_tile "help" "(help \"\" \"DDUCSP\")")5 ~) ]* d1 D6 E4 J& m4 B3 Y. ^" K( k0 Z
  (if (= (start_dialog) 1)
6 D' u7 M1 k2 _$ u* f    (ai_ucsp_set)
1 P0 ?. _1 v! {# T/ F  )
' P7 R7 k! P& w$ N) c)
; N7 J5 _: G$ G/ a( g, K
3 O, u6 C. ~! J$ _1 C* g(defun c:UUS ( / app dcl_id old_cmd old_osmode ai_ucsp_prevs
' L+ O4 T. j: d( N, r) _                    ai_ucsp_sw undo_init)
2 ?; K. g+ o, \) Z5 \# K) }/ ]3 {! ^7 n2 H* E9 Z) {) R0 f9 Q- L
  ;; Set up error function." H. h. w' f& N4 d. w) N% r& L
  (setq old_cmd (getvar "CMDECHO")    ; save current setting of cmdecho& m( {7 k3 O5 d# }' O& k! q
        old_error  *error*            ; save current error function! T; e$ O  j) R% F5 t! l
        *error* ai_error              ; new error function
3 X, F0 C; y: ]1 Y' \  @3 O        old_osmode (getvar "OSMODE")  ; disable OSNAP for duration
" Y/ a; }: d2 }& i* z! m  )& j& u& O5 f3 _3 B+ A
* s# k8 w/ x0 P$ u
  (setvar "CMDECHO" 0), O( S3 R; W5 U+ R$ N. J2 e; S$ d

" f, f9 S" e9 e  (cond
% P0 m( l+ \( x9 U6 Z; X" K4 _, K     (  (not (ai_notrans)))                     ; transparent not OK5 m! |/ G4 L/ [$ Z
     (  (not (ai_acadapp)))                     ; ACADAPP.EXP xloaded?0 L# l* e: t/ d3 s8 r# h. e7 m
     (  (not (setq dcl_id (ai_dcl "dducsp"))))  ; is .DCL file loaded?
$ c- `) n7 ?% }3 J9 W/ X     (T (ai_undo_push)
3 h- N1 b6 Y6 l4 A* V7 P        (setvar "OSMODE" 0)
* ]( x# w. x* n) e" `+ J        (ai_ucsp_main)
7 p4 r: f  D/ `5 r6 n) ?$ B4 z        (setvar "OSMODE" old_osmode)) F  x6 H: m& Q( t; A# O
        (ai_undo_pop)
& B3 T3 J/ E% s- Z     )
: f) _  Z- z0 j  )/ M2 Q& s( b3 F8 ]# L3 n

( W/ Z9 }' S/ x0 K  (setq *error* old_error) 8 y0 h! {2 }( N
  (setvar "cmdecho" old_cmd)
, y: e5 V( c; |) G2 L4 Z  H* t, I. W' M' [1 p$ k- A6 U8 r
  (princ)
% O* @% |3 ^) I4 Y0 R& e3 U/ D)
: G; X( \( R# s
3 |) u% d) a% M5 v+ O(princ "  DDUCSP loaded.  ")$ p1 {1 K! J2 Z8 e5 C
(princ)
; i. X& u, z, a4 g9 @/ a$ C
3 B. c6 A) w$ f+ e( i, t;;;???;;;---------------------------------------------------------------------------------------/ x5 U. G  t0 j  D2 p: a
- W7 \" l* @/ n. }/ M9 ]5 \1 P
;;;----------------------------------------------------------------------------, ?8 w/ X2 ^8 b  L: v+ @8 L# N' `
;;;
2 D" g: ?- e& P% k;;;    EXCHPROP.LSP    - l) S& z. ?& ~6 o5 X  X: r7 g
;;;    Polyline and text modification capabilities added by
! L) n8 \' W3 ~; f- }4 p;;;    Randy Kintzley  
9 @6 u( O3 z! V2 K;;;
5 ?  L- ?  |1 K;;;    Copyright (C) 1997 by Autodesk, Inc.4 j0 @" D% J3 S5 R- W
;;;! D" Y2 e5 Z' g% o- ~7 X1 N
;;;    Permission to use, copy, modify, and distribute this software9 h0 q8 z, Q3 n0 a( s  _% T
;;;    for any purpose and without fee is hereby granted, provided
$ ~1 u9 S$ I$ j* p  _4 T;;;    that the above copyright notice appears in all copies and% L8 H: ]( b9 U
;;;    that both that copyright notice and the limited warranty and
& ~& ?% a2 w7 `2 };;;    restricted rights notice below appear in all supporting9 \% ~" e! Z3 {5 i3 @1 h8 v2 Z
;;;    documentation.+ A6 Y8 X, t& t. c# @, ~
;;;
' f: `# E/ i  T1 I& Y8 Y;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.$ L: i0 B8 @, \/ K
;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
' B0 X  U: M# t2 o, n4 L9 m;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
, ~  g( k0 f" a2 ~2 R2 D;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE4 I- l% |/ ]& C
;;;    UNINTERRUPTED OR ERROR FREE.: C6 `( u. a2 R1 p' c. Z5 ~* s
;;;2 N; x8 k0 Y6 i  \$ S4 C
;;;    Use, duplication, or disclosure by the U.S. Government is subject to
( {1 b* |! K' V;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
$ t* }- @) M8 x+ Y7 c# }; `;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)! s  M/ D: ?7 V7 G+ v& X9 \/ W
;;;    (Rights in Technical Data and Computer Software), as applicable.
2 Q0 I: Z8 D  o  _$ `7 E1 z9 O5 A;;;
6 P% T3 U% A8 `" ~1 I, }& B;;;.  b0 P9 a' B5 |6 ]
;;;    28 February 19979 ]# ]: q, W0 }% C. R
;;;* i  l3 p; o0 q* N% y) T% K# J$ q
;;;( k, d3 o. Q8 f2 |' M% E6 ?5 [
;;;----------------------------------------------------------------------------
( K5 o  R4 Z# U. I% e' t% r& J;;;   DESCRIPTION/ g  z6 c; t4 `& w7 T1 i4 d
;;;----------------------------------------------------------------------------
/ x0 Y/ d- I/ k" b, @;;;   C:EXCHPROP is an extended or enhanced version of ddchprop. This  4 S( J' x; R% {! w# V6 m7 Q
;;;   command gives the user the abilitie to change several characteristics 2 G7 M/ C6 ~; p& n/ g0 K
;;;   of selected polyline and text objects. , v2 F) h. L% p) l
;;;       The style and height of selectected text objects can be modified $ C1 R0 t4 z; X6 n0 ]/ h( y0 s* z. i9 F6 W
;;;   (including text, mtext and attribute definitions) as well as, width and
2 L8 G) }7 ^  ^' E$ Y7 ~4 r;;;   elevation characteristics of selected polylines (includes lightweight and
: ^9 i6 _6 ^5 Q4 D' y6 k;;;   traditional polylines.)
9 C: h3 n) |1 A7 t" k- G0 [;;;----------------------------------------------------------------------------  @) e6 [6 s5 F3 a0 }8 }
;;;----------------------------------------------------------------------------+ T" u$ B7 K& H: |6 u: K
;;;   Prefixes in command and keyword strings:# M3 [! J* W2 ^4 D; F$ C
;;;      "."  specifies the built-in AutoCAD command in case it has been, L) s  Z2 Q* O8 [: W
;;;           redefined.
3 V1 x3 @) \. N0 Y! \3 n( T;;;      "_"  denotes an AutoCAD command or keyword in the native language1 W' b% }( w% ?+ W. _
;;;           version, English.: x8 n# r' t, M, ?' ]. o
;;;----------------------------------------------------------------------------9 ]7 y, e# X8 m$ v. [# `' h
;;;
; t& ]2 ^, d5 \. f" C9 N/ D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0 ?/ x# {4 M6 v' n, G0 `  E6 O
;;;;;;;;;;;;;;;;;;;;;;;;;;;;GLOBAL INFO.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4 f. m' z8 B- W# o- W) k;Functions created as result of loading file: exchprop.lsp
. v0 C4 I7 w) a9 [; l) N  d% m; DDCHPROP25 y9 Q! W' c; e9 ~- R- I% L
; DDCHPROP2_INIT# g) n! z% V2 Y6 h/ R" h* t" _+ W
; DDCHPROP2_SELECT
3 s% a1 r& {( z9 p8 {6 n# O! U;/ l2 k* Y- h& @$ l5 {
;Variables created as result of loading file: exchprop.lsp
( H; X" ~) t7 B. \, j/ K: ?; OLD_ALLOC% v/ v* x% a6 g& C. r
;6 ~* e6 [  y7 d5 f. U- _8 L3 x5 J6 T1 |
;Functions created as a result of executing the commands in: exchprop.lsp1 t. R" i- R! X1 M
;
9 m# W1 N/ D  Z" f  M;Variables created as a result of executing the commands in: exchprop.lsp1 q4 ?5 P7 {. ^% P/ f1 b
; AI_SELTYPE
. C3 ?' ~7 V" e9 B5 X, l, C/ }; BONUS_ALIVE7 F& j3 H% w( v, b" j. p4 U* D
; BONUS_OLD_ERROR& H9 k0 h# g& e
;;;;;;;;;;;;;;;;;;;;;;;;;;;;GLOBAL INFO.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- e# f- P5 M4 T;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
, h) A% s# N! a# O7 K- Q$ H
  h; R* S5 E# a7 v;;;
3 Q; I) x+ }0 s& b/ d8 l6 q8 z9 c;;; Avoid (gc)s on load to improve load time.
; ~( z0 W& t) U7 X" y;;;
$ i# E0 _; ]2 a* Q(defun do_alloc (/ old_allod new_alloc)# @% u/ `5 _4 x
  (setq old_alloc (alloc 2000) new_alloc (alloc 2000)): i8 e0 g/ u  R3 I
  (expand (1+ (/ 4750 new_alloc)))
& x0 t: k' ~  l! n$ n  (alloc old_alloc); g9 W4 E' y! y' Q- t6 Z) z/ w
);defun5 R! u- }, [* l& u- |% r' T
& {. \; |6 K7 V; E9 ^, x8 f* O
;runs at load time - rk
4 h) R/ V4 r5 a5 V9 Q) u  m(do_alloc)& l, J! t( ]6 P7 v* M2 c
(setq do_alloc nil)
& O. `% @' D& Q" e9 u. S, G;;;7 Z8 W: G* _( c* q
;;; ===========================================================================
$ W/ e3 B" K& }$ M& u# R;;; ===================== load-time error checking ============================
' ?  h+ E; r# S/ I- A;;;
: Y$ I  E: X6 a4 S4 I2 ^2 G. c' j( I* d' g( \) O
  (defun ai_abort (app msg)
! }/ V( r& M. u8 G     (defun *error* (s)( F3 V; ~" l0 V9 w* E
      (if old_error (setq *error* old_error))* b6 o' u, P& Y! Z  M1 W! W
      (princ)9 v- ^0 R% f; s: y: }% A5 S% w' i
     );defun
3 O5 e: d  r; L+ s5 e     (if msg! _7 y$ t* z+ z8 \0 L
       (alert (strcat " Application error: "  B2 |) {& d! s+ b8 \* Q
                      app$ Z. N& Y$ m" m6 w  A, `
                      " \n\n  "
. i' }0 ~* i0 _' {                      msg
7 ?" x5 @; u, q                      "  \n", }$ a% o6 `9 P6 e/ q/ q! S
              )& w5 \, G: g1 M/ s
       );alert
. F0 Z2 p; E5 C- A     );if! I+ N* |/ W) x
     ;(*error* msg)+ z( Z5 e3 P% f
     (exit)( ]0 @5 @4 p3 z; a$ i- V
  );defun ai_abort
& k2 k7 ^* l' l0 G5 n0 I! x4 c
' X6 t$ Z" i& m5 X0 u;runs at load time - rk
, l" W) `2 W: Y( m, J4 e1 g;(if (and *error*      ;added the if wrapper around this - rk.
3 F5 y# k/ V/ e$ z' W;         (not old_error)      
0 j7 M9 w1 I' f' r5 u;    );and 1 W1 F$ ]0 ?. |. C6 f8 t
;    (setq old_error *error*);setq8 P: Z% k1 P1 r0 ^+ y* K: F0 x
;);if
: K2 k2 y" x7 X& W" A) m) A: `2 a7 F) O& K! `
, w. z7 ~: [$ ]
;;; Check to see if AI_UTILS is loaded, If not, try to find it,
( o$ n0 K% |. Y7 S0 @' M3 F' d;;; and then try to load it.
! w! f/ |& E. q  \8 g, E- ^;;;  C6 O8 O, o+ b3 X1 f  s/ m
;;; If it can't be found or it can't be loaded, then abort the4 m6 r4 r! r8 t, ^
;;; loading of this file immediately, preserving the (autoload)
8 b( D9 Z5 T  C) r# Y;;; stub function./ y! R& |$ z3 F* D( ^1 y
9 L9 w' B4 ?' ^
;runs at load time - rk.
& A1 W7 U  K9 Y" O6 o) }(cond
1 T3 g, X( f7 @) [7 }( v (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.+ K: Z* X% F( h/ x
(  (not (findfile "ai_utils.lsp"))                     ; find it
1 j6 N; y$ e: u  L0 `& m    (ai_abort "EXCHPROP"
# E5 t& U9 i* A. V' j% X              (strcat "Can't locate file AI_UTILS.LSP.": y) d1 m, Z. g& ]# V8 L
                      "\n Check support directory.")* o' G( p' n2 y6 g1 \
    );ai_abort
3 |3 d5 l5 {4 O ); ~; s7 ^, P6 \
(  (eq "failed" (load "ai_utils" "failed"))            ; load it! k9 A7 t1 S- P0 L! @, K
    (ai_abort "EXCHPROP" "Can't load file AI_UTILS.LSP")
% }5 `# a- V: s4 ? )
; X5 X3 {( N& ^+ |);cond close
: \: k7 A0 ~4 T: D( y1 J9 P  U7 i8 z  M5 c: B# @
(if (not (ai_acadapp))               ; defined in AI_UTILS.LSP$ |: _# S- {- O& E3 ~9 I
    (ai_abort "EXCHPROP" nil)       ; a Nil <msg> supresses
) I% y+ H8 _9 I- d3 K);if                                 ; ai_abort's alert box dialog.
7 I, [4 f$ m) Q! [/ t; e  Y: @  D+ j3 F" [( s3 n6 |8 b
;;; ==================== end load-time operations ===========================& \( b4 ]2 Z$ R! N7 e3 U; I

3 D# e* k" M! J3 L;;; Initialize program subroutines and variables.; r# ^5 R% h! R8 X1 n
  B& ?& y- F) {1 \* Q7 O
(defun ddchprop2_init()) j! p$ A4 L5 \4 H
& J( }6 ?; l: O8 c8 Q1 J, r
% R' K" n' [3 m" M/ N2 P

" s: U6 g" D* P$ J3 \1 ~  ;;& y1 \$ _: s" Y. [& I+ {
  ;; Define buttons and set values in CHPROP dialogue box
8 x9 b. L& q( Q4 s4 j+ z  ;;% F& L, f% W: R' T
  (defun call_chp2 (/ cmdact p1 p2)
" _% {2 ~& M& s. G) ]- ?# X, [# Z; V$ H6 I' K
    (if (not (new_dialog "ch_prop" dcl_id)) 2 S2 R; k8 O- I, F2 D, ?
        (exit)
9 e$ J1 v, M! H    )
" G7 B1 T- P7 }, y
3 B3 B0 j: E" @    (set_tile "error" "")
) T' o1 U, ]2 u    ;; Set initial dialogue tile values# J" U! E- X% N$ J2 h
    (set_col_tile)  t& o9 i& \0 L4 g( `4 @
    (set_tile "t_layer" elayer)
5 i+ Z4 `6 D  B3 ]6 b! t
4 N$ j0 p' \# w6 A    (cond8 }7 |3 z" t+ j! l! ?5 f$ s
      ((= lt-idx nil)
9 F9 A! V: \# f% O" r3 R6 V: b' Z        (set_tile "t_ltype" "Varies")0 S- l. j) j0 v0 F' \8 g) c
      )$ K. N5 u; C: C+ O6 N. e
      ((= lt-idx 0) ; set tile "By layer & layer linetype"" G$ d( o$ d; K0 P' \$ V5 y
        (set_tile "t_ltype" (bylayer_lt))
' ?( W( ~) F2 ]2 p; a& y      )
+ b% a1 L# Q2 l# d! m0 Y6 y      (T
' X5 s# m" N" k3 i0 }        (set_tile "t_ltype" (nth lt-idx ltnmlst))# I) f2 C: N  ~6 R, B5 M# O
      )
' y. Y, o1 L7 r' Z; Z, V    ), V) E9 v! M4 N9 s/ ~# k

$ l, m" X# z* Y8 ^    (if (or (= ethickness nil)
; w+ |1 D2 S4 l/ X, c& G+ L6 F            (= ethickness ""): n( Z, Q6 u8 s! T* B9 j6 V* u
            (= ethickness "Varies")
; m! Z1 ^, t" D& h& D        );or
( ]1 W8 o! A$ t$ K        (set_tile "eb_thickness" "")% o6 q% H% a' ]* Q; G2 ]
        (set_tile "eb_thickness" (ai_rtos ethickness))4 _' P$ L2 s6 x6 d% i
    );if2 z( C" W7 c4 T" Z5 T( s  o
    (if (or (= eltscale nil)
, ]! h! d# M  o            (= eltscale "")0 x; b( _' u$ ?5 Y7 m
            (= eltscale "Varies")
# U6 ?+ r4 {# A& a) c+ n% P! x6 Z2 |$ Z3 O5 {4 D2 y1 I
        )
* a( K' M4 R, R        (set_tile "eb_ltscale" "")
, E$ h8 c- q0 W& q$ W2 K9 I        (set_tile "eb_ltscale" (ai_rtos eltscale))6 B$ i) I5 f9 ?) y0 j+ P
    )7 Y6 \/ p7 T9 M; ~3 p/ B
    (if( v: d* T7 l* M+ A& E9 |7 C
      (numberp ewidth)% A) }$ Q* f8 m: N# q
      (set_tile "poly_wid" (ai_rtos ewidth))
0 ?, @7 g( M' |6 V! c# W& p, e      (set_tile "poly_wid" ewidth)+ ]3 j& c6 S8 g% q6 U6 r6 b
    )4 S, w) v' p7 `. S+ z- A
    (if
0 k" r7 f$ q& q" x' h      (numberp eelevation)
" E# Y5 `& a1 p) v& J* {% V' x4 W      (set_tile "poly_elev" (ai_rtos eelevation))1 V& l/ t% G3 w1 T" E. F6 H
      (set_tile "poly_elev" eelevation)
& L8 h/ _1 _" C% X; p2 R    )8 U' \/ _- Z- k! r5 p) z* ?5 U5 t
    (if
) W" W# \1 Z! f( I& k$ g      (numberp eheight)
0 u* L% G, ]( I6 z3 H: r& y, f% m      (set_tile "text_hgt" (ai_rtos eheight))
+ I+ g+ `& Z: a' z$ X      (set_tile "text_hgt" eheight)
" n) Y% ?! `0 S* N+ W' C6 u    ). S" Y! d, W/ q0 }
    (if (not estyle)( F) m) j) K. |  @; V
        (setq estyle "")& G' }# T+ @2 g% @9 K  A  R. w
    );if
. n- ]4 Z( A" {* q    (setq hair_style_list (tnlist '("style" 16)));setq
3 \! y4 j6 ~. z    (if (not (member estyle hair_style_list)), C# K% q4 `: X* F+ w$ Z2 |
        (setq hair_style_list (append hair_style_list (list estyle)));setq
# G- B- t' ^; t2 Z- V' b6 F    );if 3 N7 [5 E0 h5 \6 R* Y" I+ B

' _  @2 i. c5 O" M    (setq hair_style_list (acad_strlsort hair_style_list));setq
! b# Z4 {! A! K    (mpoplst "text_style" hair_style_list)
1 b# j' {: e1 l7 a    (set_tile "text_style"
- S# V$ c- N5 }( l              (itoa (position estyle hair_style_list))
/ E/ c- [9 N$ j# q  A    );set_tile ' E3 P4 B, h: }4 m( B
2 k" [* n2 X% C) S1 h# P, ^
    ;; Disable tiles if need be...  ;@RK/ Q# g5 B9 B) C' |& M
    (setq a 0): l; f; S; Z# ?6 O
    (while ( < a  (sslength ss)). C) g( c2 i3 |3 }4 c. y+ s0 |
      (setq which_tiles! f/ B. F2 D0 O; b
            (ai_common_state (cdr (assoc '0 (entget (ssname ss a))))))
" n/ m9 y6 j7 X
. F! \- Z( W! v) p# S0 `3 |; X      ;; If all fields are enabled, don't bother checking anymore.' h0 T7 r0 @0 N' ?" A2 @
      (if (/= which_tiles (logior 1 2 4 8 16))
5 \. I: ^& w( V+ l        (setq a (1+ a))# D, {- {) }9 k. Z4 R
        (setq a (sslength ss))+ K: p7 f1 }4 x$ f; f
      )3 ~8 a- R/ s+ g  P; w' N
    )
) n. K$ |; a( F0 H, c    ;; Layer Button and Text Field" z3 c# h. b/ X$ O

) P6 A( [  D, h% O$ O$ c    (if (/= 1 (logand 1 which_tiles))
6 f9 W/ B( ]; `; I  A" ~9 M      (progn( |  \# D! \. G
        (mode_tile "t_layer" 1)
) F' K7 n  c! [7 L3 m# ?, E        (mode_tile "b_name" 1)
3 x/ q( ~. t$ }3 `2 @: M/ l- `! C0 e' ?, J      )4 R- C( y  \( {& u; {& O  |" ?
    )& `; F4 m0 ~: A+ ^$ A. k! n: F
# N9 Z1 V4 J& b
    ;; Color Button and Text Field
3 F4 y& `' I# }% \5 b6 p    (if (/= 2 (logand 2 which_tiles))  g  C5 |$ Y- @3 d- W$ |+ A: h/ q
      (progn
; H: V# U8 T, w/ f+ l3 M9 H        (mode_tile "t_color" 1)
: S3 j- c7 C, z/ V( w! J7 _        (mode_tile "b_color" 1)5 k0 E. O0 l1 n" V# `  w
        (mode_tile "show_image" 1)
1 z8 {. W, T' N" d9 ?% M      )
  A; Y  t  N1 e, H6 C    )
, e1 [- B- c! ]! f    ;; Linetype Button and Text Field8 m. Z! g. o2 }. k: G
    (if (/= 4 (logand 4 which_tiles))
9 o0 R: {! y, ^2 A* D! Y$ @      (progn
- j  p9 ?1 E; y        (mode_tile "t_ltype" 1)
: ?" t+ f! ]) \3 h, A  g. M/ {" n        (mode_tile "b_line" 1)
5 G! D+ H3 J- z# j- Y      )
% O9 X, \# T. n( I3 s% w3 [$ H    )7 h$ F( a; u1 b  H
    ;; Linetype Scale Edit Field
# F! j! t9 c9 G6 D. }    (if (/= 8 (logand 8 which_tiles))
% w" A) g* B% `6 X) ~' S      (progn
- t  O# Q( p2 ]5 o, F3 l        (mode_tile "eb_ltscale" 1)
  S3 I- _( y7 Z: J  n! {      )5 O& C2 v' z8 P' P& U8 W6 d& S! ^
    )
) C# d) f7 \6 R" u5 x3 |- b    ;; Thickness Edit Field.
& g, ?2 L( t: ~+ ?* m5 f+ e    (if (/= 16 (logand 16 which_tiles))
, m* k3 Y0 x9 O% W' F% j      (progn
2 x9 p5 \1 p! M% N6 [+ x        (mode_tile "eb_thickness" 1)
% k# p1 j% Z7 ?( b9 ?' b- b2 b      )
; f  ^- d' \1 Q    )
/ j* n9 r1 X* e5 j( p/ ^& p8 |
% {* y  ]# o/ C, g/ K    ;; Polyline box and tiles          @rk 10:05 AM 1/30/978 W+ S0 o2 X6 `  V/ [6 U& f6 D
    (if (not (= 2 (logand 2 eflag)))5 E5 F1 C3 k" ~# ~( g
        (progn& s% V7 y1 B% T) d0 e
         (mode_tile "text_hgt" 1)4 ?# g& J: ]- t9 F$ w0 b+ F! {
         (mode_tile "text_style" 1): ^0 J5 z: t, L; ]2 c+ S& j- n
        );progn0 l- k# U  U$ q& E9 F" B
    );if
; P) g& O3 e7 Q( y- |    (if (not (= 1 (logand 1 eflag)))6 P6 h! A+ e" m/ h: L+ T
        (progn
% _' [0 k& l/ D* ^( ~, A1 @: F5 {) Z         (mode_tile "poly_wid" 1). ^$ b( e' P. S1 {4 c1 p
         (mode_tile "poly_elev" 1)0 U0 Q2 l" p+ c  e. z4 o. t9 Y! T
        );progn then disable polyline fields4 p& |: W9 n( F3 b+ R% x; v
    );if/ Q& c3 K; t4 o8 C! k/ }2 I. b
0 d; u/ w+ w: H; z4 M
    ;; Define action for tiles
0 X+ ~$ D* U# V6 v& v/ E( p: y    (action_tile "b_color" "(setq ecolor (getcolor))")7 d0 p2 T1 h2 ^* j- r# J* N
    (action_tile "show_image" "(setq ecolor (getcolor))")
" t8 v" Q" w1 }4 N. ?  b, J' O( _    (action_tile "b_name" "(setq elayer (getlayer))")
( r5 n; w' v# s2 o    (action_tile "b_line" "(setq eltype (getltype))")- n# T: c6 ]( K( t4 E- B
    (action_tile "eb_ltscale"  "(getscale $value)")
; Q7 g$ B/ o8 U' o! L% [$ t4 ?    (action_tile "eb_thickness"  "(getthickness $value)")( H7 f1 o" H. f4 F* A  g. G
    (action_tile "poly_wid" "(getwidth $value)")# N! N6 G0 O, l0 u3 d
    (action_tile "poly_elev" "(getelevation $value)")
+ m- n6 h- G. h2 V    (action_tile "text_hgt" "(getheight $value)")
1 I1 `, j8 @: S5 E# O4 [    (action_tile "text_style" "(getstyle $value hair_style_list)")
$ m; L( {3 g  H* f- n/ [    (action_tile "help" "(help \"AC_BONUS.HLP\" \"EXCHPROP\")")
( {# w1 h0 B5 u    (action_tile "accept" "(test-main-ok)")
' c5 f. q; w& t' n# D6 d" {- z6 |% h+ V0 v5 \
    (if (= (start_dialog) 1)
6 H) j1 L% J/ H1 o7 ]$ P      (progn
) N- v& s/ v4 Y$ o2 n7 H" |3 W1 c        ; Update special properties for polyline and text selection-sets.
0 ?2 V7 s3 L- N  A( H/ R0 r0 t
2 f! o$ W/ R2 l  s, y        (if (and (= 1 (logand 1 eflag))   ; polylines rk chprop
5 ~- R* T0 e9 C; C                 (or ewidth
$ G9 u3 B* Y3 u/ d- {2 C8 C6 i0 w6 w( V                     eelevation
# Y8 i! k% s6 p                 );or
. d: e, E6 R% Z4 p! Q0 z            );and' h* Y- D3 Y$ n# d9 q& @  x2 Y
            (progn, \1 ^5 {" j  Y8 V  C' _1 X
             (setq  ss-index 0
( b6 o& F  ~( p0 K! [8 i& g2 C                   ss-length (sslength poly_ss): j- ~- i5 L& T8 {4 W
             );setq
" q+ D! `( k# S% e3 N( F9 j             (while (< ss-index ss-length)& P2 h: S5 Y5 c4 D9 V: F+ X
               (setq ename (ssname poly_ss ss-index)
3 d* M  ?  h8 [% }: b* h. V% ]3 L                     elist (entget ename)
, d$ P2 m' K3 g* N; b/ x! O( k               );setq+ B. @. g$ n5 d) b2 ^
               (ucs_2_ent (cdr (assoc 210 elist)));this function lives in ac_bonus.lsp3 K; l; z: ?* {" A
               (if ewidth
9 ]% |! X. K! S1 [" X# M                   (command "_.pedit" ename "_W" ewidth "_x")
- p8 o- N+ F2 v; n, \2 ~3 [+ }               );if
8 c- ?5 C$ t3 `2 H! `               (if eelevation
2 Y+ K3 U+ |! T                   (progn
- a5 f7 U" F+ C) m# B% k1 i7 c                    (setq p2 (list 0.0 0.0 eelevation));setq# _9 ^3 N. M+ Y" c
                    (if (equal (cdr (assoc 0 elist)) "POLYLINE")
  {* p  @( w! U2 x3 _" v7 I' `                        (setq p1 (list 0.0 0.0
4 H& ^% n; A5 o4 N7 p8 `                                       (caddr (cdr (assoc 10 elist)))1 i  Q+ d. c4 E0 f' [3 T
                                 );list9 ?) J' Z! l* r8 B- H7 L4 v: T
                        );setq( B% y' s% k4 a/ O5 {0 `
                        (progn0 O# P0 i! Z  I* w9 c
                         (if (assoc 38 elist)6 c  Z) B1 \- R9 p
                             (setq p1 (list 0.0 0.0
1 F+ I' e, D. d2 j8 X                                            (cdr (assoc 38 elist))5 @9 a* @3 T/ S$ I8 l' a% V1 p7 r
                                      );list
- a/ J" Q: y3 v2 g                             );setq
, M* p$ u& S7 n, z% l                             (setq p1 '(0.0 0.0 0.0))
; R+ O6 M, T! X* H+ ?                         );if6 L+ n- A0 o" E; q3 @, ~
                        );progn
3 k9 j0 k  {$ M5 t4 Q                    );if% I- o7 w4 n: o+ r
                    (command "_.move" ename "" p1 p2)
: p0 R: b) y9 _) {9 V% o. P# N8 n                   );progn then change the elevation of the polyline4 q8 a4 m0 |- U8 k  u9 @- R
               );if
. y% z% x! \/ P- m               (command "_.ucs" "_p")" R, v' ?2 F) Q5 ~
               (setq ss-index (1+ ss-index))
& U  r) ^3 N5 O. R! D7 ~7 {             );while0 G7 {# l( |- k( g
           );progn then polylines are in the selset
) L7 N7 ~5 U: `, P         );if3 Q' {& b* K1 K) T* b( e
         (if (and (= 2 (logand 2 eflag))     ; text( K  \  C1 ~$ l% \+ Q& A* ^
                  (or eheight ) f2 }, O! L4 T/ R' J' o
                      estyle
! }4 p" c; S1 e; H( x                  );or
$ W; A; e. u! e9 O( O  x             );and
8 V7 W; \+ a6 v             (progn  @, F: t) J& q5 m5 ~
              (setq ss-index 0 ss-length (sslength txt_ss))
# _+ Q1 T) i, F. _              (while1 r: ?, c7 [* X3 U! e7 L
                (< ss-index ss-length)- F/ l0 s. p/ X
                (setq elist (entget (setq ename (ssname txt_ss ss-index))))
1 p5 n  L2 P  a1 g; f                (if (numberp eheight)
+ s% S2 s  S& D( V4 f3 _                    (setq elist (subst (cons 40 eheight)
0 ^6 f4 q6 u* X$ a" }8 C5 N. }9 S                                       (assoc 40 elist)4 R% n/ H% _) i" l* m) s4 e
                                       elist
9 a' Z% I! @6 y0 g                                );subst5 [9 H( q8 a. G
                    );setq: o: o8 e3 d  I2 s- C7 \3 [
                );if
4 J5 W; U/ L2 x# k; G5 v- `                (if (and estyle ;(not (equal estyle ""))
$ E) e/ _' D& v* D7 n                         (not (equal estyle (cdr (assoc 7 elist)))): h1 T( _; n+ g9 V  \* h) }/ v
                    );and$ D* G3 A$ V8 ~  V5 u  ~9 {
                    (progn  6 P& F; X3 X8 S4 y6 p* e6 i
                     ;rk. This needs to be implemented as per mtext font issue in                                                                                                          ;    ddchprop_notes.txt
/ K" S& O& p; e                     ;(if (equal "MTEXT" (cdr (assoc 0 elist)))) r0 c" Q' [4 V$ o9 i3 I
                     ;    (setq elist (fix_mtext_fonts estyle
' f+ G6 N6 p+ P                     ;                                 elist. A: j$ ^3 Z3 e- D# j( J. s$ u( [
                     ;                ): n/ c3 D8 l* Z- w9 j& b  J
                     ;    );setq then7 F  j1 z9 `; j) F" t, A$ a
                         (setq elist (subst (cons 7 estyle)
0 C1 i  w5 o6 V                                            (assoc 7 elist)
5 f- ]9 B/ Q' M  t( a' Q1 ?                                            elist
  G( N+ F- Y5 y1 Y/ C  o                                      );subst
2 r- q% P/ ]+ R  j                         );setq else
' M$ t% j. T: X% y2 u" K* t2 a                     ;);if 9 F( k9 ^% |( f1 |4 t) D0 t
                    );progn; w( Q" d6 A( x/ y6 B: l) V$ ?
                );if
7 m; q! d( y; I                (entmod elist)
( W) m+ i) l8 h: q                (setq ss-index (1+ ss-index))# |: w) ?/ q- [) F6 N, p
              );while
! L+ ^0 N6 s$ E- I: n; {% X/ x             );progn then" b2 m5 j6 m6 y  u) K1 z
         );if
5 b' T+ h3 S3 D4 p2 Y  l& R3 V6 e, \' z! r. y1 r, w
        (setq cmdact (getvar "cmdactive"))
$ F' x# b8 C! _, m, m8 p' X        (command "_.chprop" ss "")/ x0 o, a1 |  C8 l
        (if (/= cmdact (getvar "cmdactive"))  ; Is CHPROP actually running?+ p- w' u6 E$ ]  M. e( J* E; S! `
          (progn
6 X% R6 _( ]. ^5 M0 p1 ?! i7 s: F4 k9 S            (if ecolor( W$ o, S6 m: K) w2 x" F
                (progn
( y. }' ^5 f2 s: B( K                 (if (= 0 ecolor)   (setq ecolor ;|MSG0|;"BYBLOCK"))
$ j3 `1 F8 f; N5 c' J$ w+ j                 (if (= 256 ecolor) (setq ecolor ;|MSG0|;"BYLAYER"))9 Z+ u) ~; p9 t$ K4 `
                 (command "_c" ecolor)
4 u" `; L# K' g" s5 L; B% L% r& Z* ~                );progn then
: i) k8 z: G' m1 ?" o  h            )
& k, U6 V& ]% q* y4 h+ J; m# ]            (if (and lt-idx$ d, R, w4 z" L3 H& }
                     (/= eltype ;|MSG0|;"Varies")
' F0 a% ]' A5 M# B7 ?! Q1 N                )
* j9 x  }+ C9 k; P  w                (command "_lt" eltype)
; `$ \8 a( Y& V            )5 {! p: w/ w! U7 H
            (if (and lay-idx + c, b; y9 ^" Q% C8 T
                     (/= elayer ;|MSG0|;"Varies")- ?) f6 y! J* V* I% O5 h
                )* t- ~5 D9 D8 G( ^& u
                (command "_la" elayer)2 t$ ]0 R' \2 z( }$ x# h2 Y
            )# |3 k' W7 O% g1 q
            (if (and ethickness
4 i' I' i4 w' p# \+ R; g& H8 O                     (/= ethickness "")
9 H; e" c8 Q% y; a" O, ], |3 @8 N                     (/= ethickness "Varies")
- b4 v' f) U+ R5 n" H/ `/ n1 Z                )  Q0 G1 n9 ]0 T) e
                (command "_t" ethickness)3 f) S5 A. u3 J: o
            )
! w6 [8 g' J5 D- ]+ Z( I( S            (if (and  eltscale (/= eltscale ""))+ h$ N5 @* D; U, ]* t5 [/ Z' d" f
                (command "_lts" eltscale)  I  S. r, I; L; a/ U
            );if$ e" ?/ N" ]* q, x1 }  b( F; l
            (command "")
: |; x2 E) Z. u. Z          )
! a3 P$ l) t& {          (princ "\nProperties unchanged")  ; CHPROP didn't like our SS set& b# R1 I# @- C' I6 f6 r0 n
        )
! G/ M9 c4 x* i' J. B9 [6 }" H" ^7 g* A9 b
      );progn then OK was picked in the dialog.2 {9 a2 X0 _! `" r
2 R' t# D3 d+ j/ n6 ^
      ;; Fred GERBER - 25-AUG-94
& V: h2 [$ V$ d' x      ;; Don't print the "Properties unchanged" message when the user cancels
  a3 U( P4 d" Z: c+ |      ;; the dialog because he knows that already (otherwise he would have
. D! A" C. X$ f7 ^" L      ;; hit the "OK" button). Display the message only if CHPROP fails for6 ]5 i5 v, C  I! H) t$ W
      ;; some reason, because it is not the expected behavior of the command.
! t( L3 ^& C* H; B  g      ;;/ I9 p" N% [0 z  C# E% V9 D1 I8 H
      ;; (princ ;|DDCHPROP2_LSP_8|;"\nProperties unchanged")
2 u/ ?& Z! _0 a) m7 H    );if
' J4 h4 L& c* b8 b    (princ)% J, E4 R' f, @$ ], n2 ~* L9 n& }
  );defun call_chp2. q9 M' T* r" B" P
  ;;
5 h, n5 `# C% K  L  ;; Function to set the Color text tile and swab to the current color value.% R  y# N2 q- E- R9 B0 D% p3 T
  ;;
/ l8 L8 E1 ?! h: j) ^  (defun set_col_tile()
! u5 x$ g0 z% E0 l    (cond* c) b9 t* I+ _- D+ i+ t
      ((= ecolor nil)
  g6 p3 w9 _) ?2 n6 _. @        (set_tile "t_color" "Varies")
4 a8 S6 R  `* `9 Q        (col_tile "show_image" 0 nil)# ^! x) u' m5 D. t
      )- D4 I7 i  b* x
      ((= ecolor 0)- g# |  z  B' o
        (set_tile "t_color" "BYBLOCK"). H) J% w0 D3 S7 x/ X. `# r
        (col_tile "show_image" 7 nil)    ; show BYBLOCK as white6 c  q! w5 ?3 F0 p% U
      )- E/ N1 B1 P8 ~: a
      ((= ecolor 1)$ a6 ?9 \" X+ z# A2 W/ s
        (set_tile "t_color" "1 red")
! @' J2 O2 f. e9 G8 p2 n9 E        (col_tile "show_image" 1 nil)
7 ^" `2 e. C) n9 p# W6 x      )1 V; S7 Y2 m5 K8 |$ v; E
      ((= ecolor 2)+ D) Y0 n" k/ Z, J/ W! M
        (set_tile "t_color" "2 yellow")
! `( @2 J- T1 ]1 N        (col_tile "show_image" 2 nil): n  t/ c$ O0 [1 c
      )4 {2 C  y; k! @3 R" s7 S
      ((= ecolor 3)! ?5 w4 j" ?  E) c$ o$ f9 V" l
        (set_tile "t_color" "3 green")+ T1 P4 Y- _+ ?$ f) F3 P" O9 _: S" ]
        (col_tile "show_image" 3 nil)" ]6 D5 T% f) \5 g; W6 ]
      )/ ?& \, |, d3 n
      ((= ecolor 4)1 q7 `  d* Y* y2 \. e; [
        (set_tile "t_color" "4 cyan")( i% X- W. X; L: t9 H
        (col_tile "show_image" 4 nil)
) e4 O4 W9 U( P: S( |: d      ), g% K& N( I. U* y
      ((= ecolor 5)
: O8 `  z# d4 }% I        (set_tile "t_color" "5 blue")
( N' u( J; f3 b. D        (col_tile "show_image" 5 nil)
* Z6 g  ]7 ?& d) V      )
4 z. S' W0 d) `- x3 {9 t' u' t      ((= ecolor 6)
, E4 w. M' x1 f8 `' E  Z        (set_tile "t_color" "6 magenta")
. b' h) c1 r7 j8 F4 F3 ~2 s$ e+ R( J        (col_tile "show_image" 6 nil)- l" @) U* ~3 ]2 |5 j
      )- K* J$ X6 `; q7 h
      ((= ecolor 7)$ F! {6 F( d6 H% @8 f% m2 o- |6 n
        (set_tile "t_color" "7 white")1 ^$ R2 v+ g8 r& K+ b' u. [
        (col_tile "show_image" 7 nil)
$ _( A# N/ a& u$ L      )/ R/ Q! E  b1 G" m# B, ^
      ;; If the color is "BYLAYER", then set the tile to! k$ o" P/ U9 N8 H. p
      ;; show it's set By layer, but also indicate the$ [- P( }$ R& v' B& w
      ;; color of the layer - i.e. By layer (red)
: |. ~4 F& O' u7 f: X      ((= ecolor 256)& S6 e; [6 u& z6 {) w# ]. L
        (set_tile "t_color" (bylayer_col))
, A: ?8 E5 u& J% J* e, K        (col_tile "show_image" cn nil)
, k" l; K- e- z      )& K9 n- ]6 {3 V( Z+ G9 Z
      (T9 P. o7 x5 A$ W0 p. \1 i1 B
        (set_tile "t_color" (itoa ecolor)); n; F5 `4 n+ W$ F9 {/ N1 x. ^
        (col_tile "show_image" ecolor nil)1 x" W5 [: C( b4 b2 B0 x4 W
      )
& b' i% `0 ~8 X2 O( x, Q    )/ ^; W1 J) I& u, u+ {1 a
  )9 `4 o0 g5 Z8 k; }7 A* k* Q' ?
  ;;( O/ ?/ w) j- |5 X' `
  ;;  Function to put up the standard color dialogue.2 C5 f0 v$ o2 f% _3 G
  ;;
% g( g$ h' A9 v7 j% a  (defun getcolor(/ col_def lay_clr temp_color)% }# s* {3 U3 q6 T$ n6 A
    ;; col_def is the default color used when rq_color is called.  If ecolor
- Q1 s% j. L+ o6 D( \  [( G    ;; is nil (varies) then set it to 1, else use the value of ecolor.
6 o8 L( R9 g) P; V& O8 ^: ?& S    (if ecolor
* g7 _( B! D* m7 x3 z2 W      (setq col_def ecolor)
& G7 z* ^: }( Q6 \; F      (setq col_def 1), ?$ s, C# S, B
    )6 E0 b( m. D% n
: s# q3 a& R. X  h+ h3 ~
    ;; If we're working with a single layer, get its color
# q6 }5 C# }- y5 j* R    ;; for use in the color swatch if the user selects color BYLAYER.
5 p8 b6 H! c1 n8 i    (if (/= elayer ;|MSG0|;"Varies")6 m% |$ x$ T+ c4 P* L( `
      (setq lay_clr (cdr (assoc 62 (tblsearch "layer" elayer))))" o; r  @- J9 O4 o, o. T: l! H5 M8 n1 f
      (setq lay_clr 0)
& u) @. {* n0 k0 z$ B    )
& l$ V( h4 L3 S2 j    (if (numberp (setq temp_color (acad_colordlg col_def T lay_clr)))& B3 S! I. Q) O1 T7 _; c
      (progn  C& H5 c6 Z9 y
        (setq ecolor temp_color)
5 }1 f# K# D/ L0 I        (set_col_tile)
2 ]. Q5 o! p) z        ecolor
" N& ]- H3 ^/ K9 _3 L) t      )
! Y3 y/ m( L: a7 n( n5 l: w      ecolor( u8 Y8 w- p) _) V4 |
    )" ~( g0 w/ C" k0 P( R+ h
  )
( x% P4 i. o2 u$ u" ^7 x  ;;
* M0 X; |: g0 o; m6 i1 N% T  ;; This function pops a dialogue box consisting of a list box, image tile,
  i: a1 ]- [$ H+ J9 ^" j  ;; and edit box to allow the user to select or type a linetype.  It returns
4 U0 Q5 z4 c" {- b' M: ^$ I/ u  ;; the linetype selected.
1 e; c! U& h) K: w  ;;
9 a+ {. F4 c, d6 p/ H  (defun getltype (/ old-idx ltname)
+ g7 ~& U7 V! [2 H    ;; Initialize a dialogue from dialogue file
) P9 n/ `5 e0 z" m9 A3 w/ c5 s    (if (not (new_dialog "setltype" dcl_id)) (exit))4 H' P' E+ ~+ U
    (start_list "list_lt")
0 @2 c3 s6 x" N4 d$ c    (mapcar 'add_list ltnmlst)         ; initialize list box$ U8 |4 A6 c0 q0 \% z1 T! `
    (end_list)! l/ u- v6 g( @0 ~7 M. T% E8 ~6 m, P
    (setq old-idx lt-idx)7 Z) X6 a; H) D: K1 j; M
    ;; Show initial ltype in image tile, list box, and edit box3 A$ V) C( {: }( ]4 [
    (if (/= lt-idx nil)
* D+ ~. }. Y" @; J2 x; P! |5 f9 s  V& @        (ltlist_act (itoa lt-idx))# S8 V, {- Q- q9 W; x. X- m4 p
        (progn: f: I: O6 R& A/ d' p
         (set_tile "edit_lt" "")
) ~* G$ k" o6 x; @4 a! ?         (col_tile "show_image" 0 nil)
. c! G# }5 J% H: _& T9 W: p        );progn else
+ d$ f$ [, N( b! `3 _    );if
# O! [7 q3 H) l- A    (action_tile "list_lt" "(ltlist_act $value)")/ B( u2 t1 M/ Q# q2 r
    (action_tile "edit_lt" "(ltedit_act)")8 a' @) r0 j/ s; R+ q9 w# }; g% u
    (action_tile "accept" "(test-ok)")
$ e$ N  ^6 H2 ^  e+ H& Y* |# t    (action_tile "cancel" "(reset-lt)")
- L* M) @% k+ _4 M% A    (if (= (start_dialog) 1)           ; User pressed OK$ o% r% P2 @7 c" I  h( {% M# M
        (cond& m& o7 S+ P: E7 c& M' n( K
         ((or (= lt-idx nil)) E" f% _6 J5 ]' |  Q; m' x
              (= lt-idx (1- (length ltnmlst)))) v/ k5 T; \/ v& E& ^/ P- y* k
          );or
* G& E9 i0 f6 F  V. [% ^* a2 w# r5 Z          (set_tile "t_ltype" "Varies")
0 A6 m! C" H, t& H          ;|MSG0|;"Varies"6 S! s1 ~0 U0 V" G% N2 A4 L1 C
         )1 m1 H/ @$ z8 q. y/ o7 f6 H" G
         ((= lt-idx 0)
' i8 {' `  u: Y* q" p          (set_tile "t_ltype" (bylayer_lt))
" b) m% Y7 \: X           ;|MSG0|;"BYLAYER"  ?" }( B" z0 B/ @0 F
         )/ f/ q) z) g' T& U( `
         ((= lt-idx 1)3 u9 f( R; [: E& D) a9 i5 y* J* U
           (set_tile "t_ltype" "BYBLOCK")
9 [' C6 J& i5 n! Z$ T5 u0 i           ;|MSG0|;"BYBLOCK"
8 }- S% R# a! x+ k         )/ T2 Z' z, I2 a3 C4 U% c* A
         (T. E2 i' ]2 |* A0 v- }
           (set_tile "t_ltype" ltname)
6 q+ C  a+ W+ d* j3 I% C           ltname
2 l3 W- A; p  @3 W         )& P$ U# K9 y0 w: m* W: }
        );cond then2 g! w5 E8 j* x
        eltype
4 b, j2 B2 X2 O- n/ y9 ?9 l    );if3 a% O6 P. P2 z9 z
  );defun
% P; ^9 c  D* d3 M' R" I  j/ P  ;;/ H, \& T2 }+ w  I' ~0 f1 m
  ;; Edit box entries end up here
- w$ M$ |' ]9 L0 M% X; k  ;;
4 t) w& b- m& h4 H/ v- L5 e: w( N  (defun ltedit_act ( / flag)! Z4 {3 D& Q  O0 ^0 Y" @
    ;; If linetype name,is valid, then clear error string,! N2 q9 E  o$ m* k5 X
    ;; call ltlist_act function, and change focus to list box.) N5 @' `( v2 G9 l# x
    ;; Else print error message." {' h/ r! e, w$ m

; ]# ?+ d: E& L( S% p    (setq ltvalue (xstrcase (get_tile "edit_lt"))), X! O! u2 l3 l0 ]7 H7 J* s# @
    (if (or (= ltvalue ;|MSG0|;"BYLAYER")& K, {/ b- W: x. l; m% z8 W
            (= ltvalue "BY LAYER")
- Q! p! E# A5 G6 d5 f        )
3 i, b1 `) N- X" x" l0 U        (setq ltvalue "BYLAYER")' F1 m/ E1 p+ u+ J/ b, I2 t
    )
* u% [3 ~& b0 T* L5 w    (if (or (= ltvalue ;|MSG0|;"BYBLOCK")
1 R' F! }8 L. }" i' w            (= ltvalue "BY BLOCK")' f5 `2 F. p; |' W7 `, X' v
        ); z0 P1 X( P: Z0 n
        (setq ltvalue "BYBLOCK")
4 K. l# y$ O* f' j4 @! V3 h" t; M    )
- L) t$ O# G- x% o5 I( o    (if (setq lt-idx (getindex ltvalue ltnmlst)); |- |& T! q0 G+ J; J5 @% m
        (progn7 y& r+ p9 H5 b, z4 T
         (set_tile "error" "")
- H2 k$ ~, o$ |4 Y9 P         (ltlist_act (itoa lt-idx))
  E1 |! x5 M- J; G9 W4 H         ;(mode_tile "list_lt" 2)8 }: ~; J: S' A6 o1 |: O$ ?9 N, p& \
        );progn then$ B- b" _# v, D5 p' J! T
        (progn
' q) i' C& R8 k9 y9 Y2 D9 i" P         (if (/= ltvalue ""): l: ]- a1 s! a0 ^. Y1 r/ f4 b
             (progn
* P( {: L9 h: W3 s               (set_tile "error" "Invalid linetype."): G1 H6 V# b- D/ ]8 j  ?
               (setq flag T)
: U, T1 b3 t: S' Q7 I! _             );progn
! a& J! R: s+ [# G         )
7 A- R' P8 d( s3 H1 S         (setq lt-idx old-idx)* F( r6 M5 N4 h" n9 ?0 l0 ]! g
        );progn else
: @3 |7 e. D7 l/ M7 q( z    );if3 T- t$ e, z/ K" M- W2 j' k8 M0 G
    (if (and (not flag) ;added so a return will take you out of the dialog.
- }3 i! s* P" g* q% _             (= $reason 1)
: N7 W% p' \0 S, ]0 F0 D4 Y$ x- V        );and0 ?6 j* r) P. T
        (done_dialog 1)
0 K  K& z& j7 u( Z% B: i    );if
6 h. A1 B# V: v  );defun ltedit_act0 `+ S% t7 i) \. }. u, f! b8 Z
  ;;
% w! S. P5 p5 D  ;; List selections end up here
& r( y5 L# z4 O5 _  ;;
9 M6 R) y& c5 V" j1 u0 ]+ u  (defun ltlist_act (index / dashdata)
9 n3 G" `/ d# f6 }    ;; Update the list box, edit box, and color tile3 ~. c' s* y1 u3 e
    (set_tile "error" ""). ?1 L* a* ~; h) V, Y$ s# W
    (setq lt-idx (atoi index))  r4 m  E3 j$ r" n' O) d  G& t. ~
    (setq ltname (nth lt-idx ltnmlst)). p6 d' _2 S- y& x8 o$ k# R) {
    (setq dashdata (nth lt-idx mdashlist))' c4 m- f4 j3 e* Q: W- f
    (col_tile "show_image" 0 dashdata)
$ E9 f; x* n, {1 _6 `( h    (set_tile "list_lt" (itoa lt-idx))
' w( o  z6 M, c    (set_tile "edit_lt" ltname)4 u2 B/ {% _! q8 j
  )3 k/ a7 o  M. M; o2 O2 [
  ;;
2 p4 ^( r! A5 {  ;; Reset to original linetype when cancel it selected' N# R' H( T+ _7 o
  ;;/ {, Q: b, @' l
  (defun reset-lt ()
0 @5 h' @% B9 U0 D    (setq lt-idx old-idx)
* x% k6 p7 O% E4 y9 r" m  U    (done_dialog 0)$ P, ~3 ^- o7 K4 A  ^2 T) o
  )
9 v! b7 [) g: B% s4 M  ;;
. n! z6 N. \; j( @  ;; This function pops a dialogue box consisting of a list box and edit box to
) O4 E% b, V" f, I# r2 Z8 Y  ;; allow the user to select or type a layer name.  It returns the layer name
% W- ~4 r  K0 [, u6 m  ;; selected.  It also the status (On, Off, Frozen, etc.) of all layer in the
! d) q* h- t+ M$ s& j+ Q/ F) Y6 h  ;; drawing.1 o0 p5 \  a1 X& R0 r" j5 @1 K
  ;;
6 v1 t3 o3 |$ U. p8 O" F$ p  (defun getlayer (/ old-idx layname on off frozth linetype colname)
  q2 h6 d8 n; \0 s7 v    ;; Create layer list the first time the layer; C0 B% O* F' i. u
    ;; dialogue is called.
1 C; F7 F: I/ S' u8 u' k6 P3 i% n& H    (if (not lay-idx)
5 Q& p" S0 s$ K' O/ T; v# C        (progn
" [& n! ~; W  `' `$ b6 |         (makelaylists)                     ; layer list - laynmlst: H+ G- C4 u3 U
         ;rk  M& p8 H( d$ @* J6 @9 Q
         (setq lay-idx (getindex elayer laynmlst))
: D+ K; h% Q% e  {* m9 u' r        );progn0 @1 t# Y0 L3 o- O) g* E
    );if
( s5 g' g( L+ _" S
" N% j" E- v5 o    ;; Load a dialogue from dialogue file) w& C' l: p5 A2 E
    (if (not (new_dialog "setlayer" dcl_id)) (exit))
- Q  `' Q( E/ p" ~, W: _    (start_list "list_lay")
) v( p1 d0 I! A3 E! h* ?2 k$ d    (mapcar 'add_list longlist)        ; initialize list box7 l8 W1 V2 S1 ^5 L7 W( f: l
    (end_list): S  f- r& X! w. s: j
    ;; Display current layer, show initial layer name in edit& ]( Q$ j6 H- y! s5 S$ u4 T0 V
    ;; box, and highlight list box.1 u( N1 ?) A5 j, Y$ }; o( m
    (setq old-idx lay-idx)
" m  a1 z9 c; F* S* V5 I    (if (/= lay-idx nil) (laylist_act (itoa lay-idx)))4 ~- X8 Y7 H# t5 c" \
    (set_tile "cur_layer" (getvar "clayer"))) n  `5 d5 v2 ]( f0 U/ F8 M) n) o0 u
    (action_tile "list_lay" "(laylist_act $value)")/ {4 r5 m- y6 Z% A8 Q  m
    (action_tile "edit_lay" "(layedit_act)")
8 I* G: Q* j; G/ m( E    (action_tile "accept" "(test-ok)")
% w: N$ H/ I: N    (action_tile "cancel" "(reset-lay)")4 `" Y( b) Z! M, M
    (if (= (start_dialog) 1)           ; User pressed OK$ S- l, f1 \  j. X9 o
       (progn) i5 r+ q) `9 O9 y
         (if (or (= lay-idx nil)
9 d. _; K* N- M+ W' N                 (= lay-idx (1- (length laynmlst)))1 |! ^% @' s+ d3 @& M2 V$ C
             );or
8 j+ a0 P5 ?. s/ S             (progn
, n+ D' k% y" {- Q              (setq lay-idx nil)  7 D* m8 b3 `- ?$ L7 A
              (setq layname ;|MSG0|;"VARIES")
) {/ o  y- @$ l3 q2 s1 F              (set_tile "t_layer" "Varies")7 L# S, G' _- H4 R% D) K' L
              (setq layname "")# f5 `8 P' n/ p. @/ X
             );progn5 V6 B' U! g2 P5 V
             (set_tile "t_layer" layname)& [  m1 ~6 A1 h% R3 A
         );if! u9 y! _4 x$ }$ p
         ; If layer or ltype equals bylayer reset their tiles
* D5 U% B& I" U0 }+ G         (if (= lt-idx 0)
/ F5 G# O0 V" F             (set_tile "t_ltype" (bylayer_lt))
% V$ _  v& X; P% M( d         );if+ `: |- u  s' U/ r
         (if (= ecolor 256)
( g2 Z% |4 x4 F- q1 u             (progn
! o- c- g6 n' F              (set_tile "t_color" (bylayer_col))8 z( z5 X4 Y# y7 D! K1 o/ |" e3 T
              (col_tile "show_image" cn nil)
# i9 J! @3 y# P4 m* O+ e; }             )% i8 b- O" C& G
         );if
6 v3 j0 c% w/ R5 f' j9 ^         layname' u4 w$ q! F, x3 a, Y& t/ X
       );progn) C0 ]2 z: p3 H! N/ A* z3 G1 r
       elayer  |8 [% l$ L2 V/ y% Z- ?
    );if6 P6 W6 l  Q: I  f, t) I% `
  )5 `, E5 T0 ]. t% S* Q7 u
  ;;
: s$ |" M% ~: D& k7 e1 p3 P  ;; Edit box selections end up here3 L/ l' J4 w( r2 k7 d6 z4 g5 W
  ;;
; o( m+ k- m8 B# r  (defun layedit_act()8 L9 F8 G& ]$ t
    ;; Convert layer entry to upper case.  If layer name is
9 ~3 O* K! h* ~3 w    ;; valid, clear error string, call (laylist_act) function,9 B$ S# v0 g$ f! n' M1 T
    ;; and change focus to list box.  Else print error message.+ b, y7 t  I" v8 V/ t
    (setq layvalue (xstrcase (get_tile "edit_lay")))
3 |! A5 q1 I; }2 K    (if (setq lay-idx (getindex layvalue laynmlst))- s7 J: {" \: g& e9 ^# p) F
        (progn2 c8 j8 T- p, q; u
         (set_tile "error" "")' _1 q: ^+ z! T' Y
         (laylist_act (itoa lay-idx))
/ K  _8 N! L( ]2 W        )! |1 X4 I  n- G+ f: y8 ?! d1 P
        (progn  }3 Y3 X0 l& v9 B7 s
         (set_tile "error" "Invalid layer name.")
6 S( B" g+ u; l1 f( E) W0 G4 c8 ^         (mode_tile "edit_lay" 2)
. }3 [' S! x7 c4 l) [  k0 R: L5 P; _: d         (setq lay-idx old-idx)
  ?! u# c# e$ P. U) t- }        )
  U6 ?$ q+ L  u" N/ J    );if! h% n/ E' ]4 Z% R0 Q! X7 j2 B
  );defun
. K3 R2 c& G4 F5 V  ;;0 k7 }- p; X4 p1 n# H
  ;; List entry selections end up here$ ~- Z2 X& ^" L$ W! R9 [+ R
  ;;& n7 h# C( Y" y7 R4 j
  (defun laylist_act (index / layinfo color dashdata)5 k$ ~, B7 g: y( e& @# G* v6 S! w
    ;; Update the list box, edit box, and color tile
, x0 i+ _, ^) j# U7 P) p    (set_tile "error" "")1 s( L1 d; [' _% z. T% v7 c# j- ^
    (setq lay-idx (atoi index))$ r+ e( ^4 s! N8 T( `
    (if (not (equal lay-idx (1- (length laynmlst))))3 g! p+ _2 x4 k6 w& `
        (progn
( J3 j7 q2 P3 @5 f4 {9 O9 \         (setq layname (nth lay-idx laynmlst))! v9 S4 x3 T- \2 a  E) r! ]$ x
         (setq layinfo (tblsearch "layer" layname))) w9 U: s' O7 l- t" g
         (setq color (cdr (assoc 62 layinfo)))
3 m, S5 X  D( k, |: i         (setq color (abs color))2 \, n) K7 F1 |' h% i
         (setq colname (colorname color))
8 s! C% W" A0 p7 B" D  I  z         (set_tile "list_lay" (itoa lay-idx))
0 r; C, m, }. ^% d" N% o6 B' p+ v         (set_tile "edit_lay" layname)1 V: Z" x5 g( l3 H. ^
         ;(mode_tile "list_lay" 2)
* W. ~$ s9 O: L        );progn then
. d; A  K  p' o$ h0 P  _        (set_tile "edit_lay" "")
. R4 u9 @0 V9 e    );if " K, j5 c3 u; I2 P, `
  );defun laylist_act
7 ?3 s) O; W& t8 a5 K( q/ y$ {  ;;* j3 h# L* W  O0 D2 I
  ;; Reset to original layer when cancel is selected
& v0 Y: q* f! b  U% S  ;;6 ^* N: J" P7 N% Q( }
  (defun reset-lay ()
' \* K9 h) w8 X    (setq lay-idx old-idx)9 O2 }# Y: [6 |  g
    (done_dialog 0)( H1 k2 p, {" b) q
  )/ [4 M8 }7 Y- W" R$ b& d0 _  `
& O6 s  ?; W0 b2 X2 E5 j
  ;; Checks validity of linetype scale from edit box.  It checks to
  \: l  p$ F5 b0 d6 l6 [7 t  ;; see if the value equals "Varies".% V' @0 H) w4 C# w, Z& ^

# Z4 B; x% f  h' I! G# m, ?  (defun getscale (value / rval)
( j7 K+ z2 ]; ~- Q5 B* X; o; N    (setq value (strcase value)5 e4 m, u7 u; [: m/ E; {
           rval (distof value)0 k  l4 ]" {/ [6 i/ ]7 b
    );setq
" X5 q. Q: M: r( u2 r' F8 j" M    (if (or (= value ""); H5 _6 T3 I4 J4 l/ P! ]
            (> rval 0.0)* ^% C8 ]" S. s0 X# u
        )2 m. h0 W# A& r3 v
        (progn9 z: N8 M* j+ r. g, K
          (set_tile "error" "")
; B" a- a$ Z( K8 d0 |! e1 U" I          (if (= value "")+ ^4 a) y1 y0 \; T6 H7 o
              (progn+ e0 R  f: u- C0 ^
               (set_tile "eb_ltscale" "")8 U2 z& H' ^3 k" _
               (setq eltscale nil)
1 t( @' T( z: N              );progn then4 W2 }8 H/ i/ @7 R! W
              (progn
2 O; b8 |5 C/ }) h$ z               (setq eltscale (distof value))
8 K3 L) R" {3 \( Q. \$ u; L8 Y               (set_tile "eb_ltscale" (ai_rtos eltscale)); I4 D4 [7 z" B; m9 r
               eltscale/ \8 U& z% W  Y( o! m! [( s+ d
              );progn else& z4 O" R( b/ w: j* R2 |. S
          );if
5 H# p& d' H0 N        );progn
# v3 j2 P  T) Y7 H9 u- J7 S$ s. E        (progn
( l3 ^5 l* ^3 |4 [: g9 I# q& {4 q. Y         (set_tile "error" "Invalid ltscale.")
- A5 H6 I( P( }9 f( e         nil) ]4 a; V( P5 b) K0 A8 a
        );progn else+ Q5 A8 l0 Z0 d. l8 h' b
    );if
  M8 a, d/ [/ y( r6 Z  );defun
9 }& l5 K# F7 R6 @2 n$ y  ;;
! h" l7 _4 N* h. j5 X2 T  ;; Checks validity of thickness from edit box. Since (atof) returns 0 when a
; t: g9 a/ X' K6 v! u( p2 n  ;; string can't be converted to a real, this routine checks if the first% w" Z2 c" c3 K# A! Q
  ;; character is "0".  It also checks to see if the value equals "Varies"." g4 y* r7 `0 M8 \; Z; z+ a) S5 ^
  ;;% X3 M( t2 C$ N  e5 @, b! v
  (defun getthickness (value)+ ?8 J# F& m; s1 j& ~( p4 G( d
    (setq value (strcase value))
1 [# V' a" K+ S7 k' D+ ?; m    (if (or (= value "")
4 N) F. f4 G$ a. S; U; D! \            (distof value); y! U, ]8 k/ }( q7 ^4 N  e- ~& s
        );or
' q$ _" a) b" g+ q        (progn- E0 I, l7 ~) s, c
         (set_tile "error" "")8 D0 d+ N" M0 y* [/ C
         (if (= value "")# b$ r) j& T/ @! f- p1 L6 ~; }
             (progn
, r6 ~0 L; _8 ~              (set_tile "eb_thickness" "")
8 m  w) b8 S3 J4 t; u; h4 Y% L5 F9 ^              (setq ethickness nil)& @& g1 M0 b; i1 f! z$ G
             );progn
+ Q, }+ {% N8 T. N1 R: H. C             (progn
1 q% J( [) V/ g7 D+ @6 o! c              (setq ethickness (distof value))
! m3 |. ?1 s7 ?, c" r# B: @" o( Z/ G              (set_tile "eb_thickness" (ai_rtos ethickness))
2 V1 p, D* E) ^2 ]              ethickness
# J! Q* z2 ~; j6 L# E: Z4 i/ p) q: b             );progn
: m$ E! O$ S6 B! b         );if
4 U; F8 I2 l9 E, B3 u        );progn
; B. ]- Z# t9 I; S8 z        (progn7 ^9 x; k7 ]9 o
          (set_tile "error" "Invalid thickness.")* p) m7 b6 ^! c0 q( @) Q
          nil
2 e4 v: y7 \( M1 w: ~        );progn
( x' Y. @! D8 O  W  e! ?    );if
3 F5 e& W  N$ |5 f( j" Z" K# _& k  );defun * J# B, V1 g& x7 n& \  ?6 m, w; {
  ;;
' h. C0 H+ m& t! z9 c  D. k# Z  ;; Checks validity of polyline elevation from edit box.5 C* P" u* r) U  u! j7 K8 N
  ;;3 X( }( a; C8 ^5 S& l9 H, J% d$ ^
  (defun getelevation (value)! O$ P* ?+ Z5 S# Y' p0 J$ c7 _) M
    (setq value (strcase value))4 z( U. h+ M/ V" d' [
    (if (or (= value "")
6 B0 U' M" C1 A+ E+ Y- Y            (distof value)
  l; N7 m- b2 R( ^        )
, w  w; X. n9 N/ S4 t7 f        (progn
. V: ?) f- Q. {* [9 ~6 q         (set_tile "error" "")0 F' ~* j6 e7 j5 k
         (if (= value "")5 ]/ |* n: I$ O; P+ l% X7 j8 N
             (progn6 Q4 `8 k4 y% a# m# L, m: h2 l
              (set_tile "poly_elev" "")
2 h, |" m1 k, j              (setq eelevation nil)
: Z  I3 f5 z+ j& j1 @7 H0 i8 ?/ D             );progn
9 n  s/ w5 Q( W' K" x9 E- B% x             (progn
+ W/ V& ^% d: H' K              (setq eelevation (distof value))5 @5 s: k  S4 D3 s
              (set_tile "poly_elev" (ai_rtos eelevation))2 Z" P  R- }$ R6 k0 }, `
              eelevation' @9 Y& d9 v' l* ^, Z1 U2 Y/ e
             );progn
+ R% e2 B3 ^  F6 w0 y0 N; }         );if6 d" m, y" `# L5 l; H6 j6 p
        );progn
# l: a5 Q7 E4 b( g        (progn# N5 I- a5 }. Z3 ]# [- y
         (set_tile "error" "Invalid elevation.")
0 S" ?1 e9 ?- X* k3 d9 G         nil# k; X7 m! k+ S' j
        );progn% s6 ]1 s( `8 b, f. X, `% t
    );if
: ^7 v6 }& p2 Q4 V$ P3 M( [' w  v, i  );defun& c' L4 j9 v3 Q5 t1 Y7 D* z
  ;;. M0 C" Y  j6 \$ T
  ;; Checks validity of polyline width from edit box.7 A, m) g0 l, S( S+ K
  ;;
/ g4 z, a+ \2 g; A  (defun getwidth (value / rval)5 d9 y* d# f. L0 ^  l
    (setq value (strcase value)) u. @4 [, c4 [# P7 C$ u1 A
           rval (distof value)! W- l. A: x8 a. E" Z
    )) d* P& R3 A, {; P
    (if (or (= value "")& V# c& C4 O1 P% P
            (>= rval 0.0)# n$ B% p/ U& c
        )
5 O: @( {! Z: r        (progn- D5 B. o4 a3 s" G$ G* n, w
         (set_tile "error" "")
, ~  X# ~  i5 t& m6 P! X: T         (if (= value "")0 \1 _% t) q5 B
             (progn
/ t) F1 T7 V$ W2 t* S              (set_tile "poly_wid" ""). S0 @; K2 t" n4 z9 l0 M
              (setq ewidth nil)
5 A2 K2 ^; t4 D4 y: F0 d& C             );progn0 g9 w5 Y+ n+ S1 F( o9 D" Q4 S% n
             (progn$ G: F0 ~2 \# y# C
              (setq ewidth (distof value))7 i* Y. e1 }  D  b* p
              (set_tile "poly_wid" (ai_rtos ewidth))3 e2 q4 G/ a! `# y
              ;width
# y+ p4 j+ D( \             );progn4 R1 D  F# n+ O" t- d/ \6 p
         );if& |7 h6 U( s0 W* I( @( u# e/ w
        );progn: _! K9 @7 V1 l" H" f3 g
        (progn
& @, b5 t: b9 E" K5 K$ D7 o         (set_tile "error" "Invalid width.")
5 s5 o/ E6 |, t& w         ;(setq ewidth nil)
) ~4 x# M/ M- ~         nil 1 D6 P6 d2 y' {; P6 l: M
        );progn
9 i$ F8 j/ y/ \0 Q* I" i9 W% @0 V" A    );if$ g/ {) C, t/ N5 }6 h# b5 a  n  i$ Q1 E
  );defun2 n* h3 l$ Y9 n
  ;;
; Q7 R' K( k2 M; z  ;; Checks validity of text height from edit box.
, I( n8 Z5 \- b7 L6 r  ;;' j/ X9 s9 a6 X& e: {' {* y( i
  (defun getheight (value / rval)
3 T/ M' w6 \  u8 M: N1 F    (setq value (strcase value)
# I( j2 A8 w' }7 m; [$ m1 ]& s# k2 p           rval (distof value)
. @. y% x8 o) ~- U) z/ r% {1 |    )$ K* |, P# c$ o; ~
    (if (or (= value ""), V+ S0 h& ]) Z+ _( s7 O
            (> rval 0.0), {' k% p  W8 G2 p) ], E) H
        )9 _- q' d' o  w5 w, }
        (progn# k8 m; O/ A0 m' V% b
         (set_tile "error" "")" T1 }0 I2 t5 S) v
         (if (= value "")
, f0 U2 f* o  `4 j" L0 R             (progn
0 {/ U0 I3 E, ^) j, M              (set_tile "text_hgt" "")
7 z  ]8 }: [+ V4 M0 A; g& K8 u% ?4 J% C              (setq eheight nil)0 y1 [$ w# d  C$ f  |+ O) Q4 X
             );progn
' a" s& P4 u" W! p3 j5 h; X             (progn8 R: @; a! s/ S
              (setq eheight (distof value))
  Q3 }/ X$ L' W3 D              (set_tile "text_hgt" (ai_rtos eheight))9 e$ _- a# V1 a
              eheight  x+ E( |7 f2 f+ `0 ~7 h
             );progn5 p# @( l7 l! S2 }6 F( \
         );if
: e  u0 h9 O$ m        );progn' F6 w4 E' u. c, c
        (progn
, t* K6 a9 k4 p1 M+ }+ x  \' M; F         (set_tile "error" "Invalid height.")0 Q3 v1 R1 Q- d% Q
         nil
+ i1 \, N3 o% r+ M( ?        );progn' F' A5 b2 X+ ?! f+ b5 k
    );if
. j: q5 _6 i8 p7 J. c  );defun
+ k$ {& s8 l9 R9 y# c, \
3 T; r+ K3 {6 f$ M! I7 O  (defun getstyle (value lst / rval)2 G6 x# X/ h/ _" D- p% |2 x: P
    ;(setq value (strcase value))
# `1 Y; V' Y6 u% H6 ?    (set_tile "error" "")
7 G% n, V: [" q1 h1 o3 Z2 X1 I    (setq estyle (nth (atoi value) lst))( r5 Y" c  \2 K$ l) y$ W9 C; L
    (if (equal estyle "")
5 h# c8 k" m$ Q4 S( q        (setq estyle nil)
, X$ G' r; N; O. n  T5 Y    );if1 ?6 }5 W: k$ o7 q: C

* ]  e5 H1 a) y/ _! S  );defun getstyle# A+ o" U4 Z# C; a/ U) O
) R) e& k8 A2 U" t. k8 }
  ;;) y2 d) m  S  E
  ;; This function make a list called laynmlst which consists of all the layer
: d( f" m+ j! b. k* b) H  ;; names in the drawing.  It also creates a list called longlist which# k0 g" v2 R  z1 {' {  b4 c
  ;; consists of strings which contain the layer name, color, linetype, etc.+ J7 T( z) o; d" M) }
  ;; Longlist is later mapped into the layer listbox.  Both are ordered the
4 ~/ s& r( R# D( R  ;; same.$ Y7 O/ B$ Q5 I1 c
  ;;& [" ^6 X$ H5 O) M: ?5 g$ w
  (defun makelaylists (/ layname onoff frozth color linetype lock vpf vpn ss cvpname' z/ T7 `' a7 E
                         xdlist vpldata sortlist name templist bit-70* \8 N: S* i2 |' D# F( Y% u
                         layer_number
0 A5 `+ L  M( H! ?                      )
- u0 O4 Z' X' V6 M/ q    (if (= (setq tilemode (getvar "tilemode")) 0)* P# X! j% Y0 j
      (progn
! @$ [3 f6 b: d1 s1 g3 Z        (setq ss (ssget "_x" (list (cons 0 "VIEWPORT")% ?. h- h* r/ k$ f3 ?/ J& P3 U& a
                                  (cons 69 (getvar "CVPORT"))% T  r9 q5 i: r* i0 s/ v6 o$ G
                            )9 [1 ^* V9 i9 W" V% s# \* F5 U  r
                 )
3 ?; M5 t  v+ Y( |% v2 R9 @: g        )8 ]- r3 P6 e( C& b
        (setq cvpname (ssname ss 0))
. a$ K5 [0 t! K- z+ S0 k        (setq xdlist (assoc -3 (entget cvpname '("acad"))))
5 d2 ]7 o& I% m/ ]% l/ |* f        (setq vpldata (cdadr xdlist))
0 L, {4 V! y7 K' V      )
. R: r# b* Q( h2 X9 R# T    )% m, l* H: d+ c; @3 D, e+ R6 f
    (setq sortlist nil)0 y: C" h' a, k7 f* i* i6 s* N
    (setq templist (tblnext "LAYER" T))4 x$ _# o% n. P/ L( [7 |8 k
    (setq layer_number 1)
# k4 X  S- K+ g; O; W1 s: i% R    (while templist/ x+ S3 q0 G1 y- n' R
      (if (not (equal 16 (logand 16 (cdr (assoc 70 templist)))))
3 L, ~! H, \- R* N* r( Z, W          (progn  - z/ W: H8 B0 M% V) F) [. z  C
           (setq name (cdr (assoc 2 templist)))
6 H/ o; S, L; H/ f           (setq sortlist (cons name sortlist))& n: e% E. {5 {! M9 o0 o
           ;; Not dead message...
& A* ~! n' X/ y           (setq layer_number (1+ layer_number))
, q7 u4 r5 ~8 d          );progn
  e4 D. V7 U' _8 R      );if5 M3 K7 n8 q/ f9 M1 L5 w9 v
      (setq templist (tblnext "LAYER"))
5 F% \- J8 w) h      (if (= (/ layer_number 50.0) (fix (/ layer_number 50.0)))
" t$ K0 o9 d+ Z$ L0 }9 m          (set_tile "error" (strcat "Collecting..." (itoa layer_number)))
. q3 d( v; O. J* G" |      );if7 |$ {9 q: l, ~. w
    )
, J7 [* K' p  v: [+ Q5 s    (set_tile "error" "")
9 F+ z4 B0 ]; x1 F, K' x$ E    (if (>= (getvar "maxsort") (length sortlist))* w7 x0 f( {$ O7 l& q& O
      (progn
7 c, f1 {% t* l2 I" \. o        (if (> layer_number 50)5 Q- M( o/ s1 h
          (set_tile "error" "Sorting...")8 P. J! z' I: m3 n; W
        )4 e8 U5 E6 F# a+ ^5 @8 m/ J
        (setq sortlist (acad_strlsort sortlist))
3 w" |  ]  ]5 J/ X      )
$ O9 k5 P' B$ D7 f; q+ W. v( j: G      (setq sortlist (reverse sortlist))9 I! R6 {/ l. |9 G. w# k
    ). c) Q% y8 L5 f6 F% a' R
    (set_tile "error" "")  N- v. o/ s# [9 [+ z/ o4 k
    (setq laynmlst sortlist)5 R' w* Z: X: U) {) L
    ;rk " Q/ ^+ }5 \/ |9 ]
    (setq laynmlst (append laynmlst (list "")))     
4 m( V: M, `' S! `' r# B9 `# G) |6 w8 V$ M
    (setq longlist nil)
& t6 B5 L9 |+ X* m6 A% i5 @    (setq layname (car sortlist))1 N) b8 j# b2 P
    (setq layer_number 1)
% L0 ]3 |8 ~# A' n* Q& |( ^, {" p2 \    (while layname. p' X! J) a  B# _2 d4 k$ ~% J2 b
      (if (= (/ layer_number 50.0)
5 z4 w- W! |, n7 ]             (fix (/ layer_number 50.0))
8 j# J2 B$ u5 M; D- ?          )( J: [  s+ D5 H7 y+ l( {- H" g1 {3 F; u
          (set_tile "error" (strcat "Analyzing..." (itoa layer_number)))
1 V# |. t$ R2 H) N      );if
/ Y1 q( W7 t: n! i" Y      (setq layer_number (1+ layer_number))
% l" G/ p& X* t+ X      (setq laylist (tblsearch "LAYER" layname))- D+ |, L7 e! Q1 z% D( a
      (setq color (cdr (assoc 62 laylist)))" t5 T4 l" I8 x' w7 u
      (if (minusp color)3 V7 e0 `. a6 B, I9 Q* m$ c  R
        (setq onoff ".")
) G$ p: t) t: }8 b8 G        (setq onoff "On")
# I5 k2 C' m6 X      )
! C  z7 r4 r4 s! E2 d# t1 @7 k      (setq color (abs color))
3 b  L* ~# w% z# I; W      (setq colname (colorname color))  A- F& v1 {3 K& U! z4 V6 e
      (setq bit-70 (cdr (assoc 70 laylist)))0 t- c2 z: ^; n$ O) u
      (if (= (logand bit-70 1) 1)
) s" x2 Y6 u- Z2 |# a5 ^3 Q" g        (setq frozth "F" fchk laylist)7 V; K, F1 X' m# C4 M
        (setq frozth ".")6 d# z- [2 J: `7 o: O
      )( ^4 g1 _2 H7 l6 \
      (if (= (logand bit-70 2) 2)
  n3 C' J$ E. V8 N" a4 _        (setq vpn "N")8 w; Z+ h! A% Z1 ]% S$ M
        (setq vpn ".")/ V, v' G+ f- M
      )
4 y7 d% \+ U$ k/ G2 `      (if (= (logand bit-70 4) 4)
: a% \+ q# l; f* U$ k3 Z- ?* Z        (setq lock "L")6 |7 K- D! L5 w" H+ G! a
        (setq lock ".")) c) j: K" f* H# E. [) C. ?7 w
      )
" m) `) Z( z! E' f- ]2 C1 ?      (setq linetype (cdr (assoc 6 laylist)))
. @0 R$ a5 N% T$ l$ u, W      (setq layname (substr layname 1 31))
$ v- S3 y2 i; s      (if (= tilemode 0); |! d" @3 l7 B
        (progn$ m" U+ J4 L2 S. k0 y$ f1 m4 M
          (if (member (cons 1003 layname) vpldata)5 {4 v5 I. w! u7 k
            (setq vpf "C")
* w8 g& D% {+ ^$ s% C            (setq vpf ".")
" V% \6 p4 e) a/ K! k          )
7 f8 L5 E6 X4 w2 t        )
& x4 H) C7 D9 B$ ]8 d% l        (setq vpf ".")
/ s% t: I; H5 d" S6 [$ |      )
7 w) N6 B  O" M& V  O+ ~# d& L& K$ {      (setq ltabstr (strcat layname "\t"1 l" S2 n/ P0 V( A' O% k, s% C+ q6 x
                              onoff "\t"8 O3 \5 O: E4 n" {! l$ C
                             frozth "\t"5 u$ X% g6 S4 [/ t) u! ]8 e2 Y; a/ S
                               lock "\t"5 Q0 Y5 ^* L; J0 l" ~, m
                                vpf "\t"
/ E7 S% C) C8 a5 J+ j- }7 g1 H6 n4 D                                vpn "\t"! G9 l( M& I  x4 ^
                            colname "\t"
' s( S2 Y( a9 w) ~                           linetype
$ j! `' V# S6 ^' ?* |$ y3 q                    )
, H4 Z2 ~) O4 I- [+ g      )
+ i) I! `! j0 O. e; G4 Y& j      (setq longlist (append longlist (list ltabstr)))
% t; ~3 k- a, ?9 a# A      (setq sortlist (cdr sortlist))
, U  q' O3 @" A& |  Z4 j3 x" |5 o      (setq layname (car sortlist))( w& N3 ^2 [' H" p, x4 O
    );while- e1 n7 u% S, q+ q8 B
    (setq longlist (append longlist (list "")))
. I4 V& {# U( q) f; Z    (set_tile "error" "")
. R$ A9 D; f; t9 ]" N& [8 ]  )7 S: z" v4 g& Y" p0 u
  ;;% \' ~  {9 Q) d: A
  ;; This function makes 2 lists - ltnmlst & mdashlist.  Ltnmlst is a list of
2 S. a* m8 V9 R8 N  V  ;; linetype names read from the symbol table.  Mdashlist is list consisting
# x. Q. J  Q3 C- R8 X  ;; of lists which define the linetype pattern - numbers that indicate dots,6 L; r: z# |  f  I2 D
  ;; dashes, and spaces taken from group code 49.  The list corresponds to the
& H9 A. _" V, \, \  ;; order of names in ltnmlst.
8 O3 Y' l+ M; p* p  ;;' U! c% f/ N' n7 O! p* T; p
  (defun makeltlists (/ ltlist ltname)
: u& Z/ L  W1 R$ w: f" g) K    (setq mdashlist nil)
, Z, ~2 P) ]. D( {4 i/ J5 x  c! D    (setq ltlist (tblnext "LTYPE" T))
- T4 f: b0 ^6 P/ k, ~    (setq ltname (cdr (assoc 2 ltlist)))
1 Y4 P( z4 i" G* `3 o  o    (setq ltnmlst (list ltname)); ~+ a* A/ m( o7 m# }
    (while (setq ltlist (tblnext "LTYPE"))& p# g; |: I- e1 t: p% c
     (if (not (equal 16 (logand 16 (cdr (assoc 70 ltlist)))))5 j% q% F9 i1 o; @( R5 {6 R; R
         (progn 2 Y, l) ?" _& L6 A* e1 h( i
          (setq ltname (cdr (assoc 2 ltlist)))9 r# h" p6 I; h8 Z
          (setq ltnmlst (append ltnmlst (list ltname)))
9 K5 u0 g. [( G& c6 M" ]# u         );progn
/ L4 Z. g, G# \0 p8 r9 Z) c  o     );if 4 l5 t% s% }6 q) E4 i7 v9 a/ E
    );while6 z: o" F# ?. c, |
    (setq ltnmlst (acad_strlsort ltnmlst))( }" R2 z  U. z( Z" ^3 b/ _& F0 j
    (setq ltnmlst (append ltnmlst (list "")));add by rk & e# [: R( Z, \/ D
    (foreach ltname ltnmlst
9 H3 @, ?0 S5 ^# L5 \/ {; M      (setq ltlist (tblsearch "LTYPE" ltname))
. |% N. Z5 Q  o: W" w      (if (= ltname "CONTINUOUS")( ]/ j+ }7 Q# [( e! o5 M5 H7 f
        (setq mdashlist (append mdashlist (list "CONT")))& S) s! T" y- |6 N5 H3 r* a# D
        (setq mdashlist
2 U7 x' `- _- g" j9 O/ v+ j            (append mdashlist (list (add-mdash ltlist)))/ R- B  }' z( `/ s  w" ^2 `5 u+ ~
        ), U. O' U+ a4 i) B; S
      )3 a: j" H9 i9 i  K8 Q
    )  s! h1 H5 l" }7 I, V! H
    (setq ltnmlst (cons "BYBLOCK" ltnmlst))
" u( p- b6 v8 r6 R4 x$ j    (setq mdashlist  (cons nil mdashlist))# U# I7 q0 f" D4 o: W& P
    (setq ltnmlst (cons "BYLAYER" ltnmlst))0 }! F! U1 W3 t  N9 p0 a: c
    (setq mdashlist  (cons nil mdashlist))" J# |0 H- I- L
  )
% s0 _. G7 ]3 ^: ]4 _/ J) F  ;;
9 L: _; s: M( p6 O9 R' W  ;; Get all the group code 49 values for a linetype and put them in a list$ T( ^" j6 y0 G0 z: g6 d
  ;; (pen-up, pen-down info)
, w# V& x( x4 Z# }/ W  ;;
, w5 f1 z, H, j* |+ K. ^, \" L- Q: ~  (defun add-mdash (ltlist1 / dashlist assoclist dashsize)) U" I+ v. p2 G
    (setq dashlist nil)+ m5 x+ O1 i6 o( ]- i! x# i1 i. E
    (while (setq assoclist (car ltlist1))5 ]( o$ K. K' t" L, Y2 @1 ^
      (if (= (car assoclist) 49)
8 u, N& v4 [1 Y- O- t- ^        (progn
5 J* {7 r! f! ^& Y. L' T          (setq dashsize (cdr assoclist))
. c. H( Q$ g$ q5 {          (setq dashlist (cons dashsize dashlist))
+ U* H( l6 I- H1 a* k6 y9 |0 ^6 @        )
* n6 b% t5 s/ V- ?& E      )  ]+ Z$ ^9 L$ u  v' t
      (setq ltlist1 (cdr ltlist1))
) }1 c4 E% N: x7 ^" V, j# ?( b; ^2 p    )
9 E8 d: d3 W9 l5 _: k    (setq dashlist (reverse dashlist))) B  m4 Q1 y  U" j0 \" Z9 L; B
  )
1 W6 p' y1 w% x% u3 |. P  T  ;;
. w8 r, z! h; H  p  ?  ;; Color a tile, draw linetype, and draw a border around it1 ~& v5 u; Y% S( B
  ;;
3 H4 u- H' [- @/ r7 d6 Q  (defun col_tile (tile color patlist / x y)4 t# u0 M% s) |/ z7 g
    (setq x (dimx_tile tile))* ^" c8 P9 `' L/ @1 U
    (setq y (dimy_tile tile))1 H' l6 v5 f5 R: c* k
    (start_image tile)
" T; z) ~$ K4 y/ v; u, M    (fill_image 0 0 x y color)5 m1 z$ o& Y. x6 x" p
    (if (= color 7)
$ A6 L" X* ^) I2 w! m      (progn
: `- J3 p+ i$ ]        (if patlist (drawpattern x (/ y 2) patlist 0))
2 o+ u# Q7 m  W* Y: E9 |7 @% U        (tile_rect 0 0 x y 0)
3 H, {& `& U' Y- Y2 S$ p' V      )" s2 z7 G2 ]0 U7 N6 J
      (progn
* k: j* |/ X; e! p- K        (if patlist (drawpattern x (/ y 2) patlist 7))
1 B" N% b6 M3 z( D+ S        (tile_rect 0 0 x y 7)# ?# U& M, H: ?, h  R
      )
# v3 F. S* B/ @" [1 }0 S$ m( a# B( a    )$ e, h; b; u, I/ n0 e( X2 I1 p# j
    (end_image)  \9 o) S- @- F: n6 I3 o+ Q) [! `0 e2 ^
  )& x6 V+ k1 F" b0 H6 x
  ;;
& |8 m( D. Q+ j2 }  ;; Draw a border around a tile
! M2 H* v) A0 u, N$ j  ;;- n/ W3 Z1 k! `" k4 ?, ?* e3 R4 }
  (defun tile_rect (x1 y1 x2 y2 color)+ v3 G% o: B0 t. U  G; a' U
    (setq x2 (- x2 1))# e! h% h, d" H# f  N0 G
    (setq y2 (- y2 1))2 f3 [/ K6 X7 [- Z7 L+ D2 j
    (vector_image x1 y1 x2 y1 color)" l1 f7 J& n/ x! F1 B7 \
    (vector_image x2 y1 x2 y2 color)
8 x1 V$ S9 i! X5 A4 s    (vector_image x2 y2 x1 y2 color)
/ K0 Z4 T4 @9 v+ ~4 _" P: Z4 K    (vector_image x1 y2 x1 y1 color)
! [, Z) E" @  L  y2 j" H6 i( T  )% T0 c2 C/ _" `. W7 s5 h. ]
  ;;5 k7 u5 g6 B; e
  ;; Draw the linetype pattern in a tile.  Boxlength is the length of the image
  |( B# ~+ H  z  V- O9 _1 W7 l  ;; tile, y2 is the midpoint of the height of the image tile, pattern is a
3 E5 J$ Z, J$ E; H6 K  r  ;; list of numbers that define the linetype, and color is the color of the
* M( Z: ?8 q2 ~& S2 n' ]8 L/ L  ;; tile.. l0 `# I2 q  w& H* V0 k
  ;;. _( n! U, ~5 E% s8 M
  (defun drawpattern (boxlength y2 pattern color / x1 x2
$ P+ _, j3 m9 [! b+ ]3 V4 I. E                      patlist dash); E2 j; E$ }: R- F$ W
    (setq x1 0 x2 0)7 K8 {1 A8 f. U  O. x9 c7 v9 J, t
    (setq patlist pattern)
! G& K1 d8 H6 y3 v; k9 s    (setq fx 30)
7 }  n# f/ c, A5 K1 g- N1 G3 c; L    (if (= patlist "CONT")
0 |/ q% t  ~: @9 n      (progn* @9 X$ N( x& B
        (setq dash boxlength)
  f2 I' c- _  ]; B" f4 q) k        (vi)& R% S; T5 h8 e, _( K; O9 y& Y
        (setq x1 boxlength)
0 f- L8 g$ l0 L6 A  \      )
) `: l1 A; k  V6 O9 ?* S      (foreach dash patlist
4 `) H8 `: R( i) n# r        (if (> (abs dash) 2.5)
  H, y5 |" _% S6 o6 C: k( M          (setq fx 2)
+ ~- b8 u* L: ^% J* y6 m2 j        )3 m5 x% w/ R7 y
      )
% i0 x$ p5 o8 S& V( E! I- ^    )
7 A' P  N& j2 M: A  L/ d$ Q8 \    (while (< x1 boxlength)9 i5 e1 ~. o/ j" {) Z+ c( o
      (if (setq dash (car patlist))
8 m1 a. Z6 l  K% O/ ?% m8 {8 A        (progn
" K  ^6 O; G: j7 i          (setq dash (fix (* fx dash)))
0 Q8 ]5 v6 ]$ t' u1 n          (cond2 I6 S# W) {& W. s$ ^
            ((= dash 0)3 E* D$ ^) \9 m8 ~% B& _8 t
              (setq dash 1)# w1 [; B" L8 h5 k) U% N5 f9 G
              (vi)8 j: Q' P. i7 x* Z
            )
% F( r; B% d1 {! e$ [7 U* F            ((> dash 0)# _% C8 s: S( g# j
              (vi). ?% @$ {. `( B! B
            )
/ j' L! X! m5 B- ?            (T
9 c5 \5 s7 r1 L* R% n- G/ Y4 ~4 W8 ?              (if (< (abs dash) 2) (setq dash 2))
, P! m' a( z+ c: g! h              (setq x2 (+ x2 (abs dash)))
; K8 W! Z# a. g2 f1 \  p            )
  \) W( @( z$ Z* I# a          )9 B/ h( K; d# M+ d9 A; }0 {
          (setq patlist (cdr patlist))* Z/ ^5 i$ W  F" `# s& u
          (setq x1 x2)4 s% I, J+ E! ^" ~. k2 B
        )" g6 g* T. f6 ?' i0 O; ?/ `' Z+ J8 |7 k
        (setq patlist pattern)( l) q1 F" k' X" e/ y+ i8 r7 R
      )
3 ~7 m3 u! w6 a    ). w8 N# U; Z5 W. `
  )
* S8 J3 ]" o1 E4 @  X7 F; |5 p& U  S  ;;
6 f7 K) I: t' D, G, T  ;; Draw a dash or dot in image tile
7 O6 J" _, ?8 C1 _  ;;1 y3 }! p  J7 X8 i1 w
  (defun vi ()
0 l$ W. W( x: u; f6 v0 ]6 G$ b% o1 i    (setq x2 (+ x2 dash))3 y6 [/ z! t( L; [% ^7 c
    (vector_image x1 y2 x2 y2 color)
) J# h; g0 r: ?! N# ^  )
/ {( G) f5 _# D, Q7 e& G
8 L. {3 A; W5 R+ q  Z8 Z  ;; This function takes a selection and returns a list of the color,: `2 x3 X  `/ s* Q0 W
  ;; linetype, layer, linetype scale, and thickness properties that
9 G( N; e" O9 ^$ ?  ;; are common to every entities in the selection set - (color/ s; ?$ r' F, E% a/ q3 C) w/ t
  ;; linetype layer thickness).  If all entities do not share the same: B2 y1 N" Y4 Z/ C1 A: B
  ;; property value it returns "Varies" in place of the property
7 h4 w- ?, W, K  ;; value.  i.e.  ("BYLAYER" "DASHED" "Varies" 0)
& u7 b5 X+ i2 ]9 f) h# i2 n, w. ]  ;; The last item in the return list is an integer flag for the
, n8 z8 V4 X3 l/ ^  @/ ~  ;; homegenity of the selection-set object types.
0 i5 x3 A, a1 m; \- V  ;;   1 = All polylines
$ o, z: y5 _8 ~9 R. e% s, ~1 p: |5 N7 A  ;;   2 = All text or mtext or attdef, or a combination of the three0 H2 U7 z, U8 C5 ~
  ;;  -1 = Any other mix of objects9 I2 y& \1 U1 S  m

7 k/ [  B2 u# H2 e2 u+ A  (defun getprops (selset / sslen elist color ltype layer ltscale thickness
, r0 z3 p# t: R9 k3 ?6 `                          width elevation height go ctr
/ p8 w2 e) _- K! X7 E- W# D/ l                          eflag 0 [1 L( Z/ P7 L" P5 r
                          etype temp
, h/ h. k$ i0 R) [& H9 b) J                          txt_ss     ;;;;rk 11:24 AM 1/30/976 m$ L" M& u0 h/ h5 Q& Q) e4 M
                          tmp $ T  D: S! |7 Q; {: q9 c8 I
                          poly_ss   5 M* V+ M( T6 H
                          style; T6 p" B& _+ B2 i3 i8 r0 ~& c
                  )
' i2 {. h$ F6 E8 R) q, i$ T2 U' E' r0 C
% |6 l2 Z! q) ^2 @8 O2 \, ]
    (setq     sslen (sslength selset)
5 t: c" c  |4 D8 Q" ^( v3 E' ~              elist (entget (ssname selset 0))
) W& z" R/ M0 x3 F% c- N2 D& Z7 [/ W              etype (strcase (cdr (assoc 0 elist))). g- k2 v# r. h( G3 c  e% B2 J7 [
              color (cdr (assoc 62 elist))% x) [; F( h0 ~( c/ _* l
              ltype (cdr (assoc 6 elist))" V. A: A+ W- X
              layer (cdr (assoc 8 elist))* t" Q; ~: Z4 A4 v- Q0 j
          thickness (cdr (assoc 39 elist))" Y$ h! Y8 T, n; W2 S1 M! A) t
            ltscale (cdr (assoc 48 elist))+ ~* p- u/ q' j/ v! G) V$ P* w
    );setq
* Y$ E4 {( O  I2 V( ^  q  M6 s  ^3 @" P, F/ h
    (if (not color)     (setq color 256))
  x" L" I: E0 o    (if (not ltype)     (setq ltype "BYLAYER")): q% L/ n% C( l0 h% c
    (if (not thickness) (setq thickness 0))
" e* z7 |, U% o2 K    (if (not ltscale)   (setq ltscale 1))2 X% H1 m8 J9 Z/ R1 j
/ C" d" k% _- h' Y7 D; ~
    (if (not width)     (setq width "")): Q  }! v" U' y
    (if (not elevation) (setq elevation ""))
  n8 Z8 {. r( G* R* t3 w    (if (not height)    (setq height ""))
8 O5 O5 X" ]( B& A1 L0 h9 O/ I1 B3 Z# S! \( W
    (setq      go T ( c" S. P% S7 A
          chk-col T ; P4 n! }% A/ D" {3 V
           chk-lt T
' w* j0 l! J4 s3 b: v# U          chk-lay T
2 G2 p- t1 m6 P, ?" z- q          chk-lts T
; R- m) D+ R& C6 o           chk-th T
: N  _# l& h% Q              ctr 0
4 L# \6 `+ b) |; o    );setq
* P. p; I& B3 h) T
% |/ u8 E9 f. Y+ k7 P    ;; Page through the selection set.  When a property* y* I) |) `9 A; ^6 G
    ;; does not match, stop checking for that property." J% i: S; @1 l$ u
    ;; When the selection set is not homogenous, stop checking.1 e& y3 x' L: i9 z4 \' y9 a$ Q6 l
    ;; If all properties vary and the set is not a type 1, Y/ X$ q6 y) Z( j) v. L7 H/ E
    ;; (polyline) or type 2 (attdef/text/mtext) set, stop paging.
/ X9 }- K# r* z( e# l# {( u- a8 _# y
    ;Lets set the eflag so we know if the selection set includes any 9 ]3 V/ }) R2 z( }/ T6 o9 J- X
    ;combination of polylines, lwpolylines, text, mtext or attdefs.
! H1 Z' [5 H* R, v! K* v  t
0 L8 J# q& J  g' s% v+ Y8 x; o    ;watch out for 3dpolyline and 3dmeshes here! @rk 10:17 AM 1/30/97. \  H  N1 V. Y, Z4 L) z. Z
    (setq eflag 0)7 @# I) L* \( g$ v
    (if (setq poly_ss & i6 B; j* V* Z- A
              (ssget "P" (list '(0 . "*POLYLINE")* T3 d; n  @% b. ?3 C4 r- h1 ~9 T
                               '(-4 . "<AND")
4 \1 x6 r4 t2 N  Q8 H, s7 y                                  '(-4 . "<NOT") '(-4 . "&=") '(70 . 8)  '(-4 . "NOT>")
3 S% U- x& m( P9 G9 c* u5 L                                  '(-4 . "<NOT") '(-4 . "&=") '(70 . 16) '(-4 . "NOT>")& s$ @- ]) o1 Q9 P
                                  '(-4 . "<NOT") '(-4 . "&=") '(70 . 64) '(-4 . "NOT>"). e  k2 M0 Z1 j. M: Y! E. Z
                               '(-4 . "AND>") 4 Y) A  u- [6 y3 W* l
                         );list
: T6 h3 }5 s& Q2 U! a0 F+ J, ]              );ssget get 2d polylines (legacy and lw)/ [0 ~7 Y9 @; y. Q$ w6 m0 Q/ ^$ P
        );setq
& @! Z" m- l4 L% j: g        (progn/ K0 X& t: X$ B
         (setq eflag (+ eflag 1))
4 u4 |0 x$ Y1 @/ a6 N
/ u4 ]2 p; s' h         (setq tmp (entget (ssname poly_ss 0)));setq, H$ E: B  x. k+ K( s( I
& b) _( a0 @8 N6 i2 t* ]
         (if (equal "POLYLINE" (cdr (assoc 0 tmp)))' E# X9 x7 p; `2 x( p
             (setq elevation (last (cdr (assoc 10 tmp))))$ H7 Y! i- ?+ t6 O5 H
             (setq elevation (cdr (assoc 38 tmp))): }0 P5 M; {* K, B9 T3 l( l
         );if3 Z* d" q8 W/ r6 g' d: z! r( X
         (if (not elevation)" k1 L! ?9 }/ f- V) \/ t6 |
             (setq elevation 0.0);setq8 {6 W; i7 T' {# z% r! J% P% c, h( k
         );if
/ H, ~' z# w' O% b, _/ I4 N
0 c! R7 V2 j/ r9 X% r         (setq tmp (ssget "P" # @$ V* T0 j1 f* Z2 C* e0 n7 T3 N
                          (list : R# Q0 [  ^6 C3 m2 m
                             '(-4 . "<OR")
' L' ?3 {/ ~6 v5 r# C# t. ?0 z                               '(-4 . "<AND") ! |) D, h( j; {: y
                                 '(0 . "LWPOLYLINE")
  C* D0 n# R5 X                                  (cons 38 elevation); q+ C5 d# E, W) _* v. R5 I% Z
                               '(-4 . "AND>"); Y0 h/ f" Z2 O; @; v! `9 [
                               '(-4 . "<AND"), I; v. N5 @* D5 l2 l
                                 '(0 . "POLYLINE")
( Y1 J& L) x8 z3 v, d8 `) Y. b2 Q                                 '(-4 . "*,*,=")
  Y' F& d7 U1 L  ^4 L1 H' Y" k0 o                                  (cons 10 (list 1.0 1.0 elevation))
" @* a3 I; L0 X$ C  P! F                               '(-4 . "AND>")
: O: T3 {$ E3 p" V: N5 o6 |                              '(-4 . "OR>")- l9 \; J1 N  [1 k$ L8 `
                         );list
+ u: P4 \6 m2 e" P6 ]                   );ssget+ r) r: q8 V: O) N- _
         );setq& }8 j1 y# D# ^

1 m% \, J) ]. O4 F0 y         (if (and tmp
& Z9 n! l1 R% O  w* t( @, |) F                  (equal (sslength tmp) (sslength poly_ss))
( q9 f8 u$ U3 Z5 i  y( O             );and
2 v5 {- ~. t( l* k6 B             (setq elevation (ai_rtos elevation));setq
4 _+ ?9 L. _2 U( C4 q6 o# c1 L             (setq elevation ""): K- D% s! g/ q1 F4 S+ [+ p& i
         );if1 t0 d7 A( @/ f. |' ]: p
2 G1 A* v, f$ s* ?' m) r1 j( Z/ b
         (setq width (pl_width_getter poly_ss));setq" ?+ E& H) I+ J" j+ Z5 q

7 z0 @! ~7 ]; L- Y) V        );progn then 2d polylines and/or lwpolylines are in the HHHHHOUSE!' @& S( G$ g# `& F% Y0 ~
    );if' l# f1 E2 O, `6 W, Z2 P7 r
    (command "_.select" selset "")
. a0 f" s. p+ T- M2 w$ Z, g- A' W: O* G) N4 q" X, Y
    (if (setq txt_ss
( U" y% g5 G1 \' x0 y7 G              (ssget "P" '((-4 . "<OR") (0 . "TEXT") (0 . "MTEXT")
7 V  }- o: x5 V& D                           (0 . "ATTDEF") (-4 . "OR>"))3 p# s" V4 {$ f8 \; U9 H/ `' W
              )  ' M1 r, M3 U4 b
        );setq
3 V9 S* m* r8 H" R; i+ i; [: ~( V9 m2 `        (progn
4 Q# p5 h' K0 l5 r( B+ R0 w         (setq eflag (+ eflag 2))( y' F. |( M0 g
         (setq height (cdr (assoc 40 (entget (ssname txt_ss 0))))+ r& E6 ?7 `/ y8 A  Y7 h
                  tmp (ssget "P" (list (cons 40 height))) $ V; ]' q. u# y/ a$ s, g/ y
         );setq 8 U: W! [1 @" n5 o
         (if (and tmp. y) b( z& o; S* [7 n+ z2 r
                  (equal (sslength txt_ss) (sslength tmp))                    
/ V# N. _4 x8 P# g. i/ B             );and
5 O) g' e$ S' f) }% q% J             (setq height (ai_rtos height));setq  ;@rk need to translate from float # [2 q  b% b, d
                                                   ;to string and back again easily
. ~/ q8 M9 O4 ]8 T' y             (setq height "");setq else the height varies 0 t5 d2 |1 D( _
         );if
* O3 Z0 I7 z  c  t: L' ]: `         (command "_.select" txt_ss "")
+ \' a3 q% t  L6 e/ i" X# n/ i  X         (setq style (cdr (assoc 7 (entget (ssname txt_ss 0))))
  b% M' @# |4 Z8 ~2 f3 i                 tmp (ssget "P" (list (cons 7 style))) - }8 B* N0 k0 O# e8 p
         );setq
! ~! v1 c7 {7 Q5 C) L( ]4 D3 O         (if (not (and tmp
+ V9 k+ E4 K; x1 l" }) ?; A  [                       (equal (sslength txt_ss) (sslength tmp))                    
' D$ U6 b1 \! L6 L4 W, I                  );and! j+ f% |# [5 X$ Z4 E
             );not: j' Z2 x9 K! G5 e' f7 j! V0 ^
             (setq style "");setq then the style varies 2 V* u8 f5 `2 Z
         );if) V0 {! J% Z. J
        );progn the text type objects are in the selection set  |4 `, S( i! j: I
    );if7 O/ Q! o8 g1 m' [: N- w/ \. d; }# q
    (command "_.select" selset "")3 ~; C5 y% n4 v( ^* H
6 ]) T3 R: {. t! N) \8 k
    (while (and (> sslen ctr) 7 a8 w% S$ p' @* x" N! f
                go2 g& u- a8 S5 G) X" D9 n
           );and6 o$ L* X8 p: j% K
      (setq elist (entget (setq en (ssname selset ctr))))
1 Q- B( R' o2 [8 H3 q) @* w" K: y
6 o/ ~. m3 U4 L( W      (if chk-col (match-col))
( |6 \  S: J$ t" V& C- ?      (if chk-lt (match-lt))
5 S5 e( ]. _& i* d' t7 B1 q      (if chk-lay (match-lay))
3 G3 ~8 S: g0 S6 [6 ~& T8 g      (if chk-lts (match-lts)), w# C7 T8 l! b& Y
      (if chk-th (match-th))
) x2 b' {. y+ x+ `+ c/ y3 D0 L! P+ @$ H
      ;(if chk-etype (match-etype))& L8 k" q/ K9 i! g& C( C1 F, B

- K4 ~! a4 ~8 b! L& R7 C8 t      (setq ctr (1+ ctr))
7 P9 F8 A$ h) R) d7 b$ q" Z; f4 `" O) G) V      (if (and (not chk-col)- M4 ?/ V0 J! }. o+ |1 ^: y" h
               (not chk-lt)2 T. Z* r5 l" h. d7 n
               (not chk-lay)& B6 w1 N& M- u* _
               (not chk-lts)7 X& c! o- m- B& Q; l, v  e
               (not chk-th)
% \2 Z" K3 R. }% S               ;(not chk-etype)
' a$ b7 H* {1 @  @; I. D          );and
; u5 T' B5 w8 T+ g          (setq go nil)4 w1 O5 s" L' P! P6 A  r3 `) m
      );if
' R8 F1 q/ l& p9 a6 W4 Y    );while( N# x' h" D2 W2 i' ~5 h

( s, P1 X1 a/ Q: A    (list color ltype layer thickness ltscale: |% I% L) r* w0 C3 F
          width elevation height eflag
9 W' ]1 X3 v: i: ?! c          style poly_ss txt_ss
1 p: _* ~, E( v    )
2 _5 i* M6 b/ j$ ^  );defun getprops
# X. Q- H7 @9 C
& W& m" Q0 `8 w6 t' H  @  ;  This is a speedy little routine to tell whether the polylines in 4 n& W- u6 e+ u4 ~2 W5 W
  ;the selection set argument are of varying width or a constant value. $ a% w! w" h( q$ [
  ;Looping through the vertex's has to be done for old polylines when 0 ~% w- Z9 I% ^' A9 w
  ;the polyline header has width values of 0.0. Basically, in this case, + @9 a/ b; s+ m" k3 Y' ~. K0 f
  ;information in the polyline entity header is abmiguous. Width values % i. `) H9 ]8 j9 X$ k9 u
  ;of 0.0 in the header entity could mean the polyline has a constant
$ f4 w% S+ @% M2 |# j$ @  ;width of 0.0 or it could mean that the polyline has vertex's of varying
5 v& t  ]$ ?: W1 W# v4 \! R  ;width.4 ?  X/ W7 V( V7 u! S& O
  ;" H# h. @1 Q  [2 N
  ;  It's all in wrist. Err a.., I mean it's all in the 'if'! a2 c; ~2 i0 d; W) J
  ;;, j5 b( `/ e" v* v
  (defun pl_width_getter ( ss / ss2 ss3 n na e1 width width_a width_b flag flag2); X4 E5 M6 i3 `1 u$ }
& ]% s! r  a0 m: a
   (if ss   d* z0 T% h+ L+ |3 Y7 p0 V5 |- C
       (command "_.select" ss "")
" l: j* X! c8 n   );if
5 _6 g/ w0 a" s* U4 L   (setq width ""
2 B+ `) N) ]- H8 d0 q! i) H: _          flag nil$ b' ~: V. n  y2 B) d8 \' O
         flag2 nil
  g. h" I; N( \2 Z   );setq% F5 F) L& v. b
   (if (not - J8 c9 ^$ u( f
         (and ss; c: Q- {0 T) y. v0 U4 b) l6 a/ ]
              (setq ss2 (ssget "p" '((0 . "LWPOLYLINE"))));setq0 p2 M5 r7 A: P# |) R, H  }0 D
              (setq    na (ssname ss2 0)0 }8 V9 X+ K# }+ P& r4 {
                    width (cdr (assoc 43 (entget na))); a5 z" N. c5 n  J7 q" ~
              );setq  M3 ~" p3 ]4 w& ]8 d, u
              (setq ss3 (ssget "p" (list '(0 . "LWPOLYLINE")! Y; J! f3 M7 t. I9 t- T% ?; ?% Q7 a
                                          (cons 43 width)
% d: @8 ~( u2 l1 `* v6 K* W                                   );list1 \; h' O2 T9 f! Q" ^
                        );ssget
5 s% K& A- a% I              );setq
; r% W' H9 b8 ^5 A# @  u  F              (setq flag T) ) p& q" P, Q' J6 [. u6 L
              (equal (sslength ss2) (sslength ss3))
8 Y( F8 L5 z# x- N1 [+ b- A         );and- b2 Z3 A! {; y: c) t
       );not, |" w+ `2 g% o1 E! m* O
       (progn
+ `9 u' J) E% `" x# `: T        (if flag4 x: L3 r" y- D& i( x
            (setq width nil)
, g7 y! T( G( m3 K: c% c2 Y        );if3 ]: ~6 S& h/ M- l
       );progn3 C% f' E" r2 ]0 P5 N
   );if 3 [, |) G/ ]  n' [- b
0 J3 w( E# ~8 N% q2 f! Z8 y
   (if (not - I& Y+ ?! d- \  ?  U( H* w
        (and " y/ d8 l2 d$ l3 t
             ss. h9 j. z  p* D  z9 B* B
             (progn (command "_.select" ss "") + ^6 f; Y- m% T  B3 K) S3 P4 y
                    (setq ss2 (ssget "p" '((0 . "POLYLINE"))));setq
% d: O# W. K- |             )
0 p9 w! G7 b, t9 A             (setq      na (ssname ss2 0)
, D" t+ @2 o" b9 ~3 D5 A                        e1 (entget na)$ C7 A- @3 c, G4 i9 \/ `* Z0 x
                   width_a (cdr (assoc 40 e1))
( u. o; A, ?; n1 F! M1 G2 r! J1 v                   width_b (cdr (assoc 41 e1))2 l. A9 e) M3 F; x9 V& x
             );setq
* y) y9 K. C5 X( [             (equal width_a width_b)
+ W# n7 H3 \9 H' _9 S             (setq ss3 (ssget "p" (list '(0 . "POLYLINE")/ |  G6 E! B" [8 N" a. h* l
                                         (cons 40 width_a)
; w) u5 J5 r7 [                                         (cons 41 width_b)& z+ d+ b; M& W7 U9 I5 j
                                  );list; {( ^  A* [) m
                       );ssget
3 s  f; h% h3 ~- O0 \9 u3 F             );setq( V1 }5 ^" X7 u
             (setq flag2 T)8 l" o3 S% n8 S8 k9 e4 F! W3 x& D1 G
             (equal (sslength ss2) (sslength ss3)). t) W3 l- P" O  t% B
        );and ' A/ i4 k& O6 d$ t' g, s+ s0 S
       );not
% l* _  s) b1 i( e       (progn, X' d2 \( U1 _" S
        (if flag2
5 k$ h! j3 d8 e; K            (setq width nil);setq
. E2 I) [( u1 n" m# e        );if% p1 i5 X: p  m2 P1 ~. Q! c
       );progn then
5 z7 Y' \( l5 h. j% a1 }/ @7 w' L( r       (progn( m2 R8 u0 R3 G+ b. R; u
        (if (or (equal width "")! R1 `/ O# _4 }9 M+ {7 X) ^( a
                (not flag)  a8 s) _+ h0 [. }- [( B; d/ N7 b
            );or) J* `% t% }  c. Y5 r( i7 K
            (setq width width_a)$ G3 c% w( j4 z/ \
            (progn
7 R( m& o( R3 J3 e             (if (not (equal width width_a))4 D' M) c8 M' c) Z9 v
                 (setq width "")
4 I9 E: ]( P1 M; M; t+ t             );if  4 D# W% ^+ H0 a; n
            );progn
- X: g6 D. @' l9 y# t* \7 q        );if! o" `- e) x$ E) H3 z
       );progn* }: m2 W* r2 ]3 }1 a
   );if
' S+ I9 O* F( M$ s- G' z0 m  j( ?% n8 Z) |8 O6 Z7 z

% J" P: U/ q9 o* M5 W   ;now for the special handling for old polylines5 ?$ M( C2 \9 b2 M9 N. S# C
   (if (and width - C) Q$ u( @6 A. ~
            (equal width 0.0)8 I% u$ p; S9 z; F0 ?( v/ f
            flag2
$ s# e9 T. |7 K3 y       );and
/ p9 F% ]% R; W- |# `" K       (progn
% y( f9 [7 f+ r% m5 I  \8 V! F1 z0 e
        (setq n 0);setq
7 ]& `7 c7 v! r" ]        (while (and (equal width 0.0)
1 R  M7 c$ [( R) A) U6 Z, u                    (< n (sslength ss3))
7 p4 L1 }. z7 z) A3 D               );and4 M1 a/ @1 z/ ]8 F
         (setq flag nil
  H/ W' r+ `* I+ Z; w1 y                 na (ssname ss3 n)* Z) E8 x8 D* j: `. b+ u
                 na (entnext na)/ A! n- N, @8 M* }' L6 K# U6 ], Y
                 e1 (entget na)
: P. U" A( E5 A" o0 n  k; b         );setq" m! ~3 K, {) t, o- P4 _
         (while (not flag)1 G( R# ^9 `" D2 V3 a; u4 U1 q8 y
          (if (or (equal (cdr (assoc 0 e1)) "SEQEND")$ o" ]# ]! g, K" v' ], V2 w+ ]. W
                  (not (equal (cdr (assoc 40 e1)) 0.0))
7 B2 F7 n3 G$ C% W' r; T' R  H                  (not (equal (cdr (assoc 41 e1)) 0.0))
# [# j4 p8 H2 J2 O              );or) v) b* _/ {3 j- _1 @
              (progn
( t: Z+ F- \8 z( F               (setq flag T);% {7 G" d) K2 Y' @, m/ b
               (if (not (equal (cdr (assoc 0 e1)) "SEQEND"))- r7 E" V/ t: \1 E' v3 u
                   (setq width nil)
* y9 G% R$ Z4 a               );if6 F8 @" L0 A) m
              );progn then jump out of the loop/ b  z- M. |$ e
              (setq na (entnext na)) ]* L2 t$ k- B9 {  C( p; o, k$ Z$ v
                    e1 (entget na)% C2 b( D/ M8 V. {
              );setq
' i9 o7 Z5 ~. N( ?; n* h          );if
" X0 f& i8 {, D- I3 z% X* O         );while
9 \& M: @# {2 x5 T2 O/ Y) m5 ^        (setq n (+ n 1));setq  ' V7 l+ l5 P' r2 |2 s' ~
        );while 9 s: b3 V2 G3 r5 R, s. `
3 O, v& v( S3 }) c1 b% A8 P" \) o% z
       );progn then it's a legacy ; b/ b4 D' B* m3 d. |
   );if    ;legacy polylines that may have varying widths  
. f3 N3 t; p$ A5 |7 l% d/ X$ E$ w/ l9 E; q* ]$ _
   (if (not width)
' V+ q; q9 ^$ {. Z. |, V       (setq width "");setq+ b, G9 E8 g2 s$ a4 b# a
   );if
/ c% Y/ i/ o! X: N# X* n   (if (not (equal 'STR (type width))); F/ [$ r4 R1 B! p' x+ W
       (setq width (ai_rtos width));setq
7 ^2 r% w+ j3 v9 z1 S. F   );if + q- p9 r% M3 z4 J+ Q) h
  {: |  F# e: n( e$ X5 T- ^
   width   7 v" Y. @# \" \8 ]6 D) Y& S
  );defun pl_width_getter5 x0 S+ j( {6 D7 O  g& g6 D3 K3 q3 Q

  p1 r+ a4 x8 u( j. O) S0 j, V$ Q% j3 I" c3 m1 M+ U8 S
  (defun match-col (/ ncolor); Z4 p* i9 ~0 e5 B, @/ A% x! |  I+ R
    (setq ncolor (cdr (assoc 62 elist)))
: {. f8 `4 c7 u    (if (not ncolor) (setq ncolor 256))
  Q5 F5 G8 h( y% M3 C% O8 i- U# z. S3 I    (if (/= color ncolor)4 g# s: b- Z! P$ _2 {7 O
      (progn% J- V7 Q% }3 |& \# d& c2 S
        (setq chk-col nil), y! D: Y% i8 c0 |0 l
        (setq color nil)* O0 H: o3 H6 J) `) @
      )
3 w6 ?- h$ V) V9 K    )
: _1 e! x8 z4 ?6 w" n  ), Z' ]1 v  D0 l
2 B3 e3 U9 {: h! v/ R+ u3 ~; N% @
  (defun match-lt (/ nltype)
4 o/ _/ E$ |/ R) ~8 B5 Q( t    (setq nltype (cdr (assoc 6 elist)))
% A" w* s9 p5 y  g  ~    (if (not nltype) (setq nltype "BYLAYER"))
& |7 m) s* a/ F2 _# m( T2 s7 {3 {    (if (/= ltype nltype)3 |' ]3 V, \" P* D$ a
      (progn9 v0 y% A! L3 A: Z/ l
        (setq chk-lt nil): \  Q3 `, U& u. M$ C5 y. L
        (setq ltype ;|MSG0|;"Varies")
4 ~+ |( ^3 ?4 c4 l8 E      )
& d+ W0 I* ?( |6 P    )3 z! s- M8 L. I! [& i0 f/ ~
  )
. o2 S' u; Q' Z6 s- @7 Y1 X  S% X, V
  S7 ~( f( ^/ F4 g3 D: d; G  (defun match-lay (/ nlayer)7 r9 k6 Z2 \2 B2 H4 Z% v
    (setq nlayer (cdr (assoc 8 elist))). T; k( ^8 n  O7 T
    (if (/= layer nlayer)
( |) R+ L6 S5 a1 ?3 v4 A      (progn5 F+ M3 m3 T9 D+ F
        (setq chk-lay nil): X, z9 s, N7 k9 F" [! S2 o% m
        (setq layer ;|MSG0|;"Varies")
* _1 L0 B$ \0 }- a; d      )5 p$ B# b8 l; w8 b. V! v
    )# ]* r  n' \( a, I
  )% F9 A! W4 s9 q9 Q! Y

* f# q# p2 q# A( r  (defun match-th (/ nthickness)
5 {  X& s8 `; U2 e  Z: o* N    (setq nthickness (cdr (assoc 39 elist)))2 k* U0 q7 T' n! ?
    (if (not nthickness) (setq nthickness 0))% `1 f5 N8 I4 M  X1 F. G" q$ r. Y
    (if (/= thickness nthickness)
9 l% _( j' v( K7 r% i4 P# H      (progn) s  @3 U7 \" [) w! F# k5 P' E. s  Z. h
        (setq chk-th nil)8 W8 S  T' o; S' ]( ^7 v& f
        (setq thickness ;|MSG0|;"Varies")
; ?7 Z3 Z# S& Y- }) K: p5 G      )
8 C: }1 K- V! V0 {: z$ B    )
5 g" t' p$ p' L  s  )
" Y9 T  b% A( }1 ^! U9 u4 z6 \. {; F/ ~6 @
  (defun match-lts (/ nltscale)
! [/ d; @5 {5 V& ^# m4 m4 w    (setq nltscale (cdr (assoc 48 elist)))7 T) y6 f& c- a5 }/ u! y
    (if (not nltscale) (setq nltscale 1))( V# k. R# \& S$ O4 W
    (if (/= ltscale nltscale)
: J4 P( L  Y# s% e; o8 }. G      (progn
( T8 X7 h* d* W2 }        (setq chk-lts nil)6 Y& b$ j1 {, z$ @, d7 @4 F
        (setq ltscale ;|MSG0|;"Varies")/ {+ B/ l* i, x# ~
      )
$ C; t5 e# u2 R    )
5 R; \7 V4 j* }' w  )
% o# g. ~. G5 K; @
& g6 `9 c* W* E/ E3 R. u  ;;9 y7 g1 R0 l+ ~. x3 l
  ;; If an item is a member of the list, then return its index number, else
* ]1 l* A4 _$ \  ;; return nil.3 F3 J. M5 |7 @, p7 p' @
  ;;" R1 n$ t6 h3 r+ q/ o* \4 b
  (defun getindex (item itemlist / m n)
* |7 t6 E; f4 K# i! P1 U1 C    (setq n (length itemlist))6 m( f. F2 @2 a$ Y7 V( n
    (if (> (setq m (length (member item itemlist))) 0)
. c8 g4 r8 e% @; L+ c/ {: \        (- n m)
1 P* c! E7 U5 Z6 {4 p        nil  O2 g  J$ N; N
    ): {' E% ^0 r' Z8 M+ r$ P/ }
  )
5 \, s/ k7 P) B* t! ~  ;;8 G( J2 D% |  Y! `% S
  ;; This function is called if the linetype is set "BYLAYER". It finds the
" H7 Q7 x- Z* b# D/ L" H! e  ;; ltype of the layer so it can be displayed beside the linetype button.- `) l% K7 u  N0 N8 C, ?2 u
  ;;: G- e$ H0 f2 X: {% A! p
  (defun bylayer_lt (/ layname layinfo ltype)
4 e2 n; e2 F% b. N8 k  \9 D8 r' {    (if lay-idx
" {( M5 e, N' z. n      (progn
9 s3 o  P8 Q' @( a        (setq layname (nth lay-idx laynmlst))
; m0 u+ ^4 T* B& N  y, w8 ]9 j        (setq layinfo (tblsearch "layer" layname))
) X$ Z, F, h3 l. \) c        (setq ltype (cdr (assoc 6 layinfo)))
6 M2 q" Y$ ^/ g1 D        (strcat "BYLAYER" " (" ltype ")")
+ V1 Q5 e0 r; [* V" y3 a: G      )2 k' V  J7 e) [3 g& _' O
      "BYLAYER"
3 l2 O# ~  G9 E; R" [( Z( B+ _    )
$ B, g; u3 |2 N( f8 G* i  )* q3 _# _) n8 g) b
  ;;* r( o" ]; a4 V% O
  ;; This function is called if the color is set "BYLAYER".  It finds the. E3 v& p9 ^3 D; a) O* u; j
  ;; color of the layer so it can be displayed  beside the color button.8 Z$ g/ Q- M$ u: Q0 y( O
  ;;
* D  w/ B+ R% W: m" d7 G  (defun bylayer_col (/ layname layinfo color)# C+ S* ?: D  ^! I7 P
    (if lay-idx
) u$ m  f; ]6 y9 R- Q2 Q      (progn
( v4 J0 F& v2 r! B3 L8 i2 X        (setq layname (nth lay-idx laynmlst))
, v3 R2 G8 e* d2 u; S# z; A        (setq layinfo (tblsearch "layer" layname))
9 P3 v# t! r& u        (setq color (abs (cdr (assoc 62 layinfo))))/ X( p, g3 d; n6 d0 i8 f+ T
        (setq cn color)% L- M& `- m2 U* s
        (strcat "BYLAYER" " (" (colorname color) ")")
6 r1 a# D; t2 Q; X& A      )
- c, o) ?; i# o: u( ?      (progn
7 [) Q3 Z$ D/ N; I( }7 @3 ?+ q        (setq layname elayer)
# y4 [* U8 @4 v( |2 |# I        (if (and (/= elayer "")7 b1 u4 F8 `8 Q# W6 o9 z/ |
                 (/= elayer "Varies")7 \6 e3 k) F: C+ V7 {( s
            );and
3 w0 g$ G! \. O( P            (progn
# B" H% J% O2 R. K5 N' G* T$ m4 d% \             (setq layinfo (tblsearch "layer" elayer))
$ v/ \7 S2 o% I- h0 C) N             (setq color (abs (cdr (assoc 62 layinfo))))1 F$ ]5 E0 B7 m8 @
             (setq cn color)% w( J( x5 D6 M2 A$ p
             (strcat "BYLAYER" " (" (colorname color) ")"), w3 @: ~2 i! g- F
            )5 A( e7 ~2 s3 ^- S. h- e" Q% G! T* m
            (progn2 z# ]+ Z* O$ O6 u
             (setq cn 0); d& f6 |3 e( F. g
             "BYLAYER"
/ E& ]2 p4 K  ^  N$ H            )
3 v  p9 [- e7 l& ?0 t        );if
' {5 H/ |3 [7 |+ P5 }$ E      );progn
/ e4 S  M: ]- N6 @8 Y" o    );if
. o1 D# R( ]8 [2 y1 w  )
! Z6 H4 _; ]. U" |  ;;; @$ F+ p* r' g5 |3 M
  ;; If there is no error message, then close the dialogue
/ H9 h5 C% m: I6 v% v, Y  ;;( m/ Y3 \0 S! X$ A- J9 y
  ;; If there is an error message, then set focus to the tile
# W6 }4 p6 z, g7 J  ;; that's associated with the error message.3 `4 l6 M$ j( j6 w% \
  ;;6 c$ M, W9 a9 s0 {, ~7 ?6 ~
  (defun test-ok ( / errtile)2 S$ O, @; j; f) q% Q
    (setq errtile (get_tile "error"))& ^& K0 S2 _9 J
    (cond: G$ J& K2 c" V3 F
      (  (= errtile "")
- a! T" j# ]! }' u         (done_dialog 1))* n  n1 w0 N8 ]/ A3 R1 Y
      (  (= errtile "Invalid thickness.")6 A3 s& A- b) [( I* J# t! B
         (mode_tile "eb_thickness" 2))
' }; F' K& `) d8 |; d    )
! {3 S: u3 h$ Q$ v5 @; D  ); ^+ l, s  f- N4 K# g
  ;;6 O% ?6 ~. c/ @; e5 u3 d
  ;; OK in main dialogue.9 U" n; N+ b( c' a9 e2 p( t7 l
  ;;
& P8 j) O9 p; A/ Z# I* Z7 K  (defun test-main-ok ( / flag)8 S- j3 ?3 a5 {) @0 \/ P, o3 }- s
   (setq flag T) . y) _0 P2 k9 k5 Z- t& Z2 `2 |% l
   (if (not (or (distof (get_tile "eb_thickness"))
# ^/ F1 |6 |+ I1 X2 D/ u9 ^: X+ F# i                (= "" (get_tile "eb_thickness"))4 R- `* v, g- s8 e4 I8 s
            );or" }2 H: ^# o$ {3 }
       );not* J$ E2 G5 b: {' d7 J  J/ O
       (progn) k6 }0 G+ }$ m0 H
        (set_tile "error" "Invalid thickness.")6 z8 Z) P- w3 O
        (mode_tile "eb_thickness" 2)8 w% S& o9 Z  Q2 d
        (setq flag nil);setq) U, X4 r# I' N
       );progn
9 y7 Q  s; j5 M% w   );if2 \4 c( g7 [# s
   (if (and flag. X, H8 D- j/ F$ p% k) P7 C# U
            (not (or (< 0 (distof (get_tile "eb_ltscale")))
; z( Q% ?2 k# {8 r0 i- q' j                     (= "" (get_tile "eb_ltscale"))1 x" H7 C% ~. p. X. \
                 );or      . O! ]8 @/ Q9 t5 i) [7 M  n- b1 c4 u
            );not3 g' _2 m: F* q' I0 g
       );and
! q2 k1 ^: l, p       (progn
1 g4 Q/ n5 ]  A: M- r$ r2 u% N        (set_tile "error" "Invalid ltscale.")
. t3 B( l/ X$ A2 W4 k        (mode_tile "eb_ltscale" 2), U- r' [1 }$ v4 z; z0 o8 U
        (setq flag nil); ' }- W: D9 Q- U' o8 c: r+ l
       );progn then
5 x( n( o9 z, I; C   );if& `8 |. X) o6 C3 ]7 q: G
   (if (and flag
% ^- x2 J3 W  [5 J5 F) t          ; Don't test the tile's value unless it's enabled.
$ s: k& M" R+ B          ; We're not set up for the display-only value1 D  u' E5 ^. u0 B/ p
          ; of "" here in the error handler.
8 Z2 c1 s5 E4 B, `          (= 2 (logand 2 eflag))
( Z' J- W, h& L. }8 t( n          (not (or (< 0 (distof (get_tile "text_hgt")))2 F6 K, O) P8 y! D0 `* f( t! T. T
                   (= "" (get_tile "text_hgt"))
# a" ?  u8 d% v+ ]/ ]               );or
' a$ U- Y% ^+ G1 f( _1 ]' `          );not) q6 Q6 l' d' \, L9 D
        );and0 l/ @% w6 g" ~& a# A
        (progn
/ ]/ o! H4 d) Y         (set_tile "error" "Invalid height.")
% q2 u+ t, c0 |2 G, j/ I         (mode_tile "text_hgt" 2)
9 n( Z1 C' l4 j! W+ n3 N         (setq flag nil);
+ N; n6 X% R4 X: E( X        );progn then# E! p" E5 l1 h. A3 i
   );if
" U2 Z: T$ p1 L1 j   (if (and flag
! I& ^4 h$ c' J' G; A0 f6 b& g: j            (= 1 (logand 1 eflag))
4 c  w0 t" n1 I4 w' l; j# q            (not (or (<= 0 (distof (get_tile "poly_wid")))
. @; G/ w; o9 T/ G' ?                     (= "" (get_tile "poly_wid"))2 a3 T, P7 }+ I4 a3 f- W/ ]& P
                 );or# k/ v8 K6 F2 ?" e
            );not3 _8 r+ w8 B6 o1 y6 J- k
       );and0 Q9 t$ n. C2 W1 p' L
       (progn
: D; v: W4 j: C( [; P/ ^        (set_tile "error" "Invalid width.")$ p! K8 K' c+ X: \
        (mode_tile "poly_wid" 2)
, l( c  Q6 i4 K9 }* }# e        (setq flag nil)4 w/ j8 W3 I$ C$ @3 }; F" a
       );progn then
. X# v: E6 I# k! a   );if 5 J  T( k# R: j5 g
   (if (and flag
! b, o/ Y) H( N6 o4 u% t            (= 1 (logand 1 eflag))$ {0 t) y5 T. B5 F+ V  G, D4 _
            (not (or (distof (get_tile "poly_elev")). Q* V) C, I9 ]) c* j3 Y& x2 i* C
                     (= "" (get_tile "poly_elev"))
8 P0 S( n3 l; @+ d5 W( f                 );or
# e1 ]( L. H$ h7 X8 Y            );not
6 m4 f7 Q( ~7 x% @0 L5 L        );and' v0 T& y! E; K
        (progn
, ?; `) g4 a) l5 h' q         (set_tile "error" "Invalid elevation.")
' A/ }# u5 ?% I7 D) u         (mode_tile "poly_elev" 2)
2 s3 X" `8 [  H  Q1 K, ^         (setq flag nil)5 z, M+ c( p( V7 X) W% l
        );progn then# j2 y' p$ y0 Y# O9 t6 _
   );if  
6 y8 N# I) a- K, M0 q  x- T   (if flag 6 z; \0 ~3 U: n5 s( [" K
       (done_dialog 1)
5 L) z& `" h" J   );if
+ c; B  I3 s) ]9 V/ h4 }  );defun test-main-ok7 H! z3 e  w0 A/ |7 d2 e* e
6 P$ `, L6 V0 C5 g6 }0 _
  ;;( ^0 V, e' j! S
  ;; A color function used by getlayer.
4 R% P0 Y: o& D3 g! F; O  ;;7 x3 |1 n1 O) S0 B+ W$ N
  (defun colorname (colnum)4 O, M* g' ]6 X0 H
    (setq cn (abs colnum)). a3 |0 k% W- ]/ k7 E9 {) S
    (cond ((= cn 1) "red")
1 M& \/ A# Y5 M. e* A# U          ((= cn 2) "yellow")+ g. U1 H) c: H8 R
          ((= cn 3) "green")
8 q4 _' p* W6 `          ((= cn 4) "cyan")6 j/ E- ~4 }& y7 F5 K# @0 w
          ((= cn 5) "blue")
, s) n2 c5 @! v          ((= cn 6) "magenta")
2 I% {  K6 N" o. B( H4 K( Z3 B" V          ((= cn 7) "white"); z; `9 S) Y' l# k" h4 b
          (T (itoa cn))* s# _) ^& `) p5 a% E$ ?5 f) |
    )
3 I6 {# d* T- g5 v; i/ `. u1 z  );defun
- Y' {- x0 I4 b4 u9 i
5 u; Q# {% r8 }$ \# E;;; Construct layer and ltype lists and initialize all
9 A) s6 M0 Q+ G; V; x- A;;; program variables:
. h" h/ \: d2 x
2 w; w0 A9 e$ A: `4 h1 ?  f;  (makelaylists)                     ; layer list - laynmlst* Q+ {; c9 F& E/ c- t

( `+ _. @9 n) H; }% E& O
1 ^+ b: _6 v, K$ v  u0 [6 i  (makeltlists)                      ; linetype lists - ltnmlst, mdashlist: N2 n" @6 o+ j' {
9 m# q  C# o+ X) e+ L
  ;; Find the property values of the selection set.
0 D- ~* S4 W6 K; D  ;; (getprops ss) returns a list of properties from0 ^6 g7 v, r9 E; ^( ^+ _+ E0 e
  ;; a selection set - (color ltype layer thickness HEGHT STYLE WIDTH).$ x; w8 {* E( B
. ?; c( I# b6 g5 S
  (setq proplist (getprops ss));@rk interesting things happen here& Y3 C& R1 n* Q; ]% k* W7 c! D
! s% C. x. }2 I/ \, m- M7 C' f
  (setq
* M" a/ W* {2 p            ecolor (car proplist)
) z! U+ F$ b) w9 \; E$ |            eltype (nth 1 proplist)* h* }' {+ K# O( C
            elayer (nth 2 proplist)9 G7 f# E% U( w/ D$ E* M
        ethickness (nth 3 proplist)
( O: n1 {7 k) h; v' c5 E3 E          eltscale (nth 4 proplist)
% }/ J* |* ?. b3 V            ewidth (nth 5 proplist)5 b% |+ r: m7 J% ?
        eelevation (nth 6 proplist); P- H6 @  Q1 e# f  ~, U
           eheight (nth 7 proplist)9 P% j8 i% J; L; T' I3 f8 Z
            ;etype (nth 8 proplist);commented out and replaced with the line below. RK." E6 ~5 ?2 V* B* i
             eflag (nth 8 proplist)
, @/ h3 {* C( h            estyle (nth 9 proplist)
4 W2 h- u% H4 U           poly_ss (nth 10 proplist)4 b  d' n6 ~9 f3 h6 }1 l) G+ V
           txt_ss  (nth 11 proplist)
: K  {4 Q: v! A1 G  );setq
7 K, ]& C9 H. p3 D0 R4 H5 a  }
6 B  l6 y% E8 A* i+ I& B! A  ;; Find index of linetype, and layer lists3 M) C4 s5 D& a. O; Y
  (cond
) E* r4 }9 Y. O2 o# O' w    ((= eltype "Varies") (setq lt-idx nil))
3 b3 ^! J5 h( ]' @' ]9 ~6 z, ]    ((= eltype "BYLAYER")8 ]5 O; F+ y! ]; z2 x5 p# d
     (setq lt-idx (getindex "BYLAYER" ltnmlst)))# u! ]! [- J* w
    ((= eltype "BYBLOCK")
$ q3 q0 S" I) r" w9 x  b, G     (setq lt-idx (getindex "BYBLOCK" ltnmlst)))
) I8 ^4 ^+ I4 q" T. l1 ~+ K    (T (setq lt-idx (getindex eltype ltnmlst)))8 h$ ~8 q* c; U. S. W+ N. t
  )
, J) Z2 N- M; [# S7 h7 n) c  (if (= elayer "Varies")! {- ?3 R4 ~# x% m. m
      (setq lay-idx nil)# U/ w/ ^2 c  O
      (setq lay-idx (getindex elayer laynmlst))' l+ p) w( `$ g1 j) U; R/ w* f/ ^
  );if
* H# k9 s1 M: q' g  (if (= ethickness ""). U) h& i. y+ t! ^& I' d
      (setq ethickness nil)
$ g9 b9 {' D  I( o  );if
$ q7 C" ~/ _) h# Q, f  (if (= eltscale "")
0 q, d" f! c) B# s) K) ~      (setq eltscale nil)
/ ~1 C+ l6 w" Q! e. E' A6 U; y  );if
! f' f" v4 j0 Q. H6 M, [8 H1 ?( ~! }' X; o
);defun ddchprop2_init   ; end (ddchprop2_init)1 J5 E( c* i, K0 i+ c
7 t% R# b& {8 s5 R- s3 P6 x, s
;;; (ddchprop2_select)
+ g* S% K' P( Y1 A6 T( K;;;8 O7 C2 X# A) ?7 g1 x6 n
;;; Aquires selection set for DDCHPROP2, in one of three ways:5 e, B& c% r4 E9 g8 b2 C
;;;' h3 l$ _: h2 Z6 J
;;;   1 - Autoselected.; G0 V1 _3 E  Q  p. U2 }- k
;;;   2 - Prompted for.3 q' K! {8 W( Y) E- S: }
;;;   3 - Passed as an argument in a call to (ddchprop2 <ss> )
# U7 h$ S8 O& z9 F/ T;;;0 y; q+ {1 X% U$ k" _( K; _% N
;;; The (ddchprop2_select) function also sets the value of the8 D/ V. {# {, ?# Y/ V7 b
;;; global symbol AI_SELTYPE to one of the above three values to+ Y! |6 n' L7 w! E/ g9 j/ f1 u1 P+ Z# H
;;; indicate the method thru which the entity was aquired.( L9 O5 c; G" P( i/ |. x
) k+ ?+ B: I; K3 X, w4 o

! S8 T$ u5 M( n( T(defun ddchprop2_select ( / )9 f! B% e% h0 I3 e+ v

" {8 E# Q7 }8 q$ H% s, Z" C4 H
, q" M$ C7 |$ a( O% V) g6 u;returns only entities in ss that are in the current space.
& g! e4 y3 t" S! A. B9 x(defun ss_in_current_space ( ss / a cur_space ss2)
( F$ r" l1 `# M, ~: a/ c( G/ A4 a
# N, t  q# J: S- j0 y5 ` (if ss
% T( ~$ N5 z+ s8 V  f5 C     (progn3 b: d+ ]8 m4 e0 X
      (if (and (equal (getvar "tilemode") 0)
. G, f% m( P- O. |2 j               (equal (getvar "cvport") 1)
: R; H+ Z* S$ `; Y          );and
; S5 p/ |. T4 u+ N0 D; \          (setq cur_space 1);then paper space is where we are.5 Z9 S% q- f; V' R1 X! I4 ?3 q% c
          (setq cur_space 0);else model space.
" J, I. f! X5 w* {9 z      );if
: e; F( {" q* q( Y      (command "_.select" ss "")
! y- t+ J3 f5 |2 k/ _& o      (setq ss2 (ssget "p" (list (cons 67 cur_space))));setq# A. L" L6 S. q! {) Z7 Z$ v
      (cond                              ;;;;;tell the user what's going on.
0 H# f; J6 B+ }* u8 a+ J% h$ P       ((not ss2) (princ "\nNo objects found in current space."))
; o) f: J+ i" |4 {" Q3 o( W& D       ((not (equal (sslength ss) (sslength ss2)))
* R7 |7 Q  _) t8 m6 F+ e. H% l        (princ (strcat "\n" (itoa (- (sslength ss) (sslength ss2)))
* j" H7 s. z& {/ J8 O9 O! W                       " object(s) were not in current space."
( U) F3 u8 d$ p               )
4 q$ Z/ k9 ^0 [9 m0 B1 @4 w4 c' w        )
7 s* [1 m# }. T4 g- m! }$ ^9 b       ) 6 ]' S6 `$ U+ ^" s6 m, l
      );cond
! c+ E' H6 \" r" F- |& b; Z     );progn then& H* G) }; Z' O# d
);if  / x* }+ y6 H5 K$ I9 \2 m2 M
ss2( g  l; x% x, X3 ?, w9 O" Q
);defun ss_in_current_space) u5 {* H& x3 X5 W+ w) {
/ P3 I( R# L* I$ C
+ e' ~3 q6 h, Z( b1 z8 a7 |, Q
;;;begin the work of ddchprop2_select6 ^8 C, G# M: b2 ~

2 T7 }- x) N' _! ?* W ;; temporarily restore original highlight setting.* g9 B  S) P# B3 f! W
(b_set_sysvars (assoc "HIGHLIGHT" (car bonus_varlist)))
! {/ ^5 s# ]2 ^* b  E (cond
. |8 K5 G/ }9 R, V( j/ I7 r   ((and ss , t- i( a5 f9 b) u: p5 _
         (eq (type ss) 'pickset)
1 L+ u* l0 z" G    )        ; selection set passed to- p0 F5 x1 M( n: I5 r, _
    (cond                                   ; (ddchprop2) as argument! l9 M) f  S) n  L0 _+ j
     ((not (zerop (sslength ss)))       ;   If not empty, then
* t/ H5 Q. O( Z# x& Q      (setq ai_seltype 3)               ;   then return pickset.+ }3 s5 c# _  A6 P* @3 D/ ?
      (ai_return ss)0 M- I& e: s4 x* w  a# f
     )
2 w. r  z3 |: ?1 A/ k    );cond close
* ?! w: R7 t1 M' c1 S" E   );cond #1! z& B1 s4 L  o
   ((setq ss (ai_aselect)))                          ; Use current selection
/ v: f  a/ o9 @1 M, W1 T5 E# i                                                     ; set or prompt for objects+ M+ ]4 }2 K/ q; }1 K$ b
   (T (princ "\nNothing selected.")& Y( e' w) G* X# W
      (ai_return nil)% S3 q5 ]3 ], O% ?" Z
   )4 \" x7 L) S2 K7 O
);cond close
+ _9 d6 s/ ]" z8 [ (b_restore_sysvars)1 W4 D" C/ N) Q4 R' d

, D. y$ o9 ^; r( Q' Z% {! o3 e ;(if ss  h" N- p7 v7 m; @4 i6 U1 _% r$ N
;    (setq ss (ss_remove_locked ss))
9 [0 I6 F  ~+ K% z& T: ^; o+ T0 ~ ;);if
2 t/ ?8 q* ^" l8 l8 Z (if ss$ r% C2 W4 A1 z9 s( ?. g3 ]; n
     (setq ss (ss_in_current_space ss)) 4 Q/ i) z/ I) x  H' A1 m# e
);if
- Y. T6 {9 b- b7 u1 O9 d$ L; z- `8 ?) Z6 g: `
ss& r) M1 |' h& V/ w  H% _
);defun ddchprop2_select6 M: L) g% @$ s+ ^9 V* p) D  x
) M! B1 \. K+ E/ |. H

" K& p; V; J' }* ~;;; Define command function.& H# O: L$ n2 q$ {- z
(defun C:CCH ()( q% X8 p: D8 m, D3 D. I3 C: P' V
  (ddchprop2 nil)2 h3 E0 D0 T; P
  (princ)! B. U# f) c+ Z9 Z4 Y3 \. X% r  z
);defun
+ [" o* _5 Z! M. J5 D8 y# R; v
* _8 Z. a  [7 g) w* h4 O, P" [9 ]% h9 z& g# h1 `
;;; Main program function - callable as a subroutine.
, _6 v5 d: o" G;;;
# ~4 e' i! ^5 Z1 t5 y;;; (ddchprop2 <pickset> )
) S/ A! f7 x6 e% r  L;;;
9 t# }5 [& M- l;;; <pickset> is the selection set of objects to be changed.- |, w1 e. m1 i/ P% o# B
;;;
9 n8 {* h' k+ {  E8 h  L;;; If <pickset> is nil, then the current selection set is+ H( B  Z: y7 q+ e3 n$ m: I
;;; aquired, if one exists.  Otherwise, the user is prompted# p" s  f2 {- M/ B/ L- G8 d
;;; to select the objects to be changed.
8 q5 |7 e! U2 a& D, O;;;
' j* z" G- z; I  \6 E0 x2 c1 };;; Before (ddchprop2) can be called as a subroutine, it must
( q2 T- z! U; Q* p1 K6 N5 c;;; be loaded first.  It is up to the calling application to
1 T' i8 C1 ~" N3 Y8 P;;; first determine this, and load it if necessary.
( X( g' O8 n7 I
; [& y7 R5 |6 {2 S- v: t- k(defun ddchprop2 (ss  /
' N8 L' D5 z$ z' R: X
% `0 X& n4 G. _$ r) I5 f' R                  a
. I2 _" {6 u$ o7 }                  add-mdash
* o+ B( x1 L% @0 e) z                  assoclist3 b* q+ m6 b) h# Q3 n
                  bit-70
# H# E+ c/ ]# y; ?1 i                  boxlength
4 R9 d: O& s. D6 v                  bylayer-lt
/ ^) V2 Z; z3 F                  bylayer_col
9 m; _% X" V2 k$ W) p                  bylayer_lt
- H. N" g0 t6 E: B                  call_chp22 Y8 f; |, }6 m/ k' i& l
                  chk-col
% j* Q$ i# v: w                  ;chk-etype        ;var removed by rk
# w+ W* t6 E; e9 e                  chk-lay   
3 w, I$ U' S5 F+ R5 Z& x                  chk-lt, S* {# [9 H* e! ~; b- a2 }2 g
                  chk-lts           ;var added by rk
, W$ q9 l/ z+ I6 U$ a0 b                  chk-th
, W2 R$ v6 A: k$ x$ i6 @6 N0 M8 X: L. S6 T                  cmd4 N- T0 ^  d* B  S" l  H- x
                  cmdecho' S6 ~" E1 o4 ?# y9 x% }& ^
                  cn
( U( [. q3 c3 H                  cnum: q& m* @+ v" ^' |
                  col-idx0 C& D) D- D- y$ n# x! H
                  col_def- d5 c4 U! h  L& J  T
                  col_tile
9 \3 U2 P( ~  X& j" A0 C4 o# T  d                  colname
2 u" V+ X! b" |                  colnum! S: V. A9 w+ d5 h2 J& {
                  color. W1 E5 Y3 h) W3 B: a# G
                  colorname8 |% `6 |+ A* y9 U  n: A% N  X
                  cvpname( e3 e2 A1 w* n/ ~5 a; l2 ?0 C' V
                  dash
. c" ^" l0 U0 z+ `: f/ J                  dashdata0 l, }' a: Z, g0 Q) N. }; }
                  dashlist
4 @) ?# k4 e& E5 m/ f+ D+ F; w  ~                  dashsize
* s, I- v$ a% `4 y" e7 ?( \                  dcl_id
2 P$ }$ j) ]/ T' O/ o; N* e                  ddchprop-err8 C% P) C, j) ~: m# ~6 ?
                  drawpattern
/ o1 p! y" u0 S6 V                  ecolor/ n' `2 c& N6 d$ N! }
                  eelevation
5 i, y/ m0 E4 `6 \# K& s                  eflag
1 f% s: V) U( e& p0 e% U% s                  eheight: Z' U" j, @% i2 Q8 T- `
                  elayer
2 T3 }. |! X: X  g- c. ?4 _3 Y                  elevation( Z, {  Q+ W) `% l  h( W
                  elist
' f5 d7 A% e  }4 [# ^                  eltscale
- U! o  e' R7 O& F+ n* R# N9 V                  eltype
" g0 L3 i6 v( F* S                  en
$ _1 E8 ]. P$ Q8 p                  ename
+ q3 @" [3 v8 o  T8 y% d0 p                  ESTYLE             ;var added by rk
2 s  F1 j: ~2 R4 `: v                  ethickness' n* E% R; y: w7 ?9 r1 N7 ?
                  ;etype             ;var removed by rk8 t1 `1 ?* R; h) }4 S  C
                  ewidth
1 e- Y" z- _4 l1 _6 T! B                  fchk# S- V. W/ A6 V- J
                  frozth7 T, ^5 z, z$ e
                  fx
1 F4 g& P  L* r$ T                  getcolor% o4 I1 U0 _& q3 A3 r7 _& G1 k" A
                  GETELEVATION      ;function added by rk# e  {1 @7 C$ B- n: p, g
                  GETHEIGHT         ;function added by rk$ |  }- L2 E/ {4 j8 e  F$ M
                  getindex
0 K1 [9 ^. E3 T9 a1 a% l                  getlayer" q+ b9 l. Z1 Y0 ?
                  ;get_locked_layers ;function added and then removed by rk 1 w3 x2 e  K0 s) X2 e9 \3 _
                  getltype
! Y! |2 C! \/ P2 t                  getprops; x% F: B  w, z. |7 }  ~. J
                  getscale          ;function added by rk
& l7 c) `( b- P' [                  GETSTYLE          ;function added by rk- l1 ?9 E; Z. ?- @2 ~) p
                  getthickness# l4 H& |! }2 s1 V+ l: k
                  GETWIDTH          ;function added by rk
" l9 V5 q0 Z5 V                  globals
8 |/ z* U1 U, k2 I, j: B7 h+ `                  HAIR_STYLE_LIST   ;var added by rk! }. @0 c9 H/ o4 p# G
                  height
" @9 C+ ?6 d6 I6 Q% A+ {# |                  index5 A6 {2 M5 ]6 i( F
                  item
, q/ y. m9 c% V2 }, J. F                  item1) f9 v5 E" }* Y/ J$ W
                  item2
  i7 t/ I7 _: L5 t5 f                  itemlist
9 t. ]+ e. ?; U  r" R. A0 A; u                  lay-idx
( `: W) |; g/ e                  layedit_act$ L; ~8 {6 s1 I" f2 V0 d
                  layer
6 F0 \7 q8 A' |                  layinfo
3 @6 i% g" c$ E3 r$ m+ R                  laylist
* e% u4 Z2 i9 ], I6 _6 n7 o                  laylist_act: w# e7 ?" y3 w/ i: y. A1 Y
                  layname
& S- i. `8 V8 h: ~2 e; y; k! O                  laynmlst
% j& C4 _0 A+ x0 r& f  O                  layvalue
$ S1 \9 I7 p7 x/ J3 F                  linetype- s9 l! O( h$ C$ N" n& [9 w8 @
                  list1
' H( q! E  n0 V. W5 j. H/ b: C& e                  longlist7 f; O+ V4 _1 h
                  lt-idx* _" D: r( c; a  [9 d# P
                  ltabstr
: B7 l# H" Y; b                  ltedit_act) G7 |# b# o: o1 Q
                  ltidx
  n4 z5 L4 E9 B3 ^/ }0 C  w- b                  ltlist
9 q' D5 L$ w* G* _( B& }9 P                  ltlist1
/ q1 x) h  I5 T' \# i1 d$ P9 A8 i                  ltlist_act! ?7 X+ d9 D+ C6 z/ N
                  ltname7 [6 A* m/ h' ?3 k* ~
                  ltnmlst1 t0 V4 V# d/ W- f0 e: g6 Q
                  ltvalue( t5 r- t# s& m
                  ltype5 Q8 [7 y2 \9 {6 O9 y* F2 I1 e
                  m
- P- v4 j6 M0 t                  makelaylists
. t9 Z: z5 ^3 j2 x0 Y                  makeltlists
& j# y4 p& f) V) b& t  L; S, p6 F; G                  match-col4 l. U2 [- t. m5 h" }% v
                  ;match-etype          ;function removed by rk
  e1 L+ [/ D3 y* N; C% d# X6 D8 K                  match-in, q$ c% x* Y. P  ~
                  match-lay
: K! Q% d' l6 w) l                  match-lt
$ @( g' }% {+ Z) y2 i' F7 n                  match-lts
% G* B5 K) Q/ |  i                  match-th
: q, t% w3 ]6 _, y+ Z5 {' G& S                  match_col
. c8 m3 G: }6 A4 J% o4 T- L# {" ~                  mdashlist; ?4 @/ {# e0 ~" c" x6 \
                  ;MPOPLST               ;function added and then move to ac_bonus.lsp by rk
, {0 h2 z) G* g# G* j9 L; H6 N9 U                  n
" u! `4 U: c- `. _1 y                  name4 U7 a9 s9 a7 p; D0 V1 J
                  ncolor6 K  \6 A4 w! J9 y) R# M- J
                  nlayer! U; [$ X: D: h, A6 ^
                  nltype$ q( h; H: @: @. r% Z
                  nthickness
( T. J7 w  ^  Y6 y$ Y                  off
1 s* K$ u% H3 A8 X: k7 D- G" u                  old-idx! R& |7 i% r8 J! T+ j; L8 q
                  olderr
  m6 A, L& c% n' l2 B7 i* I2 }                  on5 W7 g; m. i7 X! g3 j$ L
                  onoff# ^. z; @0 B: F; m- o' m+ m) G/ z
                  patlist, v+ a% I& e+ u( O& s
                  pattern
8 g7 y% ?* `/ D& r; Y& L9 m; r+ W. ~                  PL_WIDTH_GETTER       ;function added by rk
/ R/ Z+ }+ V/ U; |- l9 X* u" N3 _! R                  POLY_SS               ;var added by rk
4 U5 D+ \$ S* U7 a8 N0 c, z                  ;POSITION              ;function added by rk and then moved to ac_bonus.lsp( T* \! m5 T2 |! M& b) j
                  proplist  A8 X+ X( A7 z) f0 `
                  reset-lay" x$ l" v) ]* @; m* {0 m
                  reset-lt& R9 x; I% V  ~0 \* ]3 z" u- U% K6 T
                  s
5 M' o! A! S& y( Q' s" X: z                  selset
- g6 `9 A% J: _8 ]' o. |                  set_col_tile& X. n6 ~: ~, }; N+ k, T+ m
                  sortlist- O$ l5 i0 r1 q) W% W1 I( \5 r
                  ss; M0 l7 z4 @2 A7 _
                  ss_in_current_space  ;function add by rk.( F  e1 c# `: v5 U6 a1 d
                  ss-index
4 O8 R- V8 r( k; V3 H- v7 |  b2 o                  ss-length
# d9 _, `  Q8 d2 h                  ;ss_remove_locked     ;function added and then removed by rk.
- t9 y7 Y: f7 n& {8 d* z                  sslen" ]+ t2 Q5 I1 {7 C1 n
                  temp_color
# V3 O/ x/ X+ n+ A" |                  templist/ e" ^- m: [/ G
                  test-main-ok! y2 W4 f  x$ j8 ]& s7 B
                  test-ok
# ?' N* K! \; ?$ q3 m8 H) w' s( J                  testidx) S5 N. M0 i+ n) [: L
                  testlay
6 y1 e8 P! n9 `; [% t                  th-value
7 t4 ~' B( B( v. c0 n) }. M8 k5 N( A                  thickness
" E3 I; L# E& P( i3 Q                  tile, q% d  J! z  e' b! g
                  tile_rect
6 j9 \! B1 X; ~1 j  S9 V                  tilemode
* I! H+ C4 g; G                  ;TNLIST           ;function removed and moved to ac_bonus.lsp by rk
4 B+ r# b+ D& F: W0 o  ^- S' ^                  TXT_SS            ;var added by rk
$ \: X/ r: `1 S. s8 X7 {2 o- e                  ;undo_init        ;removed by rk.* o% S5 `5 O; b
                  vi
9 g; y) B* j* v- W" B0 i$ _                  vpf8 v3 ?  |- S4 K: a- K' l
                  vpldata( d/ D" w7 Y3 X- n
                  vpn
- W; `( f4 |7 ]9 Q9 ]0 h  ^                  which_tiles
, D0 u1 Z* M4 W                  width
8 N4 [( y. ?) w0 ?8 z. n, J                  x/ P" Y# o4 n/ ^; s& b" c0 G9 l  F
                  x1
6 O6 C1 x+ N. A* z                  x2. W9 v8 W8 H$ d, Y8 `# e
                  xdlist
# P8 w8 }5 D; ^: U% D; R                  y
# R8 \" P9 M/ d& g, b& N6 j                  y1
2 J2 I# _  Q1 S1 B. B9 @                  y2# l3 ~6 g7 e8 V2 x
                )$ t2 w/ q6 g9 Y9 u7 h# V4 b& r

0 {7 Q: z$ [9 b  (if (and (not init_bonus_error)
$ u" R4 P; K4 H  `8 M           (equal -1 (load "ac_bonus.lsp"  -1)) 3 t2 J7 d2 ~+ J, _
      );and  @+ I. t* F7 l* w
      (progn (alert "Error:\n     Cannot find AC_BONUS.LSP.")(exit))( F0 d5 H, }, H6 F) ^5 y& H. a" t2 C
  );if
7 k, O( t0 i* W* A+ O# w" S  (init_bonus_error (list
6 n% }7 P: i2 D$ n4 B                     (list   "cmdecho" 0 & w9 u4 R. p7 D8 t
                           "highlight" 0& y1 Q* t/ C; r+ ^2 b
                           "regenmode" 17 Z9 B6 p0 U( V1 j5 x. q
                             "ucsicon" 0
) s$ o! j1 C6 k, P' O+ @0 l4 ^                     )
  L& |$ K7 g, d$ y& ^+ c7 j                     T     ;flag. True means use undo for error clean up.                    
. C/ y/ E8 v. j                    );list  
, V3 {% N1 E$ `) r% Q. r. S+ D  );init_bonus_error
( f' d  Q  A* m- i! x- ]" u6 [0 Y2 k% t2 w) d
  (cond
8 R! s# ]! s& U" `* a     (  (not (ai_notrans)))                       ; Not transparent?" r. t* }7 F  a0 d, c# c* B7 p
     (  (not (ai_acadapp)))                       ; ACADAPP.EXP xloaded?, y, e- x5 _* u+ W
     (  (not (setq dcl_id (ai_dcl "exchprop")))) ; is .DCL file loaded?" x* g2 s6 @9 o; Z: ^5 i2 p' i2 ?# ^) |
     (  (not (setq ss (ddchprop2_select))))       ; objects to modify?
; L1 b; S5 a) q$ K$ [  g5 I     (t
( a. B" Q* a1 U+ I        ;(ai_undo_push)
6 Z% r* Q5 J2 F% j* E        (ddchprop2_init)                          ; Everything's cool,
) J: m; l# ]3 Q- @        (call_chp2)                               ; so proceed!' E2 D* }: {. Q
        ;(ai_undo_pop)
" J6 R: d5 h2 T+ j; V# j2 Y% I  d     )! F2 e* ~) P; t7 U3 g
  );cond close0 A& I6 I. L# N3 ~$ [' R
$ K1 j$ p+ B/ ^
  (restore_old_error); j0 i$ V2 s& V5 z) W0 V) N
% I* S# J: t+ f4 S8 u% ]9 B
(princ)' X8 F% h! W# X% s# I# P
);defun ddchprop23 }; ~. n# F' M% e! t+ @' {
; P6 z9 d! v+ x- n0 J# i4 u6 R# H+ q5 ?
;;;----------------------------------------------------------------------------( n4 A5 I: e) r6 u# @4 |% u
- [9 G' a7 q8 T: }4 Q. m: P* q
(princ "   EXCHPROP loaded.")
# P8 [5 T$ _; I) W" b+ \(princ)
: ?) f4 Y+ K5 ~
+ L- u" @2 B1 W;;;----------------------------------------------------------------------------- w0 b) w8 B; T
;;;---------------------------------DDCOLOR_LSP--------------------------------+ a7 f% @9 l) s( `: U/ j
;;;----------------------------------------------------------------------------$ d1 v# l" H1 R+ M9 Y: U; C* x
0 t& R+ |; H2 S5 L' F0 T& w" w
; Next available MSG number is    24 0 s3 w( _  R/ M' g7 r
; MODULE_ID DDCOLOR_LSP_6 b3 t& V5 i+ n; L1 f1 {
;;;
" F( `. q$ |% F( f;;;    ddcolor.lsp
# k5 F$ E( t+ i9 M% B;;;   
5 ~- ~5 R  Y- [  x& f* X5 e;;;    Copyright 1990, 1992, 1994, 1996 by Autodesk, Inc.: m( ?: d. F4 z
;;;
" B& n9 z* ?3 o0 F;;;    Permission to use, copy, modify, and distribute this software" H  E3 x$ P2 W2 @- a- ~8 a3 ?
;;;    for any purpose and without fee is hereby granted, provided3 G1 Q5 Z3 ~  q1 F
;;;    that the above copyright notice appears in all copies and
9 J- Y) r; m7 w, q9 n( ?" X" A;;;    that both that copyright notice and the limited warranty and
: P/ A+ I( y, m;;;    restricted rights notice below appear in all supporting
7 Q6 s  C, d' s. U9 N;;;    documentation.
/ k2 M* ?' ?' r: a7 |# M% C6 O, E;;;9 y% M- X' X6 Q/ a. N! B3 H% W
;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.% t$ `# n; T  h: J' g& [" x
;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF; r. [% J2 I2 K; n# i* r2 `% J
;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
8 _4 K. V* t( }, P+ ~;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE7 Z; F2 H& t# C1 P3 @
;;;    UNINTERRUPTED OR ERROR FREE.2 Z8 o! z9 D# F8 l) ?
;;;
; {  v- o/ b, L+ f, J% _;;;    Use, duplication, or disclosure by the U.S. Government is subject to
* U) x- N7 l  ~/ A) d, l;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer3 X, ^  [! D* \
;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
/ q. s, U( {' ?, ~6 r# ~4 u+ L, y;;;    (Rights in Technical Data and Computer Software), as applicable.
( @) l& Q8 K/ y9 A;;;$ K# C# |3 S- l" y- A( w. ]; ]
;;;.
( B2 O, Y5 G' F, M1 B;;;' N3 f# F0 K3 ?2 M1 @& q' I% I2 y
;;;----------------------------------------------------------------------------
3 l2 n2 V8 W9 ~( _8 t0 G;;;    DESCRIPTION, K5 K: u+ B, H& x1 g- Q! ]
;;;     
' c1 x6 S  x8 ];;;    Chromatic Pallete style color selection dialog.
5 u) o! A0 Y! V2 r/ w' [! z! m;;;    8 K1 G2 H: {& y+ P* P7 Y+ O
;;;    Globals:* ~, j! X" l/ z0 P  ~/ }% \
;;;   
0 W! X4 e1 T) H2 ^1 H;;;          chroma_color - Integer color index.  The last value selected
7 r. @4 \0 y* [;;;              by the user in chroma dialog.  It is not cleared or reset
, K  Z- Y% d- [. b) i: O1 P;;;              by a cancel.  Only used for communication between callback
! E9 O( O( o9 Z;;;              functions and the (chroma) funciton.
) e% X/ T; g+ _5 i( @6 `# m;;;   
+ d4 W9 F# m: V- n;;;    Depends on the definitions for the dialog provided in chroma.dcl." w% n* P4 V' v6 y, ~) r4 X
;;;    4 ~" }' J2 X  c+ z# m' V3 k% a+ C+ K  |
;;;
3 e: E2 @% X7 ];;; C:DDCOLOR -- Dialogue front end to the CECOLOR sysvar.  Uses the chroma
* k* q. i( I8 D0 _;;; pallete style color selector.
" U8 F4 X5 t- s% c7 I- };;;
4 U+ V! B1 ^- K% g, c# F; M;;; ===========================================================================
" M3 s- l7 {0 Y;;; ===================== load-time error checking ============================9 Z! ]) m% Y6 a# q
;;;. z6 h5 w- |; R$ T4 n, D- D; s

6 _4 P  G+ i' V$ d  (defun ai_abort (app msg)8 d! o0 `5 `" Q7 S! ?, p
     (defun *error* (s)
+ n/ z8 S/ U* w, m6 g        (if old_error (setq *error* old_error))
. W- E( _8 i7 T* y5 B/ e# r- i2 _        (princ)
4 s5 G. v2 G  \- T. ~! b& Q/ s! i/ x     )8 s# ~0 o& @2 u6 r. X
     (if msg
. R$ N, ]5 D* I3 P7 e       (alert (strcat " Application error: "
8 Q4 D3 s2 N! f  O                      app: j" Q8 ]8 `5 _+ e8 i
                      " \n\n  ": F: k5 T8 M1 w8 f
                      msg
: U! P  C' P$ T$ n, _/ o% k; d/ S) p                      "  \n"6 n9 p  K+ b! r1 r/ P8 `2 D
              )
4 x3 E2 v6 i9 D7 _# F+ w       )& z# f6 B3 l9 V6 o6 l! Q  T, [6 ^
     )9 L; T* r  U$ ?5 i
     (exit)# d3 J1 r' k6 ^
  )
/ Q3 P. \0 o. @% J
  w  l: `3 F9 H8 o. @;;; Check to see if AI_UTILS is loaded, If not, try to find it,
* I5 t8 s/ T3 n! V$ b;;; and then try to load it.
# F& H) }2 ?8 i1 D6 m$ C; {9 W;;;( |8 E& Y) R7 V8 u9 d9 P, U
;;; If it can't be found or it can't be loaded, then abort the1 q! o) v' r' z- q3 d6 V) T+ b$ T
;;; loading of this file immediately, preserving the (autoload)$ S; G- E& M! j& B
;;; stub function.0 E. y2 \' P, R: a9 u
  T8 l- b6 z- `: T9 F
  (cond
) k. J: E* m2 E3 ^* v' c     (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.
0 Z% F/ c9 i; S5 W
9 X: l7 g+ |' d     (  (not (findfile "ai_utils.lsp"))                     ; find it0 a- k! l* @  `" Q& P0 F7 P
        (ai_abort "DDCOLOR"
8 R3 B' J- u+ }" w2 l                  (strcat "Can't locate file AI_UTILS.LSP."; N, v& j5 e5 h! h; N
                          "\n Check support directory.")))* N' I9 U( H  N8 I
% Y( I1 S# `+ J7 i4 K
     (  (eq "failed" (load "ai_utils" "failed"))            ; load it7 h+ L& Z  g2 ^" k* I  P; Z
        (ai_abort "DDCOLOR" "Can't load file AI_UTILS.LSP"))
, U/ ~$ W& d) K$ s) D  )3 g& x' Q  d) g1 P6 b+ ^$ Q
1 T0 X- {( N2 ~; U
  (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP7 l3 z/ H  C& B& B! r
      (ai_abort "DDCOLOR" nil)         ; a Nil <msg> supresses8 x2 J1 {5 h/ n% s5 p& k0 \4 t0 p
  )                                    ; ai_abort's alert box dialog.
- S5 j3 R* e, O1 k. ~4 z! p3 q6 H2 c9 i) o1 m% r
;;; ==================== end load-time operations ===========================+ M( M* x- v' E

0 x4 l& H, q' C5 J  W0 z" r(defun c:ccc (/ co_oce clrx co_err co_oer lay_clr)( n/ Y) A4 h4 Z

1 n# s4 F) k% D5 j  ;; Main Color function, called by setup code.2 t" u: S' o7 N+ ~' q9 R% v2 H# v' ?
  (defun ddcolor_main()
: A8 ?7 ^) C: B* Y* \! U
( n/ L  w+ L3 r0 |0 a0 e1 z    (graphscr)- f# B% V4 F: Z. V! I
% m- [1 ]- H2 e
    ;; Get the color of the current layer, for possible BYLAYER color swatch.8 W- a) ^, {) ^. \+ a* V
    (setq lay_clr (cdr (assoc 62 (tblsearch "layer" (getvar "clayer")))))
( S4 `( U' u' E) B6 s2 u
( l7 B9 z" l; G* I; z$ L- f    ;; Call the dialog here...
. P5 O0 f! ?3 o$ N    (setq clr (acad_colordlg (cstoci (getvar "cecolor")) T lay_clr)), ^" i, m( |" W5 S4 n9 r
- p0 _$ n3 O; P+ O* e3 Z
    (if clr' g2 Z# T, M. o. Z* ~6 y
      (setvar "CECOLOR" (citocs clr)))' K; U2 i" w& t$ F' o
  ): t8 [( D7 C3 M, _# N" l

4 Y+ T5 f: ]$ g4 @* ?- K" a  ;;;; _0 R) A! V  g" T5 ]7 f
  ;;; CSTOCI -- Color string to color index8 k) i7 Q3 i2 G: f
  ;;;   Convert an arbitrary case string into a color index.
# [5 g, ?* k# m( ^  ;;;   Returns nil if string is not a valid color.
" {9 j7 E  c& b, T2 }- t5 y4 H  ;;;2 l4 u" e8 V0 J  L
  (defun cstoci (str)
( g7 ^8 m, P4 Q, G    (setq str (strcase str))7 [  [2 p& L$ G5 P! X8 J4 j0 t% p
    (cond
$ @; h, }3 d; P     ((= str "RED")        1)  b; I2 m" y2 h. a
     ((= str "YELLOW")     2)% u7 c8 o+ x4 x, y! D1 Y& T0 q3 f
     ((= str "GREEN")      3)' }) L2 J$ s6 j, u
     ((= str "CYAN")       4)) }# H* v9 ^% ~  Y
     ((= str "BLUE")       5)
, b6 ~! D: {$ g5 t$ F9 G     ((= str "MAGENTA")    6)
1 L) W) u6 J/ }- z8 L3 j     ((= str "WHITE")      7)5 q2 S; T( s3 C* Y1 Q6 u/ Y
     ((= str "BYLAYER")  256)
- _5 b* U1 Q1 K( P# I     ((= str "BYBLOCK")    0)( C7 C2 U# M3 u
     ((= str "BY LAYER") 256)
9 w; p' g# u8 `7 F. b, C     ((= str "BY BLOCK")   0)) C3 {. n8 D. T
     ((and (< 0 (atoi str)) (> 256 (atoi str))) (atoi str)), B# c2 m$ ^" {0 f+ K
     (nil))
- C2 p( O  O; K* s+ Z  )) ]$ C; d" I9 k0 a; W: F5 U# {
7 ?! @1 g1 w. q6 x
2 r5 ~" M* r* b6 a1 l. n
  ;;;
- o7 D. @' I/ q  q  ;;; CITOCS -- Convert color index into standard color name.
. B7 v! D' ]/ d7 A  ;;;    Will return the standard and logical color names as text
. k% F" Z9 p. y# e  ;;;    strings.  Returns nil for out-of-range color indicies.
- {. U; r! H7 R* o# n7 M& d  ;;;, e% N' v% F3 ?  n3 |( i! @
  (defun citocs(i)
, B, B/ j$ a0 P0 G1 ^$ Q$ e. |    (cond! W# s8 q9 P/ D& C. I: p
     ((= i 0)   "BYBLOCK"), E: {5 [6 n. c' }; O7 _
     ((= i 1)   "red")
+ e7 q8 m, m9 p! t     ((= i 2)   "yellow")/ k& w4 {- c+ o4 [+ m
     ((= i 3)   "green")
* V7 s$ [: h$ D8 `, K. o6 ]     ((= i 4)   "cyan")( s) q7 T; @+ K% u
     ((= i 5)   "blue")
* X5 O" Y0 X# t& P2 c  @# V9 O     ((= i 6)   "magenta")
; _$ y. {% E# k4 @3 ]# P     ((= i 7)   "white")
3 {; k; W5 J% A     ((= i 256) "BYLAYER")  r7 V: C" e# N+ e; o- p! p
     ((and (< 0 i) (> 256 i)) (itoa i))$ t3 V4 ?  W- j$ u: |' f' \% s& ~# {% r# n
     (nil)): y$ T* d/ o5 O- j- z$ q% b2 o
  )% Y& _  v  v0 ]2 D+ _7 ]% p8 f
$ f" }3 B; U& w9 n
  ;; Start of ddcolor# y: `) y, N1 p. l. l
  (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho
. F* T  K( [& @) b9 e( K) [$ R        old_error  *error*            ; save current error function
: G5 R- l. m( h; |! n        *error* ai_error              ; new error function
) \( ^6 I8 I* w- H. J% y) L! e  )( w- }2 y3 G6 Y6 h% Y* h
' ?& W/ S7 t  W+ i3 S/ l  V2 a$ Z
  (setvar "cmdecho" 0)
) `- n' s3 f2 X, X, }- X4 E' [3 x6 ~* @
  (cond
6 w6 h, T. u1 L$ [) ^2 H* {     (  (not (ai_trans)))                        ; transparent OK$ u* h6 t/ K# y) m# f, w6 I# w8 e
     (  (not (ai_acadapp)))                      ; ACADAPP.EXP xloaded?
3 C2 I4 F7 a+ Q1 s! Z; U; I- D3 }% {6 [8 H9 x" ~7 s7 q% h- C# G
     (t (if (and (/= 1 (logand 1 (getvar "cmdactive"))), b' K5 D; g5 ^2 Y
                 (/= 8 (logand 8 (getvar "cmdactive")))" ?. i/ r  }5 L% k" S8 G* v
            )* i2 A! C8 @: C, U
         (ai_undo_push)
8 I1 ?. y5 p4 s/ k$ x% Z        )- M, T2 Y+ @$ F2 S2 H% u

$ Q0 F6 Y) H3 H3 D/ V4 l) I        (ddcolor_main)                          ; proceed!
7 w) `. g' t0 w6 A$ O. q/ V5 g! r* {& `" c7 a
        (if (and (/= 1 (logand 1 (getvar "cmdactive")))
% F8 H( t. C3 |& W( z9 ^: `                 (/= 8 (logand 8 (getvar "cmdactive")))
9 k" j& V7 e, J            )- a1 T, m! ^* x
         (ai_undo_pop)% ], J6 b! N7 |/ q- i% @
        )) y1 w6 N0 X) ^, h$ |
     )
0 S8 R+ ^: j" O1 \8 a  k: c  )
, R: c9 ]* E" \1 s  f( P* ]; x, g) d4 Y; I1 E  }
  (setq *error* old_error) 4 S; c" a0 L$ x# W  L; J  P% P& ^
  (setvar "cmdecho" old_cmd)
  Y# h. r- L$ ?* \7 a+ @0 l# ]  (princ); c5 G7 j  s: J2 r# S
" S8 H) I; X9 k
)+ |- \) }0 A  V' D' y8 Y: ]
. f, C: ]# o, z3 n- m' |
;;;----------------------------------------------------------------------------
$ ]  P' m- U# f' `" N" Q1 |! @* Z
  m1 W) R% d( O/ T# r( C2 ~(princ "  DDCOLOR loaded.  ")8 D0 ?" N7 H3 W! _( m
(princ)
% @; |% r6 z, e
8 q  f- y4 F" y9 B& S;;;--------------------------------------------------------------------------;
' _7 U7 I! {' F. T0 i;;;---------------Chon NHANH Nhieu Doi Tuong GIONG THUOC TINH----------------;
. q1 s6 t9 d: v. [; B9 A;;;--------------------------------------------------------------------------;" Q. v: c3 U4 _5 W" S
;;;   ssx.lsp
; U- u5 \6 v/ J;;;   Copyright (C) 1990 by Autodesk, Inc.7 V: ]+ o2 V: E9 }* j7 x, L
;;;   Copyright (C) 1991 by Control Systems, Inc.5 A& G! |- |  ]/ A
;;;
) {* Z; x# n' _3 |( d: |  @;;;   Permission to use, copy, modify, and distribute this software and its
: m/ W( ~4 T9 B8 |4 W;;;   documentation for any purpose and without fee is hereby granted.
) C# E3 j8 v9 b! L3 `;;;
/ _: ]1 o1 J" f0 V6 z0 G, |;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.' y' ~& i9 k5 F* v
;;;   ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
4 T' {8 Y: |' K6 c4 x) \  q;;;   MERCHANTABILITY ARE HEREBY DISCLAIMED.
; l' ]) d& _! S  ~;;;& t9 J& {3 o5 k; ?: ~  N
;;;   Larry Knott                        Version 2.0    7/18/88
- _: `7 A. ?% I( c( E6 T3 {;;;   Carl Bethea & Jan S. Yoder         Version 3.0$ r. u( _  y+ F2 g0 ^
;;;   Enhancements to (ssx).( H( s  E0 H+ z- H9 I$ ^! U( i
;;;   15 March 1990 1 K4 O. d. h; D3 T+ a
;;;
" p6 h& d% [+ a  J9 U6 ]4 t;;;   ARTIST Software, Inc               Version 4.0   December 1991
' r) Q: f! M/ q9 R$ b$ R' e;;;   Modified for FLEXICON usage. If the variable FLEXVAR = 1,* P' B7 M8 i- `- C
;;;   use Flexicon menus
, ~% H  }' }7 r, M6 u;;;
  @* ~8 D8 s& l! G6 A" @1 f;;;--------------------------------------------------------------------------;
  I- I; X9 ?" h; O+ O2 R! Q;;; DESCRIPTION
5 h+ c- N1 x* d;;;                              SSX.LSP                                  9 V5 d( T0 @- M; r, A
;;;                                                                          + E: c2 f+ \8 Y+ x
;;;   "(SSX)" -  Easy SSGET filter routine.                                    
* S0 @: E! ^9 o; w5 f;;;                                                                           
% O. p1 H4 G  w! }3 y;;;   Creates a selection set.  Either type "SSX" at the "Command:" prompt   
& Y) u6 A2 v/ c0 p# w3 E8 i;;;   to create a "previous" selection set or type "(SSX)" in response to . |. _* W+ Y0 i3 j2 K5 h1 z
;;;   any "Select objects:" prompt.  You may use the functions "(A)" to add , N  Z3 @. t. }0 ?3 d( [; g9 h
;;;   entities and "(R)" to remove entities from a selection set during
. u0 W6 c6 X# l' M1 r- _* u;;;   object selection.  More than one filter criteria can be used at a * W/ m# a  q) v' |3 b0 C' F) ~! U
;;;   time.         " M5 R6 o& t% P+ E" T% N- v
;;;                                                                          0 r/ M7 c- J  w% n
;;;   SSX returns a selection set either exactly like a selected# [" k: }- ~, d  {* N
;;;   entity or, by adjusting the filter list, similar to it.
: B, {9 o/ B: I7 {; h/ g1 g;;;4 L5 F4 I& e, U$ Z! n: D
;;;   The initial prompt is this:
9 J" u9 U1 c; S7 s$ @;;;   
$ S# U: Q' J( C) }  I;;;     Command: ssx
, [* D' A# q6 T; Q% L9 S;;;     Select object/<None>: (RETURN)0 }; i5 a/ R4 V. E3 ~
;;;     >>Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector: 4 F" t8 p3 D; r
;;;   ; v# i4 u, Q. y  d
;;;   Pressing RETURN at the initial prompt gives you a null selection ) \  w+ s" w1 T) X7 U1 Y
;;;   mechanism just as (ssx) did in Release 10, but you may select an ( F! O5 z- F; F" X8 @, A! T' b
;;;   entity if you desire.  If you do so, then the list of valid types
) E- L% K2 S, X4 m;;;   allowed by (ssget "x") are presented on the command line.
8 [' ?. [2 w6 t- Q# B6 g7 ?;;;   
% ]. Z+ w: o4 S/ E& h;;;     Select object/<None>:  (a LINE selected)
" }, p+ H3 M  m" o8 H- ~;;;     Filter: ((0 . "LINE") (8 . "0") (39 . 2.0) (62 . 1) (210 0.0 0.0 1.0))
* Q& s6 U- q8 v* p3 u& ?;;;     >>Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector:
+ _- ~( m3 }, u& j, Q. t! f- z$ ~;;;   
; L/ w; T* c9 |5 g* w;;;   At this point any of these filters may be removed by selecting the + b8 y& ?1 P( @7 C8 H
;;;   option keyword, then pressing RETURN.) E6 i% W1 Q) s* f: c' e- z
;;;   
& [/ e3 n( y" l. n& z6 D;;;     >>Layer name to add/<RETURN to remove>: (RETURN)
: R) ^* ]! V, s' l4 I0 L- c4 X;;;         
+ g2 v! Z4 X( d/ J' u: N9 B) ]/ K;;;     Filter: ((0 . "LINE") (39 . 2.0) (62 . 1) (210 0.0 0.0 1.0))8 R3 c# ]  @2 k- z- X" Y- n, l
;;;     >>Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector: ; d; I" y+ v+ H( }
;;;   
# p. D9 `0 b3 [( R' l% d) r1 s;;;   If an item exists in the filter list and you elect to add a new item, 0 Q3 C' i% f! P! T3 o* ]
;;;   the old value is overwritten by the new value, as you can have only 5 v, f& @: @9 \0 t( z6 K6 e4 w
;;;   one of each type in a single (ssget "x") call.8 w3 i1 w' r. t5 [) H
;;;
) f2 h) T. U% X9 s0 O9 [3 L;;;--------------------------------------------------------------------------;
7 y" a) D2 ]' g+ M( |% N- D+ |+ Q;;;7 g/ J+ Y+ w! J* E1 M2 _
;;; Find the dotted pairs that are valid filters for ssget
1 v9 m0 m2 ]9 }4 ]5 V;;; in entity named "ent".$ @  B5 O6 w; d/ i7 d, p1 r
;;;
$ O! C7 U( Z) b7 a;;; ssx_fe == SSX_Find_Entity
+ x0 w! y% N" p4 R7 Z9 Z. G( F% I;;;$ i2 O: ~3 d. U2 S  \
(defun ssx_fe (/ x data fltr ent)
$ Z( ?: o' T4 F/ K0 x  (if (and (= flexvar 1)(/= t2 "Pick"))
1 \$ t% e9 f6 f$ }' w7 r- T   (setq ent nil)
: d, Q/ r4 M' p, x4 \   (setq ent (car (entsel "\nSelect object/<None>: ")))
5 Y. q' y) N' C  )
$ m$ [7 m$ t, y/ a& @" L" {  (if ent
2 |8 |# E/ F2 p7 v$ }/ m    (progn4 g5 ?; r# o5 r* z/ J, @
      (setq data (entget ent))6 y2 X$ k( C, m3 k! N, G8 u# h
      (foreach x '(0 2 6 7 8 39 62 66 210) ; do not include 38
& ^! ?# R4 c+ N2 k. `! _) n        (if (assoc x data)2 ?( p' ?' z5 F0 V3 m
          (setq fltr 9 t; X. ^! G5 |$ t# j! ~
            (cons (assoc x data) fltr)0 G( V1 K% O( G
          )
& ?( b) j) `) v        )5 p' Q2 A" R+ o7 e  W2 Y/ p
      )   
/ \- @) p8 W+ P; Z5 L      (reverse fltr)! S- \- d: K1 h
    )
- s) C, w5 Q7 q: i5 }  o  )
6 e+ e' P" Z2 k( C! N5 o)7 D9 T  q. `+ Q
;;;  A7 {  K" |' [0 Z
;;; Remove "element" from "alist".
& T& [. \" _: \$ |2 @6 n;;;
6 B+ ?1 n  \  ]' o) ~;;; ssx_re == SSX_Remove_Element
+ q% C) l+ u5 }- k% Z+ Y;;;+ {: ~; z, ?' ~
(defun ssx_re (element alist)
) m! \* t6 a/ m" b/ x* |' A/ {  (append
, E/ i$ C0 o; ~5 x8 r    (reverse (cdr (member element (reverse alist))))  p0 D9 X& \3 V! p
    (cdr (member element alist))   
/ o+ p' [% W* S9 r/ |/ q5 ?  )
- C) q$ Q- B/ }& Q& u* K! P)
& E; l; W5 _# Z& {$ };;;, ^8 W; h, x- {
;;; INTERNAL ERROR HANDLER ; T' _( m8 b0 \1 T6 D2 t
;;;
3 p% M6 m. @7 M; l0 z(defun ssx_er (s)                     ; If an error (such as CTRL-C) occurs
9 P) E! U# C% a, g  v9 _. B                                      ; while this command is active...
, ?) W+ A, H7 ?, h: U  (if (/= s "Function cancelled")
( m' |2 p* e" s% s4 y& D* y    (princ (strcat "\nError: " s))! ^& A" P7 h8 H+ d+ d8 \
  )2 ~2 Q: z% a, p2 p5 r/ L2 V
  (if olderr (setq *error* olderr))   ; Restore old *error* handler
2 }! S' t8 X3 W. o  (setq flexvar 0). g5 F) _7 f2 U& `( _: n4 M' w& c
  (princ)
& z. Q$ ?. J; B6 v)! @: c( u) z" x, T1 A" J: P
;;;
) ]) |& j( k- W( d  I;;; Flexicon call routine
5 r$ Y: W3 _2 D  N2 G;;;
# T1 a% h5 g; `  w6 E3 g5 Z7 A1 I(defun flexmnu (a)
% W( k- Y6 r% P5 ?  U+ l, a1 k (if (= flexvar 1)
6 `) l. v7 |& ^. ?& T1 g( `  (command "FLEXICON" (strcat "FLEX" a))
2 M8 F' c( y" P, b* }. n )
* m/ B+ X  O, g# ~)7 m- M* d+ y2 D  \) R7 o
: C3 {# [/ P1 v  E$ K% b& O! u; B1 u
;;;   
$ j4 I7 e2 o/ ]! _  \1 v" m5 _;;; Get the filtered sel-set.1 m9 `: g9 \2 V" h& ~9 S
;;;
& r9 x& L( E. g& ?0 C$ P;;;8 k- h" U# u: s$ j; V
(defun ssx (/ olderr)
  C! b) Y: M' c1 @  (gc)                                ; close any sel-sets            
/ K9 s) a3 s# f1 k# a) s4 ~) e- ^  (setq olderr *error* ! J4 F; `2 I' ?/ l
        *error* ssx_er
" }6 j4 \) s, i6 s  )4 x5 H9 [# v2 S* }& \
  (setq fltr (ssx_fe)) 1 E1 x: L3 u$ |. F5 O; y" g1 F
  (ssx_gf fltr) 0 E" I* D; I- [0 y/ w6 S. k: I% V
  (if (= flexvar 1)
' c8 F5 P6 O) V   (progn, W" ]# t3 D* X- |/ V8 s
    (prompt "\n \n \nNow select the required EDIT command and (P)revious.")
- x/ t; ?5 l0 }* h    (flexmnu "EDIT")
; k+ u% O9 L* J' Z: J( L   )$ g! j# y. h6 C# G! U( y: ~
   (command "p")
1 B6 _3 n. t4 U7 Q9 D; s. ^" t' J/ P  )
* _1 p9 K: A# U* E( N9 N, h% s  (princ)
  d9 [& a5 z2 a7 I. s! D5 j6 l)0 k* t- }8 \' I" q/ |, F
;;;
+ F+ o9 G, R" C/ V;;; Build the filter list up by picking, selecting an item to add,
4 r  j+ h' W" z4 A9 O;;; or remove an item from the list by selecting it and pressing RETURN.  W; d3 g/ v, B: ^
;;;
" I" y- Z9 z2 w9 r  Q;;; ssx_gf == SSX_Get_Filters
1 @4 n2 e8 K) E( C" R7 P9 j; v;;;9 S7 w7 G0 Q# y4 O
(defun ssx_gf (f1 / t1 t2 t3 f1 f2)- H8 J8 q+ W: R( x) n
  (while
  n+ X1 y1 }+ J/ f6 d( M" O    (progn! n9 ]8 y8 _( t
      (flexmnu "SSX")
' B4 R5 y4 y' I+ d; s7 o      (cond (f1 (prompt "\nFilter: ") (prin1 f1)))+ J0 s4 Q/ j7 z1 \6 w
      (initget 4 ~  q& T' D3 }& U, i
        "Block Color Entity Flag LAyer LType Pick Style Thickness Vector")+ {8 H  ?, e4 _* [5 B( |
      (setq t1 (getkword (strcat" w: m7 m3 c3 D4 N" |$ C
        "\n>>Block name/Color/Entity/Flag/"- v7 y* C# O, G9 ?2 _
        "LAyer/LType/Pick/Style/Thickness/Vector: ")))
, C& H: f5 m: X9 x, P    )( f0 s5 m. [" V
    (setq t2
" {# H; F# Y! h' }      (cond
5 e( n- |  J& z& B% c' |        ((eq t1 "Block")      2)   ((eq t1 "Color")     62)
& @  H0 D0 [: m/ W! H' K        ((eq t1 "Entity")     0)   ((eq t1 "LAyer")      8)3 H8 W! Z* p$ G
        ((eq t1 "LType")      6)   ((eq t1 "Style")      7): h2 {1 c# x1 P
        ((eq t1 "Thickness") 39)   ((eq t1 "Flag" )     66)
, w; ?/ N9 W' h" V6 H2 D8 H8 g        ((eq t1 "Vector")   210)
3 }5 O! ~1 y3 N3 a: x+ |5 b        (T t1)
, X7 w8 _  f: f. F% a      )2 V" e% A8 {/ h% K$ g
    )
; D7 ?  D! L4 ~  x    (setq t3  I0 R1 N& E! t, w
      (cond
5 f% m6 S7 o" m; _' v4 E  ~        ((= t2  2)
: b7 {& i- S# h% h9 m         (if (= flexvar gtads 1)4 w' L; x$ c+ N& z
          (progn
: m5 W+ }+ z' G4 R8 G           (prompt "\n>>Block name to add/<RETURN to remove>: ")
. t# k0 t5 m% a; i( _) l           (gttable "BLOCK")
3 r. D& [3 T/ ]7 d5 D          )2 ~% r# v) Y1 W+ |2 q
          (getstring "\n>>Block name to add/<RETURN to remove>: ")& j4 [* }+ @! N4 c( D
         )
2 O4 _. k* _( i1 B1 z0 _& B        )
' q, k6 {: _1 T* c  y- [        ((= t2 62)  (initget 4 "?")
6 d- k+ z4 c! q& o# [7 P8 `% @          (cond
5 ~9 i: t% w) r; j: P            ((or (eq (setq t3 (getint 9 @( S3 e' w2 w1 f! V9 R+ Y, i
              "\n>>Color number to add/?/<RETURN to remove>: ")) "?")
6 W4 L$ U; t. P8 u# c0 y/ W              (> t3 256))0 l4 c$ ?: P7 m& _& B# R
              (ssx_pc)                ; Print color values.
' d- P) d; W7 y/ N- N) E              nil# S3 i7 j. t6 s' o8 C) R' x. x
            )
0 B0 e2 ?/ F) c- H: q) Z$ m            (T! U. E8 o' B% X6 F1 ~8 g/ i
              t3                      ; Return t3.
" P; R* J0 S* s: l: [- k  R            )
0 @: x2 z: H5 Z) `: o' x6 Z          )
- T0 z( O' Y, y2 q. _        )) Y; g" z2 Q- }+ ]
        ((= t2  0) (getstring "\n>>Entity type to add/<RETURN to remove>: "))
; m; `! @" B' F' ?1 Y( X        ((= t2  8)
0 m3 A  c$ s! u* k* F) G0 {. B         (if (= flexvar gtads 1); n7 Y' L$ ~2 @- Y7 R
          (progn' ^7 |% U& p) B
           (prompt "\n>>Layer name to add/<RETURN to remove>: ")
4 R) f/ J8 F6 E3 F5 o; {- O           (gttable "LAYER")
6 H) b  T4 B+ B4 D, e8 r# g$ Y5 _          )+ L( p3 R) e, ^1 l/ ]. G" C, _
          (getstring "\n>>Layer name to add/<RETURN to remove>: ")
# }  z8 K! I, Z1 v         )8 S$ O+ e6 E2 J, g  V; F
        )6 O9 r' d3 w0 w+ R4 I. P9 ?2 y
        ((= t2  6)
; n& a. X+ k1 r- |         (if (= flexvar gtads 1)! j7 ~3 Y$ n+ T) s7 C2 {
          (progn, e$ `3 q6 ^- p3 F
           (prompt "\n>>Linetype name to add/<RETURN to remove>: ")+ G6 U: m0 Y7 A; U0 R0 j  s
           (gttable "LTYPE")" P# j% T5 O( m9 c* O1 i1 W# i! [
          )- f/ z% t, S$ Q( {+ Z
         (getstring "\n>>Linetype name to add/<RETURN to remove>: ")
, x# V' P" a3 t         )
# l% ~4 y$ D, p' `: V6 {        )
' k4 U0 X, J; H8 _8 u0 U        ((= t2  7)
+ ?7 ~+ F# x+ j/ a( D         (if (= flexvar gtads 1)
' }  K- M$ a1 C% [2 o" P8 l          (progn, z: ~9 |3 u+ K8 F* K, @
           (prompt "\n>>Text style name to add/<RETURN to remove>: ")
% u# \+ p) }, T( i) y           (gttable "STYLE")
4 a! ^7 e$ n6 F          )5 N' e) ]2 H) ~% \) ]2 a( q
          (getstring "\n>>Text style name to add/<RETURN to remove>: ")
, u2 r3 k2 A% O6 j" L9 k1 o         )
- o0 Y6 l% m/ y3 V5 L5 u8 r: V        )- B4 w" h% k+ ~4 _& k/ \; ~( B
        ((= t2 39)
2 ^, j  _8 s1 e1 I5 [) D8 y           (prompt "\n>>Thickness to add/<RETURN to remove>: ")9 `/ z7 R9 C, {" m. m% |7 ]( ]% y
           (if(= flexvar gtads 1)(gtfnum"Thickness to add:")(getreal))
$ B/ c5 I% y" O; O; r. {        )
& N% ]2 V; X2 G        ((= t2 66)  (if (assoc 66 f1) nil 1))
9 {" @* q3 E% k: ?        ((= t2 210) % @/ T2 G4 T5 I1 r0 {
          (getpoint  "\n>>Extrusion Vector to add/<RETURN to remove>: ")
" h9 L2 j( |, h        )
, j& B1 k9 E1 o; ?        (T          nil)
# z* O5 C1 ]* i$ B2 p+ G2 Y      )# P/ o) P2 g1 s6 g- t
    )
7 A; t! Q, b# L+ f4 _7 T' r    (cond; `" x6 |. y* k$ H1 S1 k
      ((= t2 "Pick") (setq f1 (ssx_fe) t2 nil)) ; get entity
. q$ N# g9 j# x" u3 s      ((and f1 (assoc t2 f1))         ; already in the list& l0 C8 ?: L0 q! c# y
        (if (and t3 (/= t3 ""))& L( t0 I1 F7 o' g' {) D
          ;; Replace with a new value...            
: \1 p8 t2 L9 l7 P( c7 C- v1 {& X          (setq f1 (subst (cons t2 t3) (assoc t2 f1) f1))
8 {1 @: Y" e* X5 E, z, g4 a          ;; Remove it from filter list...
9 b: B1 k6 H  q3 Y% O! x          (setq f1 (ssx_re (assoc t2 f1) f1)) & A4 L4 p8 q1 K' y
        )  
+ J3 [2 U  m4 Q9 J; a      )
" U# \7 u" ^  P      ((and t3 (/= t3 ""))
0 D2 ]) L, g4 J. S. p        (setq f1 (cons (cons t2 t3) f1)): P0 m/ n: R1 v
      )2 a! p& ^: a& e0 i; T
      (T nil)7 r. ^6 `5 N- I5 d$ |1 g
    )
) p8 _2 }+ Z* E" c8 f6 }  )
* p  G  f+ T5 V- ^4 f4 V$ s  (if f1 (setq f2 (ssget "x" f1)))/ a5 t5 i% c) a% o) b/ z# z( i4 l
  (setq *error* olderr)' q  @, \/ V% K( _$ ^
  (if (and f1 f2) , C" ?! f" D& y6 X2 W* d. \0 `
    (progn
7 r( r7 p- o4 G6 q/ I      (princ (strcat "\n" (itoa (sslength f2)) " found. "))4 t& ]1 z) c! y# K
      f2 % Q( ~5 ]! }) H: }9 v: |
    )
" u2 p- Z/ f8 U3 i' F    (progn (princ "\n0 found.") (prin1))
3 [" G9 u! n/ Y" m  ): f6 h0 C: g2 {0 i7 r) |) g
)
% o3 C" c1 a, G;;;
3 i( z9 [4 P7 B& i;;; Print the standard color assignments.) J3 ]4 W8 ~$ Z
;;;
1 \, e5 g: [6 R& m) j;;;; X% M! r# E: P/ v  ?+ e
(defun ssx_pc ()
8 Y2 M& C" z" f% x5 z4 E2 E1 O! a  (if textpage (textpage) (textscr))
0 N, o  H" I5 e$ b0 s9 J8 x  (princ "\n                                                     ")
2 w/ h) }9 I# s  (princ "\n                 Color number   |   Standard meaning ")0 ^# L- A8 y- Y% `' G+ x
  (princ "\n                ________________|____________________")
( Z' F% r; k' P  (princ "\n                                |                    ")
# E7 ~" Z7 s2 }$ P; Y8 z. a2 M  (princ "\n                       0        |      <BYBLOCK>     ")6 C: g( \+ J; q: |( Q0 t# q
  (princ "\n                       1        |      Red           ")
2 b/ g4 N" r8 U& @( Q$ I) j  (princ "\n                       2        |      Yellow        ")4 E: m9 B- B1 o( ?# U
  (princ "\n                       3        |      Green         ")  h' g5 @2 e. U8 \2 Q. l0 b( h6 A
  (princ "\n                       4        |      Cyan          ")
5 A* a" f0 \; ~& _0 n2 @  (princ "\n                       5        |      Blue          ")# F, G4 O" R3 n, w  l9 b; @
  (princ "\n                       6        |      Magenta       "): t; U6 d9 [+ h3 O3 E9 \
  (princ "\n                       7        |      White         ")
; f  J: j: M. _' R+ Q/ B( S% a  (princ "\n                    8...255     |      -Varies-      ")
( }3 [$ L+ l( \, J  (princ "\n                      256       |      <BYLAYER>     ")' {, b: B) E4 M
  (princ "\n                                               \n\n\n")5 ~6 ^* V# |3 I" @! ], J8 ]3 p8 B: d/ Y
); n: r5 a# Z% k& V4 J5 m
;;;+ u: o7 Z; ^6 R% z* Z
;;; C: function definition.- t; P: w1 T0 C7 |: v& g1 L" d* ^
;;;9 V. i+ i% H" V) O  ~( C' @
(defun c:ssx () (ssx)(princ))
. O+ {- N( ?  G$ K; |- O8 x(princ "\n\tType \"ssx\" at a Command: prompt or ")8 U3 R3 Q1 b( S$ R" M0 c/ V
(princ "\n\t(ssx) at any object selection prompt. "). m  E5 b4 m" z! [0 l* @
(princ)& m; p$ z0 E* A8 F: W, J

: R# q  k- G+ j, L;;;--------------------------------------------------------------------------;; g) K+ \% i8 g* E6 I. D' j+ C
;;;--------------------------------------------------------------------------;
3 f8 ~5 C# m1 b7 q;;;--------------------------------------------------------------------------;, v& e" `& v% y% s! S* E
(defun S::STARTUP ()
8 M; l9 {  \! T2 ?8 f(setvar "cmdecho" 0)8 s' u; o# q, C
(setvar "cmdecho" 1)% h8 `/ k$ E) f3 a+ v1 {% t
(setvar "LTSCALE" 10)& Q1 p8 |' J+ @# h4 M

/ [7 T# H3 J; d8 v- \; d  A# {. x0 U3 l& ~0 {- k
;(command "_load" "chenKH.fas")# Z  ~# R0 N- H( T9 v8 z
;(command "_load" "ctcot.fas")7 s1 X& Y' J2 R
;(command "_load" "damdoc.fas")
* @$ O9 I, j" n2 ~;(command "_load" "ghichu.fas")9 U, `# z4 G* S* u( @9 [
;(command "_load" "hamtutao.lsp")8 u3 x1 _0 n; H
;(command "_load" "KHOITAO.fas")
, @* q9 N) A: I% V4 D# ];(command "_load" "KHthep.fas")
  P' x7 M/ e& b0 i; K; c;(command "_load" "mbmong.dcl")
5 i. c8 A- Q  K5 I2 h. R  A0 l;(command "_load" "mbmong.fas")
. l) Q* ]4 y3 a8 E2 {, d# Z; [;(command "_load" "mccot.fas")
( b8 N2 R8 ^+ X9 v' `0 i# ~6 Y;(command "_load" "mcdam.fas")  P7 {. d+ x0 H2 \
;(command "_load" "mcmong1.dcl")
' x6 Z9 b2 [6 Q. P" _" n9 \6 d;(command "_load" "mcmong1.fas")
$ R3 ~/ d0 u1 k9 d/ ]# n4 _$ @;(command "_load" "mcmong2.dcl")
0 t/ I8 C1 B- C  _8 t;(command "_load" "mcmong2.fas")8 U1 G2 f/ p. n% D9 T
;(command "_load" "mcmong3.dcl")6 X% L6 E3 L9 E. B
;(command "_load" "mcmong3.fas")
, i- s7 C  G' x- U8 h" c;(command "_load" "mcsan.fas")9 e) t, w7 G9 t+ J' e' |, P" ]
;(command "_load" "thepdai.fas")
8 j6 C, l- p& ~: h0 j# t;(command "_load" "thepdoc.fas"). j- P- |* T, T. {) {
;(command "_load" "thepmb.fas")6 C( h; p) }2 @1 h% E7 f, h
;(command "_load" "thepphbo.fas")( c8 _+ S) a, k# w  G
(command "_script" "thongso.scr")
1 c8 a0 ^5 o. |. _- b/ V;(command "_load" "thongso1.dcl")
5 z% H2 l8 n. D;(command "_load" "thongso1.fas")
' s$ ]9 l0 l9 w;(command "_load" "thongso2.dcl")5 p4 U$ g7 c7 t( `
;(command "_load" "thongso2.fas")
! @0 Q6 j+ V# }( Z+ r$ f;(command "_load" "tietdien.fas")" H4 u  U& {: V+ y
;(command "_load" "vehan.fas")/ @- C+ ]& o. \
(command "_load" "phamduy782006htd.dcl")$ R7 j* w* O( l1 c3 i
(command "_load" "DDCHPROP.dcl")
) r7 x% _+ ^  t# |(command "_load" "EXCHPROP.dcl")
# p& k7 h9 r7 ?/ m# A# z(command "_load" "DDMODIDY.dcl")
" Y8 J( m7 e& N) i8 O" ^  g(command "_load" "TK.dcl")
* i# I# E9 i1 j: n; R; H! K, r" X(command "_load" "TK_LIB.dcl")2 k9 N3 U. h4 l9 p( l
(princ)
$ \+ f8 C, B* {( J)' G6 N& k. h' i4 e  q* o. Z) ^' W

, _9 v2 w" \  P) L" W: Z) X0 I(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\DDCHPROP.LSP")
. b& }6 d. K4 U( b+ a& O' d; o- E5 z- [, j! \) x  ^
(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\SSX.LSP"). P. S- v1 }5 M, a$ U& j; e* J
2 v+ r" ?& D0 x$ @" s
;(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\phamDuy782006_TKT_VNI.LSP")  g+ Z! n0 l2 J6 J+ c: ~# u
;(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\phamduy782006ganhtd.LSP")
- N1 I. \9 s8 n3 a- |0 t2 U;(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\phamduy782006ganhtds.LSP")+ v; ?" e4 h$ x

5 l' M" L. f" Q# V/ r( w(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\THONGKE-THEP\\TK_EXP.LSP")
: s! [. x! ], l# E  A+ t! h(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\THONGKE-THEP\\TKN.LSP")
& j6 ]/ Z; n7 I% {3 |- {
( Y7 ^& O. Q/ t/ W0 x/ x;(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\ACAD iit insertTEXT - iiT.LSP")
( e7 _& C3 W5 X& V8 ]/ T; L: X: z
;(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\ACAD iit insertTEXT - iPT.LSP")* ^/ h: c8 k5 M6 _; c1 S  U
) [5 \- v, k! m% T) z5 z6 T
(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\ACAD insertPOINT - PTA4.LSP")  U5 m! x; R8 \" Q6 q- [
2 o, G6 T3 k2 t7 J9 s2 s
;; Silent load.
7 A% Q. v; ?9 q+ L(princ)) ]* }- B& s* O1 E0 P8 Y1 [' |' Y- e; V

6 {* C" X1 f  v4 G
: V- M5 S+ F. D$ D) R;; Silent load for the Express Tools.
# v8 g6 `! |" i" Y4 ?" z* a;; Altering this line will affect Express Tools functionality
3 E6 |8 B# Y1 b! A! Q(load "acettest.fas" (princ))7 g' p- s7 J6 |1 X
8 {8 l. t6 m+ B. w# l. q
;------BLOCK NAME Put The End because ERROR other LISP-------
& u, J! S, s/ p& H+ _: b;------------------------BODER HATCH-------------------------
- n3 b+ n0 @% h; z; `( S. @  h' Z( l/ g- k' N
;;; HATCHB.LSP ver 2.5
3 ]. k) ~8 ^7 b5 Z( e;;; Recreates hatch boundary by selecting a hatch
4 R- }% x  t4 R9 t3 `/ w. e;;; Known problem with some elipses and splines1 x# [- n& r" J, K( [
;;; By Jimmy Bergmark
" f/ O0 f. R1 _1 g3 S0 [: W;;; Copyright (C) 1997-2008 JTB World, All Rights Reserved2 h" B* H6 `5 o4 Q6 J
;;; Website: www.jtbworld.com
/ M, r! ^6 B2 `;;; E-mail: info@jtbworld.com/ C8 u4 n; G. j3 j. l9 h
;;; 2000-02-12 - First release. O" Q1 r' q  X: K- }8 i
;;; 2000-03-27 - Counterclockwise arcs and ellipses fixed
9 U" f) g$ i. V% {6 ?- a;;;              Objects created joined to lwpolyline if possible
8 r2 m3 P( w) ]) M' y6 v0 A1 [2 ^;;;              Error-handling, undo of command
  S% E. r0 h1 F. p;;;              Can handle PLINETYPE = 0,1,2# @! ]/ f" Z/ }* a$ a' O5 s
;;; 2000-03-30 - Integrating hatchb and hatchb14
8 {2 J$ ^7 v3 |;;;              Selection of many hatches
; r1 X  F: S3 H. }3 |8 D: R;;;              Splines supported if closed.9 S4 v) D0 \* o
;;; 2001-04-02 - Fixed bug with entmake of line with no Z for r144 [2 z4 L: C5 K5 [& a
;;; 2001-07-31 - Removed an irritating semicolon to enable polylines to be created.. H4 s9 i  C' T0 v: d# X7 d" u
;;; 2001-10-04 - Changed mail and homepage so it's easy to find when new versions comes up.5 ~& g/ u! F4 G, N3 x
;;; 2003-02-06 - Minor fix
: k  p6 ^- H$ G5 S;;; 2003-02-17 - Area returned if no islands is found since it's not consistant% x6 T! l/ L0 v4 n6 Y& j
;;; 2003-05-19 - Fix to take PEDITACCEPT variable used in AutoCAD 2004 into account' I4 m$ }* F& K! M* {, t$ R
;;; 2004-11-05 - Minor bugs fixed% e4 o3 ^- \) _' Y/ @
;;; 2006-03-18 - Nothing changed from 2.1 other that it's been confirmed to work with AutoCAD 2007
  x; `6 h1 L2 S+ `;;; 2006-05-13 - Create the boundary on the same layer as the hatch using the hbl command and  Y. U+ s0 ?$ A5 o4 {  P
;;;              on current layer/color/linetype using the hb or hatchb command0 X* Y% S2 f5 b
;;; 2007-02-08 - Fixed a bug with the hbl command: s9 }+ }8 w7 \; o) `! |
;;; 2008-02-29 - Support for hatches in non WCS thanks to xiaocai
+ {- V; b8 A2 V8 a;;; Tested on AutoCAD r14, 2000, 2000i, 2002, 2004, 2005, 2006, 2007, 2008, 2009
0 e$ M" O$ X: q9 O;;; should be working on older versions too.; \+ M9 U; |& i2 S( u

0 }, m$ X% d! M, ^! D! v6 b9 N& C(defun c:hb () (hatchb nil)) ; this line can be commented out if there is an existing command called hb$ s" U5 u7 A  K" Y8 X' o" g' f
(defun c:hbl () (hatchb T)) ; this line can be commented out if there is an existing command called hbl9 D- A! L5 n$ M
(defun c:hatchb () (hatchb nil))7 w# Q$ U) \' I8 d1 ^( _
(defun hatchb (hl  /     es    blay  ed1   ed2   loops1      bptf  part
# C2 N. I/ i5 w) q$ ^2 u             et    noe   plist ic    bul   nr    ang1  ang2  obj *ModelSpace* *PaperSpace*
$ G/ `9 S7 i; F5 n             space cw errexit undox olderr oldcmdecho ss1 lastent en1 en2 ss lwp
; F, ?$ K' M- H" \             list->variantArray 3dPoint->2dPoint A2k ent i ss28 D& L7 {% V+ f6 G
             knot-list controlpoint-list kn cn pos xv bot area hst noarea$ w) Q: r. w8 o7 e$ Z' m
            )
, \9 [1 ?9 R* ^- D (setq A2k (>= (substr (getvar "ACADVER") 1 2) "15"))$ M4 i% i) s! ]4 Z
(if A2k0 l" i5 \+ s' c
   (progn/ y7 y+ K( F& t( f) Q% m2 f# I
     (defun list->variantArray (ptsList / arraySpace sArray)
) \% z  \5 G  p- a       (setq arraySpace
5 K8 y$ n! z: p, `" d# }: r              (vlax-make-safearray' q- c/ _' x4 P$ X0 k
                vlax-vbdouble. C0 o# }; I* P' b" Y' }& U
                (cons 0 (- (length ptsList) 1))4 ]+ A  @& d. Y# V" @! s0 _5 L
              )$ I: W& u! }1 F/ L, }
       )
, w, |- z, g# E6 ~       (setq sArray (vlax-safearray-fill arraySpace ptsList))
* v  `2 |! `1 ^( ?: @       (vlax-make-variant sArray)( B9 J* Q: x3 ?
     )
: n% s" x. ?7 S* t( s5 K     (defun areaOfObject (en / curve area)& N9 a* o7 i# t
       (if en
/ Q2 N; \$ ^* s8 {: h2 A' L         (if A2k; y/ A5 g9 B  s+ Z8 i' C
           (progn
- B2 r$ y/ \) Y/ A7 X* g             (setq curve (vlax-ename->vla-object en))
  T+ p# P1 G2 a5 f5 p             (if
# e7 }  m! A  l% U" a9 H               (vl-catch-all-error-p
4 G5 \6 R9 r0 X' _                 (setq: t: [7 c/ }; e0 r& I
                   area
6 r- G4 O* Z. T+ n2 w# ^                    (vl-catch-all-apply 'vlax-curve-getArea (list curve))* A, M8 _, r, j1 Y
                 )& Q% O9 o2 m. J9 W; x/ [7 x
               )( T7 {" @- C8 m. `
                nil
% j% Q9 _7 g  d6 Q/ a9 f                area
- s) l7 b' J! N: y             )/ |5 O& s) }( L" Z
           )
* B1 \2 v% e2 T; N) P           (progn
) I9 C/ w* l: o% K! y             (command "._area" "_O" en): U1 O2 V8 r/ t3 |
             (getvar "area")6 V- E* |% |. f# _/ F; V3 W7 u* @, Q6 L
           )* W2 y- m2 ^/ a5 [3 U, F
         )
4 C" Y: C: N  g8 p. p       )$ j" T3 q# O# c0 u% A3 p
     )
' Q* f+ }5 I+ o4 `   )$ \! g' [8 v; v* @
). c4 [8 t3 x$ y) K+ b
(if A2k+ Y% L# U" S, ^9 D/ l
  (defun 3dPoint->2dPoint (3dpt); ~' @8 m7 A" a" F5 [
    (list (float (car 3dpt)) (float (cadr 3dpt)))7 B4 e( g  d+ h+ t2 L
  ). [' ^3 l. Z" B1 j" k0 V) z' z/ `
)/ u  J' E4 R" n$ I! s9 k
! Z' [* \: d! W6 S/ ]5 H4 Z# u/ L2 S
  (defun errexit (s)( q. `+ ]0 f- q8 ]- r* E2 `/ d6 a
    (princ "\nError:  ")
7 I6 @+ f. m5 o    (princ s)
! b( c: n& x+ V+ h1 {6 b# g" F2 K    (restore)" a: V- }" V4 f' H9 ~
  )( S: w' Q: o# G- t* K: p

* o: ?+ e  q; B* b( a. [5 @5 G5 |  (defun undox ()& }# b& ~) `0 Z9 r6 u
    (command "._ucs" "_p")
+ V, K/ Z' |7 r. K9 @) {9 q. A    (command "._undo" "_E")& Y9 F6 N$ ^! k" ?. k7 u; p3 ~
    (setvar "cmdecho" oldcmdecho)
2 q5 @1 N. E& M* b; T2 W    (setq *error* olderr)
9 j$ r$ Y1 i6 [, D3 X' _$ ~    (princ)/ [* G( |+ U% W6 h1 o
  )
1 G- q# w5 p/ h- z# y! B: s& E7 M4 p4 s2 Q4 N
  (setq olderr  *error*
! G; A! o+ }. G7 d; T0 D        restore undox: m1 K! _8 D# `8 d2 y
        *error* errexit2 s; d  J$ s- b2 a# f0 A2 Q4 F
  )( R: W. p1 @! \! p& W( {" ^1 \
  (setq oldcmdecho (getvar "cmdecho"))# |' a$ q8 A' f3 X4 ], |
  (setvar "cmdecho" 0)
  ^+ f% q# l# r* r  (command "._UNDO" "_BE")
5 @& W* F! V! E; S1 ^; y  (if A2k (progn
: q& v2 x0 f  F+ `3 I( Q, w    (vl-load-com)8 t- o2 W2 q( [
    (setq *ModelSpace* (vla-get-ModelSpace
+ R& a& ~  \7 M! @                         (vla-get-ActiveDocument (vlax-get-acad-object))7 L& F$ H  y- A" T0 w2 I
                       )
/ x1 h# b7 Y2 D  o          *PaperSpace* (vla-get-PaperSpace
$ R( Y2 U- W) y  m4 {6 r9 I* D                         (vla-get-ActiveDocument (vlax-get-acad-object)): Y3 e# G+ h- |# L. O
                       )
, \5 E  X+ t2 B. a; I" e  x' j  [    ))
- A( |6 U& h6 M# Z6 Y  )+ l+ }( \% @/ ^

, V' f5 ~# F) \: G
1 ~3 I. W/ `; |7 b/ T5 q7 i; Remove for testing purpose
" ^  b; d$ u9 S' A; (setq A2k nil)5 G) D! T9 l1 ]7 y8 l

1 G" I9 g. o' i# O0 f. I$ E% ~  (if (/= (setq ss2 (ssget '((0 . "HATCH")))) nil)
  B4 o% W/ P( T( R) w  [   (progn
& ]' h0 `2 O0 }2 l( Y! v: A    (setq i 0)
! b9 K# k- ^( h/ u, z    (setq area 0)
/ i4 z7 m" S% x5 p, P% N2 ^    (setq bMoreLoops nil). K6 h; U, M4 W3 O& B& j1 j; C
    (while (setq ent (ssname ss2 i))0 ^% K, A% \  |. |
      (setq noarea nil): v  \! W1 F" L, a5 t9 s
      (setq ed1 (entget ent))
! j; f& z+ p! o6 W8 _. c; t      (setq layer (cdr (assoc 8 ed1)))
' _9 L/ y* ]5 r3 S+ P9 p) T  v# q      ; (if (not (equal (assoc 210 ed1) '(210 0.0 0.0 1.0))) (princ "\nHatch not in WCS!"))  ;modified by xiaocai
6 u6 i; S3 \  E8 F: J      ; (setq xv (cdr (assoc 210 ed1)))                                                      ;modified by xiaocai
; a8 X$ E$ L! ^  A      (command "._ucs" "_w")# a9 y  {0 `0 I2 g6 A$ T8 v: C
      (setq loops1 (cdr (assoc 91 ed1))) ; number of boundary paths (loops)
* ^: Y8 v( k, I* c) K# q      (if (and A2k (= (strcase (cdr (assoc 410 ed1))) "MODEL"))2 `7 p8 e/ k0 q% }6 r. ], N
        (setq space *ModelSpace*)5 _* ]: T5 w7 T# q3 M
        (setq space *PaperSpace*)
4 F8 @+ q/ B9 \) z1 R0 }) Q      )
2 r8 g0 d+ k1 a! i      (repeat loops1
/ Y/ [& S9 P$ @+ D        (setq ed1 (member (assoc 92 ed1) ed1))
6 e: _$ z5 a$ ?" X% T  y        (setq bptf (cdr (car ed1))) ; boundary path type flag
, `2 t: h6 `  c) a* a        (setq ic (cdr (assoc 73 ed1))) ; is closed) H  S; w- \. h8 r2 O
        (setq noe (cdr (assoc 93 ed1))) ; number of edges+ c5 Z3 {/ ]$ k) y- i
        (setq bot (cdr (assoc 92 ed1))) ; boundary type+ J, Q4 D9 p, L% o
        (setq hst (cdr (assoc 75 ed1))) ; hatch style
8 s0 \: W2 S9 g0 {' ?- ~$ E        (setq ed1 (member (assoc 72 ed1) ed1))
/ E: Y1 _# }8 J# d: y$ T0 N. T        (setq bul (cdr (car ed1))) ; bulge
& ^* Z* L/ u1 [* E2 Z        (setq plist nil)' D$ V* D0 e$ o% x/ H/ Z
        (setq blist nil)- R' @3 u. {: |
        (cond
7 D+ w( G, c) Y) i9 N          ((> (boole 1 bptf 2) 0) ; polyline
% `! I+ U! V- j           (repeat noe
7 G6 E, B4 _: g4 C9 F             (setq ed1 (member (assoc 10 (cdr ed1)) ed1))
6 q. S& G  l( n! I# V6 f- J             (setq plist (append plist (list    (trans (cdr (assoc 10 ed1)) ent 0)     ))) ;;add trans by xiaocai2 t/ a; P# h5 L. \6 _& ?& g
             (setq blist (append blist
0 Y0 y$ s3 f* E2 X                                 (if (> bul 0): h9 R: u3 \* @5 |! W0 `& E
                                   (list (cdr (assoc 42 ed1))): u+ |$ h. s: G
                                   nil
- t# D+ G' X5 i' d% [                                 )7 P: R3 Z3 w# ?; u* D% b
                         )
# _% P* {+ N7 h- V             )7 P* O( u7 V3 C9 a! n
           )% f5 C: G( W7 Z% s1 a  c9 E, j' w
           (if A2k (progn; j8 @+ \) y1 U! W2 [$ Y9 S
             (setq polypoints* F! w  p6 J! v- N
                    (apply 'append
( w6 b" V" y& j+ A$ F4 K  r                           (mapcar '3dPoint->2dPoint plist)
* x' l* G# v5 r9 i+ C; N                    ). l" U# |, R# Z  q
             )
$ V5 \7 c9 T) I2 W* N             (setq VLADataPts (list->variantArray polypoints))
, l$ p' Z: D' z& b3 K             (setq obj (vla-addLightweightPolyline space VLADataPts)): |1 R. k# Y: l( }
             (setq nr 0)
6 L0 n% W' U6 Z2 [8 X4 x             (repeat (length blist)
" t) B8 h/ F6 Y' H- y9 P3 _$ y  }               (if (/= (nth nr blist) 0)
& k0 b9 X! n( T4 M9 x9 I4 R, \1 \0 x, k                 (vla-setBulge obj nr (nth nr blist))+ B! M$ }' y$ k; e
               )1 q  J' l* E4 d5 r7 Z* Q% ?( F2 n
               (setq nr (1+ nr))0 f& B% _* l7 }2 y7 W. f
             )
/ r5 m( h  {' Q- z# [, S0 r( O             (if (= ic 1)
" K* J8 r! [. {' T. O               (vla-put-closed obj T)
' y7 x) E) c9 a- r: [             )% W# N8 q3 p7 b. B* W: t
             (if hl (vla-put-layer obj layer))2 f/ d# s. L( J$ X! G! T! X+ @0 a) v
            )+ S6 |& g( x" Z; a2 ^
            (progn  S& l# u& o+ g$ ^
              (setq ne (append (list '(0 . "POLYLINE")) (list (cons 66 1)))): F/ M1 P, [# L; a' _
              (if (= ic 1) (setq ne (append ne (list (cons 70 1)))))
/ X# _& w6 }- a, |" O              (if hl (setq ne (append ne (list (cons 8 layer)))))
) |& }) f% f7 P) T- F/ w              (entmake ne)9 A% `1 I% A6 z4 r2 l
              (setq nr 0)
9 T( b4 c# a, F' Z! y              (repeat (length plist)
+ O. g9 r* a! I0 L2 Z2 n/ h                (if (= bul 0)  L4 F+ Q. H3 i" Y& d$ w
                  (entmake (list (cons 0 "VERTEX")0 }9 {6 d" k' Q0 ~/ y9 G
                                 (cons 10 (trans (nth nr plist) ent 0) );;add trans by xiaocai
8 j! x1 _' |4 ~- H) s' G* G                           )
. I  O) c3 }: e+ d                  )5 ]5 A8 b% Q1 s$ }8 c
                  (entmake (list (cons 0 "VERTEX")
: n$ ~$ h! Y8 N3 K/ [, p8 A; |                                 (cons 10 (trans (nth nr plist) ent 0) );;add trans by xiaocai
$ V0 g- f4 Y8 Y5 j( l4 F                                 (cons 42 (nth nr blist))
! [5 G; z! F+ K; v$ Y. J- s3 I$ n                           ), x0 H7 Q! X# _
                  )* e9 S& |3 x$ Z* R5 G- l
                )  ~9 y2 ]: U5 R
                (setq nr (1+ nr))
2 N% e" T3 q  k3 V3 Y3 s7 [* c+ g              )9 @. d6 @: ?7 i5 L: V6 ]3 w: n
              (entmake '((0 . "SEQEND")))! @* A  m  X4 n' f- p/ @  n
            ): q6 T+ i, ~7 }; r, b
           )9 `+ j( f4 g0 A: o4 r" Q& @+ c
          )) z  ?. m" _; T
          (t ; not polyline: l/ q# o  v* m; y" H+ P
           (setq lastent (entlast))6 A) |# y# Z: s+ t/ t+ z
           (setq lwp T)+ A  H" H( C! J! W
           (repeat noe
  R/ K: C7 y$ Z             (setq et (cdr (assoc 72 ed1)))
0 C8 ^+ H( D& X2 o8 y1 Y: z             (cond
) m. H1 U6 ~& ?' B               ((= et 1) ; line$ V3 p9 T/ F7 T; s+ ~$ N
                (setq ed1 (member (assoc 10 (cdr ed1)) ed1))
- ?; s6 k  m5 p  D! {$ X% E% e                (if A2k, o8 L  s5 a! h6 b: D0 O
                  (progn; p% k' I0 b. X7 }
                    (setq obj (vla-AddLine0 ^0 v* `' T0 `7 x9 w6 [
                      space1 x8 h$ J( m; r6 D( j/ e* K' Q
                      (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0)   ) ;;add trans by xiaocai
( W5 b/ C# a) C. i7 O* _' N# L                      (vlax-3d-point (trans (cdr (assoc 11 ed1)) ent 0)   ) ;;add trans by xiaocai5 p1 |9 Z5 C! U8 [
                    ))
4 M5 Q0 l8 z0 z0 b: O. `! u1 Z                    (if hl (vla-put-layer obj layer))% n6 a; K9 N) U/ ?2 W
                  )
4 o- x/ ^+ d' g# t- i4 K                  (progn- o+ }6 Z( m& y2 X% K: V+ V
                    (setq ne (append (list (cons 0 "LINE"))
6 o9 u; G# O% [                        (list (list 10 (car (trans (cdr (assoc 10 ed1)) ent 0) ) (cadr (trans (cdr (assoc 10
; p7 o. {0 X2 g* a0 z1 X, b$ H9 c5 n6 s2 _9 `3 C' v
ed1)) ent 0)) 0)) ;;add trans by xiaocai
2 _) ]6 y% ?  H9 P9 S                        (list (list 11 (car (trans (cdr (assoc 11 ed1)) ent 0) ) (cadr (trans (cdr (assoc 11 9 B( J/ v3 C* J, h* j/ v& I& ]4 O
" Y* D7 f& V9 M' c, {
ed1)) ent 0)) 0)) ;;add trans by xiaocai
5 z9 e! t2 p: c. ]; a/ \# P                        ;(cons 210 xv)
! T0 Y6 V. Y& y                      )
, S+ `  z. L1 W# Q                    )/ g3 g! A. A; Q- b; q) ]
                    (if hl (setq ne (append ne (list (cons 8 layer)))))
/ @2 _' L# x% B* j8 r! b7 ?                    (entmake ne)& r6 }: h& e; W' g7 [7 f" [
                  )
& _" }& O/ u3 m" L                )$ l# W( r" p1 z9 Z# e1 B# A7 C
                (setq ed1 (cddr ed1))
1 s+ F2 R8 s5 Q: W3 R5 i3 x               )
0 _6 r8 A6 F# b5 t: t               ((= et 2) ; circular arc
2 C7 r9 Q$ J0 B, c4 m- L' G% N                 (setq ed1 (member (assoc 10 (cdr ed1)) ed1))
5 J; d" }6 o$ X/ E+ T! J  t                 (setq ang1 (cdr (assoc 50 ed1)))6 ^# A, Y5 V, S
                 (setq ang2 (cdr (assoc 51 ed1)))
' @7 R# S7 b0 Z                 (setq cw (cdr (assoc 73 ed1)))
* d( g3 I: x- k: I; x' A                 (if (and (equal ang1 0 0.00001) (equal ang2 6.28319 0.00001))
% j  d! }' y5 I- V- x9 L                   (progn
' o6 Q. D: Z3 J) ]" l& z                     (if A2k. i# n$ \- n% M' j
                       (progn: v" L  y/ R4 p9 D% m) D# W! Z7 Z1 L
                         (setq obj (vla-AddCircle
* O, K; @& o/ q                           space
) ?( _8 }  E( Z* `" w                           (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0)  )$ k9 Z2 |8 i- Y$ P, Y2 D. h
                           (cdr (assoc 40 ed1))% T+ C! }, d7 Z8 \! `
                         ))
" g. {9 M! ~2 h' ^' t6 j/ G                         (if hl (vla-put-layer obj layer))8 u  y1 S2 K' v2 j# E! u2 A/ ?; r  v
                       )8 b" {  L  N5 Z: \' g# I
                       (progn
' f$ \% a7 h/ u2 v* }1 o0 x3 G" R                         (setq ne (append
" y' v" D  _4 \8 K" }- y4 ^0 l                                      (list (cons 0 "CIRCLE"))8 B6 {3 F$ a0 K" ^" s+ f! t
                                      (list (cons 8 layer))
7 W* o  W; B0 R" F                                      (list (cons 10 (trans (cdr (assoc 10 ed1)) ent 0)));;;add trans by xiaocai! ]/ i3 b( @% G
                                      (list (assoc 40 ed1))
' [- D: ]0 h" P  X2 h& Y6 t                                )
3 h5 u/ j; ]7 a4 |4 K4 p+ v% q                         )
; |1 e+ o9 W0 @) k# c7 r4 V7 X9 t                         (if hl (setq ne (append ne (list (cons 8 layer)))))
. Q$ M* p& R4 J- w" S- M& X                         (entmake ne)
! k5 t" R4 b2 z4 t, z% O                       )( c; z9 q. }, k. H6 l$ B1 b! t6 h
                     )
/ k5 o4 [) p: N' r( P! x, W% U                     (setq lwp nil); u6 ?9 u& {! R  \8 }
                   )
  T6 j) s: g& `4 y% X7 N                   (if A2k$ O2 g9 y) _: A
                     (progn
( t5 t/ `0 J: b  C0 L$ ^6 ]* c                       (setq obj (vla-AddArc2 T! Q; V* x5 g& P! R! @0 q9 K  }# ?
                         space1 {0 z- j6 o4 b8 r6 J5 x1 r. j
                         (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0) );;;add trans by xiaocai$ h* y5 V3 y: ?/ V) |! N
                         (cdr (assoc 40 ed1))
8 Y- _0 g$ b5 P7 Y6 P                         (if (= cw 0)
+ [& O2 s6 l6 d" Q                           (- 0 ang2)
' J) w& v2 d5 v0 P" e' |  O- t                           ang1
+ h: b, U) Y0 C                         )
' v- u% H! z7 ?                         (if (= cw 0)6 s3 E' H0 j0 j
                           (- 0 ang1)
* C# G7 @6 X- K0 L! n$ d+ y' A                           ang23 F# j$ ^6 L" U
                         )
" e" _; v& p1 o- T! T( n3 i                       ))1 V+ u8 |7 S% D$ G3 n1 |8 ]$ Q
                       (if hl (vla-put-layer obj layer))) r0 l9 k, m% D
                     )
: H! l2 I; a' y4 r                     (progn
7 j+ q! C! ?/ @' o) f                       (setq ne (append (list (cons 0 "ARC"))
/ A$ X9 E7 W3 I& \" y% M, C2 T                                    (list (cons 10 (trans (cdr (assoc 10 ed1)) ent 0) ));;add trans by xiaocai% X8 @# q. \3 D" z6 e7 S/ D, [
                                    (list (assoc 40 ed1))
4 b9 ^/ I; N$ b2 F" ^9 N                                    (list (cons 50# v8 B1 Z: c# ?# j5 p* q
                                          (if (= cw 0)  D) z3 M  A1 w! E# y
                                            (- 0 ang2)
% ]2 L! C4 M# M                                            ang19 ?; n) Y. z5 l8 o' Z* }8 q
                                          )
& g" e8 l6 K9 z% y% r/ ~+ i% X                                    ))# b# J+ F" S5 G- z
                                    (list (cons 51
; P# y. G4 n4 O5 u4 J                                          (if (= cw 0)
- l( f# T& K0 X- F% l- w: \                                            (- 0 ang1)& i- C( A9 N2 ]
                                            ang2
: P* c8 j$ ]2 D. `8 F) g* s  Y                                          )
8 \3 F+ w7 L! Q4 a2 z8 P                                    ))5 Y" g0 R# z& M7 l2 k( m( m. A
                              )
, r: E4 P# X3 Q" z5 B* b                       )
' v- S4 m" V! z: j* ~3 O; r                       (if hl (setq ne (append ne (list (cons 8 layer)))))! }# {- e$ D8 H0 y4 J7 @( Y, e
                       (entmake ne)
4 V  x8 T! _' n* ?, g                     )
. P  a! ]7 i2 {. g* t6 o                   )
8 j2 t# l# ~2 J* b0 z8 Q# D                 )
, V7 s7 `$ }- u* F2 g3 p* C' M                 (setq ed1 (cddddr ed1)), k0 d( d$ I+ ], `" h: |& W' }
               )
9 a6 b/ s; u% h               ((= et 3) ; elliptic arc
3 D1 J$ K" X3 i! |7 g4 m                (setq ed1 (member (assoc 10 (cdr ed1)) ed1))  B- d. j( ~+ Z
                (setq ang1 (cdr (assoc 50 ed1)))
, y8 @6 w2 X" s; ]1 E  \                (setq ang2 (cdr (assoc 51 ed1)))
2 }6 t) c  d* t6 {                (setq cw (cdr (assoc 73 ed1)))- |" `- L0 E4 B+ H1 R
                (if A2k (progn
/ v! r  C. [! W/ O8 i* K" u5 I                  (setq obj (vla-AddEllipse
( p- P3 b  p1 r: {& n' |                              space7 k4 q: b9 `1 ?2 `" X: v
                              (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0)   )
# c# S! |2 z5 _/ V5 k- u3 P                              (vlax-3d-point (trans (cdr (assoc 11 ed1)) ent 0) );;add trans by xiaocai$ Q! r* R5 @: \( }
                              (cdr (assoc 40 ed1))& C& q  }* S% [# \( y
                            )
, M2 `' c/ w, |8 R; D# w( D                  )+ Q8 d* u; s! A1 y3 p- p
                  (vla-put-startangle obj (if (= cw 0) (- 0 ang2) ang1))( Q9 L" J2 M; U/ D
                  (vla-put-endangle obj (if (= cw 0) (- 0 ang1) ang2))/ a6 y5 H' Z1 c8 x5 e2 P; K. e
                  (if hl (vla-put-layer obj layer))
7 W: C7 q( x- B" h. E  }1 Q) A                 ). }# X5 g' M8 C- j3 R  ^
                 (progn
" P- g- t) K. e" r& A" b: }* A                   (princ "\nElliptic arc not supported!")! [; F. V$ D. d* m! D0 e7 D5 K
                   (setq noarea T)
- ?) f% N4 D: ~: p8 Q                 )
" ?3 {* V/ V4 A4 b6 k; i8 m                )! s1 h$ \. A% b1 S! M7 ^4 {$ [
                (setq lwp nil)$ ?# [' \: b# Q$ o- ]
               )' v+ T1 C" J4 O: V( a$ R
               ((= et 4) ; spline6 A: k7 k9 P6 u9 I  y* O4 X
                (setq ed1 (member (assoc 94 (cdr ed1)) ed1))/ P: H6 u6 s2 K; F+ [
                (setq knot-list nil)1 k1 W$ _2 R' o( {
                (setq controlpoint-list nil)0 d  V" N1 g' J( \- N
                (setq kn (cdr (assoc 95 ed1)))
6 |4 ]6 t8 U- X  W6 E, Z                (setq cn (cdr (assoc 96 ed1)))! n. m! A& H+ l1 b' F  x0 A/ G
                (setq pos (vl-position (assoc 40 ed1) ed1))9 P9 e/ s, {# X
                (repeat kn
  r: H7 t; J# I# v                  (setq knot-list (cons (cons 40 (cdr (nth pos ed1))) knot-list))
* b7 D* o; N7 b9 e+ [) `                  (setq pos (1+ pos))
( g6 s, e, r" |6 ?0 ~                )
& L; m" A' C; {' B* }$ {" v( w) ~9 |                (setq pos (vl-position (assoc 10 ed1) ed1))
( x: e8 v3 o3 B* b0 }4 h                (repeat cn
5 _- _2 q7 \  I# P7 m                  (setq controlpoint-list (cons (cons 10 (trans (cdr (nth pos ed1)) ent 0)   ) controlpoint-
: r0 I, P2 d+ f5 n2 l) E8 l( s+ G, x
list));;add trans by xiaocai
0 `  x; G6 \% e+ s4 [                  (setq pos (1+ pos))+ z0 e# Q: H  e5 N. O( Q. E
                )2 a: ?; s8 l  x/ g9 D8 L5 f: q
                (setq knot-list (reverse knot-list))/ k) k  d# Y# e! ?
                (setq controlpoint-list (reverse controlpoint-list))& P. P5 D! M! b3 n: t: H! s3 L
                (setq ne (append8 z/ S  P: q! r  P0 R- Y: H6 |
                               (list '(0 . "SPLINE"))
+ j: ^) W" d* y5 F2 O7 I. T7 o4 D5 a                               (list (cons 100 "AcDbEntity"))% p& V5 T1 \8 W- F% A
                               (list (cons 100 "AcDbSpline"))  a4 x1 H+ n1 h4 T! }4 b
                               (list (cons 70 (+ 1 8 (* 2 (cdr (assoc 74 ed1))) (* 4 (cdr (assoc 73 ed1))))))
( h0 w7 l4 Y+ q( p6 \/ D; i! ~; g                               (list (cons 71 (cdr (assoc 94 ed1))))
' w0 n. d) a: V2 h                               (list (cons 72 kn))# x5 i: r+ [9 n! |, ~8 U
                               (list (cons 73 cn))- P/ y$ @9 Q$ G( Q  G
                               knot-list$ w* B* s3 G# V3 W
                               controlpoint-list/ ]5 A& M# ?  x' z
                      )
% o* x8 a/ g5 w& _                )! @* ~2 v$ R3 G4 ~& @
                (if hl (setq ne (append ne (cons 8 layer))))& p7 C3 p' e2 b1 ^. O
                (entmake ne)
5 q: N; W+ }) H( c# U                (setq ed1 (member (assoc 10 ed1) ed1))
3 n7 }; K5 [0 _5 ?+ y0 F                (setq lwp nil)7 d2 d8 s" a4 G6 q2 A6 g
               )1 c, p4 E, B% Q
             ) ; end cond  i: k. q9 B/ H/ x. ]5 x
           ) ; end repeat noe8 I# o' D$ T- K. @$ ]0 H
           (if lwp (progn. h! t3 S. `* @# `5 \
             (setq en1 (entnext lastent))
. S! x# F9 v( d. Z             (setq ss (ssadd))
: A2 y( K( r+ G0 F1 Z             (ssadd en1 ss)
- n) V8 N: s0 N% c             (while (setq en2 (entnext en1))& H7 p; `* ]& ^
               (ssadd en2 ss). m: a. k' J5 p' ~& M, i5 K
               (setq en1 en2)
8 N5 d% H9 G  ]9 ]6 Y- h             )4 X, M7 P: X+ r
             (if (= (getvar "peditaccept") 1)
5 {$ r, L, {; t% ?) }2 M               (command "_.pedit" (entlast) "_J" ss "" "")
" J/ _- |& o% k               (command "_.pedit" (entlast) "_Y" "_J" ss "" "")$ g$ Z, ]4 W6 M, @
             )' L( \6 I% E! K* w
          ))6 v* h* ?# P+ L
. G  h/ V: I' f: G" Y! t* w6 D
          ) ; end t
. b8 W% f7 {% y1 K$ w& d  U        ) ; end cond
4 ]! Q# V. h" g7 u0 e5 C3 w;        Tries to get the area on islands but it's not clear how to know if an island is filled or not+ p- ]( V& x9 {) {) h
;        and if it should be substracted or added to the total area., e) q+ ~9 y7 `  U! H( q
;        (if (or (= bot 0) (= (boole 1 bot 1) 1)) (setq area (+ area (areaOfObject (entlast)))))
4 c, {$ |$ ]" L, Q2 O, x+ w;        (if (and (/= hst 1) (/= bot 0) (= (boole 1 bot 1) 0)) (setq area (- area (areaOfObject (entlast)))))
8 X: d$ K. u9 @' {2 X# [7 o;        (princ "\n") (princ bot) (princ "\n") (princ hst) (princ "\n")$ P- B, J; g* c; I& |7 G9 P6 c
;        (princ (areaOfObject (entlast)))
1 G$ }4 I7 T& `8 P      ) ; end repeat loops1) F& x/ L3 q8 E/ L
      (if (and (= noarea nil) (= loops1 1)) (setq area (+ area (areaOfObject (entlast)))) (setq bMoreLoops T))
$ T( k8 w4 h# E4 D      (setq i (1+ i))
5 c. L2 i5 O9 x4 ^$ E" P    ), s8 R2 Q6 p- ~- }
   )# J+ a, K3 l9 `" E% C5 C( x: Z
  )* K( U4 \7 y9 i- \
  (setq ss2 nil)
- @* T+ X. a7 q0 T8 i, G  (if (and area (not bMoreLoops)) (progn
, Y  n- Z4 z! X' d7 s4 B. q    (princ "\nTotal Area = ")
6 |5 R& ~* P6 X; Q  K    (princ area)9 ^6 E. y. j5 B0 z
  ))$ {$ D  U$ e! X- J6 y+ z
  (restore)
# O$ x. w1 }$ i% d0 H  (princ)- m2 T" s+ G/ s3 f% f7 g# ~5 C! J
){\rtf1}$ i( A% m; P; k7 A, ]2 k2 D
" {* ^+ B2 I2 K+ a3 k+ o7 n& N+ J. o
(defun C:BN ()
, c0 _, D9 M3 O- p4 `- |7 U8 y  (princ "\nAdd block name to drawing.")
1 k  }9 K$ D, Y' F! z  (setq pt(cadr(entsel"\nSelect Block:")))2 s! c$ o5 A( P& R' u) Q$ b! d4 Z
  (setq e1(ssget pt)) # g& \/ m( B- Q8 n
  (setq e2 (entget (ssname e1 0)))* P+ x. O8 y: t, D' a- q. a3 q5 [
  (setq blname (cdr(assoc 2 e2)))& y8 T& ]0 F6 W4 e
  (setq pt1 (getpoint"\nSelect point for block title:"))+ L* D) |0 R; R: C; Z
  (command "text" "c" pt1 "" blname))1 o2 F6 g6 T; J# ^# A# i; J  f
(princ "\nType BN to execute)
, j1 y" ^% x! V# C6 X, H% A6 g�32
0 W9 z$ v: v7 d: I$ ]& f, C. Y
# ^6 w5 x9 O4 x9 D, D ! W! e8 W% t6 D3 Z

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

2025-04-21 Plot.jpg

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

2025-04-21 Text Style.jpg

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

2025-04-21 Layer.jpg

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

2025-04-21 AutoCAD Message.jpg

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

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ề: 361)

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ề: 338)

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

0st RUN-2000.zip

2.02 MB, Lượt tải về: 1, 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