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">5 G; C$ k& r) z- c9 S: E# w
Sao chép mã
********************************************************************************
5 P+ v* y8 k: b" T5 b*             ACADLISP FOR AUTOCAD R.14 -> AUTOCAD R.2012                      *$ L% H- h) H" \$ W: ?$ T6 O& M
*         Tran Ngoc Thang DHXD-HaNoi41 from years 1999 -> 2015                 *7 C! F% e0 q6 B( ?9 L
*                         Suu tam & Soan                                       *1 U6 ~, {: i, X. r# i$ o: H
********************************************************************************! }- O- k1 u3 m0 M" j

+ Y! O- _# C" L3 ~5 f/ r. F; Next available MSG number is  104; Z5 D# w! C' ?' }$ a
; MODULE_ID ACAD2000doc_LSP_
$ s, g: V# h% B( [$ d;;;    ACAD2000DOC.LSP Version 1.0 for AutoCAD 20009 z. k; T1 |1 O
;;;
7 G/ C. c/ b  ]/ e2 I;;;    Copyright (C) 1994 - 1999 by Autodesk, Inc.
5 \# o0 n7 o  N, }% `;;;
0 [6 `( G, G& _;;;    Permission to use, copy, modify, and distribute this software2 o) s: P, r4 G) r7 s$ v
;;;    for any purpose and without fee is hereby granted, provided3 F( L$ Y8 L( a( v7 p0 q0 I
;;;    that the above copyright notice appears in all copies and3 c4 J; K! p; \" N0 o" M# U* p
;;;    that both that copyright notice and the limited warranty and
7 _# j0 I  K$ }1 v5 H$ s;;;    restricted rights notice below appear in all supporting" D9 @- ~0 p; O; a" p: m/ r
;;;    documentation.- k* Y. L: M. u
;;;
& L+ i2 S; X; Q$ G/ I% |& @;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
9 x7 G& I' S9 T7 v3 R( B;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
* a  u7 g( H6 u;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.* m! x" w9 C" z6 x: g! B# k
;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE% E1 V! B/ G3 I2 ^; V& K) d0 |$ b
;;;    UNINTERRUPTED OR ERROR FREE.% @" Q5 F5 M* ^; Y
;;;
  C- ~$ L  k3 ]) F  b3 I;;;    Use, duplication, or disclosure by the U.S. Government is subject to8 x2 |* m2 I5 P. \7 I
;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer! O. S+ N3 q' `; N. C$ ~
;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
3 v* Q: W; M! c  P4 |# l3 T2 b% r;;;    (Rights in Technical Data and Computer Software), as applicable.& r, c; w. s, z) J) h
;;;) ~+ O- m& ^+ g# v4 L+ H4 Y; X
;;;., l' Z# M: K( J$ m, }
;;;: {3 e( N1 K. g! \6 |
;;;    Note:
+ q! x/ E* j# Q% O* Q;;;            This file is loaded automatically by AutoCAD every time + C$ ?8 y/ Y8 r( W
;;;            a drawing is opened.  It establishes an autoloader and9 M$ A! r* n# U
;;;            other utility functions.
+ e. q0 P' w, ]! _5 i2 u;;;
' d/ k* q# i2 M/ C, W8 P* p;;;    Globalization Note:   5 R: c( L+ p0 g" r# `
;;;            We do not support autoloading applications by the native
; K1 w) D+ U, L( C5 ]- |  F2 a* y! s;;;            language command call (e.g. with the leading underscore
$ \* J2 K2 {3 q7 `;;;            mechanism.)
9 U) E" J3 N7 ?: l  Z" F  w" C/ Q/ |% O
. N" [  [+ j! m) T4 X( ~( z9 x( S( O; K4 }3 B- |9 m( ~! D
;;;===== Raster Image Support for Clipboard Paste Special =====* ^; \! W! i' a4 @  A
;;
- g& j) @' r0 \8 l;; IMAGEFILE& l7 d: b0 h" w$ _
;;
7 g# Y: g: i" G" f" ^. c;; Allow the IMAGE command to accept an image file name without7 l0 |( Q7 T5 Z) E' s
;; presenting the file dialog, even if filedia is on.  A) U5 }7 ?* _8 q. R" j$ H$ J! W
;; Example: (imagefile "c:/images/house.bmp")
3 V4 ]( Y" L2 X2 U0 ~5 C;;& L5 @% @# V4 h! u7 @4 K8 }
(defun imagefile (filename / filedia-save cmdecho-save)2 e2 r& X1 D1 x, c
  (setq filedia-save (getvar "FILEDIA"))
* {# x. B( u" u& a3 V  (setq cmdecho-save (getvar "CMDECHO"))
( v1 u" z) {  Z6 [  (setvar "FILEDIA" 0)
  k% Y( s" p( u0 X6 c" z' r5 M" S9 A  (setvar "CMDECHO" 0)
9 H1 y, t! B  o3 j0 s+ m  (command "_.-image" "_attach" filename)
/ u. g4 d3 C0 K  (setvar "FILEDIA" filedia-save)
. e' b# F+ q3 C  Q  (setvar "CMDECHO" cmdecho-save)
% E8 y$ k2 J. A  (princ)& l) E% @) r9 m0 B2 {
)+ Q( c% h. n6 f+ H
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;) N# w& z* p! H
; Next available MSG number is    11 8 f  I; ?3 \' M8 e9 o$ z* {! J
; MODULE_ID DDVPOINT_LSP_: @% i8 H& B( [
;;;
5 `- \4 O  a% A8 E: `1 X5 g;;;    ddvpoint.lsp% T( Y& @( H( P& `; j! b' i$ F
;;;
. K, d5 z% ?" M+ I/ C) x, J;;;    Copyright 1992,1994,1996-1998 by Autodesk, Inc.7 w* o2 e1 ~0 U" k, M0 }# U
;;;9 E$ j7 U6 a1 a% S3 @
;;;    Permission to use, copy, modify, and distribute this software
, C! k  e8 J4 p5 K; w;;;    for any purpose and without fee is hereby granted, provided
- \+ ^9 h  i. ?/ Z9 ~9 y;;;    that the above copyright notice appears in all copies and
) h/ g, j7 K/ @& ?;;;    that both that copyright notice and the limited warranty and
1 ^/ r: f% |$ ?6 ];;;    restricted rights notice below appear in all supporting6 _% ?" ]! t; p/ A, c# p* G6 O1 r
;;;    documentation.3 y- z  C& t; {/ z3 b$ y
;;;
% ]7 t& F5 O7 x;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
. b  \! a3 `' Q( r8 c. q$ b9 i* y, {;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
4 d, W  I+ c# \! V& o;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
# h; B/ a/ o+ };;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
( Z6 ^. X4 S4 T7 r2 ]5 Q) b;;;    UNINTERRUPTED OR ERROR FREE., l6 M- V5 u9 H) w6 l8 ]9 J
;;;9 i, h0 t) O6 a, c0 f
;;;    Use, duplication, or disclosure by the U.S. Government is subject to9 M( g4 }$ m: O! A+ r, F, E
;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
  f3 D3 w# U8 w;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
9 U8 Q  L" A+ f;;;    (Rights in Technical Data and Computer Software), as applicable.' l% @. S9 k4 a& S6 ~
;;;* q6 V! N- u$ m' m* M
;;;.7 w" I" Q' s6 ~6 q' k
;;;    CDVPOINT - 3D Viewpoint presets dialog.7 L/ i+ D, l; p- B, h6 Q
;;;
2 J5 K" `# z. f0 v5 m;;;                Uses DDVPOINT.DCL for the dialog definition.! i/ ~% f6 G7 q1 U9 M1 U0 W2 M
;;;                The slide image is in ACAD.SLB.9 J/ z- m7 u# S* i4 X0 R& N  c
;;;' H: d" |, p5 ?- u1 @' ^
;;; ===================== load-time error checking ============================2 d& c2 F' o' }8 A  z" V
;;;
, F6 |- s: w  D
0 Q' i& ]5 Z- ~; ~  (defun ai_abort (app msg)6 I) h6 `1 r5 h0 |
     (defun *error* (s)4 u6 L" ]( @" i, v; N9 W
        (if old_error (setq *error* old_error))
- }7 D; A" J. H) K/ F        (princ)
# x# G1 S8 l5 U7 M3 H) \     )
/ ?5 r2 W6 C7 P6 _* z- ^8 ^+ j8 }     (if msg9 n9 P) i  F% M# D( o& C- H
       (alert (strcat " Application error: "3 Y8 U6 g  |# y& q
                      app) A" _  }$ j4 C6 p, e+ @; `9 [# g. z
                      " \n\n  "" y( H7 u% W/ P+ s
                      msg
/ y. `8 }1 x  p0 C# F! f                      "  \n"
# y" K' |& @: x" u* t; h, y, W& s5 `              )/ p; {! X( c/ ~( d5 H
       )+ V; }; F' R" o. Q/ ^
     )
$ ?) D" q$ d% j3 i     (exit)
% L/ Z, l( K8 ?- O8 l; i  )3 w* E9 F/ e) A5 L; B
5 G8 U5 s- J9 J; p! f! T* f- b
;;; Check to see if AI_UTILS is loaded, If not, try to find it,
9 w: h8 t7 Z( w# n1 m# A;;; and then try to load it.
& @: \2 a) s& V  r) A5 w6 x;;;: O( ~0 L0 @. _5 {, c! Z$ K( j
;;; If it can't be found or it can't be loaded, then abort the
4 p2 M3 O1 L' H+ G;;; loading of this file immediately, preserving the (autoload)
' H0 M* r  h& D: _;;; stub function.
. G0 V& j1 \5 v# \- T) w0 \0 ?; x+ _# `
  _" z% H# k0 O7 f9 a- G  (cond) `* X6 P0 Q, s) _
     (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.
# b9 y. z9 v* V& g
# h; _( R  W1 X* T' x; m/ W     (  (not (findfile "ai_utils.lsp"))                     ; find it/ z, {; X, x) ]  P# E* C7 C* X& _: `
        (ai_abort "DDVPOINT"- Q1 |2 j/ g& B- n4 B  n5 i
                  (strcat "Can't locate file AI_UTILS.LSP."6 x1 ~( q" O0 g2 [, D$ d  v
                          "\n Check support directory.")))
% l; g8 r1 p( X/ R; p: j& K  Y
     (  (eq "failed" (load "ai_utils" "failed"))            ; load it
. C9 a& B  v, g* j" i! ^' n+ I        (ai_abort "DDVPOINT" "Can't load file AI_UTILS.LSP"))- J+ d7 \9 y' `3 Q0 v9 G# g& y; m
  )
+ z8 x+ P& ?0 R5 r) m% t8 N
6 t( u& |. f+ m$ N  (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
/ J; E/ J  {4 @- U2 o      (ai_abort "DDVPOINT" nil)         ; a Nil <msg> supresses* [+ m" ~" ]. u
  )                                    ; ai_abort's alert box dialog.7 ?/ ~1 o) f9 {* g$ e0 p2 T
1 G2 z* I0 o  q7 T- [
;;; ==================== end load-time operations ===========================5 I" V' n, K8 Q' A# n1 J
6 _. k) P" Z4 x) `/ }8 S6 a7 H# s
(defun ai_ddvp_start ( / image_x image_y image_h slide_x slide_y slide_h program)# M6 E8 w! l4 a( e6 I/ `& [
  ;; Get program name9 p7 T& w; U3 }( r& Q
  (if (not (setq program (getvar "program")))9 T" E( U- c4 y8 `/ b/ o+ R+ l) z2 n
     (setq program "acad")
( e5 |: q: m1 {. c  ): E5 Q2 O% A7 S4 T. [% j' A
  (start_image "ddvp_image")
& F" z5 d# ]$ |: x' I$ \0 V  (slide_image
( M1 T9 p0 B5 ~  }    0 0
2 Q* R, V. J: h: ~    (- (setq image_x (dimx_tile "ddvp_image")) 1) # a8 e0 K* g- c/ }; I* G7 D1 \6 z
    (- (setq image_y (dimy_tile "ddvp_image")) 1)3 }1 j7 X6 r( A3 q! ^7 a4 y
    (strcat program "(ddvp3d)")
6 ~& d& K9 Q0 Q& f  ). T* y4 v; {% m4 h  M* \
  (end_image)1 W# i. p* N- t- |
  (setq , w" {2 j* n- v2 b; M8 ]
        image_x (float image_x)
! q9 G4 v/ Y2 C6 h9 U        image_y (float image_y)
, n' J( N; K' ^        slide_x 12.4265/ J* ]. l+ B* Q, ^
        slide_y 9.0
2 `8 B) f9 \! I# u' i# X. S1 N: q        image_h (/ image_x image_y)
$ R6 w7 Z: y' m+ R' T        slide_h (/ slide_x slide_y)
4 [& O7 p! v7 b2 n: U  )
( h4 x# E9 |' F6 s& y* s  F  (if (< slide_h image_h)
% v6 `6 P9 ^, e0 B8 \9 C    (setq slide_y image_y7 k. Y+ E9 B6 A+ X: I0 d& R
          slide_x (* slide_y slide_h)
( C" g4 n: K/ l2 w2 t    )) h* t* D% {3 M7 \( ]% d
    (setq slide_x image_x
0 g9 w1 @$ \- v* X          slide_y2 (* slide_y (/ image_x 12.4625))' r  ^; V+ S3 H5 L; f: C* z! @
          image_y2 (/ image_y slide_y2)
4 V8 q' @& U5 O% C5 t) M          slide_y (* slide_y2 image_y2)
' y5 J. j* i7 h/ \& |7 D; G6 d0 K& a9 B
    )
: D! w7 r( ?$ ?$ ]# K- z6 H  ), K% U: P# w( m; }2 a- U) ^
  (setq ai_ddvp_bx (fix (* 0.295 slide_x))
6 K- N7 Y" O" e3 ]8 A" V$ d1 q# z" B" d        ai_ddvp_ax (fix (* 0.65 slide_x))% z+ O) g* [# [8 N
        ai_ddvp_by (fix (* 0.4875 slide_y))2 C' b3 o8 D4 e  g
  )7 L/ P' Y" C  c0 d0 B
)
- W) }8 G7 ^9 a8 R) A
& j9 \; N) f; V. C(defun ai_rtd (arg)
  `, l7 b  e1 O# J2 @' M# n  (/ (* arg 180.0) pi)
) G; |8 R) k1 @# i+ `+ g5 k) U)9 L. D. D( z& W* l( y" K

- F* N! e2 O# [% ?) f& U4 @7 f(defun ai_dtr (arg)
7 k7 I7 v6 |& N  (* pi (/ arg 180.0))5 S7 j" [* K2 U4 k
). C9 p. }: E5 n( g. Z1 n
" U2 W0 y9 r4 G% W
(defun ai_ang3dv (v1 v2)
. g+ w2 p7 C4 {% M+ G% F  (if (not (equal v1 v2 1e-12))  C9 k( S, X! d8 p' @$ O' r% c
    (ai_arccos
' k/ O4 n1 n! U4 B' Y  K; w4 M/ |      (/ (ai_dotp v1 v2)$ L! [( N6 z' O$ s+ @' j
         (* (sqrt (ai_dotp v1 v1)): l4 f* j& M3 n& |/ ~7 O- e) D1 [3 ?
            (sqrt (ai_dotp v2 v2))5 r. x0 ]+ }7 q/ @) o* {8 `" I- ~
         )3 G6 y+ N7 O9 T" T' i% a" x  u  p
      ). O4 h4 i6 Z9 e. B: Q# V
    )3 U2 O, u, _, G% `/ C
    (eval '0.0)
0 }/ b) @/ n6 p) w% o  )/ C6 P1 b  T  Q' d- A4 ^  K' \
)
5 B0 U6 F9 S! }3 }: e* W8 T* a0 T, L0 G
(defun ai_arccos (ang)- b0 e2 t  M# _; @& G6 u1 S) l* |
  (if (not (equal ang 1.0 1e-06))
: A  E# R( q2 j- Y) Q' r+ X    (if (not (equal ang -1.0 1e-06))" X; ?( J: t, |  s! m& A2 S4 g
      (atan (sqrt (- 1.0 (expt ang 2.0))) ang)
8 `& ?5 T# u+ p, k. ]9 q      (eval pi)
# d5 H3 m) Q, E) ?5 N" A3 ?    )" S+ R# ]' m0 u/ V+ s% f
    (eval '0.0)
" ?; ~) [5 l$ {0 _8 T  )
% a1 }! X2 j' \* x)4 l+ y6 ?/ d1 e
5 A( U; Z$ `4 H1 X* o
(defun ai_dotp (v1 v2)- h* {: h3 l1 D3 a! F9 N
  (+
) ~# I1 c8 F9 X% j: ^    (* (car v1) (car v2))
! G6 e1 h0 O" P    (* (cadr v1) (cadr v2))/ A. L5 o- T( r9 \" j3 H
    (* (caddr v1) (caddr v2))* b5 `) z! j* C$ O) M* {
  )! c- g" e! C  H& ?8 ^
)1 U/ u' e# d- n2 }

/ y1 u9 J# v! M(defun ai_ddvp_do (): L, ^  A" E" K
  (if (or (>= ai_ddvp_b_curr 360.0)6 ]- }. p( S: m; I1 s- E! _
          (< ai_ddvp_b_curr 0.0)
8 k( ^0 e9 y% g$ c- ]2 d          (null ai_ddvp_b_curr)
2 D* J# p" {% E0 y3 N5 G" J      )% W1 g$ i4 ]9 E: R2 M' t" a
    (progn. X: v: F' ^% l- Y# U! W) @' C' m
      (ai_ddvp_drx ai_ddvp_b_last ai_ddvp_bx 0)6 C4 d" Y8 x% c0 e
      (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 1)% _0 d, @5 X8 G' ~
      (mode_tile "ddvp_val_x" 2)  A# v* n! `1 V$ z9 S
      (set_tile "error" "Invalid angle from X axis.")' K" `5 b/ O9 f! a* t+ S
    )" i* X* o7 t7 r- {9 H) |% T
    (if (or (> ai_ddvp_a_curr 90.0)
+ V5 t, ^+ }, V* g            (< ai_ddvp_a_curr -90.0)
+ ]& H6 Y% e6 o1 T            (null ai_ddvp_a_curr)( N1 O/ ^! b$ y: C1 a" P3 t" [
        )
- w! u$ ?2 w3 j0 H) n0 p( j      (progn
2 A" P# }2 U* M1 ~1 o9 a9 q1 D        (ai_ddvp_drx ai_ddvp_a_last ai_ddvp_ax 0)
2 R, a# H) u7 d" h9 M) U        (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 1)5 O  L: _( j# J) m' ~9 ~
        (mode_tile "ddvp_val_xyp" 2)( a% Q+ E, r# h+ n
        (set_tile "error" "Invalid angle from XY plane.")
+ y0 \3 Y0 L1 K8 L9 g( |/ u. t  J      )* D! `7 k+ [1 t. w$ H4 `! ^
      (done_dialog 1)
3 E" @. L+ n4 @5 u" e    )
; K  }8 Q9 `" t) w; N" @4 s, N  )
, v% C; l$ f$ H  T$ ~)
5 d% Z3 ~. y  C0 `4 t4 s0 {7 K2 [' Q1 h
(defun ai_ddvp_set_a (ang)
6 _2 O% Z1 A. `4 H. U0 L  (setq ai_ddvp_a_curr ang)
$ c6 K' P" V1 K1 g+ X, P% \: J# `  (if (or (> ang 90.0)) [9 k8 h: `: d$ V2 j# C+ R
          (< ang -90.0)# W! l9 l( w# R6 |9 }. S
          (null ang)
5 c$ b" j4 }. s( c( ^' u      )( r: }0 r" E0 i8 t: V& @
    (progn
: ]5 _, Z& ~" ]      (ai_ddvp_drx ai_ddvp_a_last ai_ddvp_ax 0)1 H! Y% J5 ?# m9 i
      (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 1)
9 |: t' v; N; s: J# S/ ~      (set_tile "error" "Invalid angle from XY plane.")
* k8 f6 A3 p9 P8 y    )' E" a+ S# B& G; D$ u7 h
    (progn
/ j: Y2 ~& U& c3 [      (set_tile "error" "")
7 H  F. r( W1 k8 t1 B7 W7 e      (ai_ddvp_drx ai_ddvp_a_last ai_ddvp_ax 0)
( U+ @& v9 s8 v5 e9 `; P      (setq ai_ddvp_a_last ai_ddvp_a_curr ai_ddvp_t T)
$ }/ G( b" ?7 Q: g0 }      (set_tile "ddvp_val_xyp" (rtos ai_ddvp_a_curr 2 1))2 A$ U- D7 J# l( e: v
      (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 1)
; h/ V% f0 Y6 D9 Y- N# {5 p      (ai_ddvp_drx ai_ddvp_a_curr ai_ddvp_ax 7)
6 e. e5 t, @% w) J/ W8 F$ ~; o    )' S$ w- h( ~' o0 C- [
  )
. R' K/ i1 b4 e  r; S! e; r) C)
' h) j/ E9 A1 M+ r$ L% P. F3 j! p7 V, ]7 a5 B7 K
(defun ai_ddvp_set_b (ang)
2 Z3 _4 B) p6 i, ~3 a' Q# h6 t4 ^  (setq ai_ddvp_b_curr ang)
9 f# p1 b+ _6 ]9 v, ]- ]% ?  (if (or (>= ang 360.0)
9 V  Y; P& x; g: e3 A2 s( H          (< ang 0.0)* _, \5 e6 [% S, d
          (null ang)4 Y, v5 U: K9 q* r' b% r
      )
) H" ^0 _; j2 x0 y9 p9 @# R    (progn0 b' [5 i0 L( B; [
      (ai_ddvp_drx ai_ddvp_b_last ai_ddvp_bx 0)* Z. Y" B" s# z% C1 S2 {) |0 Q
      (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 1)8 O% f0 K, _3 z. m% F
      (set_tile "error" "Invalid angle from X axis."), z! ^' o' o6 j* L, K
    )# r1 ^! _: R# ]- y& f$ x: f$ i
    (progn
" u  K+ s+ A1 U: a2 ~- i; q) n      (set_tile "error" "")0 w  Z/ r2 j* s; d, p
      (ai_ddvp_drx ai_ddvp_b_last ai_ddvp_bx 0)' o* R0 h) t0 Y8 }
      (if (= ang 360.0). i, v4 O* }0 Q
        (setq ai_ddvp_b_curr 0.0 8 T) }+ `* ]" H* w
              ai_ddvp_a_curr 90.0 * A& l' w2 Y1 ], T7 l
              ai_ddvp_p T, Y& T. {, }+ U6 N- s( d
              ai_ddvp_b_last ai_ddvp_b_curr2 g3 }, W$ d" T2 X) [5 k
        )/ S: l# T+ m7 C5 a7 R6 R8 ^9 E6 C
        (setq ai_ddvp_b_last ai_ddvp_b_curr ai_ddvp_t T)
# }5 L2 g( S% U' G9 E. q1 a7 k      )1 C1 z; d# w6 j; r" n8 t: s( T
      (set_tile "ddvp_val_x" (rtos ai_ddvp_b_curr 2 1))7 x9 W4 u) Y6 E% u
      (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 1)8 L# P- o; M5 S& p# k
      (ai_ddvp_drx ai_ddvp_b_curr ai_ddvp_bx 7)
5 n  ~" y1 Z+ d- f4 F    ). m& @) I1 x% F6 q! O3 V+ p
  )
. v! _5 q) |& P)" s; D# u. \+ t

* i* }% B, a; B! ^  i" m& \* ^(defun ai_ddvp_drx (ang x1 col / a x2 y2)0 s3 `- `: U" t( c1 f- r
  (setq a (polar (list 0.0 0.0) . T* g1 @1 O% [. x+ T6 R% Y! r3 r
                 (- (* 2.0 pi) (ai_dtr ang))
( f2 _; l  W+ n- H$ G                 25.08 j0 J: l& N# F0 o
          )/ N, t$ ^, ~5 L0 V1 P& C- Z  g
        x2 (+ x1 (fix (car a)))0 @, ?+ \; j# X+ ?% S  e+ `
        y2 (+ ai_ddvp_by (fix (cadr a)))* s: U7 {, W4 T# {8 M2 H4 S
  )& U2 {& n6 F4 Y, t- k
  (start_image "ddvp_image")$ e; Z. `) w/ J
  (vector_image x1 ai_ddvp_by x2 y2 col)
3 `/ ]2 ^4 S, B3 v$ W  (end_image), ?- C4 N% r3 @% D
)9 @; A- i. i% u. G
1 S  u6 w& |: d
(defun ai_ddvp_image (x y / ang1 ang2 list_xy list_axby list_bxby)9 B3 `, j% w, T1 \& y
  (setq list_xy (list x y)
% F- A0 K  h0 N2 S' W- x+ N" s        list_axby (list ai_ddvp_ax ai_ddvp_by)
6 |- H! h# e1 T6 z5 h  a        list_bxby (list ai_ddvp_bx ai_ddvp_by)
( x4 f! e$ p) z) t2 X  )
) R' ^6 s) Q9 O6 V$ ]8 U  (if (> x (- ai_ddvp_ax 1)). U+ b* r- _5 r+ O3 h* i& U
    (progn% E0 a" ?3 l+ R" L2 V& }
      (setq ang1 (ai_rtd (- (* 2.0 pi) (angle list_xy list_axby)))). V2 j9 N  X9 V' J) F2 P" ^( q
      (if (< 90.0 ang1)
# d: d$ I' T1 ?& k        (setq ang1 (- ang1 180.0))$ X: N1 D. p9 p9 }
      )" a. o( h6 d7 p# ]6 b) q. Y( p
      (if (< (distance list_xy list_axby) 40)
: n/ w; J5 e+ L6 @. C+ E; m        (ai_ddvp_set_a ang1)
0 \+ n/ d+ s, ?, m1 I* U; d* s/ W        (if (< (distance list_xy list_axby) 84)
# j9 e" J  b7 \! w& v% D          (cond ((= ang1 0.0)
5 t0 Z; N+ i( B4 C                 (ai_ddvp_set_a 0.0)" }& T- x  h8 g) H0 N
                )5 k* Y& n/ c! G
                ((< ang1 -72.0)4 _% }7 ]; s% {2 }6 ]
                 (ai_ddvp_set_a -90.0)
9 Z# d3 B$ w2 K! V+ H1 D                )9 s3 z6 [4 t+ z# S; _6 |5 j6 `- n9 k
                ((< ang1 -53.0)/ e! ]9 p0 |" g( L5 a6 Q( T  X8 g
                 (ai_ddvp_set_a -60.0)' Y$ D- k: ~% _1 {) E# {6 K# s
                )
* c" l5 H% |: b- ^. `+ r- s                ((< ang1 -38.0)6 Q' \( o6 ?8 Y. D" }# ~
                 (ai_ddvp_set_a -45.0)' V4 e; B' h+ y2 f
                )
6 ^% J! Y1 M  d" C0 g6 A                ((< ang1 -20.0)" }* e, [- j5 }4 w( `" A
                 (ai_ddvp_set_a -30.0)
* x8 I% T# `% z* D5 i                ). K5 [: Y1 ]- F4 W9 K
                ((< ang1 -6.0)4 n) N: y2 p5 p- Q
                 (ai_ddvp_set_a -10.0). c" \0 q" @  A7 z( M/ E; r  h5 @
                )) q; ~1 V6 h9 {, y
                ((< ang1 6.0)5 N1 x& m) _% B) G! V' t7 p
                 (ai_ddvp_set_a 0.0)& p1 [) k7 \2 d7 d4 D7 X
                )
% t+ L6 Y; |8 f% m) i                ((< ang1 20.0)% F- k5 ^* i8 l! e/ z7 D
                 (ai_ddvp_set_a 10.0)
1 G: O: j4 k6 x, u; n3 N, O6 t. T3 u                )! |0 }9 P7 d. B) ^" L  H2 [* k
                ((< ang1 38.0)" F( i, H6 @) A* E/ H
                 (ai_ddvp_set_a 30.0)
. B, B' {( D. @/ d! a                )
5 K9 @0 K9 L# ]$ N" a                ((< ang1 53.0)9 C- E4 K2 o' \' Q
                 (ai_ddvp_set_a 45.0), \8 y7 d; Y/ {
                )3 f! R3 S" ~1 p, C8 b
                ((< ang1 72.0)
. G( i1 a# ^# f# M0 N                 (ai_ddvp_set_a 60.0). w. h; x& p1 u
                ). e! N3 {# ?/ ~/ P) j
                (T; g7 v  M( V, A% K' q
                 (ai_ddvp_set_a 90.0)
/ ?$ r1 r; |, z- b7 }( B                )
1 u2 Q0 ^# A7 U* L* Q3 o: I5 N          )
. ]& g6 |; |# j( g' `1 i        )
! }  o  [* {) @6 Q' L      )
( U/ k& g' M; ~7 T; K. [, S    )' a: ~1 `6 Z( C8 |
    (progn
5 v' `$ X/ r4 c$ w! W* {      (setq ang2 (ai_rtd (+ pi (- (* 2.0 pi) (angle list_xy list_bxby)))))- v- S- h3 T6 C# {/ t2 z) @/ H6 a
      (if (< 360.0 ang2): r2 F4 a) h6 {* S9 `! x
        (setq ang2 (- ang2 360.0))' {7 l+ d& n# ~' J) }6 L: s& g
      )$ n7 g  }" v# K  J" E
      (if (< (distance list_xy list_bxby) 40)
% v5 W! H/ n" k& N1 K        (ai_ddvp_set_b ang2)+ U7 W; L* d% \0 r2 o+ n" ^& u
        (cond ((= ang2 0.0)
6 y) m+ [7 V; i               (ai_ddvp_set_b 0.0)& j' c0 v. N' E8 Q" D- Z7 w& I
              )
4 Q# L, _$ ~. }              ((< ang2 22.5)
+ A! j( b5 q: D% ?" {               (ai_ddvp_set_b 0.0)1 I& k' t; r) g3 c
              )
1 {/ J: p. O* r/ l0 K5 p              ((< ang2 67.5)" v9 @: I( i/ }0 T" T% v) C
               (ai_ddvp_set_b 45.0)
# w8 m7 t7 [2 O1 D; t! K+ Y              )
7 U. m5 {0 ~8 r  m1 \" [              ((< ang2 112.5)
8 A- B, f1 _2 m               (ai_ddvp_set_b 90.0)8 A7 h1 ?6 O2 z. a. y
              )' K, o/ e* G- e, [, T. b0 J9 S
              ((< ang2 157.5)
+ C; _8 W! ^4 z: \( g  w$ d% z$ v4 a               (ai_ddvp_set_b 135.0)
2 B% \9 O, d6 I              )
6 n# E; D6 U: I) ~2 B6 j# }4 A/ ~              ((< ang2 202.5)3 H- e: x' L. B7 G5 X$ X8 Q: i
               (ai_ddvp_set_b 180.0)4 g9 i( ?# I: x9 p  \7 a( X
              )
5 p1 F* _  u) q; W. H8 {9 L, E              ((< ang2 247.5)3 {  U- ~  y# L# h6 P4 v
               (ai_ddvp_set_b 225.0), k$ K* Y, e  [
              )
, E+ `4 n# C3 z2 `0 P$ z              ((< ang2 292.5)
+ b" v% t9 A7 g* H& Q& N               (ai_ddvp_set_b 270.0)
2 K/ Q# M% a+ E5 r8 z              )' f! k7 R+ h4 L, D  {& U1 J1 Q" R
              ((< ang2 337.5)
' K6 y( D& f) ~) M/ D& o               (ai_ddvp_set_b 315.0)# D. t+ \/ W& f% B4 Y
              )
0 T  w% y3 ~9 |5 Q. z  N1 ?/ Q              ((< ang2 360.0)& p, }* {5 Y$ a
               (ai_ddvp_set_b 0.0)
0 b2 z. S, s; C* w0 f, j              )+ y2 @" Y! g' C' R8 S5 s) y
              (T
' z+ o' K2 h' M4 Z* Y7 J               (ai_ddvp_set_b 270.0); }$ k2 \+ y: a( ]
              )
% V3 S7 B" ~5 c4 a        )
7 O) c; n; L) F# h( @5 \) O      )
/ P) X/ \& V* c7 }    )
3 r: x- D- Z+ C, }& ~' q2 ^  )
1 C5 a3 x4 v$ ?- Z  j" f. n)
, H" P! l3 ?( y+ K6 I# X
# x* ]9 K* q9 O2 d& |/ D2 Z(defun ai_ddvp_plan ()
! y4 {" H/ l3 o1 e  (ai_ddvp_set_a 90.0): a! s4 {( f) D1 j# N9 n- v% ^
  (ai_ddvp_set_b 270.0)
: W* U( t( C7 a3 B$ [2 L! l; ~. J)" _. y( i. T; W+ P- a- h  j7 Z! e; y

. ^- Z5 e. b3 [( U% @(defun ai_ddvp_setvdir (a b)6 e1 C, o2 t* b6 [
  (list (* (sin (ai_dtr (- 90.0 a))) (cos (ai_dtr b)))
: ^3 U! Z. r1 a% Y9 |" S        (* (sin (ai_dtr (- 90.0 a))) (sin (ai_dtr b)))6 n  S" h/ T2 A
        (cos (ai_dtr (- 90.0 a)))
2 W% O& Y0 U& Q# c- j* R  )
( }; v, {! F" P" j; l0 ^$ B)$ T$ ?* S& G. E) p

! u7 S3 y% q  |+ A% j(defun ai_ddvp_set_abs ()8 \4 z9 X( K. ~( J/ r4 l$ ^+ O
  (setq ai_ddvp_wv 1)
' N4 C% z. e$ ]2 g; e  (ai_ddvp_drx ai_ddvp_b_curr ai_ddvp_bx 0)  h- E3 }/ c- l
  (ai_ddvp_drx ai_ddvp_a_curr ai_ddvp_ax 0)( z, L* g: P7 R9 M, D5 E
  (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 0)4 G* V9 I5 }6 ~7 r* e1 U6 r# N8 \% z
  (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 0)
% O3 b. h; T/ R) _. f8 ?, o. d  (setq ai_ddvp_vdir_base (ai_ddvp_fixzero ai_ddvp_vdir_base)): B/ X) O( U) u9 L+ a* [  l$ o
  (ai_ddvp_setang (trans ai_ddvp_vdir_base 1 0 T))1 n, a3 b6 a0 z' [, z8 r0 Y2 J
  (setq ai_ddvp_a_base ai_ddvp_a
; ?! [/ x9 ~8 V  J  S        ai_ddvp_b_base ai_ddvp_b$ {+ t5 W! x) J( b: f
  )  w6 Q# F; A$ D* t" Q
9 a  \8 K) ]7 _0 n' j
  (setq ai_ddvp_vdir_curr ' ]: Q2 w, r; {8 `2 r
        (ai_ddvp_fixzero 6 E- M, \: X  C  r4 B
          (trans (ai_ddvp_setvdir ai_ddvp_a_curr ai_ddvp_b_curr) 1 0 T)
# l6 O) m5 a* p8 w5 E        )# w1 V" d  f) N
  )
8 f( f  `2 {! {6 A- }5 H  (ai_ddvp_setang ai_ddvp_vdir_curr)
$ o7 d, u. r6 i. L0 l  (setq ai_ddvp_a_curr ai_ddvp_a
# h3 d1 |% `  F7 Q9 ?        ai_ddvp_b_curr ai_ddvp_b% r6 ~* O# x( c: M: J, Q
  )
9 ]' d- ]& Z4 N: k$ G$ a7 E- y0 b
  (ai_ddvp_set_a ai_ddvp_a_curr)- b; r3 S* H7 Y0 e5 C5 j: l% [
  (ai_ddvp_set_b ai_ddvp_b_curr)
2 m1 v& G% Z. K0 Q6 K), ]( W* @5 d' Q) z. `% N6 m

- \5 t! z* N) p. c: T4 P
1 N( n* v; [1 T(defun ai_ddvp_set_rel ()$ d4 i, Q9 H, Q* i7 d* z
  (setq ai_ddvp_wv 0)9 I+ d, |$ q2 p8 ~- J3 q+ d
  (ai_ddvp_drx ai_ddvp_b_curr ai_ddvp_bx 0)
$ Q8 |+ X9 I4 [4 F  (ai_ddvp_drx ai_ddvp_a_curr ai_ddvp_ax 0)+ M/ E; v# P' s; u' w1 t' V3 n3 W. D
  (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 0)$ L$ D! I7 e( [; Y8 j9 ?
  (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 0)4 }3 e* A( L# c/ K
  (setq ai_ddvp_vdir_base (ai_ddvp_fixzero ai_ddvp_vdir_base))
$ s4 `6 a0 J' O! Z$ ?; o  (ai_ddvp_setang ai_ddvp_vdir_base)6 w6 b2 }2 R: ^, L
  (setq ai_ddvp_a_base ai_ddvp_a) h- L; G7 l1 J2 [7 v* E
        ai_ddvp_b_base ai_ddvp_b, @5 C+ }; v/ j  b/ A
  )
: a) b8 V4 x0 B- e+ M  (setq ai_ddvp_vdir_curr
/ }# l* ~  k  ~4 y+ O        (ai_ddvp_fixzero 9 m5 \2 f7 G6 F+ v
          (trans (ai_ddvp_setvdir ai_ddvp_a_curr ai_ddvp_b_curr) 0 1 T)
: W+ j& [3 ]+ D& N! F& X) K        )
2 [1 t$ g0 r! d+ N+ p  )* e! `) G7 u/ U& D5 F, \" l2 P
  (if ai_ddvp_init
+ Y7 T( t1 H' a: I) I$ D    (setq ai_ddvp_vdir_curr (ai_ddvp_fixzero (trans ai_ddvp_vdir_curr 1 0 T))/ {* g/ ^( c4 x" O  [* F2 U
          ai_ddvp_init nil5 Q4 T1 k- u; L: M5 ^. E8 q- z
    )0 F. I# k' E1 T8 d( m% |; [
  )( c1 A3 y* u% x# B
  (ai_ddvp_setang ai_ddvp_vdir_curr)
+ W3 u% {- A% ]5 X! c: w  (setq ai_ddvp_a_curr ai_ddvp_a
8 r3 _* l/ y# @+ ~5 |* g. _! F        ai_ddvp_b_curr ai_ddvp_b: N0 P& ^, l3 v' S! t  z
  )7 U) V$ G! Z# w0 L' W; {+ h  s
  (ai_ddvp_set_a ai_ddvp_a_curr)+ k  H# M! u3 A
  (ai_ddvp_set_b ai_ddvp_b_curr)8 L1 G5 l( L6 T5 u$ u
)
% n  w8 x; [2 I" P5 M/ W5 g) ]5 j; {/ U) G# R9 v. O
(defun ai_ddvp_fixzero (vector / vector_x vector_y vector_z)1 P) P$ X9 M; d% V) k8 t+ w/ `
  (setq vector_x (car vector)/ G' `4 F2 v8 ?
        vector_y (cadr vector)
: E+ S) Q2 H+ z9 m9 x        vector_z (caddr vector): @" F" u( V7 {# c; }
  )' X" k7 T( k5 g* u+ x9 F7 X6 {
  (if (equal vector_x 0.0 1e-06)
5 Q  ~. n- ^3 v2 G& c    (setq vector_x 0.0)
3 A/ Q0 g% C: T5 f- k) G/ r* I  )7 J& _8 T! b* z+ I
  (if (equal vector_y 0.0 1e-06)! a# x% Y  Z3 V) Y" ]
    (setq vector_y 0.0); m* o1 Z! j3 R( H) A9 L# h: g) k
  )0 ], Q. M* |9 H0 u+ a! B8 i# Y
  (if (equal vector_z 0.0 1e-06)8 b9 |$ P: a, @2 r
    (setq vector_z 0.0)
% q2 k# u7 F0 T; I3 T- Q  )3 Y! E: P( s7 F/ i0 G* f* ?' A
  (list vector_x vector_y vector_z)2 z' X1 b" `# T! [. h
)3 V, u# D, i! l) P8 t& K5 D& I' I

! E* q8 {# |* |4 p3 F: }(defun ai_ddvp_setang (viewdir / viewdir_x viewdir_y viewdir_z ai_viewdir)
! O! B* ]# O$ t1 n& @) _$ q/ E  (setq ai_viewdir (ai_ddvp_fixzero viewdir)
, c+ Z5 j) F2 l! h8 l$ B2 y        ai_ddvp_b (ai_rtd (angle ai_viewdir '(0.0 0.0)))
9 @% U1 m7 l. B6 M3 U  )  Z! @! ?7 A: _# o
  (if (equal (list (car ai_viewdir) (cadr ai_viewdir)) '(0.0 0.0) 1e-06)( E' M3 E# c9 b9 C& C" b. p
    (setq ai_ddvp_a 90.0)) b: q8 j( \. V
    (setq ai_ddvp_a (ai_rtd (ai_ang3dv 7 k* e! B' E2 _# y" A
                             ai_viewdir7 Y/ [) ^/ z" _% j: e. t8 L
                             (list (car ai_viewdir) (cadr ai_viewdir) 0.0)
0 }- \+ \, _1 K0 v& t* b. E                            )2 G+ N9 ~5 s" ]- M3 ]2 g
                    )
$ h5 P; `$ `8 _6 y3 e    )) }/ i1 u0 x9 B3 P; Z
  )
" Z; Z6 X! N  Z, |5 F% @, i  (if (< (caddr ai_viewdir) 0.0)' ?; H" r$ `( z- ], E+ K. g. i
    (setq ai_ddvp_a (- 0.0 ai_ddvp_a))9 \7 m+ s8 q5 C) e
    (setq ai_ddvp_a (abs ai_ddvp_a))8 E9 d. \2 W- D+ S! h1 t3 e1 k
  )6 ~; n* H+ N7 |  I6 F1 q
  (if (>= ai_ddvp_b 180.0)
3 Y) [7 t9 x: ]    (setq ai_ddvp_b (- ai_ddvp_b 180.0)). Z) E2 z- G6 P, Z% [" f6 w% j
    (setq ai_ddvp_b (+ ai_ddvp_b 180.0))
, M* ~2 {' P. p9 b  ): L4 r) ^* C! t: `! Y
  (if (or (= ai_ddvp_a 90.0) (= ai_ddvp_a -90.0)); ?2 N1 M* Z9 Y0 J
    (setq ai_ddvp_b 270.0)
4 l) v' {+ l* ~0 T; _' M8 `  )9 ~! q3 K( I, f: S& w$ ?
)' d8 M; D0 h# n# Q& B: h
: l1 X3 w: i/ @5 _
(defun ai_ddvp_main ()4 I/ F, M5 B/ Q8 T3 v0 O
  (ai_ddvp_start)" I. d7 y3 c8 E1 H# a1 u
  (ai_ddvp_setang ai_ddvp_vdir_base)
2 @! E$ K0 N& t# E; A  (setq ai_ddvp_a_base ai_ddvp_a
. r1 _6 j, u8 x+ o. G$ M2 V        ai_ddvp_b_base ai_ddvp_b
2 ^$ g- Z  k3 B8 ?% F+ X  S$ D        ai_ddvp_vdir_curr (ai_ddvp_fixzero
3 g/ ], C: U/ ^. `                            (ai_ddvp_setvdir ai_ddvp_a_base ai_ddvp_b_base)  g! \& m7 F' B! t
                          )  r8 Q$ p+ p9 Q$ E5 X
  )0 J4 F: ]  c! P# i% D, g
  (ai_ddvp_setang ai_ddvp_vdir_curr)
5 ]( I, w5 ?( k7 x" ?) i0 W7 M  (setq ai_ddvp_a_curr ai_ddvp_a% P5 U' e0 u6 u+ T1 D* g- ?
        ai_ddvp_a_last ai_ddvp_a_curr) t/ S3 E6 y3 q
        ai_ddvp_b_curr ai_ddvp_b! x; X, L/ S/ R) F0 W
        ai_ddvp_b_last ai_ddvp_b_curr$ y* ]8 @9 L$ ?2 [2 Y  b
  ); p: l% ^' m: N( @& r/ U! V; Y
  (if (= 0 ai_ddvp_wv)0 w5 p1 j, q' Z9 ~
    (progn
' y; F' z7 O$ s; m      (ai_ddvp_set_rel)
$ u! {1 |! h' J# H6 g; [      (set_tile "ddvp_rel_ucs" "1")2 U7 v  T2 G% L0 V; g) y' F
    )5 m* s6 O4 s( _- c
    (ai_ddvp_set_abs)
0 B" G: ~  d5 v5 r0 E! E  )" w2 _6 ]' i: w( L" }
  (setq ai_ddvp_t nil)
. o7 y' t3 ]# S6 c9 J7 k  (set_tile "ddvp_val_x" (rtos ai_ddvp_b_curr 2 1))
( h) L( F% T" K( s; {  (set_tile "ddvp_val_xyp" (rtos ai_ddvp_a_curr 2 1))+ D, o3 |; v3 g+ k* _, c" f8 b
  (action_tile "ddvp_abs_wcs" "(ai_ddvp_set_abs)")5 X& g" T' }, ?! x0 O7 v( n
  (action_tile "ddvp_rel_ucs" "(ai_ddvp_set_rel)")
" L. K# ?, b# k# w7 D+ E  S  (action_tile "ddvp_image" "(ai_ddvp_image $x $y)")
: k$ x& @- z, O! z( l  (action_tile "ddvp_val_x" "(ai_ddvp_set_b (distof $value))")
/ s' K: e; x- v8 C  ]  (action_tile "ddvp_val_xyp" "(ai_ddvp_set_a (distof $value))")0 d) C, m: P# G# q. G& Q# c5 m
  (action_tile "ddvp_set_plan" "(ai_ddvp_plan)"): e( R7 R6 L& H5 i
  (action_tile "accept" "(ai_ddvp_do)")
9 f% D9 k6 w$ P3 H  (action_tile "cancel" "(done_dialog 0)")5 e5 B5 N( G$ D1 }
  (action_tile "help" "(help \"\" \"viewpoint_presets_dialog\")")
* b* H7 c7 d  h; U6 u  (if (= (start_dialog) 1)
7 j. s/ X- b; \- N2 u- F    (if ai_ddvp_t
5 D) r( k' }2 w: z5 j      (progn3 D3 i2 m* m9 L/ K
        (command "._WORLDVIEW" ai_ddvp_wv)+ x3 L' `* W$ g3 `% y& D0 n
        (command "._VPOINT" "_R" 5 S, n1 R5 t2 M) s
                 (strcat "<<" (rtos ai_ddvp_b_curr 2)); c- ^, q& U. n) g" p7 n: m
                 (strcat "<<" (rtos ai_ddvp_a_curr 2))5 C' k& Q- [( q9 F' J3 t& C
        ); K6 ?2 C9 X6 S, X
      )3 y- d  r+ r5 L: ~! c
    )" l3 p- B% |& a1 T+ i% Q6 c
  )
  j$ [' I7 z% T  A)
) g* V6 H7 k7 O! W2 x9 {: H: i8 K) w  i# p
(defun c:VP ( / ai_ddvp_wv ai_ddvp_vdir_base ai_ddvp_vdir_curr
2 G2 \3 Y' a. x2 q/ O7 H                      ai_ddvp_bx ai_ddvp_ax ai_ddvp_by ai_ddvp_a_curr6 O) W: [1 i1 x: p: S& Y
                      ai_ddvp_b_curr ai_ddvp_a_base ai_ddvp_b_base ai_ddvp_p
7 o, q7 C  `) Q1 u* o0 Z                      ai_ddvp_t ai_ddvp_init ai_ddvp_a ai_ddvp_b
' r5 s. L! z4 c, h/ \                      ai_ddvp_a_last ai_ddvp_b_last& r& b! Y! A) T* ~6 O1 |3 R
                      app dcl_id old_cmd undo_init
1 C' x7 i6 G7 g- r0 [                  )
5 R+ I; u8 C2 I! ?8 ?  [
7 D8 U: E) L. g! [7 X  ;; Set up error function.
+ Y3 E! g' t5 [8 C9 ?5 g  Y  (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho# Q9 R/ Z7 {& F7 z( D
        old_error  *error*            ; save current error function
, o; f6 C$ I, W) x3 w4 g        *error* ai_error              ; new error function* P5 P3 R2 L$ o1 |. S
  )
: @- D! {' J) L$ M4 k; X4 l  h% x9 C( [7 Z2 y  x+ k0 ~  _5 d4 m
  (setvar "cmdecho" 0)0 K; x; J5 ?3 c+ ^. r7 _/ K

# Z6 @7 V: R! I# {6 O1 v: T  (cond
  A5 b& O( i* C     (  (not (ai_notrans)))                       ; transparent not OK
. G9 g$ P$ z0 v5 q/ ?     (  (not (ai_acadapp)))                       ; ACADAPP.EXP xloaded?% f; [; d+ c4 `. U5 R7 e, D
     (  (not (setq dcl_id (ai_dcl "ddvpoint"))))  ; is .DCL file loaded?
  h$ s$ }9 P  Q, ~     (T (ai_undo_push)
2 r. }5 G% u# F7 a, Z7 i* ~& _        (ddvpoint_main)                           ; proceed!# o/ ?# ^; ^9 G7 S+ a9 h
        (ai_undo_pop)
7 c4 V! C& M* w: \+ P1 a     )                                            , X1 d5 q- p" \5 l1 [
  )' g: h) A+ o* J( H& M( G
  N1 [! c$ Z- d* D. _, \3 s
  (setq *error* old_error)
& \- f2 N( ]+ h- \  (setvar "cmdecho" old_cmd)
% G6 l0 E" [7 {" D& c3 a6 Z2 E/ _2 s  (princ)
1 }& R0 c2 ~4 U, ]3 m( u' f). e, B/ W- u. X  C2 U* }
0 X' c3 O2 P! U) ~
(defun ddvpoint_main()
/ b* ~9 a6 ^7 t1 {5 i" b7 M4 Q
6 E$ X! S5 \. e4 h  (if (and (= 0 (getvar "TILEMODE"))
- ^" F# A2 U! k& D- y           (= 1 (getvar "CVPORT"))* ?7 f5 x# r4 c
      ). Z0 D+ ^- d. b5 s! X1 h2 z: U
    (princ "\n** Command not allowed in Paper space **")
/ B( m0 U* P& i7 a( L1 Z    (progn! U( x$ e6 A, N) [  g2 K" `
      (if (not (new_dialog "ddvpoint" dcl_id))
+ T' [0 s4 n% H) U4 L        (exit)5 ?) ]" B2 O9 _$ \- P
      )
9 F0 |1 p0 c. r% P- Z7 L; h( W: s      (setq ai_ddvp_vdir_base (ai_ddvp_fixzero (getvar "VIEWDIR"))& N$ k: `1 N; G; G' t: p
            ai_ddvp_wv (getvar "WORLDVIEW")1 Z( B6 g- d! I0 z4 S# Z
            ai_ddvp_init T
3 y6 m6 Z7 \  I4 v3 T      )
5 c4 a) J6 L1 L% w4 W9 w      (ai_ddvp_main)  [3 U4 [) O0 f5 Y8 k7 h( q/ w+ I
    )
" Y4 m; E" b5 b! L  )1 K- p; A$ {" g: F
)* B9 q$ |+ ^- X: ~0 d* S

* G4 q: s* x4 B) d$ t' m* L(princ "  DDVPOINT loaded.  ")
7 Q, j1 E  U# [* Q6 H(princ)/ m$ j; O! @% V8 u6 @' M
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0 N& ~+ k; V+ a& }& s
;============================= Tran Ngoc Thang =================================& t$ d: A4 o1 F6 Z5 k: ?& q
(defun c:zx () (command "zoom" ".5x"))
4 d, G8 k, P! p; Y* d4 l(defun c:zz () (command "zoom" "p"))1 I' T0 t) e  W
(defun c:za () (command "zoom" "a"))/ N8 E1 c% F' a( H* T
(defun c:zd () (command "zoom" "d"))
( W: J1 }+ F- K& [" S4 o5 V6 y(defun c:ze () (command "zoom" "e"))
, H8 N8 ^. ?+ ?- l' \" N9 _(defun c:zr () (command "zoom" "" ""))( q' j$ {  F- O& Q
(defun c:vv () (command "ucs" "v"))4 H0 t% H* O2 D8 X, N
(defun c:co () (ssget) (command "copy" "p" "" "m"))1 u* O# I6 i/ {2 O: ?: u) s/ [5 `
(defun c:c () (command "circle"))  b4 B/ v$ w7 @9 n
(defun c:rt () (command "rotate"))
( x" s) u7 _! O, R! B6 w(defun c:3q () (ssget) (command "_rotate3d" "ANGDIR" "value" pause (princ)))
# O& I2 A& L7 e6 b3 n7 Q7 X(defun c:30 () (ssget) (command "rotate" "p" "" pause "30"))9 [7 F0 M& F- w* {( r* Q, x
(defun c:-30 () (ssget) (command "rotate" "p" "" pause "-30"))
- z0 d; r* Q+ y, G# L3 A(defun c:45 () (ssget) (command "rotate" "p" "" pause "45"))" G2 n( i  i  @  z3 Z
(defun c:r5 () (ssget) (command "rotate" "p" "" pause "5"))
( ~0 [) r3 @/ l( L(defun c:60 () (ssget) (command "rotate" "p" "" pause "60")): \' O3 }+ o+ R6 {8 Q6 Z; l
(defun c:-60 () (ssget) (command "rotate" "p" "" pause "-60"))
9 }: U' a% Z8 l; i. }(defun c:90 () (ssget) (command "rotate" "p" "" pause "90"))/ |0 Z1 A0 u6 H* G
(defun c:180 () (ssget) (command "rotate" "p" "" pause "180"))
: e1 M, |) k: O5 G  p8 Z$ s4 J(defun c:-45 () (ssget) (command "rotate" "p" "" pause "-45"))
9 A4 R! ?4 q% O( a(defun c:-90 () (ssget) (command "rotate" "p" "" pause "-90"))
+ ?4 E5 V% R0 |, ]$ X( y(defun c:md () (ssget) (command "mirror" "p" "" pause pause "y"))
+ s4 k" ~- b5 g5 x! d7 n(defun c:fd () (command "find" "p" "" )(princ))(princ)2 L: N( g  J7 ^
/ D8 t8 }/ Z) b8 i
(defun c:VNI () (command "-style" "VNi-AUCHON" "VNI-vauchon" "225""1""0""n""n""n"))(princ)
$ [' r: Y; v0 Q+ G9 N0 D' z6 r1 i; C1 G! s0 Y1 L- e
(defun c:romantdim () (command "-style" "ROMANT-DIM" "romant,vnh.shx" "200""1""0""n""n""n"))(princ)
5 x- l% m" ~% h' {2 x(defun c:romantext () (command "-style" "ROMANT-TEXT" "romant,vnh.shx" "200""1""0""n""n""n"))(princ)
' V8 \  q/ W. o9 u  O(defun c:vnhelvthuong () (command "-style" "VNHELVLT-Thuong" "vnhelv,vnh.shx" "500""1""0""n""n""n"))(princ)
& V2 O' P# m  `4 b" h(defun c:vnhelvhoa () (command "-style" "VNHELVLT-Hoa" "vnhelvh,vnh.shx" "500""1""0""n""n""n"))(princ)
) p6 S0 O' V: u" B4 A) c. O(defun c:truc () (command "-style" "TRUC" "impact" "0""1""0""n""n""n"))" d* J/ X4 B$ E. Z9 @" K
(defun c:chu () (command "-style" "CAMBRIA" "Cambria" "200""1""0""n""n"))3 u. W& k* b3 M' {  u" l
(defun c:cot () (command "-style" "COTES" "Romand" """1""0""n""n"))
8 y( x# b. l8 k  L2 j, q
1 G8 n$ V4 i/ Q( Y( s* b0 K(defun c:an () (command "-style" ".AVANT" ".vnavant" "200""1""0""n""n"))
+ I$ F4 Y5 r7 ?; |* U(defun c:ah () (command "-style" ".AVANTH" ".vnavanth" "200""1""0""n""n"))
" ~7 n5 b% k+ B2 }(defun c:ha () (command "-style" ".ARIALH" ".vnarialh" "200""1""0""n""n"))  A- l; o- O; F6 z2 Y1 \9 U
(defun c:na () (command "-style" ".ARIALNARROWH" ".vnarial narrowh""1200""1""0""n""n"))
3 T  w, r, C" j0 C" o(defun c:vn () (command "-style" ".VNTIME" ".vntime" "200""1""0""n""n"))
- v  `; {4 z& U(defun c:vh () (command "-style" ".VNTIMEH" ".vntimeh" "200""1""0""n""n"))
, f9 a( V2 k8 L! t+ i' n! Y
0 A) i" k/ _6 W(defun c:ps () (command "SOUT" "CorelDraw-import-Photoshop" "W"))(princ);export the current view of a drawing as an EPS file
6 i2 E4 u% W! p! S3 S# o4 f2 E+ o( O! h. ?2 b; b$ |! V8 e( k
;free lisp by cadviet,cd2k44  F+ s! i; M/ ]; Q# t6 u7 q
;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830
" D$ t# u: z1 ?7 g(defun c:FTEXT (/ ent tstyle )
  m1 j$ W' H2 s8 L$ p: o7 y(command "undo" "be")
& t( ~; _( Q0 C2 q) B' ]9 Y& d(setq ent (entsel "\n Pick text :"))
; A% i+ w$ @1 x% l7 N7 M(setq TSTYLE (cdr (assoc 7 (entget (car ent))))): F, w% M7 C4 b* r9 z
(command "STYLE" TSTYLE "romant.shx,vnh.shx" "0" "1" "0" "N" "N" "n")# g% s, m( K( M' M# i& B5 w
(setvar "TEXTSTYLE" Tstyle)
$ q- R  V! X; J$ }' V/ E(command "undo" "end")# }1 L# F1 B/ I6 e. C
)
9 \6 p# u' R+ _;Cam on cadviet nhieu 27-11-2023 04h15p36s (thanks cadviet)* d- R- l0 R3 r+ O% c( q- ~  z% g, [+ O
5 i9 D" ?3 M2 L( j
;free lisp by cadviet,cd2k44
: E0 }6 L4 j9 g' I' M;link bai viet http://www.cadviet.com/forum/index.php?showtopic=538305 f) X# R( E  L' n# P
(defun c:Fvnh (/ ent tstyle )
; W) M+ H6 N( X9 O(command "undo" "be")
, r3 \* T$ g6 S  t8 U9 v(setq ent (entsel "\n Pick text :"))
3 C, W. o3 L, G(setq TSTYLE (cdr (assoc 7 (entget (car ent)))))
$ f4 x' |. |. F(command "STYLE" TSTYLE "vnhelvh.shx,vnh.shx" "0" "1" "0" "N" "N" "n")% v* V2 t5 e% D+ [6 r% \# T
(setvar "TEXTSTYLE" Tstyle)' ?2 [0 f( Y4 S
(command "undo" "end")
* \& V; V' G% m1 |0 m0 y7 \: ^" i), l- a! Y8 D8 S! z. n
( W4 Y1 @2 M3 g# [
;free lisp by cadviet,cd2k448 K4 d8 M' g  c1 @( \1 m' h
;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830
2 E% m% a: k* Y% z5 c% U(defun c:Chbg (/ ent tstyle )
5 h" c8 ^# U/ A$ u: E(command "undo" "be")( ^1 i$ J) |" ]# R
(setq ent (entsel "\n Pick text :"))
9 D) V, g. z" n* z( ^1 [(setq TSTYLE (cdr (assoc 7 (entget (car ent)))))2 K" |3 k. ]7 d* y/ j/ ~1 q
(command "STYLE" TSTYLE "chhbg.shx,vnh.shx" "0" "1" "0" "N" "N" "n")
5 _. @# ~! j% y- A) V4 D4 T(setvar "TEXTSTYLE" Tstyle)% ~- u! |' Y& l
(command "undo" "end")* N/ [( k' `4 v0 @: O4 c& S/ g
)1 K0 o- o& a. G7 T. Q$ u+ W- c
" B" C, m& t/ ?- t/ K7 B" j, p
;free lisp by cadviet,cd2k44
7 y! Z7 f' J0 I  t0 G9 |3 n, W;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830
$ D9 h0 f* l! |(defun c:Chsm (/ ent tstyle )8 @" s( [3 o- b
(command "undo" "be")  `6 V9 D, Q; }9 g, Q4 |
(setq ent (entsel "\n Pick text :"))
- ~5 H" ]7 w4 w% d9 Q7 a9 d(setq TSTYLE (cdr (assoc 7 (entget (car ent)))))" Q' L, {4 F* S7 }4 t9 Y4 V
(command "STYLE" TSTYLE "chhsml.shx,vnh.shx" "0" "1" "0" "N" "N" "n")
4 q2 i# c7 a4 D& ?- S) C(setvar "TEXTSTYLE" Tstyle)
) k6 @6 n& k( x8 l. w/ }& ?% K(command "undo" "end")) H* K" |3 r. N2 j. S& e( k
)
% l) |5 F+ |. A; A; T+ G: j& e1 W  W0 G* w7 z
;free lisp by cadviet,cd2k444 ]7 G/ _2 o, U% i# o! O
;link bai viet http://www.cadviet.com/forum/index.php?showtopic=53830
9 Z6 @: @/ u; _7 V+ G(defun c:Fttf (/ ent tstyle )3 _! ]% \* ^  X; ?- S! ?% K
(command "undo" "be")2 x7 _; B: [' f
(setq ent (entsel "\n Pick text :"))
% t/ E/ q# c& ~/ s(setq TSTYLE (cdr (assoc 7 (entget (car ent)))))
3 f$ H- K/ Y+ N* r, Y(command "STYLE" TSTYLE "Cambria.ttf" "0" "1" "0" "N" "N" "n")
  \; ], ?6 i9 S% u0 u% [(setvar "TEXTSTYLE" Tstyle)* C: g6 M/ s- _8 a) F6 s" `
(command "undo" "end")4 i( f1 w. J3 Z" t5 B: E1 b. `
); ]$ D, \: T1 g/ T; L/ |
; H, O0 L5 H) A4 I3 D( n
;;; ============================================
; f, w: u% ^3 ~; Z;;;
2 L! z) i: w1 I$ H; }, r;;;   LISP Creater Tao Duong Dan AUTOCAD2000
& n' w* Z5 X( H% O2 n( [& o;;;
. V7 w! R2 k$ m;;; ============================================# v9 |: h$ p9 {4 s

# C9 H, ?* t0 `! N0 `6 M8 P, R5 x;;; ============================================
: g4 \) d8 l0 @% F;;;* t; V" |9 K8 m% T' n% W4 T  _- H
;;;          CREATING FROM AUTOCAD2000. }7 x, Q! `* A% H  ?9 i$ Y3 m" S
;;;      Tran Ngoc Thang - Sinh 03-05-19762 E+ o' F/ f6 d5 Q- ~' S
;;; ============================================
. F4 O* d0 m3 N3 B' V
. }" b( V$ S8 I/ v(setvar "MEASUREMENT"1);Bien So SCALE Cua BHATCH
) }; B! f$ i' N5 T# b4 w# K;(setvar "DYNMODE"2);Bien So An Hien COMMAND LINE5 `5 l  g; H) e1 \* X4 y
;(setvar "VTENABLE"0);VTOPTIONS Enable Animation for Pan and Zoom. H, d7 h- O4 }! w% y. B- H; g" }
(setvar "INSUNITS"4)2 Y! j- Y5 h( ]0 D
(setvar "ANGBASE"0)  L+ j- z( h) O. i& R: A* k' D
(setvar "ANGDIR"0)
; a* L2 i  O+ O2 c+ g(setvar "AUNITS"0)
4 ^& u# }6 y# v1 H2 H; z" a* e(setvar "AUPREC"8)3 u$ v' Z( @6 c
(setvar "LUNITS"2)# O: z  v& J: b$ |2 d9 m' }
(setvar "LUPREC"8)* r- J8 N: b# M5 T
(setvar "ACADLSPASDOC"1) # _. ?9 O& N; J9 c' q
(setvar "pickbox"5)0 y# p. D5 ~" p* ?# i
(setvar "blipmode"0)
  t( F" {# _" ^9 |9 f. [4 T(setvar "mirrtext"0)
' K( r- L1 v" d(setvar "cursorsize"100)  R0 E- Z- x- I$ X
(setvar "ZOOMFACTOR"75)% A( {4 E" N# e4 Q' m; }
(setvar "LTSCALE" 10)
6 M+ N: v% m" l( X, v6 J1 T(setvar "lwunits"1)
+ Q1 Y, a- A" t+ X& d(setvar "DIMBLK" "Closed")8 ]- w: y  p" o( X
(setvar "DIMGAP"0.0693)* k" [+ s7 G4 v. {
(setvar "DIMASZ"0.20)- c# Y0 w4 q% m) a
(setvar "DIMCEN"0.2)4 R  g. g+ b+ @" _. W& {
(setvar "DIMDLI"0.1)/ a1 R( g& O. o+ H$ J& B. V, ^' `
(setvar "DIMEXE"0.0693)
: x" R/ q; L1 G/ |1 V% |(setvar "DIMEXO"0.25)$ C! n! a  M' E2 G
(setvar "DIMDEC"0)
. [! s" ?9 ]4 [; E(setvar "DIMTIX" 1)
  v) @1 K. o( Q(setvar "DIMTXT" 0.099)# s* l, g, o: ^/ {
(setvar "DIMCLRT" 7)4 [. Y" w$ ~( [+ _$ ]7 x
(setvar "DIMTVP" 1)
9 ?2 V2 b9 S; U5 C' Q( A(setvar "DIMJUST" 0)
9 _% R- e% ]6 e, C2 v(setvar "DIMTIH" 0)
" ^% `7 x1 S7 w( `(setvar "DIMTOFL" 1)
! p/ ^8 U. h* ^: |3 ]7 D* t: c9 Y(setvar "DIMSCALE" 1111.1111)  V0 p1 ]- p1 M
7 |0 `3 u$ G; M. T( ~

) c1 U2 u! X7 g. ^- `1 Z: ]' q" |4 R" g  h2 ^0 p
(defun c:zp ()  (command "'.zoom" "p")): ?; D" u0 [+ b) @
(defun c:zz ()  (command "'.zoom" "p"))/ g9 g4 E6 k' L7 f! _" j% W
(defun c:ze ()  (command "'.zoom" "e"))
2 ^6 i. v; Y, M8 F+ p# X(defun c:za ()  (command "'.zoom" "a"))
% e! n2 M0 S2 b9 T5 j* x(defun c:zd ()  (command "'.zoom" "d"))
! Z) E1 D/ D. q! N4 Y8 u  N# W(DEFUN C:ZZZ () (COMMAND "ZOOM" ".25X"))
& s9 i5 o: ~% ?9 Y$ j(DEFUN C:ZX  () (COMMAND "ZOOM" "2X"))) l* S$ G" T& j0 c5 K6 V
(defun c:de () (command "ddedit")(princ))& U1 }6 W; Q: Y5 w
(defun c:dda () (command "Dimaligned"))
( N7 E9 ~5 y. B(defun c:ddb () (command "Dimabaseline"))( O% ?- b* p9 R) o0 x
(defun c:ddc () (command "Dimcontinue"))5 V) _7 o" s4 z! A2 R
(defun c:dde () (command "Dimtedit"))
- K# n' G1 {, M% p/ ]" N# O(defun c:ddf () (command "Ddattdef"))
5 g" P5 [* Z6 f' g7 M: {, O# j(defun c:ddi () (command "Dimdiameter"))
2 y) o8 T9 \; [: a(defun c:ddl () (command "Dimlinear")); z2 S. b7 c2 b
(defun c:ddn () (command "Dimangular"))
, k2 ?5 |% m* k( \. {(defun c:ddo () (command "Dimordinate"))
8 Z) Q4 z/ ?% c# R1 w  P7 F- _(defun c:ddr () (command "Dimradius"))8 `  A% w; g- h/ B, O8 S
(defun c:dds () (command "Dimstyle"))* n2 z0 S$ t9 I  I1 W$ s1 f

$ J- D3 }7 c% x* j+ M: r(defun cU () (command "dim1" "up" "select" "exit" pause ))(princ)
& C& }' c! W' O% ~$ x" y/ c8 f(defun cH () (command "Dim1" "home" "select" "exit" pause))(princ)
: L& [' x4 a- {(defun c:UU () (command "dim1""update""all"))0 q+ ~0 T" Q- Y: ?% d$ Q* x0 o
(defun c:ded() (command "dim1""tedit")); B3 T# _+ B) b# `+ {) D  c. H
(defun c:da () (command "dim1""ali"))% u; |3 M- I& S4 \
(defun c:dll() (command "dim1""l"))( l" V% e0 M' n9 h7 t
(defun c:dan() (command "dim1""an"))& w$ N0 O4 A1 `" L: A9 K
(defun c:d1 () (command "dim1""ra"))
7 g# u' d9 e' @* U4 J; T4 {! l) \(defun c:n  () (command "dim1""new"))
/ }# i+ K+ c/ l- p/ C! y3 k. Y
7 J: N- J$ y/ m- X9 m) @(DEFUN CE  () (COMMAND "EDIT")): \" f8 P( @  n4 Y
(DEFUN CL  () (COMMAND "LINE"))
1 Q0 t* L: @1 x6 `. `( {(defun c:dd () (command "dist")(princ))
$ i, P1 g' l9 R6 e(defun c:w () (command "pedit" pause "w" "au")(princ))
7 L# Z5 W& ?( B& ?(defun c:pg  () (command "polygon" "polygon"))
5 R* V  h8 I% D7 w: q1 X; {(defun c:el  () (command "ellipse"))) {" g: ?- v8 M3 l$ P4 a. R
(defun c:xe  () (command "explode"))( j0 G, X, B2 M7 y7 d# i3 t' f
(defun c:eex  () (command "extrude"))
$ O# l9 n) g9 T/ X7 H9 g1 p(defun c:xg  () (command "xline""a"))
% `) ~& i. h& W3 u; ?! G(defun c:xh  () (command "xline""h")): G7 b8 E7 S' `# W
(defun c:xv  () (command "xline""v"))
9 _3 t1 f) D+ x1 d  ]
- \  ^$ _- g0 K1 N8 ?7 `0 w' `; n(defun cc () (command "osnap""cen")). e* A! n, `2 v  x
(defun cd () (command "osnap""nod"))7 N- u9 A  M- b# z
(defun ce () (command "osnap""end"))
7 ?9 P- [) `7 f1 {; Y* l(defun ci () (command "osnap""int"))- ?5 m7 m: \0 \
(defun cr () (command "osnap""per"))
' L, |+ Y  v) [! B# s(defun cn () (command "osnap""none"))# i6 u& r1 s. f' F
(defun cq () (command "osnap""qua"))
3 q1 y: r4 S! S3 \: ^! K0 H(defun cm () (command "osnap""mid"))# ]) o/ J2 L9 K8 d
(defun ct () (command "osnap""tan"))) {' t1 G1 r+ n# Y  c4 h' F  i
(defun cin () (command "osnap""ins"))
& B% O: Y' J* g" t(defun c:oa () (command "osnap""nea"))
7 |( V* U1 D$ s5 F5 C(defun c:ol () (command "osnap" "End,Mid,Cen,Node,Nea,Int,Perp,Qua")(princ))
, C6 `- E; z1 m# n2 Q, `;(defun c:du () (command "dim1" "up" "s" "pick" "other"))
6 V' p# C, p( l  n, q4 X8 d;(defun c:nn () (command "new" "y" ))& v* J# f/ A' r& o+ }8 |

  f* L, ]7 f3 S# \. W+ z" J(defun c:/ () (command "limits")): p3 ]* T5 Y1 H3 B  p9 J0 g
(defun c:`1 () (command "region"))
* ~' J. y0 i" x+ f(defun c:`2 () (command "subtract"))
  ?* Z3 i0 }) F# A6 C* Z# Q& }(defun c:`3 () (command "union"))
/ l- m9 R- l/ z$ i' y3 n) D0 [(defun c:`4 () (command "intersect"))
# E! Y- o5 E# A) A" {(defun c:`c () (command "cal"))+ X) N2 X' I( M# {9 [& z7 e
(defun c:`g () (command "olygon"))% p1 D4 O: g0 Z$ J0 E7 }: u
/ z$ T8 Y  a* i' H6 ]+ w
(defun c:lmi() (command "LIMMAX" pause "" "zoom" "all" )(princ))% U; d6 Q% |) w- W
(defun c:drt () (command "DRAWORDERCTL" pause "Integer" "" "" )(princ))
  h4 t+ m# j# i! g! p9 q0 Q& E# {(defun c:ip () (ssget) (command "print,_plot" ))(princ)
8 C6 W) Q' `0 o. ?. h% `# R. O3 O. f9 G$ X: K, p* e. o
(defun c:ddm () (command "ddlmodes" pause))
1 C0 n6 X, D5 `! C% t5 V4 P2 C) F
(defun c:sha () (command "shade" pause))
4 B$ }7 j; M6 e* r  c8 I  j: }& i. u5 v" I& p% K. G$ I, u
(defun c:sr1 () (command "surftab1" "p" "" pause))6 G+ \  a3 T, H( P+ N- w( q
(defun c:sr2 () (command "surftab2" "p" "" pause))
) \; ^: e- e9 b9 M- `0 L
: `# c' S$ S. b1 H% L/ z  r& o(defun c:ad () (command "audit""y"))
" H3 d7 Y' h, z" E5 N(defun c:q () (command "quit"))
$ @1 f. D" n! c1 u4 k+ u1 N+ d* i% S* n0 x
(defun c:30 () (ssget) (command "rotate" "p" "" pause "30"))6 E! Y; H( Q/ k8 b: L) a) F
(defun c:-30 () (ssget) (command "rotate" "p" "" pause "-30"))
) h5 y  f# V' b& v$ J% l(defun c:45 () (ssget) (command "rotate" "p" "" pause "45"))
  a- h% |) X5 H* m0 t2 ](defun c:-45 () (ssget) (command "rotate" "p" "" pause "-45"))" X4 v; M1 e9 [) c
(defun c:60 () (ssget) (command "rotate" "p" "" pause "60"))# y' @2 r3 }0 i6 F, o; ?4 b$ J! _
(defun c:-60 () (ssget) (command "rotate" "p" "" pause "-60"))
5 e4 G8 S1 T$ @) w5 f(defun c:90 () (ssget) (command "rotate" "p" "" pause "90"))
2 O5 j. i; u: k; `, I(defun c:-90 () (ssget) (command "rotate" "p" "" pause "-90"))3 V+ \1 J: M. l
(defun c:180 () (ssget) (command "rotate" "p" "" pause "180"))/ J! p9 `, y/ l" s, J$ D
1 b0 }1 o, H# z! T0 z
(defun c:u3 () (command "ucs""3"))2 ~; B4 }+ J# l7 d7 L
(defun c:ue () (command "ucs""o""end"))
: i( x  T' R$ Y; q" b! ~1 d! `(defun c:ui () (command "ucs""o""int"))
$ u2 L$ p( t- A) I& \+ b(defun c:um () (command "ucs""o""mid"))  X8 U# X# l& _. y. c
(defun c:uc () (command "ucs""o""cen"))
" k( P; n# Z5 Q4 z/ d$ ~(defun c:uq () (command "ucs""o""qua"))  o. ^  m6 A% E6 t$ ^/ j
(defun c:3s () (command "ucs""3")): Z8 {+ \" F4 M8 v& K4 ]
(defun c:sx () (command "ucs""s"))
% D4 W3 f4 m& z1 H7 {7 f2 B(defun c:sf () (command "ucs""o"))
$ o  {, I, W! W5 \6 x. a. @2 n# h& l(defun c:sz () (command "ucs""p"))2 P9 }" H) C: J3 e  {. t% R* L6 ]
(defun c:sr () (command "ucs""r"))  t& A3 z) \4 B  t& c+ ^* c# k& Y9 |
(defun c:sw () (command "ucs""w"))
/ o" ]; A9 c1 s& H2 c(defun c:fv () (command "ucs""v"))
4 @! X0 e) d2 K; p! C8 x. j0 D4 _4 h" K- T(defun c:ux () (command "ucs""x"))
1 c& i3 `' ^% [: j7 K0 \(defun c:uux () (command "ucs""x""90"))
( {" ^8 ?2 n0 W& u(defun c:xxu () (command "ucs""x""-90"))
( e/ F+ ]4 B# I, V+ Q5 B(defun c:uy () (command "ucs""y")): |; g" @4 }5 P+ X6 {
(defun c:uuy () (command "ucs""y""90"))
% d) S' {5 K- j* \3 p(defun c:yyu () (command "ucs""y""-90"))5 ?( `2 w* y5 g1 G) E$ p* @6 |- N
(defun c:uz () (command "ucs""z"))7 d0 K( x) y$ N/ R
(defun c:uuz () (command "ucs""z""90"))
# M. A5 A8 m$ F( L! S(defun c:zzu () (command "ucs""z""-90"))
' M5 r+ F, l/ ~- [  L" d! l( Y(defun c:uci () (command "ucsicon" "roperties" ))(princ)
% A& D0 m( I5 V(defun c:ucm () (command "ucsman" ))(princ)
. b  I1 Q3 p* l. F8 g& W* I) o* F
2 j! {8 h/ X7 O(defun c:sa () (command "vpoint""_non""-1,-1,1"))
+ I3 M- f; z6 a. o$ s/ R) Q(defun c:sd () (command "vpoint""_non""1,-1,1"))6 r4 c) B4 Z8 V: T7 w: G1 P
(defun c:se () (command "vpoint""_non""1,1,1"))! N; E- u2 }2 t# N1 p+ i* {
(defun c:sq () (command "vpoint""_non""-1,1,1"))4 O' m+ h: W: ~! U* M
(defun c:vc () (command "plan"""))4 h( h2 d, J9 G* @. U. @) f* E3 Z" l0 ?
(defun c:vd () (command "dview""all"))
0 c; e0 H, M: |9 \+ `; ~" y! C( w7 ^$ D* U; }  m1 `0 Y
(defun c:TT0 () (command "tilemode""0"))! @0 `9 B) a9 h6 g
(defun c:TT1 () (command "tilemode""1"))
1 ^# H$ \* l* O. n; V, J
2 w+ p  t. z& V" A(defun c:vt () (command "vpoint""_non""0,0,1"))
9 n& D2 \1 J2 q(defun c:vb () (command "vpoint""_non""0,0,-1"))1 P" D- S9 P) |' h8 o+ e  B
(defun c:vl () (command "vpoint""_non""-1,0,0"))$ \/ h% k- H5 B' m; E! _
(defun c:vr () (command "vpoint""_non""1,0,0"))
3 J: _2 \) s" W  q; q- S( X1 Y(defun c:vf () (command "vpoint""_non""0,-1,0"))
4 F! G+ e% u- d5 C% y7 y2 W4 q1 i$ R5 @(defun c:vk () (command "vpoint""_non""0,1,0"))
8 y) @* A0 ]# e. |7 m2 g  b: |9 b* M* P0 C  i
(DEFUN C:MM  () (COMMAND "MIRROR"))
2 n3 A3 }0 Q" h+ v/ F" z+ k7 d(DEFUN C:MP  () (COMMAND "MOVE" ""))% Q) P1 `* u7 E7 a9 q7 ]
( J' ?! w6 \: d9 n- {; |8 Q: w
(defun c:mee (/ a)
: a4 |# p$ z' K8 K- Q) y) {  (setq a (ssget))(command "move"a"""end"pause"end"))6 K9 Y# h% R& J' R
(defun c:mc (/ a)/ V6 Z6 I- `; c2 V" U
  (setq a (ssget))(command "move"a"""cen"pause"cen"))
: [: m3 W: @( y" h1 v7 A0 ~(defun c:cc (/ a)5 F& ]* c8 I' K1 V
  (setq a (ssget))(command "copy"a"""m"))
  f  |" Z" N$ M" W* ^1 E(defun c:ce (/ a)
7 W! s" b# v9 F- R5 Q* ~  (setq a (ssget))(command "copy"a"""m""end"pause"end"))- T: Z5 P" }9 }  c! }
(defun c:cn (/ a)
. z6 l$ j0 P# _% S: X6 {& i9 H  (setq a (ssget))(command "copy"a"""m""cen"pause"cen")). U; {0 y$ `& q
(defun c:tl ()(command "trim""l""")); F; u& C% s. D: B' C2 J
(defun c:tf (/ a)+ S$ m/ M7 ^0 Q& B/ n/ t7 N8 J
(setq a (ssget))(command "trim"a"""f"))5 K5 V: Q- X, h  t7 N# w
(defun c:el ()(command "extend""l"""))
% Q3 ~$ R, C$ o. v4 J. F" w4 k$ r(defun c:ef (/ a)7 d+ d" P4 }8 Z
  (setq a (ssget))(command "extend"a"""f"))
( ]5 E! D, O. Z  x
0 S) Y  h* V2 L7 O; U* Q$ ^) z, Q3 D9 j2 V0 h
(DEFUN C:110   ()(princ "\nChon doi tuong can offset ra 110.......") (COMMAND "offset" "110"))" J: u1 K3 |8 l& c" N7 R
(DEFUN C:220   ()(princ "\nChon doi tuong can offset ra 220.......")(COMMAND "offset" "220"))" m- F9 A& o' z- I
(DEFUN C:330   ()(princ "\nChon doi tuong can offset ra 330.......")(COMMAND "offset" "330"))
1 N5 X' j9 F( A2 @5 f) ?(DEFUN C:400   ()(princ "\nChon doi tuong can offset ra 400.......")(COMMAND "offset" "400"))2 }5 r9 Y( n  c% ]
(DEFUN C:55   ()(princ "\nChon doi tuong can offset ra 55.......") (COMMAND "offset" "55"))
- k) ^$ n  j/ @- s(DEFUN C:600   ()(princ "\nChon doi tuong can offset ra 600.......") (COMMAND "offset" "600"))
1 p1 P7 D. }( t* _(DEFUN C:700   ()(princ "\nChon doi tuong can offset ra 700.......") (COMMAND "offset" "700"))
. Z$ h. L# r% G4 G# W6 o5 _! Q(DEFUN C:800   ()(princ "\nChon doi tuong can offset ra 800.......") (COMMAND "offset" "800"))' ?1 T# M6 X4 `9 S8 Z0 `3 M
(DEFUN C:900   ()(princ "\nChon doi tuong can offset ra 900.......") (COMMAND "offset" "900"))6 y) U7 h5 }) x
(DEFUN C:1200   ()(princ "\nChon doi tuong can offset ra 1200.......") (COMMAND "offset" "1200"))
; v1 ]6 L7 X; Z(DEFUN C:1500   ()(princ "\nChon doi tuong can offset ra 1500.......") (COMMAND "offset" "1500"))
' `+ i/ D: B& P: R2 ^9 o5 l4 F  n(DEFUN C:1800   ()(princ "\nChon doi tuong can offset ra 1800.......") (COMMAND "offset" "1800"))$ h7 d% G& T5 ~6 y0 q
(DEFUN C:2400   ()(princ "\nChon doi tuong can offset ra 2400.......") (COMMAND "offset" "2400"))
# M9 g7 u+ T5 g+ Z. N# m(DEFUN C:3000   ()(princ "\nChon doi tuong can offset ra 3000.......") (COMMAND "offset" "3000"))
. Q4 _  m' R. Y- K/ }, W( u(DEFUN C:3600   ()(princ "\nChon doi tuong can offset ra 3600.......") (COMMAND "offset" "3600"))7 T0 D! ]9 Y# T8 A4 J* _2 m
(DEFUN C:4200   ()(princ "\nChon doi tuong can offset ra 4200.......") (COMMAND "offset" "4200"))
( F& O' Z1 T- d(DEFUN C:5000   ()(princ "\nChon doi tuong can offset ra 5000.......") (COMMAND "offset" "5000"))$ q+ D. ^1 a4 Y) [

  T& h2 R9 b* J8 L(defun c:mla () (command "-mledit""av"))
$ k# m: C) H- v& G) |: W9 Z(defun c:mlc () (command "-mledit""mc"))
9 I( I! M) W8 M% T, d(defun c:mld () (command "-mledit""dv"))
0 p5 O1 z1 a) @" j3 s, y# |" b: \(defun c:mle () (command "mline""end"pause"end"))
6 A' S% I4 H7 x7 f0 s(defun c:mli () (command "-mledit""ca""int"pause"int"))5 _+ l7 t" L# Q$ v; L* X
(defun c:mlj () (command "-mledit""cj"))3 I7 G% Y( L7 }
(defun c:mlt () (command "-mledit""mt"))
; I4 t" u, ~" C: c0 X(defun c:mlk () (command "-mledit""ca""end"pause"end"))% q$ m0 ?1 g, c$ P( {+ Y$ _7 b
(defun c:mlw () (command "-mledit""wa"))
* t4 K% W" p; x7 T, M5 T* B8 n1 F# ^# a' P
(DEFUN CCA () (COMMAND "DVIEW" "all" "" "CA"))
6 k' ?" O7 L) U! q  F, u% W(DEFUN CPA () (COMMAND "DVIEW" "all" "" "A")): j& m/ M! f$ a6 J% G* P, E- a! f
(DEFUN CPO () (COMMAND "DVIEW" "all" "" "O"))- ^" Q: a% Z  Q4 R5 r- t
(DEFUN CDD () (COMMAND "DVIEW" "all" "" "D")); ]5 I% D" {  x! x- g6 W& e# c
(DEFUN CZ  () (COMMAND "DVIEW" "all" "" "Z"))
( b6 C0 ]! v! \! _
7 \2 v2 l8 C0 B% c5 X- w* A5 M5 j(defun c:p0 () (command "pline""""w""0""0"))
; F* X! J, m( u6 |  B(defun c:ot  () (command "offset""t"))
: J; b% A$ [( q6 p(defun c:t  () (command "mtext"pause"j""bl""h"pause))
1 l# r: M, N& k/ Q, B(defun c:uo () (command "ucs""ob"pause))
. U1 z5 q" @( @& c5 k(defun c:f0 () (command "fillet""r""0"))- ^6 D$ |/ Y% b4 x" T
(defun c:fr () (command "fillet""r"))3 q! s/ s; F7 m, x* E0 T; J
# ]. M/ J$ r* v
;CHAMFER
; [. f& f6 z* p(defun c:cf () (command "chamfer"))  U! t/ g, D% {: U& k
(defun c:cfd () (command "chamfer" "d"))
8 U( e: r* Q! T5 r(defun c:cf0 () (command "chamfer" "d" "0" ""))
' @; S0 ~; @; W! v4 {5 C) N# t, i
;FILLET
9 w2 B- [2 q1 n5 }4 e% a- p(defun c:f () (command "fillet"))* Q* m" r  V1 a5 T- l0 P1 v
(defun c:fr () (command "fillet" "r"))4 n" f6 L  N& E7 o- e
(defun c:f0 () (command "fillet" "r" "0"))* m& z0 u& z- D( i+ G* j

8 U/ L1 m4 f8 ~/ y/ H# {) y" |(defun c:OO  () (command "oops"))
7 P8 ?" p  J" y8 x9 w6 z) y(defun c:dln  () (command "dimlinear"))# J' X' J: L, J6 s! N6 Q+ _) s
(defun c:dan  () (command "dimaligned"))8 q; o5 g0 B4 X' P' _6 N  Q( O
(defun c:ddc  () (command "dimcontinue"))
6 R# x" o" B5 A; `
& k/ E' b# G6 Y9 F+ r- F/ t(defun c:sc () (command "scale" "auto"))
% I, I" c3 y/ l' a(DEFUN C:XO  () (COMMAND "snapang"))
3 |/ V  z* ^( C/ W(defun c:cc (/ a)
$ e0 P. |* E" o9 ]% `  (setq a (ssget))(command "copy"a"""m"))1 n6 r# y: t0 H. N3 B

) l7 P( Y. k3 H(defun cJ (/ a)
, N) `9 Y$ o0 E! F. K  (setq a (ssget))(command "pedit"a"""j""all""y"))2 a! r. c# w0 `/ W5 y6 n) E& ]' _
(defun c:JJ (/ a)
0 D' S5 e& @; }* t; S4 q( w3 {  (setq a (ssget))(command "pedit"a"""j""y"))
; `3 x$ N9 G/ J* s! R  x1 R(defun c:TN (/ a)
- B4 A1 B& L: f0 [0 \0 [  (setq a (ssget))(command "change"a"""p""T"))2 T) f/ n( |) ?/ o# y1 c- m

8 c% |. u0 H1 p$ k9 S3 ^8 h- b- x, |. P2 B$ D, r6 H
;================== Tran Ngoc Thang - Sinh 03-05-1976 - Suu Tam - Tu nam 2000 - Hoc nam cuoi KTS . DHXD ====================
8 \' V7 S. w0 o" M; {$ s3 P" k; h
(defun C:IB ()(setvar"cmdecho"1)& z3 P$ H# F* C- w8 y
  (setq pt(cadr(entsel"\nSelect Block:")))* T1 S* D- N2 Y8 C. u
  (setq e1(ssget pt))
$ i8 Q  z& ^4 ^, S" h  (setq e2 (entget (ssname e1 0)))
8 e5 a% V/ [* H* U7 W  (setq blname (cdr(assoc 2 e2)))# X# f# n( [' m) \9 ]0 ^
  (setq oer *error* *error* err2)(command ".insert" blname))" w: |" M" G0 M# |1 V

$ R% s  I0 I* C% p0 u(defun c:II ()  ~2 `7 M% p+ K* ~. r: t! X
    (setvar "cmdecho" 0)
& r5 @( I$ |% u! }3 b    (setq olderr *error* *error* myerror)
& Z/ O) \. Y: h    (prompt "\nSelect objects: ")( e. J8 M% n0 p9 A
    (command "select" "au" pause); r4 W2 ^6 A1 p5 l+ t* i
    (setq sstxt (ssget "p")# F  \1 ]" k& C7 ]: V% u
          sslen (sslength sstxt)5 V; [" `. J/ D( G- q$ c5 |& `
          ctr 0% @, `0 y' B4 b4 e1 y! E' y- N
    )2 R- z+ C" H* n6 g! e7 N3 x
    (command ".undo" "mark")3 P3 U4 @! J: M  k  k( ]( H
    (while (< ctr sslen)
0 B! o2 Y! f+ I, \. z: Q6 y           (setq listxt (entget (ssname sstxt ctr))1 u# ]" B3 X. Z5 N# ^& ~1 Z
                 txttxt (cdr (assoc 1 listxt))3 i" ?/ d  M/ o* y5 L$ X* |4 B
                 enttxt (cdr (assoc 0 listxt))& ]& s% r$ G5 O/ H6 z1 z& {. |$ e
           )
- M4 \, p6 \+ Z9 l           (if (= enttxt "TEXT")! g# A" J% A$ A; d* G
               (progn: r, Q! e. g" Z+ H) F% e+ U( h8 w
                   (setq testxt (substr txttxt 1 3))
5 |% ~+ v) h/ e& C                   (if (or (= testxt "%%C") (= testxt "%%C"))% Y6 H% g! N4 m; M: {0 @
                       (setq newtxt (substr txttxt 4))
7 _  Y% I: s% Z7 T9 G$ ^; y                       (setq newtxt (strcat "%%C" txttxt))$ j! Z) L8 [* n' r8 E( u
                   )
' w, f1 X. `$ @) |7 h9 q  q                   (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))
5 A7 {3 X. C2 J0 @: D                   (entmod listxt)- w$ ?  t  `9 \3 i; Y. o
                )$ z% f# u8 ~3 T2 \" I  W# u. A  L
            )
0 I' {, O/ V, i0 O            (setq ctr (1+ ctr))" F" H1 f5 s; J& F
    )# E. N/ _& n$ W" F$ @( H1 u# u
    (setq *error* olderr)
. q$ ^5 S9 A, X; O* y    (setvar "cmdecho" 1)9 [" c  \" K# m0 {* f  `
    (princ)
, ~( O, \9 p4 W) N2 T)- X* _: ]2 Q+ D4 N, m

, K3 v& s- b* \2 w(defun cG ()
5 U* K+ R" [. \' u, H* S    (setvar "cmdecho" 0)
! i; s- M1 t" P, e, s    (setq olderr *error* *error* myerror)
7 S: n( A& Z+ s" W3 O6 f    (prompt "\nSelect objects: ")
& e9 }8 U5 r. r3 C8 U( t% J    (command "select" "au" pause), M; Y4 K  B  Z; J" u8 A% l
    (setq sstxt (ssget "p")( f% U9 m$ j5 I/ W
          sslen (sslength sstxt)
% q/ i/ }; M) g" e0 a          ctr 0% j' t2 w2 `& Z8 ^/ H
    )
2 `- o$ T0 g: r" a' F    (command ".undo" "mark")/ A) p) x1 E% z- x+ B& k
    (while (< ctr sslen)/ B5 \& G1 v. g
           (setq listxt (entget (ssname sstxt ctr))
9 T/ P9 K5 ^* q$ b+ K                 txttxt (cdr (assoc 1 listxt))
8 n+ l! C  f3 o& B8 V0 e+ l/ I                 enttxt (cdr (assoc 0 listxt))( j7 U* e3 @0 h) M
           )! u9 {$ B: m. x; }. X# S, A
           (if (= enttxt "TEXT")
9 P* O" F. }. c1 Z# j* N               (progn
6 F& S& Z( ]: l" y                   (setq testxt (substr txttxt 1 3))2 f3 G3 }' g. d$ O" c/ c) R
                   (if (or (= testxt "%%d") (= testxt "%%d"))
; @# P7 Z9 X# N5 C" Z) I4 e5 d                       (setq newtxt (substr txttxt 4))3 C+ @4 X/ b0 m( ^/ {0 w( L
                       (setq newtxt (strcat txttxt "%%dC" ))9 a, L' ]8 Y6 G6 N) c
                   )4 u' z* w  o0 _
                   (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))' S$ p$ ]# X6 h& D' I
                   (entmod listxt)' ~' L2 ^7 `; C2 }5 |% m2 T
                )
0 }( K* d. V+ p9 N            )
0 M5 v* n, z. V- B' I1 t            (setq ctr (1+ ctr))
( o4 R! A1 m& b- g. e5 Q; |; J3 S3 V    )
3 |  J! g0 m. L( _5 w    (setq *error* olderr)
) O" T& g3 w" D6 R0 ^  L    (setvar "cmdecho" 1)% M+ N5 _/ Y+ D# `* }
    (princ)2 T2 w) z8 \- y( b& U; L# ]
)
* v3 K  V, N) G2 o8 l2 q. A; ^* k6 F: z
2 o, @2 w5 b- c; @(defun cI (): V+ G7 Z# h5 u+ K9 f/ G( J
    (setvar "cmdecho" 0)  K$ [; T* p- G/ O0 `( |8 J* V
    (setq olderr *error* *error* myerror)
6 P" U6 b3 e1 M: b    (prompt "\nSelect objects: ")1 U: j, B% k( O( j8 \( Q, l8 Y
    (command "select" "au" pause)6 K  w' U7 g! N2 Y: H  @* Y) T
    (setq sstxt (ssget "p")% I& l' ]1 y! {$ i& P3 _$ p
          sslen (sslength sstxt)
1 L7 t$ r9 K3 N$ t' |5 q          ctr 02 @9 ]' l' Z) u+ v/ }; R: m& N  l
    )
+ W$ c0 N% L  }/ u    (command ".undo" "mark")  _  P1 x& t! B; r' E' E7 a
    (while (< ctr sslen)
3 }- b- F9 A! j/ K! i           (setq listxt (entget (ssname sstxt ctr))
, b2 p( m  H4 U0 |/ ^$ O+ y$ N                 txttxt (cdr (assoc 1 listxt))
' G- U* m4 s; M# g# \! m  T% J" W                 enttxt (cdr (assoc 0 listxt))
) Q2 [" T# S8 r8 ?0 M; f           )
5 F  B) b6 \; W( N4 c           (if (= enttxt "TEXT")
3 A* R) g: X. g1 X& h$ j& V; l               (progn" E# @8 @% M3 X7 a- W( j% c$ g6 m% A
                   (setq testxt (substr txttxt 1 3))% W/ c; M0 n: ?0 J+ m9 r4 a
                   (if (or (= testxt "%%p") (= testxt "%%p"))
+ \6 Q- r% C7 G2 @0 @5 U9 C                       (setq newtxt (substr txttxt 4))
  C: @+ N# |, I0 R                       (setq newtxt (strcat "%%p" txttxt))3 i, m+ q4 O. k$ x+ P6 R1 d
                   )! `: D+ Z- _4 Z' N' I
                   (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))6 q  w0 n  _  C3 F
                   (entmod listxt)
5 U$ a/ b- u1 ?  |! \                )7 E) @  U: [$ W: ]
            )7 c- G* L. V1 |3 H
            (setq ctr (1+ ctr))
" w) _$ N: [9 `3 b" C    )
; `1 r4 L, n" h+ z) w    (setq *error* olderr)' N: [" r7 |+ x& ?$ I: a
    (setvar "cmdecho" 1)
4 s" K) V6 m7 H1 e# ]7 L* {    (princ)
1 f" x& E! e3 t; h& F2 b" y! U% [)/ t( @8 P+ \2 h: T! H

1 o' V" r1 Z( M) p/ c+ s(Defun c:CB (/ a)
0 u0 t; P: D7 @% `0 z   (setq olderr *error* *error* myerror)
1 W: l. B" l0 n; _* A4 _   (setq ocmd (getvar "cmdecho"))
3 f4 \% p1 D6 |: ^1 q   (setq oblp (getvar "blipmode"))4 @1 {9 j4 U2 A$ w8 X) |; u
   (setvar "cmdecho" 0)  H4 W4 K- n" C. X
   (setq a (ssget)), Q: ]# j/ J* s) i; V  L3 x
   (command "CHPROP" a "" "C" "bylayer" "")
8 w9 @6 l8 u- v4 [   (setvar "cmdecho" ocmd)
; j# e5 P! e% V5 i, N   (setvar "blipmode" oblp)0 |( r5 k8 ^  w5 i/ d6 d
   (setq *error* olderr)' ?5 G4 }$ x/ i0 ]; X- \6 [
   (princ)5 g! H! \  }  B- f0 |$ r
)
8 Q. s' `9 j/ o8 i& R" K3 w+ P( X6 a8 k
(defun cCC (/ co43 obj23 la23)& a2 J. Y5 L7 Y
   (setvar "cmdecho" 0)
) r# ?* [- \0 ^' _$ g, C# S% Y   (setq co43 (getstring "\nNew color : "))$ `1 k2 O. t" V  v  L: M
   (setq obj23 (car (entsel "\nPick object on desired layer: ")))
& B7 d: l1 _) W- d" n- ]" G   (if obj23 (progn; Y2 N+ J) n) `; o# F
             (setq obj23 (entget obj23))
8 a& Y( o  x* Y6 ]2 c& X' }/ j             (setq la23 (cdr (assoc 8 obj23)))
4 V! k; {0 h8 k9 i% k+ J             (command "layer" "c" co43 la23 "")
, k# q& b% ~3 e, ~# q          )$ \* H$ A8 P. B
    )
$ Y" Y3 ^. d% ]3 x' o% Q1 h! T   (prompt (strcat  "\nLayer has changed..." la23))5 b: I: S; j1 @  C( n7 K7 h2 @
   (setvar "cmdecho" 1)
7 o0 O6 ]4 f8 U   (princ)
; |" G' e0 A+ L! }, J)  
% s3 ?' m0 d+ B, r- C1 ?! q! ?
  s# |7 y* t& ?2 O8 ~; ]2 J(Defun c:RP (/ a)' Y0 [0 T0 l7 n, n& X& m
   (setq olderr *error* *error* myerror)
+ [3 u0 p3 V/ Q   (setq ocmd (getvar "cmdecho"))
$ D& B( {$ }3 x" O1 s6 p; [) W   (setq oblp (getvar "blipmode"))
6 d8 ?* z! Z9 r% N% T7 |% q2 g   (setvar "cmdecho" 0)
; n* R" Q2 p$ t6 k( a) Q" e" a. {   (prompt (strcat "\nUSE: Delete object(s) belonging to"
4 `5 P2 ]7 Q2 O2 C                   " the layer of the entity picked...!"))9 N3 [1 E: W- G4 Y
   (setq a (entsel "\nPick the entity with the desired layer to delete: "))
7 t0 Y$ f4 c+ l& G0 p8 ]9 z   (if (/= a nil)( p) S# _* ]3 B1 y5 j. e+ }( t. j
      (progn (setq a (cdr (assoc 8 (entget (car a )))))
, ^" b1 r. G+ l6 _      (command "Erase" (ssget "x" (cons (cons 8 (eval a)) tempword)) ""))
) L1 O% J, w7 r( v* W; d$ i+ A- V      (prompt "\nNo entity selected!"))0 Y; W* B- Q" O' x
   (setvar "cmdecho" ocmd)5 z2 {+ ~$ s7 D6 |
   (setvar "blipmode" oblp)
7 @2 I  i2 o4 H8 V7 g" U6 s' v9 g   (setq *error* olderr)
7 {, c5 v( C, M! o6 e1 R   (princ)
% X1 N7 ]# Z( @# I0 D)% f: U4 \4 o8 `
4 i  E+ D! c+ O  t) x% L- }) [
(DEFUN C:WL(/ SSET NET SSL M)9 P  b# D! m7 _" T8 k
   (PRINC "\nSelect lines :")% D$ c: C0 j% a2 U
   (SETQ SSET (SSGET))" @4 Q3 C  }5 E6 M; `! J0 l
   (IF (/= NIL SSET) (PROGN
! u6 D2 A" O* \$ r/ b# n  j& J: a" r   (SETQ SSL (SSLENGTH SSET))1 M, R; l0 \( `7 g% ]4 A1 Y: }
   (INITGET 4)
' g  S4 F, H0 K. e: L   (SETQ NET (GETREAL "New width : "))
% i% {& @8 i0 m! t, R+ t   (IF (/= NIL NET)
4 }' I9 [4 Y  _" A    (WHILE (> SSL 0)8 U% a' b5 u  K5 \: l+ s' m! [
      (SETQ M (SSNAME SSET (SETQ SSL (- SSL 1)) ))" T8 ^& t$ R. d/ X
      (IF (= (CDR (ASSOC '0 (ENTGET M))) "LINE") * I# ]7 |) g! A7 K0 z$ |
          (COMMAND "EDIT" M "Y" "W" NET "") 3 @+ g: o! t! J% m
      )
$ M0 @) l( P7 n6 `# y$ h    )
) O& U: n1 o& l4 o% e0 _) u+ i& W+ u+ t   )))/ U1 T" n3 @8 h* L* w/ c: q
   (PRINC)
& o" M1 b) J# l* ^( n6 V)
# b, j+ M- I  B! V4 c/ v" a* i6 t5 J5 V, w3 A/ V
(defun C:MML ()
2 ]. H/ F* T, b7 o2 {, y. q% e7 `7 Y  (princ "\nSelect objects to move to another Layer.")
4 d4 l/ g3 o; L2 Q' K  (setq ss (ssget))
0 i0 \. g8 `, k$ B' r4 }4 d  (SETQ UL1(GETSTRING "\nLayer to move entities to : "))# O; v5 o7 E; Y. x% Y: d; Y9 F
  (setq counter 0)
5 |1 b; ]7 X* E3 j  (prompt "Moving to layer.....")(princ ul1)2 t# l9 S' F. g5 a5 G
  (setq e (ssname ss counter))
- ?' W1 G2 ]: n6 @  (setq l (cdr (assoc 8 (entget e))))
- w+ V1 z6 V  v/ f  (setq S (ssget "X" (list (cons 8 l))))
& i' S2 o6 X7 T5 m% D3 X9 j" e3 Z  (command "CHANGE" ss "" "" "LA" UL1 "")& @  t/ v0 q$ A) Y* S3 |
  (setq counter (+ counter 1))+ C% I: r% K% ~, v9 V8 C
(princ)2 h# P7 H8 \2 Z, d- F
)
1 u  j& O. l6 @) B4 v
5 I  N. n" Z& v+ @: G  L;;; ================================ GHI CHU ============================1 B. Q! C0 G/ Y! D; T) }! l* A
;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========" e4 k; m/ s/ r. q
;;; =======================Thuong Dung Font Romant.vnh===================
% O9 q. ~; H- i- G7 r8 [;;;==================== Tran Ngoc Thang - Sinh 03-05-1976================$ h) S: b$ @' {6 s( ?0 `6 m2 `

, S! \' p+ n# o  ](defun c:RS (/ pta ptb ptc ptd X Y X1 Y1 rmsz pl1)
+ ?3 H7 K/ v8 V* \3 y  (setq oer *error* *error* err2)# G( P/ Y2 K2 _# r0 G9 q) K
  (PROMPT "\n(VNI-TTF)(D)ining room. (S)torage. c(L)oset. (C)onference. (O)ffice. (K)itchen. (B)ath. (M)aster Bedroom. "); ~& E& ]3 ~, q) K% w
  (SETQ Cpt(GETSTRING "\n (RomanT.vnh)(DD).(SS).(LL).(CC).(OW).(KK).(BB).(MM). (Vni-SHX)(oD).(oS).(oL).(oC).(oww).(oK).(oB).(oM)."))
/ y) @- ?  G8 ^7 o/ `  (IF(OR(= Cpt "K")(= cpt "k"))(SETQ CPT ' "Nhaø Beáp"))
* q+ y# E+ q) j- t  (IF(OR(= cpt "B")(= cpt "b"))(SETQ CPT ' "Phoøng Veä Sinh"))# l$ k+ p7 L( A9 }3 U
  (IF(OR(= cpt "C")(= cpt "c"))(SETQ CPT ' "Phoøng Hoïp"))
( F) o/ d& U& F  z$ w  (IF(OR(= cpt "O")(= cpt "o"))(SETQ CPT ' "Phoøng Laøm Vieäc"))2 v7 X8 S: A, B8 \+ @4 e3 B/ p
  (IF(OR(= cpt "M")(= cpt "m"))(SETQ CPT ' "Phoøng Nguû"))4 v# A# ~& Z' E! i
  (IF(OR(= cpt "D")(= cpt "d"))(SETQ CPT ' "Phoøng Beáp + AÊn"))
+ A; U3 D' w1 l7 M  (IF(OR(= cpt "S")(= cpt "s"))(SETQ CPT ' "Nhaø Kho")); n, r  n' S- d/ i% w, a" A! q
  (IF(OR(= cpt "L")(= cpt "l"))(SETQ CPT ' "Phoøng Ñeå Ñoà"))
6 n; B& W6 Z' y, p% z
0 h; _) V; I& m6 e  (IF(OR(= Cpt "KK")(= cpt "kk"))(SETQ CPT ' "Nhµ BÕp"))
5 ^# S. i+ W" N  (IF(OR(= cpt "BB")(= cpt "bb"))(SETQ CPT ' "Phßng VÖ Sinh"))
! t1 l  W6 T( J0 `" C" O; @  (IF(OR(= cpt "CC")(= cpt "cc"))(SETQ CPT ' "Phßng Häp"))
9 t" T1 B$ H: c" a1 j/ v, U  (IF(OR(= cpt "OW")(= cpt "ow"))(SETQ CPT ' "Phßng Lµm ViÖc"))" n, {' v9 ?  o5 U* d9 @7 i
  (IF(OR(= cpt "MM")(= cpt "mm"))(SETQ CPT ' "Phßng Ngñ"))1 x$ A2 ?( l- ?( C! t# z% C
  (IF(OR(= cpt "DD")(= cpt "dd"))(SETQ CPT ' "Phßng BÕp-¡n"))
- V' Z& q9 J3 L1 _: t  (IF(OR(= cpt "SS")(= cpt "ss"))(SETQ CPT ' "Nhµ Kho"))) u; u' c/ a. }, [9 }5 R( {* c5 b
  (IF(OR(= cpt "LL")(= cpt "ll"))(SETQ CPT ' "Phßng §Ó §å"))# m9 U4 u5 m- ?3 `5 J& L# Z" a( a

. Z  e9 @) i" ]* a  (IF(OR(= Cpt "oK")(= cpt "ok"))(SETQ CPT '"NHA/F BE/M/SP"))
; ~: R. q$ h/ Z/ X9 l' x  (IF(OR(= cpt "oB")(= cpt "ob"))(SETQ CPT '"PHO/F/NG TA/W/SM"))
$ v! {5 q( r0 O# H* `1 @2 f% Z  (IF(OR(= cpt "oC")(= cpt "oc"))(SETQ CPT '"PHO/FNG HO/JP"))0 _2 y+ ~8 z, _( c) p& x# i4 |
  (IF(OR(= cpt "oww")(= cpt "oww"))(SETQ CPT '"P.LA/FM VI/E/M/JC"))' K7 t6 n$ H5 y  a" l! }
  (IF(OR(= cpt "oM")(= cpt "om"))(SETQ CPT '"PHO/FNG NGU/R"))+ [! q* {/ a9 @" m# b% v7 v- \
  (IF(OR(= cpt "oD")(= cpt "od"))(SETQ CPT '"PHO/FNG A/WN"))7 v2 f6 ~& Z! e% A) Q" ]
  (IF(OR(= cpt "oS")(= cpt "os"))(SETQ CPT '"NHA/F KHO"))4 H0 U+ v  {0 D: q5 V4 M/ P+ |
  (IF(OR(= cpt "oL")(= cpt "ol"))(SETQ CPT '"PHO/FNG /DO/M/F"))- F1 [& C% C9 s/ M: @1 @/ z" }
(setq pta (getpoint# g3 G8 J9 M- Q! p
    "\nPick first corner. : "))
+ ~8 z3 ]% w# U3 W4 e3 w  (setq ptb (getcorner pta
8 J: p; {& w' C. V) y7 T: g. a8 ?7 E    "\nPick second corner. : "))8 q0 ?8 R  ?9 b0 f8 I3 i, L
  (setq ptc (list (car ptb)(cadr pta)))
+ ?4 u( f8 Y: a8 @  (setq ptd (list (car pta)(cadr ptb)))9 g# _- b* ?) k0 L3 b5 ~1 d2 G1 @* k1 b
  (setq ang (angle pta ptb))/ a; @/ w) Q* v9 C6 N
  (setq d1 (/(distance pta ptb) 2))( T9 t7 \3 h( O1 {- R0 o8 G& C2 C7 S
  (setq cp (polar pta (- ang (dtr 0)) d1))# e) c# H/ y! J
  (setq X (distance pta ptc))
) f5 Y& m  z' G0 w+ {  (setq Y (distance pta ptd))' i% I8 d6 p' p1 K( v0 Y3 O
  (setq X1 (rtos x 2 1))
) a& N! H+ A. Q& ~# R7 c0 m. B  (setq Y1 (rtos y 2 1))) N+ X" W7 |7 g  V- C
  (setq rmsz (strcat "(" X1 " x " Y1 ")"))
' N/ t. N4 i0 k2 |! a" {* D9 _  (command "TEXT" "c" cp "0" CPT "ROMANT-TEXT" "" rmsz))+ @6 U* p; i, z5 g! z0 p* f+ b% z
  (defun dtr (angg)7 J5 B  s! L# B- c2 Q& @
  (* pi (/ angg 180.0)))/ j2 T1 f2 Z3 y
. T' g: ]1 Q# d7 A! }9 p
(defun c:ZS (/ pta ptb rmsz pl1)0 F& a. @9 z  x
  (setq oer *error* *error* err2): N, I6 O; a' f" F4 H9 J3 H
  (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 o3 D" ^! ?5 ~; q, n6 a1 s9 M
  (SETQ Cpt(GETSTRING "\n (RomanT.Vnh)(LL)floorplan.(EE)elevation.(SS)section.(BM)planFoundation.(CM)foundation.(KC)Structure.(PP)perspective."))
& l7 v* y8 k8 J6 r
) m# N( O2 j& X  (IF(OR(= Cpt "LL")(= cpt "ll"))(SETQ CPT ' "MÆt B»ng TÇng 1 : TØ LÖ - 1:100"))/ `# J% e! A" U+ t8 z7 \( f
  (IF(OR(= cpt "EE")(= cpt "ee"))(SETQ CPT ' "MÆt §øng Trôc ?-? : TØ LÖ - 1:100"))7 X$ V, G; t' h% h9 t% o% q
  (IF(OR(= cpt "SS")(= cpt "ss"))(SETQ CPT ' "MÆt C¾t A-A : TØ LÖ - 1:100"))/ ?+ s$ u9 a7 p% D0 |) A/ t
  (IF(OR(= cpt "BM")(= cpt "bm"))(SETQ CPT ' "MÆt B»ng Mãng : TØ LÖ - 1 : 100"))0 r1 \7 `# Z6 p6 K+ T9 H
  (IF(OR(= cpt "CM")(= cpt "cm"))(SETQ CPT ' "MÆt C¾t Mãng : TØ LÖ - 1 : 100"))) h, t) I1 I: d$ r
  (IF(OR(= cpt "KC")(= cpt "kc"))(SETQ CPT ' "KÕt CÊu Khung Däc Nhµ : TØ LÖ - 1 : 100"))
( _2 @8 M4 e4 ]  f  (IF(OR(= cpt "PP")(= cpt "pp"))(SETQ CPT ' "Phèi C¶nh Mét Gãc Nh×n"))
# H. I5 r0 W2 o# L1 }0 l' \" L2 K, [- X( q% t% I0 E1 _
  (IF(OR(= Cpt "oL")(= cpt "ol"))(SETQ CPT ' "MAËT BAÈNG TAÀNG 1 : TÆ LEÄ - 1:100"))0 p% G6 {  o' L0 X
  (IF(OR(= cpt "oE")(= cpt "oe"))(SETQ CPT ' "MAËT ÑÖÙNG TRUÏC ?-? : TÆ LEÄ - 1:100")): Q% F  j5 k/ y1 F$ u
  (IF(OR(= cpt "oS")(= cpt "os"))(SETQ CPT ' "MAËT CAÉT A-A : TÆ LEÄ - 1:100"))
+ z# l1 {$ b, x/ R) Z  (IF(OR(= cpt "oM")(= cpt "om"))(SETQ CPT ' "MAËT BAÈNG MOÙNG : TÆ LEÄ - 1 : 100"))
+ H9 C+ \) \( e* Y+ k' ^. s) d5 I  (IF(OR(= cpt "oC")(= cpt "oc"))(SETQ CPT ' "MAËT CAÉT MOÙNG : TÆ LEÄ - 1 : 100"))
. Q; `+ n. r# @) ^  (IF(OR(= cpt "oK")(= cpt "ok"))(SETQ CPT ' "KEÁT CAÁU KHUNG DOÏC NHAØ : TÆ LEÄ - 1 : 100"))
+ }7 x; f1 T% I5 S/ b  (IF(OR(= cpt "oP")(= cpt "op"))(SETQ CPT ' "PHOÁI CAÛNH MOÄT GOÙC NHÌN"))& n+ P9 v+ L6 ~3 ~0 s' S

' T7 k( `7 V5 m1 h1 \  (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"))5 [6 V5 r3 ]/ x# w6 r
  (IF(OR(= cpt "E")(= cpt "e"))(SETQ CPT '"MA/W/JT /D/}/SNG TRU/JC ?-? : TI/R LE/M/J - 1:100"))
5 m: a+ p8 e% f/ s& @/ n  (IF(OR(= cpt "S")(= cpt "s"))(SETQ CPT '"MA/W/JT CA/W/ST A-A TI/R : LE/M/J - 1:100"))
; q: J" f5 L# K2 N5 ], H  (IF(OR(= Cpt "M")(= cpt "m"))(SETQ CPT '"MA/W/JT BA/W/FNG MO/SNG : TI/R LE/M/J - 1:100"))" L/ e/ X' w+ R8 c, K
  (IF(OR(= Cpt "C")(= cpt "c"))(SETQ CPT '"MA/W/JT CA/W/ST MO/SNG : TI/R LE/M/J - 1:100"))
( f* o& d2 X2 z  (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"))
  D" O' u* p" ^. i2 K% {6 j6 O  (IF(OR(= cpt "P")(= cpt "p"))(SETQ CPT '"PHO/M/SI CA/R/NH MO/M/JT GO/SC NHI/FN"))$ J# A9 g4 D& a! ~$ t
(setq pta (getpoint' n) m) U) i+ f- F: ~* `* a
    "\nPick first corner. : "))
$ f) ^- T: i0 L: I3 m  (setq ptb (getcorner pta/ L6 b! j& r, k3 S0 X! P' @! `, v
    "\nPick second corner. : "))
% d6 A- _7 d& ]: `  (setq ptc (list (car ptb)(cadr pta)))  @' l! P) p$ p( ?# N0 u* j
  (setq ptd (list (car pta)(cadr ptb)))
0 O7 B- F" }# j  m4 w  (setq ang (angle pta ptb))* G$ _( r/ o! x  I5 l
  (setq d1 (/(distance pta ptb) 2))
# [( ~# k9 c* i, A# g  (setq cp (polar pta (- ang (dtr 0)) d1))0 O! g4 ^3 R/ P
  (command "TEXT" "c" cp "0" CPT "ROMANT-TEXT" "" rmsz))
: L- h# ]6 b6 \2 S* p  (defun dtr (angg)
6 m/ s9 _5 g. w: ?# `4 X  (* pi (/ angg 180.0))). f2 x0 I7 Q5 s/ s8 l1 G9 P* X
9 C3 p6 i! ]5 ^/ w8 ]% b
;;; ================================ GHI CHU ============================; g9 x# t% k! E
;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========5 r5 K9 P- i5 {  {- F0 ?
;;; =======================Thuong Dung Font Romant.vnh===================+ t" K9 S- a+ {/ K% e
;;;==================== Tran Ngoc Thang - Sinh 03-05-1976================
3 k7 [% c5 d* u, d/ J+ f3 @, {! h# N+ X. }3 e$ T) W  ~. _
(defun c:RRS (/ pta ptb ptc ptd X Y X1 Y1 rmsz pl1)5 A  B- u% L9 {4 o. Q! J( u
  (setq oer *error* *error* err2)
  G9 G- L" }5 f  (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. ")+ [1 L/ e4 o( `9 `2 G, D: P+ F0 p. x
  (SETQ Cpt(GETSTRING "\n(RomanT.Vnh)(M)aster Bedroom. (DD). (SS). (LL). (CC). (OO). (KK). (BB). (MM). "))1 _3 s- ]; b2 I* k& s
  (IF(OR(= Cpt "K")(= cpt "k"))(SETQ CPT ' "Nhaø Beáp"))
0 {! d: P) [( e& a  (IF(OR(= cpt "B")(= cpt "b"))(SETQ CPT ' "Phoøng Veä Sinh"))! O( Q7 W+ s; J2 |. V0 Z
  (IF(OR(= cpt "C")(= cpt "c"))(SETQ CPT ' "Phoøng Hoïp"))8 P  q; o# A  g/ J
  (IF(OR(= cpt "O")(= cpt "o"))(SETQ CPT ' "Phoøng Laøm Vieäc"))8 f7 T. t4 F, Y4 [
  (IF(OR(= cpt "M")(= cpt "m"))(SETQ CPT ' "Phoøng Nguû"))
& o/ @- K& Z$ b4 a# G3 S  (IF(OR(= cpt "D")(= cpt "d"))(SETQ CPT ' "Phoøng Beáp + AÊn")): ~, C" D$ x* J
  (IF(OR(= cpt "S")(= cpt "s"))(SETQ CPT ' "Nhaø Kho"))" T( L  Z( u$ o! e: q
  (IF(OR(= cpt "L")(= cpt "l"))(SETQ CPT ' "Phoøng Ñeå Ñoà"))
* C0 Z6 @1 |- f
8 D8 ]5 Y7 B, B  H0 ~  (IF(OR(= Cpt "KK")(= cpt "kk"))(SETQ CPT ' "Nhµ BÕp")), h2 A# \: q/ p' T& G6 {
  (IF(OR(= cpt "BB")(= cpt "bb"))(SETQ CPT ' "Phßng VÖ Sinh"))
+ w7 p( V1 G3 E  (IF(OR(= cpt "CC")(= cpt "cc"))(SETQ CPT ' "Phßng Häp"))
. l8 \7 k- [" v  (IF(OR(= cpt "OO")(= cpt "oo"))(SETQ CPT ' "Phßng Lµm ViÖc"))
# y- |2 |; i9 W/ [: M- ~! P) o  (IF(OR(= cpt "MM")(= cpt "mm"))(SETQ CPT ' "Phßng Ngñ"))4 M% O6 S2 J0 v" B  v2 l" {, F
  (IF(OR(= cpt "DD")(= cpt "dd"))(SETQ CPT ' "Phßng BÕp-¡n")). N2 Y5 C; f: E: K$ ^* U0 x1 t
  (IF(OR(= cpt "SS")(= cpt "ss"))(SETQ CPT ' "Nhµ Kho")), Z9 f) @" h* S
  (IF(OR(= cpt "LL")(= cpt "ll"))(SETQ CPT ' "Phßng §Ó §å"))
$ q2 b2 R4 N+ v- o. I# f: z+ M+ h2 J3 b
  (IF(OR(= Cpt "oK")(= cpt "ok"))(SETQ CPT '"NHA/F BE/M/SP"))
; H, T$ M0 Y% ^' b/ z  (IF(OR(= cpt "oB")(= cpt "ob"))(SETQ CPT '"PHO/F/NG TA/W/SM"))4 c) C$ i" p- |& x: H
  (IF(OR(= cpt "oC")(= cpt "oc"))(SETQ CPT '"PHO/FNG HO/JP"))2 Y3 u' H) k3 P( {+ b
  (IF(OR(= cpt "oww")(= cpt "oww"))(SETQ CPT '"P.LA/FM VI/E/M/JC"))
0 t  d( t1 p9 j0 G, g# S  (IF(OR(= cpt "oM")(= cpt "om"))(SETQ CPT '"PHO/FNG NGU/R"))
; L+ v6 R+ E' {. B5 R7 E& `( B% l: G  (IF(OR(= cpt "oD")(= cpt "od"))(SETQ CPT '"PHO/FNG A/WN"))
& [) h: i: u8 g' d" E- D- i  (IF(OR(= cpt "oS")(= cpt "os"))(SETQ CPT '"NHA/F KHO"))
8 T8 K# V  l6 k! G- I0 ~  (IF(OR(= cpt "oL")(= cpt "ol"))(SETQ CPT '"PHO/FNG /DO/M/F"))8 U- b. M: E4 v! |+ k

# \5 n# j$ \4 F$ \ (setq pta (getpoint
% N/ U/ D3 g: m  ?+ S$ L3 F' v- O    "\nPick first corner. : "))* B/ Y) x+ \: a* G: \# \- I& t
  (setq ptb (getcorner pta/ X0 Y8 Z* P9 t3 q) }5 u6 _; s1 t
    "\nPick second corner. : "))
9 Z* {9 F6 c7 S' ^* j% q7 B, W  (setq ptc (list (car ptb)(cadr pta)))
/ Y% d6 d& `% A4 s  (setq ptd (list (car pta)(cadr ptb)))
$ s2 U8 U6 }. L* h2 W" T# ^( _  (setq ang (angle pta ptb)). i/ ^  W. Q2 ]' H& V
  (setq d1 (/(distance pta ptb) 2))
- C8 ~( ^  F) z* R  (setq cp (polar pta (- ang (dtr 0)) d1)): ~# M1 {+ k% d1 b
  (setq X (distance pta ptc))
! M/ K8 g! E6 x, t" x* M  (setq Y (distance pta ptd)): T6 o2 R5 |3 C5 C: K7 f' F
  (setq X1 (rtos x 2 1))+ ]4 u& p  M, l8 i8 ~7 M
  (setq Y1 (rtos y 2 1))0 U; ?1 n* @; [' ^) W
  (setq rmsz (strcat "(" X1 " x " Y1 ")"))# Z  a, P8 g; k, u: i; Q) g
  (command "TEXT" "c" cp "0" CPT "text" "" rmsz))
5 m% E; f  }6 j  n0 p& e  (defun dtr (angg)( g. R) s. B- Y' c! M
  (* pi (/ angg 180.0)))4 g) t3 u3 }, f; T+ }, u

/ b# o; J1 ^& e;;; ================================ GHI CHU ============================
# Q' K5 y/ Q% [: A) y, R) Q$ O" };;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========; O5 {- {2 z" R5 _) U; W
;;; =======================Thuong Dung Font Romant.vnh===================
* v" D* e8 I2 D+ B! e0 |8 W1 W% a: y9 ^, Q
(defun c:GS (/ a b c d). j1 [- K9 A+ ^7 H* R9 b
  (graphscr)7 d+ q- F8 {7 _" Y
  (prompt "\nSelect text to set style....")
# N4 `7 h; l3 x8 t- z1 n9 _  (setq a (entsel))
; Q: P' |# ^- @. p! o8 `  (setq b (entget (car a))); H* E& m5 }  q+ b0 f" ?  S% I
  (setq c (cdr (assoc 7 b)))
# x) ^) d" W# ?1 k" P# A  (setq d (cdr (assoc 40 b)))- W% l, }% g4 x* a9 F0 P
  (command "style" c "" d "" "" "" ""))  l7 D% o3 X5 s0 s5 d) m
  (princ "\nType GS to set text style.")
) U8 ?4 K' C% n3 T) n# i3 x# B+ ~* M6 F
(defun c:RC (/ olderr ocmd oblp pt1 pt2 pt3 pt4 l w)
  Q4 M( }' i% M  H) B  (setq olderr *error* *error* myerror)
) a3 u7 u1 m( ]% N( H; H, N, s  (setq ocmd (getvar "cmdecho"))6 p& U, `$ B* D0 a! s/ \% @- O
  (setq oblp (getvar "blipmode"))
1 [0 a/ ~/ s0 U6 E  (setvar "cmdecho" 0)
; q8 l( i. v$ ~2 O" i  j4 Q% _6 N  (initget 1)                         ;3D point can't be null9 ~1 M5 d$ X- e+ z$ ]
  (Setq pt1 (getpoint (strcat "\nCorner of rectangle or square: ")))
7 t5 B* W1 t8 J4 X  (setvar "ORTHOMODE" 1)
' _0 w  E3 ]' W* R  ^! a7 Y  (initget 7)                         ;Length can't be 0, neg, or null
! X/ d/ k3 A/ c" z  (Setq l (getdist pt1 "\nLength: ")); V4 D/ l9 x$ G: d) V
  (Setq pt2 (list (+ (car pt1) l) (cadr pt1) (caddr pt1)))
6 j2 J7 e3 ?" ^) i, g3 K( N- Y  (grdraw pt1 pt2 2)$ t! `$ w7 c& Z# H
  (initget 7 "Square")                ;Width can't be 0, neg, or null
' ?  Q" I! E6 ]! o& q  (setq w (getdist pt1 "\nSquare/<Width>: "))
  x3 o9 I- |8 n4 ?+ |1 \4 s! f$ r  (if (= w "Square")
' i+ y* y) G" r      (setq w l)+ ?+ H  ^( v% O
  )& G) t6 {, L$ v3 S7 b& y( \
  (setq pt3 (list (car pt2) (+ (cadr pt2) w) (caddr pt2))). i3 z5 P2 G) j8 r4 d) t3 w
  (setq pt4 (list (car pt1) (+ (cadr pt1) w) (caddr pt1)))' @' }; w- P$ t" [: k
  (grdraw pt2 pt3 2)# b. ~" c) \+ ^+ z# N; m
  (grdraw pt3 pt4 2)
; V9 A, q% s  H6 Z2 c  (grdraw pt4 pt1 2)
# \# c. U& Y) S+ s, f9 t6 M' S( Q! D  (setvar "ORTHOMODE" 0)
" W- x2 m$ P; |. ]0 e  k" p  (command "pline"  pt1 pt2 pt3 pt4 "close")
! C$ l, |, d4 L6 ^, b  (setvar "cmdecho" ocmd)
1 ]7 H- B0 ~, a5 z+ B* T" ]  (setvar "blipmode" oblp)
" a" v4 }0 \/ h! l% f! t% H  (setq *error* olderr)               ; Restore old *error* handler
7 a! j+ ]+ C0 i  R  (princ)
; `8 g; b4 i1 O! x; y. I8 W)
9 r: Z! r6 B! n' Z# |
4 p( E1 S/ Q3 J$ k5 s* y. ?(defun c:SG (/ ent pt1 pt2 ang)
# a. K! h2 g: ~; L* U  (setq cmd (getvar "cmdecho"))
- @# k& g9 R6 r% d  (setvar "cmdecho" 1)
8 X! X- d  I# X9 ?  (prompt (strcat"\nSnap angle will be set to angle of line"))
1 ?% L1 R" ~/ J  (setq ent (entget (car (entsel))))
. d* n( Y+ h- L* I  (setq pt1 (cdr (assoc 10 ent)))
( @( ^" W6 \4 B/ H3 B4 e0 k6 M  (setq pt2 (cdr (assoc 11 ent)))* I: X. `; {' S- O! V8 l1 X; @
  (setq ang (angle pt1 pt2))% R; K! x0 I1 ~. n
  (setq ang (/ (* ang 180.0) pi))
+ x: \  h. q9 t2 e  (setvar "cmdecho" 0)
! d8 f% B" ~* s    (command "setvar" "snapang" ang)
/ X) J( e9 l: c) E- U    (setvar "cmdecho" cmd)
! q1 i. K  D+ w); f: A- o0 j* Z, m* z0 a2 ?
) U, H  m2 L' s6 P
(defun C:TG ()
. [8 K9 }& I9 t- U  (initget "Increase New")# \8 u1 m' u. i6 Z# u/ k$ s
  (setq ans (getkword "Increase/<New>: "))6 X% a4 I& M9 q7 n7 Q
  (modang)
: \- o% N1 Y2 _- }) L4 B7 [)
9 o- D, ]$ U( P- s5 S8 c& B1 O* w(defun modang (/ ang ss ca e na ssl)
# F( J5 W. }  W  J: O9 B (if (= ans "Increase")
1 ]: q; |, ^7 A' R) w     (princ "\nIncrease angle for text by: ")" _2 E" v  A% _7 O" \: B
     (princ "\nNew angle for text: ")
* I7 ]/ h% ?$ R/ w2 f$ i* G )
) _" j' D. A# w) f (setq ang (getreal))
7 X" R* j  U5 e- o0 [ (setq ang (* (/ ang 180) pi))
" f0 U) s+ {- v (setq ss (ssget))2 P6 k8 p- L3 N+ l4 l7 Z
(setq ca 0 ssl (sslength ss))
: n( V, g0 u6 V" |0 \. N (while (< ca ssl)6 Q, b0 V: \5 x; o, z3 @
  (if (= "TEXT" (cdr (assoc 0 (setq e (entget (ssname ss ca))))))
; f3 e, K9 {9 Z" O$ ?, o   (progn1 e" t3 S7 K% D) }6 l" Q+ `
    (if (= ans "Increase")
4 Z" v6 A; ?! ?# r        (setq na (cons 50 (+ (cdr (assoc 50 e)) ang)))
* ~7 K% I( \: S; ^        (setq na (cons 50 ang))1 n& i% _9 y+ f' w$ D! t' f. X/ }
    )
' q, ]  }5 Y& @, T: T7 f    (setq e (subst na (assoc 50 e) e)), Y# d6 H/ h) j7 A! Z9 `
    (entmod e), e5 r, H* |  t, U% v! h* @8 N7 L
  (setq ca (1+ ca))" Z, ]* F- N/ y* p5 F
)) \& d$ ]2 T& D+ w  N" ~; R$ m2 P* ?; F
)
1 I  r$ K, A% y, I& X5 T1 I )
+ N# Q4 h5 Y  E, ?3 P (terpri)
8 K1 N: q/ b3 p); F; `/ G; d( _( ~

" H; E; g. P# K
; n7 ]/ Y7 `$ {% q(defun c:WL ()
9 W/ _3 Y1 c* S( T! `7 n  (setvar "cmdecho" 0)8 A" B' A: H5 Q! a; h
  (setq a 1)# i/ M- Q% Y- \+ n% C3 ?/ k# Q
  (prompt "\nSelect Polylines to change: ")
+ h& ~: h4 ^  u6 [8 ?3 G4 L: E  (while (/= a nil)
; r; b% i0 ?) Y/ h7 k, b$ n3 ?. J    (progn2 o% d9 ^: U; J7 U$ O2 h
    (setq a (entsel))
7 j7 z0 s# k, c' h9 V9 b1 a9 d! g    (if (/= a nil)
# n9 U. y! y: j        (progn
0 X6 Z' o: {: D# w          (setq b (entget (car a))): w; Q' @" U* l1 m. Y
          (setq c (cdr (assoc 40 b)))
) S% ^) g8 ?8 m2 }- A          (princ c)
2 c' V3 M' d0 t' e! G          (command "pedit"a"w""lw""")0 a" f; V* G- p1 Q
        )))) ' V/ I8 l" o4 k2 w/ l* e
  (princ)
3 Z8 s# c! ?0 H+ A5 R' o)$ a* ^. N1 y" U9 r/ w: {% L1 l

$ C, J: V2 i  c( d6 N1 p9 [1 s;;; ================================ TEXT FIT ============================
& b! n! t: o* Z' m' }# n; y" L3 L7 s6 U2 ?
(Defun c:FT ( )
8 O7 j  I* b4 `% l# R6 z1 O7 t6 U6 X  (defun setsnapang (arg /) (setvar "snapang" (angtof (angtos (cdr (assoc 50 arg)) 0 8) 0 ))  )' w( n2 j2 ^. z; ^2 ^: T9 q
  (Defun LL-xyz (arg) (CAR (TextBox arg))  )
! l" O7 M  G0 v  (Defun UR-x (arg) (CAADR (TextBox arg))  )
: Z# H+ j* o9 |9 W* s0 L  (Defun LL-y (arg)     (CADAR (TextBox arg))  )* G5 k2 L' ~; i( ~, z* I
  (Defun LR-xy (arg)     (List (UR-x arg) (LL-y arg))  )
9 v) b8 a; C, D4 ~6 }   (Setq ename (CAR (EntSel "\nSelect Text to stretch/shrink:"   )  ); L2 m$ ~- {  @; M' N  \
      Textent (If ename (EntGet ename))   )   3 N& `+ p0 R8 T' x, i- _1 h) y2 h
   (If (= (CDR (Assoc 0 textent)) "TEXT")
6 F7 U0 m+ f) R0 |; c5 E      (Progn (initget 0 "Start")2 ^1 L' P" f% l4 w9 n
         (Setq  NewEnd  (Distance  (LR-xy Textent) (LL-xyz Textent) ) )
% K- n, P6 Y: \' E. \         (setsnapang Textent)                 ;set snap along text entity% v6 K) {5 I4 b+ U; n
         (setvar "ORTHOMODE" 1)                   ;drag along the text
/ M; j6 }/ d2 I6 q# Y         (setq ' d5 z/ u, c' j6 c5 F5 L
TMP (getpoint (cdr (assoc 10 Textent)) "\nStarting Point/<Pick new ending point>: ") )
( O4 W4 o& c3 Z/ S, R         (setvar "snapang" 0)4 @, q- ^7 l8 w1 G- e: J
         (cond9 q2 Z& i: @1 Z) A* T, y6 ]$ o
           ((= (type TMP) 'STR) ;;new starting point to be selected3 G  Z( L* I" ]9 m5 F
               (setq Start (getpoint "\nPick new starting point: "))
5 @: r" N* ?) w9 W               (if Start  (progn
: ~* w, x% n# R$ k( O  j0 V                  (command "_UCS" "_E" (cdr (assoc -1 textent))): ?: W2 T1 s: o6 o6 W4 `
                  (setvar "ORTHOMODE" 1)
" P, q$ {! S" b6 \( ]' K                  (setq NewPt
8 H  |; I  k) e0 v# P, M                        (if Start- y- A) |5 Z' z- F! u
          (getpoint (trans Start 0 1) " ending point: ") nil ) )! {/ ]6 E7 ?5 B+ |0 ~1 G
                  (if NewPt (setq NewPt (trans NewPt 1 0)))
. K# l  N) @, C6 ?3 k0 S# ~4 p                  (setvar "ORTHOMODE" 0)" o6 g$ u4 \* D0 a9 ]3 C6 q2 K
                  (command "_UCS" "_W") ) ) )
- [/ y; ?: O: B) H           ((not (null TMP))    ;;new ending point selected
  H! o+ O3 p# m( _) c! ]8 D: _3 P3 q               (setq Start (cdr (assoc 10 Textent)) NewPt TMP)  )0 T; \3 R7 J9 ]) M6 o' l
           (t  (setq Start nil NewPt nil) ) )
5 y; m0 X+ B& ~4 E. o' j         (if (and Start NewPt) (progn$ o6 S, Y' A# }1 \+ ]% e/ D& Y
           (setq Val (Assoc 41 Textent) ;;current width factor, w6 V3 E9 u$ T7 X
                 Val (if Val (cdr Val) 1.0)  LTC_%       3 A4 j/ a1 k4 W3 U5 Z" I
          (* (/ (Distance Start NewPt) NewEnd ) Val )
: A0 ^4 T4 e% O                 textent (Subst (cons 41 LTC_%)
1 N: }+ g, _5 P. O7 a6 T4 j6 Q           (assoc 41 textent) textent)
! H4 Q1 U6 \1 W( s* Y/ M  textent (subst (cons 10 Start) (assoc 10 textent) textent)+ h% T& i8 e, `7 E; V7 c" p& q
  textent (subst (cons 11 NewPt) (assoc 11 textent) textent) )
) x- R6 O5 G. n' n& d$ [   (EntMod textent) (EntUpd (cdr (assoc -1 textent))))))) (Princ))
! B* ?! z( m! ]2 U: ]; r) r. i
" y  e  s. m: P& p9 y! d;=====================================================================
1 m/ A& |. Z1 u' C8 K. E;=========================COPY + ROTATE ==============================* j1 g2 x" L# a- P) K" y- k) B
;=====================================================================
" B6 C8 ~  s$ b' M
: g$ L+ \  F0 ^1 p(defun c:CR(/ olderr cm loop ss1 ss2 bp mult lent ss2 lp1 lp2)' k8 ~3 I; U( }, [4 ?* G2 C
  (setq olderr *error*4 |. c$ b8 V/ g
        *error* croerr)
8 `, o$ _9 n4 F) P2 k$ E  (setq cm (getvar "cmdecho"))8 p  S( U* t, Q- @+ H+ ]4 p5 d
  (setvar "cmdecho" 0)
$ m9 m2 c6 }' S( a3 G; h; ]8 k" D  (setq loop t)
; H7 }9 i5 y4 r' \5 M  [  (while (not (setq ss1 (ssget))))% t+ @+ m7 `- J1 Z
  (initget 1 "Multiple")
! h- v( S6 V) r  (setq bp (getpoint "\nBase point or displacement>/Multiple: "))
! ^. j0 W9 X. {2 X, F( j* b( Z  (if (= bp "Multiple")
+ B0 h) g$ x  C% z/ Z- _! f3 P. U    (progn
0 P7 G5 i" L. a, s      (setq bp (getpoint "\nBase point: "))& \1 J8 B1 @+ t* d0 l8 {; U
      (setq mult t)2 U0 h- \7 o  l5 d5 R/ T1 C- R( w- J
    )+ V0 \" \! p# [; k% J
  )9 V" G% p% s2 f, L* R2 m) ~
  (while loop+ W  _; ~6 \8 u0 o0 g: C7 k  A. j
    (setq loop mult)
& b- @2 H- `0 H    (setq lent (lastent))
' {! U. h1 P( e8 P5 R' N/ N    (command ".copy" ss1 "" bp bp)
: b' k: ^! ~. d1 A    (setq ss2 (lss lent))
+ W$ v/ R$ r& B5 V    (setq lp1 (getvar "lastpoint"))
$ |4 E. T+ l. X- k' Q6 _    (prompt "\nSecond point of displacement: ")
% C% }  v  i* @4 S' o    (command ".move" ss2 "" bp pause)" j9 Z1 g1 f5 O) q8 U% i
    (setq lp2 (getvar "lastpoint"))
& M+ T% `- X9 c) \: ^, _    (redss ss1)6 q/ A7 O5 Q3 |$ L
    (if (and (not mult)
2 E, y! f  S( p* p6 P1 a- ]2 H             (= (distance lp1 lp2) 0)
7 O0 o! g9 h1 g5 `1 ~# l        )& h- E1 F% O3 i7 e
      (setq lp2 (getpoint "\nRotation Point: "))  O6 E7 f, E0 `0 E
    )# o0 @& T6 k. J0 ?8 _; j* [
    (if mult, x' V! ?' o/ ]7 I* U4 K# k
      (prompt "\nRotation angle ")/ g; q3 `( A- S
      (prompt "\nReference/<Rotation angle>: ")- v8 F9 ~/ W) h8 n- ]
    ): p! ]1 E1 W$ S
    (command ".rotate" ss2 "" lp2 pause)
6 G5 P& J) N. _" }2 u* f! ?  )3 _6 K  O9 O7 r$ V' l
  (setvar "CMDECHO" cm)
# w5 Z$ a5 U  l1 E9 G" _  (setq *error* olderr)2 Q* H" D9 Y1 T" C+ b7 l" c1 H" h
  (princ)) n, n/ y" v/ d, [9 K
)0 O$ G* K, ?+ D; e; x/ e
(princ)
$ N* t0 n9 d) A( I, ^(defun croerr (s)        
3 V  x  F3 P9 Y  (if (/= s "Function cancelled")
- ]& V+ V  A% K5 ~0 X1 F1 B    (princ (strcat "\nError: " s))2 i1 b( Z, ^% ^# ]
  ) & O( N' j, Y2 b8 {( X8 }- R" O
  (setq S nil)
" O) X( T, x/ Y  C+ H( M7 i  (setvar "CMDECHO" cm)9 x; ~3 N5 [% m
  (setq *error* olderr)
. b2 E/ M8 A8 F! h, M2 E* E  (princ)
0 [' P( g: f! C8 s; F)) `2 N2 X0 A7 N8 f) T; a
(defun lastent (/ a b)
0 j$ @2 H! p8 o* Q+ I% _  (if (setq a (entlast)), ~, h+ C$ p( \3 c  }4 L& `9 \
    (while (setq b (entnext a))
, \1 }2 H- m2 Q/ L& u7 Y5 ^      (setq a b)
$ t+ i2 o6 ?" g; `# x4 ^) O    )
1 f' u( z0 K! i2 }  )
+ G# ?7 T. I0 n; o( s  N: `  a
9 C  Q% p) ^+ ^( o$ ]# M$ h* H7 {  C)* a3 Z: c# P" T6 a
(defun redss (ss / en i)
! u  T+ i, ^- q9 d! x4 y  (setq i 0)
. ]0 z0 w& O/ i& {( t) B- r  d. m  (while (setq en (ssname ss i))- a) K+ b7 ?* P0 l2 E3 D, I
    (redraw en 1)
; |# m. S1 j: }& M7 P5 f8 q, {2 r: B    (setq i (1+ i))9 ]0 g% U6 X7 |! e% J9 P8 _0 G
  ): R. Z1 s% ]2 Q5 e( O3 R
)5 W! f/ b7 A7 s+ K
(defun lss (en / sels ed)
) J5 w* b) i$ r& e* {9 |( c" |  (setq sels (ssadd))
9 R& H) _: }2 `" |7 D  (while (/= en nil)0 C- E" g4 x0 m  A, G
    (if (setq en (entnext en)) (setq ed (entget en)))
! x& v/ E: F. f    (if (/= en nil) (setq sels (ssadd en sels)))
8 l$ s! m% w- [$ q1 w    (if (or (= (cdr (assoc 0 ed)) "Polyline")  J$ w4 ]9 V1 X% U' V( c7 \9 P. E
            (= (cdr (assoc 0 ed)) "Insert")
! t: f& G1 _6 q4 u5 x7 A7 L4 N3 ?: ]        )! F" [: _( `& ]
      (while (/= (cdr (assoc 0 (entget (setq en (entnext en))))) "Seqend"))6 ]) \) r" v: j5 L  n& K
    )4 N( U& V4 b- R' Z; p9 C
  ): `/ f. T' r' s  h: G
  sels& J' W& c3 w$ X2 W- n
); @7 {( b( s4 M1 i/ r2 G
' v2 u' G5 o* u8 E6 X2 l( p
;;;; ================== CAC FUNCTIONS DUNG TRONG ACAD.LSP ==================
, b9 ^5 |2 g0 b* m! G% A;;;==================== Tran Ngoc Thang - Sinh 03-05-1976===================- C( P* `6 B5 ~% k- T

/ c+ s9 T7 C5 p(defun c:00 ()(princ "\nChon doi tuong net Defpoints")(ssget)(command "change" "p" "" "p" "la" "Defpoints" ""))
+ r  O( Q. b$ |. ?8 Y, F+ H(defun c:0 ()(princ "\nChon doi tuong net 0")(ssget)(command "change" "p" "" "p" "la" "0" ""))
2 M4 |! s9 O& l7 Z7 _2 M! T8 c- z(defun c:1 ()(princ "\nChon doi tuong net COT")(ssget)(command "change" "p" "" "p" "la" "COT" ""))
4 L( ^# O4 n9 @9 e) O, K(defun c:11 ()(princ "\nChon doi tuong net DIM")(ssget)(command "change" "p" "" "p" "la" "DIM" ""))
' T% E' \, W! x2 i3 j; z(defun c:22 ()(princ "\nChon doi tuong net MANH")(ssget)(command "change" "p" "" "p" "la" "MANH" ""))6 f: |9 g9 C5 _3 P6 Q" s& [
(defun c:33 ()(princ "\nChon doi tuong net NETMANH")(ssget)(command "change" "p" "" "p" "la" "NETMANH" ""))) Q- v5 F. Z: X7 s( {" B7 N. L6 g
(defun c:2 ()(princ "\nChon doi tuong net NETDUT")(ssget)(command "change" "p" "" "p" "la" "NETDUT" ""))  p" [+ g1 H4 N% H; o4 z
(defun c:3 ()(princ "\nChon doi tuong net NOITHAT")(ssget)(command "change" "p" "" "p" "la" "NOITHAT" ""))
" ^$ P% Q/ N& O7 K+ ]3 T(defun c:4 ()(princ "\nChon doi tuong net TUONG")(ssget)(command "change" "p" "" "p" "la" "TUONG" ""))( }; t0 l; }" i3 P
(defun c:44 ()(princ "\nChon doi tuong net KHUNGTEN")(ssget)(command "change" "p" "" "p" "la" "KHUNGTEN" ""))
" P9 G/ E' x3 M: y% ?* N0 s2 H(defun c:5 ()(princ "\nChon doi tuong net TIMTUONG")(ssget)(command "change" "p" "" "p" "la" "TIMTUONG" "")), u8 a2 s: i& J' s
(defun c:6 ()(princ "\nChon doi tuong net CUA")(ssget)(command "change" "p" "" "p" "la" "CUA" ""))- E/ R) c/ n9 l; O% u8 v) I
(defun c:77 ()(princ "\nChon doi tuong net THAY")(ssget)(command "change" "p" "" "p" "la" "THAY" ""))& W# K! V4 m' I5 e4 q
(defun c:7 ()(princ "\nChon doi tuong net NETTHAY")(ssget)(command "change" "p" "" "p" "la" "NETTHAY" ""))
& d" n# y2 T; L! Z/ R! ?(defun c:8 ()(princ "\nChon doi tuong net HATCH")(ssget)(command "change" "p" "" "p" "la" "HATCH" ""))
, l# W* r! M/ h* H(defun c:9 ()(princ "\nChon doi tuong net TEXTTXT")(ssget)(command "change" "p" "" "p" "la" "TEXTTXT" ""))
+ M' e; s' H4 _# z& y6 z(defun c:99 ()(princ "\nChon doi tuong net TEXTVN")(ssget)(command "change" "p" "" "p" "la" "TEXTVN" "p" "C" "bylayer" ""))0 Z% x. ~2 g1 S7 R
(defun c:td ()(princ "\nChon doi tuong net THEPDOC")(ssget)(command "change" "p" "" "p" "la" "THEPDOC" "")). J1 _" K' q8 I$ F# I6 B& q
(defun c:ddt ()(princ "\nChon doi tuong net THEPDAI")(ssget)(command "change" "p" "" "p" "la" "THEPDAI" ""))
: q( b" W3 u  n( ]2 Y; a7 U5 ?& s  O+ f9 @$ l  c4 h) z' e/ L2 q
;=====================================================================6 g2 L3 V' i+ z, x) [5 h4 t6 i& j
;===================DAT Ti Le Theo KHO GIAY BAN VE====================
8 C! h' e1 @6 ?& x;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
' E2 X, f. ?: E; [) ?
6 a; y2 c7 |! Q' K, V% @) A;(defun c:SA6 () (Command "DIMSCALE" "111.11111" ))(princ)) R2 u9 E! E( m) U& D
;(defun c:SA5 () (Command "DIMSCALE" "1111.1111" ))(princ)* g2 x2 J! R1 {( b
;(defun c:SA4 () (Command "DIMSCALE" "1111.1111" ))(princ)6 R2 c, J( u& P
;(defun c:SA3 () (Command "DIMSCALE" "11111.111" ))(princ)
  f4 e; r2 j/ S3 v2 C; G;(defun c:SA2 () (Command "DIMSCALE" "111111.11" ))(princ)
. n# Z/ L% V6 Y6 U/ i;(defun c:SA1 () (Command "DIMSCALE" "111111.11" ))(princ)
7 J  K. [; }/ `8 A;(defun c:SA0 () (Command "DIMSCALE" "1111111.1" ))(princ)
( ~( @; p! x, a8 e! R$ p5 y
1 \6 r# u- i5 i: s( J- W! M2 k& [;=====================================================================
- l8 t1 Z! a) l7 e, G/ [;===================DAT Ti Le Theo KHO GIAY BAN VE====================
& I$ X% \) M. J% j0 K;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
" x% w4 t( k1 i2 Z/ W. J* @: G7 e5 S& Y# D  m
;=============== DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =============
. v1 `0 s/ |! R# B* b+ {, @& F+ Y3 ~( @# m( O: t
;=============== DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =============
1 ^& T7 h, f4 v2 _! T/ H$ }( a1 G' h$ `! ?
(alert "Using the NetXuatAnh-[ 5940.00 x 4200.00 <pixels> ] command!")
6 a+ E6 y/ k) I; t! y/ [(princ "\nEnter (DEFUN C:netxuatanh () to get to real LAYER command.\n") (command "NETXUATANH")
, b7 o6 Z2 f0 B; n" U$ ?4 M  P- G% O5 G, w% W, x, G- S+ E
;=============== DAT LAYER NET de xuat anh JPG [W x H] [5940.00 x 4200.00] ===DRAW===1 k) o, s* y0 T3 K
+ G+ r7 [, I' [9 ]; c- S
;(DEFUN C:netxuatanh ()0 b, ?# r/ H8 a" J1 |
                            (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.6" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "5" ""/ M7 x" u0 m. V
                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "1.58" ""
1 a5 L3 K' T  F+ Y5 \- K9 d                                           "M" "MANH" "C" "9" "" "Lw" "0.5" ""
, A) t( |$ e9 E' U                                       "M" "DIM" "C" "1" "" "Lw" "0.6" ""
  t7 n5 c3 j0 n0 D7 m0 X                                       "M" "THAY" "C" "7" "" "Lw" "0.7" ""
+ E9 a; j/ p4 h1 B; g! n! k8 M                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.5" ""
4 _4 Y3 s& V" N8 o                                       "M" "HATCH" "C" "5" "" "Lw" "0.35" ""1 o  ^) J' e8 r7 ~' e% s
                                       "M" "COT" "C" "2" "" "Lw" "2" ""
7 W/ v6 D1 g/ S+ ~; U( Y) K                                       "M" "Defpoints" "C" "7" "": q. b9 h! J# I" b( q
                                       "M" "0" "C" "3" "" "Lw" "0.5" "": F+ G5 d1 j6 b  S* W
;                                       "M" "1" "C" "1" "" "Lw" "0.5" ""
1 T$ n- G% ~5 v( c;                                       "M" "2" "C" "31" "" "Lw" "0.5" ""
$ L: L* q3 j( o( s;                                       "M" "3" "C" "8" "" "Lw" "0.35" ""
# s1 m8 P* a. l+ G' U' u8 i;                                       "M" "4" "C" "4" "" "Lw" "0.8" ""
3 y) Z/ r0 C% p6 w  G6 p( x2 c- C;                                       "M" "6" "C" "6" "" "Lw" "0.35" ""/ z. i3 u2 k& T5 [* @+ Q* A1 @& v- `
;                                       "M" "7" "C" "7" "" "Lw" "0.4" ""
5 Y. j& g- G$ C& f3 R+ L2 d7 [& F;                                       "M" "8" "C" "8" "" "Lw" "0.35" ""
4 k& @6 L5 Q  e. C% e( t                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.5" ""
7 Y, ~; p: o/ l; {0 ~9 _                                       "M" "DUONGBAO" "C" "7" "" "Lw" "1" ""
. i/ S7 `( F9 S4 }' j;                                       "M" "KE" "C" "8" "" "Lw" "0.3" ""6 K5 E: z0 p3 i6 _8 Q+ i, D
;                                       "M" "KT" "C" "9" "" "Lw" "0.35" "". r7 m6 G- W: ?! [" ?
                                       "M" "NETDAM" "C" "4" "" "Lw" "1" ""7 K8 h6 j9 A& _$ n1 F$ l9 b# Y
                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.7" ""
% C2 L3 K0 q; a: f! ]) Y3 G                                       "M" "NETMANH" "C" "43" "" "Lw" "0.5" ""
( W! @  `! B  e8 p" @2 P, C                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.8" ""* \  Z# s* x) w
                                       "M" "TEXT" "C" "7" "" "Lw" "1.58" ""
# R, k4 j/ p# Y  H# Q                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.5" "": I3 I# P: r' m0 [& \1 i3 a
                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.4" ""
8 ~6 o3 Q1 Q( F" E$ ~) T" n  D! U                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.4" ""3 @6 J6 s" K$ m
                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.7" ""1 X  e" D( T( K: l2 f
                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.58" ""& ~9 Q4 y* Z+ g% y
                                       "M" "CUA" "C" "6" "" "Lw" "0.5" ""% H# B' J3 d( Q, q+ p5 i! W
                                       "M" "CUAMATDUNG" "C" "6" "" "Lw" "0.5" "") C/ k7 E: Z. P

, b7 L+ ]4 T3 l5 @$ M8 W+ r;=============== DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] ===NUOC===
. r! U! j8 k' ^- t
9 W; O7 q7 N9 x& p( O/ U0 _                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.5" ""6 [/ E. |" Z4 U7 W0 U1 p- I+ u
                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE1" """ e0 M, n3 G0 Z, R- A" _5 ~
                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE2" ""
# n6 R3 Y5 g( t8 }; P4 l' l  w;                                       "M" "250" "C" "250" "" "Lw" "0.35" ""
' Y1 {8 m. D# w$ C3 k( \8 P0 j                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1" ""
, I& [' _8 R( e$ p% P( R* n                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.5" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "10" )(princ)
. G( \' x$ a6 ?2 L! i" H1 l3 W
0 C+ g  P& d& l8 P;=============== DAT LAYER TEXT de xuat anh JPG [DIM] [TEXT] [GHI CHU]======% N" y5 f0 ~  m/ k- k8 p  p) t
;===================================30|04|2024==============================1 \) q* C; [0 E( o
) N  ]4 }8 F( N' T$ M
                     (Command "-style" "VNi-AUCHON" "vauchon.ttf" "225" "1" "0" "n" "n" )(princ)
$ h5 u, |0 E" W                     (Command "-style" "VNi-COURI" "vcouri.ttf" "200" "1" "0" "n" "n" )(princ); \# f, n% U* G7 i3 {
                     (Command "-style" "VNi-COURIB" "vcourib.ttf" "200" "1" "0" "n" "n" )(princ)
0 W0 i7 H% z% G                     (Command "-style" "Vni-VietNam" "vn_vni,vns.shx" "0" "1" "0" "n" "n" "n" )8 b0 b6 V- N7 @7 Q! N5 o
                     (Command "-style" "Vni-ROMANS-TEXT" "vni-romans,vns.shx" "200" "1" "0" "n" "n" "n" )4 }4 \& t* Y+ s
                     (Command "-style" "COTES" "tcvn3italic,vns.shx" "0" "1" "0" "n" "n" "n" ), Y7 k/ b% i/ h7 s
                     (Command "-style" "TRUC" "impact" "0" "1" "0" "n" "n" )2 O; B, ]/ _4 H, O# D1 s4 }- {
                     (Command "-style" "VNHELVLT-Hoa" "vnhelvh,vnh.shx" "500" "1""0" "n" "n" )' q/ H! v7 d! R5 S
                     (Command "-style" "VNHELVLT-Thuong" "vnhelv,vnh.shx" "500""1" "0" "n" "n" ); t; O: V: D# J: K2 h% C
                     (Command "-style" "STANDARD" "Cambria" "250" "1" "0" "n" "n" )+ K! }  F1 A' Z+ M" w3 @* Y
                     (Command "-style" "CAMBRIA" "Cambria" "200" "1" "0" "n" "n" )
' O& C- v. ?& N; L; b+ T                     (Command "-style" "GHIKH" "romant,vns.shx" "0" "1" "0" "n" "n" "n")
4 ]3 X" i5 I0 O/ y  w& h                     (Command "-style" "GHISH" "impact" "0" "1" "0" "n" "n" )
$ V" F5 k+ S" m( X8 I+ X                     (Command "-style" "ROMANT-DIM" "abcroman,vns.shx" "0" "1" "0" "n" "n" "n" )  T( p4 J2 @! G6 {8 m9 d, T
                     (Command "-style" "ROMANC-KhungTEN" "abcroman,vnh.shx" "200" "1" "0" "n" "n" "n" )& [& \+ K, a8 B8 u3 p1 l# _
                     (Command "-style" "ROMAND-TEXT" "abcrom,vnh.shx" "200" "1" "0" "n" "n" "n")
/ q; p4 m7 H3 T( |) V! {                     (Command "-style" "ROMANT-TEXT" "tcvn3italic,vnh.shx" "200" "1" "0" "n" "n" "n" )(princ)" V/ {7 [# u! A; O1 t  m

* ], j6 c# o8 O+ U;============= DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =DIM-STYLE=
1 C8 B  W8 f. d( I' C;===================================17|10|2024===================================9 }9 C& a4 X: {( b, {, p% T( g
# Y4 J# b% e9 r/ k9 ^- ^, H4 w
                     (Command "DIMTXSTY" "ROMANT-DIM" )(princ)
: J0 Z, m! m$ y, U7 o& a7 s                     (Command "DIMBLK" "Closed" )(princ); q! u: [9 `3 W1 u" y/ w  P" {

& `' L5 {. Z+ J1 T5 X;============= DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =DIM-STYLE=
$ L, a0 m4 e. Q0 ~4 `, d& O4 H" l* ~;===================================17|10|2024===================================
2 P8 Q/ C% W7 w" `$ V2 s
  I) Q$ R. W/ }0 @8 L* L;(Command "-units" "2" "8" "1" "8" "" "N")
2 N1 S* `3 H: x: o# U(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)
, x3 J1 b2 k  A: C* C$ V# y$ f/ G  e7 ^% M& X4 {# }
;============= DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =DIM-STYLE=
5 Y& a# X# Q8 w( d( G; B;===================================17|10|2024===================================9 Z. z1 G( f" i1 d& p. q
% F3 }/ f- F: `* z
;======== KET THUC - DAT NET IN de xuat anh JPG [W x H] [5940.00 x 4200.00] =====
* }% o& R. d1 {( t4 v
$ O0 R" U+ h  S0 _" W;======================== DAT NET IN & TI LE BAN VE =============================
/ T# H1 A5 s( A$ x& K6 ~/ y
) ?7 @5 V5 }! i- J;=================LENH VE KHUNG TEN - Tieu Diet Lenh==================
2 {2 f0 E; |" Q;=============== DAT KHO GIAY BAN VE - KIEU KHUNG TEN ================4 l& P7 [9 k) N5 w# h
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================- H6 t6 {" S, I2 s, n6 y, {
;=============================11|07|2025==============================
7 Q, W$ F3 U$ g( e# m8 V0 _;Ti Le Ban Ve - 1 : 100
4 p2 \7 e0 A$ A+ f* X, Y(Defun c:kta4 ()
0 T4 y: Q6 [. V5 n* `/ g0 b( F% P3 G        (setq mv_sc 100);Ti le  ban ve
' C7 F& K; `. B" E8 _0 s+ Y& X5 _      (setq x4  297)
# ^/ ^8 @1 j+ Z, y      (setq y4  210)
3 N8 Q) T7 b- Z6 w% q  (setq x4 (* mv_sc x4) ; @; m4 G$ l+ y# g' c5 y
        y4 (* mv_sc y4)  )/ L( l( w$ C6 ~5 m  L$ H" e# @
  (command  4 d; [+ o$ u" R: ^+ K, V! m& R0 K3 C
    "LIMITS" "0,0" (list x4 y4)
& w, |! Y) O& m! ?9 `9 a  `- v    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
) I4 `7 P! r4 w;Khung CHU NHAT Chinh   
, x" [- q  L! h) ^& Y% O, x( \6 Q    "RECTANG" "500,500" "@28700,20000"  ]8 c* h  [/ f
    "RECTANG" "700,700" "@28300,19600"- J- E9 c' |' A( F1 |' ^
;Khung Ten Chung; i# ^1 k( Z+ S  E6 k8 X
    "RECTANG" "700,700" "@8000,1250"
2 ~3 N- ?2 U" Q0 t# K# V8 B    "RECTANG" "700,700" "@17300,2500"* }! h" Q) }7 @
;Ten Ban Ve" V7 H" J: q, _4 E8 ~% u
    "RECTANG" "18000,700" "@11000,1250"
+ v% x* o$ {' V/ h8 W! p    "RECTANG" "18000,700" "@11000,2500"% B5 E& c- \7 u# o) E
;Khung Ti Le + Ngay Thang Nam
) L: ~3 ?! c: y) V" A    "RECTANG" "22500,700" "@2000,2500"
6 Z  f* x( r2 G: q0 z8 J;Khung CHU TRI
0 Y" R) g7 j( V! {% l7 C( r    "RECTANG" "8700,700" "@3800,2500"
7 F9 F, o9 S+ Z' C- Q"ZOOM" "_a"  ))' e. N. p/ Y9 U- ]$ x" s* Q
;=====================================================================2 D2 D5 R- Y0 O6 Q% [
;Ti Le Ban Ve - 1 : 1009 t: a. H6 A# w6 h1 L: n
(Defun c:kt4a ()$ ~$ a, P* w. O4 c6 k" s
        (setq mv_sc 100);Ti le  ban ve
% Z1 |. [% X0 V1 Q      (setq x4  297)! s& I& O- w$ S# ~5 R
      (setq y4  210)
5 `# Z" B& s* s, X  (setq x4 (* mv_sc x4) & G: V. ^/ D5 A0 J- S  Z
        y4 (* mv_sc y4)  )
- c! l* V" P  w- N  (command  
" U  i/ K7 j6 A; t- C    "LIMITS" "0,0" (list x4 y4)
( f* u* ?* E% c# C2 E4 ~    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
% `# X; \/ P# g, Y& T;Khung CHU NHAT Chinh  
" d) m' |$ T  `% o) K: w  M% J+ \, |    "RECTANG" "2000,500" "@27200,20000"
* l& l: s8 W  v% a4 K    "RECTANG" "2200,700" "@26800,19600"  H0 d8 F/ f& C5 M% j$ i2 ~8 [5 g
;Khung Ten Chung
2 ]) j- m* y3 @4 Q# Z; f. y3 f0 J4 Y  _    "RECTANG" "2200,700" "@6500,1250"
4 K7 x2 b; a) W: b    "RECTANG" "2200,700" "@15800,2500". m" @9 m/ h/ A
;Ten Ban Ve5 |- x6 o  `2 D9 A" a
    "RECTANG" "18000,700" "@11000,1250"
: p; J/ F1 Q6 y, c$ C+ ]1 l6 a6 o  d) e+ G    "RECTANG" "18000,700" "@11000,2500"0 C) [2 m5 R. Y8 y/ h/ q
;Khung Ti Le + Ngay Thang Nam
1 `1 S! z8 |, }4 y1 p3 N7 S$ y) x    "RECTANG" "22500,700" "@2000,2500"
6 K* h7 _" p6 T" E;Khung CHU TRI
7 |% x  J2 ^8 F# H* b4 ]; U6 m    "RECTANG" "8700,700" "@3800,2500"
( O/ ~5 P- X# ^% u& a4 X    "ZOOM" "_a"  ))
8 W! D2 O; v+ y8 m5 q$ J" w
5 I. _8 X$ |! j* t0 ]& h! b;=================LENH VE KHUNG TEN - Tieu Diet Lenh==================0 b) n! V2 P7 h0 s4 U; }2 F( w
;=============== DAT KHO GIAY BAN VE - KIEU KHUNG TEN ================/ M, T5 t" B2 Y' i4 a$ t
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================' Q7 Y7 \5 ?5 h( @
;=============================04|07|2026==============================+ ^* M. T7 D1 ^# s6 {
;Ti Le Ban Ve - 1 : 100
! P9 J. U/ o; t9 u0 G8 v(Defun c:za4 ()
& P# e8 Y% n2 \6 f8 x4 i        (setq mv_sc 100);Ti le  ban ve
  h) g/ l$ C8 v      (setq x4  297)
" d2 o! Y! ]  i3 a; B/ K) \      (setq y4  210)5 t- c, S6 t" @% }# X. n) f4 h
  (setq x4 (* mv_sc x4) 5 [$ w0 E1 l6 R
        y4 (* mv_sc y4)  )# |" Q' J1 z' t- ~4 a
  (command  
# g  t7 ~! u! J    "LIMITS" "0,0" (list x4 y4)
$ C$ @. T5 E1 @* k( p' Y    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
5 L% _& ^, |% h5 c2 y$ D5 T;Khung CHU NHAT Chinh   
+ Q# @( o9 I: |& S8 ~1 h# I    "RECTANG" "500,500" "@28700,20000"1 _; e9 k" D* E# f, Z* j' l: v( Z4 f( r
    "RECTANG" "700,700" "@28300,19600"
' `6 h0 d) Y( T: v* s1 q+ k;Ten Ban Ve, k" p' Z; o6 d: f1 `; i9 P
    "RECTANG" "24500,700" "29000,1950") [& M; V4 U9 A) ~, Z3 Z1 q
    "RECTANG" "24500,1950" "29000,3200"
1 G. a1 O5 m' o;Khung Ti Le + Ngay Thang Nam* `1 h/ @- m2 U" Z" ?/ F
    "RECTANG" "24500,3200" "26750,4450"4 ~* u0 ?$ c2 j+ [- F$ x& @
    "RECTANG" "26750,3200" "29000,4450"
2 E" ~9 E- s5 P; e; k! E' w6 f;Khung Kiem Tra2 \7 S1 f9 x6 j- e* h6 \9 K
    "RECTANG" "24500,4450" "29000,6325": Y/ }: p+ g2 J# B+ A! N
;Khung Thiet Ke
# v1 w4 a  N# s4 h8 A    "RECTANG" "24500,6325" "29000,8200", J& t, Z% C$ n" B) B  X
;Khung CHU TRI8 F# y# T; t: q, t. c8 R+ U, O
    "RECTANG" "24500,8200" "29000,10075"
( |) U3 a. J* y) D;Khung GIAM DOC
5 P( s7 j2 M5 Z1 j0 S5 e    "RECTANG" "24500,10075" "29000,11950"
& ?: y8 x. g4 _3 e( U( \9 S4 ]$ ?;Khung HANG MUC
& Z2 O1 g/ J& `: o  D    "RECTANG" "24500,11950" "29000,14450", H1 K, N6 D, h
;Khung CONG TY6 D0 F. j. p  r/ o
    "RECTANG" "24500,14450" "29000,16950"
! f: m& ?* [* W2 P;Khung REPAIRE* s7 X0 Y) S4 F$ I0 i( x2 `
    "RECTANG" "24500,16950" "29000,18125"/ [6 ?" o+ j0 \% v/ y
    "RECTANG" "24500,18125" "29000,19300", E, \7 V! }2 y( }  N5 h9 ?
    "RECTANG" "24500,19300" "29000,20300"
7 K) N, f# L: \% F) ~8 i3 w    "RECTANG" "25500,16950" "25500,20300"& d; a1 j# O4 R7 F% d5 X
    "ZOOM" "_a"  ))
- i$ G$ L* q2 \0 i;=====================================================================9 h* \4 ^8 k: W, J: {6 }7 ^6 Y4 ]
;Ti Le Ban Ve - 1 : 1008 c/ u3 s" `5 Q  h7 p& y* y2 u, S
(Defun c:zb4 ()+ @* d% m: }( {& F1 N
        (setq mv_sc 100);Ti le  ban ve0 w1 ?+ w  g- R% t5 h
      (setq x4  297): A) l( E2 }% ^6 n; m7 e
      (setq y4  210)
' ^' M9 J: R; D+ S' B! R% m; O  (setq x4 (* mv_sc x4) 0 i5 ^% Z* m5 y; U0 ^# k3 x$ K" g
        y4 (* mv_sc y4)  )
1 q* {( q/ }  |8 M3 c% }- |( A* E1 K$ p  (command  
% c; m' E+ P" n2 k    "LIMITS" "0,0" (list x4 y4)
5 t8 X- O  K$ R, @    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
& D# p6 f2 ]7 ~2 [- };Khung CHU NHAT Chinh  0 V! B/ M: e- n1 j; c
    "RECTANG" "2000,500" "@27200,20000"2 ?, }6 C; V7 b3 D0 ~9 H$ g5 M/ c; E6 a
    "RECTANG" "2200,700" "@26800,19600"
) X# a! L! L, y8 ^; a, f7 E. x1 c8 h;Ten Ban Ve
0 D, L' m. S9 ~4 ^2 u    "RECTANG" "24500,700" "29000,1950"* C0 ~9 R! n' s# Y5 l: Z/ [
    "RECTANG" "24500,1950" "29000,3200"
0 `! X5 V! w6 W2 Z. Q3 I8 ?;Khung Ti Le + Ngay Thang Nam/ e: k' B: {" D- N5 w; X
    "RECTANG" "24500,3200" "26750,4450"- @2 P1 b2 ^( \
    "RECTANG" "26750,3200" "29000,4450"
; w+ U1 R4 {9 H1 i7 ?;Khung Kiem Tra
. Z0 w( I, H' @  ~    "RECTANG" "24500,4450" "29000,6325"
3 K  P  Z( j8 u: z3 M;Khung Thiet Ke
/ }# e* F5 K. F- E) O7 y9 s; [7 r    "RECTANG" "24500,6325" "29000,8200"
: g# e% c6 x8 G8 i- @: \;Khung CHU TRI
0 k: K% ^6 i9 O9 j6 G0 Q    "RECTANG" "24500,8200" "29000,10075"7 G* z6 A2 w( U  z- a8 n
;Khung GIAM DOC+ m' |- T$ G* r! ]' F7 x
    "RECTANG" "24500,10075" "29000,11950"3 q  D1 F- O* x* c+ [0 ~% s% e
;Khung HANG MUC
; H/ R# G2 m1 l% s    "RECTANG" "24500,11950" "29000,14450"
( S2 r, K1 N# C6 h  i;Khung CONG TY" i4 q$ ?0 P. I7 g; l: n* M: W
    "RECTANG" "24500,14450" "29000,16950"0 q9 T) k% o/ Q6 T
;Khung REPAIRE9 d/ G+ k5 h- J2 {$ V5 h7 k
    "RECTANG" "24500,16950" "29000,18125"  ]$ G. f" J" S: i# V# N" ^/ A
    "RECTANG" "24500,18125" "29000,19300"
. H+ a$ {2 a3 J  j; W    "RECTANG" "24500,19300" "29000,20300"
7 M6 ^$ P+ w: H9 L3 }    "RECTANG" "25500,16950" "25500,20300"
; V1 |0 [5 j' W9 F. I4 `3 `    "ZOOM" "_a"  ))9 a% p: k4 q7 l0 _* q" A
1 X# V, r- x4 T5 n' [. T2 }- p/ h5 x
;;; ============================GHI CHU Khung Ten========================7 v( e: z8 F( r  |, ?' n7 S
;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========# d% H8 u. B5 O( a# ~, k
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 ====================3 z7 k1 G* H, L2 a% i' q9 l, n- t
;;; =======================Thuong Dung Font Romant.vnh===================; W4 i# t- V/ F

" \) u* E4 Y0 Z$ M6 @  E(defun c:GhiChu (/ pta ptb ptc ptd X Y X1 Y1 rmsz pl1)
# i, U) N1 A& R3 \  (setq oer *error* *error* err2)% c% {6 r$ f' ~
  (PROMPT "\nChuTri. ThietKe. KiemTra. TiLe. Ngay. HangMuc. QuyMo. KieuNha. CongTrinh. KyHieu. TenBanVe. Kts. TranNgocThang. ")
. x( F+ k9 |- e) Q) k# V' H3 b  (SETQ Cpt(GETSTRING "\n(CT). (TK). (KT). (TL). (Ng). (HM). (QM). (KN). (CTr). (KH). (TBV). (Kts). (TnT). "))) S; U1 i- k( p. I: X9 {
  (IF(OR(= Cpt "QM")(= cpt "qm"))(SETQ CPT ' "Hå S¬ ThiÕt KÕ Nhµ D©n Dông quy M« :"))7 g2 L6 ]: {) S5 A
  (IF(OR(= cpt "KN")(= cpt "kn"))(SETQ CPT ' "2 TÇng 1 Tum Thang"))/ L' m( V1 V: B) t) ?
  (IF(OR(= cpt "CT")(= cpt "ct"))(SETQ CPT ' "Chñ Tr× :")); t- x8 x& Z$ ?0 T  h) M
  (IF(OR(= cpt "HM")(= cpt "hm"))(SETQ CPT ' "H¹ng Môc :")), Y3 A/ z; w# x% p8 M: e
  (IF(OR(= cpt "CTr")(= cpt "ctr"))(SETQ CPT ' "Nhµ ë Gia §×nh - Nhµ LiÒn KÒ"))
2 u2 u9 C* }: e' ]" ~( h' Y5 W2 _  (IF(OR(= cpt "TK")(= cpt "tk"))(SETQ CPT ' "ThiÕt KÕ :"))5 [7 g+ p& ^+ {$ \) Z! j  n
  (IF(OR(= cpt "KT")(= cpt "kt"))(SETQ CPT ' "KiÓm Tra :"))7 N+ d5 u, G# p  B$ h5 }
  (IF(OR(= cpt "TL")(= cpt "tl"))(SETQ CPT ' "TØ LÖ :"))
7 ~  K! A2 Z* z  [9 j  (IF(OR(= cpt "KH")(= cpt "kh"))(SETQ CPT ' "Ký HiÖu :"))% a1 v9 V0 q! }. t- v- N/ Y/ Y% o/ J
  (IF(OR(= cpt "TBV")(= cpt "tbv"))(SETQ CPT ' "Tªn B¶n VÏ :"))4 ?5 C7 b5 K9 `& Q: Z  l
  (IF(OR(= cpt "Ng")(= cpt "ng"))(SETQ CPT ' "Ngµy :"))
, t! j' Z' l5 X! d+ G  (IF(OR(= cpt "Kts")(= cpt "kts"))(SETQ CPT ' "Kts. TrÇn Ngäc Th¾ng"))
! b7 M$ i' [0 }9 w# X  (IF(OR(= cpt "TnT")(= cpt "tnt"))(SETQ CPT ' "TrÇn Ngäc Th¾ng"))1 S; T' Y+ |& u" v: x+ d3 R# a
(setq pta (getpoint$ i0 j. |8 |8 }
    "\nPick first corner. : "))- S; }$ g" @5 I) [# Q6 y
  (setq ptb (getcorner pta/ ?9 ]& A5 ?$ A+ e8 B
    "\nPick second corner. : "))8 P8 `+ L$ |7 f) X$ R
  (setq ptc (list (car ptb)(cadr pta)))9 B( ~5 V) G/ [6 S4 z+ K
  (setq ptd (list (car pta)(cadr ptb)))1 G$ J/ @; O2 V, k
  (setq ang (angle pta ptb))
1 H! O% H- R! ?; J1 D1 W  (setq d1 (/(distance pta ptb) 2))% X2 m4 S" l* n" F* ^
  (setq cp (polar pta (- ang (dtr 0)) d1)), ]. w3 ^# i& Q+ o
  (setq X (distance pta ptc))" v9 T- A+ h1 ^6 H$ K
  (setq Y (distance pta ptd))3 d. K2 Z$ X* [+ N- `3 t1 Q) I
  (setq X1 (rtos x 2 1))
, p2 C5 U! v- |' K  (setq Y1 (rtos y 2 1))
! o1 q: a7 }7 C/ i+ q- z) r5 ]  (setq rmsz (strcat "(" X1 " x " Y1 ")"))
& {+ C) ?3 E. }  g0 k6 |' H  (command "TEXT" "c" cp "0" CPT "text" "" rmsz))& t2 ?* u  _+ {8 {5 c+ E
  (defun dtr (angg)- Z& K( X" _/ j. Z! Q
  (* pi (/ angg 180.0)))
/ \; k' c* f$ ]& T* V/ H' @5 `% D! I& m, R& v7 i: }4 P8 l0 U4 t3 {
;;; ============================GHI CHU Khung Ten========================4 R6 }* @6 [3 G, L6 c$ Q
;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========
* K! m4 v. z+ @! Y2 B/ e;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 ====================
2 G1 [& _8 H3 j0 |- O  g;;; =======================Thuong Dung Font Romant.vnh===================' X3 y) e, z& {" J! j: ]8 A  t
2 w' G+ X! G. z- C
(defun c:iit (/ pt str pta ptb ptc ptd X Y X1 Y1 rmsz pl1)$ n! D7 F3 L+ w. b  t6 R
  (setq oer *error* *error* err2)& B3 X8 R. u, P1 ^, s
  (if (not h_text) (setq h_text 250)) ; Kích thuoc chu mac dinh là 2.5
2 M1 ~+ S$ A' K. |- k: D: d8 M/ ^* Z# ~0 l
  (setq ht (getreal (strcat "\nNhap chieu cao chu <" (rtos h_text) ">: ")))
  x) X2 D( y3 \- `: Z* `+ V8 M3 A% q+ L: s; D/ B
  (if ht (setq h_text ht))/ C( e) j  H& H, `3 {2 X

; b! U0 k0 ?3 b. s6 n; \4 y9 a9 P+ A8 t7 v
(setq ang (getreal "\nNhap goc nghieng moi (do) <0>: ")), @) t! S, l1 O

5 Z/ _+ F" M8 U" N% y6 ]3 F      (if (not ang) (setq ang 0.0))& A9 S+ s; a4 g& k! ~! s6 M

, P) P, y3 E( Z- |  d
& y) H6 [2 g) t7 y( M4 z9 ?! P9 A$ S" O  W$ l0 i7 A
(setq pta (getpoint
& E7 }2 q3 k7 b8 \$ ]    "\nPick first corner. : "))8 f% |4 h- H3 o' X  z2 J; U* j  K
  (setq pt (getcorner pta
5 Q: T& [9 @4 ?4 g9 `    "\nPick second corner. : "))0 \: j) l- Z1 b5 }" l
& I9 d  C0 ~# T7 K( ^
' w) \& y1 ^0 u& b- U$ M
  (command "TEXT" "j" "M" "4700,2575" "0" (SETQ pt ' "Hå S¬ ThiÕt KÕ Nhµ D©n Dông Quy M«") ) (princ)/ r% S% t6 V9 q# y% _! \9 M

! h1 _8 x0 Y' I: _( U) z% l  (command "TEXT" "j" "M" "4700,1325" "0" (SETQ pt ' "2 TÇng 1 Tum Thang") ) (princ)
. }* L  N1 C! }2 _
' M; E' A" }4 r7 A9 a. o- `  (command "TEXT" "j" "M" "10600,2850" "0" (SETQ pt ' "Chñ Tr× :") ) (princ)) R1 l% d  @  |" _

& l3 }9 W+ V  D* p0 R7 C& ?  (command "TEXT" "j" "M" "10600,1100" "0" (SETQ pt '  "TrÇn Ngäc Th¾ng") ) (princ)
) O5 ~% |- y/ V
3 J7 E, R9 F/ e( e5 ~9 V0 t, F  (command "TEXT" "j" "M" "15250,2575" "0" (SETQ pt ' "H¹ng Môc :") ) (princ); V* t( \$ q' ]9 W

4 u0 T+ }$ ~2 a  (command "TEXT" "j" "M" "15250,1950" "0" (SETQ pt ' "Nhµ ë Gia §×nh . Nhµ LiÒn KÒ") ) (princ)9 J) x- ?4 N: N, u- C6 k

6 P1 x1 F" x7 b, R0 |$ \  (command "TEXT" "j" "M" "15250,1100" "0" (SETQ pt ' "Tel : 09.76.89.12.94") ) (princ)! d. L. h- A( F* l9 ~
' u$ A. O+ N, q0 `, @
  (command "TEXT" "j" "M" "20250,2850" "0" (SETQ pt ' "ThiÕt KÕ :") ) (princ)0 N* w; i5 f( O- E
( @: _% `7 ^8 F, l. i
  (command "TEXT" "j" "M" "20250,2300" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)
, W! {7 l4 @) a& W6 w+ `% J  q; k% ^( d4 O2 {, _( W5 q& X
  (command "TEXT" "j" "M" "20250,1600" "0" (SETQ pt ' "KiÓm Tra :") ) (princ)6 r+ ?0 [* }# N+ H0 O+ N$ D
# ^4 q; c+ F1 _
  (command "TEXT" "j" "M" "20250,1100" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)
- X7 a0 ~8 q6 s+ ^4 |
$ x0 J: Z' D! E  (command "TEXT" "j" "M" "23500,2850" "0" (SETQ pt ' "TØ LÖ :") ) (princ)
5 K( G0 p! p* V$ G( r" w! C7 V2 D0 B$ A% K) h. |6 A
  (command "TEXT" "j" "M" "23500,2300" "0" (SETQ pt ' "1:75") ) (princ); D8 l5 h- g7 W

* k9 N5 J! d+ F6 j* d9 L. V( u  (command "TEXT" "j" "M" "23500,1600" "0" (SETQ pt ' "Ngµy :") ) (princ)
% F! x! A* F% T+ J: ]6 `+ w" ^. y; c: b, ?1 A( f& `
  (command "TEXT" "j" "M" "23500,1100" "0" (SETQ pt ' "2026.07.02") ) (princ)
  W2 k: k9 l2 O0 n1 y; L, B3 t/ M6 E( D
  (command "TEXT" "j" "M" "26750,2850" "0" (SETQ pt ' "Tªn B¶n VÏ :") ) (princ)
! s1 z5 V" b1 J: f0 N( s1 D3 K1 N- \" W$ t$ _
  (command "TEXT" "j" "M" "26750,2300" "0" (SETQ pt ' "MÆt B»ng TÇng 1 + 2") ) (princ)3 P5 \+ x7 I( U# @; O6 d  Z& t
  ?1 Z( _8 ^8 K  m# ^" b3 t
  (command "TEXT" "j" "M" "26750,1600" "0" (SETQ pt ' "Ký HiÖu :") ) (princ)* s2 \9 q8 S3 o+ U' C
& O8 @  W6 h3 b
  (command "TEXT" "j" "M" "26750,1100" "0" (SETQ pt ' "KT-01") ) (princ)
# J9 e# D( n4 M% p" R& ~: A3 n) M- p, U) k& o
  (setq ptc (list (car ptb)(cadr pta)))
+ k- e, C+ l4 `: |6 |3 U8 Z+ ]  (setq ptd (list (car pta)(cadr ptb)))
6 `5 [" L5 E$ [1 ?0 n7 L' b9 X  (setq ang (angle pta ptb))& h) f% y( o! Z  Q3 `2 Z( i
  (setq d1 (/(distance pta ptb) 2))6 O$ I$ m3 G' M5 Y
  (setq cp (polar pta (- ang (dtr 0)) d1))
  F, G, f" L5 W8 k) T  (setq X (distance pta ptc))
! t: B. C. J/ u# \) V: }  (setq Y (distance pta ptd))4 J4 w/ A! u5 ]) r3 r
  (setq X1 (rtos x 2 1))
8 d. p: Z& g' `, z; u6 {  (setq Y1 (rtos y 2 1))6 c! H1 D- }. z8 ~
  (setq rmsz (strcat "(" X1 " x " Y1 ")")): J7 C3 o+ j; g, n2 p8 ]. O' Q
  (command "TEXT" "c" cp "0" CPT "_text" "" rmsz))
1 W% z) `. x* g/ c5 w+ Q/ m2 w% }; D  (defun dtr (angg)7 K3 {1 u: Q. Q! @$ x1 m
  (* pi (/ angg 180.0)))8 M, B" \" m5 i% q4 }! P# {- E
" n$ Y7 d" z6 ~/ q
;;; ============================GHI CHU Khung Ten========================) H/ b) \3 b, s. R
;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========
6 h# q& E" w7 W8 l7 A;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 ====================
% l! J0 C' l( J. F4 w;;; =======================Thuong Dung Font Romant.vnh===================" `3 o9 h' C+ q
% {6 `' Q0 E/ u; L5 }" c
(defun c:ipt (/ pt str pta ptb ptc ptd X Y X1 Y1 rmsz pl1)
( O+ y' }+ q( K4 U/ e' Q  (setq oer *error* *error* err2)
# R: O; O) ]& x7 v" j! ^  (if (not h_text) (setq h_text 250)) ; Kích thuoc chu mac dinh là 2.5' ]0 L, t- U* c/ w) `' F/ N
4 U! E5 Y2 ^& ]7 Y6 s; [
  (setq ht (getreal (strcat "\nNhap chieu cao chu <" (rtos h_text) ">: ")))% l  T% w" Y; z+ a
6 w7 u' N) B  G% A0 `! \9 r' O; ]1 F
  (if ht (setq h_text ht))' V7 ~' [9 b( h
; n6 b$ K/ _# a+ V; g  v$ a

! J: A8 o' D( o0 p3 s(setq ang (getreal "\nNhap goc nghieng moi (do) <0>: "))% `0 t) ^( n& s/ F* W: ?

. T: v) v, Z; I+ u: V+ j: n      (if (not ang) (setq ang 0.0))
6 N3 V' {8 O' P- _- }8 _! J5 b. ]
4 I8 q, D; t! e5 ^& n$ |2 P& R

( b; b  \9 B/ b3 h4 A% v (setq pta (getpoint! Q+ W1 P, Q' S) F( c" t
    "\nPick first corner. : "))+ p$ E: d- a4 S) M4 |. b
  (setq pt (getcorner pta
2 y2 f# z# a" _1 T    "\nPick second corner. : "))* S- K2 \8 y- p* G
3 x6 L& c2 s0 S0 Z
8 N$ n5 Q0 E( F  }$ ]1 u
  (command "TEXT" "j" "M" "5450,2575" "0" (SETQ pt ' "Hå S¬ ThiÕt KÕ Nhµ D©n Dông Quy M«") ) (princ)* Y- A( g8 M/ D1 i; D5 m: u

. x3 u/ K3 k( i  (command "TEXT" "j" "M" "5450,1325" "0" (SETQ pt ' "2 TÇng 1 Tum Thang") ) (princ)
1 k  R7 q- z, d/ s" j
- P: N, B/ u8 ~' }  (command "TEXT" "j" "M" "10600,2850" "0" (SETQ pt ' "Chñ Tr× :") ) (princ)
5 J0 @9 X+ R- c( Y9 h" O0 @! I2 X0 I/ }3 S) G+ n: |* K: f& g
  (command "TEXT" "j" "M" "10600,1100" "0" (SETQ pt '  "TrÇn Ngäc Th¾ng") ) (princ)5 C: k; R$ B) m' u4 J

3 {, E+ G, p3 ?( V  (command "TEXT" "j" "M" "15250,2575" "0" (SETQ pt ' "H¹ng Môc :") ) (princ)
& p+ F: j; m! j/ t  X! D7 n/ f' @1 L2 F  u' m2 O# E# K
  (command "TEXT" "j" "M" "15250,1950" "0" (SETQ pt ' "Nhµ ë Gia §×nh . Nhµ LiÒn KÒ") ) (princ)
+ q: s& w; B7 @$ y; t5 ?: y- V& O$ J' ~' D4 q0 _3 H2 O# I
  (command "TEXT" "j" "M" "15250,1100" "0" (SETQ pt ' "Tel : 09.76.89.12.94") ) (princ)
1 f0 {8 B4 |! b& y3 Z; d3 @
- s* X# B0 i1 `, |  (command "TEXT" "j" "M" "20250,2850" "0" (SETQ pt ' "ThiÕt KÕ :") ) (princ)$ n8 W! n4 N$ ^4 \! o9 u; s5 w, ]6 f

6 r; g$ t# O: c' W$ ]- _  (command "TEXT" "j" "M" "20250,2300" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)
  g  [2 R: }7 _- d9 g2 S/ J9 X7 u. \& m, ^- @: |- h6 A3 ^
  (command "TEXT" "j" "M" "20250,1600" "0" (SETQ pt ' "KiÓm Tra :") ) (princ)
2 a' \" J( I7 C( R
/ M6 P1 _+ Y8 o3 N( v* ]- H  (command "TEXT" "j" "M" "20250,1100" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)
8 ^. P3 A& B9 [$ F5 v5 r1 Z6 Z! l, p4 l  K) X" r
  (command "TEXT" "j" "M" "23500,2850" "0" (SETQ pt ' "TØ LÖ :") ) (princ). r+ L: }- F6 n7 i- C( d
- @4 k3 A* B6 _( ^5 {+ k7 R: J
  (command "TEXT" "j" "M" "23500,2300" "0" (SETQ pt ' "1:75") ) (princ)
4 e  l. c" e6 {) t& _& q+ I: T2 Y: C2 v! z0 w- R+ n) K6 D* v" U
  (command "TEXT" "j" "M" "23500,1600" "0" (SETQ pt ' "Ngµy :") ) (princ)
7 Q( J8 \) N" I' u0 z4 r: L( S+ \: |8 ^2 m/ Z# P8 A1 M9 i, F: j" a
  (command "TEXT" "j" "M" "23500,1100" "0" (SETQ pt ' "2026.07.02") ) (princ)  g2 D7 a: T* B8 z' x
/ n& ^$ ~0 A9 E7 O: z0 I( J+ }
  (command "TEXT" "j" "M" "26750,2850" "0" (SETQ pt ' "Tªn B¶n VÏ :") ) (princ)6 z% z0 x" U% A& @7 s* M' T

8 N  j: j) O" c  (command "TEXT" "j" "M" "26750,2300" "0" (SETQ pt ' "MÆt B»ng TÇng 1 + 2") ) (princ)9 P2 y& u% M. @! s

2 z/ }) Q. `4 o& @+ h3 P  (command "TEXT" "j" "M" "26750,1600" "0" (SETQ pt ' "Ký HiÖu :") ) (princ)
7 i7 w$ W+ c9 A- M% z
# o  S0 W( B& H3 H& Y. p8 m  (command "TEXT" "j" "M" "26750,1100" "0" (SETQ pt ' "KT-01") ) (princ)
! d; o: P. R1 U- s  l
+ {7 q. k6 o- j  (setq ptc (list (car ptb)(cadr pta)))
1 p. g0 a' _# {, j1 a  (setq ptd (list (car pta)(cadr ptb)))
2 O3 V7 T, z, G7 V  S! w9 A8 M  (setq ang (angle pta ptb))
4 g: h. S* [9 D6 D+ t0 X( l! P' _/ l  (setq d1 (/(distance pta ptb) 2))" T) {, w/ j0 }" D& i: |9 z, E
  (setq cp (polar pta (- ang (dtr 0)) d1))7 ?$ M+ {8 E+ t! z9 u5 u
  (setq X (distance pta ptc))7 \  ~" B! b( U
  (setq Y (distance pta ptd))
8 f' r- ^* Q; r  (setq X1 (rtos x 2 1))
( Z/ L& `- m6 D3 G  (setq Y1 (rtos y 2 1))
/ P  S6 a4 W% l  j7 S  (setq rmsz (strcat "(" X1 " x " Y1 ")"))
0 m+ q: ~; m9 n' Y  (command "TEXT" "c" cp "0" CPT "_text" "" rmsz))
1 ?0 U# D3 ?0 \3 d6 y" v4 p  (defun dtr (angg)
5 p) g! y2 g3 d% q  (* pi (/ angg 180.0)))
  o* J! F' e. {% C+ i  ^/ W: `: H0 }% U+ [6 O. P$ C0 X
;;; ============================GHI CHU Khung Ten========================
8 n: I" }' L( h; j5 N;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========
, ^( f# m, {* H3 A$ E$ O6 Y;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 ====================
' C/ \, q  s- H/ S& a;;; =======================Thuong Dung Font Romant.vnh===================
; M8 i* e* X/ }) m' g) P  [! |4 L7 `& N9 m
(defun c:iza (/ pt str pta ptb ptc ptd X Y X1 Y1 rmsz pl1)- y) ], C! J9 X5 q+ O
  (setq oer *error* *error* err2)
" y+ ~" U% x8 a6 G1 I! }/ p3 l  (if (not h_text) (setq h_text 250)) ; Kích thuoc chu mac dinh là 2.5( z' y, U) r% \' E% y$ F
( w0 P2 f  I2 A  C
  (setq ht (getreal (strcat "\nNhap chieu cao chu <" (rtos h_text) ">: ")))& M1 v- F8 I) [, n* B1 @
+ x! M* U2 {; V  I/ ^7 f: Z
  (if ht (setq h_text ht))
3 @+ b5 w8 P4 Q( c' p
8 S2 m- f( s5 a) \2 m3 n+ s7 A6 f2 D6 Z- I" i
(setq ang (getreal "\nNhap goc nghieng moi (do) <0>: "))! R/ [# u. U+ u6 s! E, m, T
8 ?2 W' o2 _6 l0 G+ n9 I7 B) }
      (if (not ang) (setq ang 0.0))
8 t5 x6 n) g, W4 {6 [
1 U6 J" e7 {4 c1 v* w; ^5 B4 F. c0 L! R8 C
5 }. W% _. z9 D
(setq pta (getpoint
! j6 e  n$ a; v  O: N    "\nPick first corner. : "))4 P! L) x/ L  G# `: m
  (setq pt (getcorner pta, f$ j1 e! V. L1 `: q/ Q
    "\nPick second corner. : "))
& [& g$ U. H$ _( g: ^5 Z$ x9 ~1 B0 P: X7 u

  s. y! s4 Z1 z0 b3 G: K' j* U
4 `5 ~1 |# C4 u. t  }  (command "TEXT" "j" "M" "25000,19800" "0" (SETQ pt ' "STT") ) (princ). W0 M" E, V7 X9 I( P4 _
+ p% @9 t( j/ u1 w9 T
  (command "TEXT" "j" "M" "25000,18712.5" "0" (SETQ pt ' "1") ) (princ); g1 \  ]$ I2 Q1 \, ]! y: ?

. q' Y; |# V6 m" x  (command "TEXT" "j" "M" "25000,17537.5" "0" (SETQ pt ' "2") ) (princ)6 ?2 g1 p  O5 k- k5 z4 O

  P6 v/ m7 x# o" q7 @) H
# `# o( [0 }# A. z: s5 z! R4 Z$ t  (command "TEXT" "j" "M" "27250,19800" "0" (SETQ pt ' "Ngµy Söa Hå S¬") ) (princ)
# o, I( o2 m9 Z8 h. ]- R
9 u0 h+ C, H1 P$ g) Y. l  (command "TEXT" "j" "M" "27250,18712.5" "0" (SETQ pt ' "15.05.1997") ) (princ)& Y" y1 ~# l" N3 M
0 j, V( G" n2 B" e, b3 T
  (command "TEXT" "j" "M" "27250,17537.5" "0" (SETQ pt ' "04.07.2026") ) (princ)
! A5 y/ u3 L" e; H2 H% ?/ b' N
- A% F9 T) v1 d. s1 i
# t; d. c- }; S$ x5 @  (command "TEXT" "j" "M" "26750,16600" "0" (SETQ pt ' "C¤NG TY - Corporation") ) (princ)
. X6 P7 y* i* s% z# @% ]3 m5 V1 `8 |  z! r8 g0 T% [
  (command "TEXT" "j" "M" "26750,16016" "0" (SETQ pt ' "ZENNI.S.Z.T.K") ) (princ)/ p- T* n! ~( @& `) e

9 d/ }- J. ]) B  (command "TEXT" "j" "M" "26750,15433" "0" (SETQ pt ' "§Þa ChØ C¤NG TY") ) (princ)
" l, }+ D1 S; ^# u6 m/ c0 }& L9 |, e# K* }9 ~, R6 z1 I
  (command "TEXT" "j" "M" "26750,14850" "0" (SETQ pt ' "§Þa ChØ : 00.00.00.00.00") ) (princ)
5 |; Z  _. y+ e( M/ V
2 i) n& I  K6 }2 j0 o# i3 s& P7 R. I. z$ h# F8 A: X
  (command "TEXT" "j" "M" "26750,14100" "0" (SETQ pt ' "H¹ng Môc : Part Project") ) (princ)
  z2 |4 N1 G' k: F4 Q$ W' i( B" @9 m- e) D2 S! |
  (command "TEXT" "j" "M" "26750,13516" "0" (SETQ pt ' "Nhµ ë Gia §×nh") ) (princ); m  D# P. P! f# A6 ^2 ~

+ B. ~3 ^$ B" i  (command "TEXT" "j" "M" "26750,12933" "0" (SETQ pt '  "Nhµ LiÒn KÒ") ) (princ)
' N5 T# l( w. s: X9 A1 q7 ~; x
3 [1 g" t& K# z4 o6 I  (command "TEXT" "j" "M" "26750,12350" "0" (SETQ pt ' "Tel : 00.00.00.00.00") ) (princ)' A" b- D6 V; O5 u' Y: g5 X
( |3 A3 ?) z3 z$ h7 U, d- o

; ]2 D1 f2 I* m3 u  (command "TEXT" "j" "M" "26750,11600" "0" (SETQ pt ' "Gi¸m §èc : Director") ) (princ)& c. }* v4 ?) l( h* ?7 u1 {
$ C$ d# k. `2 k5 ^" Z' J* W! \& F
  (command "TEXT" "j" "M" "26750,10475" "0" (SETQ pt ' "ZENNI.S.Z.T.K") ) (princ)& p) Z' V3 L& k; G; {: I- Y; H( L8 I

! E- K0 L' }6 n  X- Q- E$ A+ u  (command "TEXT" "j" "M" "26750,9725" "0" (SETQ pt ' "Chñ Tr× : Main Project") ) (princ)% n+ P- U9 O" P
* i& p* Z' Q; S$ R! x% M2 J! W9 E
  (command "TEXT" "j" "M" "26750,8600" "0" (SETQ pt '  "Kts. TrÇn Ngäc Th¾ng") ) (princ)$ ^# T& A0 s5 W3 ?
/ y* ?9 B; J  @$ T
  (command "TEXT" "j" "M" "26750,7850" "0" (SETQ pt ' "ThiÕt KÕ Vµ VÏ : Design") ) (princ)4 T/ t7 _( ~+ _+ x- o

( T: R  \! j6 U/ X! e  (command "TEXT" "j" "M" "26750,6725" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)5 `4 R3 B4 O" T. n* I) [3 a

% i1 d; b6 a9 t0 L0 a- H  (command "TEXT" "j" "M" "26750,5975" "0" (SETQ pt ' "KiÓm Tra : Checking") ) (princ)
6 a5 e3 J  m4 w1 q1 i" Z% A' u
2 ]$ t* c# r5 K' }5 T+ ~  (command "TEXT" "j" "M" "26750,4850" "0" (SETQ pt ' "Kts. TrÇn Ngäc Th¾ng") ) (princ)) P" o( W  a7 ~5 U3 Q* s

+ J9 Z( e& h# W1 E& n, Q( U4 j
# X- @* Y: @- d- ^9 G
2 |* I$ z5 I$ g; ~: i. E  (command "TEXT" "j" "M" "25625,4100" "0" (SETQ pt ' "TØ LÖ-Khæ") ) (princ)6 |& Q* g* s# B8 h, n/ M

5 j4 G( n( Y; V8 ^  (command "TEXT" "j" "M" "25625,3600" "0" (SETQ pt ' "1:75 - A4") ) (princ)2 X4 X$ N- u) V3 J- K

3 E! S9 ]8 r3 H5 J) q# w  (command "TEXT" "j" "M" "27875,4100" "0" (SETQ pt ' "Ngµy Xong :") ) (princ)
- u$ ]" v) I$ n$ v. M7 K
7 S* ^" c3 @1 q  (command "TEXT" "j" "M" "27875,3600" "0" (SETQ pt ' "2026.07.04") ) (princ)" Q  {) Z- X( w& O! {  ]( Y% C
4 T- ?4 _( K6 U" q+ b5 H" Y
  (command "TEXT" "j" "M" "26750,2850" "0" (SETQ pt ' "Tªn B¶n VÏ :") ) (princ)
9 V. Y: y& C, M- \# y6 E% O4 k
! ^8 F  _  w% v7 y. v  (command "TEXT" "j" "M" "26750,2300" "0" (SETQ pt ' "MÆt B»ng TÇng 1 + 2") ) (princ)! k% _& N9 {5 n+ c7 m+ j3 w

9 Q' U+ u$ [& c  (command "TEXT" "j" "M" "26750,1600" "0" (SETQ pt ' "Ký HiÖu :") ) (princ)6 }9 S; H7 v3 X2 z) ?" _1 n
! F. Y! V9 S- b
  (command "TEXT" "j" "M" "26750,1100" "0" (SETQ pt ' "KT-01") ) (princ)
/ F# I6 e8 E) Y- @
) k% j+ v6 b0 X; Q9 [  (setq ptc (list (car ptb)(cadr pta)))
0 ~1 u1 ]% G6 t3 M  (setq ptd (list (car pta)(cadr ptb)))
9 P& z# E) `& v- K/ R, ~  (setq ang (angle pta ptb))  I8 h& ]" c6 F* y) C
  (setq d1 (/(distance pta ptb) 2))$ e: C2 _8 F$ \% t; N
  (setq cp (polar pta (- ang (dtr 0)) d1))
6 I. I2 G4 k5 C' P  |) P3 l  (setq X (distance pta ptc))
+ X  Y8 G  K9 q* z- I% N3 K  (setq Y (distance pta ptd))' V% H2 r1 r4 a6 y2 [' E
  (setq X1 (rtos x 2 1))- ?6 o- C$ X: o5 L! g( v: Q  d: q: i
  (setq Y1 (rtos y 2 1))% b* G# m  O' i. x6 X9 C
  (setq rmsz (strcat "(" X1 " x " Y1 ")"))) V% }9 @: p' e8 V9 t1 N
  (command "TEXT" "c" cp "0" CPT "_text" "" rmsz))7 d1 p2 r) j0 _  B
  (defun dtr (angg)
  C8 l9 Y. Z, U* E+ T  (* pi (/ angg 180.0)))6 _; C& [5 n+ N" u. L7 A5 j
( T! j0 f3 S6 ~' p2 x
;;; ======== Phai Vao STYLE Tao LAYER Ten TEXT + Phai Dat Height ========
% x! U  s" T1 z& v; J;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 ====================
/ K2 Z. D$ ~2 B  };;; =======================Thuong Dung Font Romant.vnh===================
2 F* L# P5 G2 }$ e$ b% H" U  {
/ i  W/ B& A5 g' A6 m. ?(defun c:pta4 (/ pt str pta ptb ptc ptd X Y X1 Y1 rmsz pl1)
0 o; F* Q8 E8 ^4 b$ ?  (setq oer *error* *error* err2)
% E3 X/ l2 H- x2 g  (if (not h_text) (setq h_text 250)) ; Kích thuoc chu mac dinh là 2.5
2 W# `/ L" D( Z0 X9 V
+ U  Z( z5 M% ?, f2 `  (setq ht (getreal (strcat "\nNhap chieu cao chu <" (rtos h_text) ">: ")))0 Q' w; ^: P% m! x) y( c: P: {  a: o, b
& J- e0 i0 v0 T$ B" h( x
  (if ht (setq h_text ht)), B  t- z0 L/ e# h% x& m

% V1 _. J$ @5 o" \! q
5 l2 O; c/ k+ ?4 s8 y1 R5 m" T(setq ang (getreal "\nNhap goc nghieng moi (do) <0>: "))
2 j0 z  f6 Q! \6 k! G. V' Z) x3 ?. N+ m2 `' o3 X
      (if (not ang) (setq ang 0.0))
0 b- S  q8 e5 G5 @
2 {% O$ c* r7 y2 r5 d7 a7 K7 Y# g- p4 U5 o
7 y) t" n9 L) R$ z# [  m' v
(setq pta (getpoint
( A9 ~$ g8 r2 k, I+ p6 v    "\nPick first corner. : ")): r3 K# T) S1 J, q! R: k2 M7 n
  (setq pt (getcorner pta+ r/ G! p$ ~5 [5 v) D
    "\nPick second corner. : "))
& D) d  V+ N/ Q& |; M$ S& |8 M) s6 `! P9 ^
' a0 t& ]1 m* O: o& `! D+ B* v
  (command "POINT" "4700,2575" ) (princ)+ W' e3 E% |; Y' c
, {" G& U7 W) W
  (command "POINT" "4700,1325" ) (princ)5 b$ p$ i9 K8 S$ j! b' E

) q& u/ D5 O* X2 U" q  (command "POINT" "10600,2850" ) (princ)
* s; z& e2 Q) J* I4 u8 O, V5 c/ f% a8 W" J- x* @% d: L# z
  (command "POINT" "10600,1100" ) (princ)
1 A9 I+ L# \* l6 ~! f0 J( i8 Q
: w6 L+ v% f- b. ~" b# u/ n  (command "POINT" "15250,2575" ) (princ)2 J; _- J  Z6 A: m

/ s- `& _& A+ i; ]  G% L! l  (command "POINT" "15250,1950" ) (princ)
; j( j' H: X, k' |& l  s/ x' e9 F2 i$ E& S# t
  (command "POINT" "15250,1100" ) (princ)+ K0 u5 b  y) R. H* B$ @1 y

$ T6 K) `9 ?) C$ Z+ x0 k  (command "POINT" "20250,2850" ) (princ)
. k2 J. L* ^3 j. z
+ z2 y, G& @; N: d  (command "POINT" "20250,2300" ) (princ)  w, x' D, u% u. B) `+ W% q# Q
9 w2 L9 _9 j5 K
  (command "POINT" "20250,1600" ) (princ)
; I$ b/ u  b7 S+ v6 c. O. T
5 p- r% |! O0 S3 G( \4 e  (command "POINT" "20250,1100" ) (princ)
7 V( T. E: L) o" B8 S- J. ~8 e. E3 _' c5 ]* y2 x8 d7 e  q
  (command "POINT" "23500,2850" ) (princ)
8 T3 P8 n1 P& l. \4 R% Z. q) d6 R
  (command "POINT" "23500,2300" ) (princ)
" k" D* ]0 O2 N6 s, w; ?
% C6 O! }& d. y9 W  (command "POINT" "23500,1600" ) (princ)0 D/ H% n  y# P* r1 a

7 U' |9 Y( f5 ?7 n0 d: E  (command "POINT" "23500,1100" ) (princ)& v4 ~/ @$ Q7 ?" V
5 ], X, Z6 o- l  c0 p( S' Y
  (command "POINT" "26750,2850" ) (princ)
; e7 S7 C2 a8 S! H% d: ^$ Y
/ [! o* h$ J& V, c  (command "POINT" "26750,2300" ) (princ)9 u9 ]% @2 m) g8 K( M
3 I! Z; `. C& S! _: F
  (command "POINT" "26750,1600" ) (princ)" i3 r$ P9 P7 \
+ Y5 U( Z, i# h1 q8 g8 n' S
  (command "POINT" "26750,1100" ) (princ)
  i6 F1 K1 Z5 ~/ ]" Y  o3 `2 _
# O' K6 P0 ~+ [" X+ O3 w2 _  (setq ptc (list (car ptb)(cadr pta)))6 f# w$ r- p3 I, q
  (setq ptd (list (car pta)(cadr ptb))): t  ~9 c8 @$ C" T. b
  (setq ang (angle pta ptb)). e4 w7 t( A; L$ `( q
  (setq d1 (/(distance pta ptb) 2))) k/ l% ]( [+ V6 `- i
  (setq cp (polar pta (- ang (dtr 0)) d1))
9 X4 @4 t; U: V6 P1 M! c  (setq X (distance pta ptc))
, y, x7 G# W$ q" d7 Y  (setq Y (distance pta ptd))
- J# R4 T* M) {+ H$ s  (setq X1 (rtos x 2 1)); t& Z- l4 T, c+ w5 X
  (setq Y1 (rtos y 2 1))
1 ~" h/ x' n! \2 l, K$ K; R  (setq rmsz (strcat "(" X1 " x " Y1 ")"))
0 L- Q/ r' d/ x8 ~2 t% m  (command "TEXT" "c" cp "0" CPT "_text" "" rmsz))
$ S  X; K6 L% G* U  (defun dtr (angg)3 z' b* R5 c" f9 c; Y7 R
  (* pi (/ angg 180.0)))# @% X) C/ Z7 {* I) X. r6 ]0 N

3 V4 T( X6 g, O. C- L- w;=====================================================================. K( ^7 d# r. T4 R+ O
;====================DAT KHO GIAY BAN VE - KIEU 1=====================
! p# \' Z- F( r& T- N0 s;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================/ U' x0 f8 H3 A0 s5 q* R
  I2 d6 O3 S! |8 c0 N0 b
(Defun c:a6 ()
' V- E: d" k, R+ n7 T; o; s: G        (setq mv_sc 100);Ti le  ban ve
9 a' {; i3 o) r$ s# d# v( m      (setq x4  74.25)
5 D& s; N) @: O      (setq y4  52.5)- A& ]! s) k" M& K3 R. ]" M
  (setq x4 (* mv_sc x4)
. K% p% r7 Q8 D. Q( h        y4 (* mv_sc y4)  ), ^) v' O' c6 z" Z8 J( p
  (command  0 Q2 b+ w7 c& H" Y* {& ^
    "LIMITS" "0,0" (list x4 y4)
3 g+ \( N* i8 P; b  m! w& {    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
; t, x. C( E! _& `    "RECTANG" "125,125" "@7175,5000"6 n& @! Y2 {: H' _8 ~
    "RECTANG" "175,175" "@7075,4900"
- U# H- h, v4 }    "ZOOM" "_a"  )); G+ x8 W" b7 z* N
;=====================================================================
1 U1 p$ g6 t  i(Defun c:a5 (). }/ H2 P& r& O5 t; O  n5 \
        (setq mv_sc 100);Ti le  ban ve
# |% j$ S* {% p) F) B      (setq x4  147.5)# o& U3 N( s$ h. V  d/ _
      (setq y4  104)
/ l& X+ }; B7 r& v7 k5 m  (setq x4 (* mv_sc x4)
% s. e. `, U% E8 F+ J4 F2 K        y4 (* mv_sc y4)  )8 m1 E) r" L8 K  _2 N6 V
  (command  ' b9 ~' [( U0 Z- r5 |) C0 H3 w8 ]
    "LIMITS" "0,0" (list x4 y4)
, Z# \/ S8 @$ l; \! r    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"9 y, W0 v# Y- \7 d: H
    "RECTANG" "250,250" "@14350,10000"
, L& A% z4 V" A    "RECTANG" "350,350" "@14150,9800"  G6 ?) t- X) G! k* Y: Q! _
    "ZOOM" "_a"  ))
/ |6 l' w" X' i$ m9 i* w2 S& L;=====================================================================/ i4 v/ ~1 ~; Q) W
(Defun c:a4 (), I: {( I7 [! \3 H
        (setq mv_sc 100);Ti le  ban ve9 l4 c; ]+ L  b) y
      (setq x4  297)- g$ R* S% C: m& Z. @
      (setq y4  210)) X  Q* \3 A- r0 g& Z* U
  (setq x4 (* mv_sc x4)
0 h8 V2 z$ ]2 y# n3 {        y4 (* mv_sc y4)  )# {4 j7 r; m6 d+ c8 m9 U! j9 G/ t$ w
  (command  
$ {1 ]1 a+ h  P. W$ L7 t    "LIMITS" "0,0" (list x4 y4)
; g) Z; `! S3 B, b- h    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
0 L8 O# P2 t8 W+ f    "RECTANG" "500,500" "@28700,20000"1 i& K1 N7 O$ H* X" P5 N6 Y
    "RECTANG" "700,700" "@28300,19600"
/ l- c- |$ F3 p# `" R' {    "ZOOM" "_a"  ))
! Y! i  d" j4 }! O6 f' I;=====================================================================5 E4 U; @* ?7 j4 t
(Defun c:a3 ()
) W$ l& K2 C" Q4 e9 D        (setq mv_sc 100): M7 g8 d3 z- `( O3 W5 W2 a+ _
      (setq x3  420): H/ g4 ], w: F) G
      (setq y3  297)- r: c+ Y7 }0 B
  (setq x3 (* mv_sc x3) ) s. x8 s2 G7 ^2 {0 d0 C, o
        y3 (* mv_sc y3)  )% N2 s) }* r* }
  (command  
! L3 u- H9 N: e2 N0 @. K9 a    "LIMITS" "0,0" (list x3 y3)
) W5 A$ w, O6 ]' {) L) ]/ s, i    "PLINE" "0,0" (list 0 y3) (list x3 y3) (list x3 0) "0,0" "_C"
% v; Q9 a3 c+ L$ ]1 S2 o2 Z0 G# H1 O    "RECTANG" "707.14285714,707.14285714" "@40590,28285.71428571"
" _! f7 q4 x- \; P9 ~* M8 q    "RECTANG" "990,990" "@40024.28571429,27720"9 |; D7 i# g7 ], A6 I' f
    "ZOOM" "_a"  ))
7 Y1 c4 M$ A9 O& I;=====================================================================
1 `9 x; `' E  h. a$ w$ K1 b6 j(Defun c:a2 ()
/ R. _  u+ P$ f/ ]0 s! q        (setq mv_sc 100)# @# N& I, V5 w& O2 G; _2 Q
      (setq x2  594)
# \# i; H# {  m, ~& z( ^0 e% |" N      (setq y2  420)+ U7 z$ r" O0 v7 @  W
  (setq x2 (* mv_sc x2) 0 B+ }% n0 R3 }& H. l0 j
        y2 (* mv_sc y2)  ). {1 P0 Q9 z6 i% u; @# X2 b7 i3 G
  (command  ; l. j. K3 j* u; Y2 \5 j+ r
    "LIMITS" "0,0" (list x2 y2)8 ~" C; k( _! X+ v4 u  j$ U
    "PLINE" "0,0" (list 0 y2) (list x2 y2) (list x2 0) "0,0" "_C"( e. L- k  t% e, L# ~- \
    "RECTANG" "1000,1000" "@57400,40000"
% X" g1 Q0 I1 x3 V" j3 b) I/ y    "RECTANG" "1400,1400" "@56600,39200"
3 b: f+ a& u) T8 w& \+ T3 D    "ZOOM" "_a"  ))
; J1 h" d5 G! E/ |$ T8 K& F8 A;=====================================================================
+ J8 Z# d+ D' x0 S3 K(Defun c:a1 (): m& _+ V( k" a# Y
        (setq mv_sc 100)& E; Z4 T# U! |. m9 c- C& g
      (setq x1  840)
" R, i6 i4 C4 ?7 j4 F1 G/ d      (setq y1  594)/ h8 m& W2 i$ [( N
  (setq x1 (* mv_sc x1) * K  A( O% ^$ Z0 X! K0 l
        y1 (* mv_sc y1)  ), b( w+ O  a! p/ s- q$ ]
  (command  
3 `6 P2 J0 j8 h7 `6 f; R* _    "LIMITS" "0,0" (list x1 y1)' z7 @/ S4 i8 x) F' o/ O
    "PLINE" "0,0" (list 0 y1) (list x1 y1) (list x1 0) "0,0" "_C"( o; N: R0 F% R& `1 b: @: u( G& d
    "RECTANG" "1414.28571429,1414.28571429" "@81180,56571.42857143"
" |( n* L# P! i3 I; }    "RECTANG" "1980,1980" "@80048.57142857,55440"
: o8 [6 }( a* Y" @6 @" C7 b$ t) j    "ZOOM" "_a"  ))* b9 X% |) [$ o& H
;=====================================================================
( P" e2 q! R# `. h: @(Defun c:a0 ()
6 M' Y. `1 c! p6 U. R        (setq mv_sc 100)3 a3 O$ f! x; ?% z2 L! Y
      (setq x0  1188)
! l1 k1 _1 l5 n0 U+ J1 }      (setq y0  840)
& n9 o7 r& Y' n0 K/ D4 W8 _0 P% f1 K  (setq x0 (* mv_sc x0) 4 A. {- a/ X; b
        y0 (* mv_sc y0)  )& h1 S& I/ I3 K/ i' t4 b( W/ h" r
  (command  
( [# G2 k- u4 ]    "LIMITS" "0,0" (list x0 y0)
$ C' V( H  y$ O( u    "PLINE" "0,0" (list 0 y0) (list x0 y0) (list x0 0) "0,0" "_C"
( W3 K$ g# r0 m  h    "RECTANG" "2000,2000" "@114800,80000"
4 e4 u9 n  \5 m1 G0 j7 z    "RECTANG" "2800,2800" "@113200,78400"
- _; u, i' v( p8 T# Q! }6 v    "ZOOM" "_a"  ))/ D% s9 d  Z2 a& z: ?

* ?5 V! S9 R: s9 A" v;=====================================================================
( V/ a- ]( w% p0 `/ g;====================DAT KHO GIAY BAN VE - KIEU 2=====================
0 H  T0 S# e( a/ V- B;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================0 F) G# E; A+ }* {7 h$ ~
" ]) A& Z5 Q  W9 `* I
(Defun c:6a ()6 k- D0 I6 b+ E( `, ~0 y; F
        (setq mv_sc 100);Ti le  ban ve
  {' I, |& D) F# S+ Y      (setq x4  74.25)
  k5 g* C! Y1 |& d1 L, V+ t. v0 t      (setq y4  52.5)
$ A' ]6 N# `  c7 I9 P6 v& ?! N  (setq x4 (* mv_sc x4) . A* e  V/ V) q; o' j9 Z  {
        y4 (* mv_sc y4)  )
4 x; L% f' ^) k- W* c  (command  
, C, m/ E8 D* l    "LIMITS" "0,0" (list x4 y4)
# @5 x6 i" E* S, z( J% X0 t* i    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"
+ _7 w, C- `9 X! v% F    "RECTANG" "505,125" "@6800,5000"6 z' l2 j& L* c& p9 D
    "RECTANG" "555,175" "@6700,4900") B% D8 ]. V5 H/ E1 h
    "ZOOM" "_a"  ))* ]. [/ o% d/ c! S
;=====================================================================
4 B6 m. d& A/ [" `* C) A+ d(Defun c:5a ()0 A5 Y2 U' v/ R/ P& Q1 ^
        (setq mv_sc 100);Ti le  ban ve7 T; A  Z! @; K
      (setq x4  148.5)) a0 c- ^; f) O  t4 ?$ J3 C5 ?
      (setq y4  105)
/ w7 m9 H% Z* d2 V1 ]1 L$ `4 e  (setq x4 (* mv_sc x4)
% [9 B0 @5 |+ @4 P        y4 (* mv_sc y4)  ); q  [, ~- b. v, F. m6 o  C/ a; c
  (command  
$ ~5 x3 l: H1 G. h' s1 d& N    "LIMITS" "0,0" (list x4 y4)
+ n5 s7 e3 k' T7 O6 u9 {3 T' X! c    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"4 [1 m  l! }  [1 b/ G
    "RECTANG" "1000,250" "@13600,10000"; w2 q# T+ ?- L# F
    "RECTANG" "1100,350" "@13400,9800"
3 X3 y- k* `$ U; r5 s. Y    "ZOOM" "_a"  ))
% X% x3 S: F2 [0 ^) x/ \;=====================================================================
* R. v) ]. z. [& N# J(Defun c:4a ()
; @* u; X( l" V2 J9 w        (setq mv_sc 100);Ti le  ban ve
9 K7 A0 \5 B! C5 U+ O  t2 P) s! k" v0 r      (setq x4  297)% G8 D4 E" F2 r2 Y) S: i1 {5 R
      (setq y4  210)3 I' ^8 Q$ J9 s/ B4 u
  (setq x4 (* mv_sc x4)
* K- D. ]- p# E/ ]6 n" \: G        y4 (* mv_sc y4)  ), k# z6 z, w" \
  (command  : p* _1 ?- J- T" `& ?& O+ C
    "LIMITS" "0,0" (list x4 y4)
% V6 s7 l1 h! t* n  |7 @& ^# V    "PLINE" "0,0" (list 0 y4) (list x4 y4) (list x4 0) "0,0" "_C"8 l$ T- e+ V  [; G
    "RECTANG" "2000,500" "@27200,20000"- v. e; u2 V3 }% d/ I( L3 S
    "RECTANG" "2200,700" "@26800,19600"
  \  V. T. g, i' k0 l# e    "ZOOM" "_a"  ))2 Y% {- P; Z6 j/ v
;=====================================================================! }9 |! @. X( X7 Y1 I
(Defun c:3a ()
0 Q& w8 E7 _# l$ }- Y8 v# u        (setq mv_sc 100)
" O! t9 B$ I  A7 Y5 H      (setq x3  420.0428571429)$ [4 O% F& d) b; Z1 _
      (setq y3  297)
1 W9 n! i. a: A9 l1 n  E/ S  (setq x3 (* mv_sc x3) % H' U$ E* l4 q
        y3 (* mv_sc y3)  )& O3 u6 M9 t# P, r2 p
  (command  
. ^% J" }, ?& H  P: v3 d    "LIMITS" "0,0" (list x3 y3)$ Z; s3 ~/ s# l/ a3 s! a
    "PLINE" "0,0" (list 0 y3) (list x3 y3) (list x3 0) "0,0" "_C"4 o$ w% p# `/ Y( O2 c, v1 H! n0 D
    "RECTANG" "2828.57142857,707.14285714" "@38468.57142857,28285.71428571"! b* l8 x  r2 j3 n( E2 |
    "RECTANG" "3111.42857142,989.99999999" "@37902.85714287,27720.00000001"
/ d5 F5 V4 n* E  ?1 n9 g    "ZOOM" "_a"  ))
' v3 O6 L8 A# d; B. G;=====================================================================% C- L, ^; a( n6 i7 M
(Defun c:2a ()  `' W$ f5 T3 q  u4 D) ]% T) c# `
        (setq mv_sc 100)
0 j5 b  R: w' c. I      (setq x2  594)$ J8 T! H% l. ]6 Z( L
      (setq y2  420)8 P) A; v% z2 g& K& l2 @1 |' J
  (setq x2 (* mv_sc x2)
, h# U6 X' r8 S1 H1 @        y2 (* mv_sc y2)  )
; M9 K( [6 t: N  (command  
$ M! b% Z3 p, z" Y4 U( w    "LIMITS" "0,0" (list x2 y2)
9 u' y5 U$ z: m5 d    "PLINE" "0,0" (list 0 y2) (list x2 y2) (list x2 0) "0,0" "_C"
! H  B$ {" m* {6 g# o& U    "RECTANG" "4000,1000" "@54400,40000"( y. z0 I' \2 n- L2 V0 C! G
    "RECTANG" "4400,1400" "@53600,39200"
- h) |  S2 N7 j7 R4 p    "ZOOM" "_a"  ))
' A( W- M4 Q& u* A& P, v4 D% i2 C7 m;=====================================================================
( F$ I8 ?/ [# O: P0 M(Defun c:1a ()
5 q; g( x$ ^+ ?: }5 A' x2 A! G9 E        (setq mv_sc 100): z* t$ ?" i' L/ x1 v, k
      (setq x1  840.0857142857)9 q' |) s4 A! @! a0 j
      (setq y1  594)
& R  n4 ^4 f7 a( C  (setq x1 (* mv_sc x1) 0 z# Q) i; A1 w
        y1 (* mv_sc y1)  )' v+ \. ]# O7 X; i& F5 R% s
  (command  : x) Z' b: E- ]% Z+ v1 q3 f
    "LIMITS" "0,0" (list x1 y1)
6 X9 K4 z9 F. P! M; Q* L" h    "PLINE" "0,0" (list 0 y1) (list x1 y1) (list x1 0) "0,0" "_C"
/ J" \7 ~; }3 ?3 i. s    "RECTANG" "5657.14285714,1414.28571429" "@76937.14285714,56571.428571436"- i( U; y9 ^) C0 @: e* Y9 Q; |* I
    "RECTANG" "6222.85714286,1980.00000001" "@75805.71428570,55440"
" g( G6 T$ ~5 V* o6 L5 U5 {    "ZOOM" "_a"  ))
$ M& a5 B5 g' K) ^6 s  g+ c;=====================================================================! X3 \8 W, V7 P4 P+ X! L
(Defun c:0a ()! G0 b& l) u3 B& L) Q9 }
        (setq mv_sc 100)1 V* |! ]$ [5 A. A
      (setq x0  1188)# \; k0 v4 O6 X" {2 \
      (setq y0  840)
- i* U2 g+ O# {0 h6 L7 h  (setq x0 (* mv_sc x0)
' K$ j) K+ m1 I& v7 t, t        y0 (* mv_sc y0)  )
6 G# `2 I2 O6 h! _  (command  
( _+ n/ C$ R& Z7 \4 I$ q6 t2 o    "LIMITS" "0,0" (list x0 y0)% p! p4 |5 ]6 B4 X1 }2 K
    "PLINE" "0,0" (list 0 y0) (list x0 y0) (list x0 0) "0,0" "_C"
- X+ f7 _, x5 }# `! a    "RECTANG" "8000,2000" "@108800,80000"
& x3 ?4 ~" ]: J0 f6 s0 l! }    "RECTANG" "8800,2800" "@107200,78400"
( ?( X1 U9 P* S' j" T- [0 {, n    "ZOOM" "_a"  ))( A6 F, V2 p/ T
5 x( q6 }2 K) L0 [  b' }5 E
;=====================================================================
( J' D6 q9 k. w5 T;==================DAT KhoGiay Theo KHO GIAY BAN VE===================# X+ v7 A9 n7 i( }+ {
;=========================== Nguoi Khac ==============================
4 E! Z0 Z$ C$ k( D(defun c:khogiay (/ oldlst a b c d e f g h kho TL)
3 y2 w, C0 m7 H' @0 X. Z3 N(command "undo" "be")
1 o1 A, d8 k  j  Y9 P8 I( R(setq oldlst (mapcar 'getvar (list "CMDECHO" "OSMODE" "cecolor")))0 b# [- _2 V8 |
(setvar "CMDECHO" 0)# ]! g" r1 a$ T1 \& Z+ j
    (setq a (getpoint "\n chon diem chen :"))
! v0 N7 t8 r; K' h& h: J' K(if (not TL) (setq TL 1.00))
( U5 h4 X; a6 `" v5 M- \) q& _ (setq TL1 (getDIST (strcat "\nScale <" (rtos TL 2 2) ">:")))
7 I3 X# Y+ @; U! Q(if TL1 (setq TL TL1))
+ g3 M2 ~; _# r0 @, _  j- Q, L(setvar "osmode" 0)2 A9 M& [! ]0 o+ R+ d
(if (not (tblsearch "layer" "Defpoints")) (Command "layer" "N" "Defpoints" ""))
; j% i3 D, D" {( S3 x(initget "0 1 2 3 4")7 x& x' y7 T+ K- r+ g
       (setq kho (getkword "\Kho A0 _ Kho A1 _ Kho A2 _ Kho A3 _ Kho A4 [0/1/2/3/4]? <0>:"))6 W9 |( r+ X" M  u- U; H
(if (= kho "0")+ n! {. ]# H: p8 X  r
     (progn, B: a1 N9 ]0 V' N9 k) U( I2 ?$ Z
             (setq b (polar a 0 (* TL 1189)))! m* [5 n; e6 J" l
                     (setq c (polar b (/ pi 2) (* TL 841)))
: `4 v4 Z8 `: g+ \                     (setq d (polar a (/ pi 2) (* TL 841)))
1 D+ L3 o/ ?0 W* c! N# ?. z6 J: d             (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 12 12)))))
- T* ?6 }6 r. m  t  }' U7 g! H2 `                     (setq f (polar e 0 (- (* TL 1189) (* TL 24))))$ r8 u. l$ b0 b$ t; D" s+ u
                     (setq g (polar f (/ pi 2) (- (* TL 841) (* TL 24))))
7 d6 V. q5 @: v/ s4 b                     (setq h (polar e (/ pi 2) (- (* TL 841) (* TL 24))))0 [+ k3 p* G* d- H  p
  (command "Pline" e f g h "c")            
& s1 h1 ?( b1 C7 Q9 e* L& |; w(command "change" "last" "" "properties" "layer" "0" "")
& k& G" M1 P2 z% }6 a- ^  Y" Q(setvar "cecolor" "4")
" E9 m2 V: w& g  (command "Pline" a b c d "c")
' A2 E* i+ [0 h$ v2 z(command "change" "last" "" "properties" "layer" "defpoints" "")))    7 u6 O8 S0 O. x% o5 C) Z# r
(if (= kho "1")
, g+ j- x# M: n8 L     (progn- n6 C% z: c- o; ?
             (setq b (polar a 0 (* TL 841)))
  k) u0 [+ i. V; y                     (setq c (polar b (/ pi 2) (* TL 594)))
. v- w+ N% l+ Y6 w, s6 b2 }' Q                     (setq d (polar a (/ pi 2) (* TL 594))): q8 d0 I/ A6 E, a) X
            (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 12 12)))))
) N; U9 X& ~  t+ o* G) Q                     (setq f (polar e 0 (- (* TL 841) (* TL 24))))
$ O6 b& p2 ?1 @4 d! {3 ^                     (setq g (polar f (/ pi 2) (- (* TL 594) (* TL 24))))& i& ]3 l$ Y7 B1 W9 U6 ?( o
                     (setq h (polar e (/ pi 2) (- (* TL 594) (* TL 24))))
+ A+ U; S9 v* k  c' l7 @: H* O3 W  (command "Pline" e f g h "c")            
6 R$ P- |% M  T(command "change" "last" "" "properties" "layer" "0" "")+ y* A+ I/ S. X0 T9 D
(setvar "cecolor" "4")9 d/ L$ c' J7 P% n' E; `. \
  (command "Pline" a b c d "c")% J5 M7 r8 K: v" G3 c
(command "change" "last" "" "properties" "layer" "defpoints" ""))), Y; N$ o. K; @+ [1 R$ w2 d: h
(if (= kho "2")
8 B% N! {' a, l3 z0 C     (progn4 J/ ?# ]0 A& X
             (setq b (polar a 0 (* TL 594)))& |0 B! Q; Y5 t9 Y
                     (setq c (polar b (/ pi 2) (* TL 420)))- W* x* O5 n* h' j8 e# ]
                     (setq d (polar a (/ pi 2) (* TL 420)))8 y, T8 u1 W4 d/ K& c
             (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 100)))))3 u# J% N: O8 L: o, a
                     (setq f (polar e 0 (- (* TL 594) (* TL 20))))) v0 e6 o+ x. s( F5 U' ~  _
                     (setq g (polar f (/ pi 2) (- (* TL 420) (* TL 20))))
# L% ?9 P% D" d- b                     (setq h (polar e (/ pi 2) (- (* TL 420) (* TL 20))))) r3 a5 f; c8 |$ G" C0 w- f
  (command "Pline" e f g h "c")            
  |. n4 Z3 Z! ?2 n$ n8 _(command "change" "last" "" "properties" "layer" "0" "")
9 p" A/ e1 y+ Z5 ?$ ](setvar "cecolor" "4")" B; B7 [- g' }4 T+ \6 O  S9 o3 M
  (command "Pline" a b c d "c")
3 z0 v! \; m3 N$ h' c  w" k9 k(command "change" "last" "" "properties" "layer" "defpoints" "")))) M; z9 n+ W( g8 M4 e
(if (= kho "3")
0 g; o4 i2 n) s' V- K( L     (progn7 {) T2 K0 c0 ~
             (setq b (polar a 0 (* tl 420)))/ p! R" d# n0 G* r* K4 g
                     (setq c (polar b (/ pi 2) (* TL 297)))+ j! N1 \5 [  t& `
                     (setq d (polar a (/ pi 2) (* TL 297)))4 f. [+ l4 g& l3 S) |( T+ z# ]
             (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 100)))))
! T( X3 R& s, R3 ^" Q                     (setq f (polar e 0 (- (* TL 420) (* TL 20))))
- F" \1 Q: f3 h  u# H- l8 h                     (setq g (polar f (/ pi 2) (- (* TL 297) (* TL 20))))9 k0 y# Q+ |& _7 ]: f4 [
                     (setq h (polar e (/ pi 2) (- (* TL 297) (* TL 20))))( {; D7 l6 D  P' `6 n+ L
(command "Pline" e f g h "c")% C4 b# `; l" G7 d$ t; z, P  f
  (command "change" "last" "" "properties" "layer" "0" "")- Q( ?# ~3 c; P, ]9 x) x
(setvar "cecolor" "4")
! J) U+ S  o' y3 |/ Q- \& M$ s(command "Pline" a b c d "c")4 U6 M  C" [0 \2 Z- z, B% z
  (command "change" "last" "" "properties" "layer" "defpoints" "")))
" \1 D& Z# X3 l (if (= kho "4")1 B1 k# J0 w( Q( z6 D+ U' d3 y
     (progn
4 Q' P- R+ m) b5 x             (setq b (polar a 0 (* TL 297)))2 n3 I# ^8 E4 o3 l- e
              (setq c (polar b (/ pi 2) (* TL 210)))( g4 x# J0 i) k! ~; h
                     (setq d (polar a (/ pi 2) (* TL 210)))
+ S& o( T5 f1 _8 U" e& F' M8 U            (setq e (polar a (/ pi 4) (* TL (sqrt (* 2 81)))))
5 ]% I& k7 w. Y  ^                     (setq f (polar e 0 (- (* TL 297) (* TL 18))))7 t( Z6 X$ D& m; |$ d+ J: m+ y
                     (setq g (polar f (/ pi 2) (- (* TL 210) (* TL 18))))9 F! w0 V2 a3 v6 A$ F. R- k
                     (setq h (polar e (/ pi 2) (- (* TL 210) (* TL 18))))" }" k6 [. @  d4 v( w" ~. q' I7 m
  (command "Pline" e f g h "c")            ( g! F5 C0 G" N1 I
(command "change" "last" "" "properties" "layer" "0" "")5 H/ k. S" r- ^9 L1 ?- @2 [4 e
(setvar "cecolor" "4")
4 q+ N9 l. _- a' B9 @$ q( j  (command "Pline" a b c d "c")
3 m# U: Y6 d4 y4 _(command "change" "last" "" "properties" "layer" "defpoints" "")))1 ?: y& ~0 A: U# e( u- E
(mapcar 'setvar (list "CMDECHO" "OSMODE" "cecolor") oldlst)
+ ?# `3 b6 L; y9 z0 J, y  l( |- t& J(command "undo" "e")
( I; s" T5 p7 t, m6 G6 @$ i(princ))
# b7 E7 @: c! y2 K;=====================================================================/ r9 J" j) _# l9 |
;==================DAT KhoGiay Theo KHO GIAY BAN VE===================
7 R1 Z1 s% m1 A# i2 J$ V1 K% K;=====================================================================. U$ o% t) X3 u

, f- J! p# w8 I; U( o) n# i) `;=====================================================================4 j' b. @% ]; @
;===================DAT Ti Le Theo KHO GIAY BAN VE====================3 B7 P2 r$ E7 ]3 C
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================) i- X9 S* R6 i7 S, S' s8 u" g  R& d4 B
  V* C' O9 M( R' y
(DEFUN C:SA6 () (setvar "DIMSCALE" 411.11111)
8 z- I3 w! K6 E* ?" `                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.1" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "5" ""
4 _# Q" T% v2 W, A                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.3" ""3 H- ~0 H! r* Y1 t8 e+ r
                                           "M" "MANH" "C" "9" "" "Lw" "0.1" ""
: w( P, E! x- n/ [  n                                       "M" "TEXT" "C" "7" "" "Lw" "0.12" ""
) l2 t4 s* I- b1 M                                       "M" "DIM" "C" "1" "" "Lw" "0.12" "") V) \6 K9 P2 l* f; k) L
                                       "M" "THAY" "C" "7" "" "Lw" "0.2" """ Y6 n. h* q, e* O  g
                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.12" ""
4 M* u4 o: a) d  r) f! S7 N                                       "M" "HATCH" "C" "5" "" "Lw" "0.1" ""' f- v- o7 j/ z
                                       "M" "COT" "C" "1" "" "Lw" "0.3" ""  T% k& K; A! l. L- t( n0 i, R
                                       "M" "Defpoints" "C" "7" ""
/ q7 i" [$ A2 ?( t0 h# c" Y5 e1 V. O                                       "M" "0" "C" "3" "" "Lw" "0.12" ""
! C+ V! i* l* J                                       "M" "CUA" "C" "6" "" "Lw" "0.12" ""3 Y  h2 ?# K- @
                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.12" ""8 O+ M+ x$ k6 H6 m6 L
                                        "M" "DAY-DIEN" "C" "3" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"
. {) y5 |7 \# G+ z) v8 c1 @                                       "M" "NETDAM" "C" "4" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"
2 i9 l% H* A8 s7 c                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"8 L  N' l9 @7 A' b
                                       "M" "NETMANH" "C" "43" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"/ x- y. l, }1 ?+ ^2 C( f& e
                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1", C7 S. @; A' p& H/ l4 G! {
                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"
" j1 z  b# @9 \( Z7 \2 u                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"
. K2 [4 j9 K3 l0 w0 m                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"0 @' }& r; {! _# X% t
                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1". C; {+ u6 ^5 h
                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.20" "" "LT" "Continuous" "" "" "LTSCALE" "1"
+ V+ q# A( V, }* H6 O  O) b7 R                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.3" "" "LT" "Continuous" "" "" "LTSCALE" "1"
; g2 @4 T! H' K$ r                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.4" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"2 Q( W2 \8 u) o
                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.4" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"1 j. b% ]2 H, y* f5 w' x! B
                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"
. d$ y3 N5 j; c: W( W* r, y* A                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.1" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "3" ""))(princ)
6 ]( m! h. u( s. S  _6 b8 ?! V(DEFUN C:SA5 () (setvar "DIMSCALE" 611.11111)" `3 Y) Z9 k6 x; ]
                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.12" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "10" ""
% U1 X5 }% [0 r/ t                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.4" "": N- G" P- G8 P( b/ ]# |( ^  |
                                           "M" "MANH" "C" "9" "" "Lw" "0.12" ""
  \0 f) Y1 W2 y7 [6 Q& M                                       "M" "TEXT" "C" "7" "" "Lw" "0.12" ""
' U+ s: V8 B) _0 _  c                                       "M" "DIM" "C" "1" "" "Lw" "0.2" ""; K% l2 S5 _) }0 b# u* u  G" Y
                                       "M" "THAY" "C" "7" "" "Lw" "0.2" ""
* P" E, l4 u3 [/ |                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.2" ""
2 ?4 c4 y* ~$ U6 m# f8 d( B                                       "M" "HATCH" "C" "5" "" "Lw" "0.1" ""; `& t0 t7 j% d7 B, R- F
                                       "M" "COT" "C" "1" "" "Lw" "0.4" "": ?- Q6 O$ |! s" x7 F
                                       "M" "Defpoints" "C" "7" ""/ A0 n* w8 `2 j  F$ m+ H5 X
                                       "M" "0" "C" "3" "" "Lw" "0.2" ""% ^1 _+ L  p9 `# Z: S; n. _6 D
                                       "M" "CUA" "C" "6" "" "Lw" "0.12" ""
, q5 C5 |1 q+ D  Z; x                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.12" ""2 t" C) q% ?+ [# c) R4 m
                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"
$ o2 L7 j  t; P8 Q& U                                       "M" "NETDAM" "C" "4" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"$ }3 }* N' j, l+ |% J! M1 V7 e
                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"
* T5 N/ w- {) h% T0 v/ F. _+ j                                       "M" "NETMANH" "C" "43" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"
/ B- R5 g6 q2 m1 X$ e4 V8 A. a! B                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"9 e8 k3 j( z& y: O4 l
                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"
* @0 J6 W& C! r3 ^4 l* q                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"
% ?$ x4 \3 R, F! S+ F7 S; g                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"7 D  x. v: y" e- {
                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"
# ?. g6 M9 `- d% |( s                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.40" "" "LT" "Continuous" "" "" "LTSCALE" "1". }: {& o7 a# X
                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.4" "" "LT" "Continuous" "" "" "LTSCALE" "1"
, i$ U; X( J) L3 L7 h                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.5" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"
, @* V8 c5 O7 O  Y3 n3 j" g* a                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.5" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"
0 i$ J: R. z4 w$ }% `: J+ O                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"
# U2 E. Y! i" A' w                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.15" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "5" ""))(princ)
& O/ k- J- z/ I' t1 M& B) ^( B- o7 |(DEFUN C:SA4 () (setvar "DIMSCALE" 1411.1111)
) ]9 {0 `! W$ `7 f                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.2" "" "LT" "ACAD_ISO03W100" "" "" "LTSCALE" "20" ""
' N. a. m  a  j5 f1 y6 J$ z! G                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.6" ""
+ K' b% }! I1 `* Z0 u                                           "M" "MANH" "C" "9" "" "Lw" "0.2" ""/ O, F- E, K/ t& T8 x& H
                                       "M" "TEXT" "C" "7" "" "Lw" "0.2" ""
0 ]1 @9 T& |  R$ Z( |/ w; b                                       "M" "DIM" "C" "1" "" "Lw" "0.25" ""
* h) i8 E% Z7 z8 `$ D0 y7 }                                       "M" "THAY" "C" "7" "" "Lw" "0.35" ""
$ B7 h; o7 P+ j. r1 S                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.25" ""' n2 t8 H+ T3 p; d1 l
                                       "M" "HATCH" "C" "5" "" "Lw" "0.15" ""
  A  i. v( H5 X% f0 H8 A5 a/ }                                       "M" "COT" "C" "1" "" "Lw" "0.6" ""
" ?# Q. _3 k4 L5 X                                       "M" "Defpoints" "C" "7" "": t- [/ U, ~8 p: R# d3 N0 A
                                       "M" "0" "C" "3" "" "Lw" "0.25" ""$ q- L( {5 _2 X7 G9 T! N7 k
                                       "M" "CUA" "C" "6" "" "Lw" "0.25" ""
/ F$ a6 Z# _: _  r                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.25" ""
$ J  N# u5 F- W7 o                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"* |% S5 C3 J. [. ~5 i9 F
                                       "M" "NETDAM" "C" "4" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"
* i0 w! d. q  [8 E) R5 f                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"5 V. X; G  r4 W8 z9 ]$ H# H
                                       "M" "NETMANH" "C" "43" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
( l: l; @( j" w. U# n  M                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
: L1 [; P* b6 `, l                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"/ a# @# n) m" i* d
                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
7 ?) X# g3 R4 p7 ?                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"/ p9 k5 c0 t' U
                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"3 J9 E! O3 ^* X3 G' @# c
                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.58" "" "LT" "Continuous" "" "" "LTSCALE" "1"
9 l, _' H# p! V                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
! p$ d- \* R1 u                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"
1 n$ M( W8 |- Z! ~4 Z8 b& E6 c0 o* z                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"# b, @: \  m) a! K
                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1.00" "" "LT" "Continuous" "" "" "LTSCALE" "1"" ^9 Y4 j& G9 r& P% u
                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.2" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "10" ""))(princ)2 s" P: }; ^0 s  j
        
( M0 g! F) u1 Y  r6 }(DEFUN C:SA3 () (setvar "DIMSCALE" 1611.1111)
# }& x+ |, E! X                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.35" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "30" "", A- K  K2 V: f/ k" j, Y) W) V4 F
                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.7" ""
0 j9 l/ \" }. B! L0 m) w% \( D                                           "M" "MANH" "C" "9" "" "Lw" "0.25" ""( T2 E: B& i' N5 D  b( L6 K& {4 v
                                       "M" "TEXT" "C" "7" "" "Lw" "0.2" ""
$ r$ G5 Z% \$ {* R9 o8 n7 ~. w* l                                       "M" "DIM" "C" "1" "" "Lw" "0.35" ""# ?! i# s* h3 W. Q$ L7 }
                                       "M" "THAY" "C" "7" "" "Lw" "0.4" ""
$ E! S2 Q6 r) I: X2 |8 {                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.25" ""3 r; o! x5 U6 e* j6 h$ k% b$ \  N
                                       "M" "HATCH" "C" "5" "" "Lw" "0.2" ""
6 X, w. E% h" Z$ H7 O, d, F7 q6 s) Y                                       "M" "COT" "C" "1" "" "Lw" "0.7" ""
1 Q9 N7 x3 b. L$ W  d; c) m5 b                                       "M" "Defpoints" "C" "7" ""
. r* r' X; e2 Z- D- n                                       "M" "0" "C" "3" "" "Lw" "0.25" ""3 u) d% ^4 y/ Q6 i0 C
                                       "M" "CUA" "C" "6" "" "Lw" "0.35" ""
. t& ]( L& v1 `& i$ @                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.3" ""
, ^& M& Z0 c' q% v" }1 o; l                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"/ y3 X5 U) ^9 J% I' X! ]
                                       "M" "NETDAM" "C" "4" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"
; \$ x+ y9 z, S! q' U                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"
0 D- a, t. S1 e. m, a4 P5 G                                       "M" "NETMANH" "C" "43" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
3 v1 S# h: B7 D) J0 _                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
$ A0 I9 B5 ^: _* A% |0 z0 _                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"* a+ I+ K1 t# L1 o* M6 Q
                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
  k2 T. l: h* S' W                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
% g4 A2 T! b% l% z' |/ E                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"/ ^" T( V" u/ f" d6 q2 V
                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.58" "" "LT" "Continuous" "" "" "LTSCALE" "1"
4 X' Z  ?/ L$ U                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.5" "" "LT" "Continuous" "" "" "LTSCALE" "1"
: H. Q" ~+ G9 l                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"
1 F4 D; W9 R/ \' k' k0 \4 ~                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.6" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"
2 l, U- [. F& v& T6 ^                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1.00" "" "LT" "Continuous" "" "" "LTSCALE" "1"
- G: ]. F, y; X6 }                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.25" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "20" ""))(princ)
2 A3 u& S9 z" B; b% u* m8 B# N9 Z/ V; C) T3 }  `
(DEFUN C:SA2 () (setvar "DIMSCALE" 4111.1111)% b4 J6 r  G. B) I
                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.35" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "45" ""
: x2 W8 h7 m" |0 D& P. F/ w  l                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.7" ""' i% e$ z  R- c: r$ X  p- W9 e
                                           "M" "MANH" "C" "9" "" "Lw" "0.25" ""9 s5 F; W, t2 z" s6 @" h
                                       "M" "TEXT" "C" "7" "" "Lw" "0.25" ""
% v/ d& N+ H6 K: y3 v' b                                       "M" "DIM" "C" "1" "" "Lw" "0.3" ""  L) M0 r& Y0 x& L( c
                                       "M" "THAY" "C" "7" "" "Lw" "0.4" ""9 T: L+ d/ z8 @9 M$ I& z
                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.3" "": n9 X3 @+ w5 g0 T7 c
                                       "M" "HATCH" "C" "5" "" "Lw" "0.2" ""
5 W$ x( o' @+ I% U% ^' u8 h! B+ P                                       "M" "COT" "C" "1" "" "Lw" "0.7" ""
4 s# k# J' S3 F) Z6 D                                       "M" "Defpoints" "C" "7" "": P3 |8 E$ }2 }7 H# M1 r8 S) Y
                                       "M" "0" "C" "3" "" "Lw" "0.35" ""
& [! q2 E/ _0 P* L' f                                       "M" "CUA" "C" "6" "" "Lw" "0.35" "": F1 h/ }- Q8 a, J
                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.3" ""
, H& l; t! U# W1 z1 Y& j2 W                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"' ?' D5 D  _% X  ?4 x. y  `
                                       "M" "NETDAM" "C" "4" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"3 C: e" B- I* L% k6 f0 M" I
                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"5 W. t' X3 U& \& K) o1 D
                                       "M" "NETMANH" "C" "43" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"
0 |! R: b+ ]& M1 ~* u2 E                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"- y# @& O1 [: `6 c" a
                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"
0 p+ b/ w8 h9 g: b4 q6 t                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"# x( i; [! R% P$ k* w# ?
                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"! w: a5 W4 W) M: X* K
                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1": v: U' y( ]0 E$ k
                                       "M" "THEPDOC" "C" "2" "" "Lw" "1.58" "" "LT" "Continuous" "" "" "LTSCALE" "1"0 ~+ I& g1 u8 C
                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.6" "" "LT" "Continuous" "" "" "LTSCALE" "1"
+ o! P: f( ?1 D) [! @+ s3 Y0 u                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.7" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"
9 W8 u  m/ Y$ K& G5 t. s                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.7" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"/ i( V' X( f: K- }) {! k
                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1.20" "" "LT" "Continuous" "" "" "LTSCALE" "1"
* g/ f6 A/ h! |/ q  D5 w                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.25" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "30" ""))(princ)& R( m( E6 _2 A( t& j- l
$ u- m# B( D1 \
(DEFUN C:SA1 () (setvar "DIMSCALE" 4411.1111)
! s7 S4 y3 o7 B4 A. h                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.4" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "60" "") g4 r1 |" ^/ p# t6 ]0 p
                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "0.85" ""$ X' C: i2 M( w- ^" B- D
                                           "M" "MANH" "C" "9" "" "Lw" "0.35" "", i  o3 Z3 y: s4 |7 I! n* G; x7 {
                                       "M" "TEXT" "C" "7" "" "Lw" "0.5" ""5 ?+ C) s1 v6 s- H
                                       "M" "DIM" "C" "1" "" "Lw" "0.35" ""
- |: V5 u6 z$ H& G+ L4 F; e                                       "M" "THAY" "C" "7" "" "Lw" "0.4" ""
. g+ m0 \5 r3 b' F# K* j                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.35" ""9 X8 n3 A, `. z4 S: h: @
                                       "M" "HATCH" "C" "5" "" "Lw" "0.25" "": r# `, M6 o# K! c) r
                                       "M" "COT" "C" "1" "" "Lw" "0.85" ""0 \4 g! j+ `! Y  z9 m$ w# R
                                       "M" "Defpoints" "C" "7" ""' p3 W  c* |3 G+ X) S8 }8 n
                                       "M" "0" "C" "3" "" "Lw" "0.35" ""( _- p* H2 y/ s0 }! {; D& ?
                                       "M" "CUA" "C" "6" "" "Lw" "0.4" ""/ u! Z& S' m7 k$ R
                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.35" ""3 f; B  }; O$ R7 \) O  |/ y% x
                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1") b/ {7 U$ f  x0 {, d) ^& Z
                                       "M" "NETDAM" "C" "4" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"
3 W. i8 q* g" ~3 q' H8 Q                                       "M" "NETTHAY" "C" "255" "" "Lw" "0.9" "" "LT" "Continuous" "" "" "LTSCALE" "1"
6 k% z" s( H/ z5 z" c4 @# g4 L  V                                       "M" "NETMANH" "C" "43" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"( K6 i2 c5 B/ V6 u( j
                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "1.0" "" "LT" "Continuous" "" "" "LTSCALE" "1"
/ v) k& O, G" Q% Z# [                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"5 q  {+ o5 i3 z0 t( b+ l8 y
                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"
+ l- o/ E& v  F5 x7 ^! h                                       "M" "TEXTVNi" "C" "4" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"
1 d4 z- K) @3 f: k. d                                       "M" "THEPDAI" "C" "3" "" "Lw" "0.9" "" "LT" "Continuous" "" "" "LTSCALE" "1"% b; F: \0 P, T2 z! ]
                                       "M" "THEPDOC" "C" "2" "" "Lw" "2.00" "" "LT" "Continuous" "" "" "LTSCALE" "1"
% N0 b- i) k7 Z                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.7" "" "LT" "Continuous" "" "" "LTSCALE" "1"
# z8 j- K# i$ H2 K2 Y) M                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.8" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2"9 O, a- i. D- z" w
                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.8" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"
3 f. K; Y$ D# y$ D6 g3 f8 X                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1.40" "" "LT" "Continuous" "" "" "LTSCALE" "1"
% K# @0 |, n4 u& t, N% \                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.3" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "40" ""))(princ)2 l! E; d3 I$ k, ~. X
        & k9 }. S9 S* N- ^8 o. N
(DEFUN C:SA0 () (setvar "DIMSCALE" 6111.1111)
" k0 X( u; z% W% |7 f/ U" w                     (COMMAND "-LAYER" "M" "NETDUT" "C" "8" "" "Lw" "0.5" "" "LT" "ACAD_ISO03W100" "" "" "" "LTSCALE" "85" ""6 G0 N% R1 u& T) ]  I4 R4 y, D
                              "-LAYER" "M" "TUONG" "C" "4" "" "Lw" "1" ""; s0 B. E! p/ X: {+ }
                                           "M" "MANH" "C" "9" "" "Lw" "0.35" ""
, I9 ]9 B. r, g& G# o                                       "M" "TEXT" "C" "7" "" "Lw" "0.5" ""
5 t3 p2 U6 w- j% G+ l' Y+ k/ k                                       "M" "DIM" "C" "1" "" "Lw" "0.35" ""
; \, v( v! g! h: H" P2 x                                       "M" "THAY" "C" "7" "" "Lw" "0.5" ""
- Y1 _0 x6 p  h, }: ~* \+ F0 ?                                       "M" "NOITHAT" "C" "60" "" "Lw" "0.4" ""
& r- ]$ X8 e* K  `! L# B                                       "M" "HATCH" "C" "5" "" "Lw" "0.35" ""
  k. q2 ]; n0 W                                       "M" "COT" "C" "1" "" "Lw" "0.1" ""
, {$ a3 C. d1 p* c% }                                       "M" "Defpoints" "C" "7" ""9 w- ]- ]; }! l# I4 B8 Z6 k$ b  i
                                       "M" "0" "C" "3" "" "Lw" "0.5" ""' P% l( ]1 F  R3 D0 h0 h  E
                                       "M" "CUA" "C" "6" "" "Lw" "0.5" ""
" j2 Q/ l9 }2 K- w. `                                       "M" "CUA MATDUNG" "C" "6" "" "Lw" "0.4" ""  r1 Q  P9 K+ m3 g% R0 Z3 G
                                       "M" "DAY-DIEN" "C" "3" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"
2 z! P% U; V% X: E0 N                                       "M" "NETDAM" "C" "4" "" "Lw" "1" "" "LT" "Continuous" "" "" "LTSCALE" "1"- H# F, }1 s1 k$ F9 p8 U% p/ Z
                                       "M" "NETTHAY" "C" "255" "" "Lw" "1.00" "" "LT" "Continuous" "" "" "LTSCALE" "1"* ~. b$ T9 o0 [/ p6 l; L7 \0 p5 z
                                       "M" "NETMANH" "C" "43" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"
8 T' X* @2 s; w( g8 k; V5 P                                       "M" "ThietBiDIEN" "C" "2" "" "Lw" "1.20" "" "LT" "Continuous" "" "" "LTSCALE" "1"
4 N6 j2 a/ h% q, w                                       "M" "TEXTTXT" "C" "7" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"
4 Y4 {# A# d, g8 G( G( h                                       "M" "TEXTVN" "C" "60" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"( j" M( i' g( k
                                       "M" "TEXTVNi" "C" "60" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1") v/ `$ g) g  a, V. E' k
                                       "M" "THEPDAI" "C" "3" "" "Lw" "1.00" "" "LT" "Continuous" "" "" "LTSCALE" "1"
' L3 s* Y; U9 {8 s4 O/ G                                       "M" "THEPDOC" "C" "2" "" "Lw" "2.11" "" "LT" "Continuous" "" "" "LTSCALE" "1"
1 n/ F! h; R7 g2 r2 V, C                                       "M" "10-VAN_KHOA" "C" "10" "" "Lw" "0.8" "" "LT" "Continuous" "" "" "LTSCALE" "1"
8 ~$ N  [, J7 y                                       "M" "4-WateR_IN" "C" "4" "" "Lw" "0.9" "" "LT" "FENCELINE1" "" "" "LTSCALE" "2", _( y6 d) ?5 w
                                       "M" "4-WateR_OUT" "C" "4" "" "Lw" "0.9" "" "LT" "FENCELINE2" "" "" "LTSCALE" "2"
' S8 V( G0 |  s% O6 e8 F  h                                       "M" "KHUNGTEN" "C" "4" "" "Lw" "1.40" "" "LT" "Continuous" "" "" "LTSCALE" "1"
+ C+ `! H2 w0 P! \                                       "M" "TIMTUONG" "C" "5" "" "Lw" "0.35" "" "LT" "ACAD_ISO10W100" "" "" "LTSCALE" "55" ""))(princ)
8 p3 _% m& i" o. _- v, R(DEFUN C:O   () (COMMAND "OFFSET")): g. W- ~$ k$ C
(defun c:s1 () (command "surftab1"))
( \. E  x9 `. P8 Q' {4 z(defun c:s2 () (command "surftab2")): W/ q% l3 |% o9 l4 r( }0 p2 s2 }
(defun c:ep () (command "explode"))0 J% ?# A# k) H9 s+ H9 S5 A7 v# E
(DEFUN CS () (COMMAND "AUDIT" "Y" "purge" "all" "*" "N" "QSAVE"))1 w& H8 k: ?" v/ s- f/ w) s9 b
(DEFUN CV   () (COMMAND "QSAVE"))( c# g( z0 Z; U* T6 e( v
(DEFUN C:S    () (COMMAND "STRETCH" "C"))
- W7 B( \' [0 l' \0 \/ s
& G  m' C0 N, l2 P+ L, m;************************** CAT DIM **************************1 N3 S0 Q) s  z( B8 O  Q& ^

9 d: H* e& r  w(DEFUN CC (/ CMD SS LTH DEM PT DS KDL N70 GOCX GOCY PT13 PT14 PTI PT13I PT14I' D' P" T1 S, J; |. O0 R: H
                PT13N PT14N O13 O14 N13 N14 OSM OLDERR PT10 PT11)
) }  D0 @2 A+ W+ o* f  A(SETQ CMD (GETVAR "CMDECHO"))- C7 A8 q3 P! p  Y$ L( M
(SETQ OSM (GETVAR "OSMODE"))
( \; v, p1 d: ^- B7 p(SETQ OLDERR *error*
+ E$ O$ G7 Y: c1 u' p4 v) l      *error* myerror)0 J- f$ J+ H. |7 k* Z  f' o
(PRINC "Please select dimension object!")
! [0 G- K7 g% L(SETQ SS (SSGET))( g6 Y% ]: i1 E
(SETVAR "CMDECHO" 0)* `2 R* a! b: F& f/ d: h
(SETQ PT (GETPOINT "Point to trim or extend:"))
$ @9 a! E7 m$ }, g3 I# E/ F  l(SETQ PT (TRANS PT 1 0))
" e, Y0 i5 v) x$ i) T(COMMAND "UCS" "W"): J  ]& E& l" W: b) P0 {
(SETQ LTH (SSLENGTH SS))4 Y" c! ]6 `! h/ ^/ a1 B2 Y4 U  [
(SETQ DEM 0)% ]/ }  }2 g- G" k8 O
(WHILE (< DEM LTH)
5 O- F3 q0 G/ s) n2 _& J    (PROGN
, T% A% s0 K9 d4 J        (SETQ DS (ENTGET (SSNAME SS DEM))): d2 M: X0 [( V5 |5 k. U% ~
        (SETQ KDL (CDR (ASSOC 0 DS)))- z$ g" h! Y7 b! p. j- T3 S$ U6 s
        (IF (= "DIMENSION" KDL)( T0 l  r, v- L
           (PROGN7 D6 ~2 @) v  n
                (SETQ PT10 (CDR (ASSOC 10 DS)))/ d0 S8 C0 I9 x, Y$ ]$ r
                (SETQ PT11 (CDR (ASSOC 11 DS)))0 @3 A  Z. ?# J7 v: [1 r! J( E7 c
                (SETQ PT13 (CDR (ASSOC 13 DS)))( l  r: `% n9 z
                (SETQ PT14 (CDR (ASSOC 14 DS)))
0 J3 B5 m2 Y4 }- c2 K                (SETQ N70 (CDR (ASSOC 70 DS)))1 l/ f0 w" w; x/ Z! m( c
                (IF (OR (= N70 32) (= N70 33) (= N70 160) (= N70 161))
' ~$ ^1 d* K# R2 C. k8 f                   (PROGN. B( u; e* k( P( T
                        (SETQ GOCY (ANGLE PT10 PT14))/ e. s1 @4 k1 |1 w& ?& j* S/ b  H
                        (SETQ GOCX (+ GOCY (/ PI 2)))4 g5 E! y2 Z9 V, x* g
                   )
9 w) s  f* U1 r' \) J3 E/ r( x                )) T1 ]% y/ r2 q) f0 }& h/ Y
                (SETVAR "OSMODE" 0)* P& t, e" f6 R/ m, h3 E
                (SETQ PTI (POLAR PT GOCX 2))
- H' D5 d2 x2 l+ J                (SETQ PT13I (POLAR PT13 GOCY 2))
1 o/ m: |, H: I3 V                (SETQ PT14I (POLAR PT14 GOCY 2))
3 T8 U  e/ v  x: G) Q7 d1 W$ D                (SETQ PT13N (INTERS PT PTI PT13 PT13I NIL))/ h3 |( V* A% i! r+ }' [4 b
                (SETQ PT14N (INTERS PT PTI PT14 PT14I NIL)), y$ J# x3 j3 S: C
                (SETQ O13 (ASSOC 13 DS))
1 ^0 d* ?+ r6 ~- Z  s9 m                (SETQ O14 (ASSOC 14 DS))
2 Z% U% N) s" D! ~+ P0 Q% c0 y                (SETQ N13 (CONS 13 PT13N))9 y1 ?; |4 a' U, Q
                (SETQ N14 (CONS 14 PT14N))0 ~/ {/ V- b6 S
                (SETQ DS (SUBST N13 O13 DS))8 g- T8 r7 s, X0 V5 @1 t1 O
                (SETQ DS (SUBST N14 O14 DS))
, S5 c* V+ B$ X$ ^- B                (ENTMOD DS)* v' |1 ?+ h6 D
           )
4 q  P) u( O& \' y1 }        ), H0 ?5 x* }& Y1 o' D7 ^' l
        (SETQ DEM (+ DEM 1))& }$ Y8 P: j8 R* f: g* x4 _
    ); y% ~& ^/ v- B5 l: A0 C& s
)
9 ], f# d5 ]4 ?+ y(COMMAND "UCS" "P"), O  \+ T- W: c. ~' @# t
(SETVAR "CMDECHO" CMD)* C+ C) u+ c) `9 h5 K: y
(SETVAR "OSMODE" OSM)5 j9 ]' H9 Q+ R+ r) P7 H% y5 M
(setq *error* OLDERR)               ; Restore old *error* handler
/ l2 N! g1 ?6 i5 }- N! m(PRINC)3 G# G3 z  H1 F/ q  m/ O+ x$ B
)
' r& @: z, W: J/ p1 a1 T
' a/ i: f  t/ w/ o. m(DEFUN C:BD (/ CMD SS LTH DEM PT DS KDL N70 GOCX GOCY PT13 PT14 PTI
' T6 r0 f) ?: i4 X( [0 `                PT10 PT10I PT10N O10 N10 PT11 PT11N O11 N11 KC OSM OLDERR)
9 E- w# z+ w. A7 t2 w7 k(SETQ CMD (GETVAR "CMDECHO")). q+ d  [3 F% @1 V5 L5 d7 x" f1 J
(SETQ OSM (GETVAR "OSMODE"))
& d/ d6 X1 D, b8 v3 c* u' M(SETQ OLDERR *error*- e# f$ f* w1 n9 i! e
      *error* myerror)$ |: o) B: n5 L1 x& j. A) C
(PRINC "Please select dimension object!")3 ?! w! O2 n* |
(SETQ SS (SSGET))
. z. Y6 U& m3 ]2 q# Q7 Y2 U) }/ X(SETVAR "CMDECHO" 0)7 v& v9 p/ N) M8 d! T' A
(SETQ PT (GETPOINT "Point to trim or extend:"))+ O" n# c; Z& S+ [0 Z! k
(SETQ PT (TRANS PT 1 0)); K/ g5 g  \5 {' @8 a
(COMMAND "UCS" "W")
7 q7 t9 M9 b% Y. T4 C% v0 i  k0 X' |(SETQ LTH (SSLENGTH SS))4 |. z! W' G$ r* `$ J
(SETQ DEM 0)) s! M* K2 Y: @# F, V
(WHILE (< DEM LTH)
: X* X1 z: I2 N+ I( G" @* O+ X    (PROGN
- _- |3 d9 c1 c; C0 d        (SETQ DS (ENTGET (SSNAME SS DEM)))
, W8 k  }/ Z  d4 U        (SETQ KDL (CDR (ASSOC 0 DS)))0 R9 _0 h) B( }3 v
        (IF (= "DIMENSION" KDL)
  y3 q; I1 ?+ R$ L6 ?2 {4 }           (PROGN
7 R1 F7 \* T- X' M% I# Q                (SETQ PT13 (CDR (ASSOC 13 DS))): e- g0 x: j8 o: l/ B! g, r" o
                (SETQ PT14 (CDR (ASSOC 14 DS))); P4 r" R6 E4 v; n; p5 i
                (SETQ PT10 (CDR (ASSOC 10 DS)))
3 I) Y( J) b+ n, F/ l+ Q  ~; D% s                (SETQ PT11 (CDR (ASSOC 11 DS)))
3 e9 u1 y0 S" @; U1 S" d6 |" k                (SETQ N70 (CDR (ASSOC 70 DS)))
; c/ |% h0 e) p9 @- h                (IF (OR (= N70 32) (= N70 33) (= N70 160) (= N70 161))
% @$ @! R; K, O; M" h2 M2 Y                   (PROGN
8 M7 C1 F9 }; z  i8 {6 x                        (SETQ GOCY (ANGLE PT10 PT14))& N) v4 V" n8 ]6 |
                        (SETQ GOCX (+ GOCY (/ PI 2)))
# h& T# b. i- V' r) f3 b# M                   ). e8 d% A' t' P9 e+ t9 q
                )" m$ D; c! e4 a9 a' m. H
                (SETVAR "OSMODE" 0)
7 }. s- ]; {' X7 w1 H& ]% ]                (SETQ PTI (POLAR PT GOCX 2))
6 k: @* [; p, u4 D                (SETQ PT10I (POLAR PT10 GOCY 2))% r4 w, j: m- r( h1 T. P! F2 ?
                (SETQ PT10N (INTERS PT PTI PT10 PT10I NIL)): }! H/ U0 ]7 b3 w
                (SETQ KC (DISTANCE PT10 PT10N))
/ g% \3 i6 ^  D1 I                (SETQ O10 (ASSOC 10 DS))) [/ x- X; d5 s* B
                (SETQ N10 (CONS 10 PT10N))0 L6 Y* w  t4 D0 q+ ?
                (SETQ DS (SUBST N10 O10 DS))
! E/ s" C: T1 q                (SETQ PT11N (POLAR PT11 (ANGLE PT10 PT10N) KC))
3 H9 }3 Z+ P: Z, x                (SETQ O11 (ASSOC 11 DS))' i) V6 i3 q2 e4 u( n9 Z0 e7 d4 Q( y
                (SETQ N11 (CONS 11 PT11N))) a  e0 S9 e* @/ q" E
                (SETQ DS (SUBST N11 O11 DS))7 g& F" I: \2 s, S+ v3 s4 t
                (ENTMOD DS)5 M+ c' T5 f- r; ~
           )9 y* W! p+ U. g3 [8 Z: u1 G
        )
. f0 n' g3 U( L        (SETQ DEM (+ DEM 1))
3 g( a% }. M1 u) }    )- |6 y3 ]) a- @% M" w" t2 j
)/ I' p) ]0 s9 n3 i# E3 X7 V
(COMMAND "UCS" "P")5 q5 N7 \. {. C5 v+ c6 u5 f* E
(SETVAR "CMDECHO" CMD)
( d& F" d. l* S& {(SETVAR "OSMODE" OSM)9 a1 ^+ W4 q3 ]& f3 p: a6 B3 H/ G" Q
(setq *error* OLDERR)
5 i! W' t% }% m0 A(PRINC)& v8 r5 K( t7 |- ^% S
)
2 i* m9 o8 I# W7 o% [
' d% u, R, E/ M: n2 p3 \" D
. Q( P- m; C  @7 ^) @% b3 x- w;;; ================ BAT - TAT CHE DO GACH CHAN TEXT (TU) =================
# z3 U1 j$ c# U  \8 i( p1 F& j+ x
: O4 J- y% B  h(defun c:tu ()  (setvar "cmdecho" 0)(prompt "\nHay chon dong TEXT can gach chan ")
+ r1 `1 c) A( _* |+ f  h% T          (prompt "\nSelect objects: ")(command "select" "au" pause)(setq sstxt (ssget "p")
- _$ |4 d) L0 U        sslen (sslength sstxt) ctr 0)(command ".undo" "mark")(while (< ctr sslen)(setq listxt1 @( q. G5 p7 ~. g5 u1 u
        (entget (ssname sstxt ctr))txttxt (cdr (assoc 1 listxt))enttxt (cdr (assoc 0 listxt)))
" ^0 F, t/ c8 T9 o: d+ l% ?        (if (= enttxt "TEXT")(progn(setq testxt (substr txttxt 1 3))(if (or (= testxt "%%u")' ^& h: @6 r. C/ C) ], p
        (= testxt "%%U"))(setq newtxt (substr txttxt 4))(setq newtxt (strcat "%%u" txttxt)))4 `0 b: |' `! ]2 r( Q5 h4 e" w! M
        (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))(entmod listxt)))2 Z: g& Y3 @' _; ]; |8 N, I
        (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))
! ^# p( y% g6 H9 l- l
' j9 u! k8 g/ k- S; ]" B1 D;;; ================ CHEN COT (TUU) =================
! h3 l6 ]' ]6 ?1 Z# I) K6 ~# t' O0 k
; R/ z" ]" w3 w$ e* A(defun c:tuu ()  (setvar "cmdecho" 0)(prompt "\nHay chon dong TEXT can chen cot ")9 H6 D& i' J: p! C6 j3 i
          (prompt "\nSelect objects: ")(command "select" "au" pause)(setq sstxt (ssget "p")
# C2 [9 k" i: O; ]; p        sslen (sslength sstxt) ctr 0)(command ".undo" "mark")(while (< ctr sslen)(setq listxt3 c* U' d0 y7 g3 M/ r& o
        (entget (ssname sstxt ctr))txttxt (cdr (assoc 1 listxt))enttxt (cdr (assoc 0 listxt)))! O) ?0 b* w0 o7 Y- t
        (if (= enttxt "TEXT")(progn(setq testxt (substr txttxt 1 3))(if (or (= testxt "%%p 0,000")
2 n, G! @$ U: G9 V6 k* A        (= testxt "%%P 0,000"))(setq newtxt (substr txttxt 4))(setq newtxt (strcat "%%P 0,000" txttxt)))+ Y( q8 H5 A5 h" r
        (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))(entmod listxt)))+ ^2 o, i" K& Q( r/ w! h! X+ S! l2 v
        (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))- ?- Q5 \  v5 V+ r8 }

$ G$ Z* A6 W; A& u8 Z;;; ================ CHEN KY HIEU THEP (TP) =================. q4 v1 U4 M* r4 x) d5 O
) l& ~3 ~9 C! I; Q4 \, z0 D
(defun c:tp ()  (setvar "cmdecho" 0)(prompt "\nHay chon dong TEXT can chen ky hieu thep ")& T% F' P' J' j& u% m+ b5 S
          (prompt "\nSelect objects: ")(command "select" "au" pause)(setq sstxt (ssget "p"); H8 e, J2 x) ~
        sslen (sslength sstxt) ctr 0)(command ".undo" "mark")(while (< ctr sslen)(setq listxt$ o+ \$ o& R1 ?+ j  `" Z5 o! d
        (entget (ssname sstxt ctr))txttxt (cdr (assoc 1 listxt))enttxt (cdr (assoc 0 listxt)))
' C- q2 I1 e6 ^2 ?7 n* r8 g        (if (= enttxt "TEXT")(progn(setq testxt (substr txttxt 1 3))(if (or (= testxt "%%c")
) |) t, ~. W3 g0 O        (= testxt "%%C"))(setq newtxt (substr txttxt 4))(setq newtxt (strcat "%%c" txttxt)))
! t% {  S- f# s/ ]# r3 f8 v        (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))(entmod listxt))); v4 @& N" s& G  \  {7 o  I8 P
        (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))
, r1 ^# `! Q% {
6 L0 ^4 Y$ b4 S. T' O;=========================== TAM TUONG (TAM) =================================
+ R# l: p3 x3 j) }
; ~& x7 `# G" C  X8 f2 u0 z(defun c:tam(/ data_m)
7 Z( f% h/ O9 h1 X/ w5 P            (defun import_data(/ i)(setq data_m (ssget))(if (= nil distan_m) (setq distan_m 110.0))6 z2 I0 m9 q. `  ?( t9 h# y% a
            (princ "Distance (")(princ distan_m)(princ "):")(setq i (getreal ))(if (not (= nil i))6 \) c+ ^8 \# H
        (setq distan_m i)))(defun process(/ ent check)(defun p_check()(setq check 0)+ k! M1 C5 i9 O! J) x$ t# k
        (if (= "LINE" (cdr (assoc 0 ent))) (setq check 1))(princ))(defun p_d_offset
1 S3 N. O3 n  I7 \! z        (/ p1 p2 p3 p4)(defun makeline(/ e2 e5)(setq la (list (cons 0 "LINE")(cons 5 (cdr
7 u! J+ ~" |. q        (assoc 5 ent)))(cons 8 (cdr (assoc 8 ent)))(cons 10 p3)(cons 11 p4)))(entmake la)(princ)
6 F/ F$ F4 m, d2 F9 z# D9 y! N6 k        )(setq p1 (cdr (assoc 10 ent)) p2 (cdr (assoc 11 ent)))(if (not (= p1 p2)) (progn (if
5 n8 n$ h( I( x/ M% E% o* F        (< (abs (- (nth 0 p1) (nth 0 p2))) 0.000001) (progn (setq p3 (list (+ (nth 0 p1)) p9 e2 D1 w6 \, A
        distan_m) (nth 1 p1) (nth 2 p1)))(setq p4 (list (+ (nth 0 p2) distan_m)(nth 1 p2)
" s+ c$ {& h$ F) F0 s% d        (nth 2 p2))) (makeline) (setq p3 (list (- (nth 0 p1) distan_m) (nth 1 p1) (nth 2 p1)))5 |4 v/ Z  p) M! N  ~
        (setq p4 (list (- (nth 0 p2) distan_m) (nth 1 p2) (nth 2 p2))) (makeline)))(if (<
+ ]$ C1 c0 l  Z3 p; Z6 [' f        (abs (- (nth 1 p1) (nth 1 p2))) 0.000001) (progn (setq p3 (list (nth 0 p1) (+ (nth 1 p1)
5 R5 n2 j: V5 U4 g        distan_m) (nth 2 p1)))(setq p4 (list (nth 0 p2) (+ (nth 1 p2) distan_m) (nth 2 p2)))- M$ W) C! R/ G, A* D9 J- g
        (makeline) (setq p3 (list (nth 0 p1) (- (nth 1 p1) distan_m) (nth 2 p1))) (setq p4
$ T  S9 [' ^( P' ^$ Q3 ]0 L' v& k+ K        (list (nth 0 p2) (- (nth 1 p2) distan_m) (nth 2 p2)))(makeline)))))(princ))(if (not
& N* E/ A) c3 D9 u2 ^( F/ g        (= nil data_m)) (progn (setq i 0)(while (< i (sslength data_m)) (progn(setq ent (entget9 X* B: i$ ]8 f
        (ssname data_m i)))(p_check)(if (= 1 check) (p_d_offset))(setq i (+ i 1))))))(princ))
& F0 F  l) K; |- S! G4 s% ~0 X          (import_data)(ai_undo_push)(process)(ai_undo_pop)(princ)); i6 T  ^  Y; p4 l5 B- l9 M
; i1 h  I* u4 u
;============ GHI CHU PHI (T1) ================
3 E. z# t0 a$ }* Y# B$ V2 G( e/ M8 A: Y; c" b
(defun c:DuongDan ()(setq D1 (getpoint " Diem thu nhat: "))(setq D2 (getpoint "Diem thu hai: " D1))- m$ i1 u2 p! y+ q: I
          (if (> (car D2) (car D1)) (setq D3 (polar D2 0 16)))(if (< (car D2) (car D1)) (setq D3
, U+ H' l; ^, p3 M3 I  v        (polar D2 PI 16)))(if (= (car D2) (car D1)) (setq D3 (polar D2 0 16)))(if (> (car D2)& l2 ?0 [3 k' y' q$ w
        (car D1)) (setq D4 (polar D3 0 3.2)))(if (< (car D2)(car D1))(setq D4 (polar D3 PI 3.2)0 U% Z9 r( {8 l3 ~+ W3 |6 J9 O
        ))(if (= (car D2) (car D1)) (setq D4 (polar D3 0 3.2)))(if (> (car D2) (car D1))
8 @1 g" {$ G/ |6 X5 i        (setq D5 (polar D2 (/ PI 9) 3)))(if (< (car D2) (car D1)) (setq D5 (polar D3 (/ PI 9)
- ^0 r3 {* E8 f; u        3)))(if (= (car D2) (car D1)) (setq D5 (polar D2 (/ PI 9) 3)))(command "color" 1)
; }3 u2 B; N6 u" y          (command "line" D1 D2 D3 "")(command "circle" D4 "3.5")(command "color" 7 )
& O, k: T6 t* B          (command "text" "m" D4 2.5 0 "1")(command "text" D5 2.5 0 "%%c6a150")
5 k. j2 L3 C% Y/ {2 S1 ^* L' ^5 Q          (command "ddedit" pause))
! W' y- }9 T  ~6 s  g
$ @( l0 V1 U) m: @7 j;;; ========================== Join (J) =================
- I) T% ]9 {3 w  H# ^9 V! ^4 a
  }! ?* ?2 N1 t3 z, m$ u$ p(defun C:J () (Setvar "cmdecho" 0)(setq m:err *error* *error* *merrmsg*)(setq sset (ssget))
& n; Z/ z0 g( {% b$ y           (if (null sset) (exit))(setq kt (getstring "\nJoin all (Y/N) <Y> ? "))
( O, U8 \" U$ l) w# a, O          (setq ssl (sslength sset))(setq temp  (entget (ssname sset 0))etype (cdr (assoc 0 temp)
2 o& p5 Q4 d# q- i        ))(cond((or (= kt "Y") (= kt "y") (= kt ""))(progn (cond((= etype "POLYLINE"); U/ |3 L0 p2 J7 p
        (COMMAND "PEDIT" sset "J" "all" "" ""))(if (or (= etype "LINE") (= etype "ARC"))
8 p. D% D, V/ j: J4 T  g: F           (COMMAND "PEDIT" sset "" "J" "all" "" "")))))((or (/= kt "Y") (/= kt "y") (/= kt ""))
1 n# d, P- t% \/ l        (progn (cond((= etype "POLYLINE")(COMMAND "PEDIT" sset "J" sset "" ""))  $ d) m- Y" R& I& J  G" E
           (if (or (= etype "LINE") (= etype "ARC"))(COMMAND "PEDIT" sset "" "J" sset "" ""))))))' Q! q, C$ _: j% U. {* q4 e2 E8 a
          (setq *error* m:err m:err nil)(princ))$ g+ ^2 Q4 |  b# V, P* M' M
! `3 d6 x. l, d2 @
;=====================================================================1 y" M/ a4 D1 }0 a  G; s
;;; DOOR.LSP 1.0, Copyright (C) 1998 by CAD Department, HUCE.: }, D- ~( X; c7 @6 U( V! R$ G0 O
;=====================================================================
0 l+ c4 j* c/ w3 f! Y, h- ]6 U. l
. b* o' O3 ?: o" g(defun C:D1 (/ p1 p2 p3 p4 side dis wid ang angsile old)
" X. |4 [: m% k' O6 X (setq old (getvar "OSMODE")) , M) t! Z3 x  g( U' t+ v

7 p/ ~; l: u* Z, V1 z (setq p1 (getpoint "\nStart point:"))! i' B: J, z. b: K
(setq p2 (getpoint p1 "\nEnd point:"))2 w6 f- U9 p  L$ R* q
(setq side (getpoint p2 "\nOpen side"))
0 D$ j, }/ D- V4 M( o0 `% c3 s0 N& t8 m
(setq dis (distance p1 p2))0 e) ^5 {& f* p6 R7 m
(setq ang (angle p1 p2))8 m! L/ o+ y4 R" @" {7 i& @
(if (< ang (angle p1 side)): Q* t) v* P' S( I
  (setq angside    (/ pi 2) )
1 f# d+ p1 \- J2 v* n8 s- Z4 b  (setq angside (- (/ pi 2)))
5 T; l/ ]* w) k. v; { )0 m/ r2 Q' E4 j; ~/ I5 M
(if  (>= (- (angle p1 side) ang) pi): K* A$ s) ^- R% I: C+ j0 ?! |
  (setq angside (- (/ pi 2)))
9 v& p" g1 h+ d+ G )
" T; X7 W1 V5 ]( ^ (if  (>= (- ANG (angle p1 side) ) pi)+ W4 X9 |  o3 S: H
  (setq angside (/ pi 2))
3 V' C+ n, L) B; U )
* K( \) T7 J( K0 ~+ I8 A/ S, ]5 _, ]( t1 a6 J8 {
(setq p3 (polar p2 (+ ang angside) dis) )
  _" b) r3 l3 e! W, y  h  p (setq p4 (polar p1 (+ ang angside) dis) )
: @: t" ?; j- K! U! e& |- q (setq wid (/ dis 15))
4 e, @0 `4 B0 Z8 r( v) Y0 c
. ~7 j# e5 P' |4 a: `$ l! y; u8 P (setvar "OSMODE" 0)
' B9 m$ i' b" L) U. ]
$ m9 \5 t7 J1 B! @7 l5 S' R- u) W (command "PLINE" p1 "A" "D" p4 p3 "L" p2 + W* x7 y* n: ~+ r6 P9 Y
                  (polar p2 (+ ang pi) wid)
8 |  h, U3 c0 B* a: w- N                  (polar p3 (+ ang pi) wid) + ^; T: J/ x# r7 G1 W
"")5 u3 W4 x. o1 C; Q8 q4 E3 Q  Y

* T2 I1 a0 L) e, y! Y (setvar "OSMODE" old)4 \3 F. g" W+ M# K/ j9 y$ K1 n
(princ)+ Q1 h& p! _1 V' I' z1 {( V# V1 L
)
- Z6 Q3 ?  `$ h( p4 s- j- C  y; T0 v
;=====================================================================) c. r; Q  j: ?8 b

% z% z1 R" G; X(defun C:D2 (/ p1 p2 p3 p4 side dis wid ang angsile old)
- j- B$ {4 {3 k" J; B: a (defun cua1 (pt1 pt2)! T: m. H; G0 S0 Z) H, ?
  (setq p1 pt1" a2 J1 w% c  k# r' b. R- X
        p2 pt2)1 l* e8 ]# _2 O% g, Z* C( @
1 _# N9 m& a# C
  (setq ang (angle p1 p2))
, V0 R' @8 H) b0 D  (if (< ang (angle p1 side))9 M, W0 y4 N/ ?
   (setq angside    (/ pi 2) )
! A: W( W, D" t9 ~/ }) K   (setq angside (- (/ pi 2))), H# s. E' N2 _4 g& u% d1 S
  )
+ x2 W  e$ x9 M8 W6 C  (if  (>= (- (angle p1 side) ang) pi)
" R& q9 R/ |1 \2 ]$ a   (setq angside (- (/ pi 2)))
! K9 B" s) Y* }) Q% G9 E  )
3 q1 z: V3 R2 D9 L( c& d  (if  (>= (- ANG (angle p1 side) ) pi)
; U0 d( Q# L: k; b   (setq angside (/ pi 2))
  P5 t' ^+ V% U9 s# r  )2 Z( L! R9 u) b7 c: c0 R

& v7 W) z' Z. v+ a1 A* {; O( z  (setq p3 (polar p2 (+ ang angside) dis) )* f% t8 C) }2 H: y& ]2 P
  (setq p4 (polar p1 (+ ang angside) dis) )
) N$ G0 |, ~( J1 i  (setq wid (/ dis 15))1 w* ?4 N) z9 ?+ n$ J- W* T( f
$ e, ^* _" X% b
  (command "PLINE" p1 "A" "D" p4 p3 "L" p2
+ t6 z2 y& d0 H/ T6 R, T. |                   (polar p2 (+ ang pi) wid)
9 p' k0 x+ i! L7 b1 y" p; K; Z3 C                   (polar p3 (+ ang pi) wid)
; F& r1 h2 i% h4 c) A1 {  "")
- V, e3 e$ A4 c7 r, y9 b )
: r' o+ {+ c3 p6 v$ }! [; \# L;=====================================================================+ m: ^- D- N$ ^5 ?7 V% s
(setq old (getvar "OSMODE")) . v0 K5 m4 u1 [
  n& f- ?/ S2 d! Y5 L6 w" G# i
(setq p1 (getpoint "\nStart point:"))4 h. a7 x$ z  |' k. K
(setq p2 (getpoint p1 "\nEnd point:"))( S  ?9 [5 @+ y' C, j
(setq side (getpoint p2 "\nOpen side"))
) X; x- A5 c; A8 O. o
* p( }+ O. _7 o4 o+ R (setq dis (distance p1 p2))2 d! \0 S  C0 }
(setq dis (/ dis 2))3 [7 s' G& U, L  v
" T+ v  {2 o9 |- ~4 \
(setvar "OSMODE" 0)
" k( c2 j6 J- w, h) |
7 v* J, U. u. z/ C. Y (setq p1 (polar p1 (angle p1 p2) dis))
) {; i/ x& M+ E  K. W (cua1 p1 p2)  1 c: z4 s/ `4 i" @1 `

# B# e$ d+ c4 ^, j- {3 O7 {$ [: U' X (setq ang (+ ang pi))1 }8 }: ^! s+ n! ~  T
(setq p2 (polar p1 ang dis))
2 j: r+ u3 G. J0 L; O; (setq side (polar p1 () dis))( B7 X& S6 P3 q
(cua1 p1 p2)  / u1 t" T  t% q6 I0 Z3 e1 k' {

. j1 b) c2 h; ~: `) Z: @/ }& s% f3 X (setvar "OSMODE" old)- z$ u. {' y! `8 l8 x; G
(princ)
) T( }+ ]7 W8 x4 j. c' X/ G)
3 d4 {2 ?. T- t' X6 j$ T5 r6 O
* K& P# u1 ^' h2 S; W( q* @;=====================================================================
; R( k$ c% X/ h3 \;"Glue" text strings.  All adopt first's properties./ [* s% z' a2 h4 i- m
;        Author:. B- L- X3 h+ ^! E, n6 W
;                Henry C. Francis' E3 K  |* M( [$ J4 o0 X
;                425 N. Ashe St.' H' C' t! F3 {! I
;                Southern Pines, NC 28387' Y6 ~5 p+ D4 ~7 ]( x; P# `
;        http://www.pinehurst.net/~pfrancis
) s9 H5 q/ ]: x;        e-mail hfrancis@pinehurst.net0 G3 k4 n7 b7 A0 o
;        All rights reserved.
4 D4 n( T5 j. ^9 U2 l/ C(defun c:gst ( / ename ent1 ent2 old1 oldsl old10 old11 old40 old50 newstr newsl new1 new10 new11)
* c* S, C+ k0 W; g# h(while
9 i7 [# u8 V. W1 W  (not( |. o) [/ ^, K  G5 F# d
    (and2 H/ |- e' i5 t" ~
      (setq ename1 (car(entsel "\nSelect first text string to join: ")))
# x5 _' y5 L/ V# W: m& m3 C4 A8 f; c9 x      (setq ent1 (entget ename1))
6 R- b; F+ G! O* |; `, ^      (eq(cdr(assoc 0 ent1))"TEXT")$ A* \% P( f* H
    );and
. X  h& V2 M1 Z9 z/ I4 F+ Q. H  );not# `, t6 Q4 L. _, H# X" K2 G2 O
);while
# r+ x4 Q! |6 d5 n/ e. n( v* R  e' [% _(setq old1 (cdr(assoc 1 ent1)))* u+ l4 k3 i9 z  \( q. u- B
(while
8 d+ h3 ~+ l: ?5 T7 D  (not
; [& Z, ~- X  ~4 _    (and
6 [3 A" E0 l: t# Z      (setq ename2 (car(entsel "\nSelect second text string to join: ")))3 ?) t9 B2 i/ F
      (setq ent2 (entget ename2))
" j' K1 F) F' ^+ q      (eq(cdr(assoc 0 ent2))"TEXT")2 u0 ]% w0 E2 o. V1 Q. }
      (not(eq ename1 ename2))) t8 @, d; m/ l% u  @) F1 l( |
    );and
' m! f3 O& W6 c( w3 P, x  );not! H% B- R2 o% e/ A3 Y- T
);while* q5 h- i" N/ R% U" @  D) u
(setq old2 (cdr(assoc 1 ent2))): G" p0 @. e6 u- c; n3 _
(setq new1 (strcat old1 " " old2)
/ ~0 w& u. r- V3 U6 U" |0 O& F! Q      ent1
& [7 O8 M7 `+ h; ~/ f: G8 ?$ S        (subst (cons 1 new1)5 @& e) i, `" r$ R( |" H: A
               (assoc 1 ent1)) N) d9 d& h+ s5 C
               ent1)7 A( b* i1 L! v" }; d
);setq
, H% }, i# l. q(entmod ent1)7 O# u% x: v0 p- a4 _- U5 B
(entdel ename2)+ N$ m0 S: v+ ?2 P) }: ~/ b% Y
(princ)" Z. L1 G' P6 l. S6 e
);defun8 K4 `. a5 z  c" y: K  U
: C8 j" s, p/ E7 w
;=====================================================================
/ ^0 U5 m; [) R3 |: v+ E9 v* O& D! Z" m+ Q4 F: e0 I6 a' X
(defun c:nt (/ g1 g2 ss1 olderr nterr l i temp e1 e2 new old dd dc)
  @. [, K7 b" `# Y2 j3 F, s& l5 x" H! [7 `, p2 t
    (defun nterr (s)
2 k, R" P: B, K3 Q# w% Y* P' a        (command "_.UCS" "" "_.UNDO" "E")  @5 R$ W) w  e& D8 q
        (setvar "cmdecho" 1)
/ m6 E7 p  g# N6 z        (setvar "blipmode" 0)' W+ W" q: f4 ~6 C* {3 S
        (setq *error* olderr)
0 ^! [) G2 j+ ]        (setq g1 nil g2 nil ss1 nil e1 nil e2 nil olderr nil
3 x+ W( c0 }# Y' h% S, v* `                nterr nil temp nil i nil l nil new nil old nil dd nil dc nil)6 h; l, D$ V: l( l5 E
        (princ)
1 r; }- K; E9 }/ s* O; X    )" _) c' c" x) S3 j0 a% A4 x
1 Y- i+ N9 a' P5 n% ~8 [; h+ b9 ?
    (defun tim_in (dt / p01 p02 ktra)
2 F0 x0 Q5 T4 o* |+ V* T        (setq p01 (cdr (assoc 10 (entget dt))))
1 }- i. O2 z2 }! w" B        (setq p02 (cdr (assoc 11 (entget dt))))) ?8 q. U, }( V+ f
        (setq ktra T)
6 Z  x4 ^* N3 [( @6 j. |        (if (and (> (car p01) (car g1)) (< (car p01) (car g2))
+ p- I+ s  L4 n! D& y/ u( o                 (> (cadr p01) (cadr g1)) (< (cadr p01) (cadr g2)))
; s$ B$ t- W* `: K3 X9 p            (setq ktra nil)) {) W' ?+ h; F2 V' w# f
        )" p: w- M0 u" l0 \! _* Q
        (if (and (> (car p02) (car g1)) (< (car p02) (car g2))
# w" W/ R5 [  ~2 A! s7 d                 (> (cadr p02) (cadr g1)) (< (cadr p02) (cadr g2)))
# I; }2 {) d! y: Y            (setq ktra nil)4 J( U, a  G1 z* h! G
        )1 L8 B9 }1 f4 E$ K* ?, ~
        ktra
- E7 `4 d0 N2 H. i/ Z   )1 i" y* H$ W3 s) G% t) }
3 v  q+ I8 y! P  {) b. p8 n, A9 `& p* z
   (defun timdt (dt1 dt2 / p01 p02)
  \" J( s; b. Y! @1 q3 W        (setq p01 (cdr (assoc 10 (entget dt2))))4 H3 q5 E  V% o( c/ ~9 k
        (setq p02 (cdr (assoc 11 (entget dt2))))( w& Q2 {3 ~) G6 c" N, M$ K. G
        (setvar "ucsicon" 0)9 d4 m+ A% n( v
        (command "_.UCS" "E" dt1)* [5 A- {2 k: y# Q
        (setq p01 (trans p01 0 1))
3 G7 n3 _, K- b- b0 e        (setq p02 (trans p02 0 1))
& `* o  [. }, r/ E( {. h        (command "_.UCS" "")7 i. [  m6 g1 w( U/ e
        (setvar "ucsicon" 1)
! P7 l# }8 |1 l* P. \6 V6 Y        (if (and (equal (cadr p01) 0 0.001) (equal (cadr p02) 0 0.001))/ M- d* ]: [8 w+ {0 }' X
                T: h8 t$ g: Q7 W# d- m
                nil
( v- V  Z- w7 u% ?        )! ]$ [. b% Q. {: Y( Y9 z2 U
   )
, _" M8 O4 z- l- v5 l9 c5 t+ k: {6 n, _9 V/ X
    (defun tim_out (dt / p01 p02 kt)
0 x4 j8 T. a* z7 e2 B: I        (setq p01 (cdr (assoc 10 (entget dt))))
5 |' y  \  [' g        (setq p02 (cdr (assoc 11 (entget dt))))# n% a- t8 r0 [6 O
        (if (and (> (car p01) (car g1)) (< (car p01) (car g2))
9 L* r, |4 R0 D: J3 H/ t                 (> (cadr p01) (cadr g1)) (< (cadr p01) (cadr g2)))
, k" j4 N- a  w" d. u            (setq kt p02)
5 f9 H4 @8 M$ c* A6 h1 @        )
( o7 N6 a3 Y! ?1 X/ Z        (if (and (> (car p02) (car g1)) (< (car p02) (car g2))
4 m, R' D8 p" U) ?) f3 P3 E                 (> (cadr p02) (cadr g1)) (< (cadr p02) (cadr g2)))% l% o+ A* v% I, ^. G* g5 F
            (setq kt p01)" j/ Q% Q5 Z0 e! h, G( J
        )
) a4 ?9 a0 P( E$ j        kt        
2 f) _, y: [3 C$ Z* Y   )
$ w" T- h& Q) ], I
" M$ j( ~' r  M( ?! }& W    (setvar "cmdecho" 0)
! F! J2 A7 [& `+ R* t: K4 D3 K. L    (setq olderr *error* *error* nterr)( p3 f$ x: G4 V0 O
    (command "_.UNDO" "G" "_.UCS" "")
7 ~$ w8 T5 O# V/ P& f& x    (while (null ss1)
, p0 d* P/ v1 _) @* |  u+ e        (princ "\nChon tuong muon noi...")
- ^1 V# z# Q8 R% ]        (initget 1)* U" E* n2 k8 O9 u0 W9 x0 F& D
        (setq g1 (getpoint "\n>Goc thu nhat:"))
* {  S5 B) W3 i6 C        (initget (+ 1 32))3 C6 u" T3 L' @
        (setq g2 (getcorner g1 "\n>Goc thu hai:"))
4 e2 P5 w, V: ]: P  \        (setq ss1 (ssget "c" g1 g2 '((0 . "LINE"))))
" L. ~: i: v' `        (if (null ss1) (princ "\nKhong tim thay doi tuong!"))
1 m! a% K6 Z9 p8 d0 f, `% q8 t9 j# j0 f    )
+ j' D4 G( N% `  ]/ Q/ Q1 M: m% y  @% Z' {* R6 q: J
    (setq temp (list (min (car g1) (car g2)) (min (cadr g1) (cadr g2)))" y; ~$ T% N3 R+ R7 z9 d
          g2 (list (max (car g1) (car g2)) (max (cadr g1) (cadr g2)))# R1 x/ @( L1 \, |( ~4 W) _# P
          g1 temp)+ H) L" ]; {* r$ g3 b9 Y; B
   (setq ss1 (ssget "w" g1 g2))
; Z, ^0 o2 ~) C8 L7 c   (if ss1 (command "_.ERASE" ss1 ""))- K% u) E( L& _: c# s
   (setq ss1 (ssget "c" g1 g2 '((0 . "LINE"))))% a- H9 M' ^: ?8 m# J: }# H3 a
" H- n( X; S' e% V7 v# o
    (setvar "blipmode" 0)7 e- @. ?# v; K8 X
        (setq i 0 l (sslength ss1))
; f% Y4 a, E+ c8 z; O5 F2 o+ K        (while (< i l)6 L! l3 q6 g7 y0 H$ H* \
           (if (tim_in (ssname ss1 i))1 E5 Y: Y% g2 k+ X
              (progn $ b* v' D4 W  i, ]3 Z
                    (ssdel (ssname ss1 i) ss1)
4 H( u- H) T1 o' D9 ~" O$ M% O                    (setq i 0 l (1- l))
! B) ]- B* k+ T2 t  x              )        - Z$ \( c* E1 u& n' Y* @" b2 N
              (setq i (1+ i))
" X. W$ e) ~9 I5 R           )
" w- I& Y+ n  B* k1 h( \        )- i  q+ @4 U! T+ d/ M+ K2 M
        (setq l (sslength ss1))
& X+ E+ W- a' `% o: }7 r# g0 Y      (while (>= l 2)
: ?7 ~3 W* P* b- R2 M/ W        (setq e1 (ssname ss1 0))
' g3 N( z0 E3 R        (ssdel e1 ss1)
$ j$ B, W* z1 Z" G# \7 d; R) b        (setq e2 nil i 0 l (sslength ss1))6 ?! u: a2 a9 h# L# f3 V& k) s
            (while (< i l)
0 e  M: x- Y# [5 b& K                (if (timdt e1 (ssname ss1 i))" J& y) ^1 n, I- a
                    (progn& o" o7 Y% P- k3 p" b" i
                        (setq e2 (ssname ss1 i))
1 Y+ K  c: J5 R, w& ^$ }0 o: d                             (setq dd (tim_out e1))
7 n' w8 Q, K# X0 X1 `                             (setq dc (tim_out e2))$ o7 a. u$ G3 y
                    )# X3 X# F5 {3 W
                )8 L! A+ \" s( k4 G
                (setq i (1+ i))
2 k6 F8 z% [) z5 j. J            )
2 h  t" q# O& p+ e            (if e2 (progn$ K/ V6 E) v( b+ |/ ^2 Z
                        (ssdel e2 ss1)                        
% a: c; b" G! |                        (command "_.ERASE" e2 "")
& Y3 F/ g' B: T  i1 A                        (setq temp (entget e1))
( x4 E7 `# p: i# ^! w1 H3 F- h( G                        (setq old (assoc 10 temp))+ L! t% y3 s  V" C" F6 D
                        (setq new (cons 10 dd))7 x' T/ R6 S$ k, O
                        (setq temp (subst new old temp))
& ?! u% C6 q# w  f                        (entmod temp)
% K  K$ u3 F* A8 c                        (setq temp (entget e1))
* K7 I3 Y" p# {6 G                        (setq old (assoc 11 temp))
3 _# J6 W0 ?* V4 n                        (setq new (cons 11 dc))# Q+ l8 F3 k, l- c- g% ?, @
                        (setq temp (subst new old temp))8 H6 L' n& ~1 }
                        (entmod temp)$ Y2 a" [3 d) |+ X
                        (redraw e1)  P4 \1 h% M. M9 K0 |
                        (setq l (sslength ss1))
3 V! [6 `6 U4 b5 n$ Y9 S6 b8 }                   )
+ R5 l( H8 T. T. c            )
& E& T' I6 q* G# v        )1 V8 R) \. z4 s+ {

: P1 t* {" a  _8 L        (command "_.UCS" "" "_.UNDO" "E")
0 ?2 x& R: U/ L2 S        (setvar "cmdecho" 1)
7 ?4 C4 N6 G: r. F& N7 V        (setvar "blipmode" 0)
. j: Q. R2 O6 y8 @        (setq *error* olderr)1 C5 H5 T3 X9 n0 I
        (princ)/ h3 _1 r6 w' a5 u2 j
)
+ O$ _( H, d. H;*********************************************************************
% @8 U5 A2 q6 p3 [* t(defun ketthuc ()( m) {. W4 {0 @3 y
        (setvar        "cmdecho"        luuecho)# T8 ^5 a5 ?$ {) R
        (setq *error*        luu
0 f% }0 c$ m/ E  R: U' F                luu                nil        
( G( ]8 q# n0 [# I  v                luuecho        nil0 k1 ~. r) r: q, [9 E& _
        );setq6 q! }- ]* X4 [8 j- a1 G
        (princ)
) |8 a2 {/ o" W# @% ?)                1 w. P0 g9 m- z- B
;*********************************************************************7 A3 u4 e9 Q: I. _7 N
(defun modau ()
! T# A: d; v' b, c$ E* Y(setq         luu *error4 k: x$ ]. a! p7 E9 s
                luuecho        (getvar        "cmdecho"). H/ i. n; f0 C! L4 y
                *error        (ketthuc)0 n( r' O* t' [  y6 A0 ~5 {
)
( v6 ~5 c4 B$ r% i/ W+ n: `6 })  }1 l3 T% A/ ]$ K) p/ q1 _
;*********************************************************************+ V! ], n8 I: Q9 X9 c
(defun xulytext (text / kytu ma sokt luusokt lui )5 V0 R3 s% v5 U5 W% i9 `# Q
(setq         kytu        (substr text (strlen text))
# D0 u% ~: @- E* m) n1 Z+ m                ma        (ascii kytu)
& Q5 c* a# ~9 n7 s4 y( R                sokt        (read kytu)
% X: i: i, ~" y6 S                lui        1& @& Q: H8 j% ^5 |
): L. N& Z7 K/ D8 {$ ^: o
(if (numberp sokt)# i! G+ P/ c% K
                (progn  j1 o( K  p# f2 L9 u
                        (setq luusokt        (1+ sokt))- K2 p, h- T& `8 c
                        (if (and         (numberp sokt)
4 |7 |6 w4 W: r$ M# B5 D9 M                                        (> (strlen text) 1)* b" D4 q* A) s8 w- o$ l0 W
                            )        & ?4 i8 O, U# J3 u" k7 B+ v
                           (progn: M  R5 N6 \& ~, W, u
                                (setq         kytu        (substr text (1- (strlen text)))3 ^0 `. I# h1 T# c6 a  V1 E
                                                sokt        (read kytu)
: d* F1 v7 l% u                                                                                )( A0 h3 P. u4 Q- b% e9 K, A& D+ ?
                                (if         (numberp sokt)
0 f! ~+ n! c+ a: w2 |                                        (setq luusokt (1+        sokt)
+ v1 g! o( b) L& c* u1 M                                                        lui         2, X' I! c8 F* D# T: x
9 I/ ~% x# z& U7 R; `# K( y
                                                )
2 _* H% u5 E8 l! T2 m$ R# ^                                )+ F8 {+ h, K3 W' K7 I* R) |
                            );progn        
2 \; F8 O3 m$ |, @                        ): I8 v0 `2 g+ J0 C, T% K
                        (if (= luusokt        100)        (setq         luusokt        0))( f: e$ j7 A! v; D
                        (setq         kytu                (rtos luusokt 2 0)
' k+ Z5 i; G" }, r8 z                                       
- u: Q7 ^, ~/ J6 T                                        text        (strcat        (substr text 1 (- (strlen text) lui))  kytu)
2 O' R' F: c+ u4 Z* p                        )
! l# q0 ~' z& \6 v* H. g                );progn                         " P% D$ N* b' S0 h- f2 q
                (if   (or         (= kytu "z")
& w7 {  P) j7 H6 y                                (= kytu "Z")6 G/ n- d) {" `, K! h, S0 _# x
                        )
" _5 D+ I2 Z  A) ?                        (setq         text                (strcat         text        "0")
3 c9 b1 s4 o% F5 h( b, s* u( F; h! m                                textxl                "0") D5 O8 s1 p! |! I2 ]/ j$ G
                        )
" Q  `* B, D3 H0 |5 P2 q5 P( `2 B                        (setq                ma        (1+        ma)
0 E* U0 F2 X/ J" [2 l0 u                                        text        (strcat        (substr text 1 (1- (strlen text)))  (chr ma))
) Q3 P7 V5 q; F  d! X" z1 a2 {2 W                        )
5 L6 C5 K3 y4 B                );if/ l( w, h. H6 F5 S' w7 \- {) D/ i% _" X
);if3 K. o1 P* g7 l% I6 m* ?3 {
)
' B5 b# s5 B9 t4 b" z, \% c3 r;*********************************************************************7 O7 x/ `3 w7 V& C0 j$ R
(defun doitext(tendoituong / chuoi doituong thoat tam dsach kieu text vitri10 vitri11 dem canle)
) A, O; h) f; l' S;Neu doi tuong la text thi tiep tuc0 x. a' R: p' ^8 C3 c  s
(setq         doituong         (entget  tendoituong)! e- H! N* z! V' J( I0 _; p( j" B" J
        kieu                (cdr (assoc         0        doituong))& I. l) ^( P/ ]) @
        canle                (cdr (assoc         72        doituong))
$ p4 V; r- `( e8 i4 U& [)        
& C' ^! H( g3 q# y- |* w- ~; z. N(if (or (= kieu                "TEXT")/ V8 I& ]% S5 i! n) b8 K* t
        (= kieu         "MTEXT")        7 e- F% M! e$ E) S- I  r
    )         2 ^, G: n9 t' d+ n1 w: t
        (progn' C2 q) O! K% N/ x/ P( d! v
                (setq        textxl        (xulytext textxl)0 T- l3 u$ u0 f& `0 F, D
                        text        (cons 1 textxl)7 N3 j8 o3 W. x/ G" h
                        vitri10         (cdr (assoc 10 doituong))
0 C- o6 ~4 i: a) A% _5 O                        vitri10         (list (+ (car vitri10) (car vitrilech)) (+ (nth 1 vitri10) (nth 1 vitrilech)))8 b0 q+ }# u- C; t6 \
                        vitri10                (cons 10 vitri10)4 f: _$ Q9 @) f3 N7 H" @1 R4 H
                        vitri11         (cdr (assoc 11 doituong))8 o2 d9 x! W/ S# Z5 o
                        vitri11         (list (+ (car vitri11) (car vitrilech)) (+ (nth 1 vitri11) (nth 1 vitrilech)))- v8 A; X1 Z8 [5 Y. X( O
                        vitri11                (cons 11 vitri11)
, ^+ _! H- n& n4 l) o7 ^                        dem        0
& O6 p9 P. c1 j/ G" s) d                        dsach        nil3 k$ ]8 R9 G# ~" s+ ]7 K: p
                )
' r; d; y2 [5 g, l# q                (foreach tam         doituong
+ V3 i. x" X1 r& _+ G4 o2 X' {                        (cond
4 ^; d/ E0 N. A" w; {                                ((= (car tam)        1)        (setq dsach         (append dsach (list text))))' N0 n7 s0 J" h6 b# J
                                ((= (car tam)        10)        (setq dsach         (append dsach (list vitri10)))). r  t' s0 C4 _
                                ((= (car tam)        11)        (setq dsach         (append dsach (list vitri11))))
4 W! E( A" m6 L                                ((setq dsach         (append dsach (list tam))))3 W9 u; B4 G! w. v4 p
                        )8 ?$ Y% B  h3 F' B8 u( c( p$ W
                )
7 a5 H4 c' s4 y7 @& }' T# ~9 U                (entmake dsach)
$ s5 L% e9 G: S        );progn; N6 U( I3 M" I& I7 V( P1 Z2 l7 R
);if+ r2 l+ K3 L  q2 h  h& D
        );9 t+ N& z  ?+ R- T4 U7 \  ?3 |. C
;*********************************************************************$ T2 d. d# X3 D2 n: o
;sao doi tuong cu sang vi tri moi5 ~) q# C2 \8 B% G& d

$ q& Z2 p4 A3 _( I. N  b' O* p6 x(defun copy_dt (tendoituong )
$ t- e+ Q( ]* x(command "copy" tendoituong "" goc toi )
; g" i% s$ F, x  @);defun( ]3 `1 O) `: G3 C, A& i5 Z- x1 ]: o

) U8 W) S: Q/ |- p8 w/ D6 Q;*********************************************************************! M/ e/ I4 w0 |! `/ x! F

+ R  h4 V3 Y& v! {  a" }( l! o(defun c:ct ( / cumdt dodai thoat dem ten doituong textxl dem goc toi)
6 {. _' H0 F9 G. ^9 ^/ Z; Khoi dau cua chuong trinh
7 }/ G: g9 ^% I+ \( B(princ "\nCopy Inteligent...\n"); B4 X7 W0 k' ^& ]' Z
(setq         luuecho        (getvar        "cmdecho")$ R$ m2 F- N1 u8 v5 J
        luu        *error*
, z* R6 e  H! Q+ B" W        *error*        ketthuc) I, Q, G  y1 _3 ~. }. k  J% o! ~
        cumdt         (ssget)
% h5 x: W" F5 V0 I$ t; |/ S        dodai         (sslength cumdt)4 `" [' {( V7 T, a( c
        goc                (getpoint "\nSelect base point:")
, v9 w6 p# J% x4 M; w        thoat                nil2 F0 e4 H0 q- c2 c2 @" v- h' V
        dem                0
6 o' ?' c- N! z' W        textxl                nil" c, J5 c, a% Z9 Q2 C' h  ^4 O
);
, z; {, u+ \( S' G9 ](setvar "cmdecho" 0)
6 S8 z" y4 _: L5 h0 G+ u) z- I' M; Loc ra duoc ong text de xu ly
" [) w0 }0 T9 H- E6 Z& u(while        (and         (= thoat        nil)% y/ @4 y( ?5 @9 s
                (< dem        dodai)$ F4 c. \: V2 E
        )) c$ v6 f  E$ I
        (setq         ten        (ssname cumdt dem)  D' c# l% V4 c+ U3 \8 w
                dem        (1+         dem)% W$ b2 l, q- p2 ~% A$ G7 V
                doituong (entget ten)
3 ]- I- j2 \7 K' P) g* X                kieu         (cdr (assoc         0        doituong))                        ( p# Z* x0 J( g7 o( H1 ]( ]: e
        )
  [& T+ r* _2 N2 F        " s( Q% Y% d- J# Z6 d
        (if (or (= kieu                "TEXT")# U, J9 A& t/ A( V( ~
                (= kieu         "MTEXT")        
% f" z: B  u$ J7 w% r                ), ]. }; ^/ Q& G1 @; H- l- {. y
                (setq         thoat        T
  V$ n1 s* t: S) @; E( `' n: y                        textxl         (cdr (assoc 1 doituong))         
8 @; X4 A. D( }: O- Q% }; _                ); _' V* u  f8 j* h* x8 f
        )
  n3 N# P$ ]  ^& @9 ~6 i) Z);% J/ D# U* L/ W& @! [" t: Q
(while T + K% w/ Z8 s/ o3 N
(setq        toi                (getpoint "\nSelect next point: " goc)
$ R+ ?! z. i: \( Z  ?4 {: W6 p. S        vitrilech         (list         (- (car toi) (car goc)) (- (nth 1 toi) (nth 1 goc)))
5 ]' A" f0 \: g' f2 L7 s        dem                0) M4 C: D4 m0 v& q9 |% p% d  v: @: c4 E
)
( u  q7 l, r! n  A1 i  y(while        (< dem dodai)) x" e& p1 l9 L3 M1 }' w5 B+ q
        (setq         ten        (ssname cumdt dem)  {) x& {+ C% f# h: Z
                dem        (1+         dem)
1 f, ^6 j8 O; A& }9 l) Y( |8 N                doituong (entget ten)
! L: p% w2 S" D9 U3 i! f                kieu         (cdr (assoc         0        doituong))                        9 S- D5 ^. e% N8 Q, Z9 t5 G, p& P5 \
        )
' I2 K7 M, ]9 Y: F9 |. ?' {% ?. s% {; I) `
        (if (or (= kieu                "TEXT")
7 \- m& Z/ s. f. t  m                (= kieu         "MTEXT")        
- H% v3 D+ i( H+ H; X3 {. h; `                )
- C% g% o) F4 d6 x: Q2 G4 T4 P                (doitext        ten)1 T. R2 b! x7 x
                (copy_dt        ten)
/ g" k  h8 s' A; B. D  q6 Z/ z$ H! o) V# ~1 k" H: [
        );if
% P* g1 k$ h0 K9 _; `/ d7 b8 S9 e)
% V$ C9 a) m. q) {% J);while
7 w* C  _! e- k! r5 K(ketthuc)
: w3 k( G  ]( c" p% I; U' l$ ^  G);defun
7 B/ X( \5 [  X: v9 L- I(princ "Type \"DG\" to start"). N/ \! \, Z# }
;Note: bien toan cuc: textxl vitrilech
5 s7 k/ D* q* i* N& q/ y8 o
+ z0 p7 P/ \  x& B/ I;=====================================================================1 y, Q* ^! K3 H& |1 {4 S, [2 t/ E
;;; PLJOINFUZZ.LSP
: V+ }: M/ d" v$ A. r/ n; @+ g;;; Joins lines, arcs and polylines using a fuzz distance; H. k* C+ K; b0 y" M! b. l
;;; If only one object is selected it tries to join to all objects that are possible  ^' S- n9 L6 V0 T
;;; By Jimmy Bergmark
) \5 l$ c6 w. J8 w, R4 [, ^;;; Copyright (C) 2003-2004 JTB World, All Rights Reserved! P3 N  y  |5 _
;;; Website: www.jtbworld.com
6 y& B' @8 ~& g  I' f;;; E-mail: info@jtbworld.com5 Z' j) e9 P5 v9 c/ h( T! h
;;; Tested on AutoCAD 2002,2004 and 2005
0 `4 U; O+ a+ b) X4 m;;; Latest revision made 2004-11-11
2 w+ ~( v7 R8 l. ?, s' g* U;;; Minor code cosmetic change made 2004-11-13: ~6 i4 ~* T$ I9 a2 O, A
;;; Bug corrected 2004-12-23
/ U4 q# u% o/ H
9 p, ]9 J! s' r( W& Q! x(defun c:jf () (c:pljoinfuzz)) ; this line can be commented out if there is an existing command called jf
" K$ y  ~. z0 U' u  o" O(defun c:pljoinfuzz (/ ss1 entLine objType oldcmdecho oldpeditaccept fuzz okObjects)
  C; S1 F9 \; ?1 ]& q! D, o  (setq oldcmdecho (getvar "cmdecho"))
2 N9 k+ D* f: i" U& g/ \3 y  (setq oldpeditaccept (getvar "PEDITACCEPT"))3 B6 `9 d. l, @8 D( A% r  a% k
  (setvar "cmdecho" 0). k) |) ?; q8 ^8 R4 ?/ B
  (setq A2k4 (>= (substr (getvar "ACADVER") 1 2) "16"))
+ z! t( ~7 c+ v! t0 M  (if A2k4 (setvar "PEDITACCEPT" 0))# x) E2 L6 i$ \! y! }- I- p% f' o6 K, h
  (setq        okObjects '((0 . "LINE,ARC,POLYLINE,LWPOLYLINE")))* `" H  I: T& R3 P# c& M, F) M
  (princ "\nSelect object to join: ")" o- o" T& q* a2 @' m
  (setq ss1 (ssget okObjects))
- ]% q+ d# V- y2 J* K! G  (setq fuzz (getdist "\nFuzz distance <0>: ")); m' `2 \/ W2 }; h/ g% k
  (if (= fuzz nil) (setq fuzz 0))
+ r* `5 {" R! r  (if (/= ss1 nil)
' r, Z1 s- Y0 C. X  x      (progn
4 w3 M- z; Y/ m7 j1 U* q        (setq objType (cdr (assoc 0 (entget (setq entLine (ssname ss1 0))))))
( P/ J1 p9 |  d& H6 D        (if (= (sslength ss1) 1) (setq ss1 (ssget "X" okObjects)))
& _, s; N5 A6 a        (if (member objType '("LINE" "ARC"))+ a3 e# {1 V0 x: V5 r3 L
          (command "_.pedit" "_M" ss1 "" "_Y" "_J" "_J" "_B" fuzz "")( X3 u) i6 q, q( I2 d7 b
          (command "_.pedit" "_M" ss1 "" "_J" "_J" "_B" fuzz ""), E7 V2 M, |, `' Z% i$ i
        )0 i4 u* G( l1 N
      )
/ ~& U6 S) M' s% ~( z2 F  )
! M, U$ t1 ^' F2 E  (setvar "cmdecho" oldcmdecho)( a" K+ n5 p  W$ t
  (if A2k4 (setvar "PEDITACCEPT" oldpeditaccept))2 s7 D" r/ R( K, [" P& i
  (princ)
% O5 E6 c  L( ]! M. T)
* S: L* T' T6 }- Y3 N0 j/ C; `& j( Z. A% L+ v- m3 T8 x
;===========================VE CAO TRINH===========================
1 u0 O( y- ?6 c( A0 s% p  R
4 K% w' S% s! ]4 G" S+ B; k(DEFUN C:Cotcao (/ CMD PT1 PT2 PT3 PT4 PT5 PT6 PT7 PT8 NPI TX DX DY TL OSM OLL) G( w5 b2 c" f8 B  t
                CRST RSIZE TSIZE STR PRMT FCH NBC OLDERR)
! O( k7 P) [/ K0 |; H(SETQ OLDERR *error*, l! O# {, j1 e4 d8 j
      *error* loisb)) h1 ]8 V, V* r* L7 D
(command "layer" "m" "dim" "c" "" """")5 K7 T1 m  E3 v: v' N
(SETQ CMD (GETVAR "CMDECHO"))
8 A( b2 R* _; A- `(SETQ NBC (GETVAR "CLAYER"))
- q" T; G+ @1 S0 p/ z/ D+ Z(SETQ OSM (GETVAR "OSMODE"))
. M5 M0 D) u2 i7 \- a5 V(SETVAR "CMDECHO" 0), b# x0 y5 k  {
(SETQ PT1 (GETPOINT "\nDiem cao trinh:"))
* T0 d  i' h" m3 Z: @(SETQ TX (GETSTRING "\nCao trinh:"))" P, y% `, l! O/ t$ y' b+ _& Q
(SETQ FCH (SUBSTR TX 1 1))
/ T  K4 d5 r4 ?8 u) y$ d(IF (= FCH "@") (SETQ TX (STRCAT "%%P" (SUBSTR TX 2 (- (STRLEN TX) 1)))))4 w* Q7 a* L2 c5 ~* j! {- i
(SETQ CRST (GETVAR "TEXTSTYLE"))2 i. w4 X4 Y9 l% L* K2 b
(SETQ RSIZE (CDR (ASSOC 40 (TBLSEARCH "STYLE" CRST))))1 ~0 q- z3 ]" r2 R6 P3 p  ?
(SETQ TSIZE (GETVAR "TEXTSIZE"))( A, M- D0 D8 u$ i
(SETQ STR (RTOS TSIZE 2)); U) Y/ V  Q9 t& X$ W; f/ I
(SETQ PRMT (STRCAT "\nText height <" STR ">:"))3 Q: c* W6 _8 p5 V9 \/ ?  t- J9 {
(IF (= RSIZE 0)9 z, C& Q8 h3 Z. L+ j- ?. q
  (PROGN
% V: O, L. C) L( [% E0 K- `  k        (INITGET 4)
6 H  d: r4 l0 x        (SETQ TSIZE (GETREAL PRMT))
: |% W- ^) u3 _  a6 J5 r( w8 p6 C        (IF (= TSIZE NIL) (SETQ TSIZE (GETVAR "TEXTSIZE"))( y5 e4 e0 ^* X; b6 \) o7 c( U6 V* {
                          (SETVAR "TEXTSIZE" TSIZE))" ]2 {" Q; {' k8 `1 f( o1 r! J
  ). Z0 @, W) ~2 r7 `1 z1 `" `- r
)
1 U: s  o- b# \' F' X3 F6 f+ p- S(PRINC)1 Y1 g5 v, F* J; i
(SETQ TL (/ (GETVAR "TEXTSIZE") 2))/ C- q% t5 t9 y/ `- _, A1 Y8 P
(SETVAR "OSMODE" 0)4 x( k: M8 A, [9 D0 t
(SETQ DX (CAAR (CDR (TEXTBOX (LIST (CONS 1 TX))))))" v3 k) |) J) B& _
(SETQ NPI (/ PI 2))9 D' |1 c- V7 Z( r
(SETQ PT4 (POLAR PT1 NPI (* 1 TL)))
! ?( s8 o/ t9 d% r(SETQ PT2 (POLAR PT4 PI (* 2 TL)))
4 q; e3 T% h( r; _  P0 j; {! B(SETQ PT3 (POLAR PT4 0 (* 2 TL)))0 K( Y9 l6 s. z
(SETQ PT5 (POLAR PT4 NPI (* 5 TL)))
# \/ F4 }8 U0 }5 z, ?(SETQ PT6 (POLAR PT2 NPI  TL)). f, s' p  H7 u: ~  b
(SETQ PT7 (POLAR PT6 0 (+ (* 3.7 TL) DX)))& |0 K' g) a+ l" @) U! M
(SETQ PT8 (POLAR PT6 NPI (* 1 TL)))
1 \9 A* ~6 E, n0 }(SETQ PT8 (POLAR PT8 0 (* 2.5 TL)))' G9 j0 R( W8 ~6 @
(SETQ PT9 (POLAR PT1 pi (* 2 TL)))8 G8 `: V: P6 O5 A! _
(SETQ PT10 (POLAR PT1 0 (* 2 TL))). S  z% b( u2 O, b
(COMMAND "COLOR" "7" "")9 A9 Q  S$ r( d& _: c
(COMMAND "STYLE" "COTES"  "tcvn3italic,vnh.shx" "" "1" "0" "n" "n" "n")
( j" E! v7 O4 P7 t0 J(IF (= RSIZE 0)(COMMAND "TEXT" PT8 TSIZE 0 tX) (COMMAND "TEXT" PT8 0 TX))
1 Q$ b2 t( Z2 b- @9 d% M% {/ @- H' C(COMMAND "COLOR" "BYLAYER" "")
$ Y' f& j8 p* p  Y3 N(COMMAND "SOLID" PT1 PT2 PT4 "" "" "pLINE"  PT1 pt3 pt2  "")
& _& c, q. j6 {5 K) k9 M, R(COMMAND "COLOR" "BYLAYER" "")" G# c9 T" x8 R  n9 Z; I
(COMMAND "pLINE" PT1 PT5 "" "pLINE" PT6 PT7 "" "pLINE" pt9 pt10"")
* B0 t6 M4 I9 a5 c(SETVAR "CLAYER" "0")
# h6 s* H' h6 u0 ]5 j% Y; C(command "ddedit" pause)
3 I% }8 A# `+ [(COMMAND "COLOR" "BYLAYER" "")
( O/ `& d+ U9 a(SETVAR "CMDECHO" CMD)
4 y! N( q) |9 `: C(SETVAR "CLAYER" NBC)
0 c) N7 K9 z. F6 g/ D(SETVAR "OSMODE" OSM)! \  }. x) V5 V* @: _
(PRINC)# x( W; c& Q3 w5 V* T
)
5 A0 x. O" |/ a  K* G+ j$ M5 M5 j7 g% T+ E+ y* X) ]
;;; =========================== VE NET CAT CHEO (GC) =============================3 C0 M& d% K. J) m! }' ~$ j

1 W2 N1 L, P% [+ P(Defun c:G1(/ p1 p2 p3 p4 p5 p6 p11 p12 l ang)
8 T& U8 B+ n9 D2 X* H, N        (setq x (getvar "osmode"))- G/ L; S; z" |0 T* c
        (setq p1 (getpoint "First point : ")
, m" c+ p% z, H0 Z              p2 (getpoint p1 "Second point : "))7 W9 ^8 m& N! E, [- U
        (setq l (distance p1 p2))
( T6 S& @7 j7 I8 q/ r2 Z        (setq p11 (polar p1 (angle p2 p1) (/ l 5))$ L- k7 g6 E2 D
              p12 (polar p2 (angle p1 p2) (/ l 5)))/ x2 H# |( p2 L4 r
        (setq ang (angle p1 p2))
2 N! h" K) j) J4 X, x, U* A        (setq p3 (polar p1 ang (/ l 2.5))% v  k/ O% H8 z3 w4 ~
              p4 (polar p3 (+ (/ pi 2) ang) (/ l 5)): F+ o% a9 @6 z+ o' b
              p5 (polar p3 ang (/ l 5))
1 W5 y; r. D  T7 A4 h                p6 (polar p5 (- ang (/ pi 2)) (/ l 5)))
3 C( ~2 t4 u4 h; V* v" m& b- Z        (setvar "osmode" 0)
# Z1 j7 u+ J# U4 W0 ] (command "pline" p11 p3 p4 p6 p5 p12 ""), @+ q/ N6 w% Y+ ]
(setvar "osmode" x)) P# X6 E4 P' w# k
)! s# L' ^) B- L! L
;----------------------------------------------------------------------------------
+ `/ o0 e$ b7 M6 }5 R8 P(Defun C:G2 (/  ps1  ps2  pf1  pf2  pf3  pf4  pf5  pf6' y1 q1 T6 j, m, z$ Q6 Z/ L$ l
   pf7  pf8  sb   sh   se   ang  old_osmode);   (setq old_osmode (getvar "OSMODE")); T* K* ?1 Z9 A7 e& P
   (setq ps1 (getpoint "\Chon diem thu nhat: "))
( S4 i+ d/ N1 {/ g) U. U/ {4 |: T0 }   (setq ps2 (getpoint ps1 "\nChon diem tiep theo: "))6 B- G2 w# m. L; V! i" a) a) r
   (setq sb 50.0 sh 200.0 se 20.0)7 g, \" h  \' ^: A4 M, C1 O
   (setq ang (angle ps1 ps2))
1 g6 r. N1 P  l' T, }' |# R   (setq pf1 (polar ps1 ang (- 0.0 se)))
5 Z# \+ o$ R5 }1 z   (setq pf2 (polar ps1 ang (/ (- (distance ps1 ps2) sb) 2.0) ))9 m. G% p( j; E4 Q# U
   (setq pf3 (polar pf2 (+ ang (/ pi 2)) (/ sh 2.0)))
0 t1 G2 l3 C. S2 c' ?7 Q   (setq pf5 (polar pf2 ang sb))8 y3 Q0 s8 n( V; g+ n7 u, w
   (setq pf4 (polar pf5 (- ang (/ pi 2)) (/ sh 2.0)))
; O0 ?- O* P6 o   (setq pf6 (polar ps2 ang se))
/ F6 D6 J! U, [- j* v% g   (setvar "OSMODE" 0)$ V# E1 ^) C; o3 O+ s( T/ o* O
   (setvar "BLIPMODE" 0)) X1 p+ k2 P% L7 {* |
   (command "PLINE" pf1 pf2 pf3 pf4 pf5 pf6 ""); Q1 t2 T" E; |
   (setvar "OSMODE" 703)- H1 u  o* L/ t6 P9 V3 ]5 Z* w
   (princ) )1 I  K/ m; K/ G  g
;----------------------------------------------------------------------------------
+ U: v% p8 m! Z& }: G- j; d& v" U(Defun C:G3 (/  ps1  ps2  pf1  pf2  pf3  pf4  pf5  pf6+ r' c$ K5 W; ]8 W
   pf7  pf8  sb   sh   se   ang  old_osmode);   (setq old_osmode (getvar "OSMODE"))
- T6 G$ H/ X" R( v: [) f/ S$ [) R   (setq ps1 (getpoint "\Chon diem thu nhat: "))4 [! g5 B) T1 J- g1 Y( f
   (setq ps2 (getpoint ps1 "\nChon diem tiep theo: "))
8 @1 o% H6 n2 _/ x5 P   (setq sb 100.0 sh 150.0 se 20.0), j/ [  l3 j) q0 S$ _
   (setq ang (angle ps1 ps2))
1 o( E, b# d6 b+ M/ d   (setq pf1 (polar ps1 ang (- 0.0 se)))7 c9 ^5 Y2 L$ a7 c) x
   (setq pf2 (polar ps1 ang (/ (- (distance ps1 ps2) sb) 2.0) ))) f  s4 @0 V$ _8 E7 {5 Y# i9 Z$ ?
   (setq pf3 (polar pf2 (+ ang (/ pi 2)) (/ sh 2.0)))
. L- M9 V# Z0 Q8 d   (setq pf5 (polar pf2 ang sb))8 F5 i$ ?6 ~, F- U
   (setq pf4 (polar pf5 (- ang (/ pi 2)) (/ sh 2.0)))
  s/ z! O" N! b% F+ k" V   (setq pf6 (polar ps2 ang se))
6 p* |( m& J* s% Z   (setvar "OSMODE" 0)
2 F$ \& m, y* ~& y$ Y$ e/ b- K   (setvar "BLIPMODE" 0)0 H" v" r9 n- ^' n* F! k: N
   (command "PLINE" pf1 pf2 pf3 pf4 pf5 pf6 "")1 q" h  O0 A7 T+ e. H  r4 J! a
   (setvar "OSMODE" 703)  g" L4 P2 n" a9 e1 E& X5 p( s( s
   (princ) )% ~) H0 m5 b9 z, ~
;----------------------------------------------------------------------------------
# m) m3 ]+ U" U$ {1 c) C4 j4 e(Defun C:G4 (/  ps1  ps2  pf1  pf2  pf3  pf4  pf5  pf6
+ D; }9 a8 e0 R, Y   pf7  pf8  sb   sh   se   ang  old_osmode);   (setq old_osmode (getvar "OSMODE"))
+ Z1 A) T' ^$ K) U' y   (setq ps1 (getpoint "\Chon diem thu nhat: "))5 `" K7 T' R4 G/ L9 C4 z/ n! H- v
   (setq ps2 (getpoint ps1 "\nChon diem tiep theo: ")). U' m+ N/ h4 V" n  ?8 F
   (setq sb 100.0 sh 250.0 se 20.0)! P* m* R; e1 }) i, n4 L# q
   (setq ang (angle ps1 ps2))) W. X, Q* c7 s+ G
   (setq pf1 (polar ps1 ang (- 0.0 se)))$ K; D4 C" \& S* Q3 F  L$ U
   (setq pf2 (polar ps1 ang (/ (- (distance ps1 ps2) sb) 2.0) ))
8 K# I  U; d4 X& K   (setq pf3 (polar pf2 (+ ang (/ pi 2)) (/ sh 2.0)))7 F) d+ L5 @/ h* O
   (setq pf5 (polar pf2 ang sb))4 b2 \2 r* G" A- s5 v4 i
   (setq pf4 (polar pf5 (- ang (/ pi 2)) (/ sh 2.0)))
) k: v2 }5 t( _* b1 t3 X   (setq pf6 (polar ps2 ang se))
) B( j( ]4 i  E2 W, H4 e& C) m  j  T   (setvar "OSMODE" 0)
1 t  F4 u9 x- |   (setvar "BLIPMODE" 0)
0 G! w+ o0 l6 K+ j2 K, |   (command "PLINE" pf1 pf2 pf3 pf4 pf5 pf6 "")
5 Y) t1 G: s4 {. C; T* s5 A7 E   (setvar "OSMODE" 703). A. _. n6 a  N: N, ~& }. o
   (princ) )1 x$ k- F/ Z7 x! ]- o, H

2 G/ }0 N/ U0 U9 s) J;==================================================================================
+ `, [+ {; p# W, ~1 T(defun c:ang (/ ent pt1 pt2 ang)
% |8 W% i0 t/ g* L0 K   (setq cmd (getvar "cmdecho"))
: N* t' R3 g- b! t- Z9 o! G  (setvar "cmdecho" 1)+ ^. A, F$ H* Z- j: ]& k3 w$ _
  (prompt (strcat"\nThay doi truc toa do theo duong thang chon truoc"))
; E  F$ I0 R7 z5 g8 |3 b  (setq ent (entsel "\nChon duong thang:"))5 j/ d' V: q& b0 t8 K
  (if ent
# N! B# C9 L2 t1 k! }! S   (progn
9 x' n# s$ l) K' r+ g6 A3 Z+ D    (setq ent (entget (car ent))): V3 P+ F; @1 G# ?4 {: A
    (setq pt1 (cdr (assoc 10 ent)))& W* ]- N1 K7 U
    (setq pt2 (cdr (assoc 11 ent)))6 \0 _4 E& H7 l# O/ t
    (setq ang (angle pt1 pt2))
4 }" z" Q" H! @- o( F    (setq ang (/ (* ang 180.0) pi))
, K2 j6 ]  m  h3 ?6 f' N( y    (setvar "cmdecho" 0)( [3 f0 X% V6 S/ n/ ?; |0 j' ~0 w
    (command "setvar" "snapang" ang)# v% [0 @# |; L; L- y/ t# \
    (princ "\nGoc cua truc toa do moi : ")$ g0 X( U; o" b8 m) h1 |
    (princ ang)1 [. j" F4 e7 c! s
   )
  N1 n3 N+ F& Y  )9 \5 n8 h- m' \# g" X( z  n
  (setvar "cmdecho" cmd)2 h/ O& {' d7 y: z% r8 X" y
  (princ)
" R5 Z! S- w- J1 {)) \5 @: V/ _' {! m* _& }
;==================================================================================
  m, G2 r& i# n# E2 E( H3 c;==============================   KY HIEU DOI XUNG   ==============================
) {5 z0 Y/ L; P; W3 K;==================================================================================
; }; P+ Q* ^$ E- m& ?: J$ X6 _
% p) H. |3 ?; T$ \(DEFUN C:DX (/ CMD OSM OLDERR PT1 PT2 PT3 PT4 PT5 PT6 PT7 PT8 PT9! K+ T3 N+ c) B/ S% K( L! J
                SZ G45 G135 G90 G180 SS loi)
# K3 {, i6 D0 s7 H( J(defun loi (s)- g/ ~# B$ p' N9 @* _' l! a
(if (= s "Function cancelled")
/ T# {+ j! y" [" U0 q     (princ)+ y$ t9 t+ u. E% K" f
     (princ (strcat "Error:" s))
6 U4 j7 R' s' }  h6 } )3 t# K  e8 s8 O8 s, G! `1 L- j; V
         (SETVAR "CMDECHO" CMD)
. c. e4 ^. }/ [% ~         (SETVAR "OSMODE" OSM)+ Z3 r" S, E! ?* p
        (SETQ *error* OLDERR)/ ?6 l$ e, I; E8 f- {; O" _" E
         (PRINC)
0 b6 k6 L4 w! U% l): y4 s; |+ Y4 w' @% k
(SETQ CMD (GETVAR "CMDECHO"))
* `* v/ {9 y* x (SETQ OSM (GETVAR "OSMODE"))
' C" A5 B/ S- M" T7 b( Z6 r (SETVAR "CMDECHO" 0), [) l: m2 Z6 p
(SETQ OLDERR *error*
2 P/ Y- x  Z; i9 O& v+ v        *error* loi)
/ C' k$ L8 B+ w (SETQ SZ (GETREAL "Size <1>:"))2 u. c% E# u# a! N$ o4 ^+ P
(IF (= SZ nil) (SETQ SZ 100))
  N( `# D, f9 E% R/ |2 @ (SETQ G45 (/ PI 4))! e- m( X, Z9 ^7 |) x" @3 ~, {8 N, p
(SETQ G135 (* 3 (/ PI 4)))
. @$ |  m: c7 H9 v  I (SETQ G90 (- G45 (/ PI 2)))
# [8 A; f+ l% ] (SETQ G180 (+ G135 (/ PI 2)))
5 E, U$ v, {. r5 E* ? (SETQ PT1 (GETPOINT "\nDiem doi xung:"))
1 w- D' W5 @6 [  z* s( Z0 c (SETVAR "OSMODE" 0)
! T7 `% B1 }* f( x7 w# P! N0 x- w5 x (SETQ PT2 (POLAR PT1 G45 (* 2 SZ)))/ z  v$ b5 b1 D2 J1 P
(SETQ PT3 (POLAR PT2 G90 (* 2 SZ)))1 U" R9 J# o; h& D+ ?6 B
(SETQ PT4 (POLAR PT1 G45 (* 1 SZ)))
' x( r* o' a) c (SETQ PT5 (POLAR PT1 G135 (* 2 SZ)))/ t1 w/ @  x, S) m3 J& r
(SETQ PT6 (POLAR PT5 G180 (* 2 SZ)))
4 P$ `) I4 `  G6 D: \& f4 R (SETQ PT7 (POLAR PT1 G135 (* 1 SZ)))' J. ~& l, L' R4 j$ [) X$ Q" j
(SETQ PT8 (POLAR PT1 G45 (* -0.7 SZ)))
$ z9 P, l0 b# k+ Q+ b- L. ? (SETQ PT9 (POLAR PT1 G135 (* -0.7 SZ)))
# t& N3 ?4 c$ u8 Q6 D/ s7 |6 x (PRINC "\nGoc quay:")
* b8 R0 D3 N  t2 p (SETQ SS (SSADD))
# Y0 m5 [  R4 t1 v9 X6 F9 G$ Q(command "layer" "m" "Dim" "c" "" """")
& o$ ?) y% B+ L4 C+ ]/ e(COMMAND "COLOR" "1" "")
: E8 @9 }! G2 j) ^ (COMMAND "LINE" PT8 PT2 "")* }# n" D5 ~% K. X
(SETQ SS (SSADD (ENTLAST) SS))
7 B/ @2 A/ o, _) A4 x (COMMAND "LINE" PT9 PT5 "")
3 o, ^, m. u" d) [- { (SETQ SS (SSADD (ENTLAST) SS))- m! i3 M' c: R+ u
(COMMAND "COLOR" "1" "")" b; O- C3 z8 u6 z! x( E
(COMMAND "SOLID" PT2 PT3 PT4 "" "")
& a% N# p$ d, h- Z (SETQ SS (SSADD (ENTLAST) SS))
: ~% Y  a5 g% [) G% M (COMMAND "SOLID" PT5 PT6 PT7 "" "")- q% o  F. ]# f7 Z: @
(SETQ SS (SSADD (ENTLAST) SS))+ L, b. X, R7 U' p( G! ]" u
(COMMAND "ROTATE" SS "" PT1 PAUSE)' a9 I+ e8 u9 c4 C$ F  C9 o
(COMMAND "COLOR" "BYLAYER" "")
" k% S" k' ]( B9 _% Q (SETVAR "CMDECHO" CMD)
$ b: q0 Y! z) {3 v% U4 Q (SETVAR "OSMODE" OSM)0 l% a2 c' E9 m  d: s
(SETQ *error* OLDERR)
- u0 p. C& |; P, }% N! C (PRINC)
7 }* N/ ^. G( r) P)) H4 R( d# q: d8 b
5 u1 S+ l: R4 U
;==================================================================================' i/ t( a8 K' o( B8 r& T0 k- y: k
;=================================   KY HIEU TRUC   ===============================
' D# x/ @. K: n/ Q* |# t/ @, l;==================================================================================
6 j$ e. t3 P, W% A' i7 ~# [
2 _4 A7 t, L# m0 k4 w(defun C:vetruc ()# T/ e3 F+ }2 M- [' k
(setq bk (getvar "USERR3"))
: y- t! ]9 T+ @$ [- m; y(if (= bk 0)" T) t3 r4 `8 j( }2 x: a
  (progn1 @+ q4 _4 |+ a2 W5 G+ g
    (setq cont "1")
: ^' J$ X3 S' n6 Y9 ^    (setvar "USERR3" 1)1 P7 W; r* l; I; Y7 f
    )+ t! _: _( N8 r+ e  ?& Q9 X$ r
        (setq cont (rtos bk))
4 X5 k1 L+ t' Q6 M" W)
% M- D" X+ H6 }3 n7 {  d/ w(setq pt1 (getpoint "\n Nhap diem dat:"))
& ?; z/ f* d7 t3 ?% }- [3 f: M  s(command "layer" "m" "Dim" "c" "" """")
' V. {8 M/ D+ c& v& O(command "osnap"  "")
; D5 |2 J+ {6 x(COMMAND "COLOR" "7" "")
2 k  O1 g: ?  u+ f/ z! `6 M, O, c(command "circle" pt1 150 "")& T) p3 e" S. M, w+ J
(setq pt2 (polar pt1 0 150))5 f$ v+ ]" ~- s" K2 G
(setq pt3 (polar pt1 (/ pi 1) 150))
2 W0 X6 O" F- ^+ J(setq pt4 (polar pt1 0 300)). E$ b' [# I7 W( j5 x6 Y
(setq pt5 (polar pt1 (/ pi 1) 300))
. X% K/ J! C3 R(setq pt6 (polar pt1 (- 0 (/ pi 2)) 150)), A6 ?% {( v+ ]  U5 z
(setq pt7 (polar pt1 (- 0 (/ pi 2)) 300))( ]- D9 f, |3 s. @& _1 \% G/ Z# {
(setq pt8 (polar pt1 (/ pi 2) 150))
* S8 D0 Z0 z9 |3 Z- {* v+ f(setq pt9 (polar pt1 (/ pi 2) 300))
6 I$ R  ]$ ]3 D" V( w' H0 J(setq pt10 (polar pt1 0 150))* J) l0 R0 j/ T0 y+ ^
(setq pt11 (polar pt1 (/ pi 4) 150))+ b% {2 D/ Z  x1 p
(COMMAND "COLOR" "BYLAYER" ""), ?4 i- ?. H  Q' k8 k% _* O
(command "line" pt2 pt4 "")
' N! T" a+ x$ ?(command "line" pt6 pt7 ""), t9 ^$ s8 G) t# W5 }9 ]5 v9 M# J$ ^
(command "line" pt3 pt5 "")+ a* {4 `3 x$ m6 [4 }0 Q' z8 B
(command "line" pt8 pt9 "")
! `/ G. X5 i" W. k. F* m' N/ \(setq dk (strcat "\n Size:<"cont">"))
5 c" Q+ k3 F" @(setq bk (getreal dk))
2 o4 {0 s2 o& w1 u(if (= bk nil)& q: i+ @5 \4 P0 D
(progn
) S9 k) l! W" e! p4 ^4 T) l' Y9 b9 Z  (setq bk (getvar "USERR3"))
2 ?; n! ?8 [+ i5 c        )
5 {# u* ?7 G. S3 c0 i" M+ n& m3 @* D  (setvar "USERR3" bk)
( J& B. e# E& s8 w' ^( q  u  D; }7 i% O  )
4 o# d( f) D. V. [! b/ [) b(command "scale" pt4 pt5 pt7 pt9 pt11"" pt1 bk"")8 Z# Y& Y9 V. W3 o% W$ S  v
(COMMAND "COLOR" "7" "")
4 q: \3 ]) U6 [2 }. A(COMMAND "STYLE" "Truc"  "impact" "" "" "" "" "")
0 q% ^+ ?6 e& d- f  S0 l: x* [(command "text" "j" "mc" pt1 (* 150 bk) pt10 "A" "")
' r" @3 t4 i4 u3 d1 o4 G7 J(COMMAND "COLOR" "BYLAYER" "")
4 o% q, U! P  C* n7 J0 U8 i)- d+ u$ \- k% Z
; `# S/ |# q# w, b! s. G/ U
;=====================================================================
( T9 s' ~' n( q/ m" ?8 k;CA - Reverses the case of text.  (Upper to Lower and Lower to Upper.)
% Z; y- Q1 Q8 D1 {8 b' P0 x;
+ P' s% o+ C& U! ~$ E( {; U;Jeffery P Sanders
- L0 i( y' j( `2 l' U;# O9 @6 o: C- L% P% ]
(defun C:CA(/ en enlist tx newtx cnt tp asc note)8 u0 Z( U4 h. G! @
(setvar "cmdecho" 0)
! Q% y6 F  C6 M$ [. \ (if(setq en(entsel))
  \0 c3 G* |4 x7 Q5 |# u+ j   (progn
: H0 |, H8 b+ q4 p3 {      (setq enlist(entget(car en))). ^: C) S! I6 g4 }' o
      (if(= "TEXT"(cdr(assoc 0 enlist)))6 C2 `( P7 i% ^6 d* V
        (progn
# g0 B1 H6 m/ G1 Y2 _4 Z7 H          (setq tx(cdr(assoc 1 enlist))
% |( c* {: e: ~" @8 L" i             newtx "" cnt(strlen tx)% K) R; O, F+ P4 a5 C1 d! U/ ]
              note "\n...CASE Reversed. \n "* S, r3 ^+ d6 `, [0 q) t6 Y
          )8 i) L; ~( Y4 ^6 O; R+ v1 b/ o
          (while (> cnt 0)
9 I( l7 v/ M$ ^0 R             (setq tp(substr tx cnt 1))6 S' [3 y' W9 r  n6 k! a9 _
             (setq asc(ascii tp))
' n( q3 d9 n  L$ H/ {             (if (> asc 96)
# g% |/ A. I& {  N4 Z* A               (setq tp(strcase tp))
- o# |# l* T7 S  q- O; N               (setq tp(strcase tp T))7 F" p6 l4 [7 d
             )8 G$ P: U& N( F6 ]
             (setq newtx(strcat tp newtx)). \$ l- s: L3 d8 i) T( ]
             (setq cnt(- cnt 1))
8 H- w! v& ~. w% m  E          )
  T, S' {/ U0 C1 [# J  W2 v4 o          (setq enlist(subst(cons 1 newtx)(assoc 1 enlist)enlist))
8 t5 S; m3 ~7 C3 l( B+ d) [- C          (entmod enlist)5 P/ B5 P7 i0 E; K& o* i
        )' F* {) J. |1 k# X6 h0 b
        (setq note "\n....Text Only Please. \n "), m) B* y5 t: X6 `/ T; V
      ): G; l. X, K4 W8 E* m5 s) K9 v
   )- S' _1 A" V' j2 i6 L
   (setq note "\n....Nothing Selected. \n ")0 g  j  Z( H8 J
  )1 y5 Z- g- ~: }# z, j
  (setvar "cmdecho" 1)
9 `8 m* m0 }. D. C1 x  (princ note)
* T3 p+ \$ p) s, ?  (princ)' d# S4 O  H' J8 m9 l
)/ C% K* h) l6 F3 h

+ N( I! M# }6 h: Y9 Q; F;=====================================================================
: v( L0 R' g  X6 T( t; h! {7 b;==================== NEW TEXT STYLE UPDATE ==========================/ e+ S7 h# O0 Y( [
;=====================================================================
4 B0 s! B' K$ H; J
2 `3 j  u: `, y; T1 A" ?; U(defun c:nS (/ tdt ssdt sodt index)
) d' F- ^' |* _(defun ObjName (ssdt /)  G$ i) v  _" j/ u
(cdr (assoc '0 (entget ssdt)))6 K" ?2 r) E( \
)( Z! f1 d* i8 Y+ q! y
(defun MoPL (ssdt /)
6 R1 Y, p* T! G) U7 K(= (cdr (assoc '70 (entget ssdt))) 0)6 g; S! X) M, _$ L4 f
)4 i! ^  C2 j* S' o3 \! `
(defun NoiPL (ssdt /)
( Z2 p8 W  [- b) Q; }8 u8 Y6 x, b6 a(if (MoPL ssdt)
( {% r5 d! a% D2 v(command ".PEDIT" ssdt "J" "All" "" "X")
% `. y+ B; ^* ])
' [' }1 Y* }: Q2 i! Z1 r  @; [)
* e+ i; q! \0 P# {- C3 y(defun NoiLC (ssdt /)0 [* ?1 S# D9 O% i
(command ".PEDIT" ssdt "Y" "J" "All" "" "X"). M2 v6 A7 r" L5 i1 i8 l4 p
)
6 M# R/ r. ?1 g: T7 s; [6 k(setq  L$ g. E; S* S) `1 N
tdt (ssget)
: b, U: o6 C4 `) S6 a( Qsodt (sslength tdt)
4 V( _6 `5 S' `, ]2 Uindex 0  q9 K8 K1 N; a$ x  T9 G3 G, a
)3 s9 l" }( m- Z5 v: w
(repeat sodt) L8 k% B0 a% N- g+ B- E9 O* f
(setq- T& E+ d8 P- S. e0 a" V7 g' x
ssdt (ssname tdt index)) A( J- i7 h3 M0 O8 X: u
index (1+ index)
8 Q% R" Z/ [1 A* C) @4 L)
# F5 a/ @( T+ o0 z(if (or (= (Objname ssdt) "LWPOLYLINE")
$ s5 D3 c" p" X! g$ N(= (Objname ssdt) "POLYLINE")9 y, T. y* d. ^2 ^
)7 r. m# s" [/ ~7 L1 a9 W  ~0 i
(NoiPL ssdt)
2 M5 X. J2 i7 A! w)
: @8 |) J" h- U5 [6 B+ P5 b& K(if (or (= (Objname ssdt) "LINE") (= (Objname ssdt) "ARC"))
% Q2 A0 a( ^. |6 D) R7 S(NoiLC ssdt)& Q2 U- e$ `* G0 j/ I6 `' \* S
)9 d7 T1 _* x1 w" p
)
) L1 Y5 l5 A! v: u0 b9 t(princ)
0 a7 ^% J! ?! X8 z5 E5 n7 b)
& V7 P: F' E. f+ G. v
; H% |; G% a# H  O) F;=====================================================================  `/ l9 O5 f; k4 w7 z
;;; AREAM.LSP5 n% ?4 ]3 N( S
;;; Function: Calculates the total area of selected objects
3 Y8 e5 P, ^6 i* [) E9 p;;; By Jimmy Bergmark
3 y9 E& P  Y0 H/ \& H;;; Copyright (C) 1997-2006 JTB World, All Rights Reserved7 [; R5 y; v' @. F8 j& q
;;; Tested on AutoCAD 2000
: M; \2 {6 g5 E0 s9 u9 ^5 f4 K. p- O% Y# ~6 O
(defun c:ea (/ olderr oldcmdecho errexit undox restore ss1 nr en tot_area)( C6 T2 c: I4 i/ B% D/ I( {
  (defun errexit (s)- b8 A4 a8 M# R, n6 g( s
    (restore)
6 d, n4 }6 I- f3 T: Y3 L/ ?" x  ), P% O8 `- d% }
7 J/ |2 H& v* u. [- y) {  Z
  (defun undox ()
: }1 w$ W- g0 O; o* E/ O+ Z2 l    (command "._undo" "_E")& _# Q* U$ p( t& x9 d
    (setvar "cmdecho" oldcmdecho)- _4 j% r* w2 E
    (setq *error* olderr)& v+ l2 x3 a! i% b
    (princ)' _. l* U9 [) ?8 ]; d  F; ?- k5 A  N% N
  )
& |1 Y" Q( b! u  J4 M' T' N
4 h1 K  l( S6 K) g' V  (setq olderr  *error*/ S8 X) O) ]% V. v
        restore undox
6 p( Q' ^' E+ B0 ]) Z$ Q& J        *error* errexit
9 h8 L% f: m! i2 s) X  )- [  N: R: P/ C$ M6 t
  (setq oldcmdecho (getvar "cmdecho")): p7 F' o' \  o0 m2 c( C0 s$ S! i
  (setvar "cmdecho" 0)
+ [! i; e* f6 i! R5 V: o; W! R  (command "._UNDO" "_BE")" ^; M6 Y6 c1 A6 y
  (if (setq ss1 (ssget '((-4 . "<OR")
4 q! ~2 X6 x) V# F0 ]3 }3 Y                         (0 . "POLYLINE")
, S9 B4 q# `  a% L/ q. D                         (0 . "LWPOLYLINE")+ t  d1 P' E' t: S
                         (0 . "CIRCLE")9 o0 ?& Y) B$ U  @
                         (0 . "ELLIPSE")
; o% o* F! S) N                         (0 . "SPLINE")
0 M" g1 B8 B. o/ I* l, o8 s                         (0 . "REGION")5 ?& y+ }. L4 f& x
                         (-4 . "OR>")( _( x8 T: I  \7 m4 T! Z7 c
                        )
; G5 N+ S4 Q, ~& F* Y( j                )
& ^- e* g) }* a& U! Y! q      )
$ e2 Q; u. d; B4 |& l. Z    (progn2 c  l* V: l7 ~# o6 \+ C
      (setq nr 0)
5 @- n3 z' n) F- I      (setq tot_area 0.0)
5 U# |7 {: R- \7 c3 }      (setq en (ssname ss1 nr))
1 o6 ~: f7 G4 V! |      (while en
5 R4 R; _/ E3 z7 p3 s! j        (command "._area" "_O" en)
! J" ]) G5 S8 M# V7 f        (setq tot_area (+ tot_area (getvar "area")))  s7 r: p* y2 E% I7 A) f
        (setq nr (1+ nr)). E$ H9 @% z  Y
        (setq en (ssname ss1 nr))
$ l. v) {4 s3 s# O. d& f      )
' P( h% I# }, ?9 K1 z      (princ "\nTotal Area = ")  u+ I' \( r  i: T! M8 `+ w
      (princ tot_area)! X1 O/ y! K; r( z, p7 [
    )
/ U9 l( o* T* _1 u  )
# c2 R" Y1 b/ h/ k  (restore)' {5 b, y3 R  R& f. @: J
)
6 T! e) i$ m$ r2 r5 M% e8 S, H; `# P; E' |/ C! _- r7 }
;=====================================================================
0 s' f$ x* ~! p- p  S; z8 A;;; By Jimmy Bergmark
3 D9 _* i1 d, \2 c6 D1 W$ ];;; Copyright (C) 2008 JTB World, All Rights Reserved- a1 L1 E- O! y* R# K; f
;;;$ N0 y1 K% S) |7 g9 q5 ^
;;; Created: 2008-03-31
# h  L9 h" l6 [9 ?;;;
) S- ^) m1 |0 H( f2 k;;; Convert Attribute definitions to mtext& f/ l, J( l9 E/ c/ b
;;;
) P7 e& A) U; o4 i; U1 @
" `4 R3 E! S) [7 H4 b5 H8 T(defun c:ATB (/ eset1 blkcnt en enlist tag1 ht pnt vl space)
" @# ]& d, u. B, z& C  (setq        eset1  (ssget (list (cons 0 "ATTDEF")))6 O+ ?9 C! c, G6 X6 g
        blkcnt 0
- o2 f3 n, L$ Z: X3 W( t  )1 p9 t* [- D1 A6 p, O

& P# b1 s% l  q0 g7 F8 x$ F5 |) H$ c* u  (if eset1
7 a6 m2 T2 P! R( T- P    (while (<= blkcnt (- (sslength eset1) 1))
* `$ Q" n( `4 U      (setq en           (ssname eset1 blkcnt)
0 I9 h( s6 y( V2 |2 e2 ?            enlist (entget en)  k) e# P5 M4 S" @6 X/ y$ g
            ht           (cdr (assoc 40 enlist))
( V4 O5 [2 d0 p6 R1 {5 Q" E            pnt           (assoc 10 enlist)
* l/ U/ X8 H/ O- F" ^            pnt           (subst (+ ht (caddr pnt)) (caddr pnt) pnt)6 }; n7 G% s$ T# m7 I: j" }
            space  (cdr (assoc 67 enlist))' y1 ~0 W6 R0 E( \& o
      )) F, I; u; H$ T6 l( A: I
      (setq vl (list+ l3 D/ Z# k3 X$ j  |8 _
                 (cons 0 "MTEXT")  [6 u6 H; Z% ?! y3 y( c
                 (cons 100 "AcDbEntity")6 v' K4 M4 l0 ]
                 (cons 100 "AcDbMText")! `' Y+ D$ Y+ n: N. n7 [+ O
                 (assoc 7 enlist)8 X; B9 ?) K0 \& }
                 (assoc 8 enlist)
. x$ G% r1 G$ K) ^8 O+ z                 pnt
2 z+ P% J' d6 O' {$ I                 (assoc 40 enlist)* G& q7 J& O+ D. ?; X7 f
                 (cond ((assoc 62 enlist)). Z0 ~6 l, A" ~2 \6 A  S$ @. Z
                       ((cons 62 256))" T2 N/ k5 _" b' L: ]
                 )' A* \! N9 u/ T/ J1 A
                 (cons 1 (cdr (assoc 2 enlist)))
8 J! y" D5 w0 @5 s& Q+ `. [( L                 (if (= space nil)
. X3 Y0 F9 f; k8 @                   (cons 67 0)
# X+ u$ o1 x/ o/ N                   (cons 67 space)! b, u* h9 R  L3 A# q- E& `7 t& \
                 )
/ n  \9 r8 `0 r" b. c" x; i. r               )9 L" w$ Y" X0 c0 H" q% D
      )
' g8 h( U' t2 i% ^' B( B3 w      (entdel en)
2 |. l6 Q6 u& r& {& P8 E- i; N% z      (entmake vl)0 K" g6 @$ h, f3 o
      (setq blkcnt (1+ blkcnt))1 N+ g7 b9 h; L7 H4 m
    )+ E# J/ q. q' b8 J5 d5 D# m/ V/ o
  )7 L+ r- \4 _! B" j
)/ V6 {0 K! j# J' C% Q: }. D

9 \, A% T; D* J' e. |: P& d/ n;=====================================================================: w- \- `9 Q/ ~, b: n1 B
3 W  L; a2 a& _1 W/ `6 L3 W
(defun c:xxx ( / cumdt dodai thoat dem ten doituong textxl dem goc toi)* i5 g  J6 o2 ]+ ]. N
; Khoi dau cua chuong trinh  v) D7 {: V" i" X# w2 w! t
(princ "\nCopy Inteligent...\n")
, t3 c, q, r' d9 c(setq         luuecho        (getvar        "cmdecho"): R* r6 H1 j# j( Y
        luu        *error*$ ], ^# v- _8 ]# U3 c9 H  L% r
        *error*        ketthuc
' w* h% X6 i0 |% ]( }  j5 z        cumdt         (ssget)
2 H6 P) j+ }& N9 r. A  a        dodai         (sslength cumdt)/ A$ U' z0 b9 J% ^# V/ F1 S+ u! ^. s
        goc                (getpoint "\nSelect base point:")6 L8 H* G: }. G6 B8 C5 M5 y, {/ e+ ^2 p
        thoat                nil
9 v, y) I( F# W4 l5 Z! U. v6 `        dem                0
+ T$ a) X! w8 Y. _6 |        textxl                nil2 H$ E- I8 S0 N, U
);
# K, c- {; R/ A  t% ^. h(setvar "cmdecho" 0)
4 ]  m+ r- ?' B& X; n; Loc ra duoc ong text de xu ly: E  V2 z5 F; L2 X" h$ q" S
(while        (and         (= thoat        nil)9 ?  n/ S' c2 o* F: z6 c- V
                (< dem        dodai)
9 Y3 w! Z/ G! d5 P* a- J        )5 E- a: L2 g) g% k& k" c( _
        (setq         ten        (ssname cumdt dem)* W9 E; ~0 z4 O" M
                dem        (1+         dem)) y' w' a% g, b! _5 U# p1 v3 B
                doituong (entget ten)7 @9 u) [! P; [/ N' `# g
                kieu         (cdr (assoc         0        doituong))                        7 y* N9 M5 y2 L2 P$ L, [; |
        )8 n: n- k' N  s7 V; ^$ W1 o
        3 j# T; T/ Y5 N2 V/ Y1 Y  x
        (if (or (= kieu                "TEXT")
# ?% }2 u3 S! v8 `) Q( @                (= kieu         "MTEXT")        
8 u  N: }- o) T- a' `6 f: I                )' y/ Z# M( Q, F  Q0 Z$ @
                (setq         thoat        T, F% Z. K( M; x- K: M# }# P
                        textxl         (cdr (assoc 1 doituong))         
0 c: O% I( y0 ]& S" t9 F                )
/ P) l/ X5 h5 z        )" r0 }! d3 b6 u, r( x- A, V
);
, N3 m" \3 B6 x, V7 H(while T
! p: f% ]4 F5 a+ W5 w7 P2 W: Q(setq        toi                (getpoint "\nSelect next point: " goc)! T& Y' i) g- M8 j0 t8 }. e: }' Y# a
        vitrilech         (list         (- (car toi) (car goc)) (- (nth 1 toi) (nth 1 goc)))
" ]+ Q' D  |8 K2 f' v% p        dem                0/ f: b3 D9 {, @
)0 J0 f" [& [$ H, y+ y# W$ _7 o0 t
(while        (< dem dodai)1 l' a$ b: L8 Q# j' t/ I" }' O
        (setq         ten        (ssname cumdt dem); c' A3 c9 M* E! J# A
                dem        (1+         dem)
. k4 f5 f& s/ s$ O                doituong (entget ten)/ |4 S/ K6 D* m- |
                kieu         (cdr (assoc         0        doituong))                        * \( b/ |% x- t' |, q
        )
% p& E: y8 c' x. s* Z  K% X/ @' V5 k; Q3 n9 _5 ^3 b9 Y% }
        (if (or (= kieu                "TEXT")6 d8 A2 U7 j1 o/ [# g1 D2 b$ H, c+ N* n
                (= kieu         "MTEXT")        / t4 }" P2 h. D" E. o
                )$ ]9 I3 M3 D2 M/ ^+ x
                (doitext        ten)
9 {$ c+ h3 E; Q+ c- B, B                (copy_dt        ten)
2 S; ^  i# }2 Q5 S  I% w
: v, O, o8 M* `! U0 K3 `6 L: a3 a        );if/ j4 G4 W8 A; ~4 z6 \1 Z
)
! {. n5 T8 r* T) J);while
% j7 B0 M- J1 q! k(ketthuc)$ n) {; [. l/ F- T/ m- }, q& L
);defun( X4 L+ w+ T8 Z% K2 k& z( s9 G5 B) F
(princ)
& L+ a8 K! f" f
; _+ h/ n9 a# ^;=====================================================================$ {9 }- a9 ^: H( C: b: L
;;; By Jimmy Bergmark+ d; C5 y9 p! s& R" r! i# p
;;; Copyright (C) 2008 JTB World, All Rights Reserved4 G8 L4 ?5 d+ G( s! S0 H
;;;- {  b5 {, l3 A; ?4 @/ ]- e
;;; Created: 2008-03-319 x+ ]% _+ X+ N+ }* x% w
;;;
1 g& d+ p/ R! R4 B* I# a5 @;;; Convert Attribute definitions to text- U: A7 \- L, {: M8 g9 X* e( B
;;;
* @3 k2 B0 s& o; P% {& }8 }& p9 s/ O9 i
(defun c:ATT (/ eset1 blkcnt en enlist vl space): B  J3 t+ T7 z
  (setq        eset1  (ssget (list (cons 0 "ATTDEF")))
0 @" O$ t4 L+ ?, a4 `' h, K2 S        blkcnt 0
7 U0 }+ J+ ^* W" E  )7 }5 J4 z& W, P" L3 u' ~

9 x" ^7 x' T$ C0 _0 t  i. M6 M  (if eset13 G# J0 w) J* |) \! ~3 b1 W
    (while (<= blkcnt (- (sslength eset1) 1))
$ ^8 g1 T+ ]8 ^0 A0 E      (setq en           (ssname eset1 blkcnt); m5 V4 i' d4 N& J
            enlist (entget en)
9 `: }# r9 D" i& I4 M' ^. P3 E            space  (cdr (assoc 67 enlist))7 g* V' f. D& L3 C; S
      )
( i8 e4 w+ E# x7 n# g! V" F      (setq vl (list
2 d0 B& S6 ~3 h' P9 Q' a, R                 (cons 0 "TEXT"); s$ Y4 e3 _' r8 [& L. L
                 (cons 100 "AcDbEntity")$ Z. Y. _9 F1 K" ]0 |
                 (cons 100 "AcDbText")
. G; p, K$ M- f, L5 d9 A                 (assoc 7 enlist)% s+ k8 c( Y! m6 ]
                 (assoc 8 enlist)
/ V0 |  l1 F, H0 v                 (assoc 10 enlist)/ K+ X- C+ L' k; m( B- ?
                 (assoc 40 enlist): g, M. k/ ?# z0 Y  }1 H. L
                 (cond ((assoc 62 enlist))
) g+ q" R% {! h+ a8 k/ \                       ((cons 62 256))8 j2 {! k/ |1 f* w" k& F. F
                 )' X1 E, K5 g3 f% l; ]' N
                 (cons 1 (cdr (assoc 2 enlist)))
/ @; |& G4 n! m' |8 D                 (if (= space nil)' ^& R9 X2 i: }7 u
                   (cons 67 0)
( _% ]% |% l! L0 ]5 B7 z7 C                   (cons 67 space)
+ r* _5 t' _+ A# T; w* A                 )* D7 F+ i+ T5 z: W2 k
               )8 i+ l3 H  |. I9 ?2 O- D# n
      )
1 J* J4 g) ]% W5 K8 ^2 P      (entdel en)
+ j6 @- w( J- r2 L+ P) H      (entmake vl); s0 U5 N- P& @/ i
      (setq blkcnt (1+ blkcnt))$ ?$ A' I. I2 h
    ), L. E2 v7 _6 Y
  )
) g! O% m8 w2 Z! a)
2 r1 K) I, p0 \;=====================================================================
) \+ x& H6 l" g& W& D5 Y, _/ {;============================ Doi Truc ===============================
8 m/ [6 p+ H3 W; G) p- ^4 l;=====================================================================) F+ L. d9 @: d6 _9 \
: r7 l8 d3 j% F+ {9 W
;=====================================================================
9 T- h/ d- V6 [( \9 s) j- b% i;=============== FUNCTIONS GA 1+3+5+7+9+11+13+15+17+19 ===============1 w; z" [" ~; @' ~) t
;======================== Tran Ngoc Thang ============================
1 ^( G) T6 D5 G4 s(defun c:ga1 ()
( {/ ]8 x, y' m% \(setq a (getpoint "\nChon diem: "))% |4 U& [" m- U6 w. i
(setq b (getpoint a"\nChon diem: "))( ?: n5 f. `# b4 }+ C* y- k
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
: ]8 ~$ g4 `& \2 h) w& |0 [(command ".circle" c a)
& s1 L# ^8 H% M1 M) e(command ".line" a c "")) ]# k7 S' X# f" r' E
(command ".array" "last" "" "p" c "1" "" "")% A1 N, E, c4 S! [. \$ h* E
(princ))
7 V6 Q+ a/ r/ m# P
& r+ H  X; g6 J+ }- _(defun c:ga3 (). p, g  P0 d, [* {. O
(setq a (getpoint "\nChon diem: "))
1 _4 I1 k. f$ k5 k' C(setq b (getpoint a"\nChon diem: "))
* a! Z! K* Q" C4 ]# q0 }(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
  H$ _2 _, n% X. V(command ".circle" c a)
& T9 r: `& B$ n6 T1 Q(command ".line" a c "")  C6 a& {/ }! r# x. N) n- q4 y
(command ".array" "last" "" "p" c "3" "" "")3 l" @+ {5 N; N
(princ))
8 G# v7 |( X; b8 Q7 \3 |8 ?! }
& Z2 z$ y8 [/ B4 F( S) f(defun c:ga5 ()' v  ]7 l5 M7 w3 a4 g7 W9 i
(setq a (getpoint "\nChon diem: "))
& R5 [! l' [, A  Z(setq b (getpoint a"\nChon diem: ")): e9 K8 b! j" d# c' c1 S
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
# B9 w1 k+ z5 f(command ".circle" c a)
  x# q- W9 P8 S8 d. {% N$ H& x0 x(command ".line" a c "")  [2 f, p" l0 n: Z  k
(command ".array" "last" "" "p" c "5" "" "")& I  X; X7 O7 d7 P% ^5 }
(princ))$ N6 L* p9 }! p  A7 D1 d8 H

5 v2 v6 G# G7 C) W(defun c:ga7 ()$ Q; A; J& i3 r  w9 a9 z
(setq a (getpoint "\nChon diem: "))2 S8 F; f* v2 M& e( J& x' S- U4 F
(setq b (getpoint a"\nChon diem: "))7 [9 j; a6 x" H* |; s* q
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))% U0 x% p& o# f
(command ".circle" c a)
8 f6 V( P& m  Z(command ".line" a c "")& W; [) l, \. @! ?
(command ".array" "last" "" "p" c "7" "" "")
; Z8 t0 D/ O$ x7 _' u# j(princ))4 ^1 E- Y4 M; c; o
% d- x* P, g) H( J0 n1 S0 c+ y- B$ R
(defun c:ga9 ()& K' g& n. i1 Z( v1 _1 Q) v/ T
(setq a (getpoint "\nChon diem: "))( A2 W3 \' J+ G4 P6 d+ I
(setq b (getpoint a"\nChon diem: "))9 k' v: j  K: u: s/ E
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
* v) \! P6 e3 r4 _5 p6 s6 d(command ".circle" c a)
% a* W5 g' r: I4 F6 d(command ".line" a c "")
- r# G  }6 m9 s(command ".array" "last" "" "p" c "9" "" "")
3 f) [# x/ s4 A$ n  W. w/ }(princ))
" m8 N1 O9 W! n9 D! h5 b" i# T( v. {$ R6 `7 o
(defun c:ga11 ()" P4 Z3 z! s7 R/ k5 G/ b, G/ W
(setq a (getpoint "\nChon diem: "))
4 ~" @( }3 e# B' w(setq b (getpoint a"\nChon diem: "))5 g, h$ g% _3 e& d
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
8 `3 w- l/ D5 m+ L: \(command ".circle" c a)
/ f5 D1 G; N2 G(command ".line" a c "")/ s" f; o( w, E% T
(command ".array" "last" "" "p" c "11" "" "")
% r- t% Y5 |7 r(princ))0 T- Y: C( f) F

& `' Q& z8 U) n(defun c:ga13 ()
/ M3 T- H  U' v' G+ X  d+ R" h, N  |(setq a (getpoint "\nChon diem: "))
; u: c6 P& U$ F' U(setq b (getpoint a"\nChon diem: "))
+ t" ]# q; d  v% w1 e(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
( q9 F9 S% _, J* f(command ".circle" c a)
8 c' T5 i4 G6 i/ L+ j(command ".line" a c "")/ \% I  \) b& c5 }
(command ".array" "last" "" "p" c "13" "" "")
2 V: \1 K% B% \# q: E1 V(princ))
0 s0 ^  [) S/ n- J3 T4 T
8 V- d; |. D! K* m(defun c:ga15 ()
4 n) w+ c5 J5 F# H(setq a (getpoint "\nChon diem: "))# d" M2 H- o5 v- {
(setq b (getpoint a"\nChon diem: "))
8 G, ~4 c/ _! m9 l7 c(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))( Z5 J3 ~6 [2 K9 k5 \" H) L
(command ".circle" c a)" ~$ U  g; x. w  a$ A8 b5 |% a/ d
(command ".line" a c "")
) C/ y+ {! N9 l0 J(command ".array" "last" "" "p" c "15" "" ""). ~) v0 p; ~7 r- B8 f/ y
(princ))3 Z' k6 d0 J1 d2 Y
( |" W0 k9 x! A
(defun c:ga17 ()
+ `& C( g( o- @9 ^; l- Y% |" L6 u2 y(setq a (getpoint "\nChon diem: "))
0 `# J9 g$ E! L& Q; s1 ?! Q. W(setq b (getpoint a"\nChon diem: "))
* p4 w. q3 O. q(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2))): _; f* {/ N; v
(command ".circle" c a)  t" r; I% M( }( X. [, u/ e
(command ".line" a c ""): k& L) ~$ _; m, t
(command ".array" "last" "" "p" c "17" "" "")
8 S8 r* ^' G4 e$ a- U* m" M& R(princ)), P; C4 i! l2 v! ?- }* h' U6 \
4 a0 q: j; V- M; h( o& t$ o% M
(defun c:ga19 ()
+ r. X) f; J% Y; B% x(setq a (getpoint "\nChon diem: "))
* y2 @$ F' ]0 R1 O& s: l(setq b (getpoint a"\nChon diem: "))
4 U5 c: ~- E0 H(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
0 L+ |4 R5 t# ^/ |(command ".circle" c a)& O- Z5 b* w8 m% Z+ z
(command ".line" a c "")
- L4 l2 o: ^- B: l# [& x* l4 G(command ".array" "last" "" "p" c "19" "" "")1 @  A; p' v3 C! q
(princ))! R: D5 u  ~6 z- p9 n% R) h/ C  z; n

0 Q" k; i1 H8 C;=====================================================================0 g/ f6 y8 E  @
;============== FUNCTIONS GA 2+4+6+8+10+12+14+16+18+20 ===============: v6 T5 J" h! [
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================! p' A1 A0 F& N1 ^& `
(defun c:ga2 ()
! E" L/ B9 n% A5 i9 q(setq a (getpoint "\nChon diem: "))3 l, _  R2 K+ s6 z/ H+ I. E
(setq b (getpoint a"\nChon diem: "))
5 O$ z! R$ Z* Z! `" X: n(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
, @' W" d4 d( X+ R+ V(command ".line" a c "")
1 k; g4 t' P$ {* Z(command ".array" "last" "" "p" c "2" "" "")- M7 {6 o9 ^; X( t( o* d0 ?
(command ".circle" c a)% u$ |9 |$ A  ]! ?3 p6 ?
(princ))8 K  \% ^0 U7 B7 H
* v1 s, l/ E. ^3 |
(defun c:ga4 ()
) f# u% g) e. m) z(setq a (getpoint "\nChon diem: "))) j4 i9 ~/ x6 @: O" q
(setq b (getpoint a"\nChon diem: "))8 z, B% N* O$ P0 G& h5 f) ~
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
) ~2 _9 f+ ^+ P8 u; a6 u(command ".line" a c "")! n) E5 N; N, M5 A
(command ".array" "last" "" "p" c "4" "" "")
9 \/ H' z7 L+ O) Q5 q(command ".circle" c a)
$ H; i  {- t; U  ](princ))4 ?( f  x3 B( L0 K. E: l8 a
2 }$ b8 d& I% W0 m& ]+ V8 B
(defun c:ga6 ()
. U& K, p+ H% ?. y* N7 M(setq a (getpoint "\nChon diem: "))8 N1 \+ @2 T0 T9 {- p$ ]% v
(setq b (getpoint a"\nChon diem: "))
8 h: c4 d: c# C3 C2 z$ v% J3 F(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
0 K! d9 a2 {6 p(command ".line" a c "")$ X; X  A' `; }
(command ".array" "last" "" "p" c "6" "" "")) Y4 {( d  ^* {' S# D; ?+ m
(command ".circle" c a)! {  s$ u0 _$ ?+ ?# @# o* Z
(princ))* K+ R9 d  W4 ?  Z$ h; \$ k

' L# ~) s5 r5 c(defun c:ga8 ()& j9 N, o8 y! n+ |1 r3 u
(setq a (getpoint "\nChon diem: "))
3 V* G- \$ c1 r8 K(setq b (getpoint a"\nChon diem: "))
6 _- G9 N4 H& H. M(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
" W: I$ V3 K  Y+ }# p(command ".line" a c "")
. V2 _2 ]2 Q& z' d6 |(command ".array" "last" "" "p" c "8" "" "")
$ w, s, M, P3 m/ _/ l1 \" k(command ".circle" c a); j; {9 c2 Z' l5 F7 p
(princ))0 S5 S1 X0 I0 a4 I
) B7 b% V" M) V: m
(defun c:ga10 ()
( s3 W0 y/ P9 r  V: m6 u(setq a (getpoint "\nChon diem: "))
- L+ q" v% p! T(setq b (getpoint a"\nChon diem: "))
# ^2 v/ ?3 J( J: J, L(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
, u5 n. U% |9 z(command ".line" a c "")
0 N& g9 V' D0 }/ r3 e# V; Z7 M; h. |(command ".array" "last" "" "p" c "10" "" "")! H. Y8 N' I% Q" O' C7 o- A' e
(command ".circle" c a)
' J- O0 x0 m2 e7 s# N% Z(princ))
" p  R5 x  Z" V- S4 u& Z
# N, f" f( D. m(defun c:ga12 ()# T+ E5 X( B5 W: O0 D
(setq a (getpoint "\nChon diem: "))5 f" W4 j+ k! _, H3 s
(setq b (getpoint a"\nChon diem: "))
$ B1 q! W/ F) D! J6 J(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))5 O$ M- u  ^8 o3 X! B; K# ~/ Z
(command ".line" a c "")
5 e' Y/ Q: B* x2 R' z* f. R(command ".array" "last" "" "p" c "12" "" ""), J) d( i2 O4 G
(command ".circle" c a)
. L9 C" |2 _  a( f2 ](princ))
8 x' Q) W8 e2 f# B  K; D. ~7 O( u! p% _, g3 }( {( ]
(defun c:ga14 ()" D8 y0 b; c  Y/ p
(setq a (getpoint "\nChon diem: "))
* z- x0 y; B, n2 Z2 b/ Q* E(setq b (getpoint a"\nChon diem: "))- O9 c3 [4 }3 M3 s! E4 `3 x, `
(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2))); N. |( q% V! ?- h! g9 B0 j
(command ".line" a c "")
6 d' _' w. D1 F! }3 C# {! P8 Q(command ".array" "last" "" "p" c "14" "" "")
0 E6 Q: ?. _' `6 f(command ".circle" c a)
- m# W% d4 g, T9 h" [9 r4 I(princ))
9 f% C- f1 j  X# b5 d
7 P+ w3 y& u  P+ q+ b0 [" G(defun c:ga16 ()7 [# ]& m3 N: W8 p' Z8 E
(setq a (getpoint "\nChon diem: "))2 i0 P4 y* E) H* T2 z
(setq b (getpoint a"\nChon diem: "))
) L% C# c2 }$ I; n7 _* P(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
! }0 S5 G+ _) T# v' ~4 P(command ".line" a c "")
" f" U8 j/ z( D" ](command ".array" "last" "" "p" c "16" "" "")) O  }' T0 q3 u) r* T
(command ".circle" c a)
5 P4 L! v3 N! ~8 ^% m* ?& x5 ]* ~0 h2 q(princ))' N& S! Y4 ?$ @2 _7 x
0 Z9 C8 g6 W: S4 }! ~
(defun c:ga18 ()+ N1 e7 b+ R$ E0 |9 k9 E
(setq a (getpoint "\nChon diem: "))
0 ]/ T* q. u% R  {  U" n0 y(setq b (getpoint a"\nChon diem: "))
7 }8 {+ p" J6 O+ L) \$ v+ J2 [(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))7 ~2 T- y4 q7 N5 G
(command ".line" a c "")6 f: S  h, w6 U
(command ".array" "last" "" "p" c "18" "" "")
$ z: e8 H" C  D0 G1 X! `(command ".circle" c a)) {7 a! f2 J0 }7 O2 d
(princ))
, Y2 g6 R: E: J8 z* T# n# d0 B5 F/ D
(defun c:ga20 ()
& s# r8 h/ Z+ _. D' A; Y" X(setq a (getpoint "\nChon diem: "))
3 o% y8 ^  I2 B! e+ T; g(setq b (getpoint a"\nChon diem: "))
3 {- @4 ]' n* y9 c2 E: ?(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
0 C4 n) b7 Q) U: z1 U. k8 p& q(command ".line" a c "")
8 F) a  P) k* @(command ".array" "last" "" "p" c "20" "" "")$ ]- V5 M. Z0 b
(command ".circle" c a)4 P; V7 z! y! N( U0 ?8 K. V% Z
(princ))
7 [) h4 K- Q& [1 m0 ~# G  w6 A$ J: }+ c& f1 _" ^1 h" \$ q! R
# f5 h  x0 h; w6 l% y
- x$ }+ |1 K0 }8 w9 Y$ O& ]: ^
;=====================================================================8 w  N; s! ]4 d, V
;============== FUNCTIONS GA TUY THICH : EVERYTHING IF ===============# z; V9 k: W* @# Q
;========================== 06-11-2016 ~ 18h00 =======================
; k/ l7 u* N. [- [& o;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
! j& F- m9 G4 L" L( Q(defun c:ga ()
& S* C3 x: Z) g; U  W9 R3 _2 ?(setq a (getpoint "\nChon diem: "))
: @* B7 z+ |4 [  o6 v4 W(setq b (getpoint a"\nChon diem: "))
/ Y- f2 e- F8 Q9 t& v, D(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
, e) T# r& C- m% k* _1 m9 b2 `(command ".circle" c a)
! y# f4 P! U, u7 O# K(command ".line" a c "")
+ K! ?( s7 x" A+ S- @(command ".array" "last" "" "p" c "NUM" "" "")# d( s5 Z, |% e; W( Z
(princ))
8 d) k. t, m$ G
' a) _) B/ T0 [; m;=====================================================================
( r! A* f6 N- k5 x# t/ ~7 `;=========== FUNCTIONS HOA THI TUY THICH : EVERYTHING IF =============
% S& {) w! p$ b7 \9 c* l! I0 h;========================== 06-11-2016 ~ 18h40 =======================) g1 Y) Q2 `* C  z4 u, Y4 E; {% k) M
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
& L) }  }, \6 Y9 L% R+ m( h1 T) Z* |# D; ]2 x# @3 X2 m& B
(defun c:hoathi ()
% W* _# K  Q# |- K( S5 H(setq a (getpoint "\nChon diem: "))
5 p& N* W! m, O! U: K, E  M' k3 r4 |(setq b (getpoint a"\nChon diem: "))
% ~! N: G: G: |  x. d(setq c (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
1 u# E3 R3 l' D' w" H$ Z8 S: G$ I( R(command ".line" a c "")
" A( v% q( Y3 \) j  Y! y8 f(command ".array" "last" "" "p" c "NUM" "" "")3 N, i& C. _+ G1 S' ]+ w
(princ))
  G4 z5 N5 I4 N& O" q* i. {+ d( f$ s( x( H7 w
;=====================================================================
# C; V3 B7 j2 `- X/ `$ Y' i6 H. n;============= FUNCTIONS CUNG TUY THICH : EVERYTHING IF ==============
8 v8 k' k) O! F% Z! O, F+ N6 \;========================== 03-11-2024 ~ 19h33 =======================
# Q0 D/ O) E' I. b- Y" ~3 @, A1 w" D;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
* S2 o. @2 H1 @% t# o" j' s; J' z8 k8 p+ ]4 E+ k6 ~$ B& Y
(defun c:cung ()
; h! H% z0 P/ W+ t9 g" s(setq a (getpoint "\nChon diem: "))
0 e9 v; D" Z4 O! T8 m. U: A# ~(setq b (getpoint a"\nChon diem: "))
' p, J+ e0 k7 c3 [(setq c (getpoint a"\nChon diem: "))0 ]/ ~* r0 U, `' i6 Y
(setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))) U4 g. M* k4 A  g( K
(command ".arc" a b c "")
& z" f# l$ p7 _( N' |+ A9 a% p8 X(command ".array" "last" "" "p" c "NUM" "" "")$ ]( ^; {( `7 J! Z) f( ?! t
(princ))2 k' {3 Q  q/ a  u4 L

- K2 I/ L7 n+ B) z" R+ w* N' G;=====================================================================
; J: B, ~3 O* Q  z;============ FUNCTIONS HECLOIC TUY THICH : EVERYTHING IF ============
$ j. t3 F# Z$ M- S+ q6 \& W;========================== 03-11-2024 ~ 20h02 =======================
2 X9 z- W. [. D( R) D/ x$ x( H;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
: [1 u  L7 U/ V) ^- D' C(defun c:hecloic ()
- G' N6 Q$ T( v) @(setq a (getpoint "\nChon diem: "))" z5 v, F6 w; t& e& E  [
(setq b (getpoint a"\nChon diem: multi "))5 J; L6 f$ Z9 _* A
(setq c (getpoint a"\nChon diem: "))(princ)
- n: o3 q8 {4 H( n1 q  ~5 x( ?; ]$ o(setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))
% S8 y/ f8 e& Y% w(command ".arc" a b c "")
. p4 A" ~  c/ l3 K7 R, w% Q1 l(command ".array" "last" "" "p" c "NUM" "" "")
( o* c8 k2 L( U& o(princ))
8 y  [" z: n: G8 @* S8 o% S8 N
$ b5 j2 P7 n; ?- f;=====================================================================
. d* `' L3 j7 C. G& M;============== FUNCTIONS GAY TUY THICH : EVERYTHING IF ==============3 a. P: {! n% x; s0 g7 z- k( Y
;========================== 03-11-2024 ~ 19h38 =======================  C- F8 Y1 \! `4 P$ X/ S" B- |
;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================4 X! A' E) p* ]

5 Q2 I5 O; V6 [(defun c:gay ()2 R+ I1 f- `; {2 K. ?+ @( l/ A
(setq a (getpoint "\nChon diem: "))
* f7 F" j9 Z2 v; N1 a(setq b (getpoint a"\nChon diem: "))& ]6 i0 ~) W: z. A
(setq c (getpoint a"\nChon diem: "))(princ)
8 E! w0 l& }2 z' P/ K(setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))3 G' n7 G# _) f! Q
(command ".pline" a b c "")
0 ]3 `9 g: g; d- |& p  Q(command ".array" "last" "" "p" c "NUM" "" "")' `* C, J* X" q; V5 G0 K
(princ))
7 ~; i# e2 D2 s; j
3 }7 C6 L2 g5 F$ v$ w5 e;=====================================================================% V5 C% O) ]1 O
;============ FUNCTIONS HECLOIT TUY THICH : EVERYTHING IF ============" c! Y& D) D1 T0 F
;========================== 03-11-2024 ~ 20h02 =======================
% a* d  c2 ~- U, U4 R;;;=============== Tran Ngoc Thang - Sinh 03-05-1976 =================
) J6 B* z- t  C& K+ L7 [. \
  M* ]* _! \/ V- }7 s(defun c:hecloit ()
& x4 x; e9 `  W; U6 Z# Y(setq a (getpoint "\nChon diem: "))  r, H, C: O$ n  a+ F
(setq b (getpoint a"\nChon diem: multi "))
( T2 H# e" F2 L( d(setq c (getpoint a"\nChon diem: "))(princ)) E# {+ q  O9 T
(setq d (list (/ (+ (car a) (car b)) 2) (/ (+ (cadr a) (cadr b)) 2)))# ]) [) Y" K/ ]* k* n  p( H" W, Q
(command ".pline" a b c "")
9 I: K2 D& b  T(command ".array" "last" "" "p" c "NUM" "" "")
) U; ^: ~; |# ^! {! H" P2 ?(princ))2 B! w3 q- I( W0 \8 E
5 {7 p3 _# ]! i$ s& j: w! m' Y/ |, ~* d

1 l; c) a+ W7 A( C. ^8 s+ `% @;;; ============================ Merge Hatch =============================
1 Z" ~' h# [% s) p: `) y/ Q
4 v+ N$ M, H. p" w/ }. s+ W. r(defun c:mh (/ ss entht sl i dt dtht)
/ ~' ^3 ~' |! e% m7 u% p8 C
0 `& m5 K& h# l5 J  r, I% B  (princ "\nMerge Hatch - free lisp from CADViet.com")
9 Y) N' n; P5 h2 r$ }( K1 B9 z
6 I6 ^( x% c* ?7 j0 L/ G7 a  (setq2 E/ g7 l( M: R/ R+ ^4 I
    ss (ssget '((0 . "HATCH")))  v2 }# T2 L1 ~
    sl (if ss
& i( r' C+ S$ y' S! _         (sslength ss)
3 ~' w. b' z" i  Z! c4 m         0$ U/ G' u6 |' Q3 T( m
       )
9 C2 v9 O8 _& \+ C1 H; a" v1 T    i  0# Y& ~" R, |& Q, g6 [1 y- E
    l  0
0 X$ m* c* y9 X$ F+ a  )
: f) b! R/ i3 ^6 p8 M6 ~9 n5 R- Z
0 {. ]9 w# T* m) a& {$ @+ |# U  (repeat sl
$ H' Y" ^4 a2 {2 K- N. t    (setq
* X' ]4 Z& P; d  T; S* ]6 ~7 f2 ?      entht (ssname ss i)$ I7 ]3 n# i2 e  F  p8 @
      dtht  (getbdata entht)7 r2 {5 a( U: o5 u" M/ y2 `% N
      dt    (append dt dtht)
0 V8 M- o% Z8 d. V2 o      l            (+ l (cdr (assoc 91 (entget entht)))): E) l8 L9 A5 q0 {( }
      i            (1+ i); ~2 t* F, ?: o" _8 X
    )0 t: q, ]4 b; R6 ]' w9 Z7 ~  W
  )
3 e8 u, R$ |9 D6 R
  D' S; a! w. _  e$ H9 E9 H' e  (setq        ent  (ssname ss 0)2 ?& f  B! z" x
        ss   (ssdel ent ss)* @5 |* @6 A$ U( Q# |- M
        tt   (entget ent)
1 X8 Q: _! t7 t+ F. w  l+ y        duoi (member (assoc 75 tt) tt)
# P1 o. I4 f2 H) W9 E, Y9 }        dau  (reverse (member (assoc 91 tt) (reverse tt)))
3 k7 n; i9 z$ z( _        tt   (append dau dt duoi)8 r* R) @! a1 p  v# D. t2 X
        tt   (subst (cons 91 l) (assoc 91 tt) tt), W8 I) V0 b) o6 d
  ), x# z; q2 @. Q; D
  (entmod tt)3 F- w) T4 Z3 A3 E- a8 E

" {4 d/ c# o, }  (command ".erase" ss ""), {9 k8 `& _4 f7 J) V
  (princ)+ R: m7 `2 J8 L+ ~- c5 w
)! Y* V' B' E# K! E* s

; S6 A7 X7 E) y, {/ h: I' n- V4 m* R- \(defun getbdata        (ent)
! g- L/ w9 q9 k$ Q' z) ~  (setq        tt (entget ent)- C1 g* ^8 R0 D" x" a
        tt (cdr (member (assoc 75 tt) (reverse tt)))
9 t$ h0 K' m4 ?' o- T8 l5 o& b( J! z        tt (cdr (member (assoc 91 tt) (reverse tt)))
' a. s1 O& S! F8 r3 J' w8 `8 z% w  m  )
5 ]) N  ~* b$ J1 D, e1 c+ R. a. L)
. E( W! d. ]' q. T* q- v( ^# v4 H4 H5 @) _' V
8 z( z% o. y2 t
(princ)
5 T# u; _, x- _# G6 S9 n0 W: [! K
- I( ^2 _4 m! a7 q) ]! F8 K;;; =========================== CAC LENH LAYER ==============================1 t7 r, e' ]: B" P- {
;;; =========================== Layer hien hanh =============================. L4 Y9 I8 m. }/ V1 Q
% ^2 w/ j: U* K# J7 ]) ?
(defun layset (/ LAY) (setvar "cmdecho" 0)
: V+ {' B# m- k" L# J (setq LAY (entsel "\nPick vao doi tuong muon Layer hien hanh la Layer cua doi tuong do : "))
. f. d7 r# A" s: R" F3 { (if LAY     (progn     / f9 {! s* q' K9 D0 F' }8 E2 m
  (setq LAY (cdr (assoc 8 (entget (car LAY)))))5 n4 c7 T6 i  Y+ `! {( q
  (command "_.layer" "set" LAY "") (princ (strcat "\nLayer : " LAY " da la hien hanh."))  )* ?/ f3 D& Z5 I
             (progn
8 V7 f$ ~7 W, s3 Q7 h      (if (not ddlop) (load "ddlop"))  (if (setq LAY (ddlop))
) j) k- X$ n! ], T+ W             (progn3 b# }: M; h3 U0 A5 C
            (command "_.LAYER" "ON" LAY "THAW" LAY "SET" LAY "")  (princ (strcat "\nLayer : " LAY " da la hien hanh.")) ) ) ) )(princ) )3 A+ {, r0 n& t0 B3 d) @# X
(defun cLL     () (layset))(defun cAYSET () (layset))
6 D( s9 `% _; _1 ?) H( ~0 Z/ `
+ U* U) Y# M9 m- h/ Y9 q( k: I;;; ================== Cap nhat doi tuong vao layer hien hanh ==================; e$ b; P" X" [! z
! _7 w- `0 V1 @) Z+ o: e
(Defun LAYCUR (/ SS CNT LAY)  (setvar "cmdecho" 0)
% Q' y7 {1 Z. R( Y, b  (if (not (setq SS (ssget "i")))
! R) [/ k8 w' S3 W. V" a0 k  q    (progn (prompt "\nChon doi tuong cap nhat vao layer hien hanh: ")
1 G2 |; \* B2 Q      (setq SS (ssget))    )  )
9 C% E& k: O2 M  f7 v  (if SS    (progn. z% G3 d2 u  Q$ {
   (setq CNT (sslength SS)) (princ (strcat "\n" (itoa CNT) " doi tuong tim thay."))                  (command "_.move" SS "")                      7 p; t" d0 b$ }) R( t
      (if (> (getvar "cmdactive") 0)               
6 h5 h- K/ [  ~: g        (progn' I; [7 x- e+ \/ t3 b/ }4 c; r
          (command "0,0" "0,0") (setq SS  (ssget "p") CNT (- CNT (sslength SS))    )   )
& Y4 H9 _0 d# p9 ?; q/ F          (setq SS nil)     )  (if (> CNT 0)                                 
5 C+ L/ F& a; y7 v% i) d9 j          (princ (strcat "\n" (itoa CNT) " doi tuong tren layer LOCK.")) ) ) )+ t6 m" C0 H" i& W+ H: E
  (if SS    (progn
4 v9 f8 N: y7 d) w# t& V7 h; D! K      (setq LAY (getvar "CLAYER")) (command "_.chprop" SS "" "_la" LAY "")% [4 K  l4 ?- ~+ e# E- ^  n
      (if (= (sslength SS) 1)
3 k4 G6 a, D) G$ s$ G! q1 N, \        (prompt (strcat "\n1 doi tuong da cap nhat vao layer : " LAY " (layer hien hanh)."))
3 V9 B6 n0 P3 [; D. y7 W" J        (prompt (strcat "\n" (itoa (sslength SS)) " doi tuong da cap nhat vao layer : " LAY " (layer hien hanh).")) ) ))  (princ) );end
7 |$ C) k- q" \" x. R(defun cAYCUR () (laycur)) (defun cHH    () (laycur))* o7 C- V; L. f( n/ m) W) ?  r

3 y# ~: z2 o( g5 `5 N;;; =========================== Layer Iso ===================================  D2 b) Z4 e3 R( S8 V, f1 r
: T3 z* w4 x1 Z  s* V! c
(Defun LAYISO (/ SS CNT LAY LAYLST VAL)  (setvar "cmdecho" 0)
6 b+ b; S6 B6 t* O4 p4 C3 }% S  (if (not (setq SS (ssget "i")))    (progn; q3 @6 }' W" I, D9 w6 _# v  q" ~
      (prompt "\nChon doi tuong tren layer(s) muon lam viec doc lap: ")% w4 i5 d. M; Q. }2 _3 e  x" e
      (setq SS (ssget))    )  )
3 @% R  y3 ~* D# k* q/ I  (if SS    (progn      (setq CNT 0)/ |) L* b: w) O% ]% S
      (while (setq LAY (ssname SS CNT))$ f8 E, V7 d$ J1 m/ B5 p
        (setq LAY (cdr (assoc 8 (entget LAY))))
  `/ s' N1 p" j4 v- @; M! P        (if (not (member LAY LAYLST))
& Q  h* P- ]) x" k' `8 k          (setq LAYLST (cons LAY LAYLST))        )1 R9 Y( _7 F5 O
        (setq CNT (1+ CNT))      )
2 s" _: r& d" ?6 u      (if (member (getvar "CLAYER") LAYLST)
, }' M0 j7 }, p$ G        (setq LAY (getvar "CLAYER"))( T8 e- w+ `3 j7 T7 z0 u
        (setvar "CLAYER" (setq LAY (last LAYLST)))      )
7 l6 }3 ?: ?6 O8 c& [- q: ?; m      (command "_.LAYER" "_OFF" "*" "_Y")
2 r6 T* @" J; |      (foreach VAL LAYLST (command "_ON" VAL))
$ B+ J0 p& \$ M' x8 P6 Y) R# W      (command "")            (if (= (length LAYLST) 1)
- g* d$ o5 k( W! s3 N( [' ~        (prompt (strcat "\nLayer " (car LAYLST) " da tach ra."))
8 f3 U8 w, B5 t* V        (prompt (strcat "\n" (itoa (length LAYLST)) " layers da tach ra. "
5 D2 k' k2 {+ ?/ _7 r( W7 g* B3 u                        "Layer " LAY " la hien hanh."   )  )  )  )  )  (princ) )
3 l) M( t/ x5 Z(defun cAYISO () (layiso)) (defun cI () (layiso)): c- N! z: [6 o, t8 c* [
, b% T) j( W8 m% a3 {3 \3 H- W2 b6 d' E) I
;;; =========================  Layer Match ==================================/ u# c0 t# H7 g: ?

  R$ c4 R9 S, E5 w3 N  K(Defun LAYMCH (/ SS CNT LOOP LAY ANS)% J' s* j% R' e
  (setvar "cmdecho" 0). }& y* u  q1 {! J: [- F. a# X
  (if (not (setq SS (ssget "i")))    (progn
8 u% Y! B$ _6 h9 [      (prompt "\nChon doi tuong muon thay doi Layer : ")# P) i2 z$ P4 D! v2 W
      (setq SS (ssget))    )  )' O- N% e: F: [7 m/ C) y
  (if SS    (progn0 ^' Q2 v! s5 j
      (setq CNT (sslength SS))3 u$ ^$ g+ M5 n: p3 j
      (princ (strcat "\n" (itoa CNT) " found."))  (command "_.move" SS "")                        ; Z. B7 B8 F4 i, c$ {+ F" Z' P, V0 B
      (if (> (getvar "cmdactive") 0)   (progn  H( ?7 T  h$ q. L
          (command "0,0" "0,0")  (setq SS  (ssget "p")' g  y- ^1 S# g2 D; Y7 u
                CNT (- CNT (sslength SS))    )    )
3 m1 y3 w6 h( q# F8 m6 C4 `        (setq SS nil)      )  (if (> CNT 0)                                    
: ?! Y& ^# ^- r+ M! O          (princ (strcat "\n" (itoa CNT) " tren layer LOCK.")) ) )  )
$ d# N+ w0 E# p  (if SS    (progn
% g% P, R6 P! A% ]' j% C      (initget "Ten")  (setq LAY  (entsel "\nTen layer/<Pick doi tuong>: ")  LOOP T  )0 K, @+ }) m! _" _0 P, g! G
    (while LOOP        (cond6 `, t: n# K0 w# F/ e
          ((not LAY)' Q6 B( _# ~4 U3 f
            (prompt "\nKhong chon doi tuong.")
& E5 b6 u% @4 ?* i8 `: ~            (prompt "\nSu dung layer hien hanh? <Y> ")
5 n% j2 M+ V" z9 ~2 G0 l            (setq ANS (strcase (getstring)))3 K+ U7 p( v9 C. E# j5 o
            (if (or (= ANS "") (= ANS "Y") (= ANS "YES"))! u4 [1 {: |1 |  g
              (setq LAY  (getvar "clayer")  LOOP nil )  )  )) |# b1 T7 G: h) X$ N, q
          ((listp LAY)  (setq LOOP nil) )
" k4 {: D$ z; d$ A' O9 S- r          ((= LAY "Ten")' \& @6 v4 q+ Y$ O' m- b
            (setq LAY (getstring "\n>Nhap ten layer: "))
( K- g3 M/ L% Q8 h# O            (cond3 {" I: z$ e. W) Y5 s6 z
              ((tblsearch "LAYER" LAY)  (setq LOOP nil)   )8 s/ H1 G9 ?# {( @/ ~# T: i  s
              ((/= LAY "")) b) [* c8 Y1 w
                (prompt "\nLayer chua co trong ban ve. Tao layer moi? <Y>: ")
8 h0 R& ^3 S9 i# v/ Z                (setq ANS (strcase (getstring)))4 t7 r$ Q1 Z) g# @% g$ y9 o' F, v* z
                (if (or (= ANS "") (= ANS "Y") (= ANS "YES"))5 x& w0 ^1 Q+ P) ?9 y7 L
                    (progn* M: W# q; W4 c3 Z* d  b6 l3 W. y+ R
                        (command "_.LAYER" "NEW" LAY "")& a7 _7 n$ p  |6 a* k
                        (setq LOOP nil)   )
1 I& ?3 x+ p3 T+ s5 b6 w8 A                    (prompt "\nLoi ten layer.")   )   )  )  )   )7 {# @) X9 `7 H" S
        (if LOOP  (progn (initget "Ten")
; ?6 g; v# `4 c            (setq LAY  (entsel "\nTen layer/<Pick doi tuong>: ")) ) ) ); while LOOP( ^: m( L( f8 x+ }9 h" Q1 x
        (if (listp LAY)3 q4 R  P5 Q5 A3 @" Y  d
        (setq LAY (cdr (assoc 8 (entget (car LAY)))))      )
9 R; t9 @3 S/ D) X  C( u      (command "_.chprop" SS "" "_la" LAY "")% O+ P7 s: k5 G7 K% {
      (if SS  (prompt (strcat "\n" (itoa (sslength SS)) " doi tuong thay doi toi layer " LAY )) ), Z! u, D3 \- _
      (if (= LAY (getvar "clayer"))
) |7 R" [" T5 i2 ^% \! }2 `. |7 _        (prompt " (layer hien hanh).")  (prompt ".") ) ) )  (princ) )
+ g( s9 _! _  X3 ?/ X(defun cAYMCH () (laymch)) (defun c:CLL    () (laymch))6 r7 j8 d2 \9 u7 K
% m( ^- B+ w5 T  J0 X. _
;;; ============================ Layer OFF =================================
  j, Z4 g& X0 v8 Q6 L5 ^+ Z2 I
) x8 z* E3 m0 L% Q(DEFUN CJ (/ SSET SSL ENT LAY I MODE)6 C/ f5 u4 h$ @* f3 Z% }
   (SETQ SSET (SSGET))
/ M3 {3 b; s8 g" W1 Q9 d0 m8 j. T   (IF (/= NIL SSET) 5 b" C( W& `7 w5 v: J/ |
    (PROGN
5 p+ {2 e0 R% t5 f& d9 [     (SETQ SSL (SSLENGTH SSET)). ^; U# F& Z, f. ]
     (SETQ LAY "")
1 v$ g9 B% {7 u$ k     (SETQ I 0)
$ [+ K8 }' A, u% k     (SETQ MODE 0) 2 y' _. p3 A& T
     (WHILE (< I SSL)
/ G/ a/ I: o% q- v2 P                 (SETQ ENT (ENTGET (SSNAME SSET I)))/ |0 x1 f! _* r
          (IF (= (CDR (ASSOC '8 ENT)) (GETVAR "CLAYER")) (SETQ MODE 1) )2 J/ a8 ?$ g  b# |
          (SETQ LAY (STRCAT LAY "," (CDR (ASSOC '8 ENT)) ))
* r6 {/ l4 ~* h) m7 A# |* Z( C          (SETQ I (+ I 1))
  o/ G# D% t$ Z     )1 q' g/ U& }' d8 A
     (COMMAND "LAYER" "OFF" LAY "")
1 \; C: z$ v* n     (IF (= MODE 1) (COMMAND "") )
3 X9 U! n+ q+ p! ~* n+ _+ u7 a" `. ]    )+ R6 \6 `% A) ]) a( n7 f% F3 C: y  m
   )
6 y( s, ~# W* [6 Z   (PRINC)
$ T- v- Y/ W, Q; [" T)
* j: t" [6 i1 n: J* |
& u. c# {3 G  B5 j7 P;;; ================================ Layer ON ==============================) Z$ V5 N0 [' T- n
- C8 ]! m, s2 e0 R0 {+ x
(Defun LAYON ()  (setvar "cmdecho" 0)/ L! A, B8 J& n. L% u' Y  W7 F
(setq Lay loff1) (setq Loff1 Loff2) (setq Loff2 Loff3) (setq Loff3 Loff4) (setq Loff4 Loff5) (setq Loff5 Loff6) (setq Loff6 "0")
( Q6 U7 w2 R2 D; V' N# N  (Command "LAYER" "ON" Lay "") (princ (strcat "\n      Layer : " LAY " da ON."))  (princ))
) G+ N9 P$ p- l(defun cAYON () (layon)) (defun c:LOO   () (layon))
; ^8 v0 c, p3 x8 w! x$ L$ x(Defun C:LO () (setvar "cmdecho" 0)  (Command "_.LAYER" "_ON" "*" "") (princ "\nDa ON toan bo cac Layer !") (princ))
% }9 J& T- T% [% t/ t/ `$ j
4 t7 s# M) k) F# X" F;;; ============================== Layer Freeze ===========================) H, h' O! e3 f8 c& t
5 |, ]# b9 |: U. ?( }
(Defun LAYFRZ (/ LAY TEMP)(setvar "cmdecho" 0) ) Q$ b) G0 ~3 y  x
(prompt "\nChon doi tuong tren layer(s) muon FREEZE: ") (SETQ SSET (SSGET))1 B% n0 E" J! m, \9 c
(IF (/= NIL SSET) (PROGN6 J/ j1 b4 P/ t5 l2 H( S
     (SETQ SSL (SSLENGTH SSET))  (SETQ LAY "") (SETQ I 0) (SETQ MODE 0) - w: _6 D4 U, i/ J( X3 b+ Z
     (WHILE (< I SSL)
' {% t( d2 t; O% Y       (SETQ ENT (ENTGET (SSNAME SSET I)))
+ `3 F( ~8 i# X4 f" `       (IF (= (CDR (ASSOC '8 ENT)) (GETVAR "CLAYER")) (SETQ MODE 1) )
( b3 ?& Q9 n, ]       (SETQ LAY (STRCAT LAY "," (CDR (ASSOC '8 ENT)) )) (SETQ I (+ I 1))), z% _+ |1 S  B9 S; c! z" ]
     (COMMAND "LAYER" "FREEZE" LAY "")8 J( ~. \  j6 s1 X$ E
     (IF (= MODE 1) (COMMAND ""))))
, r( Q/ h7 `1 G (setq Lff6 Lff5) (setq Lff5 Lff4) (setq Lff4 Lff3) (setq Lff3 Lff2) (setq Lff2 Lff1) (setq Lff1 LAY)
0 b2 ]3 o8 e# K+ b1 r6 q (princ (strcat "\n      Layer " LAY " da FREEZE."))(setvar "cmdecho" 1) (princ) )0 r3 Q$ r. f/ \( p# y& p0 `3 j
(defun c:LAYFRZ () (layfrz)) (defun c:LLF     () (layfrz))
  z* K# g7 D) V/ N' L0 u
# Y' L" @# z1 q/ ?; \- I6 G4 Y;;; ============================== Layer Thaw ===============================
8 s) [2 K" l' A% C2 K! F
4 J/ ]6 ?# x& ~& y(Defun LAYTHW ()
0 H! `6 g. E" n0 M3 ]  (setvar "cmdecho" 0)" a" d; D# h3 {; E0 B! P
(setq Lay lff1) (setq Lff1 Lff2) (setq Lff2 Lff3) (setq Lff3 Lff4) (setq Lff4 Lff5) (setq Lff5 Lff6) (setq Lff6 "0")
3 k' b7 v- L' C+ T3 i( p! h: x+ l  (Command "_.LAYER" "_THAW" LAY "")
2 R8 n) U& q& o           (princ (strcat "\n     Layer : " LAY " da THAW."))2 c0 {* n- U+ k: P) P' Q
           (princ) )
+ f# X. L. J6 K(defun c:LAYTHW () (laythw)) (defun c:LW    () (laythw))" o3 F( W7 P# |1 {

, q1 L+ q" s/ L# e;;; ============================== Layer Lock ==============================
2 D6 Q+ B1 E' ]( U! l$ O/ r% S# \9 k7 W, G' e7 E; L* i) y
(Defun LAYLCK (/ LAY)
+ ^" w' {& M& S6 d  (setvar "cmdecho" 0)6 s" J& Y) O/ |( [2 X
  (setq LAY (entsel "\n>Pick doi tuong tren layer muon LOCK: "))
% @" S: u8 d# k# \( Y$ e  (if LAY" |0 K& v) r1 b/ X; W  ~, @2 k
    (progn
$ E! F% G+ F0 G+ w: Y+ t, [" [      (setq LAY (cdr (assoc 8 (entget (car LAY)))))
% X- s; ]$ M8 C! L& @      (Command "_.LAYER" "_LOCK" LAY "")
/ k" X* y" O9 |0 E' |      (princ (strcat "\nLayer " LAY " da LOCK."))    )  )  (princ) )! ~3 Z. w2 Y# k- q: r" l2 f
(defun c:LAYLCK () (laylck)) (defun c:LK     () (laylck))
$ z* h; t7 {# e) `( M$ V5 J- k
;;; ============================== Layer UnLock ==============================0 \* y. i& I  K5 I, ~3 I, L& e+ B
7 Y) @+ x, q" L* A2 f5 T4 @% Q! X# k
(Defun LAYULK (/ LAY)
8 q, r' n" \7 Z( B7 t9 K7 W  (setvar "cmdecho" 0)" {, j/ R1 ~' K' B% S4 k
  (setq LAY (entsel "\n>Pick doi tuong tren layer muon UNLOCK: "))
+ ~+ e/ q, L+ C" D$ ~+ l% n  (if LAY
, G6 i; W. U' q# D& F2 i    (progn
+ N4 x! y/ m0 o. f$ i+ O      (setq LAY (cdr (assoc 8 (entget (car LAY)))))
" [' N8 G% P. [/ Z      (Command "_.LAYER" "_UNLOCK" LAY "")
( L7 Z6 q' E) S      (princ (strcat "\nLayer " LAY " da UNLOCK."))    )  )  (princ) )% R0 L6 K" V, J+ z) G$ z
(defun c:LAYULK () (layulk)) (defun c:LU    () (layulk))
$ w" @& O5 ?% K, g
" h8 k3 K. }& [0 ~/ A2 C;;;===================== Delete all objects of Layer ========================
  F8 H6 z6 `+ J% a2 u
$ z9 K1 s5 D; {/ e(defun DELAYER (/ ocmd L S) + q6 p( |) }* C5 @
  (setq ocmd (getvar "CMDECHO"))
. Z+ |; ]* W: f) m) ?  (setvar "CMDECHO" 0)
5 q, z" t; X+ x; Z# W2 |  (setq L (strcase (getstring "\nLayer(s) to delete: ")))
9 K' N# H" Z& [" ^: h  {) R# {3 ^- f8 r: E  (setq S (ssget "X" (list (cons 8 L))))
& H% d. b% o" D0 `( ~9 f( h. \/ S( h  (if S
% E6 m0 N! `$ n; m( I' k    (command "ERASE" S "")            ! x! ]' h( t+ B: B4 i/ G
    (princ "Layer empty or not a valid layer name.")  )
/ V8 |) p0 V- ^- A9 X  (setq S nil)                        ! C7 T, ^. F. o3 c. _/ v
  (setvar "CMDECHO" ocmd)             - z+ {! ~0 E) N4 |! A" _
  (princ) )
7 F( h4 F+ Y0 i3 Y(defun c:DELAYER  () (delayer)) (defun c:DELLAYER () (delayer)) (defun c:DEL      () (delayer))
2 R8 m0 X" Y" `+ D. j% q
, Y7 k! \( V% P( S1 \% Q;;; ========================= HET CAC LENH LAYER ===========================0 C+ v  y/ |  C9 [8 l( i
0 t% h! ^, g& ?' |
;;;====================== EXTEND NHIEU DOI TUONG ===========================- U. z; _2 t6 Z, Q. s, Z

! `) D2 B. t6 s# z0 o* {(Defun C:EET ()
9 ^4 c4 ^% D- o; W  (Setq CVAR (Getvar "CMDECHO"))  (Setvar "CMDECHO" 0)% C1 H. H$ [/ g+ l/ k4 h& m
  (Prompt "Chon doi tuong dich cua EXTEND :")  (Setq CUTEDG (Ssget))
* x7 }1 G+ v( I, D$ b/ ~0 `  (Prompt "Chon doi tuong de Extend :")  (Setq SS (SSget))  (Setq LEN (SSlength SS))% }/ d( S  y) e6 [" c! ?  B7 S1 l
  (Setq I -1)
1 A" p0 a7 U- m1 {  U  (Setq SIDE (getpoint"Chon phia de EXTEND"))  (Command "EXTEND" CUTEDG "")3 a1 A1 S9 j2 f
  (Repeat LEN
+ M" g. P$ p% q; R" @   (Setq I (1+ I))
6 L9 k/ Q; X& Y% d$ _   (Command (List(SSname SS I) SIDE))  )  (Command "")0 e. x4 i0 N0 P7 @
  (Setvar "CMDECHO" CVAR)  (Princ "Da Extend xong moi ban lam tiep")  (Princ) )
1 }, }. S& K/ r/ M8 Q) e) |& f5 X" R+ y1 m
;;; ===============  EXTEND 1 DOI TUONG THEO KHOANG CACH ===============$ ^: @1 A  ?  Q
6 A0 E9 w2 _5 H9 f7 P
(defun c:ETT ()  (setq os (getvar "osmode"))  (setvar "osmode" 512)
3 J( v5 x& a. p- k0 }  (setq pt1 (getpoint "\nKich vao 1 dau doan thang can EXTEND  "))
# @. n3 p8 q; \7 @. u$ g% W2 s  (setvar "osmode" os)6 E& ~* @3 G* H  @  ^
  (setq dis (getdist pt1 "\nKhoang cach can EXTEND :"))5 n$ G$ v' S1 j7 e" M& d
  (command "circle" "endpoint" pt1 dis)  (command "extend" "last" "" pt1 "")  (command "erase" "last" "") (princ))' A: u( A/ T" l4 Q

" O6 U& M& _4 n# j8 E;; ================ Change width of polylines =========================
6 ]+ J. T# J: i& |& r( s4 L- W; F* n
(DEFUN wp (/ a b sophantu sodem list1 ha:wid); F1 q( D0 b  l  I
(PRINC "\n         Chon doi tuong can thay doi do day (Width) !") - `. ]6 z5 ]: b# V& v
(setq b (ssget))
. `! ~5 i% r5 X% p7 k' Y% B (setq sophantu (sslength b))
# r* s5 \& u1 N' ~4 c) _ (if (null ha:wid) (setq ha:wid (getvar "tracewid")))
* Y6 {. I0 H# x; } (princ "\nDo rong polyline <")
- U; F9 C$ s- `6 [ (princ ha:wid)
* I( {/ P: j3 p% Y& |, k (princ ">: ")
* d) w, l: d& C) Z (initget 4)
, z; x& g& Z, @: x; v (setq ha:wid (getdist))
, b3 n3 o$ {4 [ (if (null ha:wid) (setq ha:wid (getvar "tracewid")))
4 q; Z0 K* ~" g6 Z* N" N (setvar "tracewid" ha:wid)
+ z( a4 n' U5 G9 h+ b3 }9 I (setvar "cmdecho" 0)
  y5 k* ]4 [9 p7 X1 q (setq sodem 0)
/ U2 m" @0 h" O3 h1 i9 M, f0 U7 ~ (repeat sophantu" v' R: s9 f/ M: H& u" E
  (setq a (ssname b sodem))- \# X: P3 ^( q/ }" s7 n# \, ?
  (setq list1 (assoc 0 (entget a)))
- I7 s" I& g+ P& s- i0 O    (cond
7 {! Z' {+ P  B0 {5 b     ((= (cdr list1) "POLYLINE") (command "_Pedit" a "w" ha:wid ""))4 E7 n3 z" l: w% f. O6 B
     (PROGN (command "_Pedit" a "" "w" ha:wid ""))    ) 4 S* ^* ^+ i& a
(setq sodem (1+ sodem)) )(SETVAR "cmdecho" 1)(princ))
6 Q2 O( \2 v. E9 M(defun c:wp () (wp)) (defun c:pw () (wp))+ R6 x+ w0 P. E
6 j) j& Y8 b9 R  |8 n1 |5 a
;; ================ Change radius of circles ==========================
7 b; ^& m1 |* |$ B0 }  ^4 F# C& P5 x; r( O
(DEFUN C:CHR (/ SSET SSL M RD I)   (PRINC "\nSelect Circles :")   (SETQ SSET (SSGET)), ]" T' }5 ?. f) _
   (IF (/= NIL SSET) (PROGN  (SETQ SSL (SSLENGTH SSET))  (INITGET 4 "")  (SETQ RD (GETDIST "\nNew radius : "))( P5 s' R3 v8 S7 ?& x0 M
   (IF (/= RD NIL)  (PROGN (SETQ I 0)4 w' a; N: h! ~+ j
   (WHILE (< I SSL) (SETQ M (ENTGET (SSNAME SSET I) ) )
7 g! v1 {8 y7 Y   (IF (= (CDR (ASSOC '0 M)) "CIRCLE") (PROGN
  y7 V! G( g0 f4 a  |' W2 r  (SETQ M (SUBST (CONS 40 RD) (ASSOC 40 M) M))  (ENTMOD M) ) )  (SETQ I (+ I 1)) )      )   ))) (PRINC) )7 i5 X: b6 h2 `) s

# M8 P& _& \& w4 ^9 o' s;;; ============================== TEXT Hight ===============================
0 F. I( T1 r4 I: R3 m/ {  A8 K7 N9 H0 E
(defun texthght (/ ent hght)
- K6 v) \; }3 c2 w9 D. S. H  (setvar "cmdecho" 1)# M% G5 v4 k( g( H6 s/ N, k
  (prompt (strcat"\nSelect text entity with required text height"))
/ E, h6 p7 A! U( [4 ~! a1 T6 ]  (prompt (strcat"\n."))
- s4 v; J: ]. c& |8 [3 C& M+ }  (setq ent (entget (car (entsel))))2 Y, ?7 ^- Q! L$ g' y6 D2 M5 B
  (setq hght (cdr (assoc 40 ent)))! f! G+ n( p) D% _0 k2 |  G
  (prompt (strcat"\nText height now set at "))(prin1 hght); S# |& N5 d* o" `4 Z+ J* p
  (prompt (strcat"\n.")) ' v+ y" Q6 g3 Y
    (setvar "cmdecho" 1)
# D! F) t3 w! c! K1 S    (command "DTEXT" PAUSE hght "") )! I4 w# P- P( v/ p
(defun c:teh () (texthght))  (defun c:texthght () (texthght))/ Q$ v0 x* J+ s" T
5 |: c; @4 I5 L+ `5 H7 `
;;; ================ BAT -TAT CHE DO GACH CHAN TEXT =================" V  y8 T* _- R# l5 o" ^
' `& v$ h/ l2 y% b
(defun c:tuu ()  (setvar "cmdecho" 0)! u' q+ |% Z! b
    (prompt "\nHay chon dong TEXT can gach chan ")
) F' u- @3 i& g) y7 Z2 j4 `    (prompt "\nSelect objects: ")
0 O  C: {+ {/ T: a6 G5 E, W0 P1 N. K    (command "select" "au" pause)# \3 E! z# ]  Z
    (setq sstxt (ssget "p")' O' D/ B6 T8 b. ~* ?8 L
          sslen (sslength sstxt)2 [. ]# @% j3 s. \* f1 Y
          ctr 0    )
6 M; a9 [* K5 d4 n2 v$ \  Y    (command ".undo" "mark")& t, @; p% ^4 Y
    (while (< ctr sslen)6 _, a' K3 T& ?  W; F' ~
           (setq listxt (entget (ssname sstxt ctr))& n0 S9 h- d2 d8 z* O  Q
                 txttxt (cdr (assoc 1 listxt))# b: e1 ?1 u% P
                 enttxt (cdr (assoc 0 listxt))   )
% v5 D( A2 ^9 X( X1 S7 y, c$ G           (if (= enttxt "TEXT")- T3 W& r& d1 q
               (progn
; i/ j  T- y) K* o& ^3 L3 q8 ]                   (setq testxt (substr txttxt 1 3))' V7 w1 Y$ X% r# o. ?, f
                   (if (or (= testxt "%%u") (= testxt "%%U"))
% A9 D( x! J( v* f4 N. Q) T1 |/ q                       (setq newtxt (substr txttxt 4))5 N) p/ A2 }. _& f) z2 i
                       (setq newtxt (strcat "%%u" txttxt))    )
8 s' n8 D/ B. E) J/ n                   (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))
2 Z0 a" R( s4 j$ y& t                   (entmod listxt)                ) )6 m# D. {6 P% L* D% h
            (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))2 B9 H8 j2 M1 Z4 N* _* N

) Y# y) G' ]2 k  D2 v" t, b;;; ================ BAT -TAT CHE DO GACH CHAN TEXT =================6 G5 l+ r' @: _' {3 n
  X. c" }$ M  P* t- l
(defun c:tob ()  (setvar "cmdecho" 0)6 L! E; E2 ]. f
    (prompt "\nHay chon dong TEXT can gach tren dau ")
& \2 J& r9 \# s7 m. y/ A4 [    (prompt "\nSelect objects: ")* a/ j# r6 f+ O/ M  K8 g9 A
    (command "select" "au" pause)
. \* ^0 j3 N- u4 T/ B    (setq sstxt (ssget "p")
8 H0 |1 W; W1 Y- I) K          sslen (sslength sstxt)7 q) }/ v. {* d9 \8 q5 D  K
          ctr 0    )
7 K, n+ ^# a( P. X+ B, r% Z    (command ".undo" "mark")
( |3 P6 D: W$ D. H    (while (< ctr sslen)) m" P# J: Z" [" u+ {
           (setq listxt (entget (ssname sstxt ctr))( G4 ]( m( {& N4 v# d6 n7 r% i- k0 |
                 txttxt (cdr (assoc 1 listxt))
* q/ Y+ v, \% h6 u6 F+ C                 enttxt (cdr (assoc 0 listxt))   )  C6 Z- ]/ J# w  ~# X& s
           (if (= enttxt "TEXT")7 V0 h9 T4 c6 ^* f
               (progn! h  z% b+ |  ~
                   (setq testxt (substr txttxt 1 3))
8 E8 w9 p( c  {2 a6 J5 g6 ~                   (if (or (= testxt "%%o") (= testxt "%%o"))
+ I" r2 k* m* d5 \% X5 B9 m                       (setq newtxt (substr txttxt 4))
' B+ J/ a( \# I; b7 h                       (setq newtxt (strcat "%%o" txttxt))    )
5 d  c8 e6 x' I9 X3 v( E                   (setq listxt (subst (cons 1 newtxt) (assoc 1 listxt) listxt))
2 {7 J" \1 f5 A  W$ d; d+ ~( [                   (entmod listxt)                ) )" ^; g6 t. e2 s" L- M
            (setq ctr (1+ ctr))  )    (setvar "cmdecho" 1)    (princ))6 k( u6 v+ t6 O1 B7 O
6 w3 o% w- f# m% a! o
;;; ========================== Tim & thay the TEXT ==========================8 u4 B; ?9 e! p) ~; v5 i

* }1 n& ^! n8 S; l, f(defun frstring (str search replace / str1 str2 index find)
; Z$ u# K" N6 |0 }, @(setq index 0) (while  (<= index (- (strlen str) (strlen search)))  (setq index (1+ index))
- z5 M/ m+ d" h( C# `(setq find (substr str index (strlen search)))  (if (= find search) (progn    (setq str1 (substr str 1 (1- index)))
3 g8 U, w" N( M# a(setq str2 (substr str (+ index (strlen search))))  (setq str (strcat str1 replace str2)) )  ) ) (setq str str))
2 ^4 @1 ]& W9 D1 p(defun hai (/ dial)
' E7 V3 k( i) ]& K. ~ (setq dial (load_dialog "hai.dcl"))       ;;goi dialog
7 d* C$ i+ N7 O (if (not (new_dialog "find" Dial)) (exit)) ;;
6 n0 R" m! H( T7 I2 Y/ n  M# i6 [1 j (mode_tile "find" 2); Tao dau nhac tai hop thoai5 y% {, {" i; k! |
(action_tile "find" "(hai1)")
! c7 U& M& y! y' O+ z' C& B6 a* _/ { (action_tile "replace" "(hai2)")$ i% e" h9 T( ?0 Q5 i2 W" r
(action_tile "cancel" "(done_dialog) (exit)")
5 q) p3 V0 N6 k7 C- R% Z (start_dialog)      
+ U9 Q7 }% T/ k' j4 a (unload_dialog dial))$ X. f# a( f! a8 u' E
(defun hai1 () (SETQ str1 (get_tile "find")))( m  d/ p. e1 u* H" H, G1 {& Q. K
(defun hai2 () (SETQ str2 (get_tile "replace")))
; V. O5 N* r2 z# A6 a  Y% k, A: ?3 }( U' }' X6 Y, c
(defun c:TTT (/ a str str1 str2 newstr taphop sodem)2 B- f3 H/ C' i/ f* d
(hai)" F7 J- R% @& J: [/ |8 S/ @
(if (or (null str1) (null str2)) (princ "\nDu lieu khong hop le")! C! J& x! f5 e- C# S; Q
  (progn5 S1 V. k' f# c& F: O( Q( T1 B
   (setq taphop (ssget '((0 . "TEXT"))))
8 B. ~6 J7 G" C3 J" u  x   (setq sodem 0)5 x! R- ~% A7 k) s
   (if taphop: o3 m1 O; e# p, y/ f
    (progn5 U# T  t) k- A6 y  O
     (Repeat (sslength taphop)
3 B3 y7 }; F: R2 d      (setq a (entget (ssname taphop sodem)))
2 w3 y3 Y  |; [, u      (setq str (cdr (assoc 1 a)))# j7 t" y' l8 z2 {4 g" y
      (setq newstr (frstring str str1 str2))
; Q2 \9 K& q8 X9 E! T      (setq a (subst (cons 1 newstr) (assoc 1 a) a))
" E6 h8 S# ~% @1 r- j" y0 [      (entmod a); y2 F' B* H7 O1 y- l
      (setq sodem (1+ sodem))     )    )
) Z0 R) P& h4 z$ ?6 j    (princ "\nNone "TEXT" selected")   )  ) ) (setq *error* olderr) (princ))
: M) g/ y6 e6 w; ?
: K( c+ O/ v% [! e+ s+ h* l;;;=============================  CHTEXSTY.LSP =============================) r7 y8 S. [: w2 Z4 v# e/ C" o% {. p

/ O6 o; I4 \8 A(Defun C:TXS () (Setvar "Cmdecho" 0) (Initget 1 "SE ST ")
3 |( ~: Q8 z8 }( ^5 r5 f$ W(Setq G (Strcase (Substr (Getkword "STyle/<SElection>:")1 2)))' M% ?4 ^, L% k
(Cond ((= G "SE") (Setq A (Ssget)) (Setq B (Sslength A))& O: `# Y8 F' x: |( e% o- N
(Initget 1) (Setq C (Getstring "\nEnter new text style: "))
5 B0 A& U2 r- ]/ P2 N; T5 r% B) I, H(Extang C) (While (> B 0) (Setq B (1- B)) (Setq D (Ssname A B))
* t( ?" N$ u. A2 Q$ x8 Q3 |+ p(Setq D (Entget D)) (Setq E (Assoc 7 D)) (Setq F (Cons 7 C))
- }2 C1 o1 G7 W  L( @, G# _(Setq D (Subst F E D)) (Setq H (Assoc 51 D)) (Setq I (Cons 51 J))
6 S' V7 n5 n! X0 @(Entmod (Subst I H D))) (Setq A nil)) ((Or (= G "ST") (= G ""))- e, A& A0 R3 `, p
(Initget 1) (Setq A (Strcase (Getstring
* ?0 ]9 }1 B6 V& Z$ |"\nEnter text style to change: "))) (Initget 1): ?; S: b' ]4 G
(Setq C (Getstring "\nEnter new text style: "))(Setq D (Entnext))9 c; k% K: R% P; G+ v
(Extang C) (While D (Princ ".") (Setq E (Entget D)) (If
' s, h3 p1 R! l! g& {7 J) E2 h(And (= "TEXT" (Cdr (Assoc 0 E))) (= A (Cdr (Assoc 7 E))))7 H$ i# M0 ~) w+ v* [
(Progn (Setq F (Assoc 7 E)) (Setq G (Cons 7 C))6 b8 D% `; u+ u+ q+ S' [3 a' B2 p
(Setq E (Subst G F E)) (Setq H (Assoc 51 E)) (Setq I (Cons 51 J))0 Z$ l! c  F" m0 ^. E
(Entmod (Subst I H E)))) (Setq D (Entnext D))))) (Princ))
: M$ P; ]. B% ]) K- M' S7 H) i2 w& `1 d% X" W: p
(Defun Extang (A) (Setq A (Tblsearch "STYLE" A))
! i' h( X2 T2 U, a. m3 L! `(Setq J (Cdr (Assoc 50 A))))
" C7 N. i1 }" z7 @$ x: D4 o0 v$ S8 Z+ y1 `5 y6 _
;;; ============================ DRAW CLOUD =============================
0 ?; z% r7 B* w8 w; W% Z7 u$ P7 ]* W, D+ z* ~
(defun CLOUD (/ pt1 pt2 arc1 cnt ss la)    (setvar "cmdecho" 0)
1 M) P  l! o3 i, w* s! ]2 c+ [    (prompt "\nVe cloud (may) khong khep kin - Tu khep kin ve diem dau!")
; o. ^4 o' j$ I1 v    (setq la (getvar "clayer"))
+ M- J6 o9 A( _0 ]+ x4 ^+ s    (command "layer" "m" "cloud" "c" "5" "" "")
$ W4 T2 s! J7 ~9 ~, e* P' ^2 k    (setq pt1 (getpoint "\nEnter first point of Cloud: "))+ v, U+ G* n) \0 j
    (if pt1 (prompt "\nProceed in a COUNTER-CLOCKWISE direction..."))' y* Q3 `/ [0 I) P
    (setq cnt 1 ss (ssadd))
) s$ Q4 B! N' G5 z. N  q    (while pt1 (setq pt2 (getpoint "\nEnter next point - and close: "))  A& F$ X$ ?" d! W
    (if pt2 (progn (command "arc" pt1 "e" pt2 "r" (/ (distance pt1 pt2) 1.75))
( `$ p' Q6 i& b- i    (if (= cnt 1) (setq arc1 (entlast) cnt 2) (ssadd (entlast) ss)) ))
- {' e; y& k& ]) f: }+ ]    (setq pt1 pt2) ) (setvar "highlight" 0) (if (> (sslength ss) 0)
! @! J. j" L9 y  A. O' O9 e0 [, ~    (command "pedit" arc1 "y" "j" ss "" "x")
1 f- A- J" m( o0 H    (if arc1 (command "pedit" arc1 "y" "x")) ) (setvar "highlight" 1). T" D3 j! u: [/ f
    (command "layer" "s" la "")    (setvar "cmdecho" 1)    (princ))  
9 c. Z" A! p# h0 o6 B% `* g* S3 Z(DEFUN C:CLOUD () (CLOUD)) (DEFUN C:CLO () (CLOUD))
! M" t6 T) [) ], e, `& u" X: K( ]" n& t7 Y
;;; ================================ Funtion-Dulieu ========================
' Z- {6 a- v  ^. n;;; ================================ Funtion-Dulieu ========================
$ u! ]% z# Q% B5 o! ~, {;;; ================================ Funtion-Dulieu ========================
' t- }3 d3 f" O& j4 u# I7 n* G% M& L( |# s. s
(defun ha:nhap (kytu thamso) (princ kytu) (princ thamso) (princ ">: ") (setq key (getint)) (if key (setq thamso key)) (princ thamso) )
- |! b1 J$ X' q; U8 i(defun ha:thoat () (reinit) (setq Temp "Da thoat khoi chuong trinh"))( B  O9 {. D) t
(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))
( L. n- Y) l2 {$ p3 J" Y(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) )* \  N4 i6 a6 V# N! |4 M
(defun hauon (hauon1 hauon2) (command "fillet" hauon1 hauon2))
1 k0 v! G8 H* Z3 c$ i' R& a(defun init () (setvar "blipmode" 0) (setvar "cmdecho" 0) (setvar "angbase" 0))0 a* ]/ W6 W* ~7 r7 ^
(defun reinit () (setvar "cmdecho" 1) (setvar "osmode" 0))& E( W# T, t2 M
(defun tichvecto (vecto1 vecto2) (apply '+ (mapcar '* vecto1 vecto2)))
6 {5 M% H: |$ C8 u(defun vectophap (v01 v02 / vectochiphuong) (setq vectochiphuong (mapcar '- v01 v02)) (list (cadr vectochiphuong) (* -1 (car vectochiphuong))))3 A. c3 p9 a/ K" v: h0 n8 F
(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)))
7 c7 H1 P- j; K  B. F4 M! C(defun dtr (dtr) (* pi (/ dtr 180.0)))
7 m& i. R- i7 A: j9 _: \7 Y(defun rtd (rtd) (* 180.0 (/ rtd pi)))
$ P! b& T& ?) w  `9 m* C/ _6 K/ N) d5 D6 B' _4 }) ~3 e
;;;==============================PROGRAME===============================2 ?- ^: [) m) F# |1 m' d
;;;=====================EditDiM Hien Hop Thoai Dep======================
. h, J  [6 e7 O;;;==============================PROGRAME===============================' W# e/ Z8 _9 L! R4 R7 P. E5 I  B

) y2 l* d1 n+ G3 x;;Dth Edit Text, Dimtex & Attributes(Chu Co Thuoc Tinh)
8 q. i& E9 D3 r;;Chay Cung Du Lieu.Lsp & Hai.Dcl$ S4 _( N  M% ^' z& G
(Defun Hai_Edim (Chon / Dial State Str Oldlis Dimdefault Pt10 Pt13 Pt14 St Ang Dis Pt Hc)
4 }6 J4 J# y5 ~6 b: T4 [  (Setq Oldlis (Entget (Car Chon))
/ \) `" N' l. |$ ?        Pt10 (Cdr (Assoc 10 Oldlis))6 k6 b# V& \7 A; s
        Pt13 (Cdr (Assoc 13 Oldlis))# @; W0 b. R4 n" ]8 ]1 S
        Pt14 (Cdr (Assoc 14 Oldlis))) D' Z5 B/ k3 f4 Z; y) P/ ?
        St  (Cdr (Assoc 70 Oldlis))
/ U5 m9 ]  u& S, o6 a# T: B6 t        Dimdefault (Cdr (Assoc 1 Oldlis))
  W: P1 W( i: T2 g. ~; v$ |        ). c: [/ N1 W+ r/ Y+ Y6 h
  (Cond) m- x6 E* T  |) |
    ((Or (= 32 St)(= 0 St)(= 160 St))3 w  g/ X( g% W5 v$ d3 V
     (Progn  d' m: B! |, m
       (Setq Ang (Cdr (Assoc 50 Oldlis))! N2 d. A2 X9 n) x" U
             Pt (Polar Pt13 Ang 500)
; w2 }7 K( ]6 Q: E7 H  {             Hc (Lay_Hinh_Chieu Pt10 Pt13 Pt)
* Y" m# x) s) N+ H             Dis (Rtos (Distance Pt13 Hc))
4 F* @+ }" C/ A5 m1 l             )0 g: M2 T/ Y7 m8 X! q1 ^
       )
9 w/ g# @$ {) {     )
' ?) ^6 S+ y9 ]* x, j9 Q    ((Or (= 33 St)(= 1 St))4 |$ o/ B& S3 ]+ N: ], c$ c3 H
     (Progn(Setq Dis (Rtos (Distance Pt13 Pt14)))))/ x: C$ k2 J, ^( ^' w0 F% H- _
    );;End Cond. E6 R; h. t0 v
  (If (= Dimdefault "") (Setq Dimdefault "<>"))! |: N( c3 s; _. l  J! X( k
  (Setq Dial (Load_Dialog "Hai.Dcl"))
$ q3 J8 y8 n1 `/ n  (If (Not (New_Dialog "eddim" Dial)) (Exit))
* @7 K( s9 C2 H, I  s# j% Y7 v  (If (Or (= 32 St)(= 0 St)(= 160 St)(= 33 St)(= 1 St))' M% r* h. n3 ~. ^
    (Set_Tile "text" Dis))
+ C: d; H. |( @3 k) z1 x  (Set_Tile "ha:edim" Dimdefault)
; a* c6 ~, [( d$ R  (Mode_Tile "ha:edim" 2); Tao Dau Nhac Tai Hop Thoai
0 _7 e8 R% }. m* o  (Action_Tile "ha:edim" "(Setq Str (Get_Tile \"ha:edim\"))(Done_Dialog 3)")
! M) h- z: q, C3 E; i  (Setq State (Start_Dialog))(Unload_Dialog Dial)
7 ?* {3 }$ D( s6 i  (If (And Str (= 3 State))
8 Y+ v" p0 b4 F! i% R, D    (Progn6 s# N" u' h) H( r- c, M
      (Setq Oldlis (Subst (Cons 1 Str) (Assoc 1 Oldlis) Oldlis))(Entmod Oldlis)))6 D2 y: ?4 w0 t; L; ]
  )" B. i8 [; r5 ?
(Defun C:EH (/ Chon Name ): d  f- U$ D+ }  B8 t! P( ]. V
  (Defun *Error* (Msg)
* z# o3 L8 h0 s+ j1 P    (Princ "\nerror: ")(Princ Msg)(Princ "  ")
- W0 H, a+ B+ e3 x9 R    (Start_Dialog)(Unload_Dialog Dial)
5 B) A; |* E0 n+ \; B    (Setq *Error* Olderr)(Princ)
2 Q& y# E) l8 u! p9 I1 X* |! ^    )
4 B1 X9 a8 }& z9 B  y5 O2 m2 u  (Setq Olderr *Error*)8 t0 r/ g$ B6 \6 F1 X: L# L
  (Setq Chon T)
1 M+ Y: ]8 i2 y5 R8 a- s: f# o  (While Chon
& g: c/ M7 W2 F8 }/ t    (Setq Chon (Entsel "\n\n\nSelect Text, Dimtext Or Attributes To Edit..."))& ?  G/ P. a- h- H# B
    (If Chon
9 `6 p; I% G  A+ _; Q$ `2 A      (Progn
! u: f% \. l  \0 @        (Setq Name (Cdr (Assoc 0 (Entget (Car Chon)))))) r* L5 p- {* B* Q
        (Cond
% t; w( ]) V' {, z          ((= Name "INSERT")(Command "Ddatte" Chon))# n; n/ o: X3 R1 c
          ((Or (= Name "TEXT") (= Name "ATTDEF") (= Name "TOLERANCE") (= Name "MTEXT"))(Command "Ddedit" Chon ""))
% V) l- U6 a" R- U6 G5 J          ((= Name "DIMENSION") (Hai_Edim Chon))
6 `) L3 l9 t: w& U6 u% Z4 ?          )
" z9 E6 Z0 B) a        );End Cond
: b- c$ \' n" u2 |  G$ K) }      );End Progn& U9 L7 v2 m+ v& x0 n- [  s) W2 n' R
    );End While* `( z1 Q( `! O: W
  (Setq Olderr *Error*)(Princ)8 r) E7 b/ n7 N7 ]4 ], ^
  );End Program
; m" y% @8 m9 ^; P, p5 }; U; W1 ^  a% j2 d4 h# k# k3 S
;;;====================DDeditDim=====================
& u6 U% f; a! v. U2 b7 _- |# \0 ?;;;=====================Hai.DCL======================  ]& a7 [) O6 f: N# P
;;;====================DDeditDim=====================" S+ E3 m1 \4 {9 F' Y' C' o& F

2 q8 E/ G7 _% V) j) V) D/ b* o* T7 E2 f;;Dth Edit Text, Dimtex & Attributes(Chu Co Thuoc Tinh)
) L0 w8 m5 @0 o, s* u;;Chay Cung Du Lieu.Lsp & Hai.Dcl
+ i. }% E0 F0 V" b(Defun Hai_Edim (Chon / Dial State Str Oldlis Dimdefault Pt10 Pt13 Pt14 St Ang Dis Pt Hc). y! c3 _, F5 C6 }/ ^- I" I
  (Setq Oldlis (Entget (Car Chon)); u: g. u" H5 f9 _
        Pt10 (Cdr (Assoc 10 Oldlis))
8 [# k6 _3 R* J" |5 P        Pt13 (Cdr (Assoc 13 Oldlis))) _6 Y# ?" D) {' O, v( e
        Pt14 (Cdr (Assoc 14 Oldlis))
# O/ }% }7 Q# x' i; A# u* O. e" ?, H        St  (Cdr (Assoc 70 Oldlis))
7 |) H8 K) t( g( ?  Q( |/ a/ G        Dimdefault (Cdr (Assoc 1 Oldlis))
9 b" Q# ]/ X2 p2 e, @' `/ C        )+ d" t! l" \: U# d: }) k9 Y9 @
  (Cond
6 w" E- [$ u- r4 _# i8 O    ((Or (= 32 St)(= 0 St)(= 160 St))3 d' T; _3 u+ ?
     (Progn
/ x% t9 L4 t" g       (Setq Ang (Cdr (Assoc 50 Oldlis))1 Q! n# q" n  |+ j
             Pt (Polar Pt13 Ang 500)
3 o/ `  ]& ]% N- S) u             Hc (Lay_Hinh_Chieu Pt10 Pt13 Pt)( Z: K; H/ `9 {) b6 H- a
             Dis (Rtos (Distance Pt13 Hc))
! c2 }+ ]. B; E; G! e             )$ M: h+ e  G  j. Y8 B9 H
       )' _* o" u  p+ L: L% }
     )
* D& H% p( K5 a) J. Y    ((Or (= 33 St)(= 1 St))
& m( u9 r6 ?0 }6 ?' E( _* o     (Progn(Setq Dis (Rtos (Distance Pt13 Pt14)))))
+ }4 G3 a7 Z1 l3 l; D% S; Y6 w4 i, y    );;End Cond
; d+ L1 e0 b* T7 R0 h  (If (= Dimdefault "") (Setq Dimdefault "<>"))# H% A5 E3 q4 N' C6 Q8 `
  (Setq Dial (Load_Dialog "Hai.Dcl"))
8 p6 V, h0 W$ F0 g! |( e2 u5 b& M  (If (Not (New_Dialog "eddim" Dial)) (Exit))% z7 B% m; R2 M$ Y" e
  (If (Or (= 32 St)(= 0 St)(= 160 St)(= 33 St)(= 1 St))
" F+ @4 h- Z) j* R  F# w- @    (Set_Tile "text" Dis))
' h- H; x! z" N2 B- S: y& n6 t  (Set_Tile "ha:edim" Dimdefault)
8 {0 D# _, J! o' i' t4 C* F) h  (Mode_Tile "ha:edim" 2); Tao Dau Nhac Tai Hop Thoai
. x" N6 [* y0 C2 m/ D: Y) L; Y* [; ?  (Action_Tile "ha:edim" "(Setq Str (Get_Tile \"ha:edim\"))(Done_Dialog 3)")3 T, u9 {( a. |
  (Setq State (Start_Dialog))(Unload_Dialog Dial)
! S- Q4 l4 S/ q, H2 e  (If (And Str (= 3 State))
% v% k4 r3 o+ Z$ L    (Progn
" j( S& i! N: E- R4 D6 i- J      (Setq Oldlis (Subst (Cons 1 Str) (Assoc 1 Oldlis) Oldlis))(Entmod Oldlis)))
( A; X; q( T9 C  )
3 F8 F; a: Z5 E8 q' q(Defun C:EH (/ Chon Name )" ^- e9 n/ C# n' {' X  H- Y- \5 U
2 B0 q  p+ K( |1 ^2 x# ?
;;;********************Du Lieu********************" n4 d, ~0 b% |0 [* C/ E5 J
. R* E" m, s! ~( I0 m- b% ?' Y
(Defun Ha:Thoat () (Reinit) (Setq Temp "Da Thoat Khoi Chuong Trinh"))
( P  Z. R: T& z0 F(Defun Hacat (Hacat1 Hacat2 / Hacat3 Chon)
  [0 B  Y& s' X, p6 G1 r5 h5 T( f  B  (If (And (/= Hacat1 Nil) (/= Hacat2 Nil))
. A  H1 T3 p4 M$ y" b+ H    (Progn. `5 A, d& }' Y2 d
      (Setq Hacat3 (Polar Hacat1 (Angle Hacat1 Hacat2) (/ (Distance Hacat1 Hacat2) 2)))
% b7 R7 |3 t# {* h- N; G! S      (Setq Chon (Ssget Hacat3))
4 F) w1 E4 Q4 k, [, X7 O      (Command "Break" Chon Hacat1 Hacat2)
3 Q7 Y2 D8 x7 e0 w1 p      )
* a0 q7 {$ f$ m( g7 m! R    )  r" ~% E$ d/ M. [% J$ M
  (Princ)& l7 h0 M( ]/ v/ q2 H0 f1 }
  )
* j7 _9 z4 z& ?! C;;9 L( {7 ?4 A* A. t
(Defun Hauon (Hauon1 Hauon2)(Command "Fillet" Hauon1 Hauon2))
. x& Q- }2 }6 v+ w7 g! Q8 S;;: l# Q+ b) C# i4 a) y+ q
(Defun Taolop (Mau Lop / A)(Setq A(Tblsearch "Layer" Lop))(If (Null A)(Command "Layer" "_N" Lop "_C" Mau Lop "")) (Setvar "Clayer" Lop))
. s2 M: k* z: @;;4 e+ b: G; r. s6 g; m: T2 ?
(Defun Init ()(Setvar "Blipmode" 0)(Setvar "Cmdecho" 0)(Setvar "Angbase" 0))/ [4 O5 z. P: h7 r
;;) f$ G! s* g1 Q! }! Y: x' ]2 e/ n% v
(Defun Reinit ()(Setvar "Cmdecho" 1))
! n7 X& U; O) _3 E;;5 P: x$ H: i) w: @
(Defun Tichvecto (Vecto1 Vecto2)(Apply '+ (Mapcar '* Vecto1 Vecto2)))
' f: M, H3 q& y, b;;
% ~4 T2 X- w( f* F. i;;Cho 2 Diem Tinh Ra Vec To Phap$ M0 s1 z0 H/ _: C
(Defun Vectophap (V01 V02 / Vectochiphuong)(Setq Vectochiphuong(Mapcar '- V01 V02)) (List (Cadr Vectochiphuong) (* -1 (Car Vectochiphuong))))$ K  O, p' Y' I' S
;;Xac Dinh Vi Tri Hinh Chieu 1 Diem Len 1 Duong Thang4 r. e' m$ y7 {) n& i) K
;;Da Biet 2 Diem Thuoc Duong Thang
4 M( `# v  O" M; v- o& m(Defun Lay_Hinh_Chieu (Dc1 P1 P2 / Hc Dc2)% A/ Q' g0 I) ~
  (Setq Dc2 (Polar Dc1 (+ (/ Pi 2) (Angle P1 P2)) 100)2 f4 g7 O: g$ C# O( M8 }! `2 G
        Hc (Inters P1 P2 Dc1 Dc2 Nil)))
4 h1 v6 u, v  r& L3 J4 j7 ?;;Xac Dinh Khoang Cach Tu 1 Diem Len 1 Duong Thang5 l  b) i; A1 t5 T4 d4 u! v* U0 m4 B
;;Da Biet 2 Diem Thuoc Duong Thang( l  `$ a6 U! }; f" r4 g5 b
(Defun Khoangcach (Dc1 P1 P2 / Dc2 Hc)
. U4 E8 t" _7 R  (Setq Dc2 (Polar Dc1 (+ (/ Pi 2) (Angle P1 P2)) 100)1 h' x/ w/ }9 X9 o8 m
        Hc (Inters P1 P2 Dc1 Dc2 Nil))
% W9 A5 O$ D0 `7 }" t- s  (Distance Dc1 Hc)
5 a4 z" ?* P# o6 U6 H+ y" o, [  )' j. `! N! G/ E
(load "nhapcua.lsp")
+ ~$ O  b( r$ J- r6 {1 Q" I% _& \# Z4 O  (Defun *Error* (Msg)2 C0 z0 N, h9 r9 h6 G' f+ t
    (Princ "\nerror: ")(Princ Msg)(Princ "  ")0 R0 o( a5 H  K" S8 F  v
    (Start_Dialog)(Unload_Dialog Dial)$ g3 |; K, A3 p  {* {8 m
    (Setq *Error* Olderr)(Princ)! `7 u: g' Z( G' u: N8 l9 U3 |; d( m
    )1 m$ k$ |0 \% T6 [
  (Setq Olderr *Error*): J" I/ Y4 C& A" ?3 h* C
  (Setq Chon T)+ Z! x7 Q7 d7 Q8 Z6 G& X
  (While Chon5 P! }2 O" q  ?% B
    (Setq Chon (Entsel "\n\n\nSelect Text, Dimtext Or Attributes To Edit..."))9 m4 c' ^3 O  m; I8 Q
    (If Chon
) R- E/ a% ?4 ]4 S4 x' H      (Progn, D  s. Y& W# T
        (Setq Name (Cdr (Assoc 0 (Entget (Car Chon)))))0 m6 {, x0 j9 y, T) R
        (Cond& J5 O2 `5 z0 g1 A: F) s1 }
          ((= Name "INSERT")(Command "Ddatte" Chon))
1 Z6 |- l8 ^& Q- V8 j; B. @; _          ((Or (= Name "TEXT") (= Name "ATTDEF") (= Name "TOLERANCE") (= Name "MTEXT"))(Command "Ddedit" Chon ""))- }  m3 c* P; u" L
          ((= Name "DIMENSION") (Hai_Edim Chon))$ {/ B) m" C1 U; r0 |3 i: N
          )
' \7 k6 L" V6 q1 d$ S# e        );End Cond4 x) w2 a0 v, b+ a0 j
      );End Progn8 P- W, l$ k7 M' y
    );End While
3 |$ T) U2 t# `* V  (Setq Olderr *Error*)(Princ)
  v1 _- y" q4 m' K1 N2 ^5 y  );End Program
# x: p" W6 z- P& |$ O" n
2 R- ~- b/ g) o+ k2 k. Z9 T$ `8 q' Z, n% V" M
0 S- u5 j: B! W4 x. Z) ?
;===================HAI DCL Nhapcua.LSP De chay Hop Thoai EditDiM===================) N8 D6 Y! s+ p' v5 m7 H
;====================================Nhapcua.LSP====================================
0 U% v' |& G' E6 X( N;===================HAI DCL Nhapcua.LSP De chay Hop Thoai EditDiM===================3 C* d1 S8 w) D/ W

1 c0 z2 C8 ^0 u7 U* t  T; W( k3 g;;; ============================ Ve Hinh chu nhat ==================================+ h5 Z* `4 [% P, A  `; u
(defun HCN (/ olderr ocmd oblp pt1 pt2 pt3 pt4 l w)
6 e8 ]/ L5 m$ z+ ^/ Q/ E  (setq ocmd (getvar "cmdecho"))" a. u6 v% f; D/ U; ~
  (setq oblp (getvar "blipmode"))
) q3 w: ]2 t( H$ Q6 F4 v, Z  (setvar "cmdecho" 0)4 V$ e8 W* L& O6 j: e7 d
  (initget 1)                         ;3D point can't be null
5 W* U" `0 Q  v; v' h6 F  (setq pt1 (getpoint (strcat "\nCorner of rectangle or square: "))), ]* E& N- {: t! M. c' S3 X5 x
  (setvar "ORTHOMODE" 1)) S; }: ?: F) Z) l& O
  (initget 7)                         ;Length can't be 0, neg, or null
9 u1 {6 W4 A5 @  q! i. m( s3 [% t  (setq l (getdist pt1 "\nLength: "))
7 s; h5 |! ?8 G. k% t: S$ W  (setq pt2 (list (+ (car pt1) l) (cadr pt1) (caddr pt1)))+ F7 p+ S* \% o
  (grdraw pt1 pt2 2)0 `2 M% Y5 G) U4 o8 D7 T* r6 R! M
  (initget 7 "Square")                ;Width can't be 0, neg, or null; X: w# j5 g4 t9 T/ |& q+ B- N' H
  (setq w (getdist pt1 "\nSquare/<Width>: "))( q4 f$ G% h- T; ^2 l( u/ S
  (if (= w "Square")
# {( a% G0 d' c/ m: y) @8 S      (setq w l)  )+ g5 O) |! x3 u( k/ P3 y. h
  (setq pt3 (list (car pt2) (+ (cadr pt2) w) (caddr pt2)))
, E: A. F+ G7 o3 e# b- Q  (setq pt4 (list (car pt1) (+ (cadr pt1) w) (caddr pt1))); v% E! B4 [: M& b/ }5 Q
  (grdraw pt2 pt3 2)
4 f" p9 ~7 Y, [& x( `  (grdraw pt3 pt4 2)
, j3 |' V: G0 d; X' H  (grdraw pt4 pt1 2)
; a" c" m6 P  d" j  (setvar "ORTHOMODE" 0)( y# O' N7 g' N- b$ n
  (command "pline"  pt1 pt2 pt3 pt4 "close")
& n" Y! {/ g9 a' T% q  (setvar "cmdecho" ocmd)* K5 O" Q3 r) K
  (setvar "blipmode" oblp) (princ))
+ R! ^+ q; o% W(DEFUN C:HCN () (HCN))6 s) ^6 s' Q' t( r1 K; T$ q1 s
! V. B2 _6 L) V( U2 d. D
;*******************;*******************;*******************;*******************  M. w7 D$ T6 f; V! b% x
;****K E T C A U****;****K E T C A U****;****K E T C A U****;****K E T C A U****( M* W  R/ @/ o. a1 k  ^
;*******************;*******************;*******************;******************** s: d& z) B- R

) v) ^6 R0 Y$ j4 ~;VE HINH BINH HANH
& Q% k+ q3 u; T; t' W! S  J3 D  _* t$ }8 N
(defun c:binhhanh (/ p1 p2 p3)4 w3 X+ z6 ~* d- u. a9 C5 q
(setq p1 (getpoint "\n Nhap diem thu nhat:")): [  G: t5 _6 \' j% |
(setq p2 (getpoint p1 "\n Nhap diem thu hai:"))
" v  f) F7 ^: ^* e(setq om (getvar "osmode"))% S) k' T, T/ C  U, H4 h. ]  s/ P
(setvar "osmode" 0)5 T. s) Q) O( M( X3 E1 Z
(command "line" p1 p2 ""). t! _! R1 @8 b+ z' |9 C
(setvar "osmode" om)
) ^0 u7 j/ n' e% r2 e  P6 U (setq p3 (getpoint p2 "\n Nhap diem thu ba:"))3 _' m! ]+ x* U
(setq a (angle p2 p1)), O* Z; V+ ]+ \. ]7 \
(setq d (distance p1 p2))
! u. }1 m* y, V( U: ^- Y (setq p4 (polar p3 a d))
" t5 y9 F+ ]* H, t2 E3 u (command "OSNAP" "none")
1 u# K- n) B5 C: ] (command "erase" "l" "")( @& e5 Q+ ^+ `! g! q
(command "pline" p1 p2 p3 p4 p1 "")
0 B6 T4 [0 {; _(setvar "osmode" om)
6 }% F6 [2 ]1 d: i& d6 W* {7 @5 u)
# |$ t7 B( C9 t" P& F. `# B( \+ P) s
;VE LUOI COT
, [( E0 ]3 M/ u+ g- M7 e
1 t2 x3 h6 M1 O0 ^0 v0 U$ ](defun c:LuoiCot ()' D; f8 a' P; \1 z
(setq om (getvar "osmode"))
! B9 u( C, K7 E2 n, ^: u% b6 [(setvar "osmode" 0)0 E$ m7 r: O" I$ i) m
(setq tile (getreal "\nCho biet Ti Le ve 1/x, x="))
4 s$ j7 E7 J* j (setq p0 (getpoint "\n Chon Basic Point:"))
; Q5 p( b! E/ U5 Z0 q2 D) _) f$ j" \0 @ (setq nc (getreal "\n Nhap chieu ngang cua cot : "))
9 [8 y% I4 u# ^) d (setq dc (getreal "\n Nhap chieu doc cua cot : "))
/ r& u+ Z6 N/ ]1 U (setq p1         (polar         (polar p0 pi (/ (* nc hstl) 2 tile) )    (* pi 1.5)    (/ (* dc hstl) 2 tile)  )  )
4 v' q+ `3 O# K* \( b, m" B1 S (setq p2         (polar         (polar p0 0 (/ (* nc hstl) 2 tile) )    (* pi 0.5)    (/ (* dc hstl) 2 tile)  )  )/ d8 e8 i4 h0 O$ A, q$ w4 j
(command "rectang" p1 p2)
# w/ |: r, d. d* x3 x9 D' o2 S. Y (command "hatch" "solid" "l" ""); ]* y1 f( ]! c' x3 c# x
(setq bcn (getreal "\n Buoc cot theo phuong ngang : "))
0 A; k% S1 \" y  r, \. \ (setq nn (getint "\n So buoc cot phuong ngang : "))
4 d9 `: Y0 `4 }% i (setq w1         (polar         (polar p1 pi (/ (* nc hstl) 2 tile) )    (* pi 1.5)    (/ (* dc hstl) 2 tile)  )  )
+ O  _8 Z( z0 i" z4 X: Y; a" D# F (setq w2         (polar         (polar p2 0 (/ (* nc hstl) 2 tile) )    (* pi 0.5)    (/ (* dc hstl) 2 tile)  )  )
( h8 l; O5 J1 a9 p! }% E (command "select" "w" w1 w2 "")
0 E6 u- s- b7 X; {2 ?& f (command "array" "p" "" "r" "1" (+ nn 1) (/ (* bcn hstl) tile) )5 _. k4 v) r5 E% t
(command "line" (polar p0 pi (/ (* 1000 hstl) tile)) (polar p0 0 (/ (* (+ (* bcn nn) 1000) hstl) tile) ) "")9 ^7 c4 F( |5 I7 z3 G5 ^
(setq w1 (polar (polar p0 pi (/ (* hstl 2000) tile)) (* pi 1.5)  (/ (* hstl 2000) tile) ))7 c; I2 p1 Z4 R
(setq w2 (polar (polar p0 0 (/ (* (+ (* bcn nn) 2000) hstl) tile) ) (* pi 0.5)  (/ (* hstl 2000) tile) ))
5 x3 h# x5 I5 y. {: ~+ s- {* j (command "zoom" "w" w1 w2)! G5 u( {* S0 A/ L1 _8 ~4 z
(command "select" "w" w1 w2 "")4 I' M) O! N8 E
(setq bcd (getreal "\n Buoc cot theo phuong doc : "))' \& @& M; j" \' B8 {
(setq nd (getint "\n So buoc cot phuong doc : "))
: L% j9 u) X( Z* {5 t3 }" W* T. F (command "array" "p" "" "r" (+ nd 1) "1" (/ (* hstl bcd) tile) )
1 h! p* f9 X8 w6 [! O4 F, ] (command "line" (polar p0 (* pi 1.5) (/ (* hstl 1000) tile))  (polar p0 (* pi 0.5)  (/ (* (+ (* bcd nd) 1000) hstl) tile))  "")- f0 G, }7 G4 m" k/ S0 y, Q& T
(command "array" "l" "" "r" "1" (+ nn 1) (/ (* hstl bcn) tile) )
- s# F- y/ J4 l3 `& I) \ (setq w2 (polar w2 (* pi 0.5) (/ (* (+ (* bcd nd) 2000) hstl) tile))  )  
5 D  R/ I% }8 ?2 P) K9 R* d (command "zoom" "w" w1 w2)
1 Q, L8 c% ^. A) e4 R(setvar "osmode" om)6 A! n: O& T! h' b4 n# x
)6 I/ b1 \* n/ e- ^" _$ o

" W8 _  D7 u1 X5 i( Q6 R;VE CUA DI
' m+ |. j+ M9 ^3 Z* R3 l  Z: Y( W+ w3 ]7 a& u5 n0 E, X* o
(defun c:cuadi ()
* P, `, F) u% ](setq om (getvar "osmode")), o% d" I, M6 \$ ~$ {6 e
(setvar "osmode" 0)
& p- j3 @6 J+ E' C5 d( ^$ a: `
6 X: S# O6 K" M$ n (setq tile (getreal "\nCho biet Ti Le ve 1/x, x=")); i( l8 c) D  u' M. i0 I
(setq b (getreal "\n Nhap be rong cua : "))& h/ z+ ]9 {5 r' f9 \8 _! H4 L: j
(setvar "osmode" om)
4 a. m: W3 i" a# M1 Q- V( c9 t(while (< 0 1)
2 Y) o6 m% I; b: u3 T0 z) T1 J9 W  c (progn
$ v+ ]5 S" f* |* Z7 w (setq p0 (getpoint "\n Chon Basic Point:"))9 I/ H9 n; T4 E  f" m# w% P
(setq p1 (getpoint p0 "\n Chon diem de xac dinh huong cua cua:"))5 G9 B2 T- F2 V( j
(command "osnap" "none")$ o. Y# ]# H# P3 U3 {7 G9 I+ T0 S0 o% k# k
(setq p2 (getpoint p0 "\n Chon diem de xac dinh huong mo cua:"))
3 y" f- k4 U# ?1 m7 R: C$ d; m (setq a1 (angle p0 p1))
) b  [) \6 r" _! O1 _ (setq p1 (polar p0 a1 (/ (* hstl b) tile)))* P) V( |. [0 F7 u5 X
(setq a2 (angle p0 p2))
5 L# k- U, I! b (if (< (- a2 a1) pi) (setq a3 (+ (/ pi 2) a1)) (setq a3 (- a1 (/ pi 2))) )% @7 B: ]2 L) M3 m9 \* a. q
(command "pline" p0 "w" "0" "0" p1 (polar p1 a3 (/ (* hstl 40) tile)) (polar p0 a3 (/ (* hstl 40) tile)) p0 "")
& j  F' V! a8 r (command "rotate" "l" "" p0 (/ (* (- a3 a1) 180) pi))
7 _2 J' e- F3 ?! W- d1 R (command "arc" "ce" p0 p1 "a" (/ (* (- a3 a1) 180) pi))
) {% ?. k& S9 a5 P: `1 t+ r( j(setvar "osmode" om)9 g+ C  s+ o7 d* J( c, u1 ~- f
))
9 H7 F6 k0 T8 I1 o)
" f0 z$ Y- [0 j$ a: ^# Q/ i4 e/ N  d: s+ _. G
;VE CUA SO
0 v% Y7 B9 O0 Y1 r+ }( z
9 k$ M3 Z4 \) s# d4 T" N(defun c:cuaso ()  _* e6 l7 ?  h+ o; b
(setq om (getvar "osmode"))
! ]: g4 z+ u( _/ ^2 e+ T(setvar "osmode" 0)
* Y; ^  d4 C" ?" M. v6 y9 r
, I* o4 a# \7 {' a8 n( P (setq tile (getreal "\nCho biet Ti Le ve 1/x, x="))0 k$ _, y" G& V# b9 p
(setvar "osmode" om)8 R* t! a7 p' \" P' |$ \3 B2 I
(while (< 0 1)
+ H+ n4 R3 c. y8 X4 u  Y (progn6 w/ H/ @; }) {3 o6 ]3 [
(setq p0 (getpoint "\n Chon Basic Point:"))$ k0 B6 e& v% ?& E* t
(setq p1 (getpoint p0 "\n Chon diem de xac dinh be rong cua:"))& ?! M( t: F2 K+ w9 ]; F7 _
(command "osnap" "none")
5 B: r7 ]# v, E: U% W (setq p2 (getpoint p1 "\n Chon 1 diem o trong nha de xac dinh huong cua so:"))
* A, p% m5 m  W- M (setq b (distance p0 p1)). ~0 r' M0 e% O, i  A! |
(if (< b  (/ (* hstl 600) tile)) (setq du 50))
2 `* t5 i* f. `4 t (if (> b  (/ (* hstl 600) tile)) (setq du 150))1 M1 K. o% [+ T: j
(if (> b (/ (* hstl 1800) tile)) (setq du 200))% f# ~0 N. R9 }
(setq a1 (angle p0 p1))( ]! a  X2 l  y. @
(setq a2 (angle p0 p2))
1 ?9 [& |+ W3 L (if (> a2 pi) (setq a2 (- a2 (* pi 2)) )  )
, H7 u3 d1 r" Z7 a( r- }; ? (if (> (- a2 a1) 0) (setq a3 (+ (/ pi 2) a1))  )
2 e6 {  f6 e1 I, a  B# l (if (> (- a1 a2) 0) (setq a3 (- a1 (/ pi 2)))  )& c' j7 W" n* G. J4 O
(command "pline" p0 "w" "0" "0" p1 "")
) `. Q2 w# B# t( T4 @$ ^ (command "pline" (polar p0 a3 (/ (* hstl 50) tile)) (polar p1 a3 (/ (* hstl 50) tile)) "")
) v0 I9 P5 y) U: `) I5 u (command "pline" (polar p0 a3 (/ (* hstl 100) tile)) (polar p1 a3 (/ (* hstl 100) tile)) "")/ l" F$ r, z$ a! G0 p# J0 b" H
(command "pline" (polar p0 a1 (* (- du) (/ hstl tile))) (polar (polar p0 a1 (* (- du) (/ hstl tile))) a3 (* -100 (/ hstl tile)))
/ H4 s. }+ H6 _( g                (polar (polar p1 a1 (* du (/ hstl tile))) a3 (* -100 (/ hstl tile))) (polar p1 a1 (* du (/ hstl tile))) "")
1 R$ z- j/ K/ F(setvar "osmode" om)/ j6 C' A$ d& g. h/ t4 _3 G
))
# ]5 e; D+ f' {)' k$ j2 n# L: s

3 P/ |* K9 N& P: ?" U/ B;;;=== General Utility Functions ===
, M5 J8 W0 U3 ~7 E; U0 g- Z2 B  q, s) Q0 y. T& N
;   R12 compatibility - In R12 (acad_helpdlg) was an externally-defined ; Y. e: G: A) j2 L
;   ADS function.  Now it's a simple AutoLISP function that calls the 0 N. z( Z( J7 P! V( D  e4 ~
;   built-in function (help).  It's only purpose is R12 compatibility.  1 Z  h6 p% V. o$ X% {
;   If you are calling it for anything else, you should almost certainly
3 T$ x9 c/ o  {8 ~+ U" ^;   be calling (help) instead.
5 q. ]% ~) V  T7 m' O7 E( c4 M! O; ~5 a! Y; `1 ^
(defun acad_helpdlg (helpfile topic)/ q: z% \! Z6 e# t! H+ g) M
  (help helpfile topic), X# A. A, t6 V" c
)9 _2 T2 Q! t& m& g3 B0 p! s
* M3 @' ?9 |1 N% N, Q* M# F6 \

8 E1 p2 y0 N% u3 o(defun *merr* (msg)9 ^. H- Z$ g3 v" {$ G0 C" p
  (setq *error* m:err m:err nil)
* H- S6 d$ F" W6 f1 C3 b  (princ)! D. s: o# l( K$ o0 c/ p7 N; Y5 O/ s0 P
). w5 p: @* i9 w
# R  x. G- F/ e" O0 o; R+ m
(defun *merrmsg* (msg)6 [8 X' u% D( B$ [
  (princ msg)' j% O, h3 B7 u% i+ \$ @
  (setq *error* m:err m:err nil)
, P: e8 x! @8 d6 y5 U9 j  (princ)0 l* G( \0 ~; S6 a. o  t; o
)
+ h# ^: D2 c& G& v& C. C2 v8 N$ I* p  \. f
;; Loads the indicated ARX app if it isn't already loaded
6 ^7 A2 G. \5 g3 N;; returns nil if no load was necessary, else returns the, l' g# S) s9 a: L& {  j: v6 }
;; app name if a load occurred.7 h7 o7 _) R; B! G# W. }' q
(defun verify_arxapp_loaded (app)
) V, C. G# g0 b' V, O9 J9 @  (if (not (loadedp app (arx)))2 \! W) p4 r2 d" w
      (arxload app f)
. ]6 c& T* z( b$ G  )1 [0 @' s9 C3 J+ O
)4 P9 }8 g7 {) O- k
- T/ g7 {: F& j2 C7 g- A
;; determines if a given application is loaded...6 D( A4 w) ~- Q2 y  i4 h
;; general purpose: can ostensibly be used for appsets (arx) or (ads) or....& F6 |  f; w# V
;;
8 ^) u9 I" q5 S3 t4 m- |( X4 C;; app is the filename of the application to check (extension is required)* C/ w1 y1 u" D/ W$ U! }. n+ o
;; appset is a list of applications, (such as (arx) or (ads)
$ @* N* X7 ]! U, A, L1 C;;
4 l2 J+ N. R" K* C1 j/ T1 p;; returns T or nil, depending on whether app is present in the appset% u( P1 u: C  B1 u8 H
;; indicated.  Case is ignored in comparison, so "foo.arx" matches "FOO.ARX"
1 K/ m2 j; N8 L;; Also, if appset contains members that contain paths, app will right-match9 c% H: u/ u3 B
;; against these members, so "bar.arx" matches "c:\\path\\bar.arx"; note that
" Q9 e0 M4 C5 a$ V' |7 x;; "bar.arx" will *not* match "c:\\path\\foobar.arx."
8 w. O- X  K# S& b$ j0 h(defun loadedp (app appset)8 K/ D  f) Z8 q4 S5 Y
  (cond (appset  (or ! R6 h- C4 b& I1 n& w, H
                     ;; exactly equal? (ignoring case). D# k& h; [2 Q; F; g  h! d9 C4 w% J
                     (= (strcase (car appset)); S  \" k' g1 `& ?( c* l
                        (strcase app))
+ p& J0 Y; P! i! B                     ;; right-matching? (ignoring case, but assuming that
# m4 }) [+ `0 E8 h7 }1 @5 C; a/ W                     ;; it's a complete filename (with a backslash before it)& ^8 ~9 a. b. `9 {$ s
                                         (and
/ \: }. Z" O% a1 M3 D7 v                                             (> (strlen (car appset)) (strlen app))9 `  k! m/ U" d1 n
                             (= (strcase (substr (car appset)
6 ]9 ]  |* P. e1 j0 d. f) K% L                                                 (- (strlen (car appset)) 7 d/ o. l% f4 e7 ]+ I2 m
                                                    (strlen app)
! q+ C; {/ p; c- [                                                 )
8 \. i* U* Y1 Q4 m+ O$ r                                         )# m) ?  t. Z+ @( r: x
                                ) ; z' P) x% x! y, r
                                (strcase (strcat "\\" app))
  a2 E/ a$ B* `6 _                             )
& W' H# Y4 l& |0 @9 d: b6 \                                     )
7 P6 G4 v2 }4 w                     ;; no match for this entry in appset, try next one....+ [6 k2 Z, H# I7 U. U4 z9 G/ \
                     (loadedp app (cdr appset)) )))
9 g& d8 X7 s& h" _5 C+ ]# i1 a)
3 E1 ^) ~+ v" E
+ J0 U5 R6 F: {2 f8 z$ o. l
# N9 o7 `& a+ O' Q8 C" [;;; ===== Single-line MText editor =====; C- e3 D/ Y6 m' x$ u
(defun LispEd (contents / fname dcl state)
; l  s. ~3 ~: x$ _& T  (if (not (setq fname (getvar "program")))
- h0 W6 G/ M7 D/ C     (setq fname "acad")
7 ~7 }, k% [. E2 g9 j7 y  )
. C9 x0 B3 W* ^/ r0 V: O  (strcat fname ".dcl")
# T1 f% Q& p4 m  H9 ]3 ^, o  (setq dcl (load_dialog fname))
' S$ k5 k) j& g6 ~9 d& z* U  (if (not (new_dialog "LispEd" dcl)) (exit))
, E8 S" E" @. x( `' E  (set_tile "contents" contents): r/ q. W& ?" v2 m" z
  (mode_tile "contents" 2)3 B5 A$ R- t" \# K5 c, R' ~- C$ u3 P; v
  (action_tile "contents" "(setq contents $value)")
' g2 s& R4 c9 W  q/ w  \  (action_tile "accept" "(done_dialog 1)")8 H% U, }2 S- o1 O& m
  (action_tile "mtexted" "(done_dialog 2)" )
8 i0 P7 ^$ |& ?9 `4 c! g0 l) o  (setq state (start_dialog)); g+ i, J; I0 q; b* t8 M* G
  (unload_dialog dcl)
( `$ t4 z8 Z  h6 _. l1 \  (cond
3 U/ E0 q9 ~5 Q' K7 f4 @3 U$ ]7 _    ((= state 1) contents)4 U. A/ Z$ i0 D& H4 Y  o
    ((= state 2) -1)& T, D# n/ x. q! r, k5 ]% m7 y
    (t 0)
, s* v& @* _1 @: w! c  )( k- B3 g2 A$ ?. R# i7 Z& U
)
5 m% ^0 w- n/ U( ?8 L& m) x5 B4 S/ X  X4 g7 G7 ?
;;; ===== Discontinued commands =====
, ^$ n% c, j" c* l" f(defun c:ddselect(/ cmdecho-save)
% k  ^" S1 ]- N6 ?7 I, o7 D  (setq cmdecho-save (getvar "CMDECHO"))
. g3 g3 _4 H7 u2 b  (setvar "CMDECHO" 0)
2 z! }3 B* ]2 C! m  (command "._+options" 7)/ t( H5 C2 H6 w3 d( J0 @  [
  (setvar "CMDECHO" cmdecho-save)
+ H. }! L4 {# e  (princ)
' J/ y' F# Z- t) r4 O5 @  })
: |0 o1 `" a: }( q+ x7 U8 A% B
& ?& s3 {# M* y- ~  f(defun c:ddgrips(/ cmdecho-save)
' m% C* M# k9 {  (setq cmdecho-save (getvar "CMDECHO"))
+ h7 `# X1 ^" C# I3 K( O: {  (setvar "CMDECHO" 0): f* ^. Y4 d' I4 \* N/ r% A" _6 e
  (command "._+options" 7)" n# ]- ~( y& M1 O& R& P
  (setvar "CMDECHO" cmdecho-save)
- d6 V- u: t! D/ c  (princ)) i6 E+ G2 ]6 H3 n2 v
)0 j9 h* E& M( M: S
1 n+ I# Y1 G# v) e4 e% O1 b0 S; O
(defun c:gifin ()0 O) n4 n. o# r& ]% C0 |
  (alert "\nThe GIFIN command is no longer supported.\nUse the IMAGE command to attach raster image files.\n")
4 n5 r* t, A9 I, }3 ~/ I. A  (princ)4 G" z2 o5 _4 J( V. e
)' c7 M3 _1 y. ?
, X, a% f# \8 V' \
(defun c:pcxin ()
, T( e+ e8 w* D  (alert "\nThe PCXIN command is no longer supported.\nUse the IMAGE command to attach raster image files.\n")2 V+ k9 }) J# Q2 B
  (princ)
; j, R$ r. e5 [% `1 G)
4 M! m1 I* R7 G# c! q% {9 ?9 y' w" m2 U" _% A2 _
(defun c:tiffin ()& ~8 P. P' h3 v* X
  (alert "\nThe TIFFIN command is no longer supported.\nUse the IMAGE command to attach raster image files.\n")
) \. F- E( X7 Q: Z2 r$ s- k/ }  (princ)
9 d0 q0 }$ z$ V)
1 j6 h5 R! \8 G6 @  G) {" i
- N2 I; H, c2 o(defun c:ddemodes()
8 l: i" U/ s% u. b" `  (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.")
3 ^- ]" S6 v4 u  (princ)$ e, G9 X. l" Z& m) o- S
)
7 C. C2 w( G7 Q+ P/ H6 w" Q+ o
' T# N$ I4 J" W4 c(defun c:ddrmodes(/ cmdecho-save)( y& J9 ~: h, ]" a
  (setq cmdecho-save (getvar "CMDECHO"))  S% S" I+ U, [  B8 Q
  (setvar "CMDECHO" 0)+ _4 J3 G% @6 A9 [
  (command "._+dsettings" 0), e% i$ y. F' z0 B. v& g& m% P2 m
  (setvar "CMDECHO" cmdecho-save)9 @; b) u0 \- X/ Q2 \* t' d
  (princ)
1 A) O. c2 `3 u1 t)# {; r7 z3 B$ L- z+ `+ V' G3 a
) p/ E# J& @3 z. @5 v
;; HPCONFIG7 ]% n. @' c+ f* j2 ~' S' ~, b
(defun c:hpconfig (/ hlppath)& N/ Y" C/ C( L$ @. Z- G: E
  (if (not (setq hlppath (findfile "acad.hlp")))) G0 b/ b1 `+ V. e4 A
    (setq hlppath ""))
+ F# a  b6 x( ]5 s, h  (help hlppath "hpconfig")
6 e+ q3 q# Q; D. X, q  (princ)
0 ?4 a- q+ D2 P)
/ D# @1 l- l$ J8 A! J" S
5 W4 r- d: R$ Y5 a8 Q;; OCECONFIG, X! ^% {0 F# u9 p
(defun c:oceconfig (/ hlppath), f0 R& F4 l6 @: F  i- F
  (if (not (setq hlppath (findfile "acad.hlp")))" u, h/ p$ W! Q2 Q
    (setq hlppath ""))2 K1 S( r5 ~, f
  (help hlppath "oceconfig")  b$ X1 n4 k( `$ ]
  (princ)6 s: x- z' ]. d! q2 u4 `( K
)
! Z! x3 N0 t* g1 E
9 j/ Z  J$ _6 L5 Y;; CCONFIG
) p) L$ G4 k/ p' a(defun c:cconfig (/ hlppath)/ H/ {6 Y; l9 z4 @5 ]9 ?: X/ y7 g$ \
  (if (not (setq hlppath (findfile "acad.hlp")))% J$ _# l2 r( R# X0 i$ f9 [2 y! x. w
    (setq hlppath ""))8 Y: z+ d. D' V+ [0 Y* d& _! D
  (help hlppath "cconfig")7 x% T1 n, a# D% N4 B; g
  (princ)5 n- p' m, l' _( c4 p7 U
)
* N, U) }- g$ Z0 L6 Z
0 ~2 c! X% i4 x* ~9 [# p. \/ A$ `;;; ===== AutoLoad =====
% x/ ^6 F9 o0 W+ J/ j7 c
! ~( I( G6 C: e. K% \;;; Check list of loaded <apptype> applications ("ads" or "arx")
" T% y1 u: ^' J' s1 e* a;;; for the name of a certain appplication <appname>.
# U9 a$ z+ }8 W2 w;;; Returns T if <appname> is loaded.
+ @9 l# Z. G$ B5 I8 l* G2 G# l% a  [: O) z7 y
(defun ai_AppLoaded (appname apptype)8 [: ?) l5 ~9 ^9 F: N
   (apply 'or4 y4 o9 c3 ]) Z2 P, x
      (mapcar " e* n% |4 j' r9 q# p
        '(lambda (j)
# n9 `0 [( g5 F* u1 N            (wcmatch
; U/ ?( `0 B, u  \# L7 `0 i; z               (strcase j T)
4 H  l, l5 O9 y               (strcase (strcat "*" appname "*") T)
) Z' z+ J8 u' u6 U            )   8 U% N* O+ p1 ^4 D3 e! W. a
         )# @# _$ [& N/ _2 Y, v: |" U
         (eval (list (read apptype)))
! F" f4 ^9 H1 I  i) t" g      )8 B- U2 J2 Q3 V2 [
   )7 i: M) t1 Y8 J# }% ~) Z
)5 G; E5 v0 j2 u, N$ `% n

1 e" H4 o" [0 K2 t' i;;  
1 p. R& ~0 R( e: c;;  Native Rx commands cannot be called with the "C:" syntax.  They must ' l1 B0 w1 ^" L6 y4 H
;;  be called via (command).  Therefore they require their own autoload
5 a2 h7 n. {, U& ^! l;;  command.
# b: k, `: q* T+ [% T- O# }+ r( k2 O& ?" e
(defun autonativeload (app cmdliste / qapp)/ w9 p. f# {2 X" D: \
  (setq qapp (strcat "\"" app "\""))% e) E: W4 i: g5 @3 R: n
  (setq initstring "\nInitializing...")
; W7 i  _7 u1 `  (mapcar
) W0 h# K* _1 ^   '(lambda (cmd / nom_cmd native_cmd)
2 f0 }% Y9 L/ q3 A+ v) @      (progn
5 B. \6 N) F( |        (setq nom_cmd (strcat "C:" cmd))
. k9 G8 E, i' F+ J  c! H        (setq native_cmd (strcat "\"_" cmd "\""))' E! C0 c) R, X
        (if (not (eval (read nom_cmd)))
; o( @- E& x$ `( J# `$ Q            (eval
  s: N& M9 ^& p# v             (read (strcat2 B1 ^, D) H% @+ |
                    "(defun " nom_cmd "()"
3 _7 P# n  _% w                    "(setq m:err *error* *error* *merrmsg*)"( y% I1 \0 g' m6 }# b6 A' k) X  M) n
                    "(if (ai_ffile " qapp ")"; _2 I. {- T6 r9 N2 O8 O
                    "(progn (princ initstring)"0 W: A6 S. R  o4 j6 X, [3 I
                    "(_autoarxload " qapp ") (command " native_cmd "))"
/ W8 U+ G  c) a7 j: G                    "(ai_nofile " qapp "))"8 {; w8 n; O0 v; T! d/ t# H
                    "(setq *error* m:err m:err nil))"# m; Y& [: t8 a) {" t3 X
                    ))))))' G* U$ x, ?% W; J2 n5 z+ W" m
   cmdliste)
" F; M. s& D, T! t3 l0 G# l% `: ?  nil
3 A7 R4 r* l+ _* ]( z% e)
% F, O+ s! }, o* J6 u
) J6 n  t& i" K8 j% V(defun _autoqload (quoi app cmdliste / qapp symnam)* A8 s- P! k) X$ q
  (setq qapp (strcat "\"" app "\""))- o7 R0 u; S) I& L# [
  (setq initstring "\nInitializing...")& h9 j# q" P( X0 r
  (mapcar+ f' F$ {8 d4 q' c) H, r
   '(lambda (cmd / nom_cmd)! ?/ h6 _; M) T+ a
      (progn9 ^; @! _8 _5 d, N# X; V  {
        (setq nom_cmd (strcat "C:" cmd))% _! M- G4 L. \" D+ x: V  \2 @$ |
        (if (not (eval (read nom_cmd)))
7 Y+ e" b7 Q, X# {: L) x            (eval2 Z- }4 z& n8 |- j2 j4 Q
             (read (strcat& p) L7 T% E3 i) L
                    "(defun " nom_cmd "( / rtn)"
9 S3 y8 \& {+ l) P0 u                    "(setq m:err *error* *error* *merrmsg*)"3 K/ c% z8 g- g/ t4 q
                    "(if (ai_ffile " qapp ")"* O8 e  R' [# e/ h* d
                    "(progn (princ initstring)"
  a/ l  [& W' r2 Z# l- L% r                    "(_auto" quoi "load " qapp ") (setq rtn (" nom_cmd ")))"* |" |4 T) c3 Q
                    "(ai_nofile " qapp "))"4 g7 C: U$ v0 S" n
                    "(setq *error* m:err m:err nil)") k; C1 Z, Q3 E: ?
                    "rtn)"
) k4 k5 k! C8 B  q7 N3 `                    ))))))
, Z' [% w9 j  L. J   cmdliste)
0 x; F3 ~, o+ M! R/ F4 D, m  nil+ t& l: k5 U$ a' V  |
)( {. z& p, h1 Y3 d$ g

& A1 w3 F# v% G5 i! D(defun autoload (app cmdliste)
" y; n) V* z* d, D$ M4 F2 r  (_autoqload "" app cmdliste)
1 `) j, y# b# |% \0 ]9 o)( ~& o% U+ g' L# p" X3 T- l

6 f: r0 h3 R; e. M! t; _; W(defun autoarxload (app cmdliste)" Q; E: D& l6 t
  (_autoqload "arx" app cmdliste): k( y: [; B1 d+ H
): ]/ E/ ~6 H+ @( S3 V# \
2 y% q  [1 Z6 `) \) Y$ V& [" I
(defun autoarxacedload (app cmdliste / qapp symnam)+ f$ \+ y- q# ^( T9 ]' j
  (setq qapp (strcat "\"" app "\""))# Y0 H- a8 V+ T# B% B" [/ `
  (setq initstring "\nInitializing...")& @7 R. L' n0 ]
  (mapcar
' I  H& Y- W2 @  W) z- W4 n' }# F1 Q" u   '(lambda (cmd / nom_cmd)6 m3 a5 p1 F# v( m* X, k8 v$ V* O
      (progn
" ~) u$ Q2 m1 h! ^        (setq nom_cmd (strcat "C:" cmd))
4 G5 f7 v) N4 Y8 q% x( u9 ]        (if (not (eval (read nom_cmd)))
1 s2 I7 R4 C7 b0 ^: a) [# h$ T. Z            (eval" B$ R0 C' r' }% N
             (read (strcat1 s! e* T3 ?0 Q+ {/ u/ h  o3 K
                    "(defun " nom_cmd "( / oldcmdecho)"1 Z8 \$ j: t9 r0 l
                    "(setq m:err *error* *error* *merrmsg*)"
  q% ~; G# ^: l- G. _                    "(if (ai_ffile " qapp ")"
$ o. ~; }/ n6 U                    "(progn (princ initstring)"% Q2 z* w2 N$ z3 h+ W
                    "(_autoarxload " qapp ")"& V" N0 p( N/ F" ^
                    "(setq oldcmdecho (getvar \"CMDECHO\"))". C* n9 R# t! b
                    "(setvar \"CMDECHO\" 0)"
: f( G7 M7 f( s" y                    "(command " "\"_" cmd "\"" ")"1 N" T; x0 R1 ?1 Q+ T- w
                    "(setvar \"CMDECHO\" oldcmdecho))"
$ z& \$ g4 B  c9 I- R6 {, C                    "(ai_nofile " qapp "))"
; d3 t" F  w4 M' d0 O                    "(setq *error* m:err m:err nil)"" @' L1 B' O8 Y6 f
                    "(princ))") z+ P. f  F+ }( q
                    ))))))
6 P! M/ P4 v* ]" U# L6 U   cmdliste)
# ^! T1 _% r0 F# [0 N  nil$ F7 q+ D  y" j* D% n
)
: B* O3 Y. k8 O- `$ ~* a7 K: m5 K. j, B8 n6 e7 `; x) Y
(defun _autoload (app)5 r. s8 K2 g* G6 P2 w
; (princ "Autoload ") (princ app) (princ ")") (terpri)" o, t8 F! d1 _1 `8 @
  (load app)
& g) T7 ?; e1 ]: k9 b' u( C)3 J5 ?! V9 j! N+ U; v8 [
% e" t" u4 U% h5 z4 F& G7 ?  w5 S
(defun _autoarxload (app)
2 R  b+ ^3 e2 W4 ^5 K( C5 F/ d; (princ "Autoarxload ") (princ app) (princ ")") (terpri)
7 f. E7 o$ b: _7 N1 _9 @. u. X. `  (arxload app)
6 o. Y: e( e1 E$ E' u), @* r5 q! `# I/ W- p% s

7 v- L+ H, g/ B( J; h! o' A(defun ai_ffile (app)5 C2 ]% O- c6 E
  (or (findfile (strcat app ".lsp"))- M2 T3 P$ t2 V  i% j0 u
      (findfile (strcat app ".exp"))5 g! _0 M& q5 P# \( ?) M" E2 d
      (findfile (strcat app ".exe")); e4 [' M7 o9 L3 ~( E6 h0 c
      (findfile (strcat app ".arx"))4 S) A' ~4 p* S1 q/ j  M
      (findfile app)
, `; p- o! C! j3 d" ]4 k  )
8 Q2 l9 F; W8 d* P! d)
7 g1 R( T8 a& D9 K( L1 Q6 J4 K# o7 a# E
(defun ai_nofile (filename)
; J, `3 w. T6 Y* u) ?5 @  (princ) d* ^: Q9 T' Z9 T; T4 W
    (strcat "\nThe file "6 r6 G. J$ c- |# h; ~
            filename
: d. ]& I- x" t1 T* {            "(.lsp/.exe/.arx) was not found in your search path folders."
1 R/ _3 m6 _1 l+ T: d! @    )
9 A* }  G$ K/ q* R4 _) z  )) @" o2 }  y  z* s5 \% e2 t
  (princ "\nCheck the installation of the support files and try again.")# B) v8 B" F' b
  (princ)
# F! Z- B( i9 G! q: c)8 ?% G8 K) v! T" h7 C2 {& B0 L$ ^
- a, u0 b; [/ i% k. c- X3 z$ Y8 q7 N

, n0 n' ?: q: |( u4 S- i& q* j. M;;;===== AutoLoad LISP Applications =====' w7 \% }5 X9 u  @
;  Set help for those apps with a command line interface- P+ D( X) @5 G$ _8 B! A8 k. V
1 v" H. j( J1 E' s* ]$ M7 a% r
(autoload "edge"  '("edge"))
  F+ \) C  r. r! ~% V2 o% R2 k(setfunhelp "C:edge" "" "edge")% N7 W3 F, }* F, ^# C" s" n

9 s1 V8 Q4 W+ _( o' E- b8 j- [(autoload "filter" '("filter " "filter"))0 n- n3 M$ m& V3 C
' a8 m8 w( j" M. j7 Y" V- J& i: j
(autoload "3d" '("3d" "3d" "ai_box" "ai_pyramid" "ai_wedge" "ai_dome"5 n4 }/ g" j! ~1 \. s1 T5 _- s) D
                 "ai_mesh" "ai_sphere" "ai_cone" "ai_torus" "ai_dish")
* s4 t0 p- t/ ]7 m7 o( ^3 s)
& c0 T3 ?+ w7 h9 V4 r/ |( L7 Y' X(setfunhelp "C:3d" "" "3d")
5 R$ t9 @" {8 J- j5 N6 ?(setfunhelp "C:ai_box" "" "3d_box")
" p: C4 h+ c, u(setfunhelp "C:ai_pyramid" "" "3d_pyramid"), ?  ~+ G: F% z3 K0 `
(setfunhelp "C:ai__wedge" "" "3d_wedge")
  y' N9 o$ u  X% Z/ a(setfunhelp "C:ai_dome" "" "3d_dome")
: ^, P8 g& x7 v(setfunhelp "C:ai_mesh" "" "3d_mesh")- r9 B9 ], P- T" }* i
(setfunhelp "C:ai_sphere" "" "3d_sphere")
8 a; _# i- j) T% ]( m6 o3 C(setfunhelp "C:ai_cone" "" "3d_cone")
9 F! v6 q( I' {% R- i7 T(setfunhelp "C:ai_torus" "" "3d_torus")( p/ B  ~6 D) P" `
(setfunhelp "C:ai_dish" "" "3d_dish"): b+ L. g+ O8 j8 V* @( G: G& t

! N/ w. K/ X- }: X6 R, C(autoload "3darray" '("3darray"))
) {7 m6 b; w' m8 s- y(setfunhelp "C:3darray" "" "3darray")( G# `* C7 U+ c7 |% U! ?1 s5 b$ u

0 ~& {( H/ J& H/ E(autoload "ddvpoint" '("ddvpoint")). y) K$ [; e! S/ m- y0 C6 q9 Z
. A  V) c: t) h; [
(autoload "mvsetup" '("mvsetup"))/ ]- r/ f2 s1 i, s) P0 `0 C
(setfunhelp "C:mvsetup" "" "mvsetup")
, m) u+ r3 L% q2 ^: B" i( p9 `4 N* Z+ W
(autoload "ddptype" '("ddptype"))$ U! ?/ e/ \( a! l' M4 \9 g* S
7 V5 t2 s" E6 g$ s
(autoload "attredef" '("attredef"))" p' H8 ]8 a6 T9 C% w
(setfunhelp "C:attredef" "" "attredef")' i* q. `, u: q' }
4 `3 [4 `% @8 C* g8 ]8 `
(autoload "xplode" '("xp" "xplode"))
+ s7 l( w1 N9 H: f$ t( H(setfunhelp "C:xplode" "" "xplode")0 q; f+ U8 t; b0 k: l: o% K
5 B% l" ^$ U, L3 q
(autoload "tutorial" '("tutdemo" "tutclear"
; U2 `/ W- L: P& Q1 d                                       "tutdemo"
+ W. l9 u3 G# o, [4 {                                       "tutclear"))+ }! ?0 i$ t7 v7 ^
" d3 A+ |  {5 I7 q
;;;===== AutoArxLoad Arx Applications =====) ]# q4 V, V2 h! x) J0 E3 J

1 T# C2 p4 [9 i' ]8 l& ?$ a0 w8 E(autoarxload "geomcal" '("cal" "cal"))8 h# M# X1 u* m! x4 o/ m( V; ^9 v  ]

7 a$ u% {' M' @7 l(autoarxload "geom3d" '("mirror3d" "rotate3d" "align"
  o* G5 u# h8 r2 _                      "mirror3d" "rotate3d" ' d, d1 z5 n; ^) l, i# q
                                 "align"))7 u, O0 k- K0 K/ }& z+ x, X3 d
4 K' C* X% x; W' a% u; q) e4 b4 x
5 Q& Z' t. z# {* h& K7 Y
;;; ===== Double byte character handling functions =====
' I. y$ T. I; `( ?" T) c% i, d4 _; ]. X" A
(defun is_lead_byte(code); z3 _0 o6 ?9 ?  D  {, V
    (setq asia_cd (getvar "dwgcodepage"))
- N& `( y, ^* S# M9 z/ u# c6 S0 ^    (cond/ \0 B9 [6 p1 F2 S5 L
        ( (or (= asia_cd "dos932")
  y. R. L* t* K# V0 U! U* l! M              (= asia_cd "ANSI_932")
- E' _6 S0 L3 Z          )
6 c$ M$ l) [' O' e/ t: H  G4 H          (or (and (<= 129 code) (<= code 159))
% M5 A- G) t5 L. V+ @  _              (and (<= 224 code) (<= code 252))& u( {, P! q* V1 o
          )
8 A( `0 L( I7 i4 P: T9 J/ ?- b0 C        )  h# S% H) ]* g4 g6 l* u
        ( (or (= asia_cd "big5")' f- _5 O4 d$ Q+ X; o$ ]' {
              (= asia_cd "ANSI_950")% m% M0 N& j: a; v% M. s  k9 c
          )
2 s; Y% Q& n3 B4 e# t1 t4 D4 Z4 E( J          (and (<= 129 code) (<= code 254))
$ D9 R/ m4 Q$ V. U# t# X7 ~' `        )
4 o) z" k7 S4 z# }( p        ( (or (= asia_cd "gb2312")9 ?. C0 L& D( Q5 J3 u
              (= asia_cd "ANSI_936")
, q5 }8 \+ U. \          )2 T. V$ g5 ]" p2 r$ A( E" h
          (and (<= 161 code) (<= code 254))0 p' s4 M1 u$ l0 i
        )
) v: f# B$ O9 I" p1 v6 \        ( (or (= asia_cd "johab")# {, K& o8 c* Y
              (= asia_cd "ANSI_1361")
5 r' q! _( @. ]5 c  P/ u          )
4 J5 p7 U9 y( a          (and (<= 132 code) (<= code 211))
" s2 J% u, L& w# `        )0 B7 P4 M+ S1 W5 f
        ( (or (= asia_cd "ksc5601")0 h. _5 |0 g* z$ c- c* a+ D
              (= asia_cd "ANSI_949")
4 I' M+ M/ g* l/ e& L" \: j! p          )
6 g0 e6 d% g2 }1 j* j          (and (<= 129 code) (<= code 254))
  N1 y6 z1 K" E  F        )4 P. E' I  J  N7 @0 ?8 r
    )
. l! d9 |$ q+ B4 y% m# h# y)
3 z. F' E4 N; ^9 M  b$ ]9 ^" o2 ^' e+ Z- ~$ M: S& g3 N" \/ q
;;; ====================================================) A# Q: P! W& b5 i

, I2 K; ~/ a( K; v9 Z. s9 z: i
& k' }& S1 P, @1 }3 D0 M/ G- N;;;
, x  V0 y% f" v' q;;;  FITSTR2LEN
' ~) P$ G2 a: W/ B* T, C% E;;;4 H* b; w8 @% F5 e" o
;;;  Truncates the given string to the given length. ! t3 {" Z4 [* i# g4 I
;;;  This function should be used to fit symbol table names, that3 p! L7 y2 C# B
;;;  may turn into \U+ sequences into a given size to be displayed
2 K. v! h6 ^. N6 E) H2 i;;;  inside a dialog box.9 R7 a) p2 l# o5 i3 P! [% r2 d0 I  g, \
;;;
. j& Q0 Y7 c3 }5 {/ N;;;  Ex: the following string:
0 L+ r0 B) I4 n8 x4 |2 c$ e6 m;;;/ j9 [( s' x' m9 p( ?7 d
;;;      "This is a long string that will not fit into a 32 character static text box."
* [8 t% {0 p- ~3 t;;;; r: N+ ^  B; C# @
;;;      would display as a 32 character long string as follows:
* B! F+ m5 ]  a;;;
  N5 j7 K5 `, j' Z;;;      "This is a long...tatic text box."
& `: @+ m3 g  i) w# L; q3 Q;;;, n1 f& L/ g* Y5 J9 }8 J' s. a4 @

0 I% n. Q; H; I(defun fitstr2len (str1 maxlen)
0 r) X$ [  B: s3 r6 F8 d
& g$ {; a5 m0 x; V4 ]3 ?9 p0 e    ;;; initialize internals
; X& A: \9 B! r+ V% v    (setq tmpstr str1)% Z, i2 {% g5 ?, s( T
    (setq len (strlen tmpstr))! y) X2 D- Z5 t5 W/ `) B1 W
* o& n- T7 E. [+ ^* l; k4 _& r
    (if (> len maxlen) - A8 ^5 ~' P! _+ O6 o! V- k3 w6 g0 `5 V2 x
         (progn
7 G+ H2 _2 K! [3 b$ X& O" O8 x            (setq maxlen2 (/ maxlen 2)). Z) Y7 Q; J7 N. A
            (if (> maxlen (* maxlen2 2))
3 I/ v6 c+ P0 g* f/ b( L                 (setq maxlen2 (- maxlen2 1))
1 n  }% h: E4 n            )& s6 E1 F7 i$ \6 e
            (if (is_lead_byte (substr tmpstr (- maxlen2 2) 1)). {! }5 W% y1 S3 r9 V
                 (setq tmpstr1 (substr tmpstr 1 (- maxlen2 3)))
6 J  Z! I1 D, i! [6 X                 (setq tmpstr1 (substr tmpstr 1 (- maxlen2 2)))$ P+ }2 n) j6 t5 F
            )3 v% z1 E( E) c/ {
            (if (is_lead_byte (substr tmpstr (- len (- maxlen2 1)) 1))1 z' t) J& E' l, U: R; M5 D/ f1 s
                 (setq tmpstr2 (substr tmpstr (- len (- maxlen2 3))))
! Q8 I+ w% s1 s                 (setq tmpstr2 (substr tmpstr (- len (- maxlen2 2)))), W7 c3 }1 [+ t% E' m- B
            )* h# A/ {6 `, D, q& l/ I
            (setq str2 (strcat tmpstr1 "..." tmpstr2))
# a0 Q" Y) w; |# h- @6 T         ) ;;; progn
5 S8 f& \$ B- F1 O: g( x. @' M+ t         (setq str2 (strcat tmpstr))
- l/ G0 E& ~4 b, b$ i4 ^    ) ;;; if
5 g( O* J3 P! C3 B& s$ \/ _) ;;; defun- w7 A) J* a- \# q8 Z- n7 \& C
. z3 E: |- b  {
; Y$ p1 c( t0 ]2 `# y( L
;;;/ e: Z$ ~3 Z7 H0 d) Y: H/ L7 ^
;;;  If the first object in a selection set has an attached URL
1 F# W# p" m7 ~2 m* H$ O" i;;;  Then launch browser and point to the URL.
( y" [8 p  Y! F! k;;;  Called by the Grips Cursor Menu
+ b( p' C% T1 Q6 {;;;
) p) A$ h* v) ~( G
# F. H' [! J2 m, c( G% g(defun C:gotourl ( / ssurl url i)) W, G) ^$ Y# ?: U3 W7 A1 R+ o
   (setq m:err *error* *error* *merrmsg* i 0). q/ ]/ d: B0 ]( p
2 t7 H0 e6 h& m" v: [7 l5 C
; if some objects are not already pickfirst selected,
5 J6 H# h# O' e0 n: K4 r, F; then allow objects to be selected
& g1 {6 b% k( r* f- C7 Q6 M9 \2 e2 g' H0 B0 l! N; E! X0 a; ], l
  (if (not (setq ssurl (ssget "_I")))
* F2 ]: I* |6 F# Y      (setq ssurl (ssget)). U) U7 U* Z* R( a" X* ?! R# O
  )
1 |4 `! N9 @; ~! z% H* |
2 r/ e7 X4 [) v  [; if geturl LISP command not found then load arx application
# E$ o( i0 W2 C( G) r0 e
5 K" b9 P7 C9 i# j( z0 b  (if (/= (type geturl) 'EXRXSUBR)
) {; {" h7 |) [3 G: x. `  e6 `    (arxload "dwfout")! B5 v3 u+ U' z5 Y; v2 a$ A4 G
  )
. o! m3 ?, n8 Y. l, Q  X" w9 g
0 l/ o; `9 n" k7 c4 U1 G/ J# |& |  N;  Search list for first object with an URL
! W3 X) Z8 P3 n2 [2 W0 L" K  t1 Z  (while (and (= url nil) (< i (sslength ssurl)))
  Z2 f% M- G6 f, ^  _/ h    (setq url (geturl (ssname ssurl i))# d  Y  U# C: v
          i (1+ i))
% }, _2 x+ ~- \' ]  )
4 k. A8 ~; x- Y" a% h/ _
8 c& L; Y; _: e5 C; If an URL has be found, open browser and point to URL: S6 Q1 L& ~$ V% _
  (if (= url nil)
: {; p2 I- T2 n* y" b! X; ~    (alert "No Universal Resource Locator associated with the object.")
4 w- H0 T% {. N  `+ T; R- P    (command "_.browser" url), \! n! Z  S  N# X- N
  )
5 I. u3 {- ]+ N) M% F2 l3 [8 W8 w7 N5 z
  (setq *error* m:err m:err nil)
$ m2 a3 c6 K% r; {5 y, Z1 P  (princ)( b4 {8 \( M" r, n+ {" p
* V6 w5 \; T- b: Q, M5 Q
)
8 j. h" j- W5 M7 u. k6 g
+ C* E) y* T4 I  m, {1 _;; Used by the import dialog to silently load a 3ds file
- l  ?5 E( V# t/ [4 L(defun import3ds (filename / filedia_old render)
) U0 M. j3 F: M8 b; C! K7 U/ {  ;; Load Render if not loaded
$ q  [& Z6 S& }8 c. {/ v3 o5 e  (setq render (findfile "acRender.arx"))
' u4 d- e% G6 l: O. l  (if render
7 |/ a; b8 w- ^) C# g7 L" s- k    (verify_arxapp_loaded render)
0 f6 P0 A* V0 d7 U8 {) c* K    (quit)
& y9 ?7 W( A, `' m  )7 _4 v3 ^9 g* C( C" |8 `" x
1 ~3 ^' R) o5 s& r# e
  ;; Save current filedia & cmdecho setting.) S: C2 p7 `9 k
  (setq filedia-save (getvar "FILEDIA"))
2 j4 C! V/ r- h! K/ c  (setq cmdecho-save (getvar "CMDECHO"))+ \5 M$ s2 Z) ?/ |' u& K6 K
  (setvar "FILEDIA" 0)
8 a( _; Q- u" [& m  (setvar "CMDECHO" 0); W! C' J: N) T* L+ P
7 h, ]  _9 Z" t4 ?$ E2 ~
  ;; Call 3DSIN and pass in filename.& t1 [5 E' k5 z6 `8 K% g4 [  U
  (c:3dsin 1 filename)
: b/ E% @) k9 N; B0 E
; n8 j3 L  P+ O  j" y, j0 b; F  ;; Reset filedia & cmdecho
, g6 A, z/ [/ M; V  (setvar "FILEDIA" filedia-save)
4 p$ \1 z  D5 \  Z. D  (setvar "CMDECHO" cmdecho-save)) n+ k( N; m: l
  (princ)
" C9 n* V* G2 z)
1 N; z5 [* i7 V& e, [) o* Y! h) }; @
/ l. f+ y# D+ q5 _' ~2 M' k
;;;=== Menu Functions ======================================
( n7 h/ T; n- i; r- d( V
1 g0 Y9 E; ?! F* [6 W(defun ai_rootmenus ()
1 |0 z! _$ C' d" F# I  (setq T_MENU 0)
! S- D& ]; @/ W9 z1 M3 x2 ^: k+ n  (menucmd "S=S")/ D7 ^5 o, z$ [5 ~
  (menucmd "S=ACAD.S")( M9 D" m/ g' O
  (princ)/ {/ V9 U  @+ h8 q; v6 i7 U
)
* I& x$ Z5 K8 k- w: j# C- x$ J
: g7 e6 s# U5 P5 C(defun c:ai_fms ( / fmsa fmsb)
) K0 H$ w+ a" d  M  (setq m:err *error* *error* *merr*); C. Q5 |8 y% W% f# A8 N4 N
  (ai_undo_push)
; A, p. H2 v2 ?6 `, r) h  (if (getvar "TILEMODE") (setvar "TILEMODE" 0))$ m: Q. o- t0 B# r$ U
  (setq fmsa (vports) fmsb (nth 0 fmsa))' G+ E' ]: ]$ X# R  p" o8 Q
  (if (member 1 fmsb)
. c% _) J7 G9 f( q- r5 p    (if (> (length fmsa) 1)( b, Z8 s+ ?5 M: k% j: w
      (command "_.mspace")0 c7 y0 n0 `- C: \9 O  ?3 |8 f* I3 C
      (progn; f' i" e& b+ r. B
        (ai_sysvar '("cmdecho" . 1))
1 e4 W: f  c9 I        (command "_.mview")
/ f$ a& w; i1 `6 l        (while (eq 1 (logand 1 (getvar "CMDACTIVE")))! `' s7 G. x7 O, {) D* ~1 `
          (command pause)+ V7 U% V  s- g! Z7 v) K
        )2 r# ^! G8 b2 w$ T" j
        (ai_sysvar NIL)/ {" b- t; f0 z" z' {/ W- D5 l! S% ]
        (command "_.mspace")
0 f1 X. @7 }" n" n: S      )
8 o# _1 T1 W2 ~& c& x    )9 Q# S8 r9 B( x  a' W
  )
; e3 ]% S/ `4 c6 r% j; C  (ai_undo_pop)
+ E1 R' B- L9 z3 }7 P% n7 e  (setq *error* m:err m:err nil)
2 L  H# v& K4 @' \- z  (princ)
9 u1 G9 v, v: J$ y)5 o( i3 l# T6 O- J

3 M+ A7 ?7 b8 b: M(defun ai_onoff (var)) ~3 w- v% r  @4 x9 v. U8 b- J8 P, m
  (setvar var (abs (1- (getvar var))))* s7 b! l( f' v, E* F* ^
  (princ)5 O, _+ {9 g5 Z( C$ k- L8 s9 r
)
' k' T* u1 Y) a( P( W) ]2 i
% a& E2 Z4 k1 o# {" u. @;;; go to paper space" b, r: V6 O1 j% }& ~1 o6 {
(defun c:ai_pspace ()
$ f- o8 Q2 Q6 l  (ai_undo_push)
/ m$ Y( H- R% E9 O% e  (if (/= 0 (getvar "tilemode"))2 N7 J9 V* O  L8 N, k: ?$ B
    (command "_.tilemode" 0)
: L( q7 Y9 {1 j7 A! @! c# G  )
$ l6 ]$ X/ }% B2 j. Q* E  (if (/= 1 (getvar "cvport"))+ [" g1 J: V! e' p- d
    (command "_.pspace")
6 _( h8 x1 H" Q4 B% ?; J+ S  )
; |: y+ p9 [& m% l+ |5 V/ e  (ai_undo_pop)
! l9 C5 n6 s% p) M* |  U  (princ)
  A/ Q' Q" j/ F) J)& O; \% I; q5 o' R  x

, t/ W+ d1 }0 V+ X;;; go to tilemode 1
* O2 h+ k' W' u& h# c/ n- D" }& M(defun c:ai_tilemode1 ()
7 {9 H* Z) e( V( k0 ^9 C/ z, E  (ai_undo_push)  s: X" ^$ \' b: Z) B
  (if (/= 1 (getvar "tilemode"))8 _9 M) g: }0 d/ r7 f, @
    (command "_.tilemode" 1)( O& X4 L0 n7 e4 [6 S, Z  x" [
  )7 Y: W% i3 l9 W1 M9 P
  (ai_undo_pop)
" ]. r# @7 L8 h2 E  (princ)+ V5 f1 T2 h( |8 \9 I
)# a1 A9 a1 }- E% t/ R, e
" A/ x  F; c4 g$ d
;;; Pop menu Draw/ Dim/ Align Text/ Centered6 k* ]$ B+ x9 E  U6 D! I
;;; Toolbar Dimensions/ Align Text/ Centered! W! M! S. v* W+ X& C8 |
" j3 ~% P9 a" K* Y  i/ O; E
(defun ai_dim_cen (/ ai_sysvar ai_dim_ss)
+ o2 Y* R& [3 @) q  (setq ai_sysvar (getvar "cmdecho")), `8 b: m8 H+ _5 _; ]8 m4 ^4 Z
  (setvar "cmdecho" 0)
9 S+ d# p9 P+ H3 n1 N3 Q5 G  (cond" E8 N4 Y1 t% _4 h
    ((setq ai_dim_ss (ssget  "_P" '((0 . "DIMENSION"))))4 t+ R$ ?9 R: `; w6 }
      (command "_.dimoverride" "_dimjust" 0 "" ai_dim_ss ""
- ?! m/ s& h" B* F- g4 c               "_.dimtedit" ai_dim_ss "_h")) a# c' e' ^+ D0 d! e
    )
4 n- d. ?1 @4 w. z0 x    (T nil)& K9 ?1 {0 f9 }5 i7 F$ \; B
  )9 V& v! x; Z3 {- Z( I! s2 i9 E, A$ W
  (setvar "cmdecho" ai_sysvar)
2 e$ L) n- ?4 d0 L, P  (princ)
/ w# o5 I! X! }; L# U* w# l& W: H4 g1 L)
  W9 J5 q6 }" R
3 P( a  z4 x6 W3 K;;; Shortcut menu for Dimension Text Above ( C2 S0 e4 w( V  T# n0 B

% F4 T/ L" G+ {, q, l' d) U(defun c:ai_dim_textabove (/ ss)
. J, q/ I* d1 f/ b5 N* U7 |  (ai_sysvar '("cmdecho" . 0))) r1 ~$ f" {4 R$ U. k5 u
  (if (setq ss (ssget "_I"))
9 f% a. d' g. G2 U5 R9 B+ X& O8 F3 l3 T    (command "_.dimoverride" "_dimtad" 3 "" ss "")
, Y4 ~1 g% {4 l5 c8 x    (if (setq ss (ssget))1 O7 C* p+ [8 F0 k! X  ~
      (command "_.dimoverride" "_dimtad" 3 "" ss "") . N$ C# d' T# S0 _
    )
4 ]" P8 d+ d/ I7 Q( v% S6 p: \  )
: p6 w" ]" P2 e6 G& p" F  (ai_sysvar NIL)& E: z4 ]% c& l# o. J. S8 |1 F
  (princ)
/ n7 t# r* ]  r# _4 Z+ n)- L. [( e" [$ D( \
/ `+ {! s" q+ Q; k6 Y
;;; Shortcut menu for Dimension Text Center ! T9 N! D8 k4 v& i$ M) b2 U2 K8 e

6 O5 v) v! j! j; n8 u6 |4 f(defun c:ai_dim_textcenter (/ ss)
: q8 w$ }( l7 e: x5 i9 M  (ai_sysvar '("cmdecho" . 0))
7 O$ d( n( u4 `3 k2 @! G  (if (setq ss (ssget "_I"))$ ?5 F, X: K- h
    (command "_.dimoverride" "_dimtad" 0 "" ss "")4 r$ P( b1 H0 g% |2 A% O
    (if (setq ss (ssget))
- I$ f( o; j  c: Q& R  }      (command "_.dimoverride" "_dimtad" 0 "" ss "") . m8 |& l4 m- e; w2 c# y3 ^
    )4 x, y4 |8 n4 j' R# Y  ^( [& g
  )
! W: A* C, Z4 W& H) _  (ai_sysvar NIL)
+ ?) s! ?; {" y* a  (princ)
9 J& I! X# q+ v: {, H)# z  R. r# p2 @  M) O# c2 N! |2 B5 \
. @1 J% D5 [$ I# S& P
;;; Shortcut menu for Dimension Text Home 5 ]8 F+ J4 s# X: c

# H; }; \( G% S2 W7 K2 K! L(defun c:ai_dim_texthome (/ ss)
' a" C7 v7 e# C  (ai_sysvar '("cmdecho" . 0))* E3 V' ]) e& Y1 B* d
  (if (setq ss (ssget "_I"))! h3 a) O: S1 a  R$ i" l
    (command "_.dimedit" "_h")& p/ Q' r: ]) I3 {8 c% H
    (if (setq ss (ssget))
, z; p' P, v. X% ?4 t      (command "_.dimedit" "_h" ss)
# j" ]( z: f0 o, y: E) Y* L    )
6 y: I1 x7 w1 [0 M+ w2 l# U8 h" H. O  )
$ M) z6 G% y; x  (ai_sysvar NIL)0 d# o$ k: o8 G5 ~
  (princ)5 I- u* s5 o+ k: D& \. G
)  k9 _! s, r% n+ y
/ t5 S9 O4 l$ q# F$ O4 R

( m9 d4 f* P. I! @$ ~& b' _/ s;;; Screen menu item for CIRCLE TaTaTan option.  [- {( C# `* e$ @( V' ^
;;;     first, get points on entities
; h& w+ i, z+ B(defun ai_circtanstart()
5 e( ^: u" }5 f4 T' M   (setq m:err *error* *error* *merr*)
! w. R6 S# |# U2 U9 J* z. Q   (ai_sysvar
" p: b' D- q6 q6 [1 ]+ s% E      (list '("cmdecho" . 0)$ \4 K1 m7 X: W, R3 }/ K- }7 X
         ;; make sure _tan pick for CIRCLE gets same entity
4 l: W- ]" k0 n) o         (cons "aperture"  (getvar "pickbox"))
+ H( ^+ e9 s- @) z* P          )
7 a2 `$ X1 I8 ]9 K. e   )
, ^2 j; V2 S& D- J1 W) e' t8 b: g   ;; prompts are the same as CIRCLE/TTR command option
. G5 M# y+ \( e. Y   (setq pt1 (ai_entsnap "\nEnter Tangent spec: "  nil))$ K2 L7 A: G5 t
   (setq pt2 (ai_entsnap "\nEnter second Tangent spec: " nil))
' a; w4 H3 n2 d0 E3 D   (setq pt3 (ai_entsnap "\nEnter third Tangent spec: "  nil))
- I2 Z/ y6 d2 n! B)
" y4 _& {7 A. ^0 g/ k, i$ T4 L;;; Command-line version
4 ~1 E* j% \: c. a, j) b9 i(defun c:ai_circtan (/ pt1 pt2 pt3)+ B2 _7 @6 k: L; m  X1 D
   (ai_circtanstart)
# |% s! V2 q* ]1 u( G( c6 A* b: B$ E
   (ai_sysvar '("osmode" . 256))6 |4 u# p4 {1 ~
   (command "_.circle" "_3p" "_tan" pt1 "_tan" pt2 "_tan" pt3)) K4 ?! X" G3 p5 x+ g$ Q4 h# W

; t0 L' m# l  N% W& R0 Z   (ai_sysvar nil)
' i7 p! L6 {7 {' v! b& ^4 z# E: H6 z   (setq *error* m:err m:err nil)
# b, D9 l) B% M4 S& U& L   (princ)" ]* h- T; ?( V! z1 a5 m: a9 M
)
9 r# u0 i* I$ \! q' C# @/ B& _;;; Use this if CMDNAMES == CIRCLE
! A. C( ]0 A6 ~1 X! m(defun ai_circtan (/ pt1 pt2 pt3)
* i$ w. [, T. z# q8 _6 `   (ai_circtanstart)
, ]. e8 \  u* O! H+ N3 J0 e
$ y* E3 m5 v6 o* h' O. ]   (ai_sysvar '("osmode" . 256))
  u8 P* \! q2 F  f. r) }8 X6 N+ ]   (command "_3p" pt1  pt2  pt3)
9 f, M0 o* H" M, |$ y
& G2 Q/ t( u$ F+ m2 J2 x   (ai_sysvar nil)' ]" j" D+ K4 z" C1 g- b
   (setq *error* m:err m:err nil)
( {. h* D6 B: a0 Z' e/ k# C" A6 Y3 u   (princ)
" S3 _, D$ V+ X" E; _. E)7 G* z; d% Q2 U4 ^: ^& F
9 k. X, p4 v+ s
% o& X/ o0 P+ t, _- e9 T
$ h" I, V% o' S" D4 _$ g/ K1 N
;;; Shortcut menu Deselect All item.& t) `( G0 I0 j1 M' P1 p9 T$ t; D

0 e, G: ?0 N6 V, F" H(defun ai_deselect ()! I  `7 Q: I/ F! A! z; ]* D1 ]
   (if (= (getvar "cmdecho") 0)                        ;start if
# d6 R% Y2 U8 g' T+ R4 V) H- c" w       (command "_.select" "_r" "_all" "")" u3 S! `  S+ @5 ^+ E* R
       (progn                                        ;start progn for cmdecho 1) H; X* u  C: I
           (setvar "cmdecho" 0)9 ^5 v9 A2 q9 I0 ?! P
           (command "_.select" "_r" "_all" "")+ E' W/ g3 `, R' @8 ]6 a) @  b
           (setvar "cmdecho" 1)
6 J, e( H, E8 f, {, Y       )                                        ;end progn for cmdecho 1" d* Y& m6 b* @0 G/ {* T
   )                                                ;end if: [: V( a: J/ L
   (terpri)
1 G' L9 Q" k% ?9 a7 H   (prompt "Everything has been deselected")! j2 E* W1 P- J  C" @: g- o8 Q
   (princ)
8 b. H- _* g4 G' W2 F, W0 s)( R, p% t! r! A% I

( v! k, l; F) l7 u+ D1 ~4 t3 |;;; Command version of ai_deselect to be called from the CUI! f& j' Q+ Y4 ]# O3 c
;;; so it gets properly recorded by the Action Recorder6 [$ @4 q0 t% C  ?5 D
;;;* J" j5 G3 x6 z! N) M
(defun c:ai_deselect ()
  `# g; ~" u  r  (ai_deselect)  V$ q4 F$ P0 z4 ]/ j7 z3 [
  (princ)/ L4 X' ^( k0 O0 @8 o) [- ], U
)& j: D" q# c- J# I: U  Y# e

8 u, u  n- n' p3 P$ r7 X$ t;;;* R! Z7 o' a8 t6 B. F! A/ G! g
;;; Enable Draworder to be called from a menu
( P9 [0 f7 T; Y/ `2 X;;; Checks for Pickfirst selected objects
/ l" {. k5 D) e) l: O;;;( k  R) M( J% _0 K1 t  Q
/ R3 w/ y4 |' H$ ^! ^! D6 x0 H
(defun ai_draworder (option / ss )& ?3 `- Z# n! g; ]( v. C7 O9 Z
; v4 B: x0 P+ `' I
  (setq m:err *error* *error* *merr*)! V0 ]0 u$ ~$ H. d1 o
  (ai_sysvar '("cmdecho" . 0))
  O" v7 f2 H. w! l
# ]6 o. a5 Z; ?) J6 ]5 o4 `4 K  (if (setq ss (ssget "_I"))
4 K! C0 ~6 F, s8 a; Q    (command "_.draworder" option)
0 A2 @% C, ^+ k3 T    (if (setq ss (ssget))
/ |: H2 d4 c- W2 I; a  C- |. i9 P      (command "_.draworder" ss "" option)) A  }  @6 |* A/ Q0 G: ~. l( r
    )
9 ~! G, F/ l# W1 T& z, \" o  )
: _+ X7 `  G4 G5 d  (ai_sysvar NIL): n8 B* u, L- ?
  (setq *error* m:err m:err nil)
2 k& \3 b- Y& P1 x" {5 a. W: n3 K% X3 @& j5 \  O
  (princ)
  P* W* ^. a  m; o8 W- Y)
! _% Q5 F' q- _# n# ~
/ S3 U: [# f/ z7 e' f;;; Command version of ai_draworder to be called from the CUI$ Y5 V& j4 e1 l* r0 D
;;; so it gets properly recorded by the Action Recorder7 F* O9 `; \/ O2 F" j% J8 H
;;;
7 z. u* I) ^4 v3 L: H, M( U- n) L) Y(defun c:ai_draworder ()* S5 L8 P% L( D8 ^) c6 }, L- ?
  (initget "Above Under Front Back")
) T1 P5 T) G* T- s  (ai_draworder (strcat "_" (getkword)))- V  h7 U: V# |- H4 ]
  (princ)' T: h6 b% X" b7 B6 U
)
7 _. M: k" ~4 F8 g4 I# z( R
& ]0 x$ Q% J) q. ^2 i' j# m(defun c:vlisp ()# }- _6 V" }: v0 ~; i" @: ^
  (if (/= nil c:vlide) (c:vlide))
$ W9 I9 s$ Z: n& J1 _8 H5 R)
! K3 E7 O( B' G" G7 @; X( \# [! O1 O3 x5 [( l+ m
(princ "loaded.")
# R% ?6 Q( L1 i& b  Q, w3 \3 b6 V/ T  u# M; I; A
;; Silent load.! C& F7 @, q. c
(princ)
% q4 m( M' s6 B7 ?/ p0 K* _/ O: c- g
: d* K3 J0 _4 v, h) C4 T+ K9 f9 F
, F) g0 m  I% {5 |( H
;;;----------------------------------------------------------------------------4 J% e1 n- _$ @6 {+ e+ S, ?
;;;
( r. w/ F2 w  P3 W" S/ h4 Q. C;;;   DDCHPROP.LSP   Version 0.5! H5 _" v, g: _+ b
;;;
7 ~1 L% }' v! a. S+ e# R& j; F' Z' N;;;   Copyright (C) 1991-1993 by Autodesk, Inc.
0 j! `# i- L% d2 d;;;
; b/ \8 R/ r5 ^1 T7 i;;;   Permission to use, copy, modify, and distribute this software' f) s0 X: X8 X1 [# G. c' U& M3 C
;;;   for any purpose and without fee is hereby granted, provided' m* q- H. F$ C" @2 s& {4 d: A
;;;   that the above copyright notice appears in all copies and that
3 k/ F  j0 c5 L- n) r& I;;;   both that copyright notice and this permission notice appear in1 S9 A. W+ s4 |- s
;;;   all supporting documentation.7 |" r4 B6 P. N
;;;: R1 l0 l. C& ?: p: i
;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
1 o, }2 J: F5 p2 H# r;;;   WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
6 K5 f1 E# a0 [;;;   PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.- v4 `4 i; Q4 N; M; _9 q
;;;
4 f7 |. V2 p. `! y2 T, o; B0 g;;;   2 February 1992
* V. b3 @7 S" }; W;;;   5 r; M* a; f* d' }
;;;----------------------------------------------------------------------------
( Y1 L; f  m+ E" F+ D;;;   DESCRIPTION8 B8 J/ N& z0 l$ ^6 L5 C; K
;;;----------------------------------------------------------------------------
$ [4 Q+ p7 L7 f/ \% {- N;;;   C:DDCHPROP is a dialogue interface for the CHPROP command.
" f* ?2 B3 W2 w2 H' w;;;1 _/ J' [6 l3 h) J: m6 u# F2 ^
;;;   The command looks similar to DDEMODES.  The main dialogue has an image
  U' B% _8 ~" D- ?# F9 N;;;   tile, 3 buttons (layer, color, linetype), and an editbox (thickness).   
1 q% ]) B+ l1 @9 ]" ~: X/ b;;;   The 3 buttons each launch a sub-dialogue containing a list and edit box.  0 l0 E: k, C5 i! R  q4 ]
;;;   The dialogues are all defined in the DDCHPROP.DCL file.
$ a8 O. d! [! S8 J, F, n) r;;;  \* @' P$ |$ M3 y9 [$ }/ i5 z) d- f
;;;4 t5 M7 {# Z. I7 m* b
;;;----------------------------------------------------------------------------
+ t* f7 R% p( S;;;----------------------------------------------------------------------------- ]! B3 z" _2 {3 i" m1 f+ p5 `+ ^
;;;   Prefixes in command and keyword strings:
0 Y8 z( f5 Y9 l0 t1 z: K0 z% p;;;      "."  specifies the built-in AutoCAD command in case it has been        * a6 }$ Z# K* D% A2 F
;;;           redefined.
5 d5 ]9 v: G* T6 `5 F  j7 A;;;      "_"  denotes an AutoCAD command or keyword in the native language
7 W( q( d% t2 b  @) I  i, C/ \;;;           version, English.! N1 X8 d$ i/ }1 W; F
;;;----------------------------------------------------------------------------
7 x0 p6 s; D& H$ `8 H0 I;;;1 w" o! J" F! n9 G5 A
;;;
; _! r; F7 u9 W/ U1 ~9 w1 D! I;;; ===========================================================================
8 Z- G. v, F7 C;;; ===================== load-time error checking ============================7 C- a+ X8 w" m; q- `4 e8 m
;;;" Y1 w  [% E- \4 X
! l- l9 H# W; f. R: J
  (defun ai_abort (app msg)
& {' |) x0 m! H. m# Y! R( B     (defun *error* (s)3 r2 X& i( \  w2 T  P
        (if old_error (setq *error* old_error))
# F! @1 s6 I4 T% G/ w- w        (princ)9 |/ F) F" A% V2 s2 ?1 j0 k
     ): @+ W% V+ m7 T, ^& A3 Z& r
     (if msg2 W( C! U* J$ a' \0 M9 L6 F
       (alert (strcat " Application error: "
- ~: A) I2 f' O/ P7 u                      app, O& k1 r4 n' M% \) s+ r  y$ a0 l
                      " \n\n  "3 P1 N6 F+ U1 q1 v3 J" t0 {
                      msg
! T: Y/ M' B( V6 B) C                      "  \n"$ k% k- N& A: ?  B6 U5 C2 o% h
              )
9 h( w% w: v: C( v       )5 [- u5 d$ r/ _6 {5 b2 e* D
     )& K: f; ]2 W( z& I/ D9 B
     (exit)5 z# L8 @4 m* P4 H0 Q
  )  v) X: O9 \  f$ O7 L3 i4 v, n: }
, [! V" m) E  Q4 G
;;; Check to see if AI_UTILS is loaded, If not, try to find it,# s7 \$ _: O& x' T7 y: X" j' v
;;; and then try to load it.! D& j( L5 q$ m" o
;;;3 K! l$ ^, ^, |2 ~, s8 x6 e
;;; If it can't be found or it can't be loaded, then abort the
+ I& Q4 f0 C3 W. V+ ^* e;;; loading of this file immediately, preserving the (autoload). @2 o3 p6 ?# J6 q5 _$ S
;;; stub function.. U! B0 ~! n, R( y# ]8 j) ^3 Z' C

: [8 f0 a5 w4 T, P  (cond8 W. F; e4 k2 g& W9 \2 {  Y4 e+ Z
     (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.
6 H% A& W) U& B7 g4 t- E$ J. {
6 y# F3 Y, a) _* M0 O4 q     (  (not (findfile "ai_utils.lsp"))                     ; find it
9 \; x' k1 j. T* }+ S" A        (ai_abort "DDCHPROP"
; d4 |6 c; ]- {1 t                  (strcat "Can't locate file AI_UTILS.LSP."1 M* W: [" q2 c
                          "\n Check support directory.")))
- V# b3 o% O/ J7 A* ^
- r% h9 {) l$ f     (  (eq "failed" (load "ai_utils" "failed"))            ; load it
1 D& V. ^2 y! |  {$ b; S3 l        (ai_abort "DDCHPROP" "Can't load file AI_UTILS.LSP"))/ U4 o! W( G/ ~: X0 p6 q
  )# J* [4 U- W. j2 R% O4 ]% N; \% w7 O

2 o( {$ W$ \% z, x' G  (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
7 ]1 y# L5 B8 F$ ^% ]* X4 q$ h- d      (ai_abort "DDCHPROP" nil)        ; a Nil <msg> supresses1 Q/ `* i! y) h2 n8 I
  )                                    ; ai_abort's alert box dialog.' a% {! m4 {' `; M. {

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

  E8 G, J: D& a) e9 B    ;; Page through the selection set.  When a property
, c! P* |4 b6 g2 a5 F, @    ;; does not match, stop checking for that property.
3 W- P% Q* w, Z/ A; j' m1 j8 W    ;; If all properties vary, stop paging.
( b. W9 }% B5 f) G% ]5 Q  v/ A% c( r, `+ ~
    (while (and (> sslen ctr) go)
# T* }* v! A3 d! R# a* x      (setq elist (entget (setq en (ssname selset ctr))))' g# J: w* [- I$ B$ O/ v& |
      (if chk-col (match-col))0 ^$ Y* K5 C2 n7 W$ a
      (if chk-lt (match-lt))
6 o( r, z' D9 \5 ?      (if chk-lay (match-lay))
* d3 r1 E0 y, _0 r7 c      (if chk-th (match-th))
2 X. i( |, j. J) W& ^, _! V      (setq ctr (1+ ctr))* Q7 Z. e/ P: m% g( `- I
      (if (and (not chk-col) (not chk-lt) (not chk-lay) (not chk-th))& m* {3 F! G0 c6 V4 O
        (setq go nil)9 s: J& s5 S6 {
      )- {+ t* c  ^2 B0 e/ T: w
    )
  i6 W, D  V0 i4 w2 b- {    (list color ltype layer thickness)+ f. N& |0 b' [) m2 D
  )+ k+ E$ Q0 {  t. Q
9 k, w2 c- j: O( F' Y
  (defun match-col (/ ncolor)( f) a! M: B2 g& |$ |2 ^
    (setq ncolor (cdr (assoc 62 elist)))+ e* i# N: l: o( y, |0 D- o
    (if (not ncolor) (setq ncolor 256))
' q0 s# {- e6 K, e    (if (/= color ncolor)6 X( f; Y4 E# @- |
      (progn* m$ i+ I/ a1 }( w
        (setq chk-col nil)! x7 E  n5 m; r' E7 |$ [; Q4 w# `
        (setq color nil)
& m- C/ ^; ~7 v  Y1 ?/ X- a2 @% z7 C      )
, n* A2 I$ S6 ^" S& F) Q) e    )
) X- s5 w% t3 k  )
. d7 K% r9 l6 x0 c6 }5 b1 r8 ?
1 F* x: A% c1 A  (defun match-lt (/ nltype), a6 F) u, o+ I4 E; {; [
    (setq nltype (cdr (assoc 6 elist)))7 C) U# g! R: a4 M& w: j
    (if (not nltype) (setq nltype "BYLAYER"))& f. L8 X3 u  I0 E
    (if (/= ltype nltype)
8 A# s: G; x, i" K( X' A) Z& S      (progn+ ]# ^& ~; k4 }: R: N7 w
        (setq chk-lt nil)' J5 c& B) S  ^6 a+ z3 n
        (setq ltype "Varies")$ Y- `$ t; H% A& g% U! Y4 j3 J
      )
: G4 l2 ~* o6 m7 k$ `. k: @    ): O, n% L8 y2 ^" K" M' Y
  )2 `- y- R. F; C+ ?8 d0 r* g: L7 O# v
& r! G$ P- f# j& F# C# o
  (defun match-lay (/ nlayer)8 p8 g7 R8 j. C3 y) k9 _7 n
    (setq nlayer (cdr (assoc 8 elist)))
0 W! ~$ d9 S( B    (if (/= layer nlayer)
! c4 P4 l% l- F/ B      (progn* X- z( ~' p5 }1 g& S4 B3 U
        (setq chk-lay nil)
. J2 a5 q8 V9 p  B        (setq layer "Varies")! k' H# }9 C4 D* u
      )+ ?; J) O: @- v) N' ^
    )8 e3 f" X: T$ u+ g6 b
  )
+ y& o7 W6 I, q  |& P8 |+ H1 w9 R  q1 S/ W. x5 c* k% W
  (defun match-th (/ nthickness)' d' U: R, u) U/ x0 R& j
    (setq nthickness (cdr (assoc 39 elist)))
0 z5 ?8 x+ T3 R    (if (not nthickness) (setq nthickness 0)). H% I& Z+ s* H! l% M- V' v
    (if (/= thickness nthickness)
1 Q6 x( Y, M5 M# g- [. Z# b; W3 }* V      (progn
( u) r2 o% i( \* a# o        (setq chk-th nil). L7 \' C$ z/ G6 U+ ]; i
        (setq thickness "Varies")' l# m# N& ^6 \2 i  W, y
      )
+ v% h: X- P! E% z# Z    )
4 k  N2 n+ K% B7 ]8 s  )1 B4 o! p7 F% k! S/ W$ z
, Z- r0 Y" N0 ?* n
  ;;. s; {0 Z8 v# D' `3 B, {
  ;; If an item is a member of the list, then return its index number, else
" ?6 h( U: c- j5 T$ P. w  ;; return nil.' T$ A- `& f$ N+ j
  ;;' U, j& \# v* f" X
  (defun getindex (item itemlist / m n)! q; M* _  J9 b- i) u: |
    (setq n (length itemlist))3 m( C+ y' e7 j4 |( l! P
    (if (> (setq m (length (member item itemlist))) 0). a5 w8 I' w4 Q* b, x/ M6 ~1 r
        (- n m)9 m3 c" x- {# a0 a
        nil' x2 s% i- R& I; c# T$ Y
    )1 m: S5 d$ e0 T' A
  )
, l9 h" ]' K7 Z* G  Z  ;;
* V) X, ?( O9 H4 m6 q4 h$ h5 X  ;; This function is called if the linetype is set "BYLAYER". It finds the
. y& g1 [( f. B( V3 ^: U* x* h  ;; ltype of the layer so it can be displayed beside the linetype button.% c5 D+ d/ c- i, Q6 w0 Y& z* {
  ;;6 l: P9 l# ]3 x* n+ x! q
  (defun bylayer_lt (/ layname layinfo ltype)3 j) ?$ A2 S, M  o
    (if lay-idx
9 B6 z& J. v) Y9 S+ ?      (progn! \1 Q: \* S; w5 q; G8 ?/ }0 X
        (setq layname (nth lay-idx laynmlst))
6 l5 M1 r( I' U" D! Q; ^  {0 w        (setq layinfo (tblsearch "layer" layname))
- r1 m, _( Z" Q$ k4 H( [        (setq ltype (cdr (assoc 6 layinfo)))
2 S7 ]$ m1 i& s, D        (strcat "BYLAYER (" ltype ")")9 \6 J4 C, v0 {
      )
* b9 q# T& ~( ]7 \      "BYLAYER") C/ a% c8 |/ S! I% ?
    ); ~% K9 O& y% \
  )6 R3 m% N; F  _3 [' b
  ;;. j% `0 p- l( D( v! w  ?4 j  u
  ;; This function is called if the color is set "BYLAYER".  It finds the
, Q6 v" r- G5 I% |3 r  i  ;; color of the layer so it can be displayed  beside the color button.
' [8 D; t/ @: R. \# q& e* y2 @  ;;5 `9 _. O' s- Y
  (defun bylayer_col (/ layname layinfo color)
) j/ b2 g* n& k. W  `& T" K    (if lay-idx
7 Z% @, A% L& J' u2 _" J8 f! T      (progn
1 o/ ~7 l$ X- f& g4 j$ W% `9 {        (setq layname (nth lay-idx laynmlst)); v  W! _9 }1 N# I/ f
        (setq layinfo (tblsearch "layer" layname))
! F2 m8 w" ?& n9 c4 f1 Z3 b# ~1 r        (setq color (abs (cdr (assoc 62 layinfo)))); g. c5 `# n1 E6 U8 a
        (setq cn color)9 ?( \7 k: ]% H
        (strcat "BYLAYER (" (colorname color) ")")( A6 d  x* k. H
      )
' ~. G: H0 y0 R: I& E* F$ X      (progn- b: V5 _" \1 @: d* D3 ?+ |
        (setq cn 0)
4 q% I5 N+ m, U/ d# d7 u; K        "BYLAYER"
2 e1 H0 T9 b- y4 c5 }$ ^+ s      )
6 k4 y3 f2 l5 K( A; A5 m    )
1 i5 d% j, ~1 R+ F5 n  )- V7 i2 V% e- n; U! ]
  ;;
( ~7 w  m1 c9 s  ;; If there is no error message, then close the dialogue
& N0 h$ w$ e* P# Y% G  ;;
% e- _& y! ~$ t6 ~/ u  ;; If there is an error message, then set focus to the tile7 J8 B) K. V$ R$ Y, Q( j) {2 y
  ;; that's associated with the error message.
3 j) o3 {5 o5 Y+ [& r. @' H' Q% n' F& s  ;;0 ?0 H% w8 D* h) K0 C5 F% w" I
  (defun test-ok ( / errtile)
3 S8 f/ ~8 r! I3 m0 Y    (setq errtile (get_tile "error"))
8 a3 E+ l0 m" r9 t3 x% h    (cond7 E& D+ ?0 l2 \: D% m5 R
      (  (= errtile ""); Y* Y0 k! j" J; {6 u! U
         (done_dialog 1))
  k+ b0 o  q/ K3 V- c# T      (  (= errtile "Invalid thickness.")7 E- Y- H8 K  ~; S* |: s* ?
         (mode_tile "eb_thickness" 2))
3 Q! e6 @( `5 \; s4 n( @- Z9 c2 h: D4 o7 F    )
' U5 }1 @8 }  h  ^1 H  )3 D8 x0 T5 \1 y# f7 ?  c) L
  ;;- c7 L. R! e7 P
  ;; A color function used by getlayer.. I. U8 \4 g" Y8 s1 @& u8 R
  ;;
3 Q+ C$ N; h( @) h; E8 O# `" D- E. S8 Z  (defun colorname (colnum)- M; C2 D, S: f0 H# U2 k& w7 _" F
    (setq cn (abs colnum))9 W* H( }. A9 H' `8 e' z
    (cond ((= cn 1) "red")
% h$ f5 I. r7 x. l          ((= cn 2) "yellow")
, I" c, I( x/ ]$ Y! N          ((= cn 3) "green")- }- g' o9 [# v
          ((= cn 4) "cyan")  X- \) q# r) s. r/ Q
          ((= cn 5) "blue"). A' x$ ~3 m2 Q  [8 U6 @- p
          ((= cn 6) "magenta")
0 V, \5 f  Z5 S$ b! D          ((= cn 7) "white")! F- g6 B0 k! ~/ B8 u
          (T (itoa cn))
1 A- @8 V( S) d2 N; `    )
" V  e3 o7 B2 s% A  )4 M6 d& I4 y1 K0 M4 S! q- W- \/ ?+ F

4 [, c) v. }0 `4 t( ^+ H1 E' |" i;;; Construct layer and ltype lists and initialize all; q% m9 y' ^* Y1 G+ o* p# q
;;; program variables:3 ]/ c9 @3 e2 ?" x! F
" Z2 B" I8 k( G  u( Q
  (makelaylists)                     ; layer list - laynmlst
! o8 G9 \$ ^( s( I. S  (makeltlists)                      ; linetype lists - ltnmlst, mdashlist2 r- q  k3 a8 r, R, q- y
  ;; Find the property values of the selection set.7 _) b1 ~6 m$ l+ m. z  b
  ;; (getprops ss) returns a list of properties from
7 a$ [$ T/ ]" n. D; \7 C  ;; a selection set - (color ltype layer thickness).) n" q% Z# T5 ~; v
  (setq proplist (getprops ss)). X8 C, l$ E7 N
  (setq ecolor (car proplist))
0 x) S4 D7 }: V! O' q5 N9 V3 n  (setq eltype (cadr proplist))  y+ R2 K. L1 c& D4 {& d) M
  (setq elayer (caddr proplist))% F' A9 M, w4 s$ b% w
  (setq ethickness (cadddr proplist))
- ?, x: M) B. q; R5 \* A' s  ;; Find index of linetype, and layer lists: u/ s" C9 F0 }+ S. s/ p* ?
  (cond
7 Z% s1 v2 D' W' `2 t7 e4 D    ((= eltype "Varies") (setq lt-idx nil))4 {  h  t9 z) J; M# V7 I6 {
;   ((= eltype "BYLAYER") (setq lt-idx (getindex "BYLAYER" ltnmlst)))
# ?, V; k0 K# X. g3 \;   ((= eltype "BYBLOCK") (setq lt-idx (getindex "BYBLOCK" ltnmlst)))
( b; g# T+ ^8 w1 N, y    (T (setq lt-idx (getindex eltype ltnmlst))), o4 w. R0 V2 ^# v/ |2 H
  ). M9 {* `$ P6 p# y
  (if (= elayer "Varies")% b/ Z5 b1 U; R* b8 Y
      (setq lay-idx nil)( m6 w6 x& E, z
      (setq lay-idx (getindex elayer laynmlst))3 W/ ~3 K) \, |( h! H/ n
  )
  F! ~: ?8 a: `% O0 C/ _  (if (= ethickness "Varies"); E4 j  W0 M# o" N( T
      (setq ethickness nil)* m% w' S% j/ o: I
  )! V) {7 I9 N/ o* a# \. K% l

" [: P8 U& {9 d- r4 ~  e)   ; end (ddchprop_init)
5 O8 Y. }5 s/ Q2 ?: Y1 j2 _% I8 `3 D* G1 B  }2 X# ~
;;; (ddchprop_select)# ?4 u7 Y/ i! O: _
;;;8 X8 @2 q/ O4 r% Z: ^( `- m
;;; Aquires selection set for DDCHPROP, in one of three ways:" O. Z9 n/ C3 b. b  Q
;;;- `! A  v# V- ^4 D( F* @& p, [
;;;   1 - Autoselected.: {' `3 f/ `8 H! Z6 f8 m
;;;   2 - Prompted for.) ?. O0 |) j& d6 t; K+ C
;;;   3 - Passed as an argument in a call to (ddchprop <ss> )
0 M  j8 w4 \% p! q5 p' M;;;0 t* ]% K% |" O# I6 M
;;; The (ddchprop_select) function also sets the value of the
3 z, s8 Y% _; P;;; global symbol AI_SELTYPE to one of the above three values to
2 u1 z% l. a1 o6 x. B4 U0 x3 K;;; indicate the method thru which the entity was aquired.
  T' ~0 Z# m1 i& ^2 E) [$ `
. [3 L# h7 U. G+ O, l$ N3 \9 Q% T& w+ b) q2 h' ?0 d$ M
(defun ddchprop_select ()) V* ?' T3 `, y7 R
   (cond
9 ~1 Q* B2 _( @$ l( X      (  (and ss (eq (type ss) 'pickset))        ; selection set passed to+ B( x' F7 F/ x1 ~. i  R+ Y& u
         (cond                                   ; (ddchprop) as argument
7 q% x" t& X  L7 u6 j! B            (  (not (zerop (sslength ss)))       ;   If not empty, then
) g0 Q  t/ ~! q* M( z1 B! F" b               (setq ai_seltype 3)               ;   then return pickset.
% m. }8 C# ^1 y+ G               (ai_return ss))))
. f* D0 C$ g1 T& F) G* r$ f* ^" J/ T; e+ ^2 n6 H4 e9 a9 J7 ]
      (  (ai_aselect))                          ; Use current selection
* Y! j& }/ Y+ `  @                                                ; set or prompt for objects0 a# V) T- F* e( s

  r7 z" G+ ~0 E; \1 i" o5 j      (t (princ "\nNothing selected.")
( A. W9 K/ s0 V; y; M2 B- J  w         (ai_return nil))7 {! ?  t/ y  Q  E* F1 U- M  j
   )6 m5 N' L: Y. p
)
0 A2 o. W$ A9 H
+ V; \- p; {3 t: T6 t7 T' i;;; Define command function.8 p+ q3 H1 @; j

' V( |% Q! j9 G  P6 t  B(defun C:CH ()5 _  V' q( R8 y' N( h" m
   (ddchprop nil)
- V5 W# U' a/ b; U- _   (princ)
: b0 ^" i  d4 I8 E: c5 s" G)
' i, L6 W0 [. @2 @) K, }6 J1 C* z$ c# N) h" b5 {. ~6 k/ Y

% d1 K5 i( \6 E;;; Main program function - callable as a subroutine.
- m( A: M7 i6 p1 t0 r3 a;;;2 I- [/ s9 x) \4 l. C" S
;;; (ddchprop <pickset> )
4 z) u( z- t0 z;;;9 @6 C1 V1 h' M1 k* D
;;; <pickset> is the selection set of objects to be changed.
! r* V3 N) _( c$ A4 z6 t! ];;;) f- h- P' X  Q' Z8 W3 P
;;; If <pickset> is nil, then the current selection set is
: ~8 q1 C; A: `; G& [( M8 K+ P* r;;; aquired, if one exists.  Otherwise, the user is prompted
5 h; {+ A! }/ M7 P: d; n% r# ~;;; to select the objects to be changed.
8 Z* m; S# T" A7 c# ^! ];;;
- s0 ^, E; p2 w! H- F;;; Before (ddchprop) can be called as a subroutine, it must
% _( U7 m7 `& ?2 A1 M2 V;;; be loaded first.  It is up to the calling application to
: F5 Z" W+ d; j2 n& t;;; first determine this, and load it if necessary.
+ m, S. F- |+ q& `- ^
$ g5 }/ @( V; l: C% \(defun ddchprop (ss  /2 C6 h0 r: b7 m5 e8 b& f8 }
0 o" K5 ~) T  R# C- M
                  add-mdash      ecolor          ltedit_act      s
1 _2 `% L1 d4 P& w: U                  assoclist      elayer          ltidx           selset
, T. a# z$ O( w1 e6 d                  bit-70         elist           ltlist          set_col_tile( `' _) B) n# b$ w. \
                  boxlength      eltype          ltlist1
' e% P: \  P4 [8 ~. J" N3 f* n' u                  bylayer-lt     en              ltlist_act      sortlist
4 f* U+ F/ i0 k( q' p) M                  bylayer_col    ethickness      ltname
" q+ x, E, a% ~( J  [                  bylayer_lt     fchk            ltnmlst         sslen* x! {# V# T7 f4 h
                  call_chp       frozth          ltvalue         templist8 c% b' w. r# W
                  chk-col        getcolor        ltype           temp_color! r' ]+ U) q0 ]5 y$ I( p
                  chk-lay        getindex        m               test-ok
0 y# F* Z$ g$ g6 L                  chk-lt         getlayer        makelaylists    testidx
" L, K) U/ U, z' p3 i4 _                  chk-th         getltype        makeltlists     testlay' L- }5 n. P) R" J2 i0 H2 }
                  cmd            getprops        match-col       th-value6 ^. H: L3 P$ }& m
                  cmdecho        getthickness    match-in        thickness0 [, c- J  H& z" I- D& g1 o
                  cn             globals         match-lay       tile
  ~, ^- S% V6 b/ b                  cnum           go              match-lt        tilemode
2 z5 }+ @1 }! T8 P. X! A: p+ f6 {                  col-idx        index           match-th        tile_rect
% k! m# `6 L! ^- i+ R8 t; P1 n                  colname        item            match_col       vi3 R2 g9 n9 G# G0 _- @( r0 j1 w
                  colnum         item1           mdashlist       vpf
5 N: |/ Q4 ^& ?! y% G                  color          item2           n               vpldata7 Y$ J" M0 g0 T5 F2 p
                  colorname      itemlist        name            vpn! y3 H! r' f, a( ^
                  col_def        lay-idx         ncolor          x% E7 X3 I0 H9 [( L% E
                  col_tile       layedit_act     nlayer          x1
5 r& y- v8 ^# X                  ctr            layer           nltype          x26 d7 @  q* y6 H2 t3 Y4 G7 f
                  cvpname        layinfo         nthickness      xdlist# V1 w+ O, q0 m" M* u
                  dash           laylist         off             y
' J" u" o7 Q& [3 y( A2 [                  dashdata       laylist_act     old-idx         y1
& V. @; \  b! a5 j                  dashlist       layname         olderr          y2$ @0 ^# M+ Y  [; j
                  dashsize       laynmlst        on              undo_init
, r# ~; s$ n; F8 T9 [                  dcl_id         layvalue        onoff
! O& G  ]$ D  i1 M8 ?( m                                 linetype        patlist  s" l: t5 i* D. _6 [! _( }2 K: ?
                  ddchprop-err   list1           pattern
+ D; b# q- i: @+ Q) \0 v; {                  longlist       proplist
" R# f2 m( r% I5 s+ I' l                  lt-idx         reset-lay
- w* E& v$ y) S$ n                  drawpattern    ltabstr         reset-lt  Q. u+ S- Y0 S/ m
                )) D7 o+ m4 c& m5 |) [2 m

) U' w/ T% @* c% P; E9 y, g/ O! ~# O  (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho
8 B# n( |% t0 p# v' @5 W: M        old_error  *error*            ; save current error function
- S1 q5 S; K2 I% f; {7 K1 R        *error* ai_error              ; new error function% `+ }" d' D6 x# g6 v+ r+ L- A
  )6 P) C# D( n  o
! \3 e4 r3 E+ |3 H
  (setvar "cmdecho" 0)
& G+ f! E9 p  A, G( \% q0 O) i' K2 ]+ |, a2 w9 L
  (cond
8 x  r# u4 G) L2 y% N7 S+ G# b6 ~     (  (not (ai_notrans)))                      ; Not transparent?* g7 q  w' R5 c# |7 E  d
     (  (not (ai_acadapp)))                      ; ACADAPP.EXP xloaded?5 ^+ Y, G3 _# M; V
     (  (not (setq dcl_id (ai_dcl "ddchprop")))) ; is .DCL file loaded?  R2 k; X; u0 V. z
     (  (not (setq ss (ddchprop_select))))       ; objects to modify?
$ y2 s( w( A) |  Z7 p8 V- c2 q) S, r0 c$ I
     (t (ai_undo_push)
4 ~4 ?! N3 f5 i" v: z8 k        (ddchprop_init)                          ; Everything's cool,
4 }8 E7 u  z* b$ F; k, z        (call_chp)                               ; so proceed!
5 `/ w5 W# e7 G, Q  \        (ai_undo_pop)
. ~1 X: i+ E8 {2 h     )
& n4 k' `6 l5 L  )( a3 ]( ~6 r( X. Y

0 F% B# ]  }' g4 o" p: e  (setq *error* old_error) 2 v' [4 Z4 M  V9 o0 K
  (setvar "cmdecho" old_cmd)& @; i7 |) Z" {8 `! ~" ^
  (princ)
, r9 k1 s( Q; ~/ V)
6 M6 ^/ h) |& ?: H/ f7 ~2 f% J5 ?* N" b& c+ N3 E6 H
;;;----------------------------------------------------------------------------- _) G) j0 w0 _. t  Y9 W
/ }0 o# W5 {' i* q$ y5 O% z
(princ "   DDCHPROP loaded.")' A, \6 I$ V& g1 s! W& X
(princ)  T. F. I. W7 C$ O2 l
( C# j; ^" g9 }% o
;;;----------------------------------------------------------------------------
/ M  @5 Q3 X0 _/ i6 e8 Q8 M3 P; t
; M8 e, w3 h1 t" Q2 B# {2 X  s;--------------------------------ddmodify.lsp----------------------------------. p+ I- y7 }5 D
; Next available MSG number is    111
9 I$ R0 x) E8 R2 i" z; MODULE_ID DDMODIFY_LSP_# N( @9 B. L7 ^: Z* e
;;;----------------------------------------------------------------------------
% M  Z) ?3 s! M& q;;;    DDMODIFY.LSP
  g. i9 Q0 U% N* Y# w;;;$ q$ a- d, X4 d! o, u
;;;    Copyright 1997 by Autodesk, Inc.
) _& [0 A5 L  x% x;;;
( Z1 q9 u0 ^: P0 C! ~;;;    Permission to use, copy, modify, and distribute this software
) ]; T2 W' ?; \( |;;;    for any purpose and without fee is hereby granted, provided' \& v9 c3 g% Z: G) ~
;;;    that the above copyright notice appears in all copies and
9 F+ O4 d) ?+ ^. t% W# h1 c- _;;;    that both that copyright notice and the limited warranty and* ]+ }5 }% b+ I0 G5 l8 `
;;;    restricted rights notice below appear in all supporting; L# I8 j! E* ?! ?7 l
;;;    documentation.
9 Z. |/ D( S/ q2 ?;;;
9 Q, W5 v0 I2 D/ P;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
; t/ t9 T6 Y* X;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF5 _2 G" ?. t% y8 a7 c2 o; K
;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
  J* E" @) |$ v$ R- p;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE7 N5 j% @7 _7 v- \
;;;    UNINTERRUPTED OR ERROR FREE.6 ]* S. J( V* K
;;;
" H  v# Y3 a% A8 `$ M1 C;;;    Use, duplication, or disclosure by the U.S. Government is subject to
" W: \/ K$ ]* K& P( J;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
' K- [7 \; g! a2 R" |: Z4 w5 M' z;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)/ H- F4 g. k5 c6 F- J  v* _# a$ X
;;;    (Rights in Technical Data and Computer Software), as applicable.7 Q. G6 `, {* w
;;;+ @1 ^0 T9 i6 n4 S6 h: A# d
;;;." h" ^/ n9 E; _) t
;;;9 _7 p, d' s% o6 V) ]
;;;----------------------------------------------------------------------------
  T/ X' ~4 f) c' d" @0 R;;;   DESCRIPTION& m: q8 l' ]7 _# F% ], ~1 X+ l. p
;;;$ I, n  f- W& y+ b
;;;   This function allows the user to get a listing comparable to the LIST! L6 v7 S% N8 k* f; @! g& P
;;;   command for most objects.  In addition, most object fields in the
  U1 r1 {/ }. w: v- D! i) n( f;;;   dialogue box are editable.  Points can be specified dynamically by7 Z" r& B0 t1 @+ R7 m
;;;   temporarily dismissing the dialogue box.  Each object has a unique2 C  q+ W( a& f( e0 Y$ {+ V
;;;   dialogue.$ F7 X8 i( U! V! s6 p4 X, d
;;;
- P9 S, k, A* E) ^, j4 };;;   Naming conventions
5 n- W4 N# i/ q;;;   Long function and widget names may use an underscore "_"1 a4 u9 u) J% w2 r
;;;   in their names to make them easier to read, long variable
0 p5 m3 H; V5 J* u5 N" e;;;   names use a dash "-".
/ E( x8 x3 u  P0 k- L4 `# B( h! u;;;----------------------------------------------------------------------------0 S" [! Y* Z2 u- z+ c) q" K+ Y& x) ^
;;;----------------------------------------------------------------------------3 n2 i/ [4 r5 Q2 G
;;;   Prefixes in command and keyword strings:$ O/ j$ f6 E( a  j
;;;      "."  specifies the built-in AutoCAD command in case it has been
) s8 M1 j4 {; ]! Q;;;           redefined.% ]$ D; P- j6 `, J0 U
;;;      "_"  denotes an AutoCAD command or keyword in the native language& ?+ \0 }- ]& M+ C- F
;;;           version, English.
- U% Z( l8 U; L/ ?2 N- i;;;----------------------------------------------------------------------------
1 o3 b$ `' p0 v4 M5 R;;;
, P7 e# {* c" H5 Z;;; Avoid (gc)s on load to improve load time.
: [7 ~* V6 e" E: y  i) Q;;;
% K" d/ {- Y: t+ Q. M& n(defun do_alloc (/ old_allod new_alloc)
/ }. q+ c: P) X: z( m: m" o  (setq old_alloc (alloc 2000) new_alloc (alloc 2000))
7 ?& N  x' \' ^. J2 k" U9 |  (expand (1+ (/ 17000 new_alloc)))
; M1 b  V. J$ f2 C0 g  (alloc old_alloc)& w" Y+ ^; u5 W" Y, }# y
)
0 ]5 i) `' m4 @( V9 K(do_alloc)) f# w& L( u5 c' n+ ~
(setq do_alloc nil)( J7 I5 c1 Z) V. M# B
- _5 K5 Z0 S+ K
;;;
2 K. A5 J$ V& Z' h7 B;;;
/ ]4 }. Z/ u/ R6 z5 d;;; ===========================================================================% A5 E' K0 {1 Z
;;; ===================== load-time error checking ============================
! R" T1 t# f# F" b! q7 ~2 U/ [- i5 N4 L6 ?' p# S
  (defun ai_abort (app msg)7 [4 m, T8 S1 Z
     (defun *error* (s)* o  d. S. a- w! x: |3 Y
        (if old_error (setq *error* old_error))7 y2 }" H) e% z6 F0 _
        (princ)) u7 r3 i: P/ y' i$ I! q# c" l
     )* y' g- u% T  i( G# A. \3 p4 b! o. b
     (if msg  k6 P& Y6 x; H0 Z
       (alert (strcat " Application error: "
% V" M0 G" O2 d, j                      app1 v" z1 S; x" {  [9 Q
                      " \n\n  "- q, a  y8 C9 Y* B
                      msg3 T; O: S9 ^" a: s
                      "  \n"  ^1 S' [" u$ B4 @( g+ z$ l2 G
              )
! N0 z% g9 p/ \       ); A* N: q( U$ x' G& d- E3 r6 Z# J6 f- c
     )) g) ]; m% j. {% B. ]
     (exit)
% O* z2 B' H+ j2 C  )
4 i3 D2 d$ N3 Q" w0 q$ U. ~' h
3 q5 W: c( s2 ~# e9 j0 J;;; Check to see if AI_UTILS is loaded, If not, try to find it,+ u1 k4 r# j- ]: P
;;; and then try to load it.  If it can't be found or can't be
7 d+ b/ O0 p6 F0 C;;; loaded, then abort the loading of this file immediately.
- ~0 g4 u+ a( ^) v3 ?8 F
& t1 P; l4 N7 K/ ^" j% q9 |! z  (cond1 a, V+ k: ]5 Q+ L' q
     (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.* l' k. l* u- b) z1 Q

( a0 X* g" s& ]     (  (not (findfile "ai_utils.lsp"))                     ; find it
# T% n* ]/ J4 o; R( {# S/ h1 s, t        (ai_abort "DDMODIFY"- F  ^2 a- f* e4 R7 W, [! u
                  (strcat "Can't locate file AI_UTILS.LSP."4 s- [" j7 p  }: e9 r
                          "\n Check support directory.")))
! L0 Y+ ^& X5 G+ `
0 f, I  T. \; S4 x' n     (  (eq "failed" (load "ai_utils" "failed"))            ; load it
* C! Y" ^8 R* m        (ai_abort "DDMODIFY" "Can't load file AI_UTILS.LSP"))5 f% g9 Z# {( g! |% X
  )# ]  T/ G2 B% M- x. o( y$ B
8 A- M7 G4 S% z. F
;;; If we get this far, then AI_UTILS.LSP is loaded and it can+ ?% r  s+ `! b% s+ W! N0 J
;;; be assumed that all functions defined therein are available.! K" I/ P1 Y6 ^1 R/ ]3 k# n3 k

% w1 H4 l4 s& u! R3 D. B9 t;;; Next, check to see if ACADAPP.EXP has been xloaded, and abort% Q5 l! Q" f1 _. ?
;;; if the file can't be found or xloaded.  Note that AI_ACADAPP+ I* J" |! O0 N/ J$ y
;;; does not abort the running application itself (so that it can
+ X/ C! j, J& n7 x;;; also be called from within the command without also stopping/ B4 G# t% r7 V" l$ M
;;; an AutoCAD command currently in progress).
/ ?; Z- _; e, ^; |
2 L9 q0 p5 D7 k  o' [% o5 ?, L) v  (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP- M- T) d; b# w, r/ z9 I
      (ai_abort "DDMODIFY" nil)        ; a Nil <msg> supresses
" o; V  H3 `! @: l1 k  )                                    ; ai_abort's alert box dialog.% Q% a# q5 Q: _- u9 e

6 Y) ^2 `; `4 x! d  V3 d' ?4 h. e;;; ==================== end load-time operations ===========================) Z: |" v! _5 a4 F
- k9 k- I/ Y6 @& e2 _
;;; global variables6 z0 b3 Y8 X4 y/ N2 p

/ c) x. P' b* w0 a(setq hatch-elist nil). f3 w9 G" g4 M' N+ G

- v+ a: `5 G8 _* |/ @1 J* o  s;;; If we get this far, both ai_utils.lsp and acadapp.exp are6 o/ I/ }# m# y6 Z2 U
;;; assumed to be available.
( Q# p6 P# c8 y1 P; K2 L6 O# s5 i; U8 _# D1 w3 h" m  b  N% K
;;; Define and encapsulate all subroutines that are declared
! K; r+ K9 [$ u" v; a5 U;;; locals of the (ddmodify) function.6 F  s/ Y% R, u$ h, U) \5 X% Y

8 \. y0 L) t4 a) U" q. S" i% B(defun ddmodify_init ()
+ r1 k6 x  z& w! j  ;;2 B' {+ y" a/ K
  ;; These three functions modify the enitity list for common properties.  Since4 m! L: [5 u+ j' e; b9 L; b1 X
  ;; color, ltype, and thickness are absent from the object list when they are
* X6 Q- D) }" o  ;; set to their defaults (i.e. color = bylayer), a simple substitution using+ N" b& e: b4 B) v$ z1 w: L" r
  ;; SUBST is not possible.
1 Y0 o# j% T$ V* j: O4 q2 g  ;;
+ l/ _: |' y5 e' d0 S- K6 |  (defun modify_properties ()
. Z- w, q0 b$ z6 j! ~    (emod ecolor 62)% d7 N$ A8 s' J
    (emod eltype 6)+ D+ P2 N. C1 A# z- r3 ]
    (emod ethickness 39)
, |. D# U0 `. \! g    (emod eltscale 48)
, K: |# B7 P7 V5 z+ L    (tempmod elayer 8 nil)1 D* Z# b7 i% g4 h. i) R
  )) r4 c  B$ Q: r5 g/ G
  ;;( n7 k2 ]0 ?$ q+ v2 B. B
  ;; This function is used for modifying common properties of the ACIS
0 t3 K4 Z" W* s: Z2 y! ~  D  ;; based geometry objects. Thickness is not valid for these objects8 b* M. c9 F- j) C; G0 Q* j
  ;; so it is left out., N" J+ s9 |% }# c. Z. d: Z
  ;;
$ J( N9 x; V" s* B/ |3 v  (defun modify_prop_geom ()# E! i1 a- G7 z2 }6 y" L
    (emod ecolor 62)
: G' K+ V9 A- O: n- n. v  [) E    (emod eltype 6)0 N9 D* `, w+ U
    (emod eltscale 48)
: L8 h/ S+ c# E5 @    (tempmod elayer 8 nil)
3 L, `( C9 n- `- x8 Z( Y, C% i$ E  )
% `" }) f8 }3 F. G: }
  B# y: M! G& _5 D+ l* S  (defun emod (value bit)! D) P! u. S0 ~5 Z# q: ^" c
    (if (= bit 62)
9 [- x0 E7 P# ?6 w+ a      (progn  j8 w6 V; N7 j+ _$ y$ |
        (if (or (= value "BYLAYER")
/ `* W6 T. L) I9 k/ p4 F                (= value "BYLAYER")) (setq value 256)), O" y5 l/ T/ W0 n, Q8 a& m
        (if (or (= value "BYBLOCK")
( w. b$ Y0 ]" ^9 N                (= value "BYBLOCK")) (setq value 0))
' Z7 s  O! t8 W* B9 i* a      )
. U; H/ d7 e* {9 L    )
4 a2 u3 }1 `" S4 c; b" e+ d    (if (setq oldlist (cdr (assoc bit elist)))
7 R7 K( c- T0 Y! r" {4 e5 ^. ^      (tempmod value bit nil)- v3 M* e6 F  l6 Y
      (setq elist (append elist (list (cons bit value))))" W# m6 {# e9 s$ Q) m3 Y, i
    )
8 |' y! O  b3 S7 V. @  )9 @# Q7 R% v0 I8 v
  ;;" ?* W5 T' u" t- `
  ;; Resets object list to original values.  Called when the dialogue or/ {, d1 q+ ?: G2 ~- I
  ;; function is cancelled.' }) h2 F, d% W& I* c. s+ ~/ V' A
  ;;8 z8 _7 }9 r( {) H# w/ s/ P) z; \
  (defun reset ()
+ G' M, W& [  W    (setq elist  old-elist
5 I) |! q% K$ p5 I) L! s, M          ecolor (cdr (assoc 62 old-elist))
2 D- \3 E( f* D- K) v( r          ethickness (cdr (assoc 39 old-elist))
5 E( r& y1 W. c& j. f# V& z          eltype (cdr (assoc 6 old-elist))
( d. ?2 t3 Z7 E( U( q          elayer (cdr (assoc 8 old-elist))0 ^3 K  E6 |" O$ j% ?' y
          eltscale (cdr (assoc 48 old-elist))9 K8 \1 U; [1 V; z! r( ^1 w
    )
8 l4 g4 M+ R+ A5 w, X    (if (not ecolor) (setq ecolor "BYLAYER"))5 U/ G! M( O6 \6 H6 b9 l
    (if (not eltype) (setq eltype "BYLAYER"))
9 D# Y5 N5 a! B7 q  C1 n# i* z9 ^    (if (not ethickness) (setq ethickness 0))! f1 }7 ~1 r# [  L0 S. c% V
    (if (not eltscale) (setq eltscale 1))
) g% C! q$ `# }% U4 S/ v/ `0 z* c    (modify_properties)
( ?- n" }! S9 B2 w7 _    (setq reset_flag t)1 Q9 P/ G# T; O! E% t8 M  X; C1 b3 T
    (entmod elist)6 M* x* t: A! l1 t
  )
: x. B1 f- C* W2 Z& d' D3 {0 k  g  ;;( W& P% R9 t0 T& ?" C+ L, c! [
  ;; Modify object when dialogue is temporarily dismissed to reflect latest. a/ j# r: a+ e, Q
  ;; settings of dialogue.  It converts the point from current UCS coordinates to
- U/ W$ P& E/ w$ H, X) S2 `  ;; the proper object coordinates (world or object)./ T# S' E9 A" P
  ;;; w9 i' s" ^3 z" L; f# N
  ;; Arguments: value - in current UCS coordinates- H7 s7 A8 d5 g( A# B
  ;;            bit   - object code (i.e. 10 for start point)
/ V' x" f' E+ ~  ;;            ptype - point type  0=world 1=planar/ h! D% B' h0 P" P1 n+ {, O0 i  M
  ;;9 v* ?- s# C% z7 t5 t+ l9 e2 e
  (defun tempmod (value bit ptype / newpoint)
* R8 y4 ~8 \. {2 |    (cond6 k; F, s9 G! F
      ((= ptype 1) (setq value (trans value 1 ename)))
) X& d5 }9 k# a7 O      ((= ptype 0) (setq value (trans value 1 0)))) l' _! ^% R" p
    )8 m# {, v7 a5 R- ^) o, g
    (setq elist (subst (cons bit value)7 _* m4 d/ z$ y* _" R: r3 p) |8 t
                       (assoc bit elist)
& H' \5 ?8 Z0 t+ i9 w                       elist
# @$ Z0 h8 ?7 ~  a9 l                )
# ^- }% {' h) }9 r; A( ]    )
+ R! E- T  J( n4 J  )( I) b: H2 v" O+ V
  ;;- r5 p. R3 w( \
  ;; The following functions are called after a dialogue has been temporarily
  y$ B" Z  K7 n$ n! \  ;; dismissed and the user is selecting a point.  If a point is selected the) A2 K' g1 Z3 A0 \# K- c& V9 H
  ;; object list is modified and new X,Y,Z values set.  If no point is selected+ j* @1 c, T' c$ r+ W* ~
  ;; (null response), then the point is reset back to its previous values.
+ L6 t: B2 i5 K. ]0 m! Q% }, ?  ;;
' l- b+ M! q, A7 Z, a  A7 o# n  (defun ver_pt1 (ptype)
' R- g: d5 v+ W! \  y    (if pt1
' O1 S: Q% T3 L" M$ i0 d      (progn" X+ F  G& A  K; C9 }# t
        (tempmod pt1 10 ptype)- ]1 {' }$ ?2 A# j7 X; e( w- Y* c
        (entmod elist)" _! Q' Z. H4 I( Z0 w  N& }
      )* X. u/ J& V' j; M  I2 o8 |. K$ d
      (setq pt1 (list x1 y1 z1)); P: w; z1 @4 y0 g! \/ z
    )
* H0 q1 K. I1 ~; [3 S% D  )
) n1 x# b+ l* e/ Q# I- |: b2 _+ S9 |+ H  u8 r5 \0 K) e/ h
  ; (move_pt1 <ptype> )
: o0 n# D+ A$ e2 _9 s' Y( K  ;  x, G8 {2 L! e
  ; Called in liew of (ver_pt1) to translate block insertions which
6 H; d, {: [' J6 ^" m5 p, W  ; might have variable attributes attached to them.  If the distance
& E6 x/ q: g& F5 x  ; the block is to be moved is < 1e-6, the move is deferred.
9 ~1 S& S7 i" H1 f1 i+ R, G4 {8 a, }; P2 i: Y
  (defun move_pt1 (ptype / basept hi)
& J, c8 k/ b& j9 s. z; j( W    (setq basept (trans (cdr (assoc 10 (entget ename))) ename 1)): j; k* D& ]! Q0 o/ n* r9 I' H
    (cond
, b+ c3 Q6 j: o5 a  O       (  (not pt1)( N  a# t9 D( X4 X5 E% L2 Q
          (setq pt1 (list x1 y1 z1)))! K0 s6 w( K) g" p! S

6 k  H+ o  G7 v. d) u! ]       (  (> 1e-6 (distance pt1 basept)))" n7 Z$ ~: Q3 B) Y# j

) D; V' v- ?  @0 x       (t (tempmod pt1 10 ptype)+ Z# X8 c. S0 O' U4 M2 H
          (setq hi (getvar "highlight"))/ ^6 D7 b6 ^- r; y
          (setvar "highlight" 0)
9 E! m" g* ]; r& N1 O          (command "._move" ename "" basept pt1)  P- e& U+ D; q0 o. E+ p
          (setvar "highlight" hi))  Z% x$ N* n3 k  [! C" D5 G
    )
7 A0 t: ~: ?' F7 w+ F  )3 c& Y4 o5 h" ~* n
) x( m1 r; C4 G  T1 q
  (defun ver_pt2 (ptype)
1 Y% }# f. B! r* j- N, m5 f    (if pt2
" m8 j! j( X# T$ `# @  C3 _# N      (progn
1 C$ B3 m9 k3 r1 t7 o        (tempmod pt2 11 ptype)
" y" Y/ R" m. J& h7 K8 |8 e2 `6 d        (entmod elist)
2 ^. w9 n4 J3 k* i6 h      )( s% w! K- }7 \. S( w0 q
      (setq pt2 (list x2 y2 z2))
  n& t0 `3 P, u  f9 f: M    )
: r2 N* g9 ?( ]9 X  )
1 F9 d8 d/ G% D" S* I. o2 h
) R4 Q6 d6 |8 R/ h7 C# N8 q9 @  (defun ver_pt3 (ptype)# Z8 Y9 \  e: ~* R3 I8 q) x& X) q5 P  G
    (if pt3# W! j% p3 V6 N0 E" p
      (progn  Y2 l  R- Q2 h8 w, C" s* Z
        (tempmod pt3 12 ptype)  \$ G/ C, r1 c. H" v' [
        (entmod elist)
7 }9 z' B, T3 L      )
0 J! z% t4 i+ \. r# i: \+ c      (setq pt3 (list x3 y3 z3)); F8 l8 V; T8 M) f, c
    )
/ M0 p6 G7 \3 ]5 P6 n  )0 f& a5 A. N1 C# L5 d! U1 t& }
, l2 z' Z. c' O& L$ s/ a( z, g6 u4 J
  (defun ver_pt4 (ptype)
/ u6 i' z+ o3 `" l    (if pt4
% K& S) {/ C8 D: g4 J$ U7 V      (progn
- {3 I5 B! t' t: J! V        (tempmod pt4 13 ptype)' {' h2 U/ S" p- r  X$ v1 I1 ]
        (entmod elist)) u. W3 V0 F5 F6 R) d0 e6 g: y. [
      )
! ^& d! }  Z1 W      (setq pt4 (list x4 y4 z4))3 Y/ V  ~- h) @! O5 n+ g7 p" {3 F
    )% O9 Y5 d0 S/ P! U. o
  )
# Z9 S& K" Q' s0 k! |  ;; Xline/Ray
* R* g. H0 O+ ^( p  (defun ver_xline_pt1()8 \0 M4 W9 s- U6 C. s4 M
    (if xline_pt1
# H1 T4 e2 _3 u' r% k" T      (progn0 R( a" h. m+ o. o0 J: r6 X
        ;; convert to WCS.$ X% y9 o* X5 @: ?  y
        (setq value (trans xline_pt1 1 0))* l: U+ n& z  M# `6 Z, j8 t0 g" x
        (setq elist (subst (cons 10 value)* D2 I2 y5 V2 |: B  j; z
                          (assoc 10 elist)$ Q, Z0 _& e# T3 H; S
                           elist
" I& M7 n# |( z4 R# I+ H7 ?                    )
: H$ ^5 y8 I8 b( j! T. |8 k- l$ j        )
, I( g9 w& e$ J" x      )
. u0 M$ F" Q. D( t4 A% Z$ ~      (setq xline_pt1 (list xline_x1 xline_y1 xline_z1))
0 S5 i4 d) D! y2 j    )
1 p1 d2 @, v! q1 U# l  )
5 ^$ G) k; F6 `# w* r6 h5 f" K) Z3 r. ?" o" Z  O& L9 u
  (defun ver_xline_pt2()
( v7 f2 ~# `/ O& O- X& r    (if xline_pt2
+ T" n: {0 i2 m( Y7 X( U      (progn3 _+ o4 F4 d; A) u: C
    ;;5 E2 H4 P9 G! P9 V* k# Y
    ;; Calculate new Direction Vector WCS
5 x( O4 P# Z' o: @- f    ;; x / (sqrt ( (x**2) + (y**2) + (z**2)     ))
1 D+ F% Z! u0 `/ i    (setq temp_dir (trans xline_pt2 1 0))
3 n( h8 H+ P% J    (setq temp_dir_x (car temp_dir)): M. p2 ^! ^: M, t  r" L
    (setq temp_dir_y (cadr temp_dir))) Q6 u7 k* N- z" z4 j% d# x6 s& w
    (setq temp_dir_z (caddr temp_dir))6 x& ?! e, Q9 @. G& j

: ^4 G+ s. q' W, g! A( ^7 }. k5 [0 u    (setq temp_xline_pt1 (trans xline_pt1 1 0))
9 h) p( t$ z- n5 `% w    (setq temp_xline_x1 (car temp_xline_pt1))
. E# j8 o: \) o7 |9 }    (setq temp_xline_y1 (cadr temp_xline_pt1))
$ _6 t7 A" _( c! L+ h" N    (setq temp_xline_z1 (caddr temp_xline_pt1))
6 \3 V* d$ b* d  H6 q7 y$ `' v
% A, D; j1 m7 F, K4 d/ S    (setq denom (sqrt (+ (expt (- temp_dir_x temp_xline_x1) 2)1 C8 l1 s9 A! `- D5 I( x) t
                         (expt (- temp_dir_y temp_xline_y1) 2)
, P) ?9 F$ c8 @" x& [9 ?7 A                         (expt (- temp_dir_z temp_xline_z1) 2)
& |5 }* S3 U  ?9 p2 P5 p& ?+ F! Q    ))); o! X/ K. r& ]; z/ H$ _. G* p% I
    (setq temp_dir_x (/ (- temp_dir_x temp_xline_x1) denom)), |* f. A+ F! G3 F
    (setq temp_dir_y (/ (- temp_dir_y temp_xline_y1) denom))# r$ V: T( }) J, Z
    (setq temp_dir_z (/ (- temp_dir_z temp_xline_z1) denom))& u! J2 i6 _1 l" E1 Q/ v8 P
    (setq elist (subst (cons 11 (list temp_dir_x temp_dir_y temp_dir_z))
$ I, M! `) `0 G( O                       (assoc 11 elist)0 k) G* }7 h3 L! }
                       elist- J$ m8 ~/ r% u) p/ [# x
                )
! i1 E3 W# V. H8 R    )
. A9 ~0 r9 P+ n. V    (entmod elist)
3 H( T8 x$ U' \& o8 a! ^        (setq xline_x2 (car xline_pt2))
+ t, q- j9 g; U: S% `        (setq xline_y2 (cadr xline_pt2))2 I/ i8 r( M3 w
        (setq xline_z2 (caddr xline_pt2))% G; c' x2 E9 ^. L+ w

* R! B2 u/ l9 B- o9 }' \! T/ M' E
. n8 B/ N) E) U/ k5 Y* V      )
8 v, c1 k) F+ {& J0 K' p( N      (setq xline_pt2 (list xline_x2 xline_y2 xline_z2))) B0 S) q& ~& b% ~! O
    )  g& U8 s( h7 p6 u9 p0 [, v9 t
  )6 e1 A0 x' @; U$ f# ?. S2 ]
  n' U* Y2 Z: v5 M# b% R% i
  ;;+ A) ^: A+ w# V; X, Z
  ;; Common properties for all objects
* ?& e" u7 Q) |. B4 X5 b  ;;% \: }: ^$ b& X' @+ G
  (defun set_tile_props ()
" D1 O& o6 J+ s7 Q    (set_tile "error" "")
1 u8 @6 Q; \8 [& N- u8 z    (setcolor)9 e2 T' j1 K. E& s; {
    (cond6 A% A- x0 m& e6 k" p7 \1 q
      ((= eltype "BYLAYER"); {9 o2 i1 G% D1 t$ v$ o
         (set_tile "t_ltype" (bylayer_lt)))$ ^/ I1 Y) k* q0 X4 f9 Z
      ((= eltype "BYBLOCK")/ A$ y5 l; Y9 d+ \1 ^9 {
         (set_tile "t_ltype" "BYBLOCK"))
* {, y+ o8 h& y) D8 _      (T (set_tile "t_ltype" eltype))/ M9 p- m. H0 a
    )
* u! g  C! @8 ]8 v" h: }    (set_tile "t_layer" elayer)
& y" w8 ^1 q# s3 w3 S    (set_tile "eb_thickness" (ai_rtos ethickness)): k- J$ f/ C7 o$ d
    (set_tile "eb_ltscale" (ai_rtos eltscale))
4 T- `2 t6 R7 R# Q6 j5 f" e% f7 k& V    (setq which_tiles (ai_common_state etype))+ E5 }- X" c% Y* O* e
    ;; Disable tiles if need be...5 D3 k* n1 _+ c3 c2 F! ^

* a$ X' W: t$ ~0 N3 ~    ;; Layer Button and Text Field
6 I+ \" Z+ A" ~# z: A% j+ g  `8 c- g5 X' c    (if (/= 1 (logand 1 which_tiles))" R6 v7 c0 _# c, h+ f
      (progn8 ^; m2 F- \7 }* j
        (mode_tile "t_layer" 1)* J+ b" Z9 X" z: Q; S/ [* N
        (mode_tile "b_name" 1)8 Y6 a6 f2 @: o0 O) Y  n
      )4 l0 G3 }1 y* [% b  o
    )
; O# M- _: \1 @" b) z% \    ;; Color Button and Text Field
; d2 ~' s' r3 r: k    (if (/= 2 (logand 2 which_tiles))
$ n* x5 E0 T* I& B# H* R' `9 V: @      (progn
" P. r3 }6 g, h8 R4 f; [0 s2 j) S        (mode_tile "t_color" 1)7 F9 k$ w6 W( L
        (mode_tile "b_color" 1)
5 S0 y. X4 l# g0 T6 Y        (mode_tile "show_image" 1)# O/ e1 j9 R: I" c, P4 T
      )
5 f  B- f  e( V) ^0 r    )
+ e; s1 b8 [7 C( h$ z. @5 f    ;; Linetype Button and Text Field
) c, V) c) R1 W) M! ?! P9 e    (if (/= 4 (logand 4 which_tiles))4 j2 B* H( ]- h4 o
      (progn
/ T* v( e8 f/ r# f7 t5 B: Q. x        (mode_tile "t_ltype" 1)# A6 X" P3 g- S
        (mode_tile "b_line" 1)7 T$ U( d$ N1 O9 z/ S2 r9 l, x
      )
) E* y$ b/ ^( `( g" U3 Y' w) A. ?    )  u6 t/ C' W6 g$ @
    ;; Linetype Scale Edit Field
3 Z  k, z3 w' M- v    (if (/= 8 (logand 8 which_tiles))
8 K% r3 F) h; s      (progn
. g7 l; o5 Y4 L7 M" [/ Q% [) ~        (mode_tile "eb_ltscale" 1)
% _5 m8 E, S1 ~% v' K+ f      )
8 C9 M4 q' o; K' P# r+ O    )
) Z+ `0 U- c. C5 W: c2 p, E5 ]& Y    ;; Thickness Edit Field.9 q$ O3 Y: r: r% r
    (if (/= 16 (logand 16 which_tiles))# ~% b3 Q* ]( ^/ D: ^# c  S+ i% k
      (progn
8 P  p3 w. e6 v( V! x# p        (mode_tile "eb_thickness" 1): Q7 [* t2 f1 b5 `9 E. k0 Z+ Q
      )
* _# q1 j% ~+ M2 x/ I    )
8 n0 h- b/ w. ~  )+ Y4 x" g5 r& r2 _# S4 z. n
  ;;
! h" o1 x, h; C: }; ^1 E/ W  ;; XYZ Point values for all enitites
: c; T2 ~* G- U6 [3 l' l  ;;
) }) e/ P+ b! A7 @9 h$ R  (defun set_tile_pt1 (ptype)
: c, r: {. o, _: @    (if (= ptype 0)- f' r, U1 M  _, u2 A* @
      (setq pt1 (trans (cdr (assoc 10 elist)) 0 1)): t0 \6 T* m1 J& p6 G7 t; B: z  _
      (setq pt1 (trans (cdr (assoc 10 elist)) ename 1))
. ?' R) t9 u) l3 N; J! N    )
" j2 q* _6 j8 }8 E    (set_tile "x1_pt" (ai_rtos (setq x1 (car pt1))))
; i( T3 H" K- j( |    (set_tile "y1_pt" (ai_rtos (setq y1 (cadr pt1))))
  d8 I( y8 |/ J/ D& r, T    (set_tile "z1_pt" (ai_rtos (setq z1 (caddr pt1))))# _' E) Q1 x5 e' Y) u4 W$ u
  )" ~5 S5 Y( S8 g& B* l# F9 k# F
  (defun set_tile_pt2 (ptype)/ e' ~0 k: f& J% j( Q: j6 t/ o6 P+ e' D
    (if (= ptype 0)" q: w/ T/ q8 b9 d3 y3 c
      (setq pt2 (trans (cdr (assoc 11 elist)) 0 1)); M$ }4 z+ M' m; v; Y# I+ {% |
      (setq pt2 (trans (cdr (assoc 11 elist)) ename 1))( v! Q. D" f) Q1 \! ^
    )
9 S: n/ A, J! N7 f- \" Q- _    (set_tile "x2_pt" (ai_rtos (setq x2 (car pt2))))
. m2 M" K% r" t0 B* u    (set_tile "y2_pt" (ai_rtos (setq y2 (cadr pt2))))6 @4 H% Z# Y8 K9 x: e  f! Y
    (set_tile "z2_pt" (ai_rtos (setq z2 (caddr pt2))))
7 L7 l2 s+ g: C  )
8 k3 f/ V/ K( D1 M' z3 k  (defun set_tile_pt3 (ptype)4 u5 t1 Q7 T9 H# O5 c6 {0 K
    (if (= ptype 0): d2 R: J0 E; p
      (setq pt3 (trans (cdr (assoc 12 elist)) 0 1))% ?1 D1 b" ^* D
      (setq pt3 (trans (cdr (assoc 12 elist)) ename 1))
( d6 [! v3 M$ G- `" W( E    )+ u  \# o# P- C. R
    (set_tile "x3_pt" (ai_rtos (setq x3 (car pt3))))
8 W! a2 |& v% u0 k1 b" L& h    (set_tile "y3_pt" (ai_rtos (setq y3 (cadr pt3))))
% L1 g) e9 ]- @$ M+ Z* o    (set_tile "z3_pt" (ai_rtos (setq z3 (caddr pt3))))
; j' k  K0 n) i3 s! i  )7 r# @) f3 m0 s" o  u2 u
  (defun set_tile_pt4 (ptype)
  F- I6 z% L- o' W) m% U$ F+ C0 T  M6 u    (if (= ptype 0)
6 Z+ A2 B  A8 ^* |4 D      (setq pt4 (trans (cdr (assoc 13 elist)) 0 1))# r0 J- H+ M) l( O+ W& {# V" c# Y/ u
      (setq pt4 (trans (cdr (assoc 13 elist)) ename 1))
" Q3 ]$ ]5 f5 E( u    ), w4 U- p4 _* U7 @
    (set_tile "x4_pt" (ai_rtos (setq x4 (car pt4))))
! t; @0 V$ A$ X, z. M& _    (set_tile "y4_pt" (ai_rtos (setq y4 (cadr pt4))))( I7 ]3 x# H$ {+ `( _$ J
    (set_tile "z4_pt" (ai_rtos (setq z4 (caddr pt4))))9 ]$ v& C! ]0 W* O6 `  I
  )
. y  [; J" A7 W5 O  g2 H+ h4 W  ;;
. m/ x) U: \7 i9 g- T/ U9 n  ;; Xline/Ray
% b% g3 r- x) \  ;;
9 c9 f2 I, b) \- F; \3 z  (defun set_tile_xline_pt1 ()
( k3 m! I# p3 u( _$ n/ W" U
% w+ m8 a/ Z6 c  k    (setq xline_pt1 (trans (cdr (assoc 10 elist)) 0 1))
8 H" t5 w9 ]: y2 @) p6 A$ P& r& n: Q" R$ E) D8 l. T! d
    (set_tile "xline_x1" (ai_rtos (setq xline_x1 (car xline_pt1))))5 S3 p: P1 _/ x/ ]) {
    (set_tile "xline_y1" (ai_rtos (setq xline_y1 (cadr xline_pt1))))
4 ^! ~& _5 u8 R( |2 f0 T* W/ @% S    (set_tile "xline_z1" (ai_rtos (setq xline_z1 (caddr xline_pt1))))$ J* G! n( n  N% \/ X
  )
0 G6 U. G# ~! N4 {  (defun set_tile_dirv ()2 Q/ S" m& k& }4 p( W/ F
        ;; Convert 11 group to local UCS (displacement)
& K$ j# X; W& A# \    (setq dir_pt (trans (cdr (assoc 11 elist)) 0 1 1))
9 e( C' ]; \# j- M$ X; K/ |4 @" e1 ^$ f( o
    (set_tile "dir_x" (rtos (setq dir_ptx (car dir_pt))))4 y. ~: _* L" i! L5 l
    (set_tile "dir_y" (rtos (setq dir_pty (cadr dir_pt))))
; M6 S8 @1 ~5 j6 _0 D    (set_tile "dir_z" (rtos (setq dir_ptz (caddr dir_pt))))
7 N- l  N( R. W2 t3 h  )$ U+ u" K0 E6 a, C' Y
  (defun set_tile_xline_pt2 (), n! F  u* e6 }: ~
    (if (not xline_pt2)% S; a& w. T% P8 B
      ;; Initial second point is Root Point + Direction Vector
7 l6 M- A% @6 s      (setq xline_pt2 (mapcar '+ xline_pt1 dir_pt))! d  o$ i2 d9 Y! x: D
    )
8 Z9 N1 c. G+ a) D$ F    (set_tile "xline_x2" (ai_rtos (setq xline_x2 (car xline_pt2))))* ?/ |0 _4 y2 }4 M' ]
    (set_tile "xline_y2" (ai_rtos (setq xline_y2 (cadr xline_pt2))))5 \% e$ N$ W9 }( @- K& M  ?
    (set_tile "xline_z2" (ai_rtos (setq xline_z2 (caddr xline_pt2))))
, T3 p% R2 {% `% [( Q0 L; P  )
4 ]2 R$ F: E. Y: @0 O/ l/ i1 Q
- F' S8 n: O, c. \6 g8 U* {& @  ;;
0 y. j: B: ?% B8 b  ;; Handle for all objects: Z' P- j6 i) I* j- F3 O' u
  ;;: g/ [9 j! K9 c9 k% d% v
  (defun set_tile_handle ()
% `/ I6 L  O" s; J1 Y5 E5 M1 M    (if (setq hand (cdr (assoc 5 elist)))- H& e6 t( L6 y7 r6 \
      (set_tile "Handle" hand)- j1 Q6 P) X) |1 s* K& B
      (set_tile "Handle" "None")+ i/ {7 S  A& j% D+ d3 L, k  k
    )
4 R2 ?: [+ i! w  )
' O% B) [, K8 ]' T  ;;
/ O3 J' O" U1 ^5 W  ;; Radius for ARC and CIRCLE, \! C3 K, I6 g& J4 o
  ;;
- H$ M1 v) N6 m6 ~( C  (defun set_tile_rad ()
$ P1 t  k  G" Z    (setq radius (cdr (assoc 40 elist)))4 D1 a7 [* J0 w  Z8 C$ D; G
    (set_tile "radius" (ai_rtos radius))
, e$ m" A" i- s) q9 o& j0 W  )
- U% U( b1 F2 D! k4 s- u; }  ;;/ O1 v' \/ K9 q8 F
  ;; Start angle for ARC/ u- q" ]/ D  p5 E0 ]( N
  ;;1 Q% g% K8 `7 t5 d6 Q
  (defun set_tile_stang ()# r3 q4 F# L# e2 }, D( o
    (setq st_ang (cdr (assoc 50 elist)))
7 H7 b, S" O5 p2 |. O/ ]    (set_tile "st_ang" (ai_angtos st_ang)): k# p2 C* o4 V) R
  )
( H* }, y8 S+ g' x2 Q- x  ;;
! o' ]  D2 Q: [0 b4 d3 S  ;; End angle for ARC
9 @2 r' a9 w2 i( _: n. @  ;;& r4 n, T" F9 n* y2 w
  (defun set_tile_endang ()2 {8 B' F2 Q2 K; `; b
    (setq end_ang (cdr (assoc 51 elist)))1 u# Z" i. v) Y- `/ C5 f
    (set_tile "end_ang" (ai_angtos end_ang))1 {, r, g% d% Y: }& w
  )2 k  w) J4 q9 L6 E
  ;;
2 b& |* Y/ W  N8 {5 U  ;; Rotation Angle - Text, Attributes, Block insertions and Shapes( N- H( e$ B6 [9 D) [/ P
  ;;
$ M% W. l, V! n  (defun set_tile_rot ()/ B' |5 ^. v8 U# r
    (setq rot (cdr (assoc 50 elist)))( c; u' p5 y" n  v$ X* Y& t
    (set_tile "rot" (ai_angtos rot))
5 G% M% G' d; P2 B  )* K& e# i  z* d+ L' h
  ;;' A" g( h+ d) q! V5 y2 n8 g
  ;; Height - Text, Attributes and Shapes
0 X7 W2 K- f5 u$ u  ;;# X0 X4 n  X3 T) o
  (defun set_tile_hght ()* M( r7 i: ~9 n: f; i
    (setq hght (cdr (assoc 40 elist)))
2 r8 q8 h$ p3 I6 r0 m    (set_tile "hght" (ai_rtos hght))
7 s2 a2 x( L4 y  ?# b  )
3 R1 M; q# L$ R: I5 I" {7 ?  ;;2 S4 R: ]; ?5 O
  ;; Width Factor - Text, Attributes and Shapes
7 _4 f$ ]9 f! k  ;;2 b/ Q# P: }. W$ M: [8 B
  (defun set_tile_wid ()% [/ k2 T, C& z# Y" `
    (setq wid (cdr (assoc 41 elist)))  m2 [. Q! P/ \
    (set_tile "wid" (ai_rtos wid)): W: j9 w$ {& Z( ~2 @8 l
  )" r- k: m7 y7 k: r  {$ A& O
  ;;/ [, F1 s" f: M3 `: |1 c  m
  ;; Obliquing Angle - Text, Attributes and Shapes7 d( ]) A) S$ p& a/ O  w* \6 y8 e! @% B
  ;;
) Y+ G7 t8 y4 ^! v  (defun set_tile_obl ()% {' P% X# p7 z
    (setq obl (cdr (assoc 51 elist)))% X& J: b; O8 }/ B7 U, c- I
    (set_tile "obl" (ai_angtos obl))
/ B: |0 \( v7 x% N; Q! X  )
3 b! ~6 d- q, r& K( ?. d/ N4 \3 t0 j  ;;% |0 k8 l* w$ O; W. [
  ;; Text string+ _  j2 L: A, i3 E* O7 J
  ;;
$ A+ x8 b5 T2 M$ H: U  (defun set_tile_text ()" t) e* B5 b' e5 N4 b
    (setq text (cdr (assoc 1 elist))): m6 g4 m. D- O+ Y, `* g! y
    (set_tile "t_string" text)
- f: M6 P2 l: H2 x# L7 Y' v  )
. ]9 M" E* e* U1 k  ;;
7 c' X% w$ S# o  ;; Attribute Tag
1 z! z( v! c3 ^9 k  ;;  u3 ~! ?7 l+ d% F
  (defun set_tile_tag ()
% n) {9 J$ F/ s7 }    (if (= etype "ATTDEF")$ s0 |/ L2 u2 v' A, h- H
      (progn  j3 O2 l1 @, v3 W2 ^& {/ w- L+ s7 ?
        (setq attag (cdr (assoc 2 elist)))
1 V: B( ~$ R- G$ y        (set_tile "tag" attag)
$ P1 b$ p$ O% F" N* Y5 z      )
4 v* C6 ~+ N" P" h, Q    )$ J/ F. Z" X7 }, o+ \
  )
+ x7 g5 I% `% J* F1 T' V  ;;
( m+ z# S$ Z9 \% ]) Y6 T. `3 S2 Y  ;; Attribute Definition
7 O# o% J+ C8 }. u- T  ;;
8 V* e: t  x- `! r* L* \  (defun set_tile_prompt ()
9 }/ ]* e7 ]" x+ ]5 U- X    (if (= etype "ATTDEF")
8 I$ a( ~% Q* k- V      (progn2 d1 k' [' J' L  z
        (setq atprompt (cdr (assoc 3 elist)))
' E3 R' s' O4 L6 t8 B. i. [        (set_tile "prompt" atprompt)8 `% z6 Q3 g# S% }: T" _2 f
      )
1 Y) R* w0 {& v! p$ _    )" d. }& s, h- s1 G# I
  )8 y1 H. s: L9 h& Z4 p6 n3 F8 ]! @
  ;;4 Q" E0 d( q2 t/ @" q
  ;; Justification setting for Attributes and Text.  Initializes, ]6 Z' F! u  T9 Z; ~7 j
  ;; popup list box
1 G! Q0 I. `4 c0 o  ;;
! N5 r6 q% z: c7 R5 |9 N  (defun set_tile_just ()1 Z& g" r9 j% T/ B7 T, X! ~
    (setq ha (cdr (assoc 72 elist)))  ; horizontal alignment
8 y3 [+ U+ _5 f/ c6 S1 ]    (setq va (cdr (assoc 73 elist)))  ; vertical alignment" ~0 b4 m. p9 d5 J& [9 D
    (setq ha-prev ha)3 ~( b% u0 V. u: p
    (if (= etype "ATTDEF")4 o8 {6 g  _3 W; }/ D
        (setq va (cdr (assoc 74 elist)))  ; vertical alignment! r$ k% R3 R) K# R8 U
    )6 e6 j9 a  ^1 o. M, ]
    (setq jlist
0 t7 U6 R% W7 I" N          (list "Left"        "Center"        "Right"
+ A3 U3 k; f6 X! [: W                "Aligned"     "Middle"        "Fit"7 j$ X9 V+ v7 X+ a- x$ q2 P
                "Top left"    "Top center"    "Top right"& o# ~5 Q( {) c7 X7 A6 O5 s2 W
                "Middle left" "Middle center" "Middle right"
4 Y; `; a' I) a; S: k1 c7 }                "Bottom left" "Bottom center" "Bottom right"- r7 b2 ^8 r( w; C4 m1 h; [  o+ `4 C
          )) }: t; N( {7 E8 i
    ), i# a/ o$ }7 J! Z; J7 z5 f: i9 R
    (start_list "popup_just")
$ g8 y; v# l; a5 y# }$ k0 j    (mapcar 'add_list jlist)
4 p' Q- `: E9 i* u    (end_list)# ?2 K( `6 z) Y& T; O) i
    (set_just_idx)
8 |: Y1 B# @* L& d5 O3 ~- D' {    (set_tile "popup_just" (jlist_act just-idx))( _1 O  l" K9 ~/ H  f$ j' o
  )+ Y$ O3 ~* q0 ]2 h0 S7 t: t4 l* t
  ;;
/ I. o9 k6 f1 F/ @/ I1 @& ?  i% ?3 b  ;; Style setting for Attributes and Text.  Reads symbol table for popup list6 a4 S; X) |1 h& Y
  ;; box.3 n- e! f4 J( M- l1 ~
  ;;. S: B3 }9 m' v8 W; U8 m# B& k
  (defun set_tile_style (/ sname style-idx tlist)
2 H# o' _) G; E9 h9 ~    (setq tlist (tblnext "STYLE" T)
9 ?# |6 T2 o; [- [* z          slist nil)
- i0 ^+ X5 ~3 k( h    (while tlist8 l  @$ g3 A7 Q$ Q8 v
      (setq sname (cdr (assoc 2 tlist)))( P6 p$ E- f2 g4 l7 n
      (if (and (/= sname "")
, m( E: x' X1 o! g  ~6 N3 G               (/= (logand 16 (cdr (assoc 70 tlist))) 16))
1 m9 R8 f! B6 T, ~6 K4 I# I          (setq slist (cons sname slist)))  @3 |. y8 M) y2 d9 V4 m3 u  M& c
      (setq tlist (tblnext "STYLE")))
! T6 M4 x0 g) P! p- `4 C    (if (>= (getvar "maxsort") (length slist))
1 G! K! C3 a% r9 z2 p+ M        (setq slist (acad_strlsort slist)) ; alphabetize style list
: e8 T1 ^9 c# R      (setq slist (reverse slist)))     ; or reverse it to put it in DB order
0 W# T0 _1 Y: J2 M3 s1 a" L* k7 @; \9 R
    (start_list "style")
1 ?4 t( ~5 A% r    (mapcar 'add_list slist)+ T" h, }5 Z/ N* m
    (end_list)
) x8 B$ M* G1 h) A+ P" w    (setq tstyle (cdr (assoc 7 elist)))& G: B2 B- }* i3 k+ T4 ], V
    (setq style-idx (getindex tstyle slist))1 O  M. w5 J& R  x9 s$ q
    (set_tile "style" (itoa style-idx))
, `9 N: r+ X% g( `  )
5 t% w$ u2 e; S+ N- B" Q* V  ;;
2 v5 Y4 B% u, @1 o3 Z& l  ;; Text and Attribute setting - upside-down, backwards
: O# W: @6 m9 h6 X' n3 U! J  ;;0 q6 r3 L5 |0 E
  (defun set_tile_bk-up ()$ {  H+ p4 [5 n# }  j$ h
    (setq bk-up (cdr (assoc 71 elist)))
) ]/ Y$ p& x) m+ \2 T/ q" E; }; L0 e    (if (= (logand bk-up 2) 2)! q' B+ a- v/ s& Z5 V3 g6 Q: X2 ~' T
      (set_tile "bkwd" (itoa (setq bkwd 1)))
/ G$ E2 s. q# @* c, r9 ~$ A, s0 _      (set_tile "bkwd" (itoa (setq bkwd 0)))
5 q9 p$ C; Q# e, W7 N    )' b8 `# T" P  Y  z
    (if (= (logand bk-up 4) 4)" h% W0 C' d, G- V
      (set_tile "upsd" (itoa (setq upsd 1)))
& O' m2 o. f  j      (set_tile "upsd" (itoa (setq upsd 0)))
7 a2 U5 @: k7 H* W/ H, @    )3 |( H0 S# L  @) X7 ?; Z1 V
  )7 R" X+ f3 t, e  H9 J
  ;;# j. M9 m4 X: q& t
  ;; Attribute setting - invisible, constant, verify, preset9 S4 D7 I! g: c2 N
  ;;! p9 A. Y9 D7 v4 R7 c
  (defun set_tile_icvp ()7 O3 V) ~4 D! `$ W8 l9 F
    (if (not (setq icvp (cdr (assoc 70 elist))))" }# Q0 m! R; M7 S# W
      (setq icvp 0)# U* K5 W' S( `1 T/ P2 d' {" z
    )
; [- M5 o* Z0 r6 J    (if (= (logand icvp 1) 1)' [( V& Y3 o# ?8 J% g0 d7 N6 Y! r
      (set_tile "inv" (itoa (setq inv 1)))$ Z0 ~0 i8 c+ D* Z: J' |" }* z: A: X
      (set_tile "inv" (itoa (setq inv 0))): K' t7 Z( e4 k- R
    )( |7 Y/ P7 Z" J& C+ W8 Q3 D; d
    (if (= (logand icvp 2) 2). C* b8 M) N( Y/ M. E$ Y' o/ f( h
      (set_tile "con" (itoa (setq con 1))). ~. b: w) \& @0 r
      (set_tile "con" (itoa (setq con 0)))
% g) t! c  ?% g  a/ d- B- P    )
) q2 J0 {6 `* B+ J# M/ Y    (if (= (logand icvp 4) 4)6 h% \2 k  X  i, w* r
      (set_tile "ver" (itoa (setq vfy 1)))
% h8 n9 M: n2 b, J" }      (set_tile "ver" (itoa (setq vfy 0)))
8 ?0 k( W/ I: F) [- ~4 r- M8 n6 l    )
, c$ x" n# Z$ U# ~    (if (= (logand icvp 8) 8)
' I8 N" e* \$ E( U/ f      (set_tile "pre" (itoa (setq pre 1)))1 p0 t' v2 B6 a# s
      (set_tile "pre" (itoa (setq pre 0)))
* X' N8 h$ k& g8 a, ?. F7 u    )
9 a5 }+ d: q6 k. z" A  )% X; l" |0 l( ^" o4 [. l, B6 e
  ;;
0 v; L( ?/ C. i0 I6 b8 T  ;; Scale factors for block insertions! ]! R/ I0 }; ~! B$ U4 p/ n3 e
  ;;  I9 ^( B2 L" V
  (defun set_tile_scale (/ temp)3 O- N' B9 w) A' e3 e. V. O" U7 s
    (setq temp (getvar "LUNITS"))
4 F$ h7 d+ W) y/ J0 h    (setvar "LUNITS" 2)
& F" G+ A! G3 d6 z) ]$ h    (setq xscale (cdr (assoc 41 elist)))
: `! w7 v0 Y, i* m+ d    (set_tile "xscale" (ai_rtos xscale))
% a+ _# B- E  H, Y. L1 G    (setq yscale (cdr (assoc 42 elist)))
/ L9 l. d7 O- {) z2 c# D* g, U    (set_tile "yscale" (ai_rtos yscale))
8 U% h" n" N  C; k" I    (setq zscale (cdr (assoc 43 elist)))
0 I: u( G/ d* D0 y8 [    (set_tile "zscale" (ai_rtos zscale))0 e. t3 U) R3 S4 j& L
    (setvar "LUNITS" temp)9 ]& g+ \  ~" n+ M
  )
  t& n' @+ m. ?0 |$ Q' Q+ k0 W  ;;# [& f. s# H. Y
  ;; Rows and columns for block insertions6 C, s6 n* T& o
  ;;) I" C+ `$ z5 _' ^( r2 `& N
  (defun set_tile_rc (); N0 q* S* M% ~- K. }4 a
    (setq columns (cdr (assoc 70 elist)))0 M  X" k1 T+ H1 ?7 r. ~
    (set_tile "columns" (itoa columns ))
5 P- w/ o9 W) N6 _: \    (setq rows (cdr (assoc 71 elist)))0 H2 V4 s# r: f: h
    (set_tile "rows" (itoa rows))6 r, o  T* }; I7 a: k2 x6 C
    (setq col-sp (cdr (assoc 44 elist)))5 `  z. D1 ]( N5 t( x+ [
    (set_tile "col_sp" (ai_rtos col-sp))
8 c4 R4 X2 D$ c% J    (setq row-sp (cdr (assoc 45 elist)))3 W0 ?: ?, k# C. ~! v3 l$ @
    (set_tile "row_sp" (ai_rtos row-sp))
3 X1 c. g$ j( @* w+ W: N  h7 L1 E0 s        (if (/= hasclip T)6 j# A, |& g# g' k+ i" _
                (mode_tile "xcliponoff" 1)
+ N& Y! s7 u$ T: d$ J                (set_tile "xcliponoff" (itoa xcliponoff))
: i+ c) W' ~2 Q; c2 R        )( z+ {- B. q4 r
  )7 P' u+ `! M5 H( t
  ;;6 A6 y) G' Q# N$ H* v& M
  ;; Invisible edges for 3DFACE
) k; w; G8 a1 a: u; i# i  ;;2 V! c" Z" J1 S% L" S# r: q
  (defun set_tile_edges ()
3 v& U8 E/ r, V& I: T    (setq f-vis (cdr (assoc 70 elist)))
1 W/ Q5 `  g( m, E) J% s* m  \' d    (if (= (logand f-vis 1) 1)& R; G, }( e$ x2 o# U  \
      (set_tile "edge_1" (setq edge1 "0"))1 Q* f, V% @( s+ V4 g! M5 O
      (set_tile "edge_1" (setq edge1 "1"))
; s( @% R* x% h    )
& P- d5 f: e( @- Q    (if (= (logand f-vis 2) 2): c3 F+ H6 `! z( e7 e
      (set_tile "edge_2" (setq edge2 "0"))7 h' Z( m6 U7 y& k* c- M
      (set_tile "edge_2" (setq edge2 "1"))
# D' A; o& ^% c( \, g    )
' Y: J' O' p5 e4 i" t+ c    (if (= (logand f-vis 4) 4)* L$ U5 i7 J$ q' `! p: X/ D
      (set_tile "edge_3" (setq edge3 "0"))) K; N$ E; K3 h/ e
      (set_tile "edge_3" (setq edge3 "1"))
. ^. p4 L, [* o+ R. H8 p    )
( E- E' y7 Q6 R' o/ K; q9 q    (if (= (logand f-vis 8) 8)
7 Z1 D6 J  O& J0 e; o      (set_tile "edge_4" (setq edge4 "0"))
& U7 y" {1 G3 J7 E) M3 R) o. B      (set_tile "edge_4" (setq edge4 "1"))
, s6 A4 N, @5 S6 w% A; q0 o& E* ^    )
1 f# B. q+ B  H/ F5 ^  )
7 p+ h9 `& U2 E+ V: K0 [0 Q  ;;
) n; ?/ w+ i8 `( k% B7 R; t1 M  ;; XYZ Point values for polyline vertex! A0 _: }* Q( h$ S, S3 ]
  ;;
* q. _# @; |, @" v  (defun set_tile_vpt (ptype)
" U1 ?- u1 Z* _9 U5 F. {% U    (if (= (cdr (assoc 0 vlist)) "LWPOLYLINE")4 h; U+ m+ r% Q2 M
        (progn
; ?/ }) ?% H' ?( f- t6 c* F            ;; ctr is 1 based, vertices are zero based.: {1 z! o4 Y- i6 [7 n6 E" `
            (setq vpt (cdr (getLwVert (- ctr 1))))
4 D4 `. Y" ^) K6 k" X            (set_tile "xtext" (rtos (setq x1 (car vpt))))  P- Y: b8 ^" I4 ~7 i
            (set_tile "ytext" (rtos (setq y1 (cadr vpt))))1 A% @$ T) U' o! e' R" w! |
            (set_tile "ztext" (rtos (setq z1 (caddr vpt))))
  ]0 g& T4 s, t: A; k8 v        )
" p% U- C* \! t2 p/ w; z" ?        (progn% ?: j! n1 v: l
            (if (= ptype 0)
: W# ]; r5 I' J& }5 C4 h                (setq vpt (trans (cdr (assoc 10 vlist)) 0 1))
) J7 ]4 x! @9 A, c2 g4 K- ~( o                (setq vpt (trans (cdr (assoc 10 vlist)) ename 1))
0 ]2 b' T9 _( c% g, v2 r3 U9 t9 b! [0 q+ N/ o            )6 P8 g: E1 {7 T

  m% O2 v  m0 b3 g* _6 Z            (set_tile "xtext" (rtos (setq x1 (car vpt))))
1 f2 |( U' ^* U; R' d            (set_tile "ytext" (rtos (setq y1 (cadr vpt))))$ w) w8 d- r8 W
            (set_tile "ztext" (rtos (setq z1 (caddr vpt))))9 d1 |% P) A/ |6 [) w. z
        )2 k: H# w+ Y" A! Q3 M4 H
    )/ N9 Z- E9 F" T4 a( g& S
2 ~  R5 E8 [6 H+ P: _
  )4 S  O/ ~# J* ~( u" B" r+ O' t
  ;; This is the equivalent to doing an entnext on the heavy weight
" |$ r; W/ {' S" m( W$ L- C  ;; polylines. The hard coded '4' below allow stepping over the
6 E1 N5 P" D$ N  ;; 40 41 and 42 group code information. The while loop finds the
8 F. _. c+ X+ c0 p/ A7 l  ;; first vertex which will be used as the starting assoc in the) D" s8 c/ f6 `3 p
  ;; call to nth.
! J( m7 p4 T6 t& d  ;;8 O: N8 s" k5 v$ {( M$ Q
  (defun getLwVert (tmpctr / count tmp)" K7 u  U' I/ t1 P
    (setq count 0)
! ^  V, ~* O! P* _8 a2 }) w    (while (/= (car (nth count vlist)) 10)
/ M8 O. ^+ P4 B" ~        (setq count (+ count 1))
7 n: T  e, ~/ w  V    ); G: l" R6 F& N1 l; M3 c" q
    ;; If the counter reaches the number of vertices,5 D/ f( J0 B3 D, C+ N
    ;; reset ctr and tmpctr to zero again.2 u# {2 I/ C( P4 @% t
    (if (= tmpctr (cdr (assoc 90 vlist)))
# U$ d! F/ z: b8 c% c) E8 X        (progn- {# r% E3 |* p+ l( k
        (setq ctr 0)
- s" j! r  m# ?4 _2 [* _0 v        (setq tmpctr 0)  M$ n7 Y$ @' Y1 [9 r" b
        )" I& ?. i; |% L) ?! U2 s1 a3 z
    )
, H5 ]" J8 H1 o$ P3 q' g    (setq tmp (nth (+ count (* tmpctr 4)) vlist))/ V8 [* z, M$ F
    (setq tmp (append tmp (list(cdr (assoc 38 vlist)))))
4 L& v- O9 R1 Q  h0 i: k' r+ x7 h    (setq pt1 (trans (cdr tmp) (cdr (assoc -1 vlist)) 1))
' `2 m: S* @- x2 Z6 n    (setq tmp (cons 10 pt1)): b3 q% c* T+ X& z
    (setq tmp tmp): g* x6 D& W' O4 ]. L$ c
  )
- f9 J7 b/ s& P9 ^  ;;
6 _0 R5 N3 V. e# p  ;; Set tiles for Spline properties. If the spline is rational then we3 f3 ~/ `* o9 F- z8 L
  ;; need to display the weight values of the control points, so set1 ^- C6 e8 m% Y; ?9 r
  ;; flag to 1.' f; x6 I0 K9 u, X9 D7 n
  ;; 1 = rational spline: x$ m( S3 k1 ~3 r* Q3 ]" I/ I
  ;; 0 = non-rational spline
% v& U/ j: w+ d6 ?0 C; @  ;;7 l/ N2 u' E- F* _+ |( O
  (defun set_tile_spline_props ()
6 x- Z0 g- O! I( e$ ^8 R    (setq rational_spl_flag 0)      ;; initialize rational spline flag, s7 W) p9 l  D( z0 ^
    (set_tile "Degree" (itoa (cdr (assoc 71 elist))))! @& i# l5 b3 f, S
    (setq bit70 (cdr (assoc 70 elist)))+ b1 h! Q9 V; G" Q  v5 q
    (if (= (logand bit70 1) 1)
9 P' ^$ i5 n( `# [        (set_tile "SpProp4" "Closed")
- H, I4 K) R/ b9 {5 ^; s' ^        (set_tile "SpProp4" "      ")
2 D/ y2 F5 u6 D* x. Q, l    )7 C* T9 k" C: X* |* m) f1 e
    (if (= (logand bit70 2) 2)
. x- j  A) D3 U' S        (set_tile "SpProp3" "Periodic")& E/ ^& i0 i/ |7 P
        (set_tile "SpProp3" "Non-Periodic")5 s8 H+ `( a2 J, @8 v7 l+ S
    )
: X( f1 h; ~( f! q  ]& n* w! ^# ~    (if (= (logand bit70 4) 4)
, u) A! r7 f/ l) |* I* u      (progn- k! R7 {2 w5 Q7 m: u6 D
        (set_tile "SpProp2" "Rational")
! L3 V' D1 a# o3 c3 x        (setq rational_spl_flag 1)      ;; this is a rational spline5 i/ _& r2 C+ D6 J0 {4 C6 [5 G
      )) Y& C; l3 C( q: A
        (set_tile "SpProp2" "Non-Rational")
5 O; @+ C# u/ g  P5 q0 I7 h; J    )3 e) }6 r9 ]6 q' f9 p6 p" G) t
    (if (= (logand bit70 8) 8)
2 a# c% H+ f: `+ d3 \        (set_tile "SpProp1" "Planar")
' w& x6 B: t7 M* A* T  ?        (set_tile "SpProp1" "Non-Planar")5 l0 T  A2 y. H9 E& o1 v
    )
3 e/ \8 d0 [3 d7 \/ I    (if (= (logand bit70 16) 16)" o8 Z, t+ d1 B( n0 |
        (set_tile "SpProp5" "Linear")
  y; |' C+ H7 W9 H        (set_tile "SpProp5" "      ")
. `( ?/ h$ Y5 I; k  o    )
0 R; r6 J8 i( T  )1 C4 ?7 g& N( V; J2 k, r
  ;;' O  s4 d# Y$ I) F, w4 h
  ;; XYZ Point values for spline points2 ^8 `8 C! c- ], h
  ;; Need to account for WCS/UCS
! `' {2 U& G. J9 ?4 U  ;;
; `5 l3 \' L4 p  (defun set_tile_cntl_pt ()
$ A, l" z) ]) I0 n* Z7 @    (setq cntl-pt (cdr (assoc 10  elist)))
. m+ I- m& T0 F( o6 S. G    (set_tile "xtext" (rtos (setq x1 (car cntl-pt))))0 k( D1 l2 P. p) o- P" B
    (set_tile "ytext" (rtos (setq y1 (cadr cntl-pt))))
1 ]! A+ d! r$ Z2 {6 ]    (set_tile "ztext" (rtos (setq z1 (caddr cntl-pt))))) v4 g  ~7 e) _5 ^% U; e7 Z
    (if (= rational_spl_flag 1)      ;; if rational spline
7 ]9 n* ~( i. b3 x6 m) x      (progn                         ;; show weight9 J+ r6 S8 v- \! i
        (setq weight (cdr (assoc 41 elist)))
" l; d. n$ J9 O' H8 P$ O3 g6 N: J1 C        (set_tile "weight" (rtos weight))9 A+ E9 h) ^! K) m, a( v% j1 n
      )                              ;; else0 g+ |& I& ^" g% ~8 z! ?; t0 I
        (mode_tile "weight_text" 1)  ;; disable weight field: S! q8 F1 z5 s7 U6 ^
    )
: t7 k- L; _5 |  )
4 Z' K1 ~, t  F  ;;
* o6 T. M4 q: F' ]" D( p7 n+ Q  ;; XYZ Point values for spline points- B! z+ n3 Q5 _& R3 k
  ;; Need to account for WCS/UCS1 E0 m; }" ~1 x8 E& l  y* `
  ;;! Y5 r, y6 _( L) s; X
  (defun set_tile_data_pt (), n! e: e. G5 |% l
    (if (not (assoc 11 elist))
7 p/ c; P" }! y# E/ W. ]$ g      (mode_tile "data_pts" 1)
$ O& c; O! ]3 T) v! g      (progn- }; t9 \, f( D8 j& }, w
         (setq data-pt (cdr (assoc 11  elist)))
, I' y. X$ J" @7 [2 ]* V$ k         ;; display points with current precision.
; X+ x3 E5 [" y9 g: h) b         (set_tile "dxtext" (rtos (setq x1 (car data-pt)))). T* M% I0 L, Q0 I7 d
         (set_tile "dytext" (rtos (setq y1 (cadr data-pt))))
& K% r/ D. n: A  u         (set_tile "dztext" (rtos (setq z1 (caddr data-pt))))
( F3 n' [# p( A% f5 O1 O# v" E      )
$ K8 c( @- H" |/ N5 j    )
. ~8 |$ W# E9 @8 u1 f! X  )
/ n: r  D5 w+ `, O  ;;% c8 m2 j" ~) |  ]- O! w; S% G/ ]8 `
  ;; Fit curve, fit spline, or smooth spline surface setting5 E+ l* J$ V" \
  ;;) K2 S; r- t; `4 \) C2 j6 z4 ^4 P
  (defun set_tile_fitsmooth ()
# Y6 D0 p& ]: K/ C7 g: J    (cond) C6 c- L- {% ^4 q) ~" j: Y
      ((= (cdr (assoc 0 elist)) "LWPOLYLINE")
, ^. |8 X) y$ [7 ]! b        (set_tile "none" "1"), q+ R) b) ?7 ]# n
      )$ N- p" }  I2 L& j! z6 u3 b2 @
      ((= (logand bit70 4) 4)
9 m7 ?; q. I4 [2 x% d! v- q       (cond9 X# o) Z, x* b) w
         ((= bit75 0)
6 c- w( b8 ~% l( q" @, b7 f  U           (set_tile "none" "1")
2 j1 g" A6 O5 Y( Z9 X% {5 w4 O1 U           (setq spltype 0)8 X! P, ^+ Z+ t% y4 M3 f
         )1 T- [1 ^0 @  k) a
         ((= bit75 5)
9 a$ y: `. G3 x/ ?& N# _# K           (set_tile "quad" "1")$ y# {5 D7 u; s) Z& u
           (setq spltype 5)
( @: M3 r# x. B6 R7 f% @3 j         )
5 w* B2 a% Q! Y" Z. [         ((= bit75 6)$ M& p3 y$ T/ |# {
           (set_tile "cubic" "1")# u$ e3 Y8 \$ I) x' D
           (setq spltype 6), C3 r) m. ^6 d
         )9 y, p0 Z2 n% Q1 r# A  O
         ((= bit75 8)
. u- @6 N- K" p# H  K           (set_tile "bezier" "1")6 ]' B  g3 Z- ^! e" U5 S8 F
           (setq spltype 8)4 W, L1 k) I1 N% I, ~: a, @4 E  ^
         )
9 B: Q8 X1 T3 K- ^7 V+ k" g0 z: i       )6 j2 |& u$ M7 V/ V/ n) G6 S
      ). m/ n4 i( `/ |) t$ `( {8 N; p
      ((= (logand bit70 2) 2)* @) q! A: x7 H  W# C0 h: w7 b
        (set_tile "fit" "1")
) I) q* I! t' w& t$ T9 K% u  r        (setq spltype 1): _. {7 U8 m1 S# r; O8 l/ x
      )  Q8 V  ?; P. h# w
      (T (set_tile "none" "1"))+ S  S8 N$ r6 E% ^4 O
    )
, {) Y2 J% `& L5 \5 ]# L  )# ]+ V7 M6 _) F/ f8 t0 N
  ;;9 H* m7 t6 ?, k: e$ i( k
  ;; Closed or Open mesh and polyline setting/ t& g3 P" P/ S$ M) t. S
  ;;
. k$ ?) W( R. H& y0 N) N6 o  (defun set_tile_closed ()4 _( c7 S, ^% D
      (if (= pltype "3D mesh")
) A  e1 k7 J- D2 T6 R: r2 n        (progn8 R+ k+ r! a* C$ L4 }& E
          (if (= (logand bit70 32) 32)1 O% {+ L& N  L9 \& s; Q. r( D
            (set_tile "closedn" (setq closedn "1")): H7 p1 W" o+ k2 v. Z$ V
            (set_tile "closedn" (setq closedn "0"))+ Q+ _$ T+ Y. o4 j3 Y
          )9 {9 O  F' ?5 K0 U) C4 V
          (if (= (logand bit70 1) 1)/ b7 z) R; W5 c  j7 o9 N1 Z3 o, Q
            (set_tile "closedm" (setq closed "1"))
4 k2 c% y0 }! O# x; K% b' L            (set_tile "closedm" (setq closed "0"))' I0 V% Y+ n3 a1 `# x7 m
          )
# q! K3 ?; M+ ~$ w8 y' A4 X          (setq old-closedm closedm old-closedn closedn)
+ y- \, g- `4 t        )
( M! ^" R  ^4 D0 O' X$ I3 [      )
- Z- q+ ^& A- |6 J6 `* `      (if (or (= pltype "2D polyline")
' k$ q2 O- v6 @              (= pltype "3D polyline")
6 b9 `% y/ }* J8 ~9 ]8 o          )
" d; e+ B: m. z, V% P$ ?8 G        (progn, h/ R7 H5 u5 P9 a
          (if (= (logand bit70 1) 1)
) e8 T2 K3 P+ U# E  [2 U            (set_tile "closed" (setq closed "1"))4 F' t7 B1 E2 u# ^
            (set_tile "closed" (setq closed "0"))& {6 Q4 O3 |2 z/ Y# V# e% ?( m; N
          )- ~( _+ s$ \" j) a6 g
          (setq old-closed closed)
  o4 L& S$ |$ n        )
, e% l/ v7 I8 n7 L      )9 B3 p& l; w! \
  )
4 y& |4 m, \8 Z  ;; Set common action tiles& m. ~% B" s/ D9 S7 U
  ;;
, U, w4 H+ n7 h% {, e. w  ;; Defines action to be taken when pressing various widgets.  It is called
2 |/ M. @3 E4 E+ F) u" m4 o  ;; for every object dialogue.  Not all widgets exist for each object dialogue,
% F, Y6 n" ?3 l+ ?% \  ;; but defining an action for a non-existent widget does no harm.0 d) E" V! X+ b" J8 w
  (defun set_action_tiles ()" K+ l6 `3 X& ]4 d1 l
    (action_tile "cancel"       "(dismiss_dialog 0)")9 K. V; ?/ P0 B3 s5 Q5 E4 p4 I' Q
    (action_tile "accept"       "(dismiss_dialog 1)")1 u4 ^  @! b' S, `
    (action_tile "help"         "(help \"\" help_entry)")
7 o: Q7 {' |, Q1 S6 K7 [, ^    (action_tile "b_color"      "(getcolor)")
3 C* O/ d% ^( r8 |( P0 L    (action_tile "show_image"   "(getcolor)")$ E8 Z; R7 Z0 [7 g6 F7 K9 t
    (action_tile "b_name"       "(setq elayer (getlayer))")2 S1 {% x* {$ {
    (action_tile "b_line"       "(setq eltype (getltype))")+ p) X; h/ B6 H  c8 ?
    (action_tile "eb_thickness" "(getthickness $value)")
) Y0 a; t/ u# P  O    (action_tile "eb_ltscale"   "(getltscale $value)")
& a& T0 K/ N) b4 s: K4 m' o$ S8 s8 v/ a( n9 i  P8 J; ]
    (action_tile "pick_1"       "(dismiss_dialog 3)")
* ^" s1 Q" m, a/ i5 r" Q    (action_tile "pick_2"       "(dismiss_dialog 4)")
* O+ n- ~' ?5 J3 p9 [# i    (action_tile "pick_3"       "(dismiss_dialog 5)")
$ Q3 r4 S4 N/ a0 D* W9 @6 K: h2 ~! t    (action_tile "pick_4"       "(dismiss_dialog 6)")3 V8 V1 a; w5 r+ @! c* g2 D
    (action_tile "x1_pt"        "(ver_x1 $value)"); ?* Z" I1 c  h6 L
    (action_tile "y1_pt"        "(ver_y1 $value)")1 Z$ p  r/ W9 u& e# x3 o
    (action_tile "z1_pt"        "(ver_z1 $value)"). B) |8 D2 @( ?
    (action_tile "x2_pt"        "(ver_x2 $value)")
* a, Z$ q1 v& P& U5 |) J    (action_tile "y2_pt"        "(ver_y2 $value)")' q; o' r1 |7 o2 E. y
    (action_tile "z2_pt"        "(ver_z2 $value)")
7 c9 v) W, `/ Y    (action_tile "x3_pt"        "(ver_x3 $value)")( Y  D* T. F$ \) R* _- X: }% K
    (action_tile "y3_pt"        "(ver_y3 $value)")# v+ e% c7 _2 N
    (action_tile "z3_pt"        "(ver_z3 $value)")
( K+ X& l9 W. z. x    (action_tile "x4_pt"        "(ver_x4 $value)"), E5 Y; _) e7 |  u( G
    (action_tile "y4_pt"        "(ver_y4 $value)")
' A6 Y; S  ]: n; R0 V( |! g    (action_tile "z4_pt"        "(ver_4 $value)")
( n8 u% N+ h) W+ G6 Y; n
* D* G8 d" {# }8 E+ z    ;; Action tiles for Xline & Ray
( m! H4 v+ @  g. S" y& m6 L    (action_tile "xline_x1" "(ver_xline_x1 $value)")
6 x( v* p' B( c    (action_tile "xline_y1" "(ver_xline_y1 $value)")
5 Q; p' c4 g: K- K) L+ r    (action_tile "xline_z1" "(ver_xline_z1 $value)")4 w9 b% n% X. ~6 `
    (action_tile "xline_x2" "(ver_xline_x2 $value)")) y- s0 S" a5 j0 U. d
    (action_tile "xline_y2" "(ver_xline_y2 $value)")
; _) C, f1 i6 S/ E0 S    (action_tile "xline_z2" "(ver_xline_z2 $value)")7 D% q' L8 ^- r/ [5 H
& K/ o* i% b: y! x$ x2 @$ f* O; v7 I
    (action_tile "edge_1"       "(setq edge1 $value)")1 s  j. k' @1 p
    (action_tile "edge_2"       "(setq edge2 $value)")5 {7 {2 Y- n6 |4 Y9 a  K
    (action_tile "edge_3"       "(setq edge3 $value)")4 }/ K! ^. j* b/ ^' _
    (action_tile "edge_4"       "(setq edge4 $value)")
8 ?" E& @( b. Y9 d" Z, U3 B5 B( M
7 Y3 `$ O& p* {4 T: O- V3 X0 D9 ]    (action_tile "radius"       "(ver_rad $value)")
, ]! J8 k6 o/ Z5 D' ]) L* f    (action_tile "st_ang"       "(ver_ang1 $value)"); i& J2 m0 m) J' v( _0 G
    (action_tile "end_ang"      "(ver_ang2 $value)")0 w) W- E* t$ M$ E6 f6 R
    (action_tile "end_eang"     "(ver_eang $value)")
* {# z7 R! z1 F0 W' p    (action_tile "minrad"       "(ver_minrad $value)")
4 ?7 F/ q5 S5 O, |+ ~  ^# `2 n$ g    (action_tile "majrad"       "(ver_majrad $value)"): q% d3 P1 z! V/ M9 s5 C

* X7 S3 H- ~3 ^! @' v    (action_tile "xscale"       "(ver_xscl $value)")
) f$ k4 ?* n$ t8 Z/ ~$ |0 _    (action_tile "yscale"       "(ver_yscl $value)")
6 i, |! r: @! d( F9 P    (action_tile "zscale"       "(ver_zscl $value)"); s9 U" i( x4 b7 v! e( U
    (action_tile "rot"          "(ver_rot $value)"). ^4 i  _* t8 n2 x$ U- J
    (action_tile "columns"      "(ver_col $value)")
) @+ V. L, p" m% F7 w    (action_tile "rows"         "(ver_row $value)")
3 }1 u3 n6 n5 h( O4 S4 r    (action_tile "col_sp"       "(ver_colsp $value)")
. ^6 o! e$ W; X2 G) v    (action_tile "row_sp"       "(ver_rowsp $value)"), h/ K" O$ H- q5 [) k5 u

/ H0 Y, p- m' M    (action_tile "hght"         "(ver_hght $value)")
. K4 l# `$ P  E! A    (action_tile "wid"          "(ver_wid $value)")' R' K0 v% |) e7 I# O) A& H
    (action_tile "obl"          "(ver_obl $value)")% Z; i2 \  V5 f2 O6 `, w
    (action_tile "style"        "(style_act $value)")
3 K; s# G: G* d% a. V1 I; `
& n$ {7 u5 b7 ^  A. n9 q  c    (action_tile "t_string"     "(ddgettext)"), ^+ r7 L- a+ H; l
    (action_tile "tag"          "(ver_tag)")# F2 e( ]+ F* C( |
    (action_tile "prompt"       "(ddgetprompt)")
7 Z$ o' [' w* E: E# V2 s0 Q7 o    (action_tile "bkwd"         "(setq bkwd (atoi $value))")( I( U3 Z- ~5 a/ G& m! Z
    (action_tile "upsd"         "(setq upsd (atoi $value))")
8 Z5 i4 A/ g$ n' k    (action_tile "inv"          "(setq inv (atoi $value))")
$ g) q. F6 a3 z/ T- S2 V. ]% ^* p    (action_tile "con"          "(setq con (atoi $value))")
: D2 a7 I6 V2 Z- C/ c( J    (action_tile "ver"          "(setq vfy (atoi $value))")
  @+ k& C% R7 C# Q* `$ F+ w    (action_tile "pre"          "(setq pre (atoi $value))"). K7 F! K: D' C; {0 ?5 r* f
    (action_tile "popup_just"   "(jlist_act $value)")" F0 Z, u$ l  A: ^/ t3 h3 Q

; S9 E6 e9 R, Q4 Q* s2 \    (action_tile "closed"       "(setq closed $value)")% y2 f# b6 F6 {& k0 c: F% N2 f
    (action_tile "ltgen"        "(setq ltgen $value)")
; E. F& P: I8 G' H) ~4 N2 w    (action_tile "closedm"      "(setq closedm $value)")' M+ a# j3 `1 M- J' c
    (action_tile "closedn"      "(setq closedn $value)")3 o) T7 @6 ~0 A3 C
    (action_tile "next_v"       "(next_vertex)")" z" G/ Q8 ?7 h# Z: O, C
    (action_tile "xcliponoff"   "(setq xcliponoff $value)")/ ?6 X; o, G  P+ q) s4 M
. F/ C- M0 g- N" ?; D
    (action_tile "next_cntlpt"  "(next_cntl_pt)")
! Y" F5 t6 j. q" L    (action_tile "next_datapt"  "(next_data_pt)")+ x7 @$ V4 V: B5 @& `

  L* g! |2 Y* d    (action_tile "none"         "(if (radio_gaga \"none\")(set_uv 0))")
2 Y, q  Y2 F! B4 `+ L    (action_tile "fit"          "(if (radio_gaga \"fit\")(set_uv 1))")1 D' l" r/ b3 S( y: y7 @/ N: y5 |
    (action_tile "quad"         "(if (radio_gaga \"quad\")(set_uv 5))")9 W/ j2 H& Y% ^! h2 t, R; d
    (action_tile "cubic"        "(if (radio_gaga \"cubic\")(set_uv 6))")8 L+ Q! z" w" V$ M
    (action_tile "bezier"       "(if (radio_gaga \"bezier\")(set_uv 8))")( B# h8 _: ?6 N& F

& Q0 K1 B/ P" `+ E    (action_tile "u"            "(ver_u $value)")* l, w, y2 N2 k  Q
    (action_tile "v"            "(ver_v $value)")
0 R2 T, f% Z* d! F$ e; o' d5 ?  )* X, z+ |! ?2 g9 a3 Q: q
1 f# f5 H3 D, w
  (defun ddgettext()
. U/ w( ~* ^) ?' q7 Q    (setq text (get_tile "t_string"))
* @0 e: E2 f5 N  )
$ b# M* M1 X7 f/ ~7 I# v3 u9 f6 q0 T, i* j6 Y" j6 ?2 @
  (defun ddgetprompt(): H/ i$ A! J1 f2 j: P
    (setq atprompt (get_tile "prompt"))4 ^8 z8 w" u  o  b; C
  )
7 R  q) i7 f% ~! U* s2 T; b/ \
6 r& H2 R3 V* a0 T& O  ;; As OW doesn't support disabling of individual radio buttons within. z9 ^/ u; f; B2 j
  ;; clusters, a check must be performed as to the legitimacy of the
% ~8 \! O7 q- f1 S) Q9 @& g  ;; button pushed and reset if necessary.: J' t# k' {4 v; S$ j
  (defun radio_gaga (pushed)4 Y1 v: [6 j* _/ I6 e: l
    (cond
: e6 {( c* V9 a" }! g; V      ((and (= pltype "3D polyline")+ H' `! |* w! ^/ F
            (or (= pushed "fit")
3 n" f' D1 x* ~1 H/ Q; _$ w                (= pushed "bezier")4 @) X! ?9 D! W" ?
            )
5 G6 C3 r; E. j: @       )
! ^# P$ U. J# z- n! y( I4 C        (set_tile "none" "1")/ z7 K4 f$ k7 c0 f$ z- G" \
        nil3 A; f0 l& h* _
      )
0 [4 D( a# D7 k( U$ D$ P0 N: l      ((and (= pltype "3D mesh")
& W7 @" k) x/ }/ P+ R7 e/ s            (= "fit" pushed)
4 T0 p) M) s8 p/ l7 e) _       )
, o* l* w" {& p' J        (set_tile "none" "1"), _6 W5 Y5 E! S
        nil9 m. T* z3 U/ z& ]
      )
. G0 J8 Q, F! W$ K$ t; k      ((= pltype "Polyface mesh"): o/ S9 ~! ]! {* A
        (set_tile "none" "1"), [. [! B/ z5 t* u  \
        nil
1 z% P; x5 s" K6 l1 r0 n      )
; c# ?: J5 U" u/ ^* Q; M, s      ((and (= pltype "2D polyline")0 r! H4 Z. _6 }9 U
            (= "bezier" pushed). Q0 o. ^4 `# a& U) v" g
       )( a0 K% @* @- B' {3 Q8 I- N7 O
        (set_tile "none" "1")
4 x7 s/ O4 ~* V2 ~& Q5 X6 \        nil! C" F3 [" d- ]7 p% j4 C! ]! j
      )
. R! O/ f8 J2 [9 R& |      (T)+ w! [+ M) I* L5 s! S
    ), `, y/ i) e: {  N" ?# A5 u$ l
  )
) B) M8 [, t6 K( A3 H  ;;- _: _: M) Z8 W- R! ^' k
  (defun set_uv (type_n): l" T& e' B* g( f
    (setq spltype type_n), ~% F8 V, C) Y; p2 R7 h8 b
    (if (= pltype "3D mesh")
/ b0 m( {' ]% q/ }6 s* l3 T: v      (if (= spltype 0)
8 [' Z: m8 |0 [( _: S        (progn2 W3 L- I5 P5 J; L/ b8 @
          (set_tile "u" (itoa (setq u 0)))
7 _. d7 Z; ~) W+ w' o) n( o" T$ @+ F          (set_tile "v" (itoa (setq v 0)))$ z$ F0 i  c9 L) E/ Q. t
        )
$ f7 A( X  U- g! Y0 z        (progn5 J0 R0 [/ {' D( d! M
          (if (= u 0); D, u. d4 G" v* I. U
            (set_tile "u" (itoa (setq u (getvar "surfu"))))
7 i+ r% w8 k+ u& @          ). j# e% P3 w$ ]: |$ W1 k
          (if (= v 0)
. y3 I' }! [( h+ e6 I1 G1 a! G            (set_tile "v" (itoa (setq v (getvar "surfv"))))( J8 E7 t5 g, y) g
          )
  m& Q/ @5 _* E" W2 g9 h        )6 R! n: M# @% H' `+ Z5 o
      )
' R3 n7 z: J7 r. _, v7 Z    )
2 q' y- }- X1 K; V1 x  )
: Q( G9 r/ F8 c0 z$ j4 p- ]' K* n6 k* i* g

9 B4 o. F3 H- E$ D: P7 c  ;;3 Q6 n. W0 O, E4 m$ S/ Q
  ;; Verification functions
3 ]" C9 D4 D2 b  ;;
* J; o6 |3 j) x3 _' K; D" z  ;; Verify distance function.  This takes a new X, Y, or Z coordinate or
5 ^3 I1 J( H9 `' O/ c6 U% F2 A  ;; distance value, the tile name, and the previous value as arguments.) J% D4 _9 S' H
  ;; If the distance is valid, it returns the distance and resets the tile.
2 ~9 @7 z( Y! d& B# [* E  ;; Otherwise, it returns the previous value, sets the error tile and keeps# J% w) w) i; m. a. B( i
  ;; focus on the tile.  Shifting focus to the tile with invalid value can) ^0 {4 g, J5 ^) C& m1 j& E: T- I) \
  ;; trigger a callback from another tile whose value is valid.  In order# ?1 u: W5 Q; x, C1 z" ?
  ;; to keep the error message from being cleared by this secondary callback,
+ q, J% L$ c7 x' C: E; k( o; z  ;; the variable errchk is set and checked.  The last-tile variable is set2 O8 ]# [$ P0 V8 H( w
  ;; and checked to ensure the error message is properly cleared when the7 {. `/ c. _+ a/ Y4 H
  ;; user corrects the value and hits return.3 z  ]# |! Q+ B* `4 _( L
  ;;8 D$ q+ ]& v1 p
  (defun verify_d (tile value old-value / coord valid errmsg)
& @; H9 C4 _* Y5 [    (setq valid nil errmsg "Invalid input value.")( F& X, g( p$ Y; f8 _9 \0 r
    (if (setq coord (distof value))
4 Q  F0 n, ?# F# [      (progn
$ }7 a  V* |9 a" Z        (cond9 w% Z- Z% O+ j7 K& E0 \
          ((or (= tile "radius")
* ]0 `7 i) O7 \8 V$ T# H% q( n$ s               (= tile "hght")
; S. P# r6 J) b               (= tile "wid")+ i5 U2 H8 {: L  W4 F+ N. q7 s. R
               (= tile "majrad")+ M7 m8 n' U, ~8 R# q! A9 p/ N
               (= tile "minrad")2 r) X0 _) R4 Z) R" t0 Q
               (= tile "eb_ltscale")
/ \$ q3 e3 S1 q3 z           )' p: N  q* s- y; `4 e) D
           (if (> coord 0)
) H+ C" i& k: \5 d1 v; i             (setq valid T)( q: }; h- {! ~: s, n& h; \
             (setq errmsg "Value must be positive and nonzero.")
8 l6 F' B, S* I3 x( G           )
) |, D+ [6 {+ {          )
& r* {9 T' R8 h- w' @6 i; Z          ((or (= tile "xscale")
. x+ N; O; l6 n' N5 e, v! O               (= tile "yscale")
+ |* [/ @6 y0 g) f               (= tile "zscale")7 u/ ?3 u8 C+ k- K1 Q& T% l8 j
           )" y5 O* s2 W' {; O. K+ `$ a5 a7 H7 a
           (if (/= coord 0)
7 o; C! ^, H4 d/ @2 x) Q             (setq valid T)
' |( X+ Q8 r4 b# m% h1 s9 n6 W. v* k+ `             (setq errmsg "Value must be nonzero.")& }+ K8 J, B5 J2 S2 v! @
           )
$ J; R" X( g, [5 D' y6 L; F1 T          )
" O5 r9 Q8 o0 T) P9 N          (T (setq valid T))
) e# Q% x  U& ]7 E$ U        )9 E/ a. l! d9 V' ~: D! ~+ J
      )! m3 K0 ?; ?, u) c$ t6 O2 W
      (setq valid nil)
1 L, `8 E: w$ H* N4 r% L* p    )6 p) u) l1 I; Y  d4 y4 i9 x
    (if valid% g! M0 B# G. I
      (progn
% {8 |& k: y2 K: y# ^- \        (if (or (= errchk 0) (= tile last-tile))
9 W4 g9 u: _: R          (set_tile "error" "")
- |5 e* R! _% {# J1 K        )
; _1 g8 ]7 I: b) R8 v+ m7 S% \5 o        (set_tile tile (ai_rtos coord))6 B6 _8 z, c1 ?7 M
        (setq errchk 0)
3 ^* R6 L0 Z8 F+ o/ e' M        (setq last-tile tile)/ [0 W/ t, k! w
        coord) P# T4 `" q, R7 _
      ): K& @: B9 A* _4 u; Y. q' c
      (progn
, b- a# O+ U; ~5 Y0 U, \! [        (mode_tile tile 2)            ; Move focus to offending field; K) F0 i) ]! ^3 [. f1 y5 U7 N6 `
        (mode_tile tile 3)            ; Select offending text' ?  T4 J! H6 J
        (set_tile "error" errmsg)8 f2 f" U# t- f: i, }* @9 T/ Q
        (setq errchk 1)$ n1 H& T( `! f: f, j1 ?
        (setq last-tile tile)
, W( z, A& [% O3 U6 t6 x        old-value
4 n* U5 Z" M" g      )
* ~  \( I6 O$ }. D6 R# U5 c    )
1 d  b) a, H3 U3 O) E  )
" X" f0 J2 p$ }1 V4 P: v) M& |  ;; Function for Xline coord edit box checking.
) f/ S; l$ g; S- E5 W/ n: O5 I  (defun verify_xline (tile value old-value / coord valid errmsg): n4 \0 j. y1 k
    (setq valid nil errmsg "Invalid input value.")
5 `) U* J" s; P! x" T. @8 u5 o    (if (setq coord (distof value))
1 c$ O+ T, Y8 u+ x  T0 m/ C      (setq valid T)+ z3 i2 L! \7 F: u' T  a3 q
      (setq valid nil)" _" \, I5 x/ ?# q# g1 p
    )
" c# l" ?, N: H! T0 m( h5 M0 J6 t2 e    (if (and coord
2 U" P" j' r% M) L( E9 d! Y          (and (= (atof (get_tile "xline_x1")) (atof (get_tile "xline_x2")) )
2 x0 y/ ]6 C9 _& k4 P3 R/ X               (= (atof (get_tile "xline_y1")) (atof (get_tile "xline_y2")) )8 M. }' ]& K4 b
               (= (atof (get_tile "xline_z1")) (atof (get_tile "xline_z2")) )# U1 c3 M4 [0 Z1 O' d, f; V
          )  Z6 ~% `1 s; S
        )
4 m' c2 z, Z! ]! N       (progn+ f2 }. N$ n8 ?+ [) T2 D) s
         (setq errmsg
' {$ m1 h0 h! Q5 {                  "The Root point and the Second point cannot be equal.")* M+ G2 i, H8 p$ ~# b- ]
         (setq valid nil)9 H  i# B9 h2 D' g3 B3 Z
       )
: ?3 [; e5 b* Y8 ?% }    )
  N9 W7 N7 k) N    (if valid# r# o5 z5 @2 j+ {
      (progn
: P3 e: s( N3 e7 C1 I7 `1 N0 J        (if (or (= errchk 0) (= tile last-tile))! m6 }9 V  d) {
          (set_tile "error" "")
9 z# N0 ~; C" ?0 Z1 J) p) u0 G        ). t" o; s& U& ]: T8 T+ E
        (set_tile tile (ai_rtos coord))2 ^7 i" ^! ?2 Q& C
        (setq errchk 0)! {- p, A0 F4 m
        (setq last-tile tile)
8 g2 i+ f- J$ q0 R+ s# s. R        coord
  n  E, J% {0 I  D- ?8 k( |8 b. m      )/ k7 s2 n& ?4 o4 k
      (progn
% O' U' i  d4 v0 J4 a        (mode_tile tile 2)            ; Move focus to offending field
0 ]/ o5 z# w, N9 f- o. q        (mode_tile tile 3)            ; Select offending text
, {7 ?) o; ^# f+ n' |        (set_tile "error" errmsg)! ~5 W7 U% ?9 r
        (setq errchk 1): x4 j# h# |7 m3 B( N
        (setq last-tile tile)
; I# n: L; o2 E: p2 l. X        old-value
  _  Q. V. m& M! u- d      )1 U& g5 q0 J% {! [- n# [
    )
, ^6 [% {' a1 N2 f, A: {  k  )5 q* `# y3 D8 T9 F, y9 H; Y
4 w3 V  h( _- L5 W0 p
  ;;
& Y5 Q* x" h5 I  ;; Verify angle function.  This takes an angle and a tile name as arguments.* Z- s9 ^1 Q0 s; z
  ;; If the angle is valid, it returns the angle and resets the tile.
4 C6 O* Y- Q  v2 ~& Z% o  ;; Otherwise, it sets the error tile and keeps focus on the tile.5 e/ p+ u' M' b0 s; ^( o6 f
  ;;  v, g" n) I- S3 ^
  (defun verify_a (tile value old-value / ang valid errmsg oblqmax)
& Y* T! n# j9 g/ C* Q0 e3 r    (setq valid  nil7 e% P! R! _+ v, i9 |
          errmsg "Illegal input value."
+ d$ ?; j  D/ A$ J    )
& J1 b5 g- y# Q( Y- D    (if (setq ang (angtof value))! j1 @# \& E; c& U* T# {3 t+ q. E
      (cond# V* a2 d3 E3 ]( H
        ((= tile "obl")               ; Restrict obliquing angle" w! k# F  B; k) y1 v! J2 ~
         (setq oblqmax (+ (* (/ PI 2.0) (/ 85.0 90.0)) 0.000001))9 |8 F2 c2 V3 v2 g( i* X
         (if (or (<= ang oblqmax), |& F! ?% ?$ J
                 (>= ang (- (* 2.0 PI) oblqmax))
1 a4 u2 c( V7 L* \7 X3 _7 |% d  j             )9 y+ ~( ]! @* t* [+ _. B% P/ @
           (setq valid T)$ e. P; _. i8 C/ R1 a9 ~
           (setq errmsg
2 r) j( Z8 f  _" J                 "Value must be between -85 and +85 degrees.")
5 J) }5 {- v+ B         )
$ B" D& w( L! r8 @" P        )
& v' i8 v: k8 {- l) ~        (T (setq valid T))            ; Other angles not restricted$ t0 j: u/ V1 c& @' r0 Q" a
      )
0 c5 D6 A8 x& F/ }      (setq valid nil)                ; Invalid angle input
" I( K; ^: n; I7 o' {( q( \    ): G2 {  _% y2 a1 ^% _
    (if valid
  p$ M" d+ N( V: P2 Q) l4 M      (progn
/ F6 I: p. k( C! f8 ^3 \4 ^        (if (or (= errchk 0) (= tile last-tile))2 f8 a; W5 t  U' r# D
          (set_tile "error" ""); F; e- s( x+ ]# K5 y9 S
        )' l$ P: b1 r1 x, i- o
        (set_tile tile (ai_angtos ang))
+ v- r* w. w2 B        (setq errchk 0)$ _8 m# D# u' }8 a/ _
        (setq last-tile tile)4 H; z8 A8 r: F) Z! z8 Q
        ang, j2 W: F4 L7 K7 p' H3 ]2 l3 E. f
      )
- h7 l+ S: k: m8 s; `      (progn
# ~0 P$ l" p& ~$ t5 N        (mode_tile tile 2)            ; Move focus to offending field
- h# ~) F% B( H        (mode_tile tile 3)            ; Select offending text. g& ~0 }3 F- c. h) N& p
        (setq last-tile tile)
% I# r' C) V& N( F        (setq errchk 1)+ J) r6 c3 h5 V7 G1 V% y
        (set_tile "error" errmsg)
5 F! p2 F. u2 k% o6 u# S4 C2 e7 n0 z        old-value: N$ j: G# b- {! V9 k9 g
      )
# d! n( P( `3 A" r$ W3 E    )
" o/ R, l8 S  K  )
; M$ P% l; }. \7 m" Q( h# N; ]* a( C  ;;
8 Q1 r: q. {* X  ;; Verify angle function.  This takes an angle and a tile name as arguments.
6 [' T" Y0 \# s1 t. C/ D  ;; If the angle is valid, it returns the angle and resets the tile.
% c* c/ Z% C# u& g/ w- \  ;; Otherwise, it sets the error tile and keeps focus on the tile.. ^5 f- d- t& Y5 |' d# W) H
  ;; This function is specifically for the end angle of the ellipse object. If
7 z9 T; Z6 ~+ X2 M$ @' r  ;; the end angle resolves to zero then we want to display it as 360.
" A: ~+ _5 D% }. u) c' \( W  ;;, R& `/ J1 m$ L9 D
  (defun verify_ae (tile value old-value / ang tempend)
7 {, e6 `0 J% ~8 M; d* h    (if (setq ang (angtof value))9 h' q0 V$ p2 d/ O( P
      (progn/ X2 y9 G  n* o* c* \
        (if (or (= errchk 0) (= tile last-tile))
0 h! b1 u- g; B5 x# O, ?: a          (set_tile "error" "")% N0 w8 p5 j( a# d$ S6 v: v
        )
; m2 u3 Y3 H( }% v- `& r        (setq tempend (ai_angtos ang))
& j! K7 H4 K( }! N- I# u        (if (= tempend "0"); H' C$ Y7 x) H" [
           (set_tile tile "360")4 L# l; S4 |- j1 M
           (set_tile tile tempend)
4 p: y: F( Q* N# ?. U) W        )# l7 A* Z- N, A; v/ v$ {: m# y
        (setq errchk 0)$ F" i+ Q, }# ~. C8 p( F6 o
        (setq last-tile tile)
& _: H; F: U: S. g3 S, f8 y4 b        ang6 ~+ c3 R% [) }8 u% y
      )
7 B; X; v6 [/ p5 |* x% C9 n      (progn
4 W/ `, u4 K: H& K, G& O* I        (mode_tile tile 2)            ; Move focus to offending field
! Z/ `- A( Y8 Z        (mode_tile tile 3)            ; Select offending text
& p* l$ S& w6 H" K8 \, V) U  \6 _+ h        (setq last-tile tile)
* B2 e; F! s+ M        (setq errchk 1)
0 V6 l2 W1 i6 z8 W        (set_tile "error" "Illegal input value.")
2 I; A0 J  p3 v! ]" b        old-value6 ?1 F4 c; L1 T+ W% I8 r6 a- X& e
      )7 [' @4 ]) l8 q7 s
    )
9 ]. |% G, l* N& r6 l5 q" U  )
* I  }2 ]* t+ y. M) R0 X8 _  ;;
" {3 k: t* ~5 |, P0 `, [, i  ;; Verify integer function.  This takes an integer and a tile name as  s) u; L1 \7 V" P: H
  ;; arguments.  If the integer is valid, it returns the integer and resets the
% c* S' ^$ j8 N% N- A) K: b  ;; tile.  Otherwise, it sets the error tile and keeps focus on the tile.
/ n5 ~2 T) r4 u) O, S. i  ;;
9 C/ O/ M" T/ h$ q, Q% \  (defun verify_i (tile value old-value / int valid errmsg)
/ y6 g8 u/ G" c2 H- ]* p- w    (setq valid nil)
% y" P% p' v# C    (setq errmsg "Value must be an integer.")- v: {9 |( ^+ N) R4 W
    (setq int (atoi value))3 p3 ?* J: ?4 _; A& k  d% E$ B
    (if (setq intchk (distof value))# c7 f  l' |9 j( w! z1 _
      (cond
5 u3 M5 q% v; H        ((or (= tile "columns") (= tile "rows"))
- @, x8 Z7 V" B! i         (if (and (= int intchk)/ [& h* E: {9 a& }1 x
                  (>= int 0)
! c6 X( P# V9 p6 b  R                  (<= int 32767). l; O% X; z! M6 S0 s
             )8 x6 b- [- i! u& y) z
           (setq valid T)
0 M/ E7 `; S0 _' p* e  P           (setq errmsg "Value must be an integer between 0 and 32767.")
+ R/ M+ j) q3 V, _/ x) @         )7 O+ r6 D( ^& m3 r, `2 j' ^
        )
; z! n+ f9 J$ d! ~9 k        ((and (or (= tile "u") (= tile "v")))) i$ \0 Q& \! D
         (if (and (= int intchk)7 h# n' G) M. d
                  (>= int 0)/ h8 }6 l" f9 f8 h
                  (< int 201)
7 a7 V! J& B# p- d# L( p; J! F             ), C0 c8 p2 |" R+ [8 n
           (setq valid T)
% @1 G+ K$ G3 q: n" o6 f( F           (setq errmsg "Value must be an integer between 0 and 200.")
+ E0 m) y$ Z& m& a% R. _         )
& R1 Y/ c0 |/ E/ U0 c( w" G% O% J        ); q6 G+ J5 c+ m0 N+ \8 S
      )- T5 E' V0 ]0 |) v0 {* I$ N
    ): j3 l! q& m2 U: w
    (if valid: H. {- t6 F4 Y, N* O
      (progn  e- i3 N* b% B. E4 [1 Y
        (if (or (= errchk 0) (= tile last-tile))
6 E* k# H1 `( x            (set_tile "error" "")
" @0 V, e0 f0 ?! K* A        )
3 V/ B0 {& |* U9 D& r        (set_tile tile (itoa int))
# v6 A& X/ W& r/ r. ?        (setq errchk 0)
, P6 p" [9 I0 c1 I( {6 l        (setq last-tile tile)
2 E+ z$ S: O0 g        int, I! [  z& s, u2 h9 f5 a# {$ U
      )
8 O' y3 @) Z. \$ K) ?- ^4 X1 m8 o      (progn
7 d0 W( y4 l; f2 \. C! L- a4 ~9 |        (mode_tile tile 2)            ; Move focus to offending field5 f; a% t) F: ]8 P6 O/ P7 ^: k1 k
        (mode_tile tile 3)            ; Select offending text
$ B6 ^; Z4 a& p+ V+ e        (set_tile "error" errmsg)/ m2 ~3 y  m4 |$ q4 ]
        (setq errchk 1)2 R# X2 o/ R" Y: p' S' U! O
        (setq last-tile tile)
/ T# W; t5 G: Y6 c        old-value
/ M( T4 q7 {3 k      )7 }3 K7 x5 b9 a8 c- k4 y
    )
- C1 n0 ]% B$ A  )4 c# Z/ A# N+ u" z
  ;;
( D' r* U; g8 W6 h6 S  ;; Functions that verify tile values for integers
; G: N% S, T. y" b" b  ;;
; u1 g- i" @, U) s4 A0 H  (defun ver_col (value)
$ t) x( w  _' x: A7 Z8 K    (setq columns (verify_i "columns" value columns))
7 _& ]9 z* P8 W1 a7 D  )
5 h  l, Z: l8 ~4 d8 n- s( L0 i  (defun ver_row (value)9 |6 z3 Q1 k: P; I! O- O& b
    (setq rows (verify_i "rows" value rows))/ H/ S- Y+ w! r% G9 `( Q9 W2 ~
  )
/ ]- K% {! L5 Q' X  (defun ver_u (value)
" F6 D7 D4 Y) u9 l2 z6 L. C    (setq u (verify_i "u" value u))
' n* ], W: a9 T! o/ g  )  i: j( c& j7 G
  (defun ver_v (value)
, J& P5 w; ?% M  W    (setq v (verify_i "v" value v))0 p; T5 g5 |9 N, Y4 c4 T- B
  )
1 T1 E' z2 R" y/ y  ;;
% ?' E. w# ~" O* V( q) u  ;; Functions that verify tile values for reals4 I7 D) C8 ?. H; u4 m4 }$ n- d
  ;;
. _  e/ j$ A" a, f5 T  (defun ver_x1 (value)7 v9 V- {+ J! Z
    (if (setq x1 (verify_d "x1_pt" value x1)) (calc))
+ @. |7 W, ?! i' J6 E9 {# V9 {" ~  )
+ M+ a% V% N  X% w7 r  (defun ver_y1 (value)
( f; D3 w' W; |/ l; I    (if (setq y1 (verify_d "y1_pt" value y1)) (calc)). X& K3 Q/ O' v! g0 n- |# S6 e
  )
7 A0 X$ s5 \3 ]; J$ D  ~  (defun ver_z1 (value)
4 p2 j! H# l- d) K    (if (setq z1 (verify_d "z1_pt" value z1)) (calc))
& p) M  [, r% ^- ]# m7 h1 s  )& y' L- p8 {; i8 E( b
  (defun ver_x2 (value)
# h9 J1 K1 Z+ |6 ~% u' z" @    (if (setq x2 (verify_d "x2_pt" value x2)) (calc))7 a" @2 _1 B1 p& h6 o
  )5 p  C, C  O3 G6 p/ f+ f- j0 I& W
  (defun ver_y2 (value)
0 g# E1 x% v, K/ w# Z& O( q( Y    (if (setq y2 (verify_d "y2_pt" value y2)) (calc))% m: j7 r: P0 y$ f; ?
  )
6 d, Q9 E, |8 W2 i  (defun ver_z2 (value)
: h! {5 [8 u4 [+ k/ r: n    (if (setq z2 (verify_d "z2_pt" value z2)) (calc))
4 z! _9 S; g( [3 m- b/ u  )$ U7 ~) X# _/ i: u% H$ _8 r; H8 y
  (defun ver_x3 (value)
" t& `+ H: X* |" w) ^    (setq x3 (verify_d "x3_pt" value x3))% ]9 G! ~7 d  o
  )2 l; D7 g+ u) F
  (defun ver_y3 (value)
+ S: L$ w0 K6 w( K    (setq y3 (verify_d "y3_pt" value y3))' s% s! H- A* X' ]( ]$ I
  )9 X' @/ C! p* Y
  (defun ver_z3 (value)
( H/ j- j. h& O" F    (setq z3 (verify_d "z3_pt" value z3))
, ~8 d1 e0 J) L# z- E  )/ V3 p- J. ?' H  w1 y
  (defun ver_x4 (value)
, K# ^$ u0 a3 u" j; Z$ W    (setq x4 (verify_d "x4_pt" value x4))8 R) Q6 {/ X& u3 A+ [
  )8 v! u; b/ ]* M  ?
  (defun ver_y4 (value)
+ ]+ b7 B) _- I5 q. Q7 T9 E1 E    (setq y4 (verify_d "y4_pt" value y4))4 R. O- \5 d4 H$ `- A7 h
  ): A$ Z7 F0 z6 E- i6 W8 J9 }; ~
  (defun ver_4 (value)3 B2 }! I" Y, X) j
    (setq z4 (verify_d "z4_pt" value z4))' `9 ~/ X& D; L
  )
8 G4 `0 k, u6 [; C2 ~$ O- j  (defun ver_xscl (value)$ H- a3 y: d, L) y
    (setq xscale (verify_d "xscale" value xscale))
: ~# [6 E" U6 g4 i  )
4 Q5 O- ?+ `% K, N  (defun ver_yscl (value)  u" `- U6 E: l7 x% `
    (setq yscale (verify_d "yscale" value yscale))
0 E* U2 o' r) p5 N5 F8 q' b  )
* m# b: x8 p3 `7 D9 N; a% C4 j  (defun ver_zscl (value)
. X" K1 J4 c/ B7 l' n, ^4 U. {    (setq zscale (verify_d "zscale" value zscale))
0 x+ ]1 @8 t7 l) n, R! q: U1 S  )" U# ^1 I+ c: N. \$ x. }
  (defun ver_colsp (value)
" ?* n# ]0 c) v. E* Y    (setq col-sp (verify_d "col_sp" value col-sp)); w; ^" {8 k3 D
  )
2 ?7 ]6 t- i. f/ t9 h+ _# W: k  (defun ver_rowsp (value)% C6 q3 |2 m. w
    (setq row-sp (verify_d "row_sp" value row-sp))1 k. w5 E1 X8 N1 E' K, G
  )9 e7 Z7 {6 ~! R/ ~9 y0 Z
  (defun xclip ()
0 e" r* B1 \+ e4 e# L    (setq xclipmode t)
+ [$ G2 B# U) V2 a. X    (if (= xcliponoff "1"); W$ r7 a& J% i5 X$ p$ Q
      (command "_.xclip" (cdr(assoc -1 elist)) "" "_on")! a& v, W/ l( F) \1 i0 Y) ?
      (command "_.xclip" (cdr(assoc -1 elist)) "" "_off")
+ ~8 m. J+ H' Q( `    )
2 A: d& F3 v$ z( `7 [2 o+ c2 K% x  )' B5 h  r  u. \$ L. M! @- `
  (defun ver_rad (value)
9 Z, o& }, t. S" C    (if (setq radius (verify_d "radius" value radius))
2 R4 B7 r& _; K% ]3 W' i      (calc)
- C) w5 h8 S) V( \# j" N0 z  S    )
% B9 S: O* T: L% o0 l0 `' G: K  ): Q' ^6 x2 L( p
  (defun ver_majrad (value)  v, ]4 A( Y3 M! m" D
    (if (setq majrad (verify_d "majrad" value majrad))" T) i/ n* V8 z% _  s
      (ell_calc_newval "majrad")
2 U2 F5 C9 C% E9 M, h, }5 L    )
8 Z, U  g- e0 D, X8 _  )% |9 X% N( h: ~
  (defun ver_minrad (value)2 p6 ~* E! e1 k
    (if (setq minrad (verify_d "minrad" value minrad))" R% p/ |! W# Z$ F; K
      (ell_calc_newval "minrad")+ t3 {9 n7 j  p8 _
    )
: I7 {! y* a3 Y  )' _1 ^+ |2 d9 w; R: M3 a
  (defun ver_hght (value). N- ?: w) ^# {: `
    (setq hght (verify_d "hght" value hght))- g9 @% w6 e$ y) X5 ]
  )) L6 o! b3 L. h4 l  V; K: |4 U
  (defun ver_wid (value). w$ h& l5 h" |6 u0 G4 D& @2 R
    (setq wid (verify_d "wid" value wid))5 Y; U: {" X: ~0 `
  )
3 M. T8 ]! o  v4 a' q) R  (defun ver_xline_x1 (value / temp)0 W$ e# w5 W3 A0 h2 G4 g/ G3 t% `7 N
    (setq temp xline_x1)  y# @: w" s- m
    (setq xline_x1 (verify_xline "xline_x1" value xline_x1))& E# g- W. Q/ Q
    (if (/= temp xline_x1)7 @) l% A$ x5 I2 P
      (progn (modify_xline 0) (set_tile_dirv) )/ m/ h/ y  a2 ^) E+ t( ~
    )/ |& R2 _% [5 ^2 ]- o
  )3 y0 g/ `& ^% d' s4 n
  (defun ver_xline_y1 (value / temp)+ o! q" R$ S5 V
    (setq temp xline_y1)$ {; c. a+ [3 j- k
    (setq xline_y1 (verify_xline "xline_y1" value xline_y1))
4 ^  U) l% `7 n1 n$ l    (if (/= temp xline_y1)
) q+ w; t" t; A& R; r      (progn (modify_xline 0) (set_tile_dirv) )4 c3 |5 [+ y, L
    )
5 x5 U! y+ i& F5 b1 u% p1 a( Q/ s8 ]  )
1 d, ?( P6 Y3 h1 ]3 n/ e) W  (defun ver_xline_z1 (value / temp)
& S$ Q) ^# t) D. {/ |    (setq temp xline_z1)- P2 e! G) ]5 Q- l: a/ b2 k. _5 L
    (setq xline_z1 (verify_xline "xline_z1" value xline_z1))+ r6 U1 `* q' Q8 e  C8 t) }- O
    (if (/= temp xline_z1)% y6 c  ?6 t. |
      (progn (modify_xline 0) (set_tile_dirv) )- m( G7 B3 {7 q( |
    )! K8 A# ~* v. F/ F9 @, ]9 O- B0 K
  )
, I+ r, W1 \' l. {1 e$ o  (defun ver_xline_x2 (value / temp)- Q; z+ w' V  `4 v
    (setq temp xline_x2)
: S5 F4 R/ B6 B& ?: W! ^    (setq xline_x2 (verify_xline "xline_x2" value xline_x2)): X3 w# K3 S; u8 z' @/ v
    (if (/= temp xline_x2)
( D. F; l' ?) z) B- M, w      (progn (modify_xline 0) (set_tile_dirv))
* J; o# H. ~8 t. @: d    )+ W; O& v9 h6 q% x
  )- E+ J  {* k6 B1 g, @
  (defun ver_xline_y2 (value / temp)$ V2 ~% n$ |: O8 R
    (setq temp xline_y2)
; ^7 w' @5 @  i3 h4 U) Z    (setq xline_y2 (verify_xline "xline_y2" value xline_y2))4 n- @' m+ j& j# L# X# B/ f
    (if (/= temp xline_y2)
: c# y9 d3 Z/ \( L( z/ G0 H      (progn (modify_xline 0) (set_tile_dirv) )
! U$ @( ?! P( e2 d( k    ); i! C+ ]! S/ R) b2 i6 S% l
  )
& g0 m4 [. m+ }% v- g5 E+ }  (defun ver_xline_z2 (value / temp), v  e3 z' ^. u
    (setq temp xline_z2)8 n, g1 p9 l6 j5 n( c$ ^
    (setq xline_z2 (verify_xline "xline_z2" value xline_z2))
; d7 r# _" v) d" S7 q/ s    (if (/= temp xline_z2)# A+ T: M# K" }5 N! E$ r
      (progn (modify_xline 0) (set_tile_dirv) )
' c+ D: h- x9 F! G9 o* O" ?    )
6 N  R% H3 t9 R4 K. \  )7 x" {& G! S9 o- |8 l8 P: H1 r
  ;;3 }" Y1 }: Y3 M% D$ |9 |" R
  ;; Functions that verify tile values for angles
- B6 O7 @( Y1 B0 J+ r  ;;: u1 c/ v2 G& ~
  (defun ver_ang1 (value)% O5 @! E  d5 ^
    (if (setq st_ang (verify_a "st_ang" value st_ang))8 h& n0 o" S3 v# W" |, ~6 J
      (calc): h) n/ U( b4 F6 ?
    )
$ \1 b, {2 |- ?+ L; Q  )- _2 j0 I0 S9 z6 r5 a
  (defun ver_ang2 (value)
# x  l6 C3 @  y    (if (setq end_ang (verify_a "end_ang" value end_ang))
: b2 _  E7 ~3 U" V3 Y5 J      (calc)
  K1 y$ n+ X* E& v# X9 @    )
4 Y7 p/ A$ B6 J+ }  )4 d# F( H. g* u, I1 Q  }1 R2 V
  ;;2 N2 Y- p8 s3 B3 a* a5 J" E
  ;; Verify tile value for ellipse end angle. Handled slightly4 J6 U, `! U9 q% C1 B
  ;; differently than the other angles.
) c/ @( Y4 O8 r; P% k  ;;
! I0 G& V6 c) w+ }- c% t- }, [4 Q1 P  (defun ver_eang (value)6 }- u1 [+ r' [7 G0 [2 K! {
    (setq end_eang (verify_ae "end_eang" value end_eang))/ O, d+ B7 p0 k9 O: h
  )
. R) w. E3 ^7 {/ b  (defun ver_rot (value)
* l5 E9 e$ \1 G& S9 E    (setq rot (verify_a "rot" value rot))0 Z& `: {& T# {0 m; P
  )5 Q1 Y2 a8 k2 z4 R2 v! a/ Y& ]
  (defun ver_obl (value)( k  a9 r1 X; O% y
    (setq obl (verify_a "obl" value obl))
; B, a4 u4 I* ^- j* Q4 t! O- C  )" T5 V" ~) a& S( Z1 d, o% s3 ?
  ;;
$ u) ^9 X: X7 @  ;; Function that verifies attribute tag field for null string,
* E9 S: N+ `8 Z; I1 c: g( C- j  ;; or a string that contains one or more spaces.  Tile value
3 y; H4 P9 {$ }: F) M  ;; is also converted to upper-case as well.4 V' ]! P( j0 t8 D9 c; }- N
  ;;
; b+ v6 |/ H3 C/ ~" l  ;;
2 w+ r1 {* `$ Z5 D) S  (defun ver_tag ( / tval)' E/ Z8 E: P- R3 L; ^2 k
     (setq tagval (get_tile "tag"))
! ~% G! n2 t- B$ H9 I: u8 k3 G, {     (set_tile "error" "")$ @' v8 A, j- ?1 m) e' _
     (cond
% w0 g, f2 g4 @& k# E        (  (or (eq "" (setq tval (strcase (ai_strtrim tagval))))
4 E1 E* }* f- g& M; M( D               (wcmatch tval "* *"))% E" {2 |! h9 S! X
           (set_tile "error" "Invalid attribute tag.")# a, v: U  L  w
           (mode_tile "tag" 2)
1 T6 O7 O  e6 l6 D           (mode_tile "tag" 3))8 C# l, s$ ?9 b! X7 \
        (t (set_tile "error" "")5 w: R* h3 Q; j
           (set_tile "tag" tval)8 s. c5 b7 k& u1 r; }; w
           (setq attag tval)))
. V# \; d6 t5 K% T4 N  s/ f  )+ h) \  V! [/ J$ B% I- C7 r; f0 |
  ;;; }/ S/ I- n+ R, O2 N" n2 K1 n! r
  ;; Calculation functions, O5 h: T0 q  U/ ^  H0 o6 J; u
  ;;- ~. M, |; P7 l4 A4 c3 ~: v
  (defun calc ()
+ M4 U: l1 m# D! D2 \) G* W& n+ b    (if (= etype "LINE") (line_calc))
1 @/ S# b( V9 O# n: x( {0 v( q4 G    (if (= etype "ARC") (arc_calc))
" \$ C' m0 r- J    (if (= etype "CIRCLE") (cir_calc))  t  c6 H3 I& ?' I
  )
% a1 d# C* ^! g5 J2 @% l  N  ;;
0 Q- R* z) u& i  ;; Calculation functions for lines, arcs, and circles8 M% d1 z# d2 n: A5 S0 A
  ;;! K" m9 L  q: R/ l
  (defun line_calc ()
/ a  G! ?' z+ A    (setq stpt  (list x1 y1 z1)). f7 l# v% C; y2 A6 ~* ?
    (setq endpt (list x2 y2 z2))% Y! j2 }: \; [6 Z
    (set_tile "delta_x" (rtos (- x2 x1)))! X% Y) A8 G8 A; W% t: J
    (set_tile "delta_y" (rtos (- y2 y1)))4 J( Q3 {! i4 Z( P- f% @
    (set_tile "delta_z" (rtos (- z2 z1)))% R( L8 }! [1 Y5 T3 n0 s
    (set_tile "l_length" (rtos (distance stpt endpt))); L2 X& F. a* K9 [* r5 E3 ]2 T7 s5 o
    (set_tile "l_angle" (angtos (angle stpt endpt)))
$ D* T. n, h  \  )- P* R; r  n/ v+ f/ D3 X7 p
: w  @5 d) R; a9 f; f3 m
  (defun cir_calc ( / area units)
' E/ i1 c9 m) J# o, J% e        (setq radtest radius); L* ^! l4 M( F. @; ~
        (set_tile "Dia" (rtos (* 2 radius)))
  M* H, E9 p) D. Z& w        (set_tile "Circum" (rtos (* 2 pi radius)))
" ^! |' Q% S' A# j& w) K        (setq area  (* pi (* radius radius)))# T6 U  ]* ^: y: V
        (setq units (getvar "LUNITS"))
3 F! H' _% r* A4 r        (if (or (= units 3) (= units 4))3 q3 ^( x; d( e  }$ ~# G  E
            (progn
; D# _- D4 ~2 E) p5 C8 F               (setq area (/ area 144.0))
$ w) v* b0 Z6 S  T               (set_tile "Area" (strcat (rtos area 2) " square ft"))
" ]- M! E0 Y2 V! p7 o  i8 `            )5 B, U6 H, I$ t! \
            (set_tile "Area" (rtos area))- p' t1 z; D) V8 S
        ). O, l; i# ~" K% j( N
  )
8 f4 {  P( z9 m) T. O$ s* R% `
& d( _2 Y3 M/ O" ^7 Y0 ~  (defun arc_calc ()
1 l- K  ]* `+ x/ ]! p    (setq totang (- end_ang st_ang))3 i6 j7 ~* n# B" A6 W
    (while (< totang 0), ~: L; b1 W7 u( x4 ^
      (setq totang (+ totang (* 2 pi)))
+ g2 J3 y' f8 {    )
8 U6 @7 t2 G: G" @: B- O    (while (> totang (* 2 pi)). d* _+ `9 }7 n' T) v1 T1 D' l
      (setq totang (- totang (* 2 pi)))* a/ k8 _% B9 [. m' s( R, ?+ l
    )6 N- O4 Z2 R" k( M) r) l( f" u
    (set_tile "tot_angle" (angtos totang))
% C# n# e+ e% B0 F8 w( |    (setq arclen (* (* 2 pi radius) (/ totang (* 2 pi))))
- ~. ~1 L5 r% {. k- F( X    (set_tile "arclen" (rtos arclen)). k  m* |+ S6 R* u- G
  )$ x' e8 J" U$ I
  ;;
, @/ C& q* k+ ]2 v  ;; Calculate the major radius, minor radius, major axis direction.
3 L. g) D* X! c  y( X* G  ;; Get radius ratio. Convert Start, end parameters to start and end
/ q2 f/ b  l# d, }- i9 `: ~  ;; angles. Save Major Radius value in "old_majrad" in case the user
- W2 o; L* e' O& r! y5 M) T  ;; chooses to input a new Major Radius value later. It's needed to- q- \/ b7 ]0 B+ t" g8 s# k
  ;; calculate a new Major Axis Vector value.
9 `1 y+ r9 D. h6 e  ;;7 ~+ v+ x' F6 K( w4 a! e- v
  (defun ell_calc ()
: r2 Q  w- K$ i        ;; Get major radius from the major axis vector.
  J9 W3 m7 R& }* s! X4 N* T* i+ b" J+ a        (setq majaxis (cdr (assoc 11 elist)))
; \7 l0 A  r2 `7 K        (setq xx (car majaxis))6 D" l) @/ T4 i/ l
        (setq yy (cadr majaxis))
  ^2 Q! {3 R$ F        (setq zz (caddr majaxis))
  W9 k/ z8 ^3 [2 l9 W        (setq majrad (sqrt (+ (* xx xx) (* yy yy) (* zz zz) )))
0 j5 d7 I) C7 \3 V+ b        (set_tile "majrad" (ai_rtos majrad))
2 y  W) L6 R0 w* P        (setq old_majrad majrad)' ~9 p" t9 e, b4 V, P& \2 z* x
        ;; Get radius ratio
/ z. X! @8 @' {* r! W: h6 |1 |        (setq rrat (cdr (assoc 40 elist)))) ^) R8 u' h0 u: i/ ?8 E2 B
        (set_tile "rratio" (rtos rrat))! W+ Q$ ]6 B; ~4 D# u
        ;; Calculate minor radius( t/ x/ S. j' ^1 {4 ?
        (setq minrad (* majrad rrat))
; X: z3 H: A0 O' g! ~: m, P0 a/ Q        (set_tile "minrad" (ai_rtos minrad))
& O) B3 U- l( ?5 a$ [        ;; display major axis vector- @2 W8 t; `# m" ]8 c: n
        (set_tile "Majraddirx" (rtos xx))
  a' ~1 P; b  B% t        (set_tile "Majraddiry" (rtos yy)); {! o! _! d2 k% a6 f% Z
        (set_tile "Majraddirz" (rtos zz))
6 C) r5 J3 J! A0 z, C! \" V! V/ n$ T; ~# s% |+ o9 |) ]* G3 u
        ;; Convert start parm to start angle3 F7 `! l& Q# F
        (setq stparm (cdr (assoc 41 elist)))- {# v7 K4 U% ?3 n8 I5 W
        (setq vecx (cos stparm))& f% g4 ?9 Z" \5 {" E3 l5 @- V. _
        (setq vecy (sin stparm))
1 T, a) H6 `/ P) p+ Y        (setq st_ang (atan (* rrat vecy) vecx))
, b& Z1 k* {- a" K+ J        (setq tempst_ang (ai_angtos st_ang))
' ], u* d0 Z1 C7 e* h( [        (set_tile "st_ang" tempst_ang)! L2 C8 k+ Z) [- Q- i
        ;; Convert end parm to end angle. If end angle evaluates to 0
+ |0 E" V. p$ M3 |, j6 c        ;; degrees then display it as 360 degrees." F- T$ k; ~% X% k3 ~3 r2 N
        (setq endparm (cdr (assoc 42 elist)))7 r% f  w# J$ J8 A5 A
        (setq evecx (cos endparm)), x; A6 q$ X) M: W" w. t; c: D
        (setq evecy (sin endparm))0 X, {" h- P* P* \% U  b5 W
        (setq end_eang (atan (* rrat evecy) evecx)): R4 e$ [, w8 V! b. d6 q
        (setq tempend_eang (ai_angtos end_eang))
: z& b6 \' w' W3 v/ c; Z        (if (= tempend_eang "0")% z8 |' D: q# R: ]1 x4 c4 p
            (set_tile "end_eang" "360")
1 Q$ g$ Q5 M" v. Q/ G, C1 C9 F            (set_tile "end_eang" tempend_eang)
5 h6 {8 P( \" [  v* R: {2 [8 f        )
2 F- s3 ~; w/ G% c, \! R3 p        ;; Get area of the ellipse.# g, Z. `; v- h3 V0 ~
        (ell_calc_area), ?; C5 }# Q5 H* i/ F
  )
  e! ]# g7 ?) G7 g5 e9 h. V3 u  ;; Calculate area of ellipse. If it is an arc then
  W4 p2 h0 P, y2 U: P  ;; grey out area display.
  R4 ?5 r' Z8 f' H2 i8 R  ;;- C& _6 ~: l' ?5 q2 Q5 j* C
  (defun ell_calc_area ( / area units)2 Q% l( T9 C' A* c+ d
     (if (and (= tempst_ang "0") (= tempend_eang "0"))& Q" m8 W7 l& g& i+ t# [
         (progn) }8 O% i5 w5 c0 z
             (setq area  (* pi majrad minrad))
& @9 o# u* d. _' R( }; \; _  H5 S             (setq units (getvar "LUNITS"))1 U+ ?2 F7 U# M1 d. }
             (if (or (= units 3) (= units 4))/ h) k1 a/ A% r) N3 M5 J2 ?* y
                 (progn' Z( t/ f1 U2 \
                     (setq area (/ area 144.0))( ]& _$ t. _. S3 w% ^% \( A
                     (set_tile "Area" (strcat (rtos area 2)" square ft"))4 K2 C$ |2 f2 @( i2 M, p
                 )+ g5 ~# W) e% G& e7 h
                 (set_tile "Area" (rtos area))
0 T. v! S. |( D3 J+ A4 J" [             )
, F) s1 G( w: p: z9 [8 [         )3 u7 f) q6 |* j9 v2 {
        (mode_tile "Area_text" 1)
3 r# M! w+ P0 p     ); b0 u' d/ P* d' i2 {8 L
  )% W- Q, d! @5 J& N" T' C+ n2 L. o; e
  ;;( }' z6 a9 s  a$ N; A
  ;; Calculate new values for ELLIPSE& ~& [; Y) D. x* c4 ^* P$ |5 f/ E7 z
  ;; Minor Radius, Area" i  w  n/ _" W* |
  ;;$ c# {2 A# s- Y2 y4 H# v& b+ ?& `2 N
  (defun ell_calc_newval (ell_tile)
0 A: Y. B9 O# e* g* Z8 l8 k2 o    (if (= ell_tile "majrad")! u3 a/ R0 W8 K
      (progn8 g: U6 w& ^9 Y& g% E
         (setq rrat (/ minrad majrad))) a: j6 ?  }# W& x; p
         (set_tile "rratio" (rtos rrat))1 J4 T* e5 g7 ]% h- P2 T( T( Z1 ^
         (ell_calc_area)
. B( P/ q1 q) r" F  Y      )  ~  f) C  Z  P0 [1 h
    )
$ A& k: n+ n' O- G  h3 l( A9 j$ n8 Z2 X    (if (= ell_tile "minrad")& m7 n3 X$ I& n' ?8 N* E( }
      (progn3 |: Z& m( P$ |  r& }6 g
         (setq rrat (/ minrad majrad))
9 }: B7 h& m8 n9 _4 o6 W: ^         (set_tile "rratio" (rtos rrat))
& J' Q! G. Y8 W1 b  T; d$ y         (ell_calc_area)
+ i- `3 i* m$ ?( U& A$ z1 t      )
: p6 G0 ~# J% H( Z; W( J' m    )
( r) |3 L% @4 c: i+ x0 G  l" l  )
0 S- b& t8 I6 q
' X2 u0 _( Y, s% i9 m7 j, t  (defun set_dimen_props (/ loop a stl txstyname); z) k, l" i9 Q! {
$ `9 M5 w0 w; G9 U; |
    (setq stname (cdr (assoc 3 elist)) ; get style name
6 L" k- E! ^+ e2 o9 M          stl (tblnext "DIMSTYLE" T)
7 p( ^$ \7 t' j0 F: Q          stlist nil)
) X: F) t1 M) U1 c$ T  w. k    ;; Get all style names and list them in alphabetical order1 P8 ]: X. w# J1 W
    (while stl4 \' Z1 z0 J1 A& c7 {
      (setq sname (cdr (assoc 2 stl)))
  l  {( H/ L% n' J0 Q6 Z      (if (/= (logand 16 (cdr (assoc 70 stl))) 16)
" {7 m8 S9 L/ Y/ t6 I* z  L           (setq stlist (cons sname stlist)))1 J6 k4 y9 Y7 ?( ]! l9 W& L
      (setq stl (tblnext "DIMSTYLE")))
& M8 f% D5 Q1 R. R
1 Q" o6 Z! w: o- ^" U0 @; }    (setq len    (length stlist)+ ]: a! s. f4 f/ W# N
          loop   0* u% j4 c; a# R/ y, \& \
          dimsty stname' }4 Y. c5 I# G
    )
8 B4 I8 {% c' G2 \3 |7 K
) M1 J( |: e2 [9 d% i. W0 B/ O    ;; alphabetize style list, depending on maxsort# Y' W' ?/ O* e0 w. t9 l' T
    (if (>= (getvar "maxsort") len)' h, c8 R4 `  n/ c9 F; H
        (setq stlist (acad_strlsort stlist))
/ |+ K- V9 v- j/ o* y3 {0 `  G      (setq stlist (reverse stlist)))
4 w% @! B& M$ y, G! J
: c. q* p; I5 p0 C) q    ; *UNNAMED style (dimsty = nil at this point) is replaced with. d0 d/ K0 y2 D% E  p' X; a
    ; the current style.  After R13, we require dimensiosn to have a* H2 F! G$ y" E/ |9 ~
    ; dimstyle, so we plug any holes where we find them.
% i) L7 }8 {/ q$ C: E    (if (null dimsty)
& B% S# o/ O% R" O# W8 f' r8 @      (setq dimsty (getvar "dimstyle"))$ `. H6 \% y0 O$ r/ C
    )
  f# e$ L$ h* |1 D# W    ; Show the styles in combo box4 b# Y7 ~5 n2 w6 z% L
    (start_list "mod_style" 2)
. ~' {; S+ _& q  U' V" z! C) H, w1 Z    (while (< loop len)
% \( x% E2 W8 J  ?  `! V" L; k/ A6 i      (add_list (nth loop stlist))5 s5 I3 ]5 n3 P6 T
      (setq loop (1+ loop))( v. {: e3 D6 J- b' F
    )) E- X# l5 {0 T9 q

" X, V4 ~+ w2 {: R  }7 G    (end_list)
  h: M/ f& ^$ s# W" T* r4 F
+ T8 v; C# a& w9 C    ; Hilight the style name of the selected entity
# [5 V+ v9 q; z; V. W# T: v% \    (while (and (< 0 loop) (/= dimsty (nth loop stlist)))
  a4 L/ n% \8 V3 d4 w0 G% ^      (setq loop (1- loop))
8 E4 i. B2 Z9 m. N    )- v, M2 ~9 S) L" J. b
    (set_tile "mod_style" (itoa loop))
& i/ X5 M9 P) j, t) k3 O) K6 u! q% y( _
    ; The following is the list dimvars. It must be sorted in the same
/ Z, J5 W, N" M4 E+ h9 x    ; order as the resfub returned from DDIM (ADS module).6 ^6 n& W3 m* D) [; i1 C4 o3 p
- g; [2 k* X7 Z) R, y' j
    (setq dimtbl (list "DIMSTYLE"  "Style name"  "Standard flag values"1 G7 F1 q0 h$ o% `+ }( g
        "dimpost"   "dimapost"    "dimblk"    "dimblk1"    "dimblk2"
/ t" n% H$ |9 T" V1 k8 `3 d        "dimscale"  "dimasz"      "dimexo"    "dimdli"     "dimexe"
% l0 s0 _/ F3 R$ K6 {  X8 V; ^6 N        "dimrnd"    "dimdle"      "dimtp"     "dimtm"      "dimtxt"8 Q: q8 r6 M( V
        "dimcen"    "dimtsz"      "dimaltf"   "dimlfac"    "dimtvp"
4 G+ z3 v2 h/ l+ p) f        "dimtfac"   "dimgap"      "dimtol"    "dimlim"     "dimtih"
$ P+ {7 P7 i- i% f! E        "dimtoh"    "dimse1"      "dimse2"    "dimtad"     "dimzin"/ c! Z" C. T/ i+ j8 r
        "dimalt"    "dimaltd"     "dimtofl"   "dimsah"     "dimtix"
9 v$ x$ y5 M+ T! B# N        "dimsoxd"   "dimclrd"     "dimclre"   "dimclrt"    "dimunit"
+ g* j( A; V! I' V6 ]        "dimdec"    "dimtdec"     "dimaltu"   "dimalttd"
8 i* d  @2 q, X        "dimaunit"  "dimjust"     "dimsd1"    "dimsd2"     "dimtolj"& g8 S1 |$ }" n+ i) O3 I; {( I9 K
        "dimtzin"   "dimaltz"     "dimalttz"  "dimfit"     "dimupt"2 k' Y! U; R# c
        "dimtxsty"% O, \8 s$ N, I: u/ @
    )); ?# P) E, v* |5 O
    (progn4 O( H) \+ ~1 N( {4 g1 W  Y
        (setq sv_dvlist (ddimen_getostate dimsty)/ i6 B9 ]( C/ t7 S( n1 ?6 o* U
              txstyname (assoc 340 sv_dvlist)9 }; P& @2 \6 l" P
              sv_dvlist (subst (cons 340 (tblobjname "STYLE" (cdr txstyname)))9 f0 K$ X9 H5 t0 n* Q  \  j4 d
                                txstyname sv_dvlist)
8 K/ Q. X/ D6 R" F; _3 b, H              dimlist sv_dvlist3 K. G4 e2 s: D/ A2 Q3 A
        )
. i0 q$ h/ Q  l6 ?: ]2 w, z    )
7 o- A) b5 T7 s' n1 E$ c    (if (= dimtype "DDLEADER")
1 p. r# x% r5 F      (mode_tile "mod_format" 1)9 c( E4 A/ u8 v& B: n% f6 ^
    ): Q1 M9 t4 Q5 g7 |. {
    (action_tile "mod_style" "(setq dimsty (ddimen_style))")) F/ Y: Z& w0 u- u' Q! k, s; [
    (action_tile "mod_text"  "(done_dialog 4)")
6 W+ r* V, |8 g# F* i+ k    (action_tile "mod_geom" "(setq dimlist (ddimen_dlg dimtype 11 dimsty dimlist))")
2 N2 n4 h3 N9 }) f; C) t! e. B$ d    (action_tile "mod_format" "(setq dimlist (ddimen_dlg dimtype 12 dimsty dimlist))")! p6 h9 U' h$ S2 d5 ~7 {6 h4 p3 P# K
    (action_tile "mod_annot" "(setq dimlist (ddimen_dlg dimtype 13 dimsty dimlist))")
1 \/ U% a7 O0 Z! l$ l3 _( [$ X. M    (action_tile "accept" "(done_dialog 1)")6 e! Z2 A3 y- A' R; j$ \  d/ ?! P
  )
* _* i& w) Q/ Z- Z( ^  ;;/ _; Z& `3 U6 C5 s# o7 [
  ;; Get dimvars that have been restored.
9 ]5 H- L  Z6 o# y* Z# n  ;;' J& e& Q. m1 c  p0 h
  (defun ddimen_getvars (/ elm dvlist dv i)+ A4 [( ^' C: t  t- h! c
    (setq i 3, w6 _* X. C8 }* s
          dvlist (list (cons 0 "DIMSTYLE"): m. [* Z; f) X0 X8 v, A. x$ I
                  (cons 2 (getvar "dimstyle")) (cons 70 0))" j0 `8 ?  B+ B0 O
    )
5 i% x  k3 P4 J, G2 O; Q9 U! a7 N    (while (setq dv (nth i dimtbl))
$ G5 J6 T) T9 _4 G      (setq elm (getvar dv)
7 k" Y, L; u0 _' E. I& h            dvlist (append dvlist (list (cons dv elm)))
. U8 z& b. n7 X$ w            i (1+ i)
# H) J% h; L. A      )
; A' z. o7 _; A, C    )
  B  k7 n7 k& i* ~( ~    dvlist
1 j4 t# e/ g; q5 k  )
# l8 w% l4 d0 T  O4 G5 y3 D) @4 f: j6 a0 P4 F# b8 G- w
  ;;0 V- F# a9 z/ F' |2 ^: ?3 l, O+ C
  ;; Get the original states of dimvars. This is for DIMENSION entities.; g( l. i" H8 K1 i( }) e
  ;;
' P' {) X* v( E/ ]' x4 D! g  (defun ddimen_getostate (dimsty / dvlist elm i dvvars)
, y9 q, A4 n' }/ g8 y    (setq dvlist (tblnext "dimstyle" T) ; Get a skelton list
; c) g' ^7 q! N+ U% |& y" B* ]          dvvars (ddimen_getvars)       ; Get dimvars for that entity) ?* ?4 ~! ]. m6 Q# ]; c! ^3 h( `, j
          i 1
3 h! }0 H4 h% r+ l8 T1 i    )
0 u" e  m6 m$ b  w% Q) r% `1 `. ~. x0 ~
    ; Create a list that contains values of the selected entity.
# B! ~4 T- g3 @9 g
, ~/ R( l2 G  b4 r    (while (setq elm (nth i dvlist))1 D. E2 F0 H5 ]* x
      (setq dvlist (subst (cons (car elm) (cdr (nth i dvvars))) elm dvlist)/ r0 A1 C* o1 K
            i (1+ i)
) k' @- t9 ~7 U* S      )9 H. S- k) U% p2 Y
    )
& }; q' X7 @0 U7 d. N" R1 G    dvlist
. V8 t, I; x' c, Y; N! P3 P  )
( Z9 i7 r7 P2 p( R8 F( q3 K. _: z0 I' k
  ;;6 a4 @; L/ d3 G" T( s
  ;; Restores dimvars of the selected enity.7 z  R/ U) l' \/ ?1 G' W
  ;;
$ c9 _8 @( r% z: x' d# ?& L* Q2 r$ \  (defun ddimen_dimsty_restore(/ dimtbl dimsvcurset en)
( a+ L/ ^; q# o. i. N& m7 s; M8 M    (setq dimtbl (list "DIMSTYLE"  "Style name"  "Standard flag values"* K  \' O, j% O2 g2 H# S2 J
        "dimpost"   "dimapost"    "dimblk"    "dimblk1"    "dimblk2"
% c6 I( c4 @* Q8 u/ }7 s        "dimscale"  "dimasz"      "dimexo"    "dimdli"     "dimexe"5 f# z' p  R: n) i! S( g" r
        "dimrnd"    "dimdle"      "dimtp"     "dimtm"      "dimtxt"9 @) s* ^- J" O) u' u2 H* d' F
        "dimcen"    "dimtsz"      "dimaltf"   "dimlfac"    "dimtvp"
1 ~- _) Y, x4 x/ a. q        "dimtfac"   "dimgap"      "dimtol"    "dimlim"     "dimtih"
. j6 Z% J$ }9 |  A& s/ Z5 B        "dimtoh"    "dimse1"      "dimse2"    "dimtad"     "dimzin"# Y3 H5 T4 U* S6 y8 n
        "dimalt"    "dimaltd"     "dimtofl"   "dimsah"     "dimtix"
# H; l: X. h$ Z        "dimsoxd"   "dimclrd"     "dimclre"   "dimclrt"    "dimunit"
6 H- L; u: V+ ]$ t; h        "dimdec"    "dimtdec"     "dimaltu"   "dimalttd"0 o* j: D  z( s. J  H1 M1 `0 v4 z- y
        "dimaunit"  "dimjust"     "dimsd1"    "dimsd2"     "dimtolj"
$ T: c9 o1 @/ G7 l% {% u        "dimtzin"   "dimaltz"     "dimalttz"  "dimfit"     "dimupt"1 G  u6 ?& T  s7 m$ ~
        "dimtxsty"
6 K% l+ r3 g( z: S7 L' Q  b    ))" T4 }* y1 [, m$ q% z8 g
    (setq dimsvcurset (ddimen_getvars))  ; Save current variable settings! F) L, u! L5 J' _" k" z2 u+ t
    (progn6 ^5 K" S# ]+ F$ p# o2 E8 E% C& `
        (setq en (cdr (assoc -1 elist)))
3 L' S5 K2 K) I1 H3 t- v2 O        (command "_.dimstyle" "" "" en)# i% S3 Q( c! b  T6 v: _, A
    )' P. t8 m2 L  L# [8 t8 ~
    dimsvcurset
6 r- u6 }& i& |4 S' I( |  )% F* o0 r, l& r3 O* P# p2 R
  ;;1 C/ o5 o0 `7 `9 B5 f8 l% w
  ;; Modify Leader1 ^. q) D! k. h3 y
  ;;' y2 J: H9 }/ U! @: R6 R5 I
  (defun ddleader (/ dtypebit blkname bename sublist a  stname n dimtbl
/ @% E! \/ {2 C" h                   dimsty dimlist dimtext svtext dimovr sv_dvlist stlist
. X) v! P0 L( \! g                   dimtype dimsvcurset)  H% J, p. q' Q0 E
    (setq dimtype "DDLEADER"1 v& q8 M6 b7 `+ @; K
          dimsvcurset (ddimen_dimsty_restore)/ e" ?4 e8 l9 X6 n
    )
; R, r  b$ N, [' B: \0 f# M# _    (if (not (new_dialog "ddleader" dcl_id)) (exit))
4 r4 _* Z# U7 q  m$ F    ;; Set initial tile values
% F; _( ~9 F! ]# T    (set_tile_props)/ N' e# i' B' B& p
    (set_dimen_props)
+ I5 F; }: Z8 T6 i; |6 R# m* m5 m    (set_tile_handle)2 o9 c' M5 O. C& b
    ;; Define action for tiles
; z% `6 K& C4 d* G$ s% z    (set_action_tiles)
0 k8 M5 |2 r9 Z    (mode_tile "mod_text" 1)) k& D; G0 h7 r' O$ l, C3 z8 G5 B
/ w' m) n, |5 L$ B4 c: Y
    (action_tile "mod_style" "(setq dimsty (ddimen_style))")$ Q$ n% M$ {8 D$ r/ G! U9 ~
    (action_tile "accept" "(setq leadtype (get_tile \"s-s\"))(setq arrow (get_tile \"arrow\"))(done_dialog 1)")
' y- a4 g7 _! B% W8 g    ;; Get ARROW and TYPE./ K3 ~2 ~$ K2 t% e* p; n
    (if (= 1 (logand (cdr (assoc '71 elist)))) (set_tile "arrow" "1"))% \  R+ p& h3 z4 \2 p
    (if (= 1 (logand (cdr (assoc '72 elist))))
, C$ l) j1 f) @3 w( f      (set_tile "s-s" "spline")
1 d# C( R6 I" h) D) a8 ]      (set_tile "s-s" "straight")
8 U- O4 M: n0 J9 V    )$ _. E+ `; e. D& y6 ?
    ;; Start the dialogue.
4 N: }% ~( B3 i% {    (setq dialog-state (start_dialog))) C8 d" t1 Y8 T# G
    (if (= dialog-state 1)
, I& K/ Z  j3 e& u! T% M* v. T      (progn
6 C) ^& g' B2 a- k3 J, l# q5 R7 {        ;; update the style
+ C' r7 ^: g3 L( F* {* `        (if (/= dimsty stname). M' |) c4 W0 g( Q( c; _
          (progn
' @/ }/ B1 T8 h. B* D            ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case
+ d0 [% ?% G# o) Q' d  A" K+ O            ; doesn't have it.
: @9 I/ }  L. i3 D1 x6 [  z. L            (if (null (assoc 3 elist))3 T( Y- x% A, T$ O) _2 K
              (setq elist (append elist (list (cons 3 dimsty))))
: q8 Q" Q& L% v8 g+ x) r( i              ; else just replace it.5 z( Y3 k4 P! \
              (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))8 K4 O5 o( o( i) r4 j' t
            )0 \9 C: j# _% c& h3 |( E5 R
            ; refresh sv_dvlist with new dimstyle.
; [: i- ^  ]" X; E0 y. j4 ^$ F            (setq sv_dvlist (tblsearch "dimstyle" dimsty))2 ?9 K* P% w( ~8 K# u" _
          )- p" t4 Y$ K) N3 D5 Q: V( C
        )
5 b+ s  t; z/ g" X        (if (not (null dimlist))   ; attempted to change dimvars2 R+ o, f3 r) N% f& @
          (ddimen_complist sv_dvlist dimlist dimtbl)
( n* q; h$ S) H/ Y4 Y        )6 _0 g' i$ X( U# J. x# a/ P" d( F
        ;; update for ARROW.
6 g! s3 V; ]& U) O  [7 \) G0 b8 i        (if (= "1" arrow)* U* ~) F6 j. p; F
          (setq elist (subst (cons 71 (logior 1 (cdr (assoc 71 elist)))) (assoc 71 elist) elist))+ y1 `3 Q( J8 s) ~+ m6 k9 L! i
          (setq elist (subst (cons 71 (logand (~ 1) (cdr (assoc 71 elist)))) (assoc 71 elist) elist))( x& X3 b- o; v  H% p- q4 w
        )' E- F$ J3 I& r* g
        ;; update the TYPE.
! I" _% B8 o* x8 G. n/ y        (if (= "spline" leadtype)3 a- Y) D, R* E0 T
          (setq elist (subst (cons 72 (logior 1 (cdr (assoc 72 elist)))) (assoc 72 elist) elist))
  P+ m5 D: j7 M, Z          (setq elist (subst (cons 72 (logand (~ 1) (cdr (assoc 72 elist)))) (assoc 72 elist) elist)), Q: E* @# u$ U
        )4 W) r, y  d7 K8 d, H4 B# r+ j% m1 }
        (modify_prop_geom)
8 ?; C$ M% Z2 f2 i        ;; update the Color# U, L1 E2 k: V7 a3 t1 h/ ]
        (setq elist (subst (cons 77 ecolor) (assoc 77 elist) elist))+ q! F) {% D) g/ U! q6 J8 H0 y
        (entmod elist)6 v, y$ q- ~. C* e
      )0 a3 w3 ]" o1 i
    )
, J8 I/ q9 t% }' k, s. n& E    (ddimen_setvars dimsvcurset)      ; Prepare to exit; w7 P& l' o8 _$ e7 B2 Z* D
  )
* f8 N/ s) T2 s8 U$ m3 M
1 k7 P& N  Z# X  ;;
  a- a4 y8 P+ Y. }+ l  ;; Get dimvars of a dimstyle with overrides.
5 C0 m. S# Q. V7 U3 A) `& ^  ;;
: v2 u% r; O0 ?! z  q! a, [& `7 z& Y- Z9 z( ]$ B& J' R0 V7 d& t9 b- [
  (defun ddimen_getdimvars (dimsty / dimovr dvlist elm i)
7 ?, \2 S- q+ E) o5 g9 v- o/ ~0 A0 O1 F
    ;; Get override information for the specified entity.( B( }6 c# \' P# Q& \) ~5 _
    ;; Leader/Tolerance cannot be restored by DIMSTYLE command, so we; i' Q# N$ b2 l1 E
    ;; must obtain override information through this tedious operation.
1 ~# X% y# G, ]* q6 B    (setq dimovr (car (cdr (assoc -3 (entget (cdr (assoc -1 elist)) (list "*")))))
: ]+ A1 N' M2 M          dvlist (tblsearch "dimstyle" dimsty)
; ^( ?7 W2 z! {; c          i 2
: T: K* l  e! o8 ]    )
0 \6 b3 f  q% C8 P" M. R8 J/ i9 T6 B! j
    ; Update the list with overrides if overrides exist.
5 @" Z: ]; U# Y1 U8 Q
* f% M: R3 {# q  Q7 I- Z    (if (and dimovr (= "DSTYLE" (cdr (nth 1 dimovr))))
0 e4 A6 \8 J, n0 p      (progn
  `9 f) u" r+ \" h; G2 X3 ]        (while (setq elm (cdr (nth i dimovr)))  H7 z2 b/ I7 s( r3 U
          (progn
3 f+ Y- M6 k& I" K            (if (or (= elm "{") (= elm "}"))
& Y! _. K. \) \* b4 Y: R# }$ H              (setq i (1+ i))
8 m# D2 H- ~# c, L7 {7 {! g              (progn" J% i/ A" s- ~! n5 ?) v
                (if (or (and (< 180 elm)
5 `8 \3 y0 g7 N2 x6 d% R* P                             (< elm 190)
* K* `1 _* |2 ^2 O) q6 j; q                        )
! }+ E8 [% D* m; C                        (and (< 80 elm)
" P8 \9 r1 ^2 v' f# g                             (< elm 90)$ S; F( t9 _& {$ n2 E7 }# E8 {) ?: @
                        )
+ d, G# N( ^+ s8 V+ A                    )6 P) }3 P9 o" L/ e! I& I
                  (setq elm (- elm 10))- L8 C' y( b; z: H/ d. E! s6 a
                )
3 Z5 f& S# o% k, u+ ~/ T                (setq i (1+ i)) ]) I( [$ s0 S
                      elm (cons elm (cdr (nth i dimovr)))+ O6 i! N! u8 }# d% M
                      dvlist (subst elm (assoc (car elm) dvlist) dvlist)' n, v! {8 G+ p! Y* `  b
                      i (1+ i)
* C- ?6 O" v  Z: {: ?# t. |                )
% \4 b; y: |& d! q% b9 @              )
5 k& D4 V5 v8 G* j            )
8 |8 I( i6 s  |) R& M6 r3 Z          )- T' i1 m5 q% F6 p/ q  E  i
        )) k2 R& I, r4 B9 M6 b9 r
      )* T5 e8 J: S( C2 ~
    )
& [( C* ]- H- |, e4 |! k    dvlist
$ m' C- c( o  O9 B8 K' p  )+ C* m1 r8 B5 `. i3 G# ~) [6 H7 z

9 U( a% S. T# V% [  ;;' N# S9 g: o+ l8 m% U: h1 b
  ;; Modify POINT
/ F, W, x# Q- N  ;;
( k" L. W- x# z1 k3 E  (defun modify_point ()
9 ^) y1 `( n+ D. V- e7 z1 y% V: G& A    (modify_properties)
) S* o8 p( z6 i: L4 Y    (setq pt1 (list x1 y1 z1))
* T4 z9 _6 P4 Z2 T3 G1 `7 ]# t1 ^    (tempmod pt1 10 0)9 O$ t) e+ e/ z! _
    (entmod elist); x. G- `0 s5 _( s/ {% Y4 I
  )
% M: H+ K1 l& d
* S% h5 T7 E9 S1 j% V2 y8 p2 q  (defun ddpoint ()
+ Y9 i, W/ p' J% j3 `    (if (not (new_dialog "ddpoint" dcl_id)) (exit))
9 A! Y! B8 R3 a& o% L; k    ;; Set initial tile values7 E) W  e+ M8 i" O1 @8 s" n
    (set_tile_props): e, Y- G2 m3 U  A3 m: m% Q
    (set_tile_handle)) W9 Y& e8 J7 I! _, s8 P
    (set_tile_pt1 0)
6 S3 N# S* }" F0 b! \$ t+ L& q" G    ;; Define action for tiles
' h5 F/ v1 Y. G6 ?) f. `% z- |; \- o    (set_action_tiles)8 `, W$ g# N/ S" E6 o
    (setq dialog-state (start_dialog))
7 m$ N; K& C' U3 M0 N1 F; f0 ]    (if (= dialog-state 0)9 s' `5 {  T* M" m
      (reset)
5 L7 r5 \7 T& q# ?/ U3 G. }    ). s9 }4 i  G; l0 ~# H' n" h
    (if (= dialog-state 3)
( X: A* n# Y) X! I  {      (progn( {5 C5 V: B" b( C$ }  W3 u# o
        (modify_point)- ~* @$ [, Q& z/ G& L; }& |9 f
        (setq pt1 (getpoint (list x1 y1 z1)  "\nPoint: "))$ I0 a$ |& V8 w; |7 ], a
        (ver_pt1 0)1 X) }7 h- ~; y$ y0 @$ ]+ y- z; d
        (ddpoint)1 z8 F; k* l$ t) W0 F( m) g' ]( A
      )
4 [0 J( [3 }" x    )
  i0 T# B7 M; ?$ j, y4 H: f    (if (= dialog-state 1)! S1 D+ p* K0 ]7 \1 ?: i" l
      (modify_point)
0 u3 E0 r) I  G' H+ f    )
( a: k& g; ]6 E# B9 `* O  )
. v$ [; }& @3 @  ;;
% ]/ r! {! W/ M; ~( h  ;; Modify LINE# O# o3 q( ~" g0 o9 @1 ^1 @
  ;;2 n* b+ l' F- V, |9 b( k5 D
  (defun modify_line ()4 u3 B! N0 i5 A) ?; j. P
    (modify_properties)
" ^' W/ W- ]  f+ x! g    (setq pt1 (list x1 y1 z1))
1 t$ Y  p' @% a7 R( D' \+ ~    (setq pt2 (list x2 y2 z2))
1 ?8 @$ P# @$ ~$ \) e. _9 ^& q    (tempmod pt1 10 0)1 d% P. v) g2 [0 Z0 D
    (tempmod pt2 11 0)
5 _; v: C' l$ r$ t    (entmod elist)/ w. |( S- @2 w$ q2 S) ?& y8 ^7 e& t
  )
, [' [5 q! f4 c9 n  (defun ddline ()0 I, ~0 n3 M8 z9 U2 F
    (if (not (new_dialog "ddline" dcl_id)) (exit))
" L& B% U0 V5 C2 v1 H% ^( N    ;; Set initial tile values* |; V9 [( n! I) }, k5 w0 P0 y/ S# a
    (set_tile_props). E! T1 v" D3 @& L( ~- H
    (set_tile_handle)
- ?1 g8 u+ B9 _# G) C; S5 f    (set_tile_pt1 0)
% p) B, }! x# [9 o* X    (set_tile_pt2 0)1 E8 y3 c+ z# t. t
    (line_calc)$ E2 s2 K! g4 {+ |3 X5 B: _
    ;; Define action for tiles
! J1 T( u# J# n" z    (set_action_tiles)
0 g+ N; j$ c! L3 D  i    (setq dialog-state (start_dialog))$ L( R7 Z5 H) A1 j5 [6 U; K0 l
    (if (= dialog-state 0)( }" D5 @& W  ?5 Y8 K  R7 [
      (reset)
5 \' w  j6 y' W9 K: C# t    )9 l9 A- W: K7 O% g
    (if (= dialog-state 3)
) s1 N# L# M; G8 l* N3 ^6 p! C5 y      (progn1 @) s0 ?0 _' l7 u# x9 G$ Y" }
        (modify_line)) b, \2 @9 G/ t- p. }& j4 p& b+ z3 H
        (setq pt1 (getpoint (list x2 y2 z2)  "\nFrom point: "))
( |( ?1 T  i" Z5 A4 R5 y4 _        (ver_pt1 0): I$ d! f) y$ u+ t
        (ddline)
) t; I% C+ E3 ?( P3 Z7 `      )+ m' P5 B5 G- X% n' L' ^1 _4 K
    )6 V9 P; E' [- j0 n0 l% Z- }9 R* l$ r
    (if (= dialog-state 4)- o% f3 t) R( q  ?! ~' E9 i5 Z) \$ T
      (progn- V* b& _1 S- D* l3 o# h% `
        (modify_line)
( ^' P0 ^8 N9 ?% [# z' S        (setq pt2 (getpoint (list x1 y1 z1) "\nTo point: "))( z! O& I; }3 w, N
        (ver_pt2 0). \6 r& N6 [1 O5 H5 K* G% m% }1 I7 l
        (ddline)
! d8 d3 A* s9 x      )
; I4 C+ W# i% S( _    )" g4 R' |& L. T5 J
    (if (= dialog-state 1)
. ?3 j: E7 k- L  r" E  u      (modify_line)/ I! @- v* a1 u. h7 w, Z  ]  J
    )
& V0 L- m! @3 E2 v; N- t  )! v1 x( u8 q- a8 g# `- Y
  ;;4 `5 ~3 m& X3 |3 `: O
  ;; Modify MLine) x' A4 e+ {2 b. n' D0 m* r9 j
  ;;' O: \$ o" |  d# l
  (defun modify_mline (). B6 M$ _- m4 G/ ?# n- D: b" [
    (modify_properties)
: d/ O5 K) ]6 @* R: K* J( x& A- ^$ w$ e    (entmod elist)$ {/ i" \. `( b/ `- m! y
  )) n3 o, F6 y$ g9 D- T& U
  (defun ddmline ()5 K5 ^5 @) E( G
    (if (not (new_dialog "ddmline" dcl_id)) (exit))6 g2 ?* r! [  x7 Z2 g4 b# w/ Y
    ;; Set initial tile values
6 i, |6 w' s7 z- r5 n" \    (set_tile_props)% R. H" F) U3 V, N: v9 z
    (set_tile_handle)
( n: _6 e/ O" h7 x3 b& i    ;; Set mline style text field.) G4 Y% s$ N/ L' W
    (set_tile "ml_style" (cdr (assoc '2 elist)))
8 ^5 _% `* o/ k* y% D+ G1 h( R! r5 M: a6 Z6 R- r
    ;; Define action for tiles
9 v6 W; |7 q: z# K  q6 @    (set_action_tiles)
6 T; v" z. c" \3 D& j    (action_tile "ml_edit" "(done_dialog 3)"). `0 u$ `2 J3 n2 j+ S" a/ G
    (setq dialog-state (start_dialog))7 G* I  H; Q+ v+ n5 g
    ;; Dialog cancelled, reset to original values.
; |! d( D/ t' r& K% L    (if (= dialog-state 0)- w* ]- [7 M) t4 M6 l$ o# f& S
      (reset)
7 d$ w% e" s3 R9 n% [" R    )
0 L# Q' R& w3 R: \& a* n, B0 {- A    ;; Dialog OKed, update the mline., c( \5 i2 D. C% ]8 @
    (if (= dialog-state 1)5 t# y9 S& T! a# K
      (modify_mline)
  |8 c  k7 l* f9 N, s" E' Z5 L6 Q    ); j8 `$ v0 L8 c
    ;; Edit Mline, call MLEDIT.
  d& [" ?4 @1 Q7 \9 O    (if (= dialog-state 3)
9 ]5 [4 S& l! R7 k# i% N( U' @      (progn, `. _- T4 p! Y' L, q
        (modify_mline)
5 e9 s1 O& H) ^0 c; x' ]* r2 l1 k        (command "_mledit")
3 y0 |0 \/ i  z: y- b        (ddmline)
$ ?4 }9 V# M( ^0 S$ c  i      )
' Z( G7 X" d8 c) A3 @    )
5 z& x( ^1 g! {6 e  )
% k# {# w: G/ s% t9 o9 m& y  ;;
2 C" E' ~* ?* z8 e, V1 U  ;; Modify Xline
* R& E1 S( G4 d  ;;' L3 Z- I# n4 ?0 i/ q- d
  (defun modify_xline (flag)5 E$ _/ m# {! f/ y
    (modify_prop_geom)
6 V+ ~; D6 L6 C5 v4 ~  d    (setq xline_pt1 (list xline_x1 xline_y1 xline_z1))1 \6 ]5 U8 G. E; `# ?( t
    (setq xline_pt2 (list xline_x2 xline_y2 xline_z2))9 n+ q) q1 o* Z7 e* _- H, f4 t
    ;; Update the Root point.+ A5 J6 i/ K; g! A; Z- e
    (setq elist (subst (cons 10 (trans xline_pt1 1 0))! ], s9 D8 P0 I) v6 d
                       (assoc 10 elist)
0 H& B8 K2 Y6 f0 a3 N1 q) Z                       elist
9 l8 L  e3 G$ i* p# l% v% u                )# {: q  D- a+ }' y! X9 N
    )
' d+ C! @+ E' }% X    ;;9 K7 A" q9 R& P% J( n5 B0 n
    ;; Calculate new Direction Vector WCS: d  g  G% {6 u
    ;; x / (sqrt ( (x**2) + (y**2) + (z**2)     ))8 _0 V/ ?, N, A, f- C

/ [: E6 G# z5 i$ `" j    (setq temp_dir (trans xline_pt2 1 0))1 s# A6 ~& x* O0 c5 z3 E! p
    (setq temp_dir_x (car temp_dir))
9 }  U2 X& I, [    (setq temp_dir_y (cadr temp_dir))
8 k2 Y1 Z2 x- k7 q" N9 h    (setq temp_dir_z (caddr temp_dir))
# {: P6 ?: k, A+ A' p6 L3 Y/ @. R/ J* z( m
    (setq temp_xline_pt1 (trans xline_pt1 1 0))
9 Z5 U  Z" D* y+ K1 ^' A2 l2 q    (setq temp_xline_x1 (car temp_xline_pt1))
% V5 t) l) a3 p0 a: o1 n/ x    (setq temp_xline_y1 (cadr temp_xline_pt1))
& `4 n% L3 K; }* x8 E# c% r    (setq temp_xline_z1 (caddr temp_xline_pt1))
  g  H0 U8 q: g& f# J) j  K) \
; n3 C6 s9 D8 m) _, Y- p, }    (setq denom (sqrt (+ (expt (- temp_dir_x temp_xline_x1) 2)
8 q" s; I6 U9 C                         (expt (- temp_dir_y temp_xline_y1) 2)
, p; v9 C- k9 |  b) k) T) O7 z4 J                         (expt (- temp_dir_z temp_xline_z1) 2)
% b6 q5 q) t5 R+ s# i# B) Y1 Q# u    )))$ }' A5 U7 }+ _( j
    (setq temp_dir_x (/ (- temp_dir_x temp_xline_x1) denom))' W3 \! e% _+ `. \: i* W/ d7 N
    (setq temp_dir_y (/ (- temp_dir_y temp_xline_y1) denom))
! P) V6 p# p' D" }    (setq temp_dir_z (/ (- temp_dir_z temp_xline_z1) denom))9 ]0 L8 T0 @0 l# N) I) }4 |
    (setq elist (subst (cons 11 (list temp_dir_x temp_dir_y temp_dir_z))
) D, n$ ~$ S; C) O! ?                       (assoc 11 elist)+ I5 Y! D/ v8 o$ B9 n4 J+ Y
                       elist' Z0 U; H5 \% E6 d6 h+ G" `* x
                )
8 P! p; r- z" r2 ^4 H    ). P6 y! D" {8 X- E2 W
    (if (= 1 flag)5 {) n- p' W/ n" ]6 p& \4 E
      (entmod elist): A! R3 U: a2 I  a6 l! c
    ); J8 m; V' [8 J
  )
( `1 f6 L4 U: b# {& V3 o6 N- `; A4 Q" w
  (defun ddxline ()
" N; I# f0 T" ]! c% S  y% b    (if (= etype "XLINE")
1 D& [5 l) f7 T( X. Y8 L! u      (if (not (new_dialog "ddxline" dcl_id)) (exit))/ Q, X+ Q7 j. p2 Y. b
      (if (not (new_dialog "ddray" dcl_id)) (exit))
* v: _6 ~) k, @1 Q    )0 e! V' T- t: N) R! n
    ;; Set initial tile values1 a, {* _% T) B4 q( H, k% T- R
    (set_tile_props)
! `! C/ C9 H  ?$ a    (set_tile_handle)
0 p. W6 S* D3 _& ]    (set_tile_xline_pt1)! N  ^" \6 y& U3 V9 g
    ;; Convert to UCS and post Direction vector.
9 T+ A9 N8 S" C' r: y9 s" C    (set_tile_dirv)
  M; u) {8 X5 z# n+ K7 ~    ;; Calculate second point by adding Root Point + Direction Vector.
7 B4 `6 K" d- @7 G! D    (set_tile_xline_pt2)
# K. q( |+ l, x3 `9 H/ C) {    ;; Define action for tiles
" x; \. `, [' R# B    (set_action_tiles)! E; v6 k5 K- V/ w2 W+ e$ r
    (setq dialog-state (start_dialog))
. Q5 k) m6 L( ]: I. w. E    (if (= dialog-state 0)
2 n2 z& C( A2 \" z( m      (reset)
, e4 m; [/ D( c3 d    )
" p4 M' f) o/ ~/ d) w7 z( I2 F3 ~7 E    (if (= dialog-state 3)
5 j0 D9 x( Z5 L& u      (progn
7 H0 j5 w! G+ [8 ~        (modify_xline 1)! d" \+ q+ k; t+ E
        (while (equal xline_pt2
$ [. G5 S, p$ ?9 F! L5 ~5 @* e/ o3 D& A          (setq xline_pt1 (getpoint xline_pt2 "\nRoot point: ")) 0.000001)+ O; M. A8 w/ S# J
          (princ "The Root point cannot equal the Second point.")# ~  U; s5 ~6 P$ J+ A6 z+ [
        )
  A/ M. x% o1 m& j! Z& P        (ver_xline_pt1)
) C# p# W' C8 V* U# U% c        (ver_xline_pt2)% e* Q( U) Q( N. O
(princ)
2 m/ U4 E" m+ e        (ddxline), c' F+ W6 [& j
      ), }" S: c( ~- k7 R# @* T; `
    )& \8 X5 g" d/ Y% K
    (if (= dialog-state 4)2 p' i* ]# i* p# b. I
      (progn5 M) n+ B. _/ ?; i! }7 {3 V) J
        (modify_xline 1)
: U1 b) H8 `8 q( F8 i$ c  Z' V5 s, L        (while (equal xline_pt1+ q7 u( m" h% E' |. r6 j- {$ u
          (setq xline_pt2 (getpoint xline_pt1 "\nSecond point: ")) 0.000001)8 L9 R7 g8 ]8 r; g! S
          (princ "The Second point cannot equal the Root point.")& o& v7 }) W. L+ S4 o
        )  u" M% |# u2 ~: m$ l: h6 _
        (ver_xline_pt2)' i3 ^) g2 y) t: X: l2 w) x, }
(princ)
' i  Q0 p- v0 v! u! k2 `        (ddxline), m, h! `& Y% q9 _  S4 i' Z
      )* N3 A8 d, D' W0 A
    )+ W, y2 v" V! n8 p1 t( {8 E
    (if (= dialog-state 1)% a7 ]" n0 ?) d5 P  A1 y
      (modify_xline 1)
; }* `2 j7 b! U3 ~( b5 H    )5 X' G6 M5 t2 y
  )) Y1 Q- l5 a# b2 t* i
  ;;
- u: f8 u" S" a! q  ;; Modify ELLIPSE
9 D8 b- o" W& V  ;;/ L7 v1 b* s6 z8 x6 Y! H" e
  (defun modify_ellipse ()
4 ]& r* z8 k" A& C+ y- a    (modify_prop_geom); W& E/ F# v# x; P) M, q- o+ |
    ;; Update Ellipse Center Point value.0 b- Y& H- B( ^- t
    (setq pt1 (list x1 y1 z1))$ ^  ~( ]& e! x4 M
    (tempmod pt1 10 1)1 ~, g* ?" D; U- Q/ y8 J* H
    ;; Update Start Parameter value.2 H/ Y" d' \2 R4 z: K) t
    (setq y_val (sin st_ang))8 a; Y$ ^7 q* G2 y
    (setq x_val (* rrat (cos st_ang)))
& J" z8 Y6 \: t; K- d/ l8 E5 q    (setq stparm (atan y_val x_val))2 \3 Z' B% _: W
    (setq elist (subst (cons 41 stparm) (assoc 41 elist) elist ))+ i' O. L/ N) c6 U  P
    ;; Update End Parameter value. Normalize it, if it's less than
; L; V0 |" u; |% a8 B) n2 ~    ;; the start parameter.
6 D. K+ l( S( a    (setq y_eval (sin end_eang))! D+ s6 L) I! _3 e: Q7 ^0 U, a
    (setq x_eval (* rrat (cos end_eang)))" G7 y9 b: J3 W- N  o# r$ `. N
    (setq endparm (atan y_eval x_eval))
- }6 |' f2 P3 {' J9 A    (setq diffparm (- endparm stparm))5 Z/ ^# s) E: q1 K
    ;; Epsilon of 1.0e-6 radians for checking a zero length arc.
3 E2 o7 {2 _3 m: L- O# j, y9 ^. }    ;; Since zero length arcs are not allowed - construct the full1 I% U0 ^* }( b7 ]( E( `( y' b+ u
    ;; ellipse in this case.6 c& a7 p. m% m8 t
    (if (<= (* diffparm diffparm) 1.0e-12)+ M6 i$ k% g$ D
        (setq endparm (+ stparm (* 2 pi)))
+ Q  G# J# ^  ^$ M- [8 P- t    )5 `% U! W/ y* F$ L
    (if (<= endparm stparm)) R% J+ h! J: @! o
        (setq endparm (+ endparm (* 2 pi)))! v) W- ~' H! x  F8 p  }% g
    )
/ _- y2 X( D  r: C" O    (setq elist (subst (cons 42 endparm) (assoc 42 elist) elist ))
/ _/ c! l" y/ j( ^( U1 ~2 R* v    ;; Calculate the Major Axis Vector by first calculating
( a! k; j; n' s    ;; a unit vector using the old Major Radius value. Then
. G) h; e) \  L    ;; Multiplying that by the (possibly) new Major Radius
  I5 K9 m/ M! Y2 a+ l6 [    ;; value to get the new Major Axis Vector value.# l( S. U7 |% Q
    (setq unitxx (/ xx old_majrad))1 N, B! |1 e) t/ G# t$ k1 q
    (setq unityy (/ yy old_majrad))
/ _; P9 i# P8 m    (setq unitzz (/ zz old_majrad))5 a! Y" d' `! u
    (setq newvecxx (* unitxx majrad))
' s. i- {, |9 i0 p9 h8 ?    (setq newvecyy (* unityy majrad))4 ]4 A- |% G. \$ k4 P, v9 Q0 _
    (setq newveczz (* unitzz majrad))
/ N+ S8 h) k; L+ l+ Y    (setq newmajaxis (list newvecxx newvecyy newveczz))0 W2 M- Z4 Z5 a$ g
    ;; Update Major Axis Vector value9 r) j  t, Y/ A. H3 G! ?5 G3 Y
    (setq elist (subst (cons 11 newmajaxis) (assoc 11 elist) elist ))
- [6 l- M6 m8 t4 [2 g1 Z2 p6 k    ;; Update Radius Ratio value
& Q- m+ |8 v; Q2 l! O3 ~1 ?  h    (setq elist (subst (cons 40 rrat) (assoc 40 elist) elist ))8 k" [. M. W; y8 g( Z
    (entmod elist)1 o6 J; q  l7 A8 r' G9 Y
  )& X" |+ q1 g) |: C
! V" |$ c1 H4 G! {6 k' W, r: g6 ~
  (defun ddellipse (); N/ A& q3 E; ~. [7 |
    (if (not (new_dialog "ddellipse" dcl_id)) (exit)); z! q8 N% s" r, T& ^2 K
    ;; Set initial tile values/ [: `" l% `5 ~7 X5 F
    (set_tile_props)/ N! ?2 X1 i* Z3 w, c9 ]' V+ o7 X
    (set_tile_handle)
8 X/ A1 ?" ]0 X) ?' Q    (set_tile_pt1 1)
# C; m) z8 s' X, E3 [    (ell_calc)7 V! O8 n0 {9 M1 o' q
    ;; Define action for tiles+ z  h! N6 c5 f/ ?. A
    (set_action_tiles)
' l* d& C# b/ o    (setq dialog-state (start_dialog))1 {4 j& l. S$ r: F; s5 c4 Y5 a% x- m: B
    (if (= dialog-state 0)
( t( D1 l4 s% y& k+ ?      (reset)' G8 B3 f! E: V' W0 ?4 o8 Z$ b
    )
- t4 Q6 F7 Q! M% Q9 y5 ~) Q6 R/ Q4 f    (if (= dialog-state 1)5 t( W- N1 ^. c# y3 H$ {8 u7 W8 C
      (modify_ellipse)
. D( n' ^+ I2 ^+ \/ \    )
, \, ^2 y- m& ^& b4 }4 x3 U8 d    (if (= dialog-state 3); w! A1 y/ |3 E3 H! b) b
      (progn3 X6 K- t9 T+ ?. t; B8 {% M
        (modify_ellipse)% _# |3 Q: F1 ^6 [
        (setq pt1 (getpoint (list x1 y1 z1)  "\nCenter point: "))  V7 J8 D8 X" K: t) l
        (ver_pt1 1)
! a6 T3 B2 e' _. |        (ddellipse)
5 w7 A- Q- Z( M) T2 _      )
6 V. Y9 @' c6 t4 K* p. j    )4 l7 b0 S" W$ o- R2 G& D% P
  )
; z$ A  \2 h! k6 s5 P8 G  ;;
' x: c# C% {6 w# l5 R2 e, M6 p; }7 r  ;; Modify REGION6 h; q; Q% j4 {# u/ H4 U# c+ [
  ;;# D% T# R) X, L" g# y1 x. M2 [, A
  (defun modify_region ()
) s: W7 \! Z- D    (modify_prop_geom)
$ e# P, Z/ d8 E% I: F    (entmod elist)( d+ y* ~2 p( m6 G2 n3 Q; v
  )
* s. ~$ w) I. |: R9 `- r% }
0 w' U" Z+ H! J1 s+ X  (defun ddregion ()$ i  B- Y; v6 d7 S$ _% k
    (if (not (new_dialog "ddregion" dcl_id)) (exit))# z: p& Y4 k3 s' n4 q
    ;; Set initial tile values& R( x9 |% n( j
    (set_tile_props)! H+ y/ j# @: _3 ?" ]7 l
    (set_tile_handle)
9 ]6 @) N; G# ]8 \- h8 y    ;; Define action for tiles
1 N& a; E  n3 `* k/ n2 l    (set_action_tiles), v) L) d$ w: t; x
    (setq dialog-state (start_dialog))* z/ C3 y. K& l6 ~8 u, g' Y- D
    (if (= dialog-state 0)
$ m8 a( O, z9 {/ ?      (reset)
3 s1 V; l) k1 R  o7 Y4 ?    )0 d2 Z& s, h7 U9 `6 h
    (if (= dialog-state 1)
  l7 i+ K( W1 G6 G9 O6 |; b' Z+ Z      (modify_region)" D% \3 a/ h* }8 i/ F
    )
( j9 e4 a4 Q1 j0 B: N: h5 i  )& z2 W% o. J- i, B+ J+ p5 k  v6 t1 G: B
  ;;. O1 q' t8 o- g( n' j
  ;; Modify 3DSOLID
& C. s. w# _. n; }  ;;
; h# ~2 W; ]9 d5 _9 j  (defun modify_3dsolid ()) N# s. [; h7 [( Y$ p0 z
    (modify_prop_geom)
4 r) W* `5 [% E    (entmod elist)
$ h5 O5 A; S: W5 J  )
: J% Z1 S/ w, N5 Z( x+ F# l& ^+ H8 L% V
  (defun dd3dsolid ()3 f. f- k# ^2 w) ^/ {+ A. S
    (if (not (new_dialog "dd3dsolid" dcl_id)) (exit))
3 \* X( X4 L) d; `: d    ;; Set initial tile values" H8 f( B; p; F: d
    (set_tile_props)
3 P% p  B9 I( i2 H/ j. u" y( h    (set_tile_handle)+ j2 y' C/ |- @  l; H: z
    ;; Define action for tiles
6 Q5 ?2 P* Q4 o! p: h4 {    (set_action_tiles)
4 c. p8 _, u! [, _5 Q' |# C    (setq dialog-state (start_dialog))
5 @# a+ L+ J* c7 j  j8 i  `    (if (= dialog-state 0)
; }7 K! p6 x3 R1 V* n- j" y& W% R      (reset), g, T! T0 G3 [! G/ ^
    )
9 |4 D4 |0 v8 ~5 o( a! d$ |    (if (= dialog-state 1)
# A2 X% K) b- a% I8 N- h      (modify_3dsolid)
: Y$ a& X: U9 k7 J3 D    )
, R$ A& Y5 N* V  g0 v  )
& S, _3 [' l' x# O! c3 w  ;;
* H3 H3 Z4 [6 M( m  ;; Modify AcDbHatch
  M1 H( R& }* d  ;;
" b! w8 y9 ^7 z! f8 N  (defun modify_hatch ()6 E3 }2 m. G+ R4 M2 x
    (modify_prop_geom)2 z& Q  M8 G' E! Q
    (entmod elist)
" V; C7 {  z1 C8 f0 ^# Z  )
0 r3 z: B9 {! j4 q8 d7 V3 J9 D4 Y, p4 D; k' C8 K
  (defun ddnewhatch ()
( Y2 m: X- O" z7 }, I  \5 C" D5 J. G    (if (equal hatch-elist nil)
- s7 i5 {  ], x  L: I         (setq hatch-elist old-elist). g& \" @+ U4 s" Z- ~
    )* `6 o- ~' J/ H6 p4 T

+ _& P6 e$ }4 [/ o    (if (not (new_dialog "ddnewhatch" dcl_id)) (exit))
" B" G5 j. @( t# k4 ?% E/ k0 y- Z' d  C: E& e
    ;; disable the thickness tile
# d. g8 c8 c! m2 {/ Y    (mode_tile "eb_thickness" 1)- l) p. m6 P( k: Z6 |! Z
    (mode_tile "e_thickness" 1)
6 p8 Z, D9 k1 s7 }
8 L/ ~% ?& C1 X# j/ m    (setq help_entry "modify_associative_hatch_dialog")- [# a6 ?5 j) K% T( u( A. b
    (set_tile_props)
) `2 d3 ~. ^6 Q" B, ~% t5 o    (set_tile_handle)8 _$ ^$ O% v- G

" Q7 W  Z, F% V2 f/ U' X0 y8 g    ;; Define action for tiles; i( I* u: c2 j% S* R3 I& ]. @
    (set_action_tiles)( W- }* F4 o: e
    (action_tile "b_hatch" "(done_dialog 2)")
/ G6 k7 W: Z5 j& n    (setq dialog-state (start_dialog))
! N( x( C) p  {$ Q8 ?% m! a    (cond( ~$ K! S  I2 h  J  H* {2 l) q
       (  (eq dialog-state 0)
9 ]. ]/ Y8 u8 W9 T          (setq old-elist hatch-elist)
: G5 R, I6 o1 w          (setq hatch-elist nil)
8 @: t% ?; L6 ?3 ]/ {          (if (= (checkforlockedlayer ename) nil)% i) N) P3 U& R, q- a* o
             (reset)
9 C& [6 y) o: Q- o$ ?             (progn         ;;; special handling for locked layer reset. N! v" r: g/ G
                ;; unlock the layer
& f3 P, Z& s+ C' D5 }3 y                (setq layername (cdr (assoc 8 (cdr (entget ename)))))9 z7 f6 [# B9 l4 U8 L4 G0 m
                (command "_.-LAYER" "_Unlock" layername "")
5 q1 w. k$ J. N/ F6 M! T' g: m1 z                ;; reset modifiction5 ?* x5 Y+ }6 R! \7 O1 I% [
                (reset)7 T+ j' Z" R- y( Y
                ;; lock the layer again
) N8 F1 |1 Y/ l* A4 u                (command "_.-LAYER" "_Lock" layername "")% x. t0 M0 ^5 x- \
            )
; Q4 O6 Z* M% f& }  }# j) F          )
3 f4 Y2 I% C1 Q4 Y* A          nil       ;;; makes (ddnewhatch) return nil for Cancel4 W0 r: l1 Z0 b) y2 b# a/ h
       )8 p3 r( L1 }: n; `2 ~( ~( d
       (  (eq dialog-state 1)
' E% x" f. B* {/ ^9 U          (setq hatch-elist nil)
4 K9 n0 Z' n' b6 [! @3 g          (modify_hatch)& I5 t: w% I( F# r0 Q5 m
          T         ;;; makes (ddnewhatch) return T for Ok# X  S: c- _4 W2 Z" W- Q
       )
# h0 ?4 Y0 n' l       (  (eq dialog-state 2)
2 @0 e( ~% k% G( w% F, q. B2 w' u6 \0 t+ ], P
          (if (= (cdr (assoc 70 (tblsearch "LAYER" elayer)))* Q2 p. B2 Y5 |9 P2 ?
                 4
1 R8 C# g) R8 a& B( X1 Y              )             - T! E$ _1 Y/ t. k0 a# X$ c/ p
              ;;; new selected layer is on a locked layer
* V; a  B4 g6 g; ?# \. U- U3 X              ;;; we can simply modify the hatch properties
1 x* l9 T0 ]/ q; v; j              (modify_hatch). o, L* y6 E9 e9 E5 m+ H
              (progn, i* a; e4 l  {! _. k  H
                    (if (= (cdr (assoc 70 (tblsearch "LAYER" (cdr (assoc 8 (cdr elist))))))
5 f4 N$ B  b0 N/ z1 _                            4
- T* G4 q- i- j3 Q: o( g) `                        )           3 r. ]3 q3 Z6 U8 d# j) \/ u
                        ;;; We changed the layer previously and now the hatch lies on a locked layer.3 ^4 D# I- |- u% p5 k9 |
                        ;;; We have to unlock the layer forethat we can update the hatch properties.8 N9 Y. ~& y7 N# r4 _9 y; P
                        ;;; If we don't do that (entmod) fails to update to the new layer.% h0 [- W0 h8 m0 P" w, h4 H
                        (progn" o# c2 T6 E. Q  D& l
                            (setq layername (cdr (assoc 8 (cdr elist))))
7 ^6 N8 o8 I% ~                            (command "_.-LAYER" "_Unlock" layername "")     ;;; unlock the layer
# g$ u% r& g' R/ K8 Z3 M                            (modify_hatch)                                  ;;; update the properties0 W1 m( Z% l4 g0 J* u) v9 I; l
                            (command "_.-LAYER" "_Lock" layername "")       ;;; lock the layer again
- F7 y# @6 R/ h' N) P( I3 s0 h; ^                        )
/ V7 q" S4 [% {( |" c1 z                        ;;;  All other cases we simply update the properties: v" y( C  V( ]5 E" r
                        (modify_hatch)
4 Y( y8 m1 w" S( I2 p! j2 X% n7 _                    )
/ T( r' C# y+ e; e              )
0 E( @0 u; a/ `* b2 o          ) # x9 G1 b4 }9 U1 N- e
          (if (= (checkforlockedlayer ename) nil)
$ a9 k( H. }5 l6 r) u              (command "_hatchedit" ename)
% C' q0 {! U" g) A              (alert ;|MSG111|;"The hatch object is on a locked layer.")3 L$ u6 v% F, K) S
          )
2 y+ L8 q4 u- `1 v. E# K          (ddmodify ename)
$ Q# S* t2 Z  A2 S" ~' S+ e       )
4 N0 M6 _. I, p  M/ _; U    )
2 U4 X1 h$ \0 o6 f* B# W1 _  ): p2 l& _; ~: b9 j/ R- X
  ;;+ S3 R' k. K! v% n  d6 B% S8 \
  ;; Modify BODY" |. b! F! K: f; z# s3 r; R
  ;;$ v# V# A5 S# [& y
  (defun modify_body ()
; G# p/ [( O8 R1 O    (modify_prop_geom)
( X! W. H  K+ d+ K) @' m; R0 }8 z* E    (entmod elist)$ e( k$ @, J* u4 m) K
  )
( E# H' i2 r2 |# o3 m5 _7 o* o' j$ n& }; f3 G- X, A
  (defun ddbody ()
  l8 x! l6 g! J! Y    (if (not (new_dialog "ddbody" dcl_id)) (exit))+ T! T: L$ V) J% D
    ;; Set initial tile values
* J" X1 p" z: Q    (set_tile_props)
! L2 G" [, \% w+ `" a( d    (set_tile_handle)% W9 U# f3 R! {
    ;; Define action for tiles" K. J6 ?% t& k3 X7 N- u
    (set_action_tiles)) U7 V& E3 R' c
    (setq dialog-state (start_dialog)): m2 L$ b  c5 O+ g) b- G
    (if (= dialog-state 0)
! y$ M0 a3 F# {1 W      (reset)6 f3 s) `) _" T4 P. p8 ]
    )
" E  E  q/ b4 O    (if (= dialog-state 1)
* h$ f# ~  J5 Q      (modify_body)
/ U6 m- Z! o. k1 p2 p, f3 ]5 N    )# }! W# u' a" }* l- u
  )
4 A# h0 \  d% f4 o$ E  ;;8 R$ H# h: t6 Z9 I1 H& _
  ;; Modify CIRCLE
0 I0 h8 f3 X, ~  ;;
/ |3 R" S6 W9 [( d- E4 G2 u7 m  (defun modify_circle (): g2 |# y& V+ u# r; Z
    (modify_properties)
& b2 \  ?5 o2 c4 \0 M    (setq pt1 (list x1 y1 z1))/ M9 `2 o/ \0 {1 x( q
    (tempmod pt1 10 1)5 d, i! c! c/ B8 n, C
    (tempmod radius 40 nil)0 u  Y) p3 y1 M3 r& b. ]0 \
    (entmod elist)
% t" V" C$ ~0 b. |' b8 n3 Z% m! Y  )
2 q2 b; A. Z7 ^4 K# W2 \. a
! r) v0 z1 S5 V! w  q- [0 r4 T  (defun ddcircle ()
  V+ L: O& ^! y  B, j$ W3 ?$ W6 z    (if (not (new_dialog "ddcircle" dcl_id)) (exit))( R- E( k" w' ?6 v
    ;; Set initial tile values! p8 z0 t3 ?3 T
    (set_tile_props)! l& u) O6 y) l* {. H, q: V' r
    (set_tile_handle)& I# d% o; D! w! i( g% y# k
    (set_tile_pt1 1)7 [0 F, w$ e* G
    (set_tile_rad)
3 o& ~! U; @; ?$ h; D    (cir_calc)( X/ p0 V8 y  |: B5 A
    ;; Define action for tiles
7 r  d$ l# Y' X% t# Z" P  N    (set_action_tiles)4 t$ e4 r6 b8 s) [
    (set_tile_pt1 1)
' N- _2 j7 d" f0 l    (setq dialog-state (start_dialog))
( N, X: R5 G& P3 L7 A8 ?  _    (if (= dialog-state 0)
6 |0 W' Z9 y! {      (reset)8 W1 j, Y. Y+ g
    )5 l0 t- `# e% p$ Y+ o" R* v
    (if (= dialog-state 1)7 n9 x& @3 @& k, J: e" @1 k1 d
      (modify_circle)
6 i$ p' Z( U3 `& W$ P    )6 N  B! @3 H/ \8 G% a
    (if (= dialog-state 3)! A$ I5 l: W# ?8 X: d& o1 y3 d3 Q
      (progn
- c/ {3 g- f2 m+ ]4 _% B) U* F2 Y        (modify_circle)
7 ^5 h- e! Q+ \( f        (setq pt1 (getpoint (list x1 y1 z1)  "\nCenter point: "))
% S+ r& o7 {' H3 `% P# [        (ver_pt1 1): \. P( o! u( J$ @
        (ddcircle)
/ Y: z% C. X; w# }9 s      )+ n; h- }' G% a
    ): K7 _1 ?5 m5 S0 m( L
  )
. Q0 B: S3 u% J3 ]  M  ;;
+ y8 m) Q3 g  a- C. V  ;; Modify ARC
4 Z" w& ~- [0 U  ;;7 F+ H! s. N3 C4 t2 v
  (defun modify_arc ()# j6 p* O4 E- c6 Z* N
    (modify_properties)+ x/ ?, T' }. Y+ A% I, K
    (setq pt1 (list x1 y1 z1))
: |3 s" C" F; {7 r    (tempmod pt1 10 1): u7 l! U: w8 R7 a. W/ c
    (tempmod radius 40 nil)
1 W, M- K3 E) u# T    (tempmod st_ang 50 nil)
  x; K4 H/ [8 q    (tempmod end_ang 51 nil)
, h4 ^+ B- c0 m3 U    (entmod elist)% b* Q# R/ ?' n1 D
  ), L* [: _9 D. [
  (defun ddarc ()
3 v) O1 V7 ^* ^5 L/ I    (if (not (new_dialog "ddarc" dcl_id)) (exit))' e, c! u/ _2 E. w0 ?
    ;; Set initial tile values' U! Z! U/ W8 _: B. n5 U: S
    (set_tile_props): B! b+ ?+ d  O
    (set_tile_handle)
/ D' B6 L' R/ M+ S  [; W) E    (set_tile_pt1 1)
& y. p6 f8 A: ]* K+ F% z7 P4 u8 ?/ ~& R    (set_tile_rad)& V4 n6 ^& @: j/ _
    (set_tile_stang)
' j# {& F9 R! g& `    (set_tile_endang)
! Q5 D6 u0 }% O3 r$ B0 K' p    (arc_calc)6 s( P, O: [. N, y
    ;; Define action for tiles
& x4 n4 x: e: i/ z* O4 t    (set_action_tiles)
( Z& t1 d% l) n  F% A    (setq dialog-state (start_dialog))
8 ]) {, j8 B: R$ U, Z' Z    (if (= dialog-state 0)" H, c1 U. T: m
      (reset)2 y5 E( d- t% O$ ^( N: |  @
    )8 R$ V3 u& `  T% p$ h
    (if (= dialog-state 1)1 X; [0 S- E# E  u
      (modify_arc)" W' |  c3 D- w6 q) E; l( q5 j2 V2 b
    )' P0 Z- O0 H: c8 ]  N* `
    (if (= dialog-state 3)
- R+ s) s% A7 j% [      (progn
4 v% C8 L; K& }  N0 g. q( J        (modify_arc)( @3 i1 F: F- K( j4 [
        (setq pt1 (getpoint (list x1 y1 z1) "\nCenter point: "))
$ O8 g; y* y, |9 G. ]' G        (ver_pt1 1)
- P1 P. Z$ G/ l, s  d# {" k        (ddarc)
9 f" j- h( V; R6 E4 B8 A# M8 K% Y      )# S- B# o0 H7 f, P- W5 b
    ). t! I4 ~9 o$ W; B( x
  )4 K* E* e" W9 r. K
  ;;
) P. D1 v( r4 p2 A. h6 z7 x8 P. N  ;; Modify SOLID or TRACE- P& V$ q! @/ {7 }
  ;; Note the Z value of the object is determined by the Z value of the fourth
" M8 y$ s" Q# E7 s% K  ;; point - code 13.  Changing the point values of a solid or trace from a UCS% L* g- g- c! u
  ;; that is nonplanar to the UCS the object was created may confuse the user.
$ X+ ]/ X3 s5 W  (defun modify_solid ()
" ?( D+ g  P0 e. g1 n    (modify_properties): L1 {$ L( Q' t) _' f) ?8 W
    (setq pt1 (list x1 y1 z4)); j7 K+ e+ i" t% L; H) D
    (setq pt2 (list x2 y2 z4))# j& N- O1 K* Z
    (setq pt3 (list x3 y3 z4)), x$ k  F- @4 z0 `
    (setq pt4 (list x4 y4 z4))0 a; H* P' ~' b- ]$ c. }! Z
    (tempmod pt1 10 1)( s, n. ]- b  X+ v& Z9 O
    (tempmod pt2 11 1)
0 ~1 V- E# p. t3 A! F    (tempmod pt3 12 1)3 a+ H3 G: L5 F' g8 c
    (tempmod pt4 13 1)  I3 B8 J, g* J# j
    (entmod elist)
4 P( ?. ]  U9 V, f: U  )+ |& `2 {# t, z8 E/ d
. R: R' `8 K4 P5 d
  (defun ddsolid ()
( U9 p2 ~+ P. Q: R/ t* y    (if (= etype "SOLID")
% T5 Q: q/ w7 z7 e# F' o        (if (not (new_dialog "ddsolid" dcl_id)) (exit))) _, ^2 z2 \8 W
        (if (not (new_dialog "ddtrace" dcl_id)) (exit))+ x& v0 v& Z/ k' J0 e" i
    )
! J6 W9 O- |) L. i    ;; Set initial tile values$ A" f2 c7 c% l- R* T; R
    (set_tile_props)3 t! y4 w: d1 {( [5 `3 E7 {  ^
    (set_tile_handle)
! W3 Y0 u3 f3 k( D* \- B& g$ t    (set_tile_pt1 1)- m1 E$ }* o. u- p! j
    (set_tile_pt2 1)
3 r# f0 R. C+ X' i, t* o    (set_tile_pt3 1)
! Q% m" a) {8 v7 P, d% \    (set_tile_pt4 1)
3 [" J, o: c8 u+ o+ X  z    ;; Define action for tiles) `+ z% `4 K2 k! D2 {; U
    (set_action_tiles)
$ l7 x: o. E+ A( N  \    (setq dialog-state (start_dialog))6 o; g, Y, y0 R  P" h
    (if (= dialog-state 0)
. A+ U* i; q0 `      (reset). q% R: w9 T- ~4 N& n. H
    )
! {: \2 I5 X/ D! p7 n" R    (if (= dialog-state 1)
$ v$ Q7 K7 d+ |- ?& V# @3 @* i      (modify_solid)1 ]. K8 d/ p3 B# A
    )( d7 A% ?! L6 _. B5 M5 U. b+ w! H
    (if (= dialog-state 3)
5 t5 @2 K5 D- z2 G      (progn7 N) c- ]$ j  l
        (modify_solid)# H/ W) c5 h: t% R. ^3 W; h
        (setq pt1 (getpoint (list x1 y1 z1) "\nFirst point: "))
+ C  j* n2 N' {5 T9 w5 I' ?; ~' r        (ver_pt1 1); v$ e; S5 A+ R) ]+ i  E
        (ddsolid)
' K. {7 l0 J0 ~( C9 [! A      )0 G! u/ Y* w7 A& M4 B7 ~% D
    )
5 R0 H( e' X- w3 X; j0 ^2 L- F6 T    (if (= dialog-state 4)
! U  M6 ?3 |8 j7 @( Y* t2 p( a      (progn
' U' D, ?- }' @) b) B" p5 L        (modify_solid)
" e3 p* a% G4 ~" R3 ]  e# \        (entmod elist)
; {0 S7 f, P8 x        (setq pt2 (getpoint (list x2 y2 z2) "\nSecond point: "))
  @2 |# N/ ]3 B" z$ t3 W8 V        (ver_pt2 1)
# j- h3 R" L" l- K( f) D        (ddsolid)
( Z; G! Y9 J4 H6 \" b1 l9 {      )3 ^+ u# g0 g7 e6 z, }
    )4 A$ s+ G2 j( s, z: o& ?8 ^
    (if (= dialog-state 5)1 S1 r8 q# i" [% ^- g3 Q
      (progn6 ?. m1 i3 `" y
        (modify_solid)0 {3 u- H( B3 i7 _6 f. q
        (setq pt3 (getpoint (list x3 y3 z3) "\nThird point: "))
. Q! _* x. o6 a        (ver_pt3 1)
2 n9 {  ~4 v( ]8 p        (ddsolid)
/ w) L; H% C4 B; b% g      )
$ C5 w/ m& J1 |! Z3 A2 c& p; _    ): K, q2 m( G6 V: i
    (if (= dialog-state 6)# O3 Z: y" S/ N5 N" x0 `
      (progn8 @: I+ S2 s9 `1 _+ d9 s
        (modify_solid)
, b/ n2 I0 i  ]0 y1 `( D1 @7 S        (setq pt4 (getpoint (list x4 y4 z4) "\nFourth point: "))
! N; I6 D7 w+ I$ q. V4 v+ g! _5 Y        (ver_pt4 1)) u- Z0 _7 y9 K2 R% a7 D
        (ddsolid)
4 U3 a0 ?7 c; Q! P' r      )+ y" ~: L' H- w  N
    )2 d/ Z6 z& @7 {- p% y; L* k" Y
  )9 g, h3 P) D/ X5 o
  ;;
- H* h+ i& `. ]1 M! n% f9 q  ;; Modify 3DFACE
$ u, @% G1 ^# V  ;;1 _) V: \' }' N) A
  ;; Check visibility of edges
6 [) j: G- S9 ]: I" `8 o  ;;/ G- l! y+ F" Y6 W) S. O' U
  (defun edgetest (/ bit1 bit2 bit3 bit4)
# C* X5 L8 t, }    (if (= edge1 "1") (setq bit1 0) (setq bit1 1))
" `# ^$ y$ s) |  c/ J    (if (= edge2 "1") (setq bit2 0) (setq bit2 2)): M# N) O# K- H9 a: A% G4 R
    (if (= edge3 "1") (setq bit3 0) (setq bit3 4))
: x/ z- Q5 z  E3 {. D# `    (if (= edge4 "1") (setq bit4 0) (setq bit4 8))$ R% q3 t1 M  R- ]+ V
    (+ bit1 bit2 bit3 bit4)! U; }" Z/ E/ C( \( h
  )
. c. K, L  b( n
3 {0 b  S! \! P1 @. N  (defun modify_3dface ()
! \, |% _) K4 Z* r  v  F; V    (modify_properties)
3 `) U- `7 ^* P, U    (setq pt1 (list x1 y1 z1)), x2 s2 M: `1 J; l
    (setq pt2 (list x2 y2 z2))* T2 I* r8 V( f8 p6 T
    (setq pt3 (list x3 y3 z3))
2 Q4 p5 t0 ?8 p9 T, W  A% t    (setq pt4 (list x4 y4 z4))! E8 q% U9 t, Q$ G
    (tempmod pt1 10 0)- b; ~* q0 @6 i9 B' S
    (tempmod pt2 11 0)
2 i- \5 Q: \0 D; ]; d    (tempmod pt3 12 0)
, D/ S" [* f5 u9 m, v+ r* `6 h& K5 x* e    (tempmod pt4 13 0)
/ E$ G# x/ I$ P0 t    (tempmod (edgetest) 70 nil)
+ n% N9 U- t! M3 Q6 W    (entmod elist)
2 I4 \2 @: x- B9 v% ~& i+ C  )* c. I% {, u% r3 W- F( o; [' T

* B& V7 \- r* B$ ^  (defun dd3dface ()
0 k# M. A2 e* C# R7 @    (if (not (new_dialog "dd3dface" dcl_id)) (exit))- a: G1 l$ D/ ~9 N
    (set_tile_props)
/ s7 b% k1 s8 o. p) o5 |/ ?) S    (set_tile_handle): Y0 p! I( O1 e! j  W
    (set_tile_pt1 0), ~; n! s8 J7 o) \
    (set_tile_pt2 0)3 U/ i& d+ Q3 O, T. b* R
    (set_tile_pt3 0)/ ^2 \6 m9 l$ R' U9 S$ z
    (set_tile_pt4 0)
- a0 V9 s" ~* I  `1 r    (set_tile_edges): w2 \$ \, f. s4 U0 t7 U; ]
    ;; Define action for tiles
7 Y! x: z! V4 s% s8 T8 y    (set_action_tiles), m, ^5 T# K" h, [: Q0 k  B" B
    (setq dialog-state (start_dialog))
# n) b" Q5 h! Y! x    (if (= dialog-state 0)
) C2 {- d" Q% ?1 }      (reset)0 {3 g0 K- k! V3 L
    )
6 F. W/ }! A: p# p( i    (if (= dialog-state 1)
$ }, l' U8 i. \: h1 W$ m5 }" x      (modify_3dface)3 f+ X3 Q: S- C5 j* I8 I2 V$ K
    )
$ z' G+ O  Q' j) B4 O4 _    (if (= dialog-state 3)$ ]4 q6 N3 q( K5 j" v" s& ^0 T$ w
      (progn8 K* R6 O- H/ Q4 G+ x; U
        (modify_3dface)
' t; O( k; M7 O. u7 a* w. L' |+ j- a5 R        (setq pt1 (getpoint (list x1 y1 z1) "\nFirst pt: "))7 ~. W1 W, W# z/ i* S$ w/ ?1 a
        (ver_pt1 0)9 [: C' b  P  R0 e* w) u5 j; d, u
        (dd3dface); Q* d4 w  K/ I+ Z) Y4 Z: Q
      )
: E& f+ h* w+ H) t& h9 t    ), j+ ~6 u9 l3 D; k0 v
    (if (= dialog-state 4)6 J4 l* o7 t( B8 |/ X
      (progn
" A. F$ F0 H* O* Q' d8 O' z        (modify_3dface)+ u1 h& s5 g. V/ }8 R' T. m0 N
        (setq pt2 (getpoint (list x2 y2 z2) "\nSecond point: "))5 U$ A. R# a$ d  K
        (ver_pt2 0)
! @( E) f, q' o2 m  d1 Y        (dd3dface), m9 P$ C- X4 b# `
      )
! [  x) t- t% g; C- O8 D    )& h# k4 e. v! U# j2 E2 d" Z
    (if (= dialog-state 5)
9 ^5 `4 P- @' n6 ^: V      (progn/ ]% n2 a5 S) ?& \6 ~
        (modify_3dface): l  A! \4 M( n' s
        (setq pt3 (getpoint (list x3 y3 z3) "\nThird point: "))
* Z' B5 o) W' e0 z: K        (ver_pt3 0)
7 l- w" c" l7 i8 Z8 u        (dd3dface)
1 M9 G) {) p5 }      )% J' N% i! i% ^* b4 Y) P: ?2 J% _
    )" P4 @0 G" K7 W$ A" _% ^* p& @7 y
    (if (= dialog-state 6)
0 V" A( d5 J  y: w/ [      (progn
! m9 I: s8 b1 c8 ^5 I( l; r        (modify_3dface)7 P. x7 u! P" a' M$ {. a3 j
        (setq pt4 (getpoint (list x4 y4 z4) "\nFourth point: "))
$ a7 M4 E$ `* g( Z8 f) T: f" n        (ver_pt4 0)
' n" ]/ k. _4 q        (dd3dface)/ V" ~7 o; W# `3 R1 L
      )' W$ @" t* x: y( P
    )
+ D1 G9 l4 v- d9 Q$ E; I7 W2 A  ); r2 D+ r1 t. M  o7 `- c1 ]: Q
- Z' A  `  L. O: a
  ;;
; \$ E& J; R0 U4 ^  ;; Image functions
( c* J, _2 d9 i1 i9 u  ;;. Y- G1 I6 l% h7 ]9 ^: O9 k4 W5 t; L
  (defun image_scale (/ upixel en n userscale temp). q. f9 h- v8 E! y8 k0 W" t: {
    ;; Calculate the size of an image pixel in AutoCAD units
1 V4 b; @! h7 q+ \4 x/ W: Q    (setq upixel (distance '(0 0 0) (cdr (assoc 11 elist))))
2 P/ }2 s4 _, N3 C) c6 j* n& M
7 o! ^# Y% L$ r$ \    ;; Retrieve the user scale
  u0 P( Y9 `) z2 m/ y9 A3 c    (setq en (dictsearch (namedobjdict) "ACAD_IMAGE_VARS"))  I  @1 z3 c- V& c/ D
, h6 Y$ F: ~! L1 L% f5 o# }
    ;; Next, extract the image units and pixel resolution0 N6 }( E: i7 R& z' C& T( X
    (if (or (= 0 (cdr (assoc 281 image:olist))) (= 0 (cdr (assoc 72 en))))
+ \: W/ \) u. H1 U3 _1 n      (setq image:scale (* (cadr (assoc 13 elist)) upixel))
3 F8 o+ r' `; ]      (progn& S* h% u1 b$ K8 j' U
        ;; Convert the user scale to the proper word+ x3 s+ u5 Q- v
        (setq n (cdr (assoc 72 en)))
  i4 p) o- x6 w5 D: W  Q+ Z        (setq temp (getvar "LUNITS"))
/ |. Q  K; q2 F. t3 M1 t& C        (if (and (/= n 0) (or (= temp 3) (= temp 4))) (setq n 5))2 |; ?$ T* U6 a+ ]3 m+ K- k% A
        (if (= n 1) (setq userscale "Millimeter"))
) z( K! p5 p4 t& T3 i        (if (= n 2) (setq userscale "Centimeter"))
/ e" ^  G  g- z  R- z! |; f8 \        (if (= n 3) (setq userscale "Meter"))
) a: P# f8 ^3 c6 {        (if (= n 4) (setq userscale "Kilometer"))$ P9 k4 G* o  N7 x! F4 E, _0 ^/ m
        (if (= n 5) (setq userscale "Inch"))
9 e7 w- R3 r+ Q4 Y        (if (= n 6) (setq userscale "Foot"))
$ k% }' S: y" s4 f# q        (if (= n 7) (setq userscale "Yard"))
6 P$ R- d) i2 E- ^  g        (if (= n 8) (setq userscale "Mile"))0 y! A9 x! i# j0 R/ x
        (setq image:scale (/ upixel (cvunit 1 "Millimeter" userscale) (cadr (assoc 11 image:olist))))
4 k8 W+ R( w+ L9 Y2 A, P3 R      )& ]1 P/ I. M; j( C
    )
5 {9 Z# [% t6 z  )2 z. \* T4 X/ V/ X/ O1 N
# r+ M& X+ @9 z
  ;;9 b7 H; D- E4 A& J6 Y3 N. b2 n
  ;; Scale factors for block insertions" n2 c2 T0 P2 P
  ;;
. Q9 m* S' m: X. j; }" ^* P  (defun image_set_tile_scale (/ temp)( ~1 l5 }8 N$ R4 L" a. k! j' _0 k# o
    (setq temp (getvar "LUNITS"))
2 Y) E' p% w7 N+ B0 H, B- F    (setvar "LUNITS" 2)
0 l- J1 x/ ?( K0 _    (set_tile "xscale" (ai_rtos (* image:scale image:mult)))
& U3 F) B2 ^. j    (set_tile "wid" (ai_rtos (* image:width image:mult)))$ o8 a6 C& S3 ]. b8 [# Y: ?
    (set_tile "hght" (ai_rtos (* image:height image:mult)))
5 o! k: ^; O5 G2 f/ R, ]5 N    (setvar "LUNITS" temp): U0 T5 i. T# b- Z
  )
( \" A( E( Q$ `5 d* S* g( q7 _6 K# e+ P; k) u& c  ?9 g: F5 e, }
  ;;$ x9 s9 R$ E, ^& v. y
  ;; Set the scale, width and height values appropriately.
$ s! M  H0 g: V6 ?8 `  ;;7 R" _. `' A# ~- o6 M7 \
  (defun image_update (field value / orig_value new_value mult)8 }4 q* `1 N1 u  T9 u7 a5 I* q
    (if (= field "xscale")  U  N9 E" j0 P' k0 a
        (setq orig_value image:scale)  W# V- \* t0 V# Y0 C* v6 q  r
    )
2 Y7 ]7 B( u2 G: [/ _    (if (= field "wid")
' G( ^. @* @) j        (setq orig_value image:width)$ L+ h  z/ C: u* a
    )" A6 O0 Y! \0 @9 K) c$ A
    (if (= field "hght")
$ \8 t7 i6 I- p* n' a4 m) q        (setq orig_value image:height)
, W2 G6 L5 j% R7 W. {- M    )* q5 G; A2 C. P" x" t
    (setq new_value (verify_d field value (* image:mult orig_value)))8 j& |' q+ V- u; L1 W, T3 i
    (if (/= new_value old_value)
! J* N2 R& u" o5 g: o      ;; Make sure the user has entered a sufficiently large value
9 w2 p3 L$ M  r      (if new_value( _9 T7 `9 F, ^: ?* t& G. c
        (progn
9 O( [$ @) Q3 {, T          (if (< new_value 1e-8)
' }2 _; ~! S6 L( j2 z, _8 r8 w" w            (setq mult image:mult); q( w; u0 r7 y" A; `- [
            (setq mult (/ new_value orig_value))) S( |# m9 @: ~  ^2 h$ Z- Q
          ), y, z  A6 D: E$ \: B  Y! D
          (setq image:mult mult), n$ v, @5 \( {* G, H0 F  }, j
          (image_set_tile_scale)
  u6 ], d% ~0 M0 V. f        )
; B: X/ s7 b& w6 x: |! ?. h      )/ Y* d& i) _: c; ?. N& a. `6 f  E
    )0 V2 R+ k9 {$ r* s  A
  )2 G. [7 f+ Z0 R- K7 w/ G
9 D" O3 X3 }) {6 Q4 q
  (defun image_disp_opt (bit)* a' m0 r4 n* P/ y+ Y
    (setq image:options (Boole 6 image:options bit))
$ s  F# b+ y( W) b+ O  )0 `7 C- C# P: ?$ h$ `
, P& D5 r# L/ k0 {4 j  V
  (defun image_modify ()
- c% p0 E) V$ D8 U    (modify_properties)
- j: N! r% D0 A    (setq pt1 (list x1 y1 z1))  f; F7 w0 D) K) Z. x
    (tempmod pt1 10 0)
8 N$ t' z5 ^0 Z8 Q' I- o) n8 d    (entmod elist)
* e$ {$ s! z% _0 M2 k6 }; B  )
$ v$ I( U+ u, ]/ m. l
1 o: H0 P  r' v; D" p& q  (defun image_clean_variables ()
# N: l/ Z# ~4 \3 X$ Q+ P    ;; Clean up global variables used here$ m! X" k: a& X2 q1 ?0 H2 ~! P
    (setq image:scale nil)2 k, n2 R0 p2 |
    (setq image:angle nil)( K* H. {. W) E  ~  J0 y
    (setq image:width nil)/ U& r) |- ]+ c  O9 S: m9 X6 @5 N
    (setq image:height nil)' i* f, @5 N9 K, n5 m
    (setq image:options nil)
3 B9 Y  C% |. R* F* U9 a8 l    (setq image:oname nil)
- Y7 t3 i! _3 ^# B  q    (setq image:olist nil)8 }& V* A- ?6 V8 W( N
    (setq image:mult nil)
+ c7 r; U- d$ l: l3 g. ]    (setq st_ang nil)
0 n% ^4 h, w, |6 S# \+ e  )7 ~0 T* ^2 `* \" B% g0 _2 Z2 ~" u

4 I; B  I6 g& J0 C( }& R  (defun image_scale_vector (v1 value), M! B3 Q  g$ p. x7 f: J' a
    (list (* (car v1) value) (* (cadr v1) value) (* (last v1) value))8 J: v& @( B8 H; t2 O3 C% t7 ^" X
  )
# a" z2 |6 c, D9 q! P/ I. A) R# u  @. W$ s
  (defun image_cross_product (v1 v2 / vx vy vz): n, H2 t6 ]' d0 S
    (setq vx (- (* (cadr v1) (last v2)) (* (cadr v2) (last v1))))
* w; U4 e  h' m9 N% D7 P    (setq vy (- (* (car v2) (last v1)) (* (car v1) (last v2)))); T7 ~; w* Q" ^: E. M% \
    (setq vz (- (* (car v1) (cadr v2)) (* (car v2) (cadr v1))))
! l6 ?) E& F; w6 t, A% K    (list vx vy vz)
5 v  l3 u- B: Q! r  )
, R  V" n& z% g- p
& ?  L7 w; o$ G7 n( c7 u  (defun image_dot_product (v1 v2)
. e; ^1 v& G+ @; A+ X; ?    (+ (* (car v1) (car v2)) (* (cadr v1) (cadr v2)) (* (last v1) (last v2)))! z* I9 u4 t* @
  )
# K' T: {; G1 H
, p9 ]- q, X0 ~2 h% R* Q8 d; f  (defun image_add_vector (v1 v2)
( {$ g! `+ `( Q4 ?% E( E! `    (list (+ (car v1) (car v2)) (+ (cadr v1) (cadr v2)) (+ (last v1) (last v2)))& Q' r% C; @: {. L, l
  )
7 g+ B2 l& @0 D) j( G  P
7 n5 R+ K, J% B. h  (defun image_subtract_vector (v1 v2)
2 D& o3 ~: Y4 I2 P' H/ W    (list (- (car v1) (car v2)) (- (cadr v1) (cadr v2)) (- (last v1) (last v2)))1 B8 L% a. d+ ?7 q
  )
7 v2 M' f# M6 }$ [2 G  A
( M: M; u6 [! ~/ _  (defun image_normalize_vector (v1)( p# k3 O$ G( m1 `! }3 I
    (image_scale_vector v1 (/ 1. (sqrt (image_dot_product v1 v1))))2 J2 F9 F; P: F0 ~- N( J! @
  )
, V9 K( a; @$ r. b; g3 ]0 D* t
9 ^8 H/ I) k! p$ R8 q& A5 j, _% {  (defun image_rotate_vector (vector angle axis / along_axis axis_x_in_rot_plane axis_y_in_rot_plane in_rot_plane)) S3 p8 Z7 y$ e$ j" k% m, `+ i; ]
    ;; Normalize the axis
( V8 I* x! s9 D% h    (setq axis (image_normalize_vector axis))' X8 j( N: ~* F8 ~- X6 |* n# N; h
    (setq along_axis (image_scale_vector axis (image_dot_product vector axis)))& X" A  T* f' @) Y+ }
    (setq axis_x_in_rot_plane (image_subtract_vector vector along_axis))/ r& [$ ^5 y- X
    (setq axis_y_in_rot_plane (image_cross_product axis axis_x_in_rot_plane))
$ X6 m* G) i0 ]    (setq in_rot_plane
7 I. E0 s7 H. f' _1 {! t8 T" S      (image_add_vector: T$ T; B' I* R% c$ R
        (image_scale_vector axis_x_in_rot_plane (cos angle))
/ H. ^# J: }3 F% E        (image_scale_vector axis_y_in_rot_plane (sin angle))
2 V& J5 N3 g( |6 H" ^( d      )& ^& V: j5 o1 S: C3 N
    )
# O+ I" m: Q$ \$ P. I7 `    (image_add_vector along_axis in_rot_plane)0 I; T1 U6 w7 f  s
  )
% q! z3 C* c) x" f- e, ]9 w9 d/ i6 {: E- W4 t0 n3 _' `' M
  ;;9 H0 v5 t# x# U% B4 `" T
  ;; Calculate current rotation angle if appropriate.
# i3 l  C) \) r  ;; If not, grey out the rotation field.: J+ F# z0 l, j! I. u/ [
  ;;! Q  y: d/ q; m5 f. C
  (defun image_rotation (/ normal rlength zlength sqrt_tolerance)
/ x3 ~1 A2 `  V4 t' `    ;; Determine if image normal is codirectional with$ A. }% [9 M/ m0 H6 f( ~
    ;; the current UCS Z-vector.) f' R) X9 ]. p
    ;;
$ N! u6 e0 P' c; n2 S    (setq normal (trans (image_normalize_vector (image_cross_product (cdr (assoc 11 elist)) (cdr (assoc 12 elist)))) 0 1 1))3 C4 ]* L3 q$ s* e; |$ _2 I& q" ~
    (setq rlength (+ (* (car normal) (car normal)) (* (cadr normal) (cadr normal))))3 y2 O9 G* N# z1 I! l6 n! n
    (setq zlength (* (last normal) (last normal)))" w- s/ H% `: O2 I& n) H$ @5 k8 N: O- S
    ;; Note that the value .0001 in the radians is approximately 0.0057 degrees.
2 F0 e% e0 B: D1 K7 ]- \    ;;
' K9 K) J1 z! o+ r    ;;                cos(.0001)^2
* s" p: F2 I1 g& `; w    ;;   Tolerance = --------------
' s8 V; M& X6 E- t# Z, u    ;;                sin(.0001)^2# ]* t* p- S1 n- Q! o
    ;;
. H0 g5 {! G  I' S    (setq sqrt_tolerance (/ (cos 0.0001) (sin 0.0001)))
+ F* E7 m2 `* V1 ~0 B    (if (and (< (* rlength sqrt_tolerance sqrt_tolerance) zlength) (> (last normal) 0)); ?( _5 {* Y! _  l) r
      (setq image:angle (angle '(0 0 0) (trans (cdr (assoc 11 elist)) 0 1 1)))
( U2 _6 b6 g9 T! b8 F! |% g      (progn7 l0 n+ H; p+ v) C
        (mode_tile "st_ang" 1)/ r' |) l( ^7 H* l5 l+ V/ X7 k
        (setq image:angle 0)
, N2 J  `2 h( R) z      )
. {2 y! e0 ]2 |- ?1 Z. s    )1 ^9 d/ _0 _/ x, `! ?
  )3 ^" l! [- u9 ]0 z
  p; `- u9 \9 b" X$ Q
  ;;1 D+ N2 A/ z7 f; l9 x6 k
  ;; Modify Image! Z5 ^: c3 L: O* l: a
  ;;1 G) [7 a! D% O0 C$ s# R
  (defun modify_image (/ u_vector v_vector z_vector)& j/ z+ u! P6 _7 [6 T8 Z/ W2 H' ^
    (modify_properties)0 Z( W6 q2 [" X6 c3 @& \# x
    (setq pt1 (list x1 y1 z1))
* C, v* I. _4 ?7 z    (tempmod pt1 10 0)" {' v+ |6 j3 ]
    ;; Make display option changes to image
) F- |, i4 O( r5 |8 F: |! S    (emod image:options 70)
; c5 X* y8 q- p7 M    ;; Get the u and v vectors
) C: @" L, n( O; X, h/ x    (setq u_vector (cdr (assoc 11 elist)))
, n4 c' H1 |; v; `3 o) }) P" l    (setq v_vector (cdr (assoc 12 elist)))0 l' i; c4 P7 `) u5 P# J5 Q. ^5 Y
  X( m9 {' G" c: q' k3 u4 B9 G
    ;; Make scale changes to the vectors
# E1 ?  R/ D2 |    (if (/= image:mult 1)* O; r" ^( ^  q. V! i
      (progn
9 c; }6 x& h. D3 G* \2 [9 N        (setq u_vector (image_scale_vector u_vector image:mult))
# M* k& n- |2 @6 M8 g& U1 M        (setq v_vector (image_scale_vector v_vector image:mult))  P5 R/ @! A( O2 `5 x. E* g
      )7 L% D9 G) |! n  H$ B
    )
  P; y/ ]( l9 _+ r4 W( v& X    ;; Rotate the vectors
7 ^/ v$ F3 F, q( o6 J. V    (setq st_ang (- st_ang image:angle))7 c* \" z2 s1 k+ Q$ r; ?
    (if (/= st_ang 0), _( ]; C0 z2 z
      (progn
5 y1 q7 l  S7 J: N        (setq z_vector5 \9 O' p6 V: k  z% l, Y
          (image_cross_product) @7 R" H$ ]" n& x  @+ v# g
            (image_normalize_vector u_vector)
0 W( `0 [* U5 |' E4 u- T            (image_normalize_vector v_vector)0 C' ]& g) U5 Z+ W: ~$ A; u
          )" b( b7 _% u: b5 y  d2 {
        )# A0 I1 N/ Z  o; x% W- [8 m
        (setq u_vector (image_rotate_vector u_vector st_ang z_vector))
! ]7 J  k6 G' j7 w; @        (setq v_vector (image_rotate_vector v_vector st_ang z_vector))
- h" m$ N$ L. F      ), X- Q9 ?) _7 {9 u" n" Y
    )5 l9 I) h  }" A
    (emod u_vector 11): g  j8 v" V* D+ z, Q
    (emod v_vector 12): [! t7 e2 {: a) M- R8 V' P
    (entmod elist)
6 B% Q# \" n. u& T  )( a( _$ P0 q3 N, i, F. T- ]

; u! ?) m$ ?, R  _5 u  ;;7 {1 j8 x& k& S
  ;; Run imageadjust on given entity, working around possible
: _$ `) b$ S0 E) o  ;; re-entrancy problems) C. F$ p% c& N; H1 a; `# u* B" h
  ;;
3 w, m) P$ c4 _  V  (defun image_adjust (ename)
  H. Z) C/ }4 ]6 I& @$ P    (verify_arxapp_loaded "ism.arx") ;; make sure it's loaded.... b2 o; K: `5 E4 U9 J1 a
    (imageadjust ename)( S: V! Y; J  r' G' ^
  )# L" y, i1 b8 A# o
, v( J  f! f3 M/ U
  (defun ddimage ()
3 k+ a8 c# `) N0 N5 H5 l) I6 S    (if (not (new_dialog "ddimage" dcl_id)) (exit)). J4 }+ j7 E% R" O' V
- V3 ?" W* I  \1 G
    ;; Grey out the thickness field.
& R' k, A$ q5 R/ A' |2 j    (mode_tile "b_thickness" 1)/ D# n9 E3 ?4 j) r; Z
    (mode_tile "eb_thickness" 1): c8 L6 }8 n/ w* ~* `$ r

- x/ @8 T3 Y  U$ C6 l    ;; Get the associated def object.
6 v& _- Z1 }7 v' \' N* u! _    (setq image:oname (cdr (assoc 340 elist)))
9 Q7 W1 G7 U2 U7 w* T9 a$ p; z! A0 M    (setq image:olist (entget image:oname))
7 O& y: L3 s" c( Y6 k# A1 h' r2 U$ J: |
    ;; Set initial tile values
6 d& [6 E0 `! ?    (set_tile_props); t/ V, \6 H/ p3 F
    (set_tile_handle)
" P' c$ G# ^- P# ]7 ]5 k    (set_tile_pt1 0)
8 i/ [, c( `6 H8 g    (setq image:scale (image_scale))
6 b2 N* `$ G8 u0 u    (setq st_ang (image_rotation))$ c2 v8 ?  ?* z
    (setq image:width (* (distance '(0 0 0) (cdr (assoc 11 elist))) (cadr (assoc 13 elist))))
9 g/ Y( P5 @( h2 Q; T    (setq image:height (* (distance '(0 0 0) (cdr (assoc 12 elist))) (caddr (assoc 13 elist))))' r) b& x3 h" A% D
    (setq image:options (cdr (assoc 70 elist)))1 J, P. x: q- z
& o, t$ r  ]! d) ~3 @0 G8 V
    ;; Record the last multiplier for use in image_update function+ a" h5 X, {8 l. q3 ]
    (setq image:mult 1)3 N) o- L" M* o$ v6 b6 s
6 I5 q% l) X) d/ D& W0 R9 j
    ;; Retrieve the image name0 G2 u( x% ^' c2 Q0 n
    (setq fn (reverse (dictsearch (namedobjdict) "ACAD_IMAGE_DICT")))
  I% N- S7 J+ P: ^/ j; r    (setq flag 0)+ A1 M7 s- |$ c
    (foreach n fn& s6 I9 ~, U/ U
      (if (= flag 1)8 }$ h4 y/ j& o4 ]
        (progn; R0 W8 n3 i/ ?6 C$ M3 Y
          ;; Display the image name& r: p% L, U5 Z6 j" b7 Z3 F
          (set_tile "image_name" (cdr n))
3 l$ z2 J! J/ C  s" G1 k% G3 e/ W          (setq flag 2)
; I9 `+ i* s) ?" [1 N( F        )
9 R6 z$ U4 `$ Z# [9 I4 u( i( i& j      )7 h6 Y" ~, z# Z. J
      (if (= flag 0)
. b" T6 w; F2 P) a  W5 b        (if (equal (cdr n) image:oname) (setq flag 1))
+ M5 k: D# h! x6 _: N. P      )2 N6 E( U1 \( p6 ^& _
    )
2 e. A* k( s* w$ D: m
) b+ j3 d* k; O! N* N5 t    (set_tile "image_path" (cdr (assoc 1 image:olist)))! J6 [+ X" o+ \, {
    (set_tile "st_ang" (ai_angtos image:angle))3 Y, r$ G3 c) _  {' w: }% J. s6 [
    (image_set_tile_scale)
. D. Y+ t4 A6 t( W) h6 E# P( b2 z8 D- y. Q
    ;; Check the appropriate boxes
+ I, \7 f% @" ]; V    (if (/= (Boole 1 image:options 1) 0) (set_tile "image_show" "1"))
" @/ K5 l4 ^. v7 Q* `    (if (/= (Boole 1 image:options 2) 0) (set_tile "image_non_ortho" "1"))
% o/ r7 D, M2 X9 A" {$ j3 Z4 U# G, O    (if (/= (Boole 1 image:options 4) 0) (set_tile "image_clipped" "1"))$ c- I. k6 z5 M4 p* U) p
    (if (/= (Boole 1 image:options 8) 0) (set_tile "image_transparency" "1"))
/ \7 \. T  c* ^! C# g$ T; c, \# w
" m/ {2 w) J+ \$ R6 F( Z    ;; Define action for tiles# ?3 `  E6 F+ E( x7 N2 [7 V
    (set_action_tiles)
/ Y( i7 E( q# e# @( k$ n& d    (action_tile "xscale" "(image_update \"xscale\" $value)"). v" t& l2 y# v; _" }& J! P
    (action_tile "st_ang" "(ver_ang1 $value)"); X3 I$ t' o' ?
    (action_tile "wid" "(image_update \"wid\" $value)")) w( y6 ]: J+ K( J9 a
    (action_tile "hght" "(image_update \"hght\" $value)")
5 s1 M8 S: E$ ^4 y" m2 z; C    (action_tile "image_show" "(image_disp_opt 1)")6 [! R0 g. ^+ r3 o
    (action_tile "image_non_ortho" "(image_disp_opt 2)")
* U# L7 j1 e/ H* `9 M    (action_tile "image_clipped" "(image_disp_opt 4)"); E3 |5 U% {) I5 p
    (action_tile "image_transparency" "(image_disp_opt 8)")3 M! m0 z8 ^) e9 |6 k# d. X# f
    (action_tile "image_adjust" "(done_dialog 4)")
7 t  P. E4 [! J
; s# V1 G4 [' ]5 [    (setq dialog-state (start_dialog))
& O5 L' U6 N7 a0 ^& u* Y7 Q8 q0 ^    (if (= dialog-state 0)
, F- x% H( x0 H7 y9 ?, E      (progn
$ a' G; X, r1 y( n" T: V        (reset)  \# a* I+ v1 n* @" x0 S+ K
        (image_clean_variables)
1 M, V8 Y4 l% I0 e* ^      )
7 c/ X' [2 ]; N6 V    )
0 V8 t% n2 r/ W) `7 }3 x    (if (= dialog-state 1)# \2 i) |5 p" O7 e. i4 F
      (progn( X; a( H; F# Y% a1 P
        (modify_image)
1 s* x9 q) \  v+ y/ L& l& T        (image_clean_variables)  o1 u) V2 I3 `9 Y5 ?& p& b1 M
      )2 L0 f) l* V, F/ M0 a9 l: k
    )
7 i: Q& N: g. z1 y5 N; {9 T( c    (if (= dialog-state 3)! I1 ?) H" r$ g, i5 U% E* i
      (progn
  P5 o0 m% J. [        (modify_image)
/ p# N% X* j; i) b3 ?  K$ b) M5 u        (image_clean_variables)2 B' A, B' s: U% X! N0 r1 \, s
        (setq pt1 (getpoint (list x1 y1 z1) "\nNew Insertion Point: "))! ^0 Q3 y3 n% C- _7 ]
        (ver_pt1 0)
0 Y/ y) P4 n7 G( f        (ddimage)
/ C. y0 v2 [, U6 m      ): t) @  ]. P: J: ]$ y+ e. F& ]2 a
    )
3 B' B8 w) h- D5 x# w5 x    (if (= dialog-state 4)" |/ w! r, q0 n, g7 U
      (progn) E  P5 J0 H1 y
        (modify_image), x* t! B+ h7 h- M4 {
        (image_adjust ename)
' ~( v5 `" h) U! ^2 N        (setq elist (entget ename))7 Y/ ^& a% l, u! C% s
        (ddimage)) J; g* n4 T% [! Q2 o6 X
      )8 [8 w) G% E, @" z6 E% [7 a$ I+ ?
    )
( U& U2 @+ z* N; |  )4 ~( P0 j( ]/ A) E
5 f1 K  B" Z8 }# b1 Z- Z; R
  ;;
& h+ h" V) X; j! N  ;; Modify BLOCK (and its Attributes, if any): X& v4 D1 c0 ^3 G8 j
  ;;( [4 U* a0 f7 j5 z% {
  (defun modify_block ( / el en2 p1 p2 oldp1 oldp2 new_hgt old_hgt attr
* `. k1 D5 E9 I, @                          new_wid old_wid old_rot scaling old_scale0 S- y& N3 h+ B- S3 i3 y5 V
                          xdelta ydelta zdelta xbase ybase zbase ipos)2 c. v$ ^# |0 z, g4 G$ v' p, Q1 b
    (modify_properties)
- O  l8 J8 F; D; x( b9 ~" L7 K0 v) C( H2 C! B' l) Y( T0 r1 w) C
    ;; First, translate and scale the Attributes, if there are any.
  L$ K8 k, y: D$ a& N    (setq old_rot   (cdr (assoc 50 elist))8 d: o) O- z# \% Q. V' Q
          old_scale (list (cdr (assoc 41 elist))0 D2 |9 J$ \( x( \2 [1 c0 l) e: ^+ `
                          (cdr (assoc 42 elist))2 f4 b; }. G" _: y. \9 E) j0 P
                          (cdr (assoc 43 elist))6 f( y1 z1 ]4 ]$ P) _
                    )
1 N& E# e$ z0 S          scaling   (or (/= xscale (car   old_scale))
1 J- ^5 M2 j' a$ K# N( o& G" E' e                        (/= yscale (cadr  old_scale))
2 u' e0 j% |, ~' P# }6 I( {% S% n                        (/= zscale (caddr old_scale))
5 G* j- }" k+ T( [                    )6 D" J* v7 O3 P: P8 P5 Z
          attr      nil               ; No Attributes modified yet
; F; W* I: i, c/ n% Z' z: X: K- C    )
  ^4 y8 s  Y9 s( l0 C! x2 D% l    (if scaling
1 y6 ]0 S, h. o; J- Z+ C      (progn
1 P2 V. X/ V+ @, [- }        (setq xdelta (/ xscale (car   old_scale))1 \" b; a" Y( U, S6 C
              ydelta (/ yscale (cadr  old_scale))
; [  v7 I* p3 m% v5 t1 a              zdelta (/ zscale (caddr old_scale))
( `0 S' m: h& W* a& K! B              ipos   (cdr (assoc 10 elist))& H9 }1 {' j  _* N
              xbase  (car   ipos)* G9 e: c0 k3 J7 u1 _( Z; Z8 d
              ybase  (cadr  ipos)
7 {/ D- B* n# \5 q! X# }' j              zbase  (caddr ipos)
+ e7 b4 E5 x+ j( Q6 W) x$ ?# J              en2    (entnext ename)  ; First Attribute
3 p- f! }9 {9 r  |$ i% ~8 @        )
5 B% X  k4 s; `" s; W& P, E8 q: A+ q# J
        ; If the Block is rotated, temporarily un-rotate it, along
6 f# `2 z" h! y: L. Z5 ?( o        ; with all its Attributes, so the scaling/translation of the
& L# m5 a- k9 r  U        ; Attributes won't have to take the Block rotation into account./ `- N& g  N3 ]  M
        (if (/= old_rot 0.0)
5 `& P6 x4 P! R+ {) j4 b: Q          (progn
1 h. k8 }. a: |1 Z; i5 `            (command "_rotate" ename "" pt1 (ai_angtos (- old_rot))); N2 Q4 o% R+ z
            (setq old_rot 0.0
( z/ N, n: }- A+ P  {1 ^                  elist   (subst (cons 50 0.0) (assoc 50 elist) elist): E: s5 l3 y0 k
            )
7 ~" X4 d2 \& t" `          )5 n. N9 d6 N8 b, {# L7 G
        )# }! _& W# S. |' \  T, P
6 Y: E" u) E: |9 M5 q& T% j6 W
        (while en2
& m- E+ [6 C- j8 l" I2 e          (setq el (entget en2))
4 |0 N& v& i' b% e7 \  g9 t- K          (if (= (cdr (assoc 0 el)) "ATTRIB")2 G: _& S  n' e
            (progn
4 I$ R: |8 I7 D' e  h9 L              (setq old_hgt (cdr (assoc 40 el))  ; Height
9 m" J9 g+ B- c9 }1 @$ k/ T$ |5 @                    old_wid (cdr (assoc 41 el))  ; Width-factor$ L! B, ^% o. S- T6 I
                    oldp1 (cdr (assoc 10 el))  ; Generation start point; {8 g! l5 m  a$ R, N/ \
                    oldp2 (cdr (assoc 11 el))  ; Optional alignment pt$ x. J1 z; P% }' X, A- D' ^! C+ [# b
                    ha    (cdr (assoc 72 el))  ; Horizontal alignment4 a8 W, `5 P8 s1 L) [) Z- B8 o7 B
                    va    (cdr (assoc 74 el))  ; Vertical alignment3 Y$ J; K2 _) u) T, D
4 r3 x. E" \/ X% X6 B4 [8 ]* }8 I- @
                    ; Translate gen. start point
/ A; L* E# \! A4 b- U7 P6 x# e. k. J                    p1    (list (+ xbase (* xdelta (- (car   oldp1) xbase)))
( ?1 T3 Y( C% K                                (+ ybase (* ydelta (- (cadr  oldp1) ybase)))6 w: V( m- W  r0 I+ B
                                (+ zbase (* zdelta (- (caddr oldp1) zbase)))3 c, ?" V: L6 U+ V$ X3 b2 ]
                          )
" c0 w4 y4 X% d% ?/ J                    el    (subst (cons 10 p1) (assoc 10 el) el)" R/ ]0 q. z& v% j0 V: M% A$ h. k
              )7 \; J, o* _; x! j2 Y8 \4 m
7 b- F  f* L' @/ c
              ; Translate alignment pt similarly, if present and applicable% N& K& H9 a1 d, y" X1 {
              (if (and oldp2 (or (/= ha 0)
, I( b& _. \( Q: i3 o- `                                 (/= va 0). N8 y# Z7 V% X. v/ ?8 y
                             )
) R! v* _. |- c6 T" r5 S$ E                  )% z( u5 ^/ p; b
                (setq p2 (list (+ xbase (* xdelta (- (car   oldp2) xbase)))
& X* J* ?& _- V( ?% T                               (+ ybase (* ydelta (- (cadr  oldp2) ybase)))
+ N: ?0 U( f0 l$ _                               (+ zbase (* zdelta (- (caddr oldp2) zbase)))
1 U( e0 I  r9 C4 M                         )& j( N7 N6 t$ }
                      el (subst (cons 11 p2) (assoc 11 el) el)
& p: J6 Y$ M2 {8 j" {7 Z                )
, g' F" |# T* S) v( ]              )7 ?" K$ j# M+ k% i5 y! \0 A

6 c% n7 i' M5 L7 t5 w8 _" p              ; Each Attribute's height and width-factor were computed' e  g' v) q+ f0 u
              ; based on the Block's scale factors.  Adjust them now,1 N% s* f( ?! N
              ; by first reducing to values for 1x1 scale...
. j( Q4 A) A' w$ D/ G3 f              (setq new_hgt (/ old_hgt (cadr old_scale))
2 \2 Y: L" ^$ ?1 c! c                    new_wid (/ old_wid (/ (car old_scale) (cadr old_scale)))
, ?% p5 _; n3 ?# k1 W              )
7 ^* V, E$ M6 G3 N1 ~* H3 W              ; ...and then rescaling.
+ O9 [3 x% f# K% F4 }9 z! I- V2 W              (setq new_hgt (* new_hgt yscale)
+ C8 \" L, {  ^' T                    new_wid (* new_wid (/ xscale yscale))" n- A! s$ \# w( Z6 s: z& p5 v
              )
' T" Z0 C# w( m              (if (/= new_hgt old_hgt)
# l9 c' t3 q1 R  h$ i) q# L  D                (setq el (subst (cons 40 new_hgt) (assoc 40 el) el))  D5 e# ]; v. T
              )5 J) N& m, f) W" j7 |0 R
              (if (/= new_wid old_wid)) Z; A+ B& K# E; M
                (setq el (subst (cons 41 new_wid) (assoc 41 el) el))
. e$ [/ g8 f, O$ d( ]) c5 C/ B2 b) e              )
+ B* P3 ?' R" T8 l2 _; r              (entmod el)
" {% k* N" d0 ~1 _" w) D( i              (setq attr T             ; At least one Attribute modified
6 j0 _! V5 Y* y/ Y7 T/ u5 D                    en2  (entnext en2) ; Next Attribute
6 s  Q1 f8 U0 u5 x3 x              )
0 e+ v! }7 K7 R2 b. J' _5 `            )5 \1 c) z; |/ H: W
            (setq en2 nil)          ; No more attributes
# {3 f! R9 |# F4 }& b1 d4 U- k          )3 w+ S/ a" u9 P, K1 i5 t
        )
# [; `9 r7 ]9 X% `6 z  P      )
' U! [5 y& N3 g% K  s    )+ c" ^4 P, Y) w4 }. E  j, Y1 M4 k
. {6 Q* z* K2 y% ?; H
    (setq pt1 (list x1 y1 z1))' U0 B5 L5 K/ X' j  e' U$ H# V
    (tempmod xscale 41 nil)5 f: n% e( _9 x' u' o
    (tempmod yscale 42 nil)
4 B+ p7 P' ?6 V5 E    (tempmod zscale 43 nil)( r2 Y3 V: X1 R. @
    (tempmod col-sp 44 nil)
6 b5 v$ v8 d. C( s8 A    (tempmod row-sp 45 nil)
& i: n3 @+ n: _0 w0 F/ U5 @4 Y    (tempmod columns 70 nil)
2 h/ a6 L1 A  J2 o. t! f    (tempmod rows 71 nil)
9 r8 D0 D: G7 n0 F- G$ K    (if (= xclipmode nil)) H1 K9 @. o4 n- M2 a$ I2 N8 y
       (entmod elist)7 ^& J) ]& M2 f3 a4 T7 n
       (setq xclipmode nil)
" ~9 @9 u: c" e    )
% g4 p- h& ^' A4 g& L    (move_pt1 1)
: q. `, |% Y3 F) Z: C
' |: z; X- w/ a( B! f" c  H: K3 L; I    ;; Now do the rotation with the ROTATE command.
5 Z  A% H" Y8 o    (if (/= old_rot rot)
$ f8 X4 i% F& L' i! f      (command "_rotate" ename "" pt1 (ai_angtos (- rot old_rot)))
% ]) m  j# D8 E; A      (if attr                          ; Else, if attributes were modified,
+ h9 H# K9 {* V+ O- o/ a        (entupd ename)                  ;   just regen to force attrib display
' ?: O* e$ Y5 J+ J6 i9 f      ); y/ A# i8 E% W: K
    )
3 V( W6 O% v* G$ f; x    (setq elist (entget ename))
# x; B" Q( c7 R& z2 Q' p  )% n2 D8 v) i) J' X7 d
  (defun ddblock (/ temp temp_xclip newhatch blkname blklist blktype program xrefpath)
0 T* c0 w5 w4 N& T5 H8 ?    (setq newhatch 0)% A% O1 u. Q0 m. W$ D
    (setq blkname (cdr (assoc 2 elist)))
9 y3 `  y4 m5 V: O" D$ o    (setq blklist (tblsearch "block" blkname))8 W' r* E9 h, Y! i! v( I
    (setq blktype (cdr (assoc 70 blklist))): I2 B/ p  P( v$ q# I7 B
    (setq xcliponoff 0)
( V6 R7 v( ^/ Q$ v: x4 y# G9 o    (if (or (= blktype 0)(= blktype 36))/ ]- z6 Z) g# E* c9 X
            (progn! q& G( `. |& [3 c+ X1 }" K
              (setq xcliponoff (xclipon elist))
5 G' Z, @) y- _  b. A" X          (setq temp_xclip xcliponoff)% T1 }6 Y/ U* y# q
        )
5 R( F0 w( ~8 F1 [7 W# V    )
! N# E& t* G2 O+ y/ ^7 R/ i    (if (= (logand blktype 4) 4), u6 H2 D4 {( g7 \4 `! c: i' j# m$ p" D
      (progn
$ w2 X; ~9 C: s6 \* R" r( ^        (setq xrefpath (cdr (assoc 1 blklist)))
9 |- e, X3 M2 k0 @- c& l8 c        (setq help_entry "modify_External_Reference_dialog")
4 s) N/ a! b6 F. f6 n. I' M5 a- L        (if (not (new_dialog "ddxref" dcl_id)) (exit))
. D4 b+ a6 }# s( B& F& O        (set_tile "Bl_name" blkname)' \7 {% Q: B& t+ J8 [: Q3 `
        (set_tile "path" xrefpath)
' K& U, O# Z. f2 d! A# B' Q! k      )9 O; R. P( d& T8 P" `# R# F
      (progn
1 q& [6 T; J, v" _- h        ;; Get program name for use as Xdata app name8 F+ \! P( O: w2 g) u
        (if (not (setq program (getvar "program")))4 `* H1 q3 R" d5 h8 C. C5 J
           (setq program "acad")
& J' x# j9 d' J+ |+ ?        )
# O, v( u3 k8 s$ f' h! ]& _3 C        (if (and (setq temp (assoc -3 (entget ename (list program))))
; ]" g" c9 T% w/ W  N% Q                 (= (cdr (assoc 1000 (cdadr temp))) "HATCH")- k9 o8 T8 J% ~
                 (assoc 1005 (cdadr temp))5 i4 F. {: j" A* X# M
            )" @% N0 ^* v% x1 ~& y0 D
          (progn
( x* j, `' }/ e( S              (setq newhatch 1)
9 f; v% }* l% X" L( H( S              (setq help_entry  "modify_Hatch_dialog")3 t4 X" I* j5 `! Z' ~
              ;;; convert the object into a new hatch
0 ^( L3 w1 A7 m& k8 j              (ai_undo_on) ;; enable undo2 o7 `3 P5 D. h9 J/ K. |& J% S. l
              (COMMAND "_.UNDO" "_Mark")
1 {' `  o: M, `! `6 h9 E              (COMMAND "_.CONVERT" "_Hatch" "_Select" (cdr (assoc -1 elist)) ""), y4 u) R$ b' q' }! g% u
              ;;; suppress nasty message from convert command& \7 L2 `/ B2 ^2 P1 {0 n3 V
              (princ "\r                                                                      \r")' ]2 l5 J% T4 \- \% }
              (setq elist (entget (setq ename (cdr (assoc -1 elist)))))
* |. \! I! z3 C2 o% S; P" ?              (setq old-elist elist)2 v, B7 J- f% ^* S% c
              ;;; If we have cancelled ddmodify
- Z8 g- B" D  X6 Z5 K8 O              (if (not (ddnewhatch))      ;;; (ddnewhatch) returns nil for Cancel or T for Ok* ]4 L% v# Y; S9 b
                   (command "_.UNDO" "_Back"); `' m8 }9 x" a: j5 C; w: m5 K. M* D
              )! o5 q# R3 U* b* n  X
              (ai_undo_off) ;; restore undo state3 t( I3 [' I( n) k9 x
          )
; `' J' s; {) H# E9 q: ^$ w1 X# q8 ?  N          (progn
. @) K2 X5 o" Q/ i/ J: ^            (if (not (new_dialog "ddblock" dcl_id)) (exit))
4 T4 E- G0 F6 }: E            (if ( = "*" (substr blkname 1 1))
: g- P; q1 a  a4 P* ]              (set_tile "Bl_name" (strcat blkname " - Anonymous block"))# D8 h6 o5 ^2 Y8 J6 }
              (set_tile "Bl_name" blkname)
# A) j) u/ z/ P! ?* Y  t            )
4 E9 F8 w5 B# w9 e. A( ^            (setq help_entry  "modify_Block_Insertion_dialog")
9 L" c0 e' D0 a8 r8 D; g2 |" |          )9 L/ c! L7 r5 M4 g
        )
2 V( J; X" j0 f# k      )
2 c' F& N6 M+ V# W& c    )- S% K& `: p" h) W# p& K; H
    (if (= newhatch 0)9 |6 t% X$ ^# w; z4 U. ~' w
      (progn
% I8 K1 y' w; @/ u- ?* _        (set_tile_props)
. x. b* U( `8 U' u. K5 |; j        (set_tile_handle)9 ~% t! X( ]+ \" N& m* k
        (set_tile_pt1 1)
2 P2 G. d" W# d, \, H4 g        (set_tile_rot); d; u5 c! b2 N
        (set_tile_scale)
) X1 a% X  n3 h  l* q        (set_tile_rc)" N: K6 ^3 j. t$ ]. C" k% Y$ D
        (if (= (logand blktype 1) 1)$ h/ n8 x( I" C8 c4 Q, D+ {" T
          (progn! z8 f% Z+ z0 u5 F$ o8 i
            (mode_tile "xscale" 1)9 _  z4 p1 C7 e6 a3 m9 V- T
            (mode_tile "yscale" 1), [( ?9 R7 y0 D* v% [
            (mode_tile "zscale" 1): B# W9 W2 m) |/ J
            (mode_tile "rot" 1)- O: N1 P; R. R4 v# E4 q3 _/ j4 e
            (mode_tile "columns" 1)1 H/ b4 U$ ^" G5 i
            (mode_tile "rows" 1)# c; A1 E9 m  n) H
            (mode_tile "col_sp" 1)
& q  d; G2 [# r* J            (mode_tile "row_sp" 1)
( U# ^2 U4 W) d: C/ i" ]          )
9 h% C+ m# H' G1 }, h* G* T, ]8 E        )
7 h# M. W- h' i- u        ;; Define action for tiles$ ^7 Q) r5 a& P
        (set_action_tiles)0 B' k" l3 D1 S
        (setq dialog-state (start_dialog))# d/ I9 Q1 D" S$ w. _) _/ W
        (cond
/ f: P$ V. ~, Y           (  (eq dialog-state 0), [3 Z4 J, j" w
              (setq pt1 (trans (cdr (assoc 10 old-elist)) ename 1))
5 j2 X2 |, f+ h2 H  {. a              (move_pt1 1)
. Z' E& I; @6 j3 v              (reset))7 p5 l" o; C, L+ p
           (  (eq dialog-state 1)
7 m1 _/ ?/ [- i2 Q              (if (and (/= temp_xclip xcliponoff) (or (= blktype 0)(= blktype 36)))8 P2 |% n1 B7 T' |! R
                (xclip)
6 K6 v8 i# M8 o+ N) Q1 I6 u              )5 L6 Y2 i. q0 U! O
              (modify_block))5 O. K2 D6 }! n0 |& V0 Q# g7 w5 V
           (  (eq dialog-state 3)
3 A+ F1 a9 V5 [) e1 E              (modify_block)6 f5 A0 I+ f9 g9 Q
              (setq pt1 (getpoint (list x1 y1 z1)  "\nInsertion point: "))
1 G  P, k' ^4 u              (move_pt1 1)
' a- P$ A' j0 L0 H7 U0 ^              (ddblock))
. {/ T! N: f+ m2 k8 S! x           (  (eq dialog-state 4). }3 l! A( [, |! b0 }; Q& D
              (modify_block)
. O$ C# Y1 Z% q4 d0 R$ H5 U              ;; Get current handle.
7 t, Y. c/ W3 @2 u# [+ y% B* g              (setq hand (cdr (assoc 5 elist)))) q% S: ?7 ~- p7 r
              (command "_hatchedit" ename)# ~' _3 Z; Z. z- ?7 y% p4 [2 l) w
              ;; If OK in hatchedit, a *new* entity is created and the old one
; v- c# [$ {- j4 S+ C  X# U7 y              ;; is deleted.  So if the old one exists, it must have been a
, o% L. g! {; s/ z) P( E4 a% z& t              ;; so rest the entity.! H$ \5 T7 e. ?3 ?0 u
              (if (entget (handent hand)) (reset))
& q5 g8 v& ~5 Q           )
2 k4 d" X6 Z* }: K' X8 W2 Y        )
, a+ ^9 {+ O! M0 @( R      )! l9 j- {' ]; _8 `" a$ z% P
    )
8 l& n0 C2 }/ U; t; {4 E  )% g0 `/ l4 c6 `' ~
  ;;
# n0 m6 Y* Y  S  ;; Modify SHAPE
# R3 N2 R1 \# S% K! f; a) ^  ;;
# [6 o( r# A& X. m8 {/ e3 V6 y7 }  (defun modify_shape ()
" o/ o  m- A/ J    (modify_properties)
7 [" V  {; x0 c) L0 n) j! G& R    (setq pt1 (list x1 y1 z1))
, |! w5 C. ~; Q0 F' X    (tempmod pt1 10 1)
7 O- ]3 y1 y* k0 A# C* K    (tempmod hght 40 nil): ]% f7 b7 t& w" ~* D/ z
    (tempmod wid 41 nil)- p0 j0 @6 f6 o5 @- [0 i9 Q1 u
    (tempmod rot 50 nil)' T6 @* l0 s! k" S$ r: ?* E
    (tempmod obl 51 nil)
& A( }/ B! z; q  d! {5 A    (entmod elist)2 J6 f) O! F3 m* ]) A3 ?% x: ?0 v2 i/ G
  )* A/ H: k" Q) p, M1 K

  {5 {  b$ L- G5 F) K  (defun ddshape ()
" `# ~# b; ?7 t8 B* O    (if (not (new_dialog "ddshape" dcl_id)) (exit))
  k7 a8 U6 V/ O3 \, `$ D) H, o    (set_tile_props)# {6 o7 D& V- ]. f! _
    (set_tile_handle)
( }: s$ l$ z, r0 n0 |9 t$ D7 ^    (set_tile_pt1 1)7 |0 N5 Y% ~" c3 V0 I' b( _9 f* a& W/ B
    (set_tile_rot)8 w5 x  J2 E9 d4 D& L- @
    (set_tile_hght)" O/ E3 Q: b  P9 u) S
    (set_tile_wid)
" n" n* _. Q( j3 n- w0 H: x) [    (set_tile_obl)
% }% h4 }- K' Q. J, F    (set_tile "sh_name" (cdr (assoc 2 elist)))
9 C. \7 t+ y4 ~' N# p5 y    ;; Define action for tiles& |- Z) \& g0 a/ w4 ~
    (set_action_tiles), r% \) \0 ]5 b; {& K
    (setq dialog-state (start_dialog))5 N! y: O" C; d9 l  u
    (if (= dialog-state 0)
+ Z$ P: h9 Q  v" w6 J6 ~* G' b      (reset)
! `. M' T! s6 X    )1 `: c: t) u3 p3 G4 i% u
    (if (= dialog-state 1)
2 j( F; y5 }/ l! Z  g1 D0 i      (modify_shape)& A/ Q; M7 ~# b6 K9 R" d) v  K  m
    )
" x& B/ d3 K" W    (if (= dialog-state 3)
3 N: O/ a2 W, J3 Z4 M: L& M      (progn
7 y! d, }* y0 w( u        (modify_shape)7 X  m  U7 b: V# l. x: R9 J- \. B
        (setq pt1 (getpoint (list x1 y1 z1)  "\nInsertion point: "))
, [* D+ G* ?2 I# \8 y) \        (ver_pt1 1)' e& `0 ?) w5 z4 ^
        (ddshape)
  C9 Q; R, L8 J- n4 X      )1 x& T/ F& K) N
    )7 n% ]$ t3 G; d
  )
% ]0 V3 ~2 S# C3 q9 X0 ]4 C  ;;7 d2 @: `( ]+ F5 a4 X! m
  ;; Modify TEXT or ATTDEF( a/ ?1 D) h# W2 `, X7 }: Z" j
  ;;+ R1 W2 J, e- m$ x& d0 u3 s
  ;; Set bit code for upside-down and backwards setting
; r8 I; A1 g6 R$ V1 I/ `6 {0 w2 R( S  ;;3 @1 h5 I4 g. m( e4 n  ^" @3 T  H
  (defun code_71 ()& C  s9 \4 b4 V" d+ g
    (cond ((and (= bkwd "0") (= upsd "0")) 0)
# i7 i' W* I$ p1 p          ((and (= bkwd "1") (= upsd "0")) 2)1 W5 m% ^5 v- k/ q# o( F% x9 \
          ((and (= bkwd "0") (= upsd "1")) 4)
" H) v* X$ @# }' K- j+ M$ t          ((and (= bkwd "1") (= upsd "1")) 6)
1 j5 _% `7 C" U. t4 H8 Z% M    )
9 i* J! A4 e/ A$ {0 v  )
: a- H2 M" g7 q# {, L  t$ s' e  ;;1 q  M, a2 L3 K; G& i
  ;; Style action.  Reset widget values to style defaults
, S6 `6 {6 e2 o/ n9 Q  ;;4 E! R: @6 z5 T) Z$ j& ^4 S. n; S
  (defun style_act (index / style-list)! K1 G- h: y' {5 [4 y
    (setq style-idx (atoi index))
! S; _# W; ~( }5 {" ~! f0 f    (setq tstyle (nth style-idx slist))
) p6 P4 N2 X" J% r# u    (setq style-idx (itoa style-idx))
6 L  u( u* ~. T' T% d/ G4 z- y    (set_tile "style" style-idx)2 {1 M1 ?3 n) A) D/ y
    (setq style-list (tblsearch "style" tstyle))
$ x- }2 Y5 W4 K, `    (setq shght (cdr (assoc 40 style-list)))
! G2 a' g  ?4 D, O  |3 y    (if (/= shght 0)
' m; Y) r9 W% D" H1 |8 m# i( m      (progn% G$ `8 y9 ^# F7 |, j* e
        (setq hght shght)
6 K4 _0 T6 h" b2 C( a  b        (set_tile "hght" (ai_rtos hght))
" }; h9 H9 A/ i; M" m) P! A      )
& e: r- |2 j5 H$ }# n/ ?% O3 `: ]    )
. M5 u* @9 h8 r6 V: C    (setq wid (cdr (assoc 41 style-list)))+ U1 D' z( v7 @' Z) d5 O0 f& a, W
    (set_tile "wid" (ai_rtos wid))
5 Y0 S" |5 l, T$ M; ~    (setq obl (cdr (assoc 50 style-list)))
8 t. L7 ^* ?( {+ H4 y7 W    (set_tile "obl" (ai_angtos obl))
% O* E; S, H, h2 j' _4 n    (setq bk-up (cdr (assoc 71 style-list))). G) z& A" f% |, }1 u- p# ?
    (if (= (logand bk-up 2) 2)
9 W* a+ b: Q6 z      (set_tile "bkwd" (itoa (setq bkwd 1)))+ X2 t/ X8 j, L; f( V' F% }3 y* L
      (set_tile "bkwd" (itoa (setq bkwd 0)))+ P  B4 O, F! @
    )
" a; B: u; v& N3 J$ B    (if (= (logand bk-up 4) 4)& ?/ I% T' ^' h/ b: G2 }0 Q7 i# y
      (set_tile "upsd" (itoa (setq upsd 1)))4 Q4 W' w% r' R' x3 ?
      (set_tile "upsd" (itoa (setq upsd 0)))
4 _# @0 ?3 Y* U0 Q# N9 F! Z% ^. ^; _    )
$ Y* U  B4 J* ~2 e; F# L2 x  )* T* c# s3 N/ [* _
  ;;
; L9 s0 H& K9 l9 b  ;; Justification action.  Set vertical and horizontal alignment variables,9 P" R  P7 P8 g0 T
  ;; grey out rotation and height if alignment = "aligned", grey out rotation
4 ]! ]3 G# v- e7 d9 B, G  ;; if alignment = "fit".& N4 |# `' K- F
  ;;- R# d3 V) D: w3 `% C2 c
  (defun jlist_act (index / templist)) R4 A! R: U! \5 E9 [
    (setq just-idx (atoi index)); v, d( z1 O, _, J$ l; j8 H0 `1 W
    (cond
/ ]2 G3 a7 Z" q( A! e      ((= just-idx 0) (setq va 0 ha 0))& X/ A7 A! H; k" ^( A. E
      ((= just-idx 1) (setq va 0 ha 1))
) _  |3 Y5 u2 h( I2 A. v      ((= just-idx 2) (setq va 0 ha 2))
8 J+ ^7 g4 Z& q/ w% `: Y% ?      ((= just-idx 3) (setq va 0 ha 3))
: X0 l0 u9 \, \5 R( {' L# h% {' u' s      ((= just-idx 4) (setq va 0 ha 4))' N1 G, U! d1 r$ {! o( g
      ((= just-idx 5) (setq va 0 ha 5)). n  D& l. |) o% h6 j- ~
      ((= just-idx 6) (setq va 3 ha 0))
% w! s* a1 s# u9 g7 N      ((= just-idx 7) (setq va 3 ha 1)). j; S" V  ?" B) w8 \
      ((= just-idx 8) (setq va 3 ha 2))% x$ K9 R8 b- \5 b
      ((= just-idx 9) (setq va 2 ha 0))
  ~' N3 A3 E5 n: h$ @& w      ((= just-idx 10) (setq va 2 ha 1))
2 z7 u/ w, ]  _8 J      ((= just-idx 11) (setq va 2 ha 2)); w' y0 C2 h; r" X% O+ Z' r
      ((= just-idx 12) (setq va 1 ha 0))
8 `* O. L) l$ Q$ l! U( ~3 }      ((= just-idx 13) (setq va 1 ha 1))
& Q! ~2 @) z. T1 \" H      ((= just-idx 14) (setq va 1 ha 2))
$ ?' k. B1 C5 G/ F  q$ c. U1 [    )
+ m) c8 w- l4 w& `: [    (if (or (= ha 3) (= ha 5))  ; If Aligned or Fit text
4 M+ R& Q  p: }8 R      (mode_tile "rot" 1)2 H5 N+ [" Z) n5 O
      (mode_tile "rot" 0)
6 Y" K5 G  U6 v' ?) X    )  i! R9 h) Y( c& S0 p7 g4 H" a  _
    (if (= ha 3)                ; If Aligned text7 c9 [$ y" |4 V
      (mode_tile "hght" 1)
3 h/ t( E: J$ V( m      (mode_tile "hght" 0); d7 O" n' F7 v! O, b
    )
7 i8 D7 j9 F6 e& N9 q& L3 c    (if (= ha 5)                ; If Fit text
& r; }+ d. z7 r5 _  {( k      (mode_tile "wid" 1)
4 b* O4 E1 N2 U* [# s  N      (mode_tile "wid" 0)# k: m9 O- w  Z% \9 E5 f5 z) B, y
    )
* m5 m+ t, O2 R0 A6 H  `    ;; Reset rotation and height if changing from aligned./ L# a1 ]. y' C  w6 c1 |' L1 `
    (if (and (= ha-prev 3)  (/= ha 3))
  t$ L$ r* X: ?; c1 A      (progn% u2 B: `7 v& m+ Q; A. g& K, a3 O
        (set_tile "rot"  (ai_angtos (setq rot 0.0)))
$ [; v* W( t+ y7 }& ]/ q+ M2 L5 U4 }8 x        (set_tile "hght" (ai_rtos (setq hght 1.0)))3 O+ {! V- G  _% F4 T, d
      )
% C! F: v3 i; M    )
! H# I9 m1 d2 }7 V! d* x* r( d0 _, |
3 `7 q# S! x- r9 r# c    ;; Reset rotation and width if changing from fit.
) @$ L, l! B" L& C2 `    (if (and (= ha-prev 5) (/= ha 5))) }, ]9 ?0 b' _
      (progn: Q  s/ u3 e( \, n7 z
        (set_tile "rot" (ai_angtos (setq rot 0.0)))$ ^! y7 E- C& p6 Q
        (set_tile "wid" (ai_rtos (setq wid 1.0)))
; ?5 Q* B* z; Q$ S2 g: C! N+ r6 f1 \      )
: _5 y: Z, A( C* R4 @    ), W) h# n8 t( S8 Y" m1 l+ W2 a

4 A; C4 W1 l8 o) i8 H    (setq ha-prev ha)           ; update ha-prev for next time
/ q% d7 f/ t0 K" h2 C    (setq just-idx (itoa just-idx))
) V+ ^3 n. H4 d. i( k! e8 o  )
* ?) ]" I8 V( D! T( e7 w8 L4 H  ;;
- a) r) n# R1 [9 K9 d" G8 }  ;; Set intitial alignment setting based on vertical and horizontal alignment- X, F9 [& H2 a2 w% n
  ;; bit codes.  W+ h% W% s/ U3 x
  ;;
2 ^) V7 o0 ?2 F0 b/ M  (defun set_just_idx ()
" C- p( T5 G6 m4 [1 [5 z    (cond
# g9 ]% d+ Y: Q4 a1 M      ((= ha 0)             ; Horiz alignment = Left
3 y9 \2 C: y8 H        (cond
7 i3 E# p# c* v" Y          ((= va 0) (setq just-idx "0"))/ w. o3 x8 H* M0 [/ E( @
          ((= va 1) (setq just-idx "12"))8 ~. E* o+ Z: `' w- h) J
          ((= va 2) (setq just-idx "9"))% {. F$ d; ~2 i; h% u6 \# l
          ((= va 3) (setq just-idx "6"))7 b" C$ i3 R! R
        )
5 _' k4 ]: e, z) g9 A      )
% {0 S6 _  W: D+ z) a/ d2 I      ((= ha 1)             ; Horiz alignment = Center* _" S( C( w$ z: \) |
        (cond
7 c8 E' X0 C! B0 s, b. ?9 ?6 c          ((= va 0) (setq just-idx "1"))! q6 \+ l5 b# B) N" z
          ((= va 1) (setq just-idx "13"))2 Z7 M: |% J2 c# M
          ((= va 2) (setq just-idx "10"))- q9 K* x/ t. N
          ((= va 3) (setq just-idx "7"))
7 v) Y- f: I7 l6 `$ y- s3 x        )
4 G! h) \( D0 g1 \% c2 O9 e6 N      )& {; @3 o) N3 l, C2 `6 z# I. P
      ((= ha 2)             ; Horiz alignment = Right
; i3 k. x; T( x( R* H, Q7 w        (cond
; k+ i: y; n3 z          ((= va 0) (setq just-idx "2"))
' {7 `2 U% A. i          ((= va 1) (setq just-idx "14"))0 U( l1 W, ?& p. M  f: {7 o
          ((= va 2) (setq just-idx "11"))
- C4 w0 M! [- E( [. c          ((= va 3) (setq just-idx "8"))6 X! U+ {8 M& G/ g" ^. ^# ?
        )
" d  X* y1 b* ]2 z+ G: C      )
/ V0 m! S+ P7 N8 I; [& @9 I6 ~      ((= ha 3) (setq just-idx "3"))   ; Aligned
0 A5 ?. K  @9 O) J! V2 I      ((= ha 4) (setq just-idx "4"))   ; Middle8 D7 M/ _2 v5 p( z- r7 N0 i  u
      ((= ha 5) (setq just-idx "5"))   ; Fit
0 \' f6 w; H) q# j6 H& L6 \      (T (setq just-idx "0"))7 i* A' A- ?; w7 {# p- i: b# d
    )
, w6 Z, G& W; k6 A    just-idx0 @+ R, H" N9 B& i$ [
  )
- k) T, `8 w5 j# n: D. t
0 W& b& G, f* u9 f% \) O. ^6 f  (defun modify_text ()
# s3 [, `! ^2 R& D# n* [% j    ;;  insertion point
4 V& m% T( W% o6 ]8 ?2 `, p. R- ?    (setq showpt (list x1 y1 z1))8 H. z* I  `1 {. a1 n# Q
    (setq bit-10 (trans showpt 1 ename)); a6 Z2 M# K$ Z- x( l
    ;;  alignment point
5 U2 _6 |1 b7 _# n2 {: \# p8 r    ;;  for 'Aligned' or 'Fit', alignment point must be different6 \' N  j; D& O0 {" W; o: O
    ;;  for all others, use insertion point. ~6 l% J9 M' B# r# ^0 ?7 U% ~
    ;;  (ACAD will recompute insertion point)& D9 b& N7 Q! h/ _8 P# g" o  x
    (if (or (= ha 3) (= ha 5))
( v  F8 k, n) ]/ A) s( z      (progn
0 V( V2 l" C. A" m        ;;  if no alignment point, fabricate one' C/ `& O+ u+ s+ @- m
        (if (not alipt)" m/ f, ~  O' Q& ?
          ;;  add text width to insertion point; K* z' v* v5 Q4 V: Z' ]( ~) Z& o+ h
          (setq alipt
* }$ V1 i  z2 o) v& u            (list (+ (car showpt) (car (cadr (textbox elist))))2 G. h# _; d" X
                  (cadr showpt)
. O- w* {- r+ R! l7 j                  (caddr showpt)
. R9 ~' w8 P# q/ A7 e. j            )/ A+ G1 X$ j: X4 p% X
          )
' B0 A: @" Q+ R        )
! s! R1 n+ B. w        (setq bit-11 (trans alipt 1 ename))
1 \7 J( @2 z6 Q( B      )) k* K. `- R2 `4 D' ]! J! t
      (setq bit-11 bit-10)
# T' M! }8 I! ?2 Y: j5 ]( G    )$ k8 v% I5 K+ j, f, y
    (modify_properties)$ C: P0 N4 V+ Q( O
    (tempmod tstyle 7 nil)
+ Y+ I! n2 o' ]* M8 G; j; I  @    (tempmod bit-10 10 nil)& L9 w/ @: i& @, i+ ?6 f+ J
    (tempmod bit-11 11 nil)
8 n( e  t/ Z8 @: e8 L3 }    (tempmod text 1 nil)
: o! V; h* z. b. M  h    (tempmod hght 40 nil): _" ~7 K  i  o5 R
    (tempmod wid 41 nil)
6 B% R0 h( E5 G: a# D/ z) J    (tempmod rot 50 nil)* [' T+ c, `+ K# @# L
    (tempmod obl 51 nil)
- K# X( l; D) m. \- O$ E    (setq bk-up (+ (* bkwd 2) (* upsd 4)))
' l4 Y3 k: x, d( S4 @    (tempmod bk-up 71 nil)
( O4 d3 @+ ?) N8 K    (tempmod ha 72 nil)
# Y. t7 o- x( m+ q: ^; B    ;; Attdefs use 74, text 73
: Q1 E2 ~; R" L8 Z; h' o1 {3 z' N    (if (= etype "ATTDEF")+ L+ C% n# j, v$ i+ N- A
      (progn) ^- C! G8 N5 o& L
        (tempmod attag 2 nil)5 v5 y* m& V" Y1 f3 A- t, x% t( l7 ]: ~
        (tempmod atprompt 3 nil), n' q7 s2 s  p/ T" e7 s
        (setq icvp (+ inv (* 2 con) (* 4 vfy) (* 8 pre)))
5 g& l7 e# K2 i        (tempmod icvp 70 nil)
' m) X& h- o4 T+ ?# b) q* {        (tempmod va 74 nil)7 ~4 Y. T$ ^, t5 }, a
      ). W  C, L- Z) A1 I
      (tempmod va 73 nil)! B" |( ~5 {  h3 ^2 P9 @  E
    ): ]5 A1 f/ X- t" o
    (entmod elist)$ T3 L1 f2 z( j  f- X* O
  )
0 u  e2 ?% R% Z- X; B5 v0 C: t1 u. B6 z7 ]9 L3 c
  (defun ddtext (/ 2ndpt slist i)
& N9 l7 U/ g* e" v; D# g' {    (if (= etype "TEXT")
- q3 W$ S1 j+ A# O3 L      (if (not (new_dialog "ddtext" dcl_id)) (exit))4 m  j: U& A) t, G' D. M) @2 j
      (if (not (new_dialog "ddattdef" dcl_id)) (exit))( I+ Y& a1 S3 U' j
    )0 U, F2 A+ [) |( F( B: y1 b
    (set_tile_props)* f! v) k, a5 l2 n
    (set_tile_handle)" P' z1 V/ B; Q& S" @* _5 Z
    (set_tile_text). W8 @8 m: Z8 I) V5 G
    (set_tile_tag), C1 D9 p; ?; m$ R8 u; F
    (set_tile_prompt)" y* X7 Q+ c1 C
    (set_tile_hght)
% x- m& W: N2 H1 f8 y5 ]  E    (set_tile_wid)
$ t) Z; c1 K3 h' y    (set_tile_rot)
5 S$ g5 S" Q: X, X/ ]    (set_tile_obl)
3 D3 s) q; W4 n2 y% p    (set_tile_bk-up)
; ^% N4 @( L$ e. ?    (set_tile_icvp)
9 H* {% t; x) R: x    (set_tile_style)
1 D: O5 ]- Y( A    (set_tile_just)
3 x+ u: @9 p  C5 T$ Y    (setq pt1 (trans (cdr (assoc 10 elist)) ename 1))# P- t: [4 V. t; i5 g
    (if (not (assoc 11 elist))% }7 S) c& N  |
      (progn (setq pt2 pt1)6 k) N1 |- Z% Q' ^) v  m+ {" a$ P
        (setq elist (cons (cons '11 (cdr (assoc 10 elist))) elist ))* Y& l* r% A- r% k% S, w  V
      )
% v% m9 K5 W8 L, Z+ m4 d;;(trans '(0.0 0.0 0.0) ename 1))
" d/ }  X6 h/ B; G4 a" o) |  ]- O      (setq pt2 (trans (cdr (assoc 11 elist)) ename 1))& E5 ]7 a* \: j! V
    )* T' X8 |' l# I8 D2 M3 C8 k7 Q) ]2 L
    (if (or (and (= ha 0) (= va 0))
7 w: B, [- U0 j            (= ha 3)- y; g+ z, o. f% N! b6 y  C
            (= ha 5)3 Y" X: {' Q" t
        ), W, k$ S# x% T6 |6 ~. o
      (setq showpt pt1)
( N* n8 H& W4 b      (setq showpt pt2)
$ @( E0 J: l+ Q/ ?' n; i* l    ): z* l0 r! L/ f9 J8 @
    (if (or (= ha 3) (= ha 5))
4 h) j% x; F. E  E/ Q! K3 G! t      (setq alipt pt2)8 M/ Z$ k! ^9 N/ O, G# E5 B
      (setq alipt nil)
9 V' b! ^6 O* b7 [  Y    )5 e+ d( L, q) ~* u
% D; D0 U1 i0 ]
    (set_tile "x1_pt" (ai_rtos (setq x1 (car showpt))))% z  ^1 t9 j9 g
    (set_tile "y1_pt" (ai_rtos (setq y1 (cadr showpt))))3 m9 `) c4 V7 F7 k( L# e! X
    (set_tile "z1_pt" (ai_rtos (setq z1 (caddr showpt))))
2 V) Y# c/ \1 `6 b
" H, s5 |3 D* j4 k4 H" @8 {6 w    ;; Define action for tiles
4 E" b9 @6 ^2 E( p6 r    (set_action_tiles)
. r  T" C7 {  W$ S    ;; Set focus initially to the text edit box." V1 X# a7 R. n2 F( |
    (if (not i) (progn (mode_tile "t_string" 2)(setq i 1)))# l3 h% L# @( ~" M/ {9 n5 i. @% d
    (setq dialog-state (start_dialog))! u) {2 v4 K6 V9 m9 ^5 G
    (if (= dialog-state 0)4 j! b+ p# v- a! b
      (reset)+ d) b% J' T. f) [% D$ L% E
    )
, M2 s5 k+ {7 d6 D    (if (= dialog-state 1)
0 G5 z" T  k# S      (modify_text)
9 j9 ~$ T6 |/ b' I& X) ^1 g/ v    )
& n. |2 g1 ]# m- r3 h- S$ Y& ?    (if (= dialog-state 3)8 O4 y/ v4 f1 F
      (progn) K6 q4 O# A5 ]7 T9 ?% Q5 I
        (modify_text)
# F/ k7 e5 r2 y7 A. Q        (if (or (= ha 3) (= ha 5))  P( d6 P5 F7 p4 ^) D7 j% N
          (progn$ x3 R4 c2 _+ K1 M
            (setq showpt (getpoint (list x1 y1 z1) "\nFirst point: "))
+ w, q( e- i/ y7 F            (if (not showpt)
8 P9 s4 E/ t: D5 Z' p& @              (setq showpt (list x1 y1 z1))4 d/ r/ Z/ D' D9 A* U
            )! W4 G9 W0 Y. z" n' r
            (setq 2ndpt (getpoint showpt "\nSecond point: "))
3 t  t  V3 D4 V+ _# ~! f# `            (if 2ndpt" X6 u8 S/ l) |
              (progn
( X* t: Z. ^3 j: ^( W6 B7 c                (setq alipt 2ndpt)
7 [4 ~: o$ ]1 O* ^5 W                (tempmod showpt 10 1)% t6 p. m( K$ X3 d3 F
                (tempmod alipt 11 1)
( o& T5 L" W( _. [4 G$ m9 t3 w                (entmod elist)1 K( S4 i$ R2 ^, p
              )
- J! A& l' _7 i7 H            )5 x$ Z9 j6 f  P4 w* I
            (setq elist (entget ename))& A, H# E, [. m: N, N
          )6 m' a4 }% z; h  s. {$ Y) L9 x
          (progn
; \8 L# Y6 Q- b( T- \, V( p            (setq showpt (getpoint (list x1 y1 z1) "\nInsertion point: "))
! D8 l  ?( ~5 J            (if showpt! F3 ^8 j! h& I
              (progn' M8 T+ G& B' j1 y9 |
                (if (and (= ha 0) (= va 0))6 J0 a3 k. {" G  K! I# F. L) {
                  (tempmod showpt 10 1)
. Q$ x7 u* \" a; [                  (tempmod showpt 11 1)( k$ J* ]! F2 Q  n! @" c2 J
                )' F+ L6 [+ i9 @. w. Y
                (entmod elist)8 j6 C$ {  g: \+ l
              )/ ?9 X% e6 u: y4 b! P
              (setq showpt (list x1 y1 z1))
, a5 z$ @8 q* u3 [  o            )
0 z: V/ L8 K  p+ @5 H  [; h          )2 {, K6 w4 _5 B, u$ ^3 y, y
        )
# C% B5 U( B1 W. }" h& N2 }        (ddtext)8 _3 K" Q% [8 p+ I# Y5 H1 ?
      )! z- [# m( r3 [) a1 E
    )
  m* [1 L6 W0 L7 U" p  )
1 D5 A, |1 E2 H/ ~" O! Z( O( E% r% M6 U$ G  A
  ;;! i% w5 v0 i8 w& K  @
  ;; Modify MTEXT% K2 S' @0 `3 Q, g! F2 K  c9 a
  ;;
" y  |! {, _& P  (defun modify_mtext ()
: ^7 Y6 }  G3 b8 n: _    (modify_properties)
. q# Q5 I4 \. w5 x    (setq pt1 (list x1 y1 z1))
5 k/ v' M( R& z; |    (tempmod pt1 10 0)- @! |6 i& N7 z/ ?
    (tempmod text 1 nil)$ `" D4 O0 k4 \$ D; j3 l
    (tempmod tstyle 7 nil)& A1 p7 C5 {+ D- w) u9 W. L
    (tempmod just-idx 71 nil)7 D! a  c8 I. M/ m% F; X
    (cond
5 D! y2 o2 K2 |, S7 B4 x  W      ((= dir-idx 0) (setq dir-idx 1))
% t+ @$ z  r; L( l4 B# L, j* [0 f      ((= dir-idx 1) (setq dir-idx 3))
; [8 m9 R0 }8 Z( Q4 l      ((= dir-idx 2) (setq dir-idx 5))
& s) P& k0 {- v+ ~. l$ I+ |  B      (T (setq dir-idx 1)): t; [$ W# M- z6 P5 F- a% q
    )2 b5 C/ `+ ~' B$ L# T$ ^1 a( P
    (tempmod dir-idx 72 nil)7 ~& b4 o, S# I0 @& W8 u2 B
    (tempmod hght 40 nil)
5 \4 Q! i" t) ~    (tempmod wid 41 nil)
- j6 K! r4 o: }( \    (tempmod rot 50 nil)+ ]  [) A0 J- ^  V; I0 Y! R4 r0 [
    (entmod elist)5 a: u3 b0 v) z2 E
  )
! S, k# A' _+ o4 w; T# F: d( H3 F: z1 z3 {9 H+ }
  ;; Set MText text style
  o. L( e0 A% w3 j  (defun MText_style (index / style-list)
9 K$ n, }8 ^# z) @( J! T8 E    (setq style-idx (atoi index))
( ~/ Y1 H6 j$ w5 K, @    (setq tstyle (nth style-idx slist))
, P. q# I. \0 i. W    (setq style-idx (itoa style-idx))
# u5 t7 B/ n' {1 |3 k8 k    (set_tile "style" style-idx)0 i% O; m- `1 }. C
    (setq style-list (tblsearch "style" tstyle))
! F$ c9 K  ~( a1 a/ f- k) U    (setq shght (cdr (assoc 40 style-list)))2 i0 M9 q3 [+ m
    (if (/= shght 0)
1 `( `' P7 W1 s7 y% ?5 {# b6 f      (progn3 r4 E" k$ B$ U1 h( p" E' |6 P
        (setq hght shght)3 ]0 L' ]% P9 A% m; l. J
        (set_tile "hght" (ai_rtos hght)). P3 a( T# K& S$ _# R# v
      )
/ z: f+ j) X5 q$ F7 _2 c$ ?    ). A8 i5 W; v7 n( K/ {# x) j" _  l
  )) q) t" k/ P: V

5 t2 J0 U" s$ H  ;; Run DDEDIT on given entity, working around possible re-entrancy2 Z& E) R7 y1 P* m5 L
  ;; problems with MTEXTED
$ p2 F$ i4 M5 Z+ c  (defun safe_ddedit (ename / orgMTextEd work)& s" P0 _$ j6 Z  r" Y( K) m; ~
    (setq orgMTextEd (getvar "MTEXTED"))) e0 N" N" L5 |$ N' T$ h  \2 S+ y
    (setq work orgMTextEd)
7 }7 d* u" L, _. J0 I    (if (= ":" (substr work 1 1))
, q% ~4 Y# @7 e1 ]      (progn
0 b0 H0 G- O+ w, M7 k! d        (while (and (< 0 (strlen work)) (/= "#" (substr work 1 1)))
% H1 v7 ?3 J! k% L+ `; V          (setq work (substr work 2))6 c7 S" M: U$ z7 {0 a: W& y6 F2 b
        )) w5 @9 ]2 W0 E- d: F# k
        (if (= "#" (substr work 1 1))
8 [/ P) o2 G8 [8 L          (setq work (substr work 2))8 L/ W) G/ X7 G) |  Q
        )
) n: @' e2 r+ ]5 I( G# r% C        (setvar "MTEXTED" work)6 u3 K6 N9 \% g1 e3 h; _7 v
      ): y9 Q) ]9 s. I: z, h) i
    )
4 ^- P7 D3 [  L' U. q- L& g1 K    (verify_arxapp_loaded "acmted.arx") ;; make sure it's loaded...
& y/ S$ h2 [& o7 `! a    (command "_DDEDIT" ename "")
+ f# j) }# x  b% E    (setvar "MTEXTED" orgMTextEd)! x8 Q3 k% h: ?% k5 |: Z) S$ V
  )% [* @) c% i; S

- N& r# z7 }+ o* R. ~  ;; Verify MText object width$ Y" y  P5 ~# z8 N  J0 O" q4 {
  (defun ver_MtextWidth (value)2 L1 i, k4 u5 y$ k
    (setq value (distof value))
6 m  W" O# O4 o* M, v    (set_tile "MTextWidth" (ai_rtos value))& X: B6 u( N& B/ R8 e
    (set_tile "error" "")$ _% r+ S! L$ G# w3 I7 ~
    (if (< value 0.0)
: G( b3 P6 X8 L( p# a4 q! l; |5 f2 a9 P0 S      (set_tile "error" "Value must be zero or positive.")1 o  K8 N. A, x2 p/ L( U
      (setq wid value)
8 V' r, x. l: M6 G/ D" o    ). v; ^" ^" F: m
  )
* g4 `: G# c6 k% b( D& C9 [
; q  b. ^- |, [/ S6 o' L8 n3 \; e/ P  (defun ddmtext ( / gc3)  r3 e4 h0 k. x' m* L5 t
    ;; Get dialog4 g! j$ \1 H' k
    (if (not (new_dialog "ddmtext" dcl_id)) (exit))
1 ~+ e( ]- Q1 z; B' g6 g' H( W% D( j* l/ \6 t
    ;; Load list boxes6 P  y; w( e6 k( E7 W4 J: }- L
    (start_list "MTextJustify")8 ~$ n/ M" `/ s+ [' h
    (mapcar 'add_list '(5 U" D; q' M- t4 T2 a. x- T; N9 p
                        "Top Left"
& E" m. S# X; e+ v) ~2 ~                        "Top Center"
' f4 h  q' p' a                        "Top Right"
1 U! e- d2 t; ?9 h2 W/ J                        "Middle Left"
6 Q2 q3 z- ~0 o                        "Middle Center"$ N+ O" b( T, i% N' k
                        "Middle Right"+ U- Q. p- J! R; ]  V
                        "Bottom Left"
! b0 L2 j' r- T- z3 s                        "Bottom Center"
4 n+ q& n5 O3 g$ o( w4 \                        "Bottom Right"
4 |: I9 D8 s" [2 B9 L- C                       )' A/ D8 r' g) D: R+ {; p$ w' Y+ f- `
    )- E7 x; {* a- B8 d. c+ }6 A
    (end_list)
9 r* Z8 Q  i. H6 S9 Y5 N$ [5 i
- r/ m7 Q( r) E. @: N    (start_list "MTextDirection")
; b: Q# ^* U2 A4 G4 }    (mapcar 'add_list '(
7 p. W* X" W# s$ w( R3 B/ Q                        "Horizontal"" H: G& E4 D/ `& r) m
                        "Vertical"2 E% v$ l7 }* p0 L
                        "By Style") U1 }" `$ u) o$ p. [
                       )
% k0 l- s4 u0 W7 P    )8 b0 f" Q* G3 |  G# e9 Z' l
    (end_list)% g" H- I" }6 \, M5 X
/ l/ G/ J- H" v5 `
    ;; Set initial tile values
# D4 s8 p& O. b% P, l) l; _    (set_tile_props)/ }2 Z$ ?" n" `+ Q
    (set_tile_handle)
- U6 J9 Q$ f9 Q" e$ t2 ^    (set_tile_pt1 0)
2 T8 F4 g* R8 _7 u8 G2 s9 H# v    (set_tile_style)
, T0 p7 k; f" K. Q! |% t6 ]    (setq just-idx (cdr (assoc 71 elist)))* V* D# Q; Z9 `! e( g) @
    (set_tile "MTextJustify" (itoa (1- just-idx))). e: ]; V5 y# L. ~9 J: O
    (setq dir-idx (cdr (assoc 72 elist)))$ E$ ]' g" c  L/ e
    (cond/ Z" p& U, w- r  E3 J
      ((= dir-idx 1) (setq dir-idx 0))" K; l0 T# d1 c, @( @, z. S* ~
      ((= dir-idx 2) (setq dir-idx 0))0 a4 ~  h6 w/ x1 U5 G% F
      ((= dir-idx 3) (setq dir-idx 1))
: s7 a' @; z% {      ((= dir-idx 4) (setq dir-idx 1))' i/ U: E$ d! e0 X( Y. z  F8 v- r
      ((= dir-idx 5) (setq dir-idx 2))
; a3 P, K3 d# h5 b6 Q: e3 D      (T (setq dir-idx 0))
2 ?2 x" R9 V, [& Y$ [- ?, G    )" H* V1 d/ O; S1 {/ M  H
    (set_tile "MTextDirection" (itoa dir-idx))
9 F8 s" O/ y. c3 i& V- \& n    (set_tile "MTextWidth" (ai_rtos (setq wid (cdr (assoc 41 elist)))))1 V% x# n- Y8 F2 K( m: w# O" c# U  `$ w
    (set_tile_hght): W- r9 U% |- l1 e. ?& k
    (set_tile_rot)
0 V3 |; G9 `+ }' `/ V' _: A5 D. B2 V6 |8 ~# \9 [
    ;; Set edit box, disable if too long/ P9 x+ v( x) r3 v( j* t
    (setq gc3 (cdr (assoc 3 elist))
) a+ }# a" Q4 Z0 T1 X' N          text (cdr (assoc 1 elist)))
6 \. U/ Y3 K: X6 R7 @( v    (if gc3  C$ j. |' `4 h
      (progn  ;; Text is over 250 chars, disable edit tile  p& ?0 V7 m& ]  p& l7 d
        (set_tile "t_string" (strcat (substr gc3 1 25) " ..."))' t  A+ U& i( c/ X5 C- ^+ J
        (mode_tile "t_string" 1)$ _5 t. m' _. U+ R
      ), u: |- }  `: P' }. B
      (if (> (strlen text) 80)& _3 N( ]( o! b8 n
        (progn  ;; Still too big
/ C1 f: Y& Y, n: I- c          (set_tile "t_string" (strcat (substr text 1 25) " ..."))
% e: D$ ]; |% h$ S          (mode_tile "t_string" 1): n1 q( z# l+ _9 n, W
        )
3 \/ ]- ?0 `3 f0 }' \" w) {8 I        (set_tile "t_string" text)
% @! ?- }: ]) `) `1 G, c      )! ]4 u7 z8 v$ B& G* y7 @
    )
5 V7 m' ]' `# m6 D1 E1 r
5 Y6 R2 s: Q. ]  @/ ~    ;; Define action for tiles
% I, Q7 b" f! f9 A- ^    (set_action_tiles)2 ^  Q: X" }+ a7 _
    (action_tile "style" "(MText_style $value)")7 D& Q" a3 M7 q7 ?
    (action_tile "MTextWidth" "(ver_MtextWidth $value)")
0 g9 C$ l: M& S    (action_tile "MTextEdit" "(done_dialog 4)")4 d0 ]9 N+ ?: P& r4 W
    (action_tile "MTextJustify" "(setq just-idx (1+ (atoi $value)))")
# N0 G' F$ Q) d$ ^    (action_tile "MTextDirection" "(setq dir-idx (atoi $value))")  }: t8 \4 p9 s5 |2 f- w$ p; b

  i& L+ E! v& X& u7 f    ;; Set initial focus to text edit box.
1 T& y  Y" I. m! I    (mode_tile "t_string" 2)
/ \0 }1 e& g' k# J/ V# {5 d5 u: B% @" v
    ;; Run the dialog
: r* r0 @' l1 y* ^# ]    (setq dialog-state (start_dialog))
; Z: o5 F- [# [  B    (cond
3 N' |1 N+ W+ |- L4 r: Z9 p6 J! E      ;; Cancelled - restore saved data, n9 ?' K0 D- _
      ((= dialog-state 0) (reset))
) [6 Q; O( n. h( q      ;; OK - save new data
: }$ H, N& Y1 [' o      ((= dialog-state 1) (modify_mtext))& t1 C6 ?) Y0 B+ \, d, P9 p& |
      ;; Pick new insertion point
- }, V4 m  b0 Y7 T. c  s2 ?8 I: \& T3 q      ((= dialog-state 3)
' t# ]: W9 y7 n; ]        (modify_mtext)  z1 b, f$ B: A# o# b* V
        (setq pt1 (getpoint (list x1 y1 z1)  "\nNew Insertion Point: "))
# s. e* ?8 L6 R0 P        (ver_pt1 0)4 r; e1 s" D! d4 q' m
        (ddmtext)' t8 `+ [% W1 ~! n4 Z1 z
      )
0 s! f/ k) }0 M/ `; P. M( t      ;; Run full editor
2 Z+ n" {7 z  z! |0 ^      ((= dialog-state 4)1 a& R" K$ s% n( _3 v6 N
        (modify_mtext)
6 d; L7 o$ W9 \: S  ~: y/ i) b        (safe_ddedit ename)" c. l, e$ h5 S* ]
        (setq elist (entget ename))
  p8 _1 V5 h8 `        (ddmtext); Q4 R# s) D; o" l4 h" {
      )7 C, B" Q4 b4 s$ z
      (T nil)' ]2 j) x* K" C6 I1 K
    )
9 i" x, X: E: m5 a  )% ^, `2 {0 P" W1 D) J' S$ v

, K& c& v* F& X  ;;$ e+ c" @5 z# ^4 Q! X
  ;; Modify VIEWPORT
) |. z( Y% T$ {: [3 }! N" ]  ;;
) {; v+ a- g- G6 [" P+ J/ x" p) Y: i) K. d3 z& K5 [
  (defun ddvport ()
' @! w1 }# V! ?1 O4 v8 Z    (if (not (new_dialog "ddvport" dcl_id)) (exit))
; h" M% t) r, K7 H9 }% A9 Y. Y    (set_tile_props)" Y: L* e" n" Q9 Q2 k- @
    (set_tile_handle)4 O4 p7 V8 X1 [+ U' w2 [4 D) V- _
    (setq vpt (cdr (assoc 10 elist)))  p2 m& H* n; T, W! S# F
    (set_tile "xtext" (rtos (setq x1 (car vpt))))$ D7 j  Q+ O" B6 h- j
    (set_tile "ytext" (rtos (setq y1 (cadr vpt))))& `6 w, |" b( r' C* U% C$ f
    (set_tile "ztext" (rtos (setq z1 (caddr vpt))))# F+ F: b. J# O5 o9 e  V
    (setq wid (cdr (assoc 40 elist)))& n: d" y" g9 N- m
    (set_tile "wid" (rtos wid))) C- I) S& U$ b8 g  z; |' o
    (setq hght (cdr (assoc 41 elist)))1 G" f8 Z( [! B! x0 y) m
    (set_tile "hght" (rtos hght))
2 W% N2 C0 M+ a  i/ W5 w! J    (setq vpid (cdr (assoc 69 elist)))
8 K% ]4 N5 f# v4 ^9 g. [% r    (set_tile "vpid" (itoa vpid)): A8 e' i" N2 d+ W  ^: ^
    (setq on-off (cdr (assoc 68 elist)))
: T! D5 r/ F) d* o/ y    (cond
; X. j6 w7 [5 _2 |$ e      ((= on-off 0) (set_tile "on-off" "OFF"))
  h& G1 f' y# V9 ^# G      ((> on-off 0) (set_tile "on-off" "ON and Active"))
+ s1 ~+ _/ @5 `$ i( c1 h      (T (set_tile "on-off" "ON and Inactive"))
( t" `3 `5 d; O3 o5 q% F    )
! o3 H8 M. i* h1 Z+ D6 j2 d3 A: w. Y: I
    ;; Define action for tiles, u6 u! n, {5 g
    (set_action_tiles)
1 k% t4 [4 x, M4 b& O& I
2 {: e% ?( i" _$ _$ M, n    (setq dialog-state (start_dialog))
# N! U: S* U/ ~% A/ A' H    (if (= dialog-state 0)( E$ j) B% N5 l# J
      (reset)
  y& O2 @; @8 v, L    )
$ ~; g  U6 q  ~: J& w! ~' Q    (if (= dialog-state 1)
2 b" S+ f+ S; O: Z% h  j" t1 t: t4 a      (progn$ Q7 }& M7 P9 X% \2 d6 F! w& \
        (if (= ecolor   0) (setq ecolor "BYBLOCK"))
# K$ |) Q, Q5 {- m0 L$ O% F        (if (= ecolor 256) (setq ecolor "BYLAYER")), T5 W7 A, ^& y- {
        (command "_.chprop" ename ""0 }  W5 ^  d3 N0 M; z4 D' _
                 "_la" elayer! j/ A$ l! v" W
                 "_c" ecolor ""
$ a  r0 I, h: h* Z; Q# u) P6 R& V        )* Y! y! T. l, p  `7 }
      )( p1 D' E: u7 Z* l( M" y$ ?7 c
    )$ v% I5 G1 f( L. X( y
  ). O( I" C5 r' ^9 ?" f
  ;;. e" i  A  n5 Q& T% Q6 S0 ~
  ;; Modify POLYLINE* Y3 m- b9 j+ W
  ;;
  L+ W6 j# Y5 f" z3 s- d* r  (defun modify_polyline ()2 W3 H" A$ Q5 V  t! Y- X2 k
    (modify_properties)
1 U( ^; P9 P5 Q8 V% V/ [    (if (= ltgen "1")
( ]9 Q% z5 ^; }        (if (/= (logand bit70 128) 128)3 a3 H7 M2 f. F+ |4 }# G2 x! q
            (setq bit70 (+ bit70 128))
9 Z; h4 J/ v7 f$ Q" W        )0 m# {# B: D3 H5 r
    )
3 C; }+ Q7 K$ X, D9 u/ w    (if (= ltgen "0")& z- V/ {' ^6 t9 g; Z! _- h7 U
        (if (= (logand bit70 128) 128)6 H2 W6 L& l, S2 {& S
            (setq bit70 (- bit70 128))1 ~; Z' Q! e# M8 F/ V2 m
        )# I1 R' I& T' O& O* N; T/ N) ^
    )
! r1 ]" i) N5 A2 A( b1 ]0 V    (setq elist (subst (cons 70 bit70) (assoc 70 elist) elist))
# A/ c7 l" }' P' B5 ~    (entmod elist)
8 b$ S) c* q. f) i) [, T7 \    ;; Added to take care of updating Vertex information for color% N' [2 c8 @' r( l$ ~" N' B' J% n  E
    ;; and linetype.+ U/ l( ~( g: z. k+ {
    (setq save-ename ename save-elist elist)
" c/ V, o) Y7 n  M, H2 f; Y    (if (= (cdr (assoc 0 elist)) "LWPOLYLINE")
% A. x) }+ {6 `5 _# [3 P' H" }        (progn3 l! G1 `' {% v! ^! Y
            (emod ecolor 62)
/ P' g; z) r/ }1 C            (emod eltype 6)
- I' g6 _+ I% y5 V' m/ s/ I8 |7 M            (emod eltscale 48)
1 j% J5 i. C1 E! J, s7 G( t) w/ \            (entmod elist)* H3 d+ U; S$ I/ [
        )
& W# f; {, s3 l- m& t/ ]* |        (progn2 }+ V+ K" X9 w6 h; ~5 H, ^/ y
            (setq ename (entnext save-ename))7 A$ ]9 R3 E# X1 D, m  D
            (setq elist (entget ename))
4 u* ^' `; z4 v. A4 D* |3 N& X0 `/ {/ H+ }; ]4 a1 b
            (while (not (= (cdr (assoc 0 elist)) "SEQEND"))1 m3 O. U. T  f- b
                (emod ecolor 62)
* N  ^( m& d9 f& D# N                (emod eltype 6)
* t7 `5 @( M0 S+ L. w                (emod eltscale 48)" O# x. L' L5 \
                (entmod elist)# H" [. w# j( l& d1 \! A
                (setq ename (entnext ename))
! A+ X2 W& ~) E+ [1 R6 a, p5 U4 D/ z                (setq elist (entget ename))7 R2 v" D& `$ J
            )8 W( o) a( w) u$ _1 c
        )
/ J' M$ H+ C- j    )' Y" n) @; k) K  k! S/ e7 y
    ;; Update the SEQEND
+ B( h6 A$ ^& J5 v( f" V    (if (= (cdr (assoc 0 elist)) "SEQEND")
- J0 E" K& @7 o2 N% d0 t& q, w      (progn
/ C9 p8 ]8 I" H9 O        (emod ecolor 62), c' c% o5 K: A% _0 S( T
        (emod eltype 6). d+ i- a2 }4 K, g
        (emod eltscale 48)
$ n% r5 K' n) Y1 b) U3 @* V, j2 F& l        (entmod elist)
# ~( d2 l1 b7 }      )
# @9 n6 v2 u2 C& b4 ~! k    )
; f' p0 j! v" Z  i) Q$ b- ?    ;; Go back to header./ a# g+ j8 O% |
    (setq ename save-ename elist save-elist)
  ~* N6 H( A4 p; v9 b2 j
0 [7 C1 z2 l% s* ~5 j# |0 u    (entupd ename)
" T1 h3 ]3 V- k$ W, ?  )# ~: h( c9 n" Q

8 |  a+ f9 m2 ~6 f  ;; Increment vertex.  Set tile values to next vertex! Z7 M2 B# P$ _$ D
  ;;: \2 [* F" W! m9 r
  (defun next_vertex ()
- C5 U3 O9 _; s. ^    (if (= (cdr (assoc 0 vlist)) "LWPOLYLINE")) N7 y1 v. v& t/ ?  G* ?( o+ {# L
        (progn* A+ I# z' U- h% \; G  U3 S4 x* p
            ;; If the counter reaches the number of vertices,; f- B( _& P! p
            ;; roll it over to zero again.
) G& g' n5 v4 f  A            (if (= ctr (cdr (assoc 90 vlist)))0 B. l: y1 Q8 P1 p, L* a; _& D
                (setq ctr 0)% a; Z$ u; _6 J
            ), c) _2 G5 V0 {5 ^7 i  F
                (set_tile "ctr" (itoa (setq ctr (+ 1 ctr))))
+ Y" q2 a- k  W- E; m+ R1 {            (set_tile_vpt pointype)4 S! h) b3 a3 a; B
        )
: V  x, f( @# v$ \7 ]9 }3 z5 `        (progn
) ~7 L6 V8 J+ Q  F, m            (setq vname (entnext vname))
# Y  Y, x8 |% V2 p            (setq vlist (entget vname))
' t9 E& f8 y# Y. H            (if (= (cdr (assoc 0 vlist)) "VERTEX")" m5 f" l9 U4 j$ W2 y7 I
                (progn
) h" r' ], @; i( _/ _) N                    (set_tile "ctr" (itoa (setq ctr (+ 1 ctr))))$ D9 T* K6 N* Z7 M1 `0 n! }
                    (set_tile_vpt pointype)  e* h8 m, j& e
                )" ~0 I1 I# v$ G5 E% _% H
                (progn2 c0 b- y# f0 O4 O
                    (setq vname (entnext ename))7 Z$ N) j, y) \8 {. z! W: p
                    (setq vlist (entget vname))
9 M* ?5 V( y3 Q* X                    (set_tile_vpt pointype)8 K" y0 }3 v' o& E# }9 {
                    (set_tile "ctr" (itoa (setq ctr 1)))
( Y  C6 J! ~9 {7 y$ f# T. w                )9 J% ?8 x1 S5 d5 q
            )
& ]0 [- s* @$ R        )
# w* |" a- T6 D' S0 Z    )* F) i1 c; b% G& U9 F0 K; q
  )
. p  `  D' ]0 `; C( R: k
/ P2 m0 L/ C: n) \' _  (defun ddpline (/ oldecho)
% h! R8 E6 @  a0 n4 _1 e    (if (not (new_dialog "ddpline" dcl_id)) (exit))
: ~! E9 _, R. n    (set_tile_props)) r- t6 q, w+ U2 D
    (set_tile_handle)
: b* R3 m; G% a* O4 ]/ ^    (setq bit70 (cdr (assoc 70 elist)))
# i* V) D/ [" V    (setq bit75 (cdr (assoc 75 elist)))
+ q4 `6 A. C' _0 S    (cond
, @4 q  U7 G9 O& Y3 Q      ((= (logand bit70 8) 8)   ; 3DPOLY
2 C% i* v) Y5 R$ f        (set_tile "ptype" (setq pltype "3D polyline"))$ A; h! a9 k* {* J
        (setq pointype 0)       ; WCS or ECS point values$ t, K$ h$ V% m# A
        (mode_tile "fit" 1)
. \: u0 Z. M  X( w; ], ]        (mode_tile "mesh" 1)
% L0 f( \8 h2 e5 q2 U0 V1 a        (mode_tile "bezier" 1)1 D5 ~# \  F0 H* i
        (mode_tile "ltgen" 1)
8 Y/ E- i" @+ o6 `6 l" z        (set_tile "none" "1")
1 l! g" S' h. n% h        (set_tile_closed)( |5 }4 B( }+ `/ f" p4 G: C: J
        (set_tile_fitsmooth)! L+ b% S6 s, ~; I
      )
! W3 o0 m* S( M! W      ((= (logand bit70 16) 16) ; 3DMESH! T' f" c6 U0 V& ^4 E* l* i3 s% y
        (set_tile "ptype" (setq pltype "3D mesh"))
! Y5 I9 j; q5 R% g0 X" c5 e        (setq pointype 0)) U+ G* M% u5 `9 G
        (mode_tile "pline" 1)
4 k/ s7 {, i/ v4 f# N        (mode_tile "fit" 1)
2 u- d  a7 b0 x, g: P: n4 S" b, {        (mode_tile "ltgen" 1)
4 {1 P( i8 i& Y" k+ j        (setq m (1- (cdr (assoc 71 elist))))) n+ F' |+ w2 W  Y3 h, v
        (setq n (1-(cdr (assoc 72 elist))))
* f2 c' |0 y7 p        (setq u (1- (cdr (assoc 73 elist))))
1 {, S) R' m8 a& K        (if (< u 0) (setq u 0))( ?; s  _6 _* F$ ^
        (setq v (1- (cdr (assoc 74 elist))))
1 p; u% |: q- b6 ^  m& Y2 o        (if (< v 0) (setq v 0))
' m9 Z) T0 y& }" O        (set_tile "m" (itoa m))0 C  C8 f/ C3 V# b9 r. U
        (set_tile "n" (itoa n))" g# V% H( p' e6 Z" E- }% j
        (set_tile "u" (itoa u))' |% m/ O6 n% A* F+ E1 T( U
        (set_tile "v" (itoa v)), F2 }3 f: |+ L8 @( w: ~- T) C
        (set_tile_closed)# t7 r8 W3 h. W2 T3 `
        (set_tile_fitsmooth)5 |$ b$ ^, y( i$ U! ^; _& K" U
      )
0 ~3 |( f- a' v& F6 D      ((= (logand bit70 64) 64) ; POLYFACE MESH
3 o( f' ?& E3 F& e        (set_tile "ptype" (setq pltype "Polyface mesh"))! \: T( H0 s0 d( x& h5 X
        (setq pointype 0)' r4 p3 ?. O" I! K8 M
        (mode_tile "f-s" 1)2 J( S8 @& h; d8 y
        (mode_tile "mesh" 1); W7 j5 U2 W# k* u5 I  y
        (mode_tile "pline" 1)9 {7 U& J5 X  b; o4 p# p3 R* V
      )
$ {: r# O  r: S2 U* z3 o      (T                        ; 2D POLYLINE
! ]. x+ P! o: i- j7 s5 G9 v- ^/ R        (set_tile "ptype" (setq pltype "2D polyline"))' K. a" [: Z" _. z* q1 A" D+ ~- y, E: }
        (setq pointype 1)
' y/ w8 _# r. @) T3 r8 f        (mode_tile "bezier" 1)
' k8 d- v5 Y6 w        (mode_tile "mesh" 1)$ r$ Q" _) [! Y9 F- Q2 c1 d6 N: Y
        (if (= (logand bit70 128) 128)" {' ~; C9 w  M
            (set_tile "ltgen" (setq ltgen "1"))
, T( L# ~9 J$ a( _3 M0 \        )  `) k5 y1 f" ?  g
        (set_tile_closed)
9 @- U& a4 v) P5 C        (set_tile_fitsmooth)
8 _, C% P9 }$ r9 L8 b% w3 `$ S! c      )
, j5 s- i6 g6 p; P$ N# f    )& O  S: S; S3 U* T4 d
6 _* i& Q* f) J% X5 {
    (if (= (cdr (assoc 0 elist)) "LWPOLYLINE")
# j9 e, E1 F  T, k        (progn
7 k6 n2 o0 m) [  m4 Y6 ^7 j            (if (not next) (setq vname ename))6 c" \! ?5 t" |+ g6 _
            (setq next T)
( ?: r) A1 |- {$ |            (set_tile "ctr" (itoa (setq ctr 1)))) p5 g  T# x- q( ]. o* k) o
            (setq vlist (entget ename))! d" K3 S" q+ S" s5 d" A2 X
        )4 B  V0 u; C% K/ w3 _' A2 f) Q" c  _
        (progn, _' E8 Z* u  }" S
            (if (not next) (setq vname (entnext ename)))  A7 d0 \% C; {) o7 n6 u; X
            (setq next T)
5 l! ?% \/ Y( r4 V- R# N$ M            (set_tile "ctr" (itoa (setq ctr 1)))
! x, G5 m  s. E. T            (setq vlist (entget vname))
: K3 U+ V2 U6 L        )
% ^/ s$ }9 d0 P# o# S2 d+ T! i    )
: N( ~# l/ l, F    (set_tile_vpt pointype)
, v- @4 Y; {: B* ^3 b3 @    ;; Define action for tiles; v9 c, X" @1 M; X! a( u# j2 @
    (set_action_tiles)
" Z* S: Q& ]9 U; @# k7 x! O    (setq dialog-state (start_dialog))7 s) E. R' P1 p* w

( }' T$ s% F1 n    (if (= dialog-state 0)0 N' F1 D7 Y0 Y/ _4 [/ Z
      (reset)5 M: g8 D' b7 E0 N
    )' M; f0 C* q3 q' E, n$ {* s* t
    (if (= dialog-state 1)
# e1 |4 C/ _4 D, O8 p$ _4 H      (progn, l/ |8 i+ x7 k  i* |  J0 Q4 r
        (modify_polyline)
. C- _. T0 L! G, Y0 F8 \        (if (or (= pltype "2D polyline")( E5 g8 u$ N7 r* |
                (= pltype "3D polyline")9 S/ J# \( f, g
            )
2 C* @* J1 H5 k' j/ Q/ z9 ~# ~          (progn
* h9 }# j% g6 @7 v8 d0 M* u            (command "_.pedit" ename)
2 }- V5 J/ Y) M1 L            (if (= spltype 0) (command "_d"))6 X# l$ S' w6 S/ ?
            (if (= spltype 1) (command "_f"))
5 p( @+ E3 _0 V. N            (if (or (= spltype 5)
5 ^3 P/ d) t4 t6 @/ t2 U* |                    (= spltype 6)
+ B; X1 T, k  x/ M                ), Z- q6 r3 F& r- T2 }
              (progn- f3 B) q: s' D: L7 `/ Q- B1 Y+ s+ b; H
                (setvar "splinetype" spltype)
0 N( k! V. J/ @8 @4 _5 P1 |                (command "_s")2 f7 E9 N4 Z* I
              )
) D& u* }/ c6 L% [2 V6 H7 y            )
$ C2 |- D; O/ J" J" w            (if (= closed "0")! M; G& d% Z+ [2 ~+ r: `
              (command "_o")4 h4 n4 [6 d; B0 Q
              (command "_c")
9 n! J- J! }" Q& _7 Z5 Q! }8 e            )
' v7 z5 I0 u0 V' e. ^            (command "")
# S5 x- N  _/ M" s; w) ^1 N/ r4 R# W% R5 f7 |2 R
            (if (= spltype 0)
7 p% ~7 |  j9 M8 @) Q, U8 [                (progn" A! O1 z9 a7 o% \( v
                    (setq oldecho (getvar "cmdecho"))+ K4 c( K- o5 l6 g* \9 [  Y
                    (command "_cmdecho" 0), J) h) D7 u& b2 G' d" n
                    (command "_convertpoly" "_light" ename "")
% K1 E! [7 Z, P7 q1 X0 q5 O% \                    (command "_cmdecho" oldecho)8 s' f: }4 r) o0 ^
                )- V# G! N" h$ ]7 l
            )
( l6 ]! R8 R5 U+ }6 {/ M          )
! j" z+ ^; K0 h+ j& U+ H) Y        )$ m' I2 s: i) A$ q
        (if (= pltype "3D mesh")
2 H, j/ B( q. ~! z          (progn/ Z: h) D+ S9 `8 J; k. F! |! Q
            (command "_.pedit" ename)
( H# d; w7 _  O: a            (if (= spltype 0) (command "_d"))9 b6 W: J8 Q" X0 k
            (if (or (= spltype 5)
& N- w& t$ X& Y% m, }; g                    (= spltype 6). u  ^: u" t! c& L, a
                    (= spltype 8); f) d" |  U0 v  q# v  P1 S
                )
& A+ h, ]/ C7 S              (progn) u+ L! k6 U) A8 S3 H, U4 W' V* c
                (setvar "surftype" spltype)" q0 t0 K; _( r; G& b& V7 b
                (setvar "surfu" u)- U4 j! y1 v! R! B. Z6 O
                (setvar "surfv" v)
* K: k3 C2 B4 \( r/ j/ K4 m% }                (command "_s")
+ {( m  `' O% J6 a7 m2 l              )) P. `6 U. W+ s7 e
            )
$ o$ ?7 F# J. M- H            (if (/= closedm old-closedm)
; g4 f+ Y+ }, [7 V- ]; S              (command "_m")8 p! s) [6 {% k) P% b
            )0 V. @5 u2 P; g" l# j
            (if (/= closedn old-closedn)' w+ e! n( O- z7 [
              (command "_n")
  i2 L* D* ]. J9 H5 N/ v$ y            )# y0 V4 B  \) }% h
            (command "")
- i! W% u0 ]; [- }1 O+ m2 ~          )
8 N0 Y" b% E& l8 ]5 h9 B( z: @        ). ~7 K. L- @1 e( M$ s0 P5 t
      )8 p" K4 x5 p1 _+ }
    )
  n! b( i% K/ g  )
. l1 K5 G3 A! V, u" R  ;;
! D; Y7 P3 P4 t1 e# R  ;; All the spline data is contained in a single elist. We must do some' _5 a7 r6 j/ a5 z9 {% D  L- q& i
  ;; tricky list processing to loop through the elist in order to display# n7 g& X$ D1 t3 C- K' a; |
  ;; all of the control points.  v3 f% U9 A# n0 z
  ;;
! s( m2 \' C8 N+ z$ ^; O" u1 T  ;; The structure of the elist is different for rational and non-rational8 Q; Q* s1 ?( E, R" ^
  ;; splines. Therefore, we check the rational spline flag., X% @! E; x1 n1 F# e' S( O( D
  ;;
& ^2 e# X* b1 R) F7 e  (defun next_cntl_pt (), d  v* j% J! w3 _! t3 e% \
    (setq elem-no 0)               ;; elem-no = element counter
4 ^$ s; R' a' m0 j$ f    (if (= first-10-time 1)        ;; If first time, find location of first
( ?9 w( k3 O$ W* o        (foreach list_item elist   ;; cntl point element in elist% \' q( X: `# W7 @  b/ d/ F
           (progn1 V$ f; y9 ?7 y$ h' |# s4 n
               (setq elem-no (+ 1 elem-no))
) U. M1 B4 n$ [. Y! C' H               (if (= (car list_item) 10)
% w* I$ B/ D7 {% ^( i: k                   (progn! ^2 _8 ~4 O# h" y* r+ A
                       (if (= first-10-time 1)/ P0 J. j9 Y) m; j6 m* n
                           (progn
8 n- A/ S2 `! U1 \                              (setq first-10-rec (- elem-no 1))
* e& L+ S. `! n; v# F1 f7 R                              (setq first-10-time 0)3 G; d: t+ f) o0 b
                              (if (= rational_spl_flag 1) ;; if rational
- O9 N6 c# u4 p& d                                  (setq cur-10-rec (+ elem-no 1))! U/ H& h* n; ~- |0 D
                                  (setq cur-10-rec elem-no)
! g* H% \5 t- H5 R& q0 n                              )4 S% {/ g6 W. O
                           )
6 F- i! m0 U8 f7 V6 O" N1 q% }                       )
6 O! @. T( x- t) `4 t, m9 o* W$ |                   )
. |% Z: h: P/ Z* E& L& ]* @/ B               )
, `& l1 b: Z! P$ R% P           )
" b2 I! f! U6 f5 B9 a9 q" p        )
6 S: h* @7 e! @7 \    )
' `9 f1 @1 ^% P' H" Z- v$ a5 E    ;; Now we know the location of the first "10" record; it's stored
8 @5 ]1 c$ K; c% c    ;; in first-10-rec. The first 10 record was already displayed when0 y! F9 z9 A1 o9 r7 y
    ;; the dialog first came up so let's display the second one when' i9 S. M  [: n6 a4 H: X' A
    ;; the user presses the "next" button (the first time through).0 H# A$ l( t& A# E8 u
    ;;
9 h5 e  Y% i, i* {    (setq temprec (nth cur-10-rec elist))' E# b; H: A. e& ~6 V" L. h2 ?
    ;;
. ?  D5 t9 o" ]) \. g    (if (= (car temprec) 10)   ;; if 10 record
' s# N! O+ H+ [& I$ _' p3 F      (progn, @: i  t. N5 V6 h5 B+ Y
        (if (= rational_spl_flag 1)    ;; if rational spline) R1 Z- Z: ]0 [
          (progn
. b% }* ?0 A. O7 T& ]: z            (setq tempweight (nth (+ cur-10-rec 1) elist))
) d* D% A# ^7 ]- Y# D            (setq cur-10-rec (+ 2 cur-10-rec)). w# E# j3 g0 Q: h6 z$ N
          )
4 S* g3 {- t/ }% v- }          (progn                       ;; else
$ M9 y1 x8 V4 ]# l" F/ {3 A            (setq cur-10-rec (+ 1 cur-10-rec))
2 K  T- T( O7 H! w' r/ y          )$ t- F, P3 a5 o, [1 T: c* b
        )* T9 ], j& E$ }5 N
      )                                ;; end if rational spline
! C  _  n  `1 p1 K; O      (progn                   ;; else reset counters
% u0 ]; \" H2 V        (setq temprec (nth first-10-rec elist))  ;; get 1st 10 rec$ ]  b. j% B' n& ]% o, e3 o( R) [
        (setq tempweight (nth (+ first-10-rec 1) elist))7 k& F; _% o  U$ [
        (setq cntl-pt-indicator 0)
7 ~( _7 y  @. w. [        (if (= rational_spl_flag 1)             ;; if rational1 c/ o6 y7 M& D' k- n5 ]$ E+ T
            (setq cur-10-rec (+ first-10-rec 2)) ;; point to 2nd 10 rec
' `3 z5 {% j4 G9 o. m9 T0 P            (setq cur-10-rec (+ first-10-rec 1)) ;; point to 2nd 10 rec/ x2 E6 X. _. w1 n2 k
        )4 p1 Y- O; l" _9 H  ]- Z8 H
      )
- h7 K; w! i: Q7 b4 E5 T, h    )                          ;; end if 10 record
' d: x2 J6 x8 |( w
5 G5 ~; E" e3 l- p8 k; U$ t+ b    ;; Display cntl point, weight and ctr. Increment ctr.
6 K+ S6 d0 b. C3 s; d& E    (setq cntl-pt (cdr temprec))# [6 s% L4 T9 S! I" A1 r& b
    (set_tile "xtext" (rtos (setq x1 (car cntl-pt)))); U# ~4 C. \  d5 _
    (set_tile "ytext" (rtos (setq y1 (cadr cntl-pt))))* }9 X3 M9 ~- ~2 ]" R
    (set_tile "ztext" (rtos (setq z1 (caddr cntl-pt))))
; _4 v* p5 H9 K+ N/ a    (setq cntl-pt-indicator (+ 1 cntl-pt-indicator))
7 b: l5 M; l' b0 [  |4 {7 _    (set_tile "cntl_ctr" (itoa cntl-pt-indicator))! N+ h# d  v8 ?
    (if (= rational_spl_flag 1)                     ;; if rational% ?7 S( K1 h5 s) ^
        (set_tile "weight" (rtos (cdr tempweight))) ;; disp wght, b0 p- l& `$ z6 [
        (mode_tile "weight_text" 1)                 ;; disable wght
6 R+ `+ R) l% B$ C    )
' ?0 s  R! V& s8 b( H  )
0 w: I9 |! s# G  ;;4 y+ S+ Y. j/ J$ G0 e' ]4 B" ^
  ;; All the spline info is contained in a single elist. We must do some( m, `& y: d* s& \( E  g
  ;; tricky list processing to loop through the elist in order to display4 A. K2 `( g  }% C) Y
  ;; all of the user data points.
9 n; }, y! Q7 g  ;;, ^) G, x3 D! O8 @; L4 `5 P  B6 L
  (defun next_data_pt ()
0 P1 d' \( _. c; V    (setq elem-no 0)               ;; elem-no = element counter
) K9 \5 f( H6 \3 H7 u    (if (= first-11-time 1)        ;; If first time, find location of first' \$ w; I6 h. P# K/ j' p0 ~
        (foreach list_item elist   ;; data point element in elist
' v( m8 V  u% n* K           (progn8 Z, @( v& [" v, g
               (setq elem-no (+ 1 elem-no))
8 A. x6 E5 U$ _0 T" F               (if (= (car list_item) 11)2 n! y9 R8 J1 i
                   (progn
+ o- B  `- q( h  s# {3 M* D                       (if (= first-11-time 1)& }1 D5 ?0 L$ W' W; k
                           (progn
" C/ R/ l# q4 x* c5 C6 u                              (setq first-11-rec (- elem-no 1))0 r8 L% h/ e' y
                              (setq cur-11-rec elem-no)9 K' ?" _* ~; o- z' T% U. s
                              (setq first-11-time 0)
+ @: A  v4 @. n3 |                           ): C+ U. v! i# I
                       )
4 [0 G6 M  W3 |6 d                   )) E" X/ Y% j# b, x
               ). v+ F* I9 Y' _$ M
           )5 T7 Y! v9 {! y1 N+ b9 v) i/ V
        )
3 O0 U: I% u3 @    )8 N0 d! _6 n" \& l
    (setq temprec (nth cur-11-rec elist))6 R' s1 g% `5 y" A$ w
    ;; If it's not a DXF "11" element then we've gone past the last& r( L0 w3 M* p8 h; f8 s6 c
    ;; "11" element. Go back to first "11" element. Reset counters.
: E+ T. N" R5 I# v0 w    (if (= (car temprec) 11)
. v. W7 h. f1 p( I2 p0 |- s9 {        (setq data-pt (cdr temprec))
0 n. j0 _, a% c+ ~        (progn                           ;; else
/ ]7 h4 |. I+ K7 u, m' }! U1 D8 Y           (setq data-pt (cdr (nth first-11-rec elist)))
5 a) S- ^( i% q; u$ T- W           (setq cur-11-rec first-11-rec); F7 X5 k# i# \4 Y' M8 g; m
           (setq data-pt-indicator 0)
2 T( A" G" n& z        )
! C* J; P" l3 f, Z6 a( b    )
  y7 S& {/ p! U2 \: O    ;; Display data point and ctr. Increment counters.
1 d4 X1 d( n' z) h    (set_tile "dxtext" (rtos (setq x1 (car data-pt))))& {& p- A) x  c! {' _: N$ g
    (set_tile "dytext" (rtos (setq y1 (cadr data-pt))))
$ V5 p: }: t" ?( D" u5 s4 y    (set_tile "dztext" (rtos (setq z1 (caddr data-pt))))
- S- L) v* Y' Y) o    (setq data-pt-indicator (+ 1 data-pt-indicator)). X& x( j5 }' A2 J
    (set_tile "data_ctr" (itoa data-pt-indicator))
7 n) n* H) O( |! s& R+ F( T% Z    (setq cur-11-rec (+ 1 cur-11-rec))* ~' g: e7 u, N9 S) \. p$ Y6 Z
  )
8 R: N1 t, _$ F  ;;0 T' n% ]4 Z2 c7 X! k1 `8 ?
  ;; Modify SPLINE2 S8 Y) B0 ^- n* p0 h; E/ n
  ;;0 Z1 {( `" t. y! a" x
  (defun modify_spline ()% T  c2 _1 z/ c
    (modify_prop_geom)
2 h0 T; j% Q( E: x, f! d% B    (entmod elist)
( H* E+ _# T: R  W5 u7 X$ O, j# m7 x9 v  )
! V+ G& O1 d4 g* k3 w4 M, s/ z: a( n* {* \+ ?5 N" ?, E
  (defun ddspline ()% F! T3 _5 h3 q0 n
    (if (not (new_dialog "ddspline" dcl_id)) (exit))) y" g! E$ z6 t* }7 @9 K
    (set_tile_props)
* @- T& u' }4 w" C' O, K    (set_tile_handle)
* {9 R, Q4 \, d  Q0 b0 o) l1 v    (set_tile_spline_props), ~; }1 G) @- y( k6 u% ^
    ;; Display first control point1 K6 \0 g5 c' W) N& Q; Y
    (set_tile_cntl_pt)
% w& a/ m+ [# q    ;; Display first data point4 T; Y4 k3 o0 c; t' F
    (set_tile_data_pt)" u* d# `; f! U. J2 g/ f

; P6 E4 i' l& q, l    ;; Initialize flags to indicate first time through the dialog.: X1 D- m' H6 [. Q  K
    ;; For control points and user data points the "next" buttons
; m& C7 ?$ M; m  i& }) w    ;; in the dialog call the appropriate functions.
; A+ _6 m1 G+ ~4 W    (setq first-10-time 1)
: K! E2 z; f9 A) \/ [( X. U( h    (setq first-11-time 1)
: t* |8 Z8 E* X& l* r    ;; initialize control point number counter
, F- f0 w+ i4 I: C- \$ k    (setq cntl-pt-indicator 1)
# d9 `0 b! |8 @8 ]2 U    (setq data-pt-indicator 1)1 Z5 P! k2 `3 F# u
    (set_tile "cntl_ctr" (itoa cntl-pt-indicator))
! m3 j+ \' o# u1 o    (set_tile "data_ctr" (itoa data-pt-indicator))6 t' [$ t) |* }5 X$ _2 x6 e, z! w4 m- |& r
    (set_action_tiles)1 i& c  ]7 W3 T$ m( e( T+ K
    (setq dialog-state (start_dialog))% W; A  n& s3 E0 n5 Q1 `  X: O

9 _' i/ S  e. q6 }4 \    (if (= dialog-state 0)
) K: V. X7 |4 r# o      (reset)9 n& e: B! _1 T( y. M* D+ p
    )
- Q7 @: o0 Z4 ], n4 T    (if (= dialog-state 1): m0 B, Z; E1 |2 J; X( e" h- h
      (modify_spline): j+ d3 J# `" D  Z3 R
    )
6 A5 h5 o  I7 s5 u. M  )
9 R" ]/ h) f, q
7 u" ^" F9 V7 r* @6 R
, ?% @' M8 n0 [0 {- L; d, R
. f8 E6 g/ Z* M; `0 U9 g  ;;
8 s+ N# x/ w# p& Z' S; a  ^8 @  ;; Modify DIMENSION
/ ]. A$ Y3 S9 t+ N& b  ;;( C4 v/ ~$ _+ Q( `5 g7 h
  (defun ddimen (/ dtypebit blkname bename sublist a stname n dimtbl
( d: [1 }& I3 W; r  e) [! k! Z9 {                   dimsty dimlist dimtext svtext dimovr sv_dvlist stlist
1 J& O9 s3 H. B# y9 `, v8 G2 f                   dimtype dimsvcurset). u# s" o+ z. Q% g4 A
   (setq dimtype "DDIMEN"
% W) P& m! a( l1 C# h0 N          dimsvcurset (ddimen_dimsty_restore)8 _& Y: b9 T1 L5 y8 z- K8 l+ z
    )2 ]- R2 q2 P/ ^% X5 n3 m7 B
    (if (not (new_dialog "ddimen" dcl_id)) (exit))$ y5 N+ y6 M6 k& B/ Z4 j
    (set_tile_props)( ^2 l  q8 t4 d! B3 o2 g: }* q) h% O- L) G
    (set_dimen_props)
3 u7 @0 J: J/ M    (setq dimtext (cdr (assoc 1 elist)))
! l* `7 \% O7 V6 z! e& V    (set_tile "t_string" (if (= "" dimtext) "<>" dimtext))  O. x$ d1 ~& N- G8 q
    (set_tile_handle)
& L5 T! L1 b  c( o6 `    ;; Define action for tiles
" I/ r1 F& `7 @' H( T    (set_action_tiles)
2 ~* N9 j: ~6 `8 C
; X5 O' R8 v. ?2 ?0 p2 z    ;; Set initial focus to text edit box.6 F* a% n) Q: K" Q
    (mode_tile "t_string" 2)
9 ?; U  V- b+ ^. i
; m- k0 U/ e2 v    (setq dialog-state (start_dialog))
# p& [5 }3 J# A% a4 V    (if (= dialog-state 0)3 j2 m- r) ?, E8 f
      (if (= ddimmt 1)
6 s. h/ i+ y- |0 b! j* O) Q: f, \        (reset)8 Q9 Z: N9 r2 D- `" y: g8 T5 U
      )& e4 {, Z9 b7 w3 y3 L  @
    )
! A' V# V- p! @8 |    (if (= dialog-state 1). p, C; O3 s# V& @4 e
      (progn+ D4 p1 I; h' A/ ^8 W) q$ p
        (if (/= dimsty stname)" y, h) ^/ ^  t% B5 h/ ^4 \
          (progn2 y8 `4 Z: i8 C& P0 ^
            ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case) i( y- Q! Y4 B$ q2 k. Y
            ; doesn't have it.
* q& r2 D6 m  P7 ~            (if (null (assoc 3 elist))
8 f% f& q; Z" k! E/ G3 f: P              (setq elist (append elist (list (cons 3 dimsty))))% {1 ^( `& v  f% O  F5 R
              ; else just replace it.1 C/ C0 U" [$ w' B/ ^+ K& G3 a0 x
              (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))2 J! k4 q$ P6 a. W! z0 K
            )
; [; t: |2 S# a4 ?2 D. a            ; refresh sv_dvlist with new dimstyle.2 q' G% p# s7 T
            (setq sv_dvlist (tblsearch "dimstyle" dimsty))
. v* h# a, X9 Z! c. S& H/ c          )2 O: @9 Q8 Q) s1 L
        )
0 ?- h' _6 z% G( s( {$ A9 R        (if (not (null dimlist))   ; attempted to change dimvars
. j& J+ c4 a4 Y+ ?1 k) T          (ddimen_complist sv_dvlist dimlist dimtbl). w8 T0 j( F' {" G. L! d
        )- U  }$ V' t* i4 m& `# @
        ; Modify dimension text+ n3 @/ B( u* \9 |7 ^+ r) K1 J
        (if (/= dimtext text). K! S4 f2 l$ @0 m" T8 U! X) H  P
          (progn
8 \1 m& q6 L( a, ]+ S1 \% _: Y) n6 E            (setq dimtext (if (= text "<>") "" text))7 B8 F; [& y- g8 J; b
            (setq elist (subst (cons 1 dimtext) (assoc 1 elist) elist))  I6 [: q7 I% N. l2 W
          )
# m1 K& y4 l1 M: o/ M# d7 U: I        )
7 _' c/ _) l  p5 ?/ ^! R, P* X        (modify_properties)1 u5 U; Y5 G# P
        (entmod elist)# v) {4 U1 \% c) @7 o
      )/ F+ X6 q- Y! b1 Q
    )7 x& x1 R% I) ^* X6 G
    (if (= dialog-state 4)
! c8 ?- u9 _  b. {4 A0 o! g9 o% I      (progn
* t2 |5 I& W2 z9 ~+ z' \        (setq ddimmt 1)# ]" m# Q9 N6 p8 n
        (if (/= dimsty stname)
$ a1 D* O. J: e, L& z: u7 t. O          (progn$ J, G4 a7 `; x: a" e+ c
            ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case' V; u  \2 X  }4 k. Y5 N
            ; doesn't have it.
0 ]. i$ C- [9 o1 \3 n            (if (null (assoc 3 elist))! X1 l- H' V. K# @
              (setq elist (append elist (list (cons 3 dimsty))))
3 M4 k, U$ j' M, c1 g              ; else just replace it.
- B" W4 G2 r( t4 K' C              (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))
) }7 j. c4 [2 e! |3 f2 @7 u            )8 g. @7 Y0 y# E: r9 P1 s
            ; refresh sv_dvlist with new dimstyle.
3 u) l: L! N" u3 n' G- l            (setq sv_dvlist (tblsearch "dimstyle" dimsty))
4 F9 T$ _/ H  Q. W' k# N          )8 `% b( s) Y- f
        )
) T; V4 ]! X0 x7 g        (if (not (null dimlist))   ; attempted to change dimvars
# o, _6 i$ z' i1 O/ N8 H          (ddimen_complist sv_dvlist dimlist dimtbl)
- \! k4 F! H  k# l' s        ): x) `( Q+ @; h! B
        ; Modify dimension text( Z, a: i- q  F$ B
        (if (/= dimtext text)
  J& Y5 W! `" v$ M* ^! d( J& E          (progn1 f" u2 A7 I+ n0 h
            (setq dimtext (if (= text "<>") "" text))# {% o2 d" p/ J$ o: C
            (setq elist (subst (cons 1 dimtext) (assoc 1 elist) elist))
+ @2 S: y8 S' K          )
8 [' ^; C. p' j6 R9 {  r+ ^# m, Y( ~        )0 C5 J) T8 {/ m' @% F6 N; L' G
        (modify_properties)" L6 A; E0 V9 u5 j
        (entmod elist). K9 N) M" Q/ s; k# g$ w1 y8 H. g
        (safe_ddedit ename)
6 d7 F! e5 b5 f( h. a" Y' Q5 D8 }        (setq elist (entget ename))
# U! k& I$ S+ _/ a        (ddimen)" E& b6 l; Y; y5 q9 A/ L! `
      )
0 b/ Y6 n( {$ S# y    )2 E# b/ x* d- O& \0 u$ C$ x# F
    (ddimen_setvars dimsvcurset)      ; Prepare to exit  B9 E4 e8 Z. e7 p! R/ s9 d
  )
5 C% S, J- B  o- R7 d. ?9 S% H4 m- j- n
  ;;6 S, p) B/ q+ r( D4 c
  ;; Modify TOLERANCE: M3 Y$ X/ r0 x; R  m2 Q
  ;;$ @  ]( w' X# u# d
  (defun ddtolerance (/ a stname n dimtbl
! U" u2 m" L: ]; ?; G, p! \                   dimsty dimlist dimovr sv_dvlist stlist dimtype
  @, e, I) ^- k# H& N6 E( }6 k2 e                   dimsvcurset)0 S. e1 e: q1 H' F
    (setq dimtype "DDTOLERANCE"
$ y! p0 `. g5 b; h& q3 C          dimsvcurset (ddimen_dimsty_restore)
4 C) J3 ]$ \; J    )8 Q1 F' l- g7 [, J! Z8 g
    (if (not (new_dialog "ddtolerance" dcl_id)) (exit))
, a4 ]( L* e* H7 s! V    (set_tile_props)
# B  I% Y( o$ Z( C; v! G    (set_dimen_props)( `; g- p. S& F2 A
    (set_tile_handle)
$ f) v4 Z4 T3 C# w( r4 z1 [    (set_action_tiles)- u1 Y) A8 J1 d* r0 U1 S+ ^7 e3 K* @
    (setq dialog-state (start_dialog))* [& q7 {0 A" l9 g% }9 l2 d
    (if (= dialog-state 0)
0 ?9 }1 I3 d7 Z0 Y7 c      (if (= ddimmt 1)0 o" `4 j3 A3 L$ f& [5 m& T$ u
        (reset)0 q8 Z; v0 e! H" E/ ?
      )
+ Z3 A  X9 [8 U! t    )
8 S0 r' ]2 @9 w9 N# `5 A, k& p5 q    (if (= dialog-state 1)
8 I* [0 W& s' l6 W4 w5 r      (progn
4 }' x" W, }2 ~$ y9 V. L5 s& T        (if (/= dimsty stname)
/ K: C: ?0 U0 l* v# o          (progn0 F% X7 \6 M3 `- C: j/ [
            ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case" K2 W- k# n3 Y0 V) C
            ; doesn't have it.) }' K, d; _) t9 s0 }
            (if (null (assoc 3 elist))
7 v% s; _: R& I/ L5 u3 n  [              (setq elist (append elist (list (cons 3 dimsty))))
1 `  W3 C6 k8 z! f" O9 H              ; else just replace it." y# q, R! b$ b
              (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))
* z5 n& I7 u8 T' W- D            )9 j' l( C5 I  b+ _! g
            ; refresh sv_dvlist with new dimstyle.0 Y8 L$ ~7 g( g5 ?
            (setq sv_dvlist (tblsearch "dimstyle" dimsty))1 G! K/ Z/ P( \. F; b! t
          ); K* o+ M- r. Z) a6 \5 p. \0 D1 W* m5 t
        )
5 b2 V8 u$ S4 X6 ^* }        (if (not (null dimlist))   ; attempted to change dimvars$ H1 g$ s6 U9 m& i' y8 _' `, X) r( V
          (ddimen_complist sv_dvlist dimlist dimtbl)
8 f# Z5 ?% L' G2 ^- o        )
1 p, E! ^& _% N8 L9 \( F# V" o        (modify_prop_geom)( a+ X1 X" F' S1 J5 x
        (entmod elist)
, S# \5 f0 f$ ~% C3 Q: c* C      )
& S. i% e/ F9 C: Z. ^8 C    )
) O. {  d. b/ }* j; [$ W2 w% N    (if (= dialog-state 4)4 [% E: L* ]' Q: e: F
      (progn/ r# j) h2 c; d! }! O& s+ Y
        (setq ddimmt 1)
  y6 X( u; m: C( [3 Y" O        (if (/= dimsty stname)
4 \* u9 G1 H( E' Q% S2 x/ L$ u          (progn
/ R1 Q4 [& d4 A# G9 \            ; Be sure to add (3 . dimstylename) element. R12 *UNNAMED case2 Y1 T0 e- @  J  X& {& J
            ; doesn't have it.
4 L2 Z' ]7 }' }6 ^* n3 d$ A            (if (null (assoc 3 elist))
" _( b9 n4 i' E% c' M# f$ h              (setq elist (append elist (list (cons 3 dimsty))))
$ ~# v) w) l  A. P2 N              ; else just replace it.' J% k7 P; U9 {8 k: y
              (setq elist (subst (cons 3 dimsty) (assoc 3 elist) elist))! {8 G1 {8 v& u# C! ]& s) Q
            )1 L% V+ M* t) ?+ k3 \. u
            ; refresh sv_dvlist with new dimstyle.1 v7 W( x5 Y, j/ D, L0 O; s
            (setq sv_dvlist (tblsearch "dimstyle" dimsty))" v" W& P% u/ K
          )- x3 L. Y6 P9 X! v" K# V$ |
        )5 q: j# |. L; G
        (if (not (null dimlist))   ; attempted to change dimvars$ z. J3 L8 j/ [7 S) c% R# D
          (ddimen_complist sv_dvlist dimlist dimtbl)
" ?# Q# x1 Z* R  |% i- L9 A        )
$ [+ P* Z% Y/ l0 ~! s% J' a        (modify_properties)6 r& L. t3 q3 j  d8 B% F4 A3 Y% s
        (entmod elist)
0 Z9 w! [* k7 L) N/ Z$ q! O2 m        (safe_ddedit ename)& }8 h  U/ v/ k0 K
        (setq elist (entget ename))( ?2 M: D  }* W
        (ddtolerance)
* X/ @: G( ]8 }. ^9 Y& ]7 l& _5 K      )+ h/ D' e2 Y8 \+ q# f, d
    )7 A6 O" u, [* C. N1 i9 g
    (ddimen_setvars dimsvcurset)      ; Prepare to exit
& p3 A; t' _( `) \3 Q1 L)8 f; ?; u' z+ A& j8 {
* l- b9 C. f* j7 k4 N5 l  ]
  ;;8 X4 @4 S: P* p5 \! y6 q
  ;; ddimen_dlg - jump to ADS ddim module
+ k* ~- Z7 V5 e  ;;
) z# S3 I% I0 s. ?: [( A; Y1 D, v: W" @+ D9 x9 X: L0 B' [
  (defun ddimen_dlg (dimtype tile dimsty dvlist / dimlist)' l; f: ~0 U& o4 P' L) N% N' Y
# g7 h4 U  h. F% Q0 ?9 Y; I
    ; Jump to DDIM with overrides if any.
' P% U' k% s2 }0 r) S! ^    (cond ((= tile 11) (setq dimlist (c:ddim "DDMODIFY" dimtype tile dimsty dvlist))) ; Geometry
# X. L" c: ^' m          ((= tile 12) (setq dimlist (c:ddim "DDMODIFY" dimtype tile dimsty dvlist))) ; Format* P5 |5 ^' n# m4 W( `. a* _/ v+ `5 S
          ((= tile 13) (setq dimlist (c:ddim "DDMODIFY" dimtype tile dimsty dvlist))) ; Annotation
0 r) E5 k( V; i    )
( y6 e9 C! \/ G% ?# U1 s  )$ d% F) g* j% M! h* l8 W" F6 Y- a0 i

0 u3 Z' }  i/ [: t: W9 a8 T  ;;
$ L' z7 ]: [/ F/ X6 ?) V  ;; Dimension variables updated are stored as overrides.# @& d( J. Z+ a- _+ J- {
  ;;# D3 K2 v3 o( c& w! @6 B( c# U

/ a5 t* t: v0 o  (defun ddimen_complist (dimolist dimnlist dimtbl / i odvar ndvar
6 o+ n1 {4 Y1 u2 O; i  Z1 ?/ B# P                          dv dime commandIssued)
. g0 K! d# M* ^  f9 E* Q$ [$ W9 M  Q/ [9 C5 |6 ^( F4 p% f
    ; Here we skip the following first three items:
2 J9 R  c: N0 \; o( H    ;   (0 . "DIMSTYLE") (2 . sylename) (70 . 0)
3 b2 U; v4 c6 A$ h2 M& N0 ~, t" M9 {5 P    ;) j6 D5 l1 |3 x$ ?5 O# E
    ; The list comparison immediately begins with dimvar.
2 ^6 }" S- O3 Y' m    ;
& L: L0 `* i- @6 u, d# n% F    ;  dimolist - original states of dimvars
  _  F, @, p: F6 j! |    ;  dimnlist - new dimvar list which is of the resbuf's5 y. r: k8 |- l
    ;  dime - entity name for the dimension
8 q3 s4 g, a! i* S' f    ;  odvar - value of dimvar for the dimolist
+ Z1 n; W- ?3 ]9 p    ;  ndvar - value of dimvar for the dimnlist/ R2 i4 d# N( Y* q, g) A

2 d; L2 f0 B' e  |+ k4 f* K    (setq i 3
. N. f" s- @1 ^' I( j8 |8 a          dime (cdr (assoc -1 elist))2 L" Z, c, J3 m6 [; _1 U  [
    )
3 c! l/ K7 Q- g5 _$ }+ y    (while (setq odvar (cdr (nth i dimolist)))
! y1 j1 f# Q% d. u+ K" M8 e      (progn
8 O- \" ?+ t' S8 `0 ^        (setq ndvar (cdr (nth i dimnlist)))
6 D! c+ ]; X% W" [        (setq dv (nth i dimtbl))% o" Z# ?0 v( n/ H
        (if (eq dv "dimtxsty")% M9 ^& g8 {& [
            (setq odvar (cdr (assoc 2 (entget odvar)))
! ^' o' y# a& k8 E* E/ Z+ X                  ndvar (cdr (assoc 2 (entget ndvar)))+ R3 L5 v6 t3 y9 Y. H/ }. k7 {2 }+ j/ Z
            )( ]5 ~! i8 C/ N9 ]! c& [3 _
        )# p6 Q, G/ [" \; b8 Z

: E' S% ~: S7 y7 l7 o& e* c                ;* B0 b; \0 M4 I$ Q6 f3 S
                ; In order for DIMOVERRRIDE to operate correctly with string
1 n" d" L7 }# F; J/ N$ R                ; based dimvars, we must pass "." versus NULL strings.$ \- G" Y8 V  O# i! o& ^
                ; In this case ndvar is the new dimvar value the user wishes) a* |' N' y$ t3 G' Q% O. s- K  U( P
                ; to update on selected dimensions.
$ m( s  S/ r2 O2 \* k, B, p% ^8 y1 T                ;
9 m: R* w5 k) r  a7 |5 t            (if (/= ndvar odvar)
# V  F) |6 x9 \              (if (= 'STR (type ndvar)), O& Q/ I4 p+ V0 w+ V
                (if (= ndvar "")6 @( O2 T3 `! p
                      (setq ndvar "."))))
3 h' y  E5 ~3 b" ]; H# Q
1 W3 ]' @) Z- T5 C& x        (if (/= ndvar odvar)2 u3 S5 O" n  _; ^
          (progn) e% I6 g7 p3 J5 ~9 o
            (setq dv (strcat "_" dv))* x/ i/ Z. l1 A) w. J- l% A
            ;* R$ b  R: Y0 C6 o$ F
            ; Start the dimoverride command
! L1 T3 g0 e6 x1 Q, P, r) F            ;. N" G* e+ V/ S6 k, F* v. J
            (if (not commandIssued)
7 H1 p" o* C* ?+ C               (progn
0 _) g. j: Y$ s                 (command "_.dimoverride")
6 x- v8 }- E- Q  e* l) G4 K                 (setq commandIssued "T")/ O/ V3 A, q2 v& y0 @
               )
9 v+ _' p) x6 a- I) ^            )
8 d5 v- h; K* ^, U3 d# W            ;
0 b! s( l  Q- ]# a2 X7 I            ; Issue dim overrides
: W( \5 T/ M; O9 f5 @: f            ;, b4 {" T0 y/ C7 Q4 v
            (if (and (or (= dv "_dimclrd") (= dv "_dimclrt") (= dv "_dimclre"))* g  N* F+ |' g8 s8 s
                     (or (= ndvar 0) (= ndvar 256))5 Y- n! g5 G8 _1 R  V/ t
                )5 ?: a* P& U8 {7 C8 C+ {
              (progn9 E4 c. Y! q( H* j) A/ g
                (if (= 0 ndvar) (command dv "BYBLOCK"))
; P- V7 g$ r% |/ g) h. Z% s                (if (= 256 ndvar) (command dv "BYLAYER"))
% }' ^2 w, E6 g0 K& S1 l  ?) _9 T4 {              ): I9 ]9 Y$ R7 m5 U# L# v
              (command dv ndvar)
# ]+ w* _' d) p8 y3 w            )
+ w6 P2 u1 U- k" l) `( i          )
3 S6 t- E5 j* e1 l4 Y        )
+ ^* _7 v& W9 H) A" z        (setq i (1+ i))0 ]2 n4 [; k/ t5 V) ]! n& l( k
      ). d4 o& {" j8 r! T7 \
    )& Z; n& S+ V/ b- p, R. @
    ;
0 Q+ e; _2 D' p& q7 W    ; Select Entity and terminate command7 e, c( a$ d# k# ~- }
    ;+ g5 [" O2 ~9 q$ u0 r% U. J
    (if commandIssued
+ D; ~6 U) p! H& _5 w        (command "" dime "")
7 C( Z. {  K: j/ F1 |- I8 O$ o3 u2 J6 t    )
# @6 @+ M2 {/ k% V6 l+ X+ N  )
% U( E9 V& S! C4 l2 ~* D4 a, C
* X+ r5 D0 N' U( `3 H  ;;$ w! X' T/ Z) Q3 n- w' Q
  ;; Get style name currently selected style name.
* d6 Y- l0 F# X% d  ;;
" p/ r# ]3 r  o/ K! ~  @
! u9 h6 ]# i+ j4 p4 a8 w* E, V2 G  (defun ddimen_style (/ dimsty)! z8 l( z1 {( f; k
    (setq dimsty (nth (atoi (get_tile "mod_style")) stlist)1 f# G( W2 l2 M$ A3 S
          dimlist (ddimen_getdimvars dimsty)
+ L* C; |- \  _. A2 c# l& ]    )4 a! i% b! t& I$ u
    dimsty. F1 `+ |6 a: {0 N9 u" T: V
  )+ U! T+ |1 z4 w" T! A0 u- p* F1 p0 W

5 Z3 M) x& ]/ n3 u8 W* l  ;;4 K4 A1 g8 N. a. f+ ]8 s: _) m
  ;; Set dimvars& W! v$ t& @- d: D+ ~
  ;;3 f- B6 v4 g5 h) R$ g$ c' M
  (defun ddimen_setvars (dimsvcurset / dv i)
+ ~6 b5 Z/ F0 D$ `, t! e  _+ E    (setq dv (cdr (nth 1 dimsvcurset)))
4 F) r# t0 j- @  C  u    (command "_.dimstyle" "" dv)
6 e1 b* `, |3 ~! v  ~0 r: a    (setq i 3)$ e* X. f) S2 M- E, X1 r
    (while (setq dv (nth i dimsvcurset))
& U8 S+ a5 g$ `      (progn
8 c# K9 {! N6 G5 k0 E1 _% ?        (setvar (car dv) (cdr dv))
+ o2 m: l  b2 v) b/ C& K5 j        (setq i (1+ i))
$ B3 t& f- G& I7 ^) Q      )3 c. X0 ?; q  m( _, y
    ); J, ^6 G' u/ O5 e. x
  )5 `( w& x3 l- l# d  V0 ^
  ;;
  H7 P& |" ?0 ^1 }* J  ;;  End-of-dimension7 Q; B  g4 g; l+ V$ W
  ;; ==================
7 m6 F& {8 [9 x2 n+ w9 p  ?- `" i. o% {# F/ M
  ;;
/ R  m9 j( L# S! S' q& Y9 {1 ]' P  ;; Sub-dialogues for properties.  Common to all object dialogues3 r- T% }. D: n7 j. N# y3 S7 l# F
  ;;
& J4 t# U8 h/ O  ;; This function pops a dialogue box consisting of a list box,image tile, and( O5 c  D% G- t% ?; w! U- @% M
  ;; edit box to allow the user to select or type a color number.  It returns
  p, k0 O* u+ C- P& g  ;; the color number selected.  T% Y$ b( w/ Q7 G
  (defun getcolor (/ old-idx colorno cname lay_clr)
- i; a7 \$ V3 S% Z3 j9 |: i    (if (= (get_tile "error") "")4 s+ n7 s5 P0 o2 r/ v* X; A
      (progn4 R6 A% `2 U3 v8 E& W6 h  C
        ;; Get the color associated with this object's layer, for use
. ]4 X- k! n; v) Y  F        ;; in the color swatch if the user selects color BYLAYER.
" P& F8 ~1 Y9 D; H9 N        (setq lay_clr (cdr (assoc 62 (tblsearch "layer" elayer)))). s! h3 ]2 ^9 |3 m) d6 _
        (if (numberp (setq temp_color (acad_colordlg ecolor T lay_clr)))2 @; I1 d5 q7 J$ i2 ~6 r
          (progn4 C  b. {' \! C- X  m' ^
            (setq ecolor temp_color)
5 _1 n3 C1 y! y" m4 k1 q9 E. Y2 M            (setcolor)0 h$ r0 r/ ~/ T* B  j' {! M
          )
* J- M' U' N5 I          (setq testcolor temp_color)
9 E; b7 C1 U7 I8 g        )- l8 O! _$ v  g; w5 M# E$ T6 x
      )* F, c/ R* Z3 Z% [& O% t9 ~6 a" Z
    )5 ^' A2 m6 D7 g& N8 _8 ]1 E
    ecolor
2 |7 C5 R4 [6 T0 z+ N, N  )/ }+ B, V' q) v( x6 W  m
  ;;8 z2 n9 b7 V0 R! J" \; C
  ;; Function to set the color tiles.4 L& G: o) ?# e9 p) ]
  (defun setcolor(); ~# N1 _, ~. @* r
    (cond5 i( b& S& G; D2 }, R) _
      ((= 0 ecolor)# e3 {, k* C% B, ?
        (set_tile "t_color" "BYBLOCK")
: u; l$ W( m' Y. u        (col_tile "show_image" 7 nil)    ; show BYBLOCK as white1 B, ~( \7 Z- O) T
      ): I" Q8 F  B7 {' ^9 o/ H+ y
      ((= 1 ecolor): W. h" c3 P: J% f5 z0 e4 y( c( s/ i
        (set_tile "t_color" "1 red")
2 [* Z7 }1 R0 I0 U$ W8 s        (col_tile "show_image" 1 nil)
) D. V! m0 H# q7 m  Y0 Y! E      ), q) A7 z* t2 |* U7 c0 _
      ((= 2 ecolor)
* B$ v3 ~1 B% \+ A4 g+ {        (set_tile "t_color" "2 yellow")( B6 i+ N% N. z! B2 b6 p  t
        (col_tile "show_image" 2 nil)9 [2 J8 p! F) z% d0 u
      )/ {1 W$ p& N- V! T. D
      ((= 3 ecolor)  X# F- e2 z8 z; Y
        (set_tile "t_color" "3 green")$ E, A4 t; c% r; f. }
        (col_tile "show_image" 3 nil)
6 J# }" E2 j4 O) X$ S0 C2 s' [      )& A6 n% b1 `) M2 p  d
      ((= 4 ecolor)
) ?. w  K$ c3 M        (set_tile "t_color" "4 cyan")" a+ ~" v) v; g. D! n( F% S+ U
        (col_tile "show_image" 4 nil)
- p3 I- [" T/ m# y) h1 B; n& q, I      )
9 \$ r( O; {% F8 m3 M      ((= 5 ecolor)
" ^" {' e/ j2 S+ o5 ~) Z; d% \        (set_tile "t_color" "5 blue")4 O* C  f; D& C: ^% _
        (col_tile "show_image" 5 nil). v* Y' y# l6 r: S
      )
5 L, ?# {0 ], r. g      ((= 6 ecolor)& A% W7 O; V- R2 ]  o6 W5 r2 A
        (set_tile "t_color" "6 magenta"); e1 y+ U5 G) `1 z0 a& o
        (col_tile "show_image" 6 nil)( J; c! i# S8 c6 J3 g
      )
: ~8 c) ?/ }& F6 [: `6 S: h      ((= 7 ecolor)2 z& k/ ~. [: v4 ~
        (set_tile "t_color" "7 white")
: t  K, s$ z5 `' D5 e        (col_tile "show_image" 7 nil)1 J& K, k1 s( O) n2 l1 E% x
      )
& F7 }% ]7 C3 x% Y; l      ((= 256 ecolor)  h+ ^8 {4 s+ B; V8 @! d- L5 Z4 a
        (set_tile "t_color" "BYLAYER")- I. n$ H) K8 s
        (col_tile "show_image" (bylayer_col) nil)
* u* @8 ~& d3 m0 f7 T+ T      )
( V! _% r+ a& G  l      (T
# G! n: Q9 Z& K/ \7 o# r        (set_tile "t_color" (itoa ecolor))/ j) o5 L  x3 P4 D% M' J8 K
        (col_tile "show_image" ecolor nil)
# m# s1 r8 L7 I! l. `0 p      )% v* l3 n% G! G1 ~
    )6 P( W. ?3 ~& U$ G# B
  )- D& A$ Y- F2 z
  ;;
8 g( N3 I: ^: d3 r& h  ;; This function pops a dialogue box consisting of a list box, image tile, and4 J* P7 }0 [& r
  ;; edit box to allow the user to select or  type a linetype.  It returns the
7 V' I+ M1 z( M0 \- }# K  ;; linetype selected.6 c& \4 v& S! x' |( M2 T" Q3 @  y; g
  ;;0 J" Q( B) [8 X# k7 f' L
  (defun getltype (/ old-idx ltname)
- N3 p. O( ?7 d, \    (if (not lt-idx)3 M8 \; T* a# y2 T
      (progn
2 T7 H/ M) F# o# P        (make_lt_lists)             ; linetype lists - ltnmlst, mdashlist
6 e2 t/ ~- j- x        (cond' {/ q' \1 O) T8 G8 _& _. }
          ((= eltype "BYLAYER")
! @' I" y, f* t- ?/ I, F             (setq lt-idx (getindex "BYLAYER" ltnmlst)))& K+ u! g& D! v; v5 J( N, m
          ((= eltype "BYBLOCK")
1 d- q' H2 P* S, Q! r             (setq lt-idx (getindex "BYBLOCK" ltnmlst)))
  S7 s* R: u+ k8 B+ I6 v# I" [          (T (setq lt-idx (getindex eltype ltnmlst)))' z4 ?- c+ g$ M, k
        )- {8 ~! }3 ], N" `/ W2 R
      )
# z9 A6 P/ M  Y4 q# T    )
: y9 y8 p8 z. J. f- O" @
6 s5 z7 G- Z. b, a8 i8 T- a/ }    (if (= (get_tile "error") "")( B7 r* i+ o) a7 m5 I7 Y
     (progn8 P3 t6 @" q& D' _
      (if (not (new_dialog "setltype" dcl_id)) (exit))
- \. d' p( y3 q9 O# a      (start_list "list_lt")9 _3 j, d5 I8 N5 i# p; n5 [6 v2 W
      (mapcar 'add_list ltnmlst)  ; initialize list box
4 ^. w  W* x0 i! R: D% Z      (end_list)
" C# f: {9 T; |, m5 H      (setq old-idx lt-idx)& K$ J0 y4 X7 q
      (ltlist_act (itoa lt-idx))9 d$ `5 w" i: n2 ^3 @( |" [/ x
& D  k1 Z, V. w) h# o0 V; ~
      (action_tile "list_lt" "(ltlist_act $value)")
: w/ N" u/ a6 p! @# g1 j6 G      (action_tile "edit_lt" "(ltedit_act $value)")
% p' ]  u4 b1 h  b0 r6 {8 P      (action_tile "accept" "(test_ok)")
3 R/ u( P0 |6 ~* b3 D      (action_tile "cancel" "(reset_lt)")
+ Y7 x* G+ o1 i- q
; i/ p/ P5 k0 b5 a: P. y      (if (= (start_dialog) 1) ; User pressed OK
* Y+ P# J/ w+ u- y- H        (cond
" T7 ~6 m3 P4 p          ((= lt-idx 0)' U3 z6 I8 q9 U" n3 L
            (set_tile "t_ltype" (bylayer_lt))
# v) @. A4 p7 l- t0 n            "BYLAYER"
: J2 e8 ~* T: @! |% _5 h          )4 q7 m4 U1 N# L
          ((= lt-idx 1)2 N7 t7 [1 S) V2 Z  _* r) d
            (set_tile "t_ltype" "BYBLOCK"): X  W2 E# A' q" [
            "BYBLOCK"
1 Q' ^$ M8 ]; |% Z; y) O          ), l( y, P4 I) o2 ?( V/ v! R- l
          (T  (set_tile "t_ltype" ltname) ltname), @% h& z3 Z& D
        )9 {/ g3 L1 i9 j3 d8 ]) s
        eltype* r* h3 d; x" R9 }) N
      )- R0 C- a( P% N) ^; o* Q' }
     )
7 u0 M4 }, H0 L5 |- x" E. |& k1 L     eltype5 }, v+ ^4 p5 T3 O- T' y
    )
- ~" l3 r6 O' T# q1 v4 O8 x7 [  )
$ ~: U8 ]# L; r  ;;8 W1 v' S4 p. F* J3 J* l; G  K( A
  ;; Edit box entries end up here
* |2 t: q+ w- E2 L- u$ @  (defun ltedit_act (ltvalue), s+ d6 T  t( L- a! f/ y$ R
    (setq ltvalue (xstrcase ltvalue))* Q# N) A1 ]6 b( [8 U# S8 y' u
    (if (or (= ltvalue "BYLAYER")
9 F6 Z0 a( L0 t# K% {            (= ltvalue "BY LAYER"))
# L+ {5 \! P+ O$ K# L" a4 L4 o      (setq ltvalue "BYLAYER")6 B+ `4 _3 j. q: X
    )* k$ f3 w* ~0 j: g! G; ~
    (if (or (= ltvalue "BYBLOCK")
: h3 ?# {- T5 [) ~7 O4 j& C            (= ltvalue "BY BLOCK"))6 h  {5 w1 i/ W( C0 [' `" a0 Q
      (setq ltvalue "BYBLOCK")2 t0 C5 K0 L. h
    ). A! Y5 ?$ n* }
    (if (setq lt-idx (getindex ltvalue ltnmlst))- ^8 K# ]2 i( S" `" Y  _
      (progn
5 g9 H3 L0 Y+ a/ C- r        (set_tile "error" "")% C4 S4 [  ^( s& I; w
        (ltlist_act (itoa lt-idx))) p3 H; L5 e! J. g7 R
      )( f% R2 g5 f3 m2 M
      (progn1 B5 W& @( W! G
        (set_tile "error" "Invalid linetype.")0 }' r( N- l8 y* l/ r, [  [
        (setq lt-idx old-idx)
* V: X) h3 A5 A) p/ J; M% u: b. M0 w;;        (mode_tile "edit_lt" 2)" D! }  ?+ l1 f# C
;;        (mode_tile "edit_lt" 3)7 W8 q3 G# M7 D
      )
1 v6 D& [# E- W8 [5 A: ?: M    )
/ g" g& u! P3 Q) |3 B9 F: E  ). Y7 u6 c8 }5 b' N' s6 L, Y' [
  ;;. }7 j5 i  l  X- H" {. N
  ;; List selections end up here.  Update the list box, edit box, and color
$ j( I. O; H6 M6 Y  ;; tile.
. c+ m1 h1 Q6 I5 E* J, ~  ;;' Q8 f8 q( _1 e: L" |
  (defun ltlist_act (index / dashdata)9 }  s4 R0 p$ b! _2 O
    (set_tile "error" "")
9 I* Q  @$ J% d2 s    (setq lt-idx (atoi index))
9 N" D6 }0 \, O$ X! T) l& N    (setq ltname (nth lt-idx ltnmlst))
3 d4 `5 A8 l. _) g    (setq dashdata (nth lt-idx mdashlist))
) m; n  P2 p% Q" H: r) T) O    (col_tile "show_image" 0 dashdata)
3 X* P: `( a/ b$ b" ~" B    (set_tile "list_lt" (itoa lt-idx))
7 q3 q3 R' ?/ L2 e    (set_tile "edit_lt" ltname)5 y! S1 M7 [) r8 v* n
  )0 ^4 m* O! z) M0 D& {! e
  ;;4 q- B" r8 t* G, U
  ;; Reset to original linetype when cancel it selected
9 x& X7 \# h/ Y8 u: U  ;;/ Y/ C* _# \2 N4 J) Z
  (defun reset_lt ()
8 n4 [& h; Q" ?5 ~9 _' H    (setq lt-idx old-idx)$ m* V  }& K. n+ ^$ }
    (done_dialog 0)' E, N7 D( [3 a8 G. P" _  G% y6 N0 k
  )2 z' L: f) H* c+ {5 n
  ;;
0 Y9 L8 H6 r, y/ L2 Y' M# @: T/ S  ;; This function pops a dialogue box consisting of a list box,image tile, and- a2 K6 @/ I8 ~! ]+ g+ g) n  K
  ;; edit box to allow the user to select or type a layer name.  It returns the
" q1 {* J3 n* {" w' C6 s' {' g  ;; layer name selected.  It also has a button to find the status (On, Off,9 B; Z" p" g# `: W3 k
  ;; Frozen, etc.) of any layer selected.+ N9 p8 Y. ]8 U5 l
  ;;
+ u0 `" v* o& ~0 ]" O, E' Y  (defun getlayer (/ old-idx layname on off frozth linetype)
/ Q! F9 j. B0 f; m7 q    ;; Create layer list the first time the layer+ n9 b: ^4 i# K/ N' Q9 S: D( x
    ;; dialogue is called.  S, _" x9 V6 r# V$ [
    (if (not lay-idx)
1 ~1 _& \# R* D6 @! Y& w      (progn
4 n4 F( ^2 k" _. A        (make_lay_lists)
5 r% q6 y$ }. @        (setq lay-idx (getindex elayer laynmlst))% L, W# l: ?# @' n# H* V
      )
' ~; A7 H, _- }" I/ ~6 C6 n4 F    )7 \3 o. y; F2 a7 Z0 K: x
* u" g+ t. ]  Z9 r* v7 n) |1 C
    (if (= (get_tile "error") "")
* M: X7 [0 X7 f) e0 X& L' @2 x4 H, k     (progn
/ O; v, Q" u+ v, J3 o- Z9 I2 q      (if (not (new_dialog "setlayer" dcl_id)) (exit)). d" a5 K2 w. R3 c$ {/ o2 M; X0 k
      (set_tile "cur_layer" (getvar "clayer"))
: j# C+ ]) o2 f      (start_list "list_lay")% n, S1 ?0 n- b7 W
      (mapcar 'add_list laynmlst)  ; initialize list box
/ f5 [7 E1 X( B0 Q$ S0 e; k      (end_list)
) S3 ~: J' ^' h( J) u9 F) \      (setq old-idx lay-idx)* m$ C5 d. B% j, s0 Q) X
      (laylist_act (itoa lay-idx))- o2 A3 V! X" U: u/ p
      (action_tile "list_lay" "(laylist_act $value)")
9 g* B: N+ S, d2 n# G+ ^      (action_tile "edit_lay" "(layedit_act $value)")
% R4 ]2 k/ ~( Q8 O/ ~1 V' R! ~      (action_tile "accept" "(test_ok)")
) V$ ?) Z' U  F. ], Z  U      (action_tile "cancel" "(reset_lay)")" z9 g7 e+ v1 |2 l# p
      (if (= (start_dialog) 1) ; User pressed OK4 U% c' J; a: q3 z: C
        (progn
- ^* C; L6 f. k% V          (set_tile "t_layer" layname)& b! X# n% s4 M8 l# l
          (setq elayer layname)
: t* I! [2 ]& e* t8 G" V! m          ;; If layer equals bylayer reset color tile
2 x/ Z  s: G; {  d0 _          (if (= ecolor 256)
/ v+ U: R) x5 M$ H+ e/ p            (col_tile "show_image" (bylayer_col) nil)
1 c2 V  E: `0 M: s2 K& |2 H4 l- U          )+ I0 c: f+ [+ e* y+ C  q9 u. e
          layname  D9 \- |, e6 q9 a5 b- w
        )6 P6 O. ?9 `' c4 H: s- l
        elayer* X0 Q4 w- ~) g7 e! a6 V6 K
      )# x! l! U- G/ c/ A* S) ]
     )
. B6 |. T4 k9 R( I3 A" r8 A     elayer) N+ R# x/ ]  c* A8 W8 w
    )
! U" ^  l0 C8 V) k& Q  )% @6 k9 I0 ?3 G
  ;;7 j6 }9 ?! o! c/ Z8 s
  ;; Edit box selections end up here.  Convert layer entry to upper case.  If
4 a% Q) }/ e( C) U0 @2 S( a  ;; layer name is valid, clear error string, call (laylist_act) function.9 |/ N3 h9 W  X! u/ s
  ;; Else print error message.
# D& @% W: c% [3 T5 J$ n0 ]  ;;' r; z7 D9 a& x* @) s$ _
  (defun layedit_act (layvalue). B! `' `$ D5 H* V% ]1 ~) C
    (setq layvalue (xstrcase layvalue))( s3 Q* y- B! F) x8 @
    (if (setq lay-idx (getindex layvalue laynmlst))
$ Z* U8 V+ F& V# e. O      (progn1 h7 Q. `0 h8 I; e& v
        (set_tile "error" "")" g0 _# u( Y" R. W8 B
        (laylist_act (itoa lay-idx))2 m% E. N' x# }: N
      )
9 q. B( L& v% G9 [. I7 c  O      (progn# U7 \' ~! [, H5 H) z$ O& h
        (set_tile "error" "Invalid layer name.")6 G2 _! n+ \( g0 _
;;        (mode_tile "edit_lay" 2)
0 y' j! B& m" Q; T;;        (mode_tile "edit_lay" 3)
# c- Y, b) l, m        (setq lay-idx old-idx)
2 k6 e5 ]% E2 _0 n* w7 Z" I% e  k; P      )
7 [1 c$ _9 U3 ^9 H6 V& @    )
- N4 k, Q7 C  N/ |# B& _  )
- M& s2 ^4 h4 y6 U" F  ;;
) R2 W+ }6 @/ u! k  ;; List entry selections end up here.. m5 k9 k7 r" e- o
  ;;
/ w( y8 d' z9 w  (defun laylist_act (index / layinfo color dashdata)( h6 Q) R" ~5 u* V' ]8 m
    ;; Update the list box, edit box, and color tile.
/ _0 ~; J3 G! w8 H) s    (set_tile "error" "")4 u% n( l0 Y7 C) [5 s6 U
    (setq lay-idx (atoi index))
  o& T3 `3 t- Q) i    (setq layname (nth lay-idx laynmlst))) ?( V  [0 f- I& [
    (setq layinfo (tblsearch "layer" layname))
  o$ ]3 x! W" ?) S    (setq color (cdr (assoc 62 layinfo)))( t: A8 u- g8 y. w. [# {; R$ E7 t
    (setq color (abs color))# o% I! e! T6 h/ k$ s4 j& i
    (setq colname (colorname color))
; M/ j! n- g; b- k. \    (set_tile "list_lay" (itoa lay-idx))
2 X% J1 |6 U1 {6 a3 D1 u    (set_tile "edit_lay" layname)
7 ]$ S' Z! A9 f& u  )
+ f; K- N2 W- K% D+ V9 {( @$ z" J( S  ;;
. s" N# N4 u, `4 T! M& x' d  ;; Reset to original layer when cancel is selected.
# t+ w$ s5 b! g- k! x' K4 N" _3 I5 `  ;;5 w; P  s- k) P) f" D# L) R; Y! o7 O
  (defun reset_lay ()
3 t. W0 _# p1 Y  H8 P! o) u    (setq lay-idx old-idx)
, N0 M4 g2 W/ x- m% ]* d    (done_dialog 0)
" O. u4 e! s+ w: B' [  )' L# b2 S" a0 L# U- F' A" Q4 G( j
  ;;
# O: X! y" C. c' e' y  ;; Checks validity of thickness from edit box.
2 p& a/ _* c" w# W, {; J6 a9 I; v  (defun getthickness (value)
! h) D) g7 {9 h$ v# M' e    (setq ethickness (verify_d "eb_thickness" value ethickness))4 y: B( I2 f6 p& k1 N+ l/ J
  )
: x" o. U! x' T: g6 e  ;;: V0 [- P% p  k2 ^7 q1 a' Y
  ;; Copy of (getthickness) for ltscale.  If more, make this function
& |# H+ y. O7 j) B& u) H  ;; generic." a2 U2 D; ~# P! c) y! r5 }: a+ K
  (defun getltscale (value)
* H, d1 i0 z0 x  ^    (setq eltscale (verify_d "eb_ltscale" value eltscale))8 n$ W5 J/ S1 s( e) |
  )
( F' e! J1 v) c- w6 M  ;;0 @% j+ R7 v% b: W! S) z
  ;; This function makes a list called laynmlst which consists of all the layer
5 a. Z- ^3 Y2 W0 L- X  B  ;; names in the drawing.  It also creates a list called longlist which4 i6 j9 y& ^' x5 E; ^
  ;; consists of strings which contain the layer name, color, linetype, etc.
4 ?9 O) S, R$ y1 i  ;; Longlist is later mapped into the layer listbox.  Both are ordered the
7 P# ~5 P- b6 c* S! |  ;; same.
6 K2 N0 q6 X$ S1 |0 Y) `  ;;+ Q: M$ ]0 }7 n' b( G$ D9 B1 m! y7 v
  (defun make_lay_lists (/ layname sortlist name templist layer_number)8 {" r9 R& e, F, ^0 A9 x& N
    (setq sortlist nil)
- Z, M+ `' T: z9 ?, N; |# s4 C- G    (setq templist (tblnext "LAYER" T))
$ s! y/ T3 ^# j% a' y    (setq layer_number 1)
; S/ {- Y4 G: b' j7 U8 {+ }: Q5 X& Z$ Z    (while templist) f8 i& d4 f* E$ Y
      ;; No xref dependent layers, please.
  W$ R9 i1 I2 v& e3 l3 h          (if (/= (logand 16 (cdr (assoc 70 templist))) 16)8 y, }3 X- b% d; V
            (progn
! H9 ^$ S' m- `/ X              (setq name (cdr (assoc 2 templist)))
  T  B/ K) w8 A          (setq sortlist (cons name sortlist))
6 b8 q2 O1 y) H9 v0 z* N        )8 ?' O  \* M6 d2 Y4 ]
          )
4 R: n! T! `5 L/ m- G. G9 g$ h' D          ; Get the next layer.: t2 J- g( Z3 y. _1 d: u+ P
      (setq templist (tblnext "LAYER"))
# l- z. S  {4 O/ y& H      ;; Not dead message...
6 X- n. h4 ~- u- f: k      (if (= (/ layer_number 50.0) (fix (/ layer_number 50.0)))9 k0 C. ]" D) H% F( u4 W
        (set_tile "error" (strcat "Collecting..." (itoa layer_number)))6 |4 x  C: r4 p  D
      )
7 w2 K) ^  v2 w. K  |      (setq layer_number (1+ layer_number)), O, S3 ]7 D* u9 K
    )9 K- L- S! }5 p6 T& Z
    (set_tile "error" "")
/ w7 V* P! Z5 Y6 P, W& |+ }    (if (>= (getvar "maxsort") (length sortlist)); O) N, O( |. N. C. v: {( }
      (progn
  L  H+ S# q' G2 ]5 e& F        (if (> layer_number 50)
, U% g4 J* I, ?, c          (set_tile "error" "Sorting...")& w/ I( s3 E7 B; M6 M/ m0 N- W
        )& O7 e' d! }5 b& E1 H2 @# ]1 O
        (setq sortlist (acad_strlsort sortlist))
$ `9 V2 ?3 O8 n1 G$ @! K6 R8 f, e      )
- N- l% k" r6 ]7 f      (setq sortlist (reverse sortlist))
8 w0 p' m( S9 i    )! L! p% i6 t* L8 P- t# i! w" n
    (set_tile "error" "")  }6 j+ R4 m0 g) X4 Y/ w. W
    (setq laynmlst sortlist)
4 x8 p$ W, i9 U% x. K  )
# a! _: B2 Y! L0 k5 g' N  ;;3 Q, Z5 u; Z3 a: q2 Z0 x: Y' [
  ;; This function makes 2 list - ltnmlst & mdashlist.  I6 _3 B  f, k& l
  ;; Ltnmlst is a list of linetype names read from the symbol table.  Mdashlist, R4 s# W4 f# H6 B# [+ Q; @6 f/ q/ c
  ;; is list consisting of lists which define the linetype pattern - numbers- B; Q  m  p6 c' j9 J) ?  e
  ;; that indicate dots, dashes, and spaces taken from group code 49.  The list
/ m" x! M) V5 r  ;; corresponds to the order of names in ltnmlst.
- b$ G. p0 \! `* z$ J" v4 q" _/ _  ;;
$ G: ~: P& m' h& i& l; O  (defun make_lt_lists (/ ltlist ltname)
$ q- Z9 ~( J8 S7 W) z) U    (setq mdashlist nil)" F7 A5 q7 M8 Q$ }
        (setq sortlist nil)- u% h4 j0 u4 i
        (setq ltype_number 1)
) a9 E6 ]  c) e$ g, O    (setq ltlist (tblnext "LTYPE" T))
8 [0 Z, R+ X$ j- m    ;;(setq ltname (cdr (assoc 2 ltlist)))
- V7 I1 N3 i  M' F1 x    ;;(setq ltnmlst (list ltname))) A  F1 B; W1 X' A$ [
    (while ltlist
  s; w7 F0 _2 `# ^% ]          ;; No xref dependent linetypes, please.
5 E- p" q/ x: o0 `$ w          (if (/= (logand 16 (cdr (assoc 70 ltlist))) 16); _' m9 V# ^* d" J0 A  B
            (progn- S: |: U$ P8 |( B9 `% l6 y+ ^
          (setq ltname (cdr (assoc 2 ltlist)))
) u4 U# P/ L. f% {0 \          (setq sortlist (cons ltname sortlist))
' l; q1 |. V# e1 m) X            )- O$ U! }* g1 u) ~5 s9 j0 f" N
          )+ }( J. a5 \6 v1 h  e
          ;; Get the next linetype.+ ~5 u7 r; f' U8 `5 W9 d5 R
          (setq ltlist (tblnext "LTYPE"))
" M' i4 F+ i/ g9 L
, w( S5 e5 ]5 H! h) P- k$ F          ;; Not dead message...
2 P% p$ d; q6 s      (if (= (/ ltype_number 50.0) (fix (/ ltype_number 50.0)))% X/ d9 n: s4 C8 Q4 k3 e% x
        (set_tile "error" (strcat "Collecting..." (itoa ltype_number)))
* r6 c' N+ S. E0 M9 }- V      )! E5 ^9 J2 v. H. ]2 C0 A
      (setq ltype_number (1+ ltype_number))
9 Q$ g' J1 u* v1 n: [0 B6 s3 F& [7 b0 f+ Y- |$ i1 q) M# e+ o
    )
9 Z: N9 B" C- E
2 L/ G& }% ]) l- E- ?        ;; Remove Collecting message.
  V7 ~* i/ N9 D8 }        (set_tile "error" "")
+ J6 R+ |! `( m- s9 b- V1 O" n# U8 p0 A* V2 a. i
    ;; Sort based on maxsort.4 V2 d$ M/ x& A2 w2 m- m
        (if (>= (getvar "maxsort") (length sortlist))* j1 s0 d$ M% G7 S" @$ x+ g
      (progn7 u( k, y; m! u- [
        (if (> ltype_number 50)
5 [) e( U7 A4 `! Q          (set_tile "error" "Sorting...")0 }6 A6 a% R1 k' n5 v( O4 Q" e' w
        )/ X) \  Z& O! S6 R# w/ n$ T  L
        (setq sortlist (acad_strlsort sortlist))0 b5 i6 i8 Z  }1 D. g7 l/ d, \
      )
- I. l! x0 A8 @      (setq sortlist (reverse sortlist))
5 x; \" P# {9 J: d    )
; e) h) [, |! \. R* \. f' J    (set_tile "error" "")3 r) B+ Z/ h% |* Y
    (setq ltnmlst sortlist)& h1 _; V6 w0 t# C- p  X
7 `  Y, s8 _  ~8 i& j$ }
    (foreach ltname ltnmlst
8 T+ ~$ x" o3 H      (setq ltlist (tblsearch "LTYPE" ltname))
9 R1 w6 C2 N) K2 x      (if (= ltname "CONTINUOUS")- _& }. e* D# y) S% K
        (setq mdashlist (append mdashlist (list "CONT")))
/ n; \! d" ?$ n* q        (setq mdashlist
2 J4 H& r. l1 f) y            (append mdashlist (list (add_mdash ltlist)))
( s1 ~9 U+ E' v1 ]+ l# `# a        )6 [. a- N* {; D: L) z3 r# ]
      )6 K- B/ s% [0 b3 l% |" [
    )
$ c- x$ D& h, B) I* X9 H4 k    (setq ltnmlst (cons "BYBLOCK" ltnmlst)); Z6 D1 ^0 I8 i
    (setq mdashlist  (cons nil mdashlist))7 `+ u/ O7 T: Z
    (setq ltnmlst (cons "BYLAYER" ltnmlst))
. m, `  ~( M/ ]    (setq mdashlist  (cons nil mdashlist))
& a6 W8 [! ?2 ?2 C- w  )  ?5 b+ F, g) n; R) {, B. C9 q
  ;;9 B! n/ ^/ U! @+ _9 `" \
  ;; Get all the group code 49 values for a linetype and put them in a list
, P/ Q, q* ?( ^; x$ M2 z  ;; (pen-up, pen-down info).
3 X6 z# m9 E) `0 X* D! Y5 ~; D  ;;$ Q% M4 ~$ d9 |3 F
  (defun add_mdash (ltlist1 / dashlist assoclist dashsize)( o6 q+ {+ A4 r. l4 O2 z7 x& v
    (setq dashlist nil)
, }& |- n) a. K# _    (while (setq assoclist (car ltlist1))
" y1 a. o9 u3 u! n      (if (= (car assoclist) 49)
  T0 P6 m* r1 w* z( M6 S! G) d# R        (progn- o- F+ n; i, `; l- ?
          (setq dashsize (cdr assoclist))
$ ?+ ]- O4 Y( @          (setq dashlist (cons dashsize dashlist)), j. ?. P/ d+ j7 g/ v
        )
2 M" g) K2 R% I& ?      )
' h4 Z4 S, [) f- v: P      (setq ltlist1 (cdr ltlist1))
: F' l8 o* C7 F" t( R$ Q    )* e0 Z5 K/ g* X+ R( t/ y" O
    (setq dashlist (reverse dashlist))
' u/ F0 y, R& O4 {' ^  )" W: U2 T( S) w
  ;;7 i- M! n; o: R2 J  x
  ;; Color a tile, draw linetype, and draw a border around it
9 {5 R0 Q/ F' t( ]  @4 R5 J  ;;
" K% ~% `. K/ d" f& W  (defun col_tile (tile color patlist / x y)7 s" i9 E0 d5 k
    (setq x (dimx_tile tile))- \7 j$ S' L9 d4 H4 Y8 p0 p
    (setq y (dimy_tile tile))( L5 {: _& ~2 F9 v( [
    (start_image tile)7 ~2 d6 G% h! Z0 ]  _* v' D% g
    (fill_image 0 0 x y color)! P( W1 ~3 @3 P; f$ d
    (if (= color 7)
# z) P( ~, Y- d' ^5 x, b( |5 ~) W      (progn" |1 l. N, c4 a3 e# M/ ]$ D( B/ Y
        (if patlist (drawpattern x (/ y 2) patlist 0))
; h4 D1 G3 I3 d2 Y4 q& l! O5 \1 A        (tile_rect 0 0 x y 0)1 Y# |! k% B  Y2 o9 j: N$ y2 i
      )9 q; m3 n1 F0 |: z, ?& b2 V
      (progn3 W/ r& t$ O1 Z$ v. X# i
        (if patlist (drawpattern x (/ y 2) patlist 7))& s8 F6 @1 ^1 M9 o& Y" u
        (tile_rect 0 0 x y 7)
9 B0 M3 f; W  i/ ?& X& l# [      )
( F" J/ a, P/ C% X) f    )
+ I- v# D' q9 b5 `& O4 I' u    (end_image). ?/ a/ B! G2 i2 @" w: _
  )
/ u% v; O& U9 ?  ;;6 i) t  F5 h( t: ~
  ;; Draw a border around a tile
5 I9 i9 d, b7 E  ;;, L2 `2 [5 j1 p5 V
  (defun tile_rect (x1 y1 x2 y2 color)
- {) k+ u. X7 r( G1 ?    (setq x2 (- x2 1))/ G4 g7 f# h# X
    (setq y2 (- y2 1))/ Y* k0 F8 g9 L5 b) N
    (vector_image x1 y1 x2 y1 color)# X% z' u! H2 }2 `( p
    (vector_image x2 y1 x2 y2 color)8 i# e% J( u  Y
    (vector_image x2 y2 x1 y2 color)$ D2 i1 {+ Z7 b3 u4 T4 r4 L3 ]/ H* B
    (vector_image x1 y2 x1 y1 color)
1 O( \) C  ]! k  )2 s. x, A- \# T- j  J* \0 i8 _
  ;;2 g# f6 v9 g0 [& R; S3 ^; L# a
  ;; Draw the linetype pattern in a tile.  Boxlength is the length of the image
: A( R1 t% f7 N4 H- i  ;; tile, y2 is the midpoint of the height of the image tile, pattern is a8 c% W% R$ p- c$ m% Y* ]# \
  ;; list of numbers that define the linetype, and color is the color of the% j( O" j/ Z8 I, p" P/ j
  ;; tile.
, n! L: N5 ], W) @) D/ i9 L, L+ i  ;;
6 h" m& C2 [+ ]" h9 C8 \  (defun drawpattern (boxlength y2 pattern color / x1 x2
  n4 O) f& _* e+ v5 ]                      patlist dash)' [4 V& r2 N( P& l( M" Q
    (setq x1 0 x2 0)
6 u1 H; D. ~) V9 y    (setq patlist pattern)
6 i  t8 N& h2 [9 E, y    (setq fx 30)3 Z- V' Y' }0 b
    (if (= patlist "CONT")! U# X% J0 H# c6 R
      (progn (setq dash boxlength)! u: W' m! C" {1 w) S
        (vi)
" J; L% n, S( R! g: {0 r! G4 x        (setq x1 boxlength)9 Y7 c0 ?3 s1 i) Q) Z+ w5 W: K
      )
" U2 a3 C! [+ a" L+ m      (foreach dash patlist9 y6 I1 O0 H# A' v2 W
        (if (> (abs dash) 2.5)
0 }- u; v( u( y" m$ p# Z          (setq fx 2)- L- V  P2 ]# x0 Y/ t! k7 B# D$ ]
        )
5 ~( I5 `+ d, J) q& V      )
; C! G9 T/ x! u/ Z. ^    )
. v5 C5 K" S# B+ A0 z& ?    (while (< x1 boxlength)
5 a4 @4 q) _$ K! H) V/ w. R      (if (setq dash (car patlist))
# G- g& X1 ]3 M, s        (progn
+ O7 W' ~1 d% e5 S# n7 |          (setq dash (fix (* fx dash)))3 R( B7 x& Z$ {/ w1 Y: E( ~
          (cond
2 {( y# }" ]$ l: x/ p$ l/ }. ~: L- l            ((= dash 0) (setq dash 1) (vi))
+ R! i2 W6 n2 Z0 X8 m/ ~* J, B            ((> dash 0) (vi))
  ]* y9 g$ M) y% c/ o  U: Q" \            (T5 a7 z/ W- q* P7 b; f$ E' }
              (if (< (abs dash) 2)9 _( \! i5 B" {
               (setq dash 2), G; `  a4 b- n: y  K, g2 l% M% V
              )7 f& v7 z. o2 o1 o
              (setq x2 (+ x2 (abs dash)))" o( F  z) N) @# Q: `! k; R
            )
; }4 i3 C( B  v1 F) z. S          )( ~8 W: d0 W+ X1 G' g
          (setq patlist (cdr patlist))
7 E: ^7 z& _! n          (setq x1 x2)
# s0 b. S# e+ v& B0 U        )
. p2 k( `+ B/ i; G3 ~        (setq patlist pattern)
: V8 v- y) g3 l& C' d      )1 a  J9 T' X, G+ U
    )
" s. B7 S1 h5 c" b  )
* l2 a, o' ?$ @+ B  ;;9 ]1 p4 k3 v; ]$ G8 i% E
  ;; Determain state of xclip" M2 R: a2 Z5 L6 l4 q" j2 i3 z
  ;; Returns the group 71 value of the spacial filter dictionary.
5 ]7 v8 a3 N3 P2 B' w9 ~# X- n  ;; If the entity doesn't have a spacial filter dictionary, this) ?& \; J! A0 w; x0 R6 l
  ;; returns 0. If it does it will return 0 or 1 depending on the) E9 _8 l/ X+ M$ S& P( Q
  ;; current setting of the state of the clipping visibility.% d. `6 p) W, m+ i* E& x! h. {
  ;;
9 A+ `, b* D4 @6 n: H  (defun xclipon(elist)& ~( ^" a" [$ c4 x! E+ K# Y
    (setq hasclip T)
* J0 a  |' I  C* N, e! r    (if (/= (assoc 360 elist) nil)
$ f; g5 @2 F/ u  t      (progn
0 w9 X! g0 U5 _        (setq tmp (entget(cdr(assoc 360 elist))))5 D& ^- x; s" t, r
        (if (/= nil (assoc 360 tmp))
$ T9 x; l' F# v3 I8 d          (progn) k; _0 G" t3 M' I% C
            (setq tmp (entget(cdr(assoc 360 tmp))))( j) A1 b$ k7 y( {, k7 s+ s2 B: J0 q
            (if (/= nil (assoc 360 tmp))
+ E6 [# I) {" ~1 P) E. Q              (progn) ^7 \8 u2 D0 q2 ~
                (setq tmp (entget(cdr(assoc 360 tmp))))
7 `: H2 V3 ?  a( w                (if (/= nil (assoc 71 tmp))
2 _; \% N( n7 E" f                  (cdr(assoc 71 tmp))
% r2 n: y+ D9 E; ]% @: f  J6 ^2 H                                  (progn " l+ [; f6 S# L# a* [: ]. S
                                        (setq hasclip nil)
5 z- ]8 Y+ x2 L( w, z2 Y                                        (eval 0)
& {" l( ^: M: Y* l5 M3 ?                                  ), ?# }$ J8 ]/ {
                )
0 Z2 A/ ^. t8 J$ B8 j# k              )$ b1 T1 t  R6 W" [- N7 Q( n( m
                          (progn 6 v% C: {1 c* l6 z+ E% n
                                (setq hasclip nil)
1 G2 }) K2 J( G+ ?+ S0 M                                (eval 0)0 F5 S/ T* n  w# D+ J+ `
                          )
" ]6 k8 [% o0 d- \4 Z            )
3 F* R" l5 q$ N3 t          )6 V5 X; E) P8 Y* R5 E
                  (progn ! t* A* y( u; B. v- d
                        (setq hasclip nil)
& E3 i' X9 }6 D7 j                        (eval 0)
1 x/ w. Z0 k# [' r/ i- l7 \                  )% g8 w. Y# o% B* D, P
        )
: I! m$ f" v  w6 w. x5 k/ Q      )3 W# m3 s$ \; D) [+ E7 B" \' P3 y
          (progn
* L' G' y2 J% I# Y8 l9 M3 H  `                (setq hasclip nil)
$ `4 i- J# G. y' N. ^5 j/ D3 C                (eval 0)
9 v1 m$ H1 e# E! x          )
5 J3 c- ?' ^1 b) L  e4 ^  S    )
+ c. ?% ~/ j' q/ k4 i. e  )3 D& H( z( g" O9 A$ |# d3 Z2 f
  ;;/ Y, ]9 C9 b1 t5 u; I0 K( [
  ;; Draw a dash or dot in image tile. J* F% Z- _8 o+ e& n. O2 M
  ;;
4 t; b) \2 e% h! [8 p  I# }" d  (defun vi ()
" V9 g8 \& M9 y+ Y; V    (setq x2 (+ x2 dash))
% ^3 Q7 u; \( M0 s/ [# d1 _    (vector_image x1 y2 x2 y2 color)
$ y' N- ]" l$ Q  )/ Q0 `; m; c: z
  ;;
0 L4 _* q3 b( K( Y- n  ;; If an item is a member of the list, then return its index number, else
  \5 B6 F, p; [! H/ f! m  h7 R  ;; return nil.
: m+ y9 p8 _7 d: @7 a/ r  ;;
7 c- l$ S% ?" J8 O6 D- S  (defun getindex (item itemlist / m n)
( k+ E1 J2 O" Y2 r' M" ~3 k    (setq n (length itemlist))
( r6 l# H5 n3 l+ U/ Z  z5 \- X    (if (> (setq m (length (member item itemlist))) 0)
, Y7 _9 l2 @9 X  o! d      (- n m)
! P+ k! i5 d- F! c+ M* O9 B8 p' h* F      nil
" ~0 m8 c0 [$ s, [& c    )
6 M4 |7 N7 d. I! V8 o. }" p  ): |% U. M6 I5 b- l9 A  p% ~# K% E8 ]
  ;;7 o0 R1 e! x3 A0 U* H# _6 M# Z
  ;; This function is called if the linetype is set "BYLAYER". It finds the3 b% d; l9 {* n0 L% O, B! r  ?
  ;; ltype of the layer so it can be displayed  beside the linetype button.
, t, s  K3 f4 n* q, Z$ n  ;;
# o( n- y) a- J. T' [* b1 `  (defun bylayer_lt (/ layname layinfo ltype)  O& V1 P- B: o; m1 e& X/ Z7 u/ F
    (if lay-idx. y# F1 d7 m6 z1 Q
      (progn- K' h6 T4 S! N/ w2 `/ J6 {& d! s
        (setq layname (nth lay-idx laynmlst))( q* S8 b' o! p: K* {" }
        (setq layinfo (tblsearch "layer" layname))2 I  Q7 T$ A/ o. S9 L
        (setq ltype (cdr (assoc 6 layinfo)))7 j$ N9 x* i+ q6 C
        "BYLAYER": }" a+ r0 {1 _
      )9 x2 \# U2 X, v' H) N& e7 i
      "BYLAYER"
/ b  V( M% z- }9 D& O; P! y    )
! l: K* G" h1 U% Q$ b8 F  )# p% t( M; w; K
  ;;: @- R3 V$ t7 b( e9 w$ B* p0 Q) X
  ;; This function is called if the color is set "BYLAYER".  It finds the color
  t+ _' W# G8 k+ m5 l3 g5 A2 p  ;; of the layer so it can be displayed beside the color button.6 R# J! b9 x; Y4 n
  ;;
/ W; Q4 {6 A( ]- S  (defun bylayer_col (/ layname layinfo color)$ s" ~4 J' m. u4 m/ x) `$ P" j% W5 U
    (setq layinfo (tblsearch "layer" elayer))9 K, n% v) E8 s- c" ]
    (setq color (abs (cdr (assoc 62 layinfo))))
$ `( \0 V7 Z# D4 \8 d  )
8 e% \7 T# P' N% P2 N  ;;
8 e: P' I& v. U. Y6 Q1 r: S  ;; Used to set the color name in layer subdialogue.
5 A7 y1 F9 n. R! g" \8 V3 Z6 {  ;;5 X2 N0 a7 \: u) V8 ^; q* {  F
  (defun colorname (colnum / cn)
- D, z( `; [& ^- U, q8 L+ I% V: m+ {    (setq cn (abs colnum))* a: G5 X  G9 f7 u  e& a9 @
    (cond ((= cn 1) "red")$ {8 Z: {& f; a: x8 T
          ((= cn 2) "yellow")
4 O) i. q0 b; ~  l  U, J          ((= cn 3) "green")( V: H/ b/ `3 K3 _+ ?! t# ?
          ((= cn 4) "cyan")
' I# O+ t" _9 \( o" `, `  r; |" d          ((= cn 5) "blue")
0 S- y8 n  D, S' c4 a5 t          ((= cn 6) "magenta")1 p8 i( a, c$ m& c* y0 P8 o) |
          ((= cn 7) "white")9 |! s' |0 C. _! o8 L4 q
          (T (itoa cn))5 ?5 ~0 d( I  n& _
    )) L- \7 w* n8 H$ P# Z! \
  )
% N7 c/ q. U2 {) A6 R2 h  ;;
& b5 t1 O0 u$ s  ;; If their is no error message, then close the dialogue.+ W) Z3 {4 P& X4 x
  ;;. P& x8 L' Z/ Q1 W2 s! v. |% d
  (defun dismiss_dialog (action)! G, P" T5 q; S3 a1 ^6 r0 ~( V
    (if (= action 0)
' W1 U+ q4 t* y  M" m/ _& F  R      (done_dialog 0)
3 T! i$ A; t$ z      (if (= (get_tile "error") ""), U- z1 g4 [5 y( C
        (done_dialog action)
3 Z3 r  c$ x3 l' b0 C! w6 t      )
7 l1 z* @  l, x    )
/ o" b. H6 Z& O( G* k$ j  )7 d* R: q: H3 {2 W  Z

* X+ u2 v  t! I% Z- ~1 J# l  (defun test_ok (); X. `* c, Y6 y5 |# z% t% T: ^
    (if (= (get_tile "error") "")
3 ]% ]4 C4 Q9 {+ \: ^5 {      (done_dialog 1)" m) s* \+ A5 o8 f/ Y. u/ K
    )1 U6 r8 q# q$ b/ p. w( u
  )
1 H3 y8 j) x9 J, C' L; B/ F; m, o  y
  (defun cancel ()* B; o$ E2 J( P$ ^) ~
    (done_dialog 0)
# k0 `: W4 m5 r, E0 r6 f  )
: F$ j  i5 p' x0 b% P, g7 e. W/ b2 i( {* J% u
;;; =======================================================================6 Y- d$ R# Q) r
;;; SETUP layer and linetype lists for application, and initialize all: F9 Y' |% v7 `+ c
;;; program variables.0 p9 X6 T7 l6 w. o
6 n3 U- E' f* F
  (setq elist       (entget ename)
- G8 Z5 `. u4 B$ E# o, `0 b* q  H        old-elist   elist
, A( ^5 W; _9 M+ _; n0 u        modlist     elist
9 o  h" K6 J# C- J        etype       (strcase (cdr (assoc 0 elist)))
' L. V6 ~8 ?9 r* S/ I        ecolor      (cdr (assoc 62 elist))
3 ^. o3 Z. x' o        elayer      (cdr (assoc 8 elist))
7 ?& Z: G# i8 E$ X; W/ t        eltscale    (cdr (assoc 48 elist))
% z+ P' y* u: P& _* f' {" r5 H        ethickness  (cdr (assoc 39 elist))
+ U& J+ F$ W( F) j        eltype      (cdr (assoc 6 elist))
% a$ @" u9 ]% b4 y2 j  ); }# K! K1 Y0 a* e3 T+ z% `: z1 t
  (if (= (assoc 210 elist) nil)" w- D. S! D+ [& `. j3 [9 Y
    (setq extru (list 0.0 0.0 1.0))( X& I6 h5 H7 I1 ~
    (setq extru (cdr (assoc 210 elist)))
* d. k/ S9 @8 T  )2 o( Z& C3 B9 Z$ `) y1 D

" _% e# q. K6 Z3 |+ T  (if (not ecolor) (setq ecolor 256))% Z% @" R/ o$ p9 h* y. H% d  W! i" Y
  (if (not eltype) (setq eltype "BYLAYER"))6 y3 v: s# f* [
  (if (not ethickness) (setq ethickness 0))# r* b8 H5 ?* ~0 e. X
  (if (not eltscale) (setq eltscale 1))
* H- R/ a; [  k, x7 G- R) ; end ddmodify_init6 i" L& K  F! J( l( n0 `
" }4 T  A5 Y0 K" s% {
;;; --------------------------------------------------------------------------
/ \' h, b" ?5 |;;; Function: DDMODIFY_SELECT' }, u0 n) A1 L$ S$ B
;;;
) `2 W3 H1 `" [- t;;; Object aquisition function.
8 {* ]3 B7 U4 X( m+ ~3 [& B5 L;;;
1 m. n1 z6 }5 _2 d8 n;;; (ddmodify_select)
- I# U3 W5 S, l0 @;;;4 }  {/ C: O* n. T6 J) O
;;; Obtains object to be modified, in one of three ways:9 k3 z, B0 I9 F, h: `8 x- B
;;;
- H# l9 e8 L9 ]3 d4 k;;;   1 - Autoselected.
1 F" u( Z9 D+ i1 `  U3 L3 h;;;   2 - Prompted for.
& F& I- c& B3 E;;;   3 - Passed as an argument in a call to (ddmodify <ename> )
4 x0 R8 K: u- b; s0 ]; [;;;* X: s7 @& I! ?4 t
;;; The (ddmodify_select) function also sets the value of the
2 Z7 t$ H# i& m0 Q' i! G;;; global symbol AI_SELTYPE to one of the above three values to$ c+ n1 T% A1 X! w7 v
;;; indicate the method thru which the object was aquired.
/ B2 L9 _; }8 s( k) Q4 j;;;
: Z& n0 r9 f0 {; n;;; This value can be useful to applications that want to RESTORE4 T4 t, P# H7 z( V0 g4 I% X1 c
;;; an object that was autoselected to its previous selected state3 M0 }5 N* b: P7 [2 Q8 o7 O1 |
;;; when they terminate, although there doesn't appear to be any
7 b" Y9 C. w: V- o8 T/ b# t9 Q0 Z;;; way to do this right now.
) W7 f$ |$ u" B( Z& |, M. X0 {( n2 w- {7 h* H( P# m  b
(defun ddmodify_select ()" E8 o9 l6 U# D
   (cond3 f" u5 x9 P# Q
      (  ename                             ; (ddmodify) was called
: k7 ~% w( M+ B         (cond                             ; with an <ename> argument& x, `8 `# w$ m" I0 Q
            (  (entget ename)              ;   If object is non-deleted
' e1 l; W! H9 n0 U6 l0 c0 k               (setq ai_seltype 3)         ;   then return its ename.
, h, J: \$ Y2 y  m               (ai_return ename))))
8 r$ c; s* h& i% v+ u+ k, N2 J2 P4 N, t; V& O8 n& \! ^
      ;; return auto-selected , see ai_utils.lsp
+ S. T% l( t/ ^0 h6 R1 p: }      (  (ai_autossget1 "\nSelect one object to modify: "))3 M8 W6 F3 ?' v  s) F
) V" H0 n) S4 c: b
      (t (princ "\nNothing selected.")  \# R- C3 f& n5 j- S" W
         (ai_return nil))  N, R5 C3 s  `& m
   )% r3 g' D  k: P4 ?6 l- e4 V
)
. v. i7 Z' w0 D# c! d: \& b' o& x) a) }4 U, z% b- n. r
;;; ============= Command line interface function =======================3 L/ A" ~+ k" w  ]3 A: `5 f* H
" ]1 E7 D+ w& b7 j
(defun C:MMO ()
4 Q4 ]/ F5 [  e+ Y* {$ R3 z   (ddmodify nil); x4 r' o" r% Q
   (princ)7 @; t; L9 Y5 M+ N
), ]1 S# Q+ Z) ^

! A9 u7 i7 M5 Y; e;;; ================== (ddmodify) - Main program ========================; B: ?7 U0 R2 P9 s: O
;;;) i, A: r/ ^! k: ^
;;; (ddmodify <ename> )
% d: F" @5 U7 R5 y7 k8 U$ V% A;;;
2 p8 B+ w0 z6 t7 ]" z$ H# T;;; Main program function, callable as a subroutine.+ F% q% n1 e0 P
;;;
! |. h% W/ ^  U9 x: b6 j;;; <ename> = object name of the object to modify.
0 r# [, ]5 ^. K* K7 G1 g  K7 R- @;;;
2 d7 T/ K" X3 M3 Z. \$ L;;; If <ename> is nil, then user is prompted to select
' u/ r6 u( X3 {1 h; D; P0 ];;; the object interactively.
% w0 V% L4 g7 o5 ^;;;( H+ G- ~( K- H% l$ [  D  f1 D1 K
;;; Before (ddmodify) can be called as a subroutine, it must* u+ u7 }# l* F6 N
;;; be loaded first.  It is up to the calling application to
( k: R# V/ I& a9 w& n# t8 k;;; first determine this, and load it if necessary.
2 }* {: D6 q5 b" p! f$ a
2 e( S( [9 |+ U4 h% d* S9 o2 g
& D, m1 O& @; \' d5 @7 t(defun ddmodify (ename /4 b# P2 i9 G# S4 h
2ndpt              ell_calc_area            move_pt1               templist0 |& }1 r7 ~0 \# A* \
add_mdash          ell_tile                 n                      tempmod" W! p( g' q3 J6 ^
alipt              eltscale                 name                   tempst_ang# c5 `0 m  }7 ~9 b: j2 U% M  q
ang                eltype                   newpoint               test_ok) Q# E+ W8 l/ A7 P. F
arc_calc           emod                     next                   text
& m; z" c0 t- uarclen             end_ang                  next_vertex            th-value
9 Q, _& \/ J- d  \# Massoclist          endpt                    obl                    tile" V; T% Y: W- V0 E' b
atprompt           errchk                   off                    tile_rect6 {+ M7 ]& o' c3 a1 |
attag              ethickness               old_majrad             tilemode3 D1 i! w2 z* i, l1 C# a
attprompt          etype                    old-closed             totang
2 D3 p) Q- j+ F' l0 l/ lbit                extru                    old-closedm            tstyle
0 P+ S* c, l8 P( q4 V  o( Ybit1               fchk                     old-closedn            u/ l$ j/ J2 `1 t$ C4 P* @
bit-10             first-10-rec             old-elist              undo_init
; h5 u7 Q& @3 @9 A  \1 R4 ubit-11             first-10-time            olderr                 upsd" k' }) T9 D6 Q' N4 k9 M
bit2               first-11-rec             old-fit                v
% R% f( _, I- {- ?: Qbit3               first-11-time            old-idx                va
* {' F  K3 f6 ]! T/ _bit4               fit                      oldlist                value
7 k. ~: l' k7 O8 P/ a8 A1 cbit70              frozth                   old-spltype            ver_4% J! x8 _9 s2 B: G0 @, r
bit-70             f-vis                    old-u                  ver_ang1
; R2 D5 @5 \9 D) |  H8 Jbit75              fx                       old-v                  ver_ang2. J2 C  x1 D: ~' z. C0 b
bk-up              get_color                on                     ver_col
8 ~% c5 K9 L/ g. K; vbkwd               getcolor                 onoff                  ver_colsp
# X" W7 m5 Z' L5 ~3 j  gboxlength          getindex                 on-off                 ver_eangle
- j/ P/ \- t$ W8 y& Z! O# e, ]- Gbylayer_col        getlayer                 patlist                ver_hght
! }* ]4 M1 Y( {# ybylayer_lt         getltype                 pattern                ver_majrad
2 v9 l, z' N4 ]7 Zcalc               getthickness             pltype                 ver_obl8 v- w* O$ i) _: L
cancel             globals                  polytype               ver_pt1
5 p7 z3 B# B+ G6 W+ Ycir_calc           ha                       pre                    ver_pt23 T! i. r2 k) C5 s' l$ T) T
closed             ha-prev                  proplist               ver_pt3
3 g2 i9 B- l% Y* I9 C$ ]( uclosedm            help_entry               pt                     ver_pt4
: k" f" X0 E: k2 r  P8 qclosedn            hght                     pt1                    ver_rad$ X( A  @% _0 c9 t1 K
cmd                icvp                     pt1_eq_pt2             ver_rot8 |+ l5 D9 B' r* m
cn                 image_add_vector         pt2                    ver_row' N/ r* [, H9 h6 |; E2 p
cname              image_clean_variables    pt3                    ver_rowsp
0 t* J: ]! R: c. {) i6 `cntl-pt-indicator  image_cross_product      pt4                    ver_tag
7 O  k3 }% a) I1 H! |code_71            image_disp_opt           ptype                  ver_u5 D$ Q6 c3 ~5 ^; U( _* F- X7 s6 h
col_tile           image_dot_product        radius                 ver_v8 W/ I+ ]* ^" L( g  h
col-idx            image_normalize_vector   rational_spl_flag      ver_wid3 K3 T- S4 Y0 r1 D& v9 O
colname            image_rotate_vector      reset                  ver_x1$ m8 q" S" Q3 |0 R. s
colnmlst           image_scale              reset_flag             ver_x2
$ K% m) M+ t* c  kcolnolst           image_scale_vector       reset_lay              ver_x3
9 i" W9 y7 W2 k# zcolnum             image_update             reset_lt               ver_x4, Q2 L* e. `& x& x$ r0 [5 ~$ K  S
color              index                    reset_uv               ver_xline_pt1
2 q. [" z" X9 F0 ]9 M" G: pcolorname          inv                      rot                    ver_xline_pt2  O8 x2 `" u; T1 K+ y$ X
colorno            item                     rows                   ver_xline_x1
, z# D" D% M+ b3 j# y9 F6 G0 ecol-sp             item1                    row-sp                 ver_xline_x2
! S# x7 J9 T- scolumns            item2                    rrat                   ver_xline_y19 b: r. V" N. F* J+ g5 Z. R' k
con                itemlist                 s                      ver_xline_y2
1 g6 q0 L# f9 O" A9 lcoord              jlist                    set_action_tiles       ver_xline_z1% c: L2 f' ~3 q. c
ctr                jlist_act                set_just_idx           ver_xline_z2
; K; _3 b) M0 x0 B+ d0 r5 Wcur-10-rec         just-idx                 set_tile_bk-up         ver_xscl
# Z, z5 U# G+ u! E6 p% ?1 ecur-11-rec         layedit_act              set_tile_cntl_pt       ver_y1
7 j5 q$ [6 R2 }+ R- |: r2 acvpname            lay-idx                  set_tile_data_pt       ver_y2' I2 C5 `/ U  i" k1 V1 B+ [8 c
dash               layinfo                  set_tile_dirv          ver_y3
+ u2 R& w# G* }. jdashdata           laylist                  set_tile_edges         ver_y42 O/ l4 a1 `# k$ r5 }7 t
dashlist           laylist_act              set_tile_endang        ver_yscl8 l2 |3 Z5 K8 R" W- W$ J5 C
dashsize           layname                  set_tile_hght          ver_z1. E3 P2 k2 x/ {+ P  S$ L- [
data-pt-indicator  laynmlst                 set_tile_icvp          ver_z2
0 u4 r- n( }/ v/ idcl_id             layvalue                 set_tile_just          ver_z3
  N! {5 V2 F& _2 P0 b; ^dd3dface           line_calc                set_tile_obl           ver_zscl
! Q* G' D2 a# T$ T  s, ddd3dsolid          linetype                 set_tile_prompt        verify_a, k5 c3 c9 n! j4 U
ddarc              list1                    set_tile_props         verify_d
" `4 W3 y, u0 K+ E3 H# kddblock            longlist                 set_tile_pt1           verify_i
0 ]4 m1 Y$ ]0 e) g3 Q' qddbody             ltabstr                  set_tile_pt2           verify_xline
" R( F# z# [5 addcircle           ltedit_act               set_tile_pt3           vfy
0 V. o4 [8 b5 G* [ddellipse          ltidx                    set_tile_pt4           vi
/ s4 f/ Q4 R6 E" b# F* v1 eddgetprompt        lt-idx                   set_tile_rad           vlist
9 s+ k8 q! N9 m! r2 Iddgettext          ltlist                   set_tile_rc            vname, G9 N# A* d1 t+ |
ddimage            ltlist_act               set_tile_rot           vpf% u& Z; ?( G) p4 c
ddimen             ltlist1                  set_tile_scale         vpid
: L5 e$ x* l1 g3 A) T, S0 X% v& B0 p1 ^ddleader           ltname                   set_tile_spline_props  vpldata
. c* u2 m1 J) F4 o1 k+ B0 g# nddline             ltnmlst                  set_tile_stang         vpn
+ ?5 j/ Z: g1 Q2 C3 P5 O- ]ddlist             ltvalue                  set_tile_style         vpt
! B7 G, O0 Z# s! H! O- Fddmline            ltype                    set_tile_tag           which_tiles
# d- q, q( k5 \) L) Jddmodify_err       m                        set_tile_text          wid
0 g8 d" W2 d( N/ ~( Mddmtext            majrad                   set_tile_vpt           x
7 A! K, z* X2 {& w  s# X' r* Sddpline            make_lay_lists           set_tile_wid           x1
. \: A/ B: M. p* x9 d: O( d8 nddpoint            make_lt_lists            set_tile_xline_pt1     x2
6 y# |! ]* d+ W! Q7 Eddray              mdashlist                set_tile_xline_pt2     x3
  O+ U- c: V! g* L7 a7 addregion           minrad                   setcolor               x4) d2 w( x6 Q4 A0 E: v& g
ddshape            modify_3dface            shght                  xdlist8 q0 Z. E' m6 d6 s" F  }# |1 A) ?7 s9 E2 b! ]
ddsolid            modify_3dsolid           showpt                 xline_pt1( o9 P- f4 _0 E& ^2 [; i
ddspline           modify_arc               size                   xline_pt27 b5 x9 `1 d* q* J
ddtext             modify_block             slist                  xline_x1( [  c+ A! R; W1 e9 o7 _
ddvport            modify_body              sname                  xline_x2
: Z8 N$ \. A" g" l+ Wddxline            modify_circle            sortlist               xline_y1
+ k: {3 c8 r5 e1 m1 m2 Bdenom              modify_ellipse           spltype                xline_y2  k. m7 m2 O/ j0 q4 k0 ^
dialog-state       modify_image             ss                     xline_z1
5 p: [* L# H) T. N+ O4 w& _; Pdir_pt             modify_line              st_ang                 xline_z2
/ L/ m. M* A6 J3 adir_ptx            modify_mline             stpt                   xscale
4 L) U4 J( e7 s# Z. _dir_pty            modify_mtext             style_act              xx
6 ~9 L( _# e% B1 q/ idir_ptz            modify_point             style-idx              y
8 r9 n$ R7 y! S, K  b$ w! e0 R: qdismiss_dialog     modify_polyline          style-list             y1
4 }# I& D3 {# @8 R8 B4 rdrawpattern        modify_prop_geom         tagval                 y21 u- C, ?/ I9 G
echo               modify_properties        temp                   y3' R( {  n) ~3 F% |2 p( B
ecolor             modify_ray               temp_color             y4- ?* R8 {* ]; S0 a# i3 P. ~& ?! s
edge1              modify_region            temp_dir_x             yscale
0 N' |2 m, W" ~$ ~edge2              modify_shape             temp_dir_y             yy
" }$ h# l% Z3 W8 Uedge3              modify_solid             temp_dir_z             z1
0 Y5 g" I  e5 C% ]" E1 Nedge4              modify_spline            temp_xline_pt1         z2. v* F7 P# }5 Q# K$ `- k+ L
edgetest           modify_text              temp_xline_x1          z3! U- }0 m8 ^; l( `9 y) F
elayer             modify_vport             temp_xline_y1          z4
! ^: m2 \, M* zelist              modify_xline             temp_xline_z1          zscale+ N7 I& s$ M" O
ell_calc           modlist                  tempend_eang           zz
; ^, r7 z, o' u' ]* U8 cdir-idx            safe_ddedit              ver_MtextWidth         xcliponoff
( F2 V" Q) G* SMText_style
4 @% |( H- l6 R% p  )/ _* c: O6 T3 [2 R) o# {) M# h

' L$ j! {# z4 H: |) K4 M4 f$ f  (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho
) k! z: B' t" w4 n        old_error  *error*            ; save current error function' w. o5 C2 V' S- t. t2 E
        *error* ai_error              ; new error function
" A' b/ T( K. P3 B  )& L( i: y7 w# B( y2 k. f
" I0 Z& ?4 E  n5 z% \1 {( \
  (setq old_pickstyle (getvar "PICKSTYLE"))          ; save old pickstyle6 G, E1 b8 l4 `' N/ O) B
  (setq new_pickstyle (logand old_pickstyle (~ 1)))  ; turn off group selection
1 C( q  A! u4 g4 ]( r8 O  (setvar "pickstyle" new_pickstyle)                 ; bit and set to new value) n; F$ Y2 u) g

% K  W; C, U- d# p2 N3 Z  (setvar "cmdecho" (cond (  (or (not *debug*) (zerop *debug*)) 0)
- t  i; e* c% u- @' g7 Y                          (t 1)))
5 ?/ N4 R* E: m4 d  (cond
% d+ d8 B5 `$ `' [     (  (not (ai_notrans)))                      ; Not transparent?4 p8 V  c- Q+ _( T8 h5 ]  h; M( E
     (  (not (ai_acadapp)))                      ; ACADAPP.EXP xloaded?
9 [6 Y9 P# ]5 D- r0 I6 p8 o     (  (not (setq dcl_id (ai_dcl "ddmodify")))) ; is .DLG file loaded?
1 |0 l$ O2 d0 r2 X/ W     (  (not (setq ename (ddmodify_select))))    ; object to modify?. i$ |/ B! Y1 I, Z& j
# O6 N9 t3 X+ K& Y! q
     (t (ai_undo_push); I+ @7 i3 [  a+ _( i+ Z
        (ddmodify_init)                          ; everything okay, proceed.
1 S* ~( P, ^& `6 v0 g- ?1 M        (cond
5 S0 q8 I& b# v* p, Q* `8 Y2 `           ((= etype "LEADER")
5 E( P! z9 _) N* _8 q             (setq help_entry  "modify_Leader_dialog")
! j6 ^/ x6 Y  Z* q& G) ^! v             (ddleader)- r/ @3 `' `* t4 H! I1 O
           )
& M: a- G( F( |           ((= etype "ARC")" C- O1 M/ I4 g
             (setq help_entry  "modify_Arc_dialog")
6 D- j( Z  L7 v0 {             (ddarc)
& f1 l* g/ N& R( |8 R           )
! x7 V- ~0 U: K5 B# `/ a4 r           ((= etype "ATTDEF")- E8 J" d1 a3 D! Y. W
             (setq help_entry  "modify_Attribute_Definition_dialog")
6 ~. T1 b1 S& E5 {6 E: v0 e             (ddtext). D+ g! h1 i, h( @
           )9 |1 _: ?% k4 m9 d4 [# E
           ((= etype "CIRCLE")4 i3 G6 e: W8 T# |2 M
             (setq help_entry  "modify_Circle_dialog")
% p2 G" x; A2 ~+ G+ S' A2 a& ]             (ddcircle)
* A$ J6 C  y4 }* |' y. D) Q& ^% U1 m           )
7 @$ s( P4 g/ Q1 S4 x6 Z           ((= etype "ELLIPSE")
) N( _% @6 q) u, j8 j             (setq help_entry  "modify_Ellipse_dialog")# ]4 ]& o3 {, z0 B
             (ddellipse)
8 S/ B9 q9 R" i           )" z9 n2 D. n: d' J
           ((= etype "3DSOLID")2 S! X3 j+ b3 x, Y: M
             (setq help_entry  "modify_3d_Solid_dialog")
- Y+ m$ k3 l6 i/ ^             (dd3dsolid)
  H' I- f6 t  a           )
, f0 z/ O# q! t: W# v+ ~: T0 O/ f           ((= etype "BODY")
; [& i6 [% }! K$ b             (setq help_entry  "modify_Body_dialog")
) F0 F/ K3 |- v             (ddbody)# j3 J7 |' H3 n6 H. w
           )
% q9 m3 A$ }; e5 l, ^. Z, U           ((= etype "REGION")
/ I, N7 b$ S5 D+ ]" R             (setq help_entry  "modify_Region_dialog")
1 k* U3 t4 P1 R8 N! U! F  Y, [) U             (ddregion)& O/ ]1 V" F5 g" L# ~; m; f- b
           )
% u5 E: @2 y# _" ~. h# d, }* I           ((= etype "HATCH")* K. B; @" R$ z" \3 K- ~) K$ H
             (setq help_entry  "modify_Hatch_dialog")0 A9 f( y; [: h
             (ddnewhatch)4 o6 z: d# ]4 T& Z# Q: J
           )2 G& Y/ g" ]& U
           ((= etype "SPLINE"); E3 @" q6 z- T* A1 ?" i
             (setq help_entry  "modify_Spline_dialog")
" K* ^- H; i% X) x; z             (ddspline)
6 {5 ]7 P( k  ^           )4 w0 X( M3 U4 G  [
           ((= etype "INSERT")    ; see ddblock for help_entry
/ {5 t* W: j; A" x& c: L             (ddblock)) `  j4 \% j- J- i; q3 q
           )6 ]6 @: X+ e! I' f5 a7 R; F( b
           ((= etype "LINE")0 X7 v2 G6 {! d$ P; j
             (setq help_entry  "modify_Line_dialog")  [) M3 @+ r+ J; M
             (ddline)" p  N1 m( R) V! G) D
           )
6 G5 d8 [- m8 b. w% }5 L( s: w+ Y           ((= etype "MLINE")
2 U2 Z+ W0 F$ n5 Q! [* g/ ^# B             (setq help_entry  "modify_multiLine_dialog")
/ e) h& p) q$ @; {( ^4 s             (ddmline)
& o$ \1 p+ J: h8 `# @8 s' P6 p2 ?  x           )2 @- e5 W9 R+ b5 [2 p$ h
           ((= etype "RAY")
5 i9 {  i4 d4 h0 K             (setq help_entry  "modify_Ray_dialog")
+ `# h* o- W6 O0 X7 \6 h$ H3 g2 b             (ddxline)5 t% D7 L( W' m9 M8 J- U6 A
           )
, D$ |7 q; q/ x; ~8 Y  ^           ((= etype "XLINE")& \7 g& @2 @7 n, U. U) M1 g* H3 I
             (setq help_entry  "modify_Xline_dialog")
+ t3 z& l; a; f             (ddxline)
) J2 Y" z1 ?1 @           )8 S: c( m' [8 R+ Y4 G
           ((= etype "POINT")) I% w9 [2 c. b5 ^! ]7 ?
             (setq help_entry  "modify_Point_dialog")
0 }9 X' P9 R6 M+ d( |( J             (ddpoint)/ p% W: Q2 D. X, _. K8 y2 x4 S
           )
  D4 Z, a8 w1 {* d7 a7 w8 R           ((or (= etype "POLYLINE") (= etype "LWPOLYLINE"))8 W* ^! ]8 C5 ?1 z/ Q
             (setq help_entry  "modify_Polyline_dialog")
7 r! X! ~5 n9 g. \             ;; If a 2D pline, check to see if it is planar to the current
6 z3 A. }5 m9 k             ;; UCS, reject if not.   To see if the pline is parallel,
- p- I. U2 J* [7 K             ;; the 210 group (WCS) is added to the current UCS origin (WCS)
, j: m; g0 B$ |             ;; and then converted to the current UCS and checked to see if# V+ ?9 R0 E  L  a( ]4 ]
             ;; it is equal to (0,0,1).# ~% E1 E% j7 F- S5 V
4 ?& ]* R; Q* u4 N) l
             ;; Incase the 210 is default and not in the dxf list.: W" C+ X" I/ ?# p: i1 t! _6 E
             (if (= (assoc 210 (entget ename)) nil)' z/ D5 g- n/ z+ i1 v6 K3 P7 |
                (ddpline)1 M/ r, V5 L; G1 D  A
                (progn
. _- V  B( Q' T/ c. Z% A                    (if (and (zerop (logand 120 (cdr (assoc 70 (entget ename)))))' R2 `3 C# |0 n5 N
                            (not (equal '(0.0 0.0 1.0)4 O3 [) E: |" D  n) k6 P
                                   (trans (mapcar '++ S) S, m2 H- ]2 ], C& `% N
                                             (cdr (assoc 210 (entget ename))); s2 p4 t. Z7 ^8 g
                                             (trans '(0.0 0.0 0.0) 1 0)- t* q$ _6 _4 a, Q5 V- ~( v
                                          )$ f  v( s! H/ h
                                     0 1
, o; ]8 u; h* x' P* o9 L                                   ); Q1 W- q: V; B; I' ^3 u
                                   0.0000000001            ; fuzz* G5 B0 @5 q+ Q( ]! M8 k
                                )
. z- K# ~3 T9 s5 |                            ); J, l* O( o1 x
                        )2 X6 r- K/ w/ Z. S; a
                    (princ "\nThe 2D Polyline is not parallel to the current UCS.")
- B3 `; {. g: t2 ]                    (ddpline)2 E6 Z4 Y! a3 p
                    )5 u6 g' P( Y5 d/ A
                )
# @3 \0 h& y0 K8 {# A8 Q4 L             )
% B5 M8 t& m4 t1 h, o           )* `; z, A: G: o) ~; @2 c+ g

3 z( Z# g2 k& g# y7 _& g5 K           ((= etype "SHAPE")1 v2 Q8 A. p5 E
             (setq help_entry  "modify_Shape_dialog")
0 F7 @* O* Z1 F7 l             (ddshape)3 p1 N7 e2 N5 e8 h! w2 i
           )3 ?2 Q1 F6 j( R0 t0 `
           ((= etype "SOLID")5 u9 h+ D1 {$ W& x6 G' s
             (setq help_entry  "modify_Solid_dialog")
; \& m4 G4 F& E# ^             (ddsolid)4 `, B8 B. G0 I/ E
           )3 p2 P! }+ T* C  A! p
           ((= etype "TEXT")
9 Z% J! Q! z5 q9 F! [$ ^             (setq help_entry  "modify_Text_dialog")+ g& o+ W, c4 N
             (ddtext)
* r7 w' H3 t% I! T4 L; t( v# ?           )
5 e: R1 q% ^# v. ]* A/ e           ((= etype "MTEXT")
: ?! C; |) |% A# Y             (setq help_entry  "modify_MText_dialog")6 e' s& K$ c. W! a/ ~8 `$ a
             (ddmtext)
0 a4 c/ A( Y; }" U           )
3 Z& ]. ~# C+ d8 r* t5 C5 w$ F; n* ~           ((= etype "TRACE")
/ P- O# V7 r, u2 d% @             (setq help_entry  "modify_Trace_dialog")2 t" A/ O" b5 }" M5 z. @
             (ddsolid)
( B3 s" `7 ?3 U/ N8 x           )
3 Q/ ]' l; j8 X0 {5 \9 @  v           ((= etype "VIEWPORT")
, D( d  Z  Y/ Y, z             (setq help_entry  "modify_Viewport_dialog")
- }7 k: j& f6 a# p+ H7 z             (ddvport)7 ^/ c# j& ^$ \, V
           )
( |8 E! J- F. j$ G0 }           ((= etype "IMAGE")
) Y- C/ p. v9 ~% m             (setq help_entry  "modify_Image_dialog")
/ u( A: }# c3 i5 e; j7 }: Y             (ddimage), r, V7 P8 y* W9 V: _! n& }1 q
           )/ {9 Q+ v7 |: @' d0 ~( a& b
           ((= etype "3DFACE")
2 |, T3 a5 t% u3 w1 `$ e' C- ?             (setq help_entry  "modify_3D_Face_dialog")
/ ]+ v( U+ q6 R( g             (dd3dface)
/ `8 j2 V* k" X: J9 c' S           ): K# H0 N4 C4 x2 k/ q( r
           ((= etype "DIMENSION")5 }0 Y- d6 m: b0 j2 I
             (setq help_entry  "modify_Dimension_dialog")( i& Y  E0 A7 C7 n# H- e: z
             (ddimen)- d# B# A+ }1 U: L& ]! [- W) w
           )
" ~" `  [9 a  p: f0 t: _5 T2 m. R           ((= etype "TOLERANCE")
6 S" e' q! k/ [             (setq help_entry  "modify_Tolerance_dialog"): s5 `* o( u2 d% M' e3 m
             (ddtolerance)
, M* F- h$ n, ]  R1 C           )
& P" ^- [& y1 M* o! v;; Fall-through condition changed by MCAD for MDT 1.1 release.' W2 {% m6 e3 {6 I
;; This allows DDMODIFY to work on any custom object or any new object type
1 u  A  d- [" Z;; that isn't specifically handled above by calling the more generic DDCHPROP.
  B8 ]  U  S, l! _4 {7 l# B           (t
, M6 ^0 _# z7 ?. a  f' L             (if (and (not ddchprop) (not (load "ddchprop" nil)))- U3 b# E5 G8 _9 v( w" Y1 |8 R; [9 |1 V
                (princ (strcat "No dialog support for object type: " etype ".")))
" b% s8 G7 E! V6 n             (progn3 i+ D- t" u) N" T
                (setq tempss (ssadd ename))
" k2 ~3 l  }$ i$ ]                (ddchprop tempss)- o/ Q" f) ^7 _8 `9 b! P" R4 o1 X
                (setq tempss nil)
( Q2 D# G& y3 Q% o8 D' x             )' U% P/ y2 E" p  R+ D" S
           )% }, `+ {7 e# d( L' G% f
        )
7 l4 S4 j! R- A" Y- W! x;; Previous fall-through condition.$ Y! M) ]) o/ e8 d! a
;;           (t (princ (strcat "No dialog support for object type: "
* g& I8 }9 y& x  k' H4 t& |2 k* _;;                             etype "."
8 U7 G* g8 ^4 Q3 h7 Z$ j;;                     )
4 `5 A5 n8 C% ]+ V* S  z% [;;              )1 r) a$ k2 }- r. [+ ]
;;           )
% t0 W" T" c! X( H3 y;;        )$ c% i8 e9 _% r/ F
        (ai_undo_pop)! y* g8 o) k- G9 z- a5 K
     )
1 O1 `' |. ]/ S  )
# P" j# a  a3 K5 b! E( {- w
8 Z5 M! M: g5 ~  (if (eq new_pickstyle (getvar "PICKSTYLE")) ; if user didn't change pickstyle
# c: h/ a+ r8 p7 r- Q* A      (setvar "PICKSTYLE" old_pickstyle)      ; transparently then set it back
/ Q' j2 X# B6 g: W  )                                           ; to what we started with
' m- ]* G  \- C  g' |) C! g+ c
3 I) L/ U: ~+ j1 G$ h' L6 t9 P9 L+ C  (setq *error* old_error)* f) q' a- n& l$ B& _- O
  (setvar "cmdecho" old_cmd)& q5 q+ S$ P0 Q" X
  (if (not reset_flag)            ; if object was modified, then
$ D1 F- O& d% p      (ai_return ename)           ; return it's ename to caller" E4 @) z3 I$ L! x
  )7 T+ }5 t' G2 `# P
)* p$ J2 E9 k. y* o' p+ l
0 \$ K9 r1 y# `) w3 a6 [$ _
(defun checkForLockedLayer (ename)  g# O4 W6 N4 \& X  E7 Y
    (setq layername (cdr (assoc 8 (cdr (entget ename)))))8 U  n6 p, ]1 z! m5 m
    (setq layerflag (cdr (assoc 70 (tblsearch "LAYER" layername))))" ~, r& c6 ~: k4 A, [
    (if (= layerflag 4)
; I# P4 X+ P5 E1 K+ o: d  E        T" S6 H+ t( T& m, y9 A6 }9 w
        nil
* i8 b) K) |0 o/ ]7 T, {% }    )' h5 e/ q* A* g1 ]- R: y2 e
)* G3 v& O2 c" A0 h

/ s* x3 E/ c5 l2 x! T, a# b2 {) ]- p(princ "  DDMODIFY loaded.  ")
+ A" d- j: K  i(princ)
, F3 m4 B6 N' a0 B$ F& o+ G;;;???;;;---------------------------------------------------------------------------------------* m0 f) O; E1 M4 q& y8 f' I+ O
) C; p) |/ U; B0 Q) q# p
; Next available MSG number is    8
6 V, d$ p1 q3 Z2 |4 }( @8 C; MODULE_ID DDUCSP_LSP_
' r- M* Y5 n$ a7 \+ f& B;;;
) N% t8 ]! U0 Y;;;    dducsp.lsp, Z5 a4 Y' e9 t- J( c- s7 U
;;;
. h: j6 a7 k9 y( `8 O. R  w- t0 P;;;    Copyright 1992, 1994, 1996 by Autodesk, Inc.2 v- N+ u3 y7 \: {
;;;
7 D  h) p8 ]/ t9 `1 }, v;;;    Permission to use, copy, modify, and distribute this software! u! w: Y/ Z+ r3 X
;;;    for any purpose and without fee is hereby granted, provided- }6 r7 W9 D+ \- a6 ~6 s
;;;    that the above copyright notice appears in all copies and
3 ^4 Z( Y  U% T" R5 q3 \8 H;;;    that both that copyright notice and the limited warranty and7 c+ P# M% d- k( c
;;;    restricted rights notice below appear in all supporting* r9 x8 q6 @+ B6 ]4 N* Y
;;;    documentation." l6 p7 y" i$ u3 d' h
;;;9 V& i+ [; o! ?
;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.* I4 Z) L( n. U- S: G
;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
, ~5 X* r* m" s( d0 u: m! H. g;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.6 x/ ^! i; i" i5 N' E& Z) o' f
;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
6 \; b3 P- y9 L/ `  G3 T9 M2 \;;;    UNINTERRUPTED OR ERROR FREE.
# u5 y" M" h6 s, p' V2 B2 r;;;) m6 M  \6 d+ {; C& ?. {1 _! ^
;;;    Use, duplication, or disclosure by the U.S. Government is subject to
" @& H. T2 m, a9 b; T: \;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer, y6 l, P" X7 Q! F( H& V
;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 9 b4 _& y! X. s* M$ Q6 a) O9 M& \
;;;    (Rights in Technical Data and Computer Software), as applicable.
! o1 O% f% p% c: N: q3 N;;;
; `+ w* D4 W* O;;;.
1 S5 b- G- G4 n6 B;;;   C:DDUCSP - User Coordinate System presets dialogue.
7 M1 c2 S: ]# D/ ^  @+ W$ x5 n;;;     
; u$ A2 u* j( J# ?6 Z& ~: E;;;              Uses DDUCSP.DCL for the dialogue definition.  The
$ O  l+ M) [; v2 A8 J9 {;;;              slide images are in ACAD.SLB.9 P# u- o% d9 f) q1 g% h$ z0 J0 y
;;;
' [9 q$ A4 ^; s0 j;;; ===========================================================================+ ?  C/ ^9 \1 K" j
;;; ===================== load-time error checking ============================
6 |$ I6 R0 I& [; a0 }  n9 D* A8 U;;;. ^( a5 G3 C  g+ {: s  M

; {; ]$ U  e* D% {, u6 i+ @+ o  (defun ai_abort (app msg)
+ h' ^7 r, x8 v; G5 R. Y! A, f  e     (defun *error* (s)
+ s4 Y; [( p! D% t' x; i7 L; X, m) l        (if old_error (setq *error* old_error))6 E6 v! B. n3 c' r9 [' g
        (princ)/ x7 b* n: G! [9 X9 Q7 V: O
     )" B6 D5 y. l' h# ^2 |6 U
     (if msg
0 k) b4 i$ D& W       (alert (strcat " Application error: "
/ Y2 d$ Y8 l7 R4 G2 \, u4 r, D: D                      app
- M+ ]+ P9 B* p" Y3 P1 J% a- W                      " \n\n  "6 V5 g$ Z' N- d8 U
                      msg
; P! w5 r- a, _                      "  \n"0 H2 B7 u+ H; X% R, r3 K
              )3 ^! C- d* X1 ~( n- i9 |
       )
. d& l4 Q* _, F" H0 i" i7 K     )  h) h. j( P8 j3 x! m$ }" M
     (exit)1 r, e( Q: k  z
  )
4 g  U* ?8 K& ?8 S: i( g9 i, J. P( R5 ]5 }
;;; Check to see if AI_UTILS is loaded, If not, try to find it,
5 {  j* q* @, o;;; and then try to load it.2 _% D8 [& f, W3 {
;;;$ N" H" p* S9 D& |. o
;;; If it can't be found or it can't be loaded, then abort the
* P2 Y+ R, J' c6 B;;; loading of this file immediately, preserving the (autoload)+ ~' d8 U, P5 L5 _; }! `' L0 ~
;;; stub function.
3 m. w/ n3 o$ E* M+ U) {) m4 h7 h; S2 Q% |
  (cond
: G  d0 t; w0 D6 Z+ _     (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.
3 ~# f( z% q/ T, E7 G* v
# h, B8 L# c4 {/ m     (  (not (findfile "ai_utils.lsp"))                     ; find it7 J2 E' g  N. I) P' x" K0 a
        (ai_abort "DDUCSP"
; J2 Z6 B# |3 R$ a, l' U! ^1 z                  (strcat "Can't locate file AI_UTILS.LSP."
1 X0 u6 x. ^! ]; H) j( c                          "\n Check support directory.")))" {$ E) p! D: ]! F* ?
) w# e0 D) n& [
     (  (eq "failed" (load "ai_utils" "failed"))            ; load it
/ P" s3 Z7 I: Q% Y        (ai_abort "DDUCSP" "Can't load file AI_UTILS.LSP"))
, k+ I8 _$ ]& B  )! K; s: ~" J; K- q2 Q) p3 n' J8 ^
! z5 Q# X) C* V5 u2 g
  (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP" h3 l4 s! L- d9 {' M
      (ai_abort "DDUCSP" nil)         ; a Nil <msg> supresses  M% T$ t" W4 g" i' D
  )                                    ; ai_abort's alert box dialog.
0 M4 i# h) X- V2 m( f( t4 h" W  @9 v, p
;;; ==================== end load-time operations ===========================' W5 o1 g: N% {3 D: s
8 `7 Z8 R& }: G  v8 a
(defun ai_ucsp_start ( / program)# H. ~5 v# u: o
  ;; Get program name6 Q9 w  Y# ^% C- A7 L' U
  (if (not (setq program (getvar "program")))
9 Z; }3 g  a! N& C4 T  T     (setq program "acad")
- Q" O1 a* C# D' b3 S' ~( ~3 Z( S% g  )# x" L; N: v( R
  (foreach v0 '("world" "left" "cview" "top" "front"
! x, Y$ r3 N5 a- y2 A                "bottom" "back" "right" "prev")
8 R+ c' K" F" F9 ]6 U    (start_image (strcat "ucsp_" v0)); C: Q% n" H8 m  [' F+ p
    (slide_image% A! l, v! Y# G# _$ {, S0 L2 @
      0 08 E5 h( M) @7 Z2 C" f
      (- (dimx_tile (strcat "ucsp_" v0)) 1) (- (dimy_tile (strcat "ucsp_" v0)) 1)
4 Y; f! C# e/ S: I+ W2 y: }      (strcat program "(u-" v0 ")")8 I% M% P# G4 S( E
    )
5 O9 z  q) R& S  A. c" N$ b! E+ ?    (end_image)
( f' p- M4 c5 O! a0 Y( K  )
7 ^8 v! B* B5 L- \" Z)( m! X  ~2 p8 @* l& g4 T
) k! H1 q2 ]5 J7 y: ^% @
(defun ai_ucsp_set ()  F: E4 d; ~' k" t: ~; N
  (if ai_ucsp_sv
+ s! z$ ~- S, \    (command "_.UCS" "_V")
2 M: T9 F7 u  c3 H( H8 G% P    (if ai_ucsp_prevs/ v( ]3 @: ?1 n/ y5 k/ k" j
      (command "_.UCS" "_P")
. ?7 w$ W2 I" j( M3 `/ C0 i* Q      (if ai_ucsp_chg/ [3 f2 o! |2 O0 k* O# b: W% J2 g
        (progn) y) b% w- Y: {* y+ E( v; d
          (if (/= ai_ucsp_a "*")! ^! o5 }/ S- v4 e" k- f
            (setvar "LASTPOINT" (trans (getvar "UCSORG") 0 1))- K/ ?# y) [# t& d9 Q$ G
          )
5 T/ {5 N6 }$ K$ o3 ^" e8 E          (if (< ai_ucsp_pick 6): x0 v" c* ~2 K8 [; d) ?
            (setq ai_ucsp_set0 "@")
$ G! v; I0 @# Z# Y. L7 P+ J5 z            (setq ai_ucsp_set0 "*0,0,0" ai_ucsp_a "*")
6 M5 z6 V' Q3 M! G( i          )" ~/ T$ s1 r% C0 ?
          (cond ((= ai_ucsp_pick 0)8 y# A- \* f6 I& H4 p. E% ^1 O. w+ b
                 (setq ai_ucsp_set1 "0,-1,0"4 {" |5 A$ _, A: N4 A. L
                       ai_ucsp_set2 "0,0,1") ^9 L; N9 g# g) n
                 )' W5 L1 B$ g) g, a% Q3 {
                )3 i2 n! P2 o& B4 W1 E; u) S
                ((= ai_ucsp_pick 2)  N/ B) T' u6 o. y7 i3 A3 R
                 (setq ai_ucsp_set1 "1,0,0"( `8 V+ b/ v2 |$ }( q8 D. ?) q
                       ai_ucsp_set2 "0,0,1"
0 t9 P( A' d. u  F8 U5 g9 E                 )0 H6 D6 A3 u3 g  i" t3 @; F
                )/ y5 M5 i6 q1 q6 r' B. L3 g* h, q, A
                ((= ai_ucsp_pick 3)7 e3 l+ `6 V- A6 o! U5 |0 f
                 (setq ai_ucsp_set1 "1,0,0"3 l( t# V* f/ l( E( G# v
                       ai_ucsp_set2 "0,-1,0"
5 `. ^2 r2 [4 g1 K: G+ J                 )
9 B# ]7 K8 }' k7 e5 z; H. P                )1 G, p, D. w9 a7 K6 b. H8 K" R
                ((= ai_ucsp_pick 4)
6 n1 c; F# j# {) A  s( u: i6 d                 (setq ai_ucsp_set1 "-1,0,0") \& T6 f8 G# p+ m) A6 Q3 r
                       ai_ucsp_set2 "0,0,1"% s7 e$ x$ W- e* i
                 )
* H. k1 h2 Q( x4 ^5 z. m2 Z                ), ^2 i3 |) G4 v2 u$ y3 H- m
                ((= ai_ucsp_pick 5)0 i6 s" U  b% _/ x3 Y1 X
                 (setq ai_ucsp_set1 "0,1,0"! r6 P) D+ U6 Q# i' X! d
                       ai_ucsp_set2 "0,0,1"
; b7 n( ~9 W* R/ a; r. {  K                 )/ N& ?, L8 a) \; s3 I# M
                )
: d# f6 ]+ L( s( E! F                (T
! K8 k* V6 Q( P0 b/ j! R% |                 (setq ai_ucsp_set1 "1,0,0"
  U/ C4 z1 z0 F- i8 R$ ^! n                       ai_ucsp_set2 "0,1,0"  H! p: ^; o/ k7 X+ P- ]( F9 c
                 )8 `0 e' s1 B/ W( u# h3 I( [
                )
4 e( O5 @* z! a8 e3 Y$ ^7 @5 f8 x          )
/ J7 C; w- ?" e) r5 }8 S          (command "_.UCS" "_3P" ai_ucsp_set0 # g1 e! u( w" A; N
                   (strcat ai_ucsp_a ai_ucsp_set1) 8 u  r  q& h0 a- K* l! E
                   (strcat ai_ucsp_a ai_ucsp_set2)
5 h( R2 A( m. b; ]- h, b- R+ F          ) 9 u& m$ G: O/ n- d" v1 G; c7 c
        ): }: @  m6 q  z
      )5 C+ s3 _  P6 R
    )! h2 A; r$ q; ^( f- d
  )$ j" U0 D% w( N/ w8 S  x
)7 ]1 H0 b1 k! A
% \1 `3 b3 q! `% t
(defun ai_ucsp_p (val currtile)" B. r# L( d9 R( O( G$ x
  (mode_tile ai_ucsp_currtile 4)
; y9 E% f* Y4 z' e  (setq ai_ucsp_pick val
1 ?3 y  ]5 F0 X+ A1 p6 R        ai_ucsp_sv nil
  O, k  T, T/ M+ y1 ^        ai_ucsp_currtile currtile
" A- g/ F3 Y: _; x) ~5 E2 p* c: f  ), _( y, R6 i: c3 C( p. c
  (if (/= val 1)
9 Z& _4 r7 ^( m    (setq ai_ucsp_chg T)& Y1 m& h8 p# D: Y- D, ?
  )
8 D9 T0 @' a$ p2 P  (mode_tile ai_ucsp_currtile 4)
& X; T) Z% g' \0 o: q3 l)" _7 b  }1 Y( y9 w* g

  r: F# q1 c  y) m(defun ai_ucsp_swcs ()( ?: ?. K! d2 |4 I& w9 M, F
  (mode_tile ai_ucsp_currtile 4)' o9 Q5 B+ O4 ^& W
  (set_tile "ucsp_a_wcs" "1")
/ T* @" j5 X( w  n4 f3 @1 a  (setq ai_ucsp_pick 6
, M% j9 c3 H3 R. i( l# g* S        ai_ucsp_sv nil
& b7 W* c4 k& G0 j, I- M0 b        ai_ucsp_currtile "ucsp_world"
0 j. Q( C/ K) A& t  ), |5 F0 v$ b; E9 r
  (if (/= 1 (getvar "WORLDUCS"))
/ y% H( H, e% Y. G    (setq ai_ucsp_chg T)/ E# M' G- P% `/ C4 y
    (setq ai_ucsp_chg nil)7 ?- v" |7 d% }% ?9 D
  )6 J  ?* q$ v( v) M; r
  (mode_tile ai_ucsp_currtile 4)
* a4 m3 K: l+ M% K7 \: a1 d/ e)
& F% v& D  N3 F' V& R( F' _% v6 b1 V; l% x/ s$ x" Y$ ]- w( l  ?% A
(defun ai_ucsp_cview ()
. F' S* K' y$ |, G8 \$ h' r  (mode_tile ai_ucsp_currtile 4)7 B; ?4 F: @! s/ Q( k' M
  (setq ai_ucsp_sv T 0 W& J( {, N: W1 L% Q1 q5 w
        ai_ucsp_chg nil7 r+ {% @2 \% [; t2 X0 g* ]
        ai_ucsp_currtile "ucsp_cview"* {- b3 w  t' Q" _! E
  )
0 v1 |4 n6 c4 B2 Y$ x' w0 H  (set_tile "ucsp_a_wcs" "1")" h$ e& I$ G" r" {( k0 Q
  (mode_tile ai_ucsp_currtile 4)
, O  R, J0 w* D7 `0 \9 ^; E)
- J; q+ ?( l0 n5 e- J0 d+ N( [
% ~" g- m4 b* b' D9 y0 F2 [(defun ai_ucsp_rucs (typ)
! B4 u. l0 b3 J* H& a) p# }* D  (setq ai_ucsp_a typ)
1 n) s0 K- c8 ^5 M) t2 X7 `% r; V1 L* z  (mode_tile ai_ucsp_currtile 2)* l5 `- s& ]& U, G+ ~9 j
); ]  T$ t1 r# |% U9 {9 @& {
" t8 E1 e. ^0 y2 j3 i1 k: v
(defun ai_ucsp_prev ()1 i. [; Q' P2 l3 u1 U3 W
  (mode_tile ai_ucsp_currtile 4)
5 i8 S9 u& H8 q3 K( v0 }  (setq ai_ucsp_prevs T
' n( m" y' m( \        ai_ucsp_currtile "ucsp_prev"
7 X7 X5 w9 Q% \# ^  )
) i+ u; I$ S. ?" S  (mode_tile ai_ucsp_currtile 4)
# f. S2 @$ L9 v' r# p, j)6 f: U$ e( F$ {7 O5 B

& P; O- K# P+ N" K, d; g+ d& Y# i(defun ai_ucsp_main ( / ai_ucsp_pick ai_ucsp_sv globals)) S8 t# Z" P( m% N0 b  B5 f; P! u
  (if (not (new_dialog "dducsp" dcl_id))1 B3 {! O6 h% z( ^: i. C- l
    (exit)
3 L  ?5 [5 G: c; p' z) h  )6 O: ?2 P- @" r8 P

* F0 {) V( m5 u: R3 P  (ai_ucsp_start)% b0 Z* i& X* {0 t
  (setq ai_ucsp_a "@"
" q- Q, k7 S3 i% j" M        ai_ucsp_pick 2
7 i1 d: m6 b& f        ai_ucsp_currtile "ucsp_top") P! a7 @' E7 G9 ^3 s  ^
  )$ ?9 r2 i1 f9 h1 _* }  M) j2 P
  (if (= 1 (getvar "WORLDUCS"))
8 T' `7 c$ ]# o! j% ^, f1 T+ Y# s    (progn9 w- d+ C% u  F' V
      (set_tile "ucsp_a_wcs" "1")5 ~1 [7 L3 X( e, M7 U
      (setq ai_ucsp_currtile "ucsp_world")' T6 {/ A) A  X& ~$ m" J
    ); R  |+ |: C1 o) s( J% H
    (set_tile "ucsp_r_ucs" "1")
6 F6 v0 c: U' `. H% G% I& v0 E  )9 ]& V8 O& [. Q" O0 @- V: w. x/ n
  (mode_tile ai_ucsp_currtile 2): {: k6 c/ n* M6 |4 Y5 C7 o( }3 q
  (mode_tile ai_ucsp_currtile 4)
& h/ R+ `; P6 h2 |% p  (action_tile "ucsp_world" "(ai_ucsp_swcs)")) L, R5 U; f" I( ?
  (action_tile "ucsp_cview" "(ai_ucsp_cview)")1 P' R& Q/ H! [) e/ y$ g
  (action_tile "ucsp_left" "(ai_ucsp_p 0 $key)")
6 l1 z; G9 v8 Y! g$ Q  (action_tile "ucsp_top" "(ai_ucsp_p 1 $key)")
' P6 _) ?) }$ t. u! O  (action_tile "ucsp_front" "(ai_ucsp_p 2 $key)")
$ T3 q6 S9 @* z1 ^  (action_tile "ucsp_bottom" "(ai_ucsp_p 3 $key)")
' R# t' ~" M0 V& ?  (action_tile "ucsp_back" "(ai_ucsp_p 4 $key)")
9 V' q, {3 F9 h* @  v  (action_tile "ucsp_right" "(ai_ucsp_p 5 $key)")
7 t% z* j) D1 {9 o% K" T$ p! Z; E  (action_tile "ucsp_prev" "(ai_ucsp_prev)"); v- ^" w# @8 q: I3 @- s! b
  (action_tile "ucsp_r_ucs" "(ai_ucsp_rucs \"@\")")& z+ ^! T  k' I% a* w0 {
  (action_tile "ucsp_a_wcs" "(ai_ucsp_rucs \"*\")")
; y7 Z- o5 v, n  I* I( w  (action_tile "accept" "(done_dialog 1)")
5 @5 V% R7 g- x1 n, F) Y  (action_tile "cancel" "(done_dialog 0)")
4 [. u& b7 Z# ~6 _6 h  (action_tile "help" "(help \"\" \"DDUCSP\")")# q6 ?$ Q4 F8 M1 B5 t* H
  (if (= (start_dialog) 1)& T* T# T. K$ e) \5 w" h
    (ai_ucsp_set)3 y7 L% }, c( |4 \
  )
. Z# p  t6 ^1 A) k) V* E)
$ o* n3 T7 L4 C+ u% z. N" j2 A( ]% ~  G2 A5 a
(defun c:UUS ( / app dcl_id old_cmd old_osmode ai_ucsp_prevs
: r: M& H( \$ r                    ai_ucsp_sw undo_init)
2 m+ ~- Z& }& z7 }! C
+ u3 ]1 e$ T2 {/ C' d  ;; Set up error function.  z8 ?$ W* V" f9 M% d& C" h
  (setq old_cmd (getvar "CMDECHO")    ; save current setting of cmdecho
% z- C+ y! o7 v& k! Z; L        old_error  *error*            ; save current error function
( \6 q* @' t1 \* z        *error* ai_error              ; new error function
- u; K" Q- Z( i  D) U' u        old_osmode (getvar "OSMODE")  ; disable OSNAP for duration
: C9 m6 u. Y+ w. p4 O9 x  )
, M1 Z/ P3 P0 s' f4 E
& b( ?" w. a) {5 }% U  (setvar "CMDECHO" 0)
# }0 S/ W2 l. Q' v* U+ k4 X/ j9 f4 e( X. n
  (cond3 f8 r. {( ]( I# @" E1 D" t2 N
     (  (not (ai_notrans)))                     ; transparent not OK
: g! V) D, P/ ]     (  (not (ai_acadapp)))                     ; ACADAPP.EXP xloaded?
( U' ~! v" Q- Q" S: S' G9 z- [" L     (  (not (setq dcl_id (ai_dcl "dducsp"))))  ; is .DCL file loaded?
6 x. ^. T; f- X) V  m     (T (ai_undo_push)# x7 M$ \! M' |
        (setvar "OSMODE" 0)4 L" q4 \$ x% s& h+ t- k$ O1 M$ Q
        (ai_ucsp_main)2 A3 M5 |1 m) X( J
        (setvar "OSMODE" old_osmode)8 D5 ~) Z7 g2 ~# B# m8 R0 B
        (ai_undo_pop)& X" k5 z( {2 I5 r! W* ]: G8 b8 _; ]0 B
     )2 O( P3 s7 G  B7 x8 v" G
  )9 a- a2 X; _% W: J1 h! _

3 F" r: Z- Q& Z) a4 ]  (setq *error* old_error)   }6 {8 s) {* Z, X6 ]
  (setvar "cmdecho" old_cmd)
; i4 l+ {$ j; B& ^( S+ I8 N/ U6 U- k$ }  P( J0 u' g: \
  (princ)
5 Z7 o. u9 f  Q0 y) U& E0 D: W: ?6 s' Y( H)8 c, p" q8 Y# m; S4 M$ `, {
/ K7 S+ g; D' `/ k# ]! t1 c4 G
(princ "  DDUCSP loaded.  ")
. N) y6 l; ]+ u(princ)" u$ G# P# `- [' V

5 F6 u$ n1 @! F! k9 y; t2 p;;;???;;;---------------------------------------------------------------------------------------
5 q8 Q& q: y4 _3 D( w, D. z! H) s- N& ~* V# T9 C8 [- H5 N, J
;;;----------------------------------------------------------------------------* Z* L( ^- p1 Y
;;;
) V  m! t/ y4 a, a7 e3 f2 s5 {4 E;;;    EXCHPROP.LSP    ' _/ L: A$ e. o. j8 _" H4 |( y
;;;    Polyline and text modification capabilities added by
" T$ G( j- V2 ~! Y;;;    Randy Kintzley  ( ~; A. l  N. n0 w) ?  T$ R( P/ W
;;;
: P4 z9 c7 j0 W- ~% c8 B5 B& G" N  s; S;;;    Copyright (C) 1997 by Autodesk, Inc.
& Q8 M. a7 W, B' w0 p' l' e$ z;;;  g0 x( k& K& [
;;;    Permission to use, copy, modify, and distribute this software) d3 c9 V" E3 ~. R
;;;    for any purpose and without fee is hereby granted, provided* i" R4 E5 L4 ], _+ p( A: A- q
;;;    that the above copyright notice appears in all copies and+ S1 u* }; n* A
;;;    that both that copyright notice and the limited warranty and6 K5 C+ y  Z  H% [
;;;    restricted rights notice below appear in all supporting
' T1 O* h& K  S+ {: c3 S  s;;;    documentation.* Y  O# {, @+ x3 z+ H
;;;/ ]' G% z2 I- @+ L7 ?# ~/ T
;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.5 o/ Q' U9 h  ?, E1 p
;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
$ G% z! z) u- I! E* C;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
+ F2 L7 m: P/ G) |5 r6 x. ~6 q) f;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
) L$ s; V  a/ A; `;;;    UNINTERRUPTED OR ERROR FREE.
  c/ ?4 k! W+ d, p7 C;;;. ^8 B: F$ p8 V4 y  h& X: K
;;;    Use, duplication, or disclosure by the U.S. Government is subject to( I( K9 m" I; f" z9 A1 z
;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
, v0 q% M. @4 c. b;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)8 C- ~4 V. `/ ]- L% B) ^
;;;    (Rights in Technical Data and Computer Software), as applicable.3 H% S6 |# e5 |5 [: _
;;;
' g" }8 B' ]: c4 R/ `/ `% K;;;.6 [! r; `  e5 {: f# z+ Q
;;;    28 February 1997
& M& n& c0 f- b3 S. k: X;;;! A' L& }6 d; j: ]  I5 k
;;;
7 e$ O0 |8 w/ C1 {. q4 d;;;----------------------------------------------------------------------------
: y1 d: t/ x- b& |$ u( ?;;;   DESCRIPTION  H: o* m$ r2 j" G
;;;----------------------------------------------------------------------------  H( m+ G. V- v" Q% r& @5 ?
;;;   C:EXCHPROP is an extended or enhanced version of ddchprop. This  6 w% Y, E" h6 v
;;;   command gives the user the abilitie to change several characteristics . D; N3 o) G4 C3 J9 o4 A
;;;   of selected polyline and text objects.
. D! }! ~1 s0 a9 b& _;;;       The style and height of selectected text objects can be modified
0 D; h% i1 T9 n- o* a: x& ?- H+ _, [;;;   (including text, mtext and attribute definitions) as well as, width and
7 U. d& _- |! N;;;   elevation characteristics of selected polylines (includes lightweight and 1 ]$ B0 }! e! B9 I6 o6 Z
;;;   traditional polylines.)
; f" P: j* r1 c$ a& F* g6 G;;;----------------------------------------------------------------------------
3 \/ ^3 A3 ]/ W3 g;;;----------------------------------------------------------------------------) q! j4 P* h# N8 A
;;;   Prefixes in command and keyword strings:
! q' W$ k4 f; d7 f6 R4 w;;;      "."  specifies the built-in AutoCAD command in case it has been
% W5 A7 a" k$ {;;;           redefined.0 z' I/ n+ p0 V' W
;;;      "_"  denotes an AutoCAD command or keyword in the native language( [8 P6 ~6 u5 ]
;;;           version, English.0 F: Q' D; V) U! T4 P
;;;----------------------------------------------------------------------------0 F8 K* `; K0 z1 ~6 ^4 b
;;;1 [+ }  p- v) c# A5 m( B3 f
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 [& u( ]) z, f/ x/ o;;;;;;;;;;;;;;;;;;;;;;;;;;;;GLOBAL INFO.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;/ q# L/ [" x6 {' _
;Functions created as result of loading file: exchprop.lsp+ t3 Z. I1 h1 T6 l) A0 C/ `, ?$ s
; DDCHPROP2
- q% C$ g& q1 E1 F  M1 x; DDCHPROP2_INIT
1 x* [/ r, O1 m( d, ?( h0 t8 z: y9 w; DDCHPROP2_SELECT
$ }1 R  `  S- C! F; ~9 p4 `;# v5 K2 ^, I1 p
;Variables created as result of loading file: exchprop.lsp+ m4 X2 B' t* }9 i
; OLD_ALLOC
! \  j6 }; h  I+ K1 l1 ^1 M4 E; V;9 y2 l# j) R# l/ O# W" n/ X+ [! C
;Functions created as a result of executing the commands in: exchprop.lsp
& A+ _2 T5 B* O9 @# d9 I% @;
( [( ~1 }$ A2 w;Variables created as a result of executing the commands in: exchprop.lsp
3 t& U! S) h: e% {( [; s8 u; AI_SELTYPE
' _4 G* l6 b' Q2 ~! Q; BONUS_ALIVE% H7 Q3 t4 H4 Z, H, i
; BONUS_OLD_ERROR5 i, A$ P* Y5 e
;;;;;;;;;;;;;;;;;;;;;;;;;;;;GLOBAL INFO.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;: s* `" \7 `6 t/ c( m1 R
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;$ A1 M4 l8 z0 g+ N1 c' B

' d- n! F0 V9 r7 n;;;) F# Q% t+ h- o3 J; |
;;; Avoid (gc)s on load to improve load time.
, ]9 Y4 \; W" n6 X( H) h;;;0 J4 l% Y5 |! w  A. v3 G
(defun do_alloc (/ old_allod new_alloc)) B" Z0 `0 a- U
  (setq old_alloc (alloc 2000) new_alloc (alloc 2000)). t" P4 T9 ?3 y
  (expand (1+ (/ 4750 new_alloc)))) A. j) }# @5 j4 ^9 t4 N: D/ @* M* P
  (alloc old_alloc)
' H" B  B% W3 L& P) U+ e& o);defun1 U' f1 S# l$ D
9 B; K2 r  }4 U' s$ ~  r
;runs at load time - rk
* N2 G% h2 H' D(do_alloc)1 e0 H- u# y+ Q
(setq do_alloc nil)0 J9 [8 [. E! r. K
;;;6 i% g. ~3 V; f
;;; ===========================================================================
. F9 x3 X" v( b/ H$ \;;; ===================== load-time error checking ============================" u! a- P. J6 o+ ^3 u
;;;
8 \  F/ S% k4 W% R) M) m3 ?6 Q5 M& L+ U3 H  g7 A) _
  (defun ai_abort (app msg)
$ F/ H3 ~! W( W1 [4 O5 d     (defun *error* (s)$ [) b# h3 R* k- @1 x- t
      (if old_error (setq *error* old_error)); h: z5 l6 d1 D# u! v
      (princ)
/ Q8 i9 h5 c  T     );defun4 z, Q2 I: }! d
     (if msg
) u& K. ^& {5 t" N. L9 \       (alert (strcat " Application error: "
! m. J+ l! E# k9 S7 d                      app8 N' G- @; t: B& F9 p; ]7 \$ @( s( D. d
                      " \n\n  "
; y5 j' o" n9 d3 D8 u                      msg
9 y5 y  ^. S' `- T5 R( i                      "  \n") e4 i$ r( s! C% v0 C9 Q
              )
* \- g! v7 m) X' d) Q2 K% o+ d2 T       );alert" I9 J7 y" T- F3 I" U6 k4 \# g# d1 W
     );if9 ]3 z8 g% a! Y& \/ L: O+ E* w; a- C
     ;(*error* msg)+ t# X0 U" u% b) ?( d' s) |
     (exit)  y0 i+ D; ?7 V! V) n
  );defun ai_abort+ [9 t+ A* j8 ?% A
( n. e+ K5 \$ H8 O
;runs at load time - rk: b, _4 `: E" s- Y6 m9 n" T
;(if (and *error*      ;added the if wrapper around this - rk.
0 G* {/ q7 R6 F; L7 e4 T  S  e# |) m;         (not old_error)      
8 N. n8 q2 Z( `;    );and
5 U/ m' u# D5 X( c! z# g3 K;    (setq old_error *error*);setq
; }: K! R8 H+ }. P;);if
! ~0 }$ [2 z; H+ E4 U* V% ?3 N! x6 k* w0 ?. b, ^

9 ?1 A- a4 X: ?3 E;;; Check to see if AI_UTILS is loaded, If not, try to find it,: O6 f, a  y2 B
;;; and then try to load it.  [; h! T$ N/ Y" o4 f' H( Y
;;;
+ w% Y' u! t7 u( k0 {  n0 Y0 M;;; If it can't be found or it can't be loaded, then abort the
8 U, C3 Y9 e( o: N3 |;;; loading of this file immediately, preserving the (autoload)
, j2 j  A" L& S7 C;;; stub function.' M+ B( X) E% q, W: C
% k  s  ]7 Y6 ~6 j
;runs at load time - rk.: ?% B# D/ F4 w) i  C5 p- N
(cond
- G" z& f* V) |( p0 G9 J$ i& U4 B (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.4 S# _9 n8 w0 r2 j) l+ l
(  (not (findfile "ai_utils.lsp"))                     ; find it
6 X0 M5 c/ a$ x! z& l; s    (ai_abort "EXCHPROP"% d: }: T6 p8 h: t# t$ I; d* `
              (strcat "Can't locate file AI_UTILS.LSP."
( h. x! Q6 V: U4 t                      "\n Check support directory.")
. F3 F1 M0 I; N+ Y. }; P- e    );ai_abort
9 y! d) p0 d9 [* Q/ g )
' p5 {& S* L2 n2 Z (  (eq "failed" (load "ai_utils" "failed"))            ; load it
; ~+ w7 R, |* s6 V    (ai_abort "EXCHPROP" "Can't load file AI_UTILS.LSP")
# j" c- N, E, Y9 N$ l )
, {+ C" q: J# d5 T" N# V$ _0 p);cond close. q# b: L! f/ _1 U" c. S

; l! Y1 i7 u) _+ ^(if (not (ai_acadapp))               ; defined in AI_UTILS.LSP- l0 K2 g5 _) O
    (ai_abort "EXCHPROP" nil)       ; a Nil <msg> supresses# l- k' u" X. }: _; _
);if                                 ; ai_abort's alert box dialog.% `4 Y, B! w+ A/ ^6 W8 n; k
9 _+ e) D* g0 \
;;; ==================== end load-time operations ===========================# P6 K! d9 O) P' S* p& ^* d
8 p) d" C6 D5 U% Y5 g0 J$ K
;;; Initialize program subroutines and variables.
3 Q: b' E. z6 Z! K5 K# K1 A  [4 C$ i4 I( M6 v- s5 a. P# ?' C
(defun ddchprop2_init()
/ m# M5 ?& d% P# f7 ?
% b6 s- R! a7 H2 M7 |% P+ L; ^* h1 d5 g+ d

; N9 U; b; a7 ]) K( W+ a  ;;& H( w% Z7 d1 o- _
  ;; Define buttons and set values in CHPROP dialogue box7 c4 c" S' d; b. j% i1 ]) V4 a
  ;;# q) a9 u8 C, V9 V2 l+ \5 N
  (defun call_chp2 (/ cmdact p1 p2)( n. W+ |6 V& S6 j/ M7 q
' f: B: ^) s4 }: r
    (if (not (new_dialog "ch_prop" dcl_id))
9 D5 V4 S2 V: H' N: i8 `! p: v, l        (exit)
+ S# E0 v' y5 z' M3 ]. W, }    )- p; B, E: M2 V2 \

/ R3 n0 {, ~$ b+ u0 V    (set_tile "error" "")' \- e' N. D$ H/ s& Z* I9 Y3 @$ S( T
    ;; Set initial dialogue tile values
1 T$ _5 v/ J- k' U& R9 H    (set_col_tile)
2 p  I, C8 _7 L4 T    (set_tile "t_layer" elayer)
1 U: C1 l) r7 g# f' H3 o# i+ j* [' b0 f
, z4 M# ^! I+ d7 ^- F9 u    (cond
' j7 {; e% D. {( x+ L+ u2 p      ((= lt-idx nil)
9 ]/ a. b0 A7 q& ~% k        (set_tile "t_ltype" "Varies")4 s" @( t7 x: ~/ z4 P
      )
+ H8 ^  a) R/ K      ((= lt-idx 0) ; set tile "By layer & layer linetype"
7 g- l" a0 \' @' H4 {+ c" {+ a- B' n        (set_tile "t_ltype" (bylayer_lt))/ d- X1 [9 r& N  h: h: K
      )
# o- N% n2 Q- T1 a. _8 f      (T
% U- f' y  M' Z. s- C" H        (set_tile "t_ltype" (nth lt-idx ltnmlst))7 N9 {, y! p, w% }
      )6 {, V) L; V6 ]+ P' J; D3 X
    ), t# c& q. x/ c# `/ t

9 s, ?$ g$ Z4 l* U" D0 b    (if (or (= ethickness nil)( L& E- o6 {( z& `5 I
            (= ethickness "")
8 q8 v7 w& v4 B( a: f            (= ethickness "Varies") ( {- Z6 e, E, o1 |& S/ [
        );or
4 A, `! \' m! H6 m8 Y        (set_tile "eb_thickness" "")
" Z4 U4 P% ?' w8 C1 w5 w* h! F3 {1 p        (set_tile "eb_thickness" (ai_rtos ethickness))
8 C( t) `% j" W* C    );if
% e, @  R. m9 v5 G5 i    (if (or (= eltscale nil)" [+ L+ N# q; {$ B: X
            (= eltscale "")
; C+ J: s4 A; o  n, B7 j' b6 h$ l            (= eltscale "Varies")
6 T5 J) m6 l0 ~8 I9 L: i  F9 l
( U/ r; d, Z/ R  O; l" Z7 F        )# R# j8 C6 o3 }% j) T* R# C2 u9 \. U
        (set_tile "eb_ltscale" "")
: F: M1 }) _9 I4 Z- m. a% z* u        (set_tile "eb_ltscale" (ai_rtos eltscale))
+ _4 y6 `$ ^8 p+ f$ V% n    )
! r1 A9 Y2 M! P+ N7 C7 x( N0 D. ^# [7 h    (if8 _$ F7 e& H9 @9 T+ Z% V8 D
      (numberp ewidth)
9 I$ g! _  H8 J1 d      (set_tile "poly_wid" (ai_rtos ewidth))1 u; K- [9 z7 c' s4 H
      (set_tile "poly_wid" ewidth)
' b' J3 Z/ z9 o5 R0 N2 w    )
: x  Z; k9 i0 ]. h& r+ t    (if! U9 W9 g0 @: Q6 f* v7 Q
      (numberp eelevation)
% {5 X+ Z  |3 Z( v4 [$ C$ A      (set_tile "poly_elev" (ai_rtos eelevation)). q3 ]$ c# G3 r" Z! f2 K
      (set_tile "poly_elev" eelevation)0 M( T& W+ c4 P9 Q$ }
    )
& z) e2 j+ e8 F3 y& h0 ]    (if. a0 H. E/ |) v/ o+ |6 }5 c5 G7 Y
      (numberp eheight)8 r. X5 z# U0 L, m
      (set_tile "text_hgt" (ai_rtos eheight))
% D8 ?) D0 t2 Y# J- n/ Z      (set_tile "text_hgt" eheight): {  t# g3 W* X7 `1 Q6 @
    )2 ~: f5 X! I/ Q- D* M
    (if (not estyle)
2 d  G6 n3 w; Z        (setq estyle "")
8 ]8 Y9 j4 k. w9 ~' [& D  J8 V7 p    );if
$ E9 A0 x% B5 z' a  T    (setq hair_style_list (tnlist '("style" 16)));setq; z! g6 {7 z9 x7 _  ^5 c4 H4 Q% Q
    (if (not (member estyle hair_style_list))
/ k2 t, r4 l; i( N        (setq hair_style_list (append hair_style_list (list estyle)));setq( o! {1 D1 p$ \5 F4 W
    );if
/ C& k4 ^8 U; B! y( {8 ^' ~
0 |* g/ Q0 z% Z+ |2 a: p9 `/ m6 l    (setq hair_style_list (acad_strlsort hair_style_list));setq6 F, m6 V; q- k* Z0 J: q5 ]- E
    (mpoplst "text_style" hair_style_list)5 q& T( L6 R3 D
    (set_tile "text_style"
0 p6 L$ D9 d% x6 R; L$ D              (itoa (position estyle hair_style_list))
% q, n$ K9 N$ ?6 ]    );set_tile
  x7 g- y. @. l3 @# n/ S# s3 p/ q+ V7 v* b, q8 t
    ;; Disable tiles if need be...  ;@RK
7 `$ _# \; s& ]$ e    (setq a 0)6 R: Q% t% f6 k; ^
    (while ( < a  (sslength ss))
/ B0 l+ J  Z9 |! A$ b      (setq which_tiles
* r7 L* T2 h3 ~6 n9 l+ T% M! L            (ai_common_state (cdr (assoc '0 (entget (ssname ss a))))))
% J7 j, X6 ^& D* }3 L% X0 g6 m2 n6 M/ _2 S7 s. g
      ;; If all fields are enabled, don't bother checking anymore.
7 N$ E& m6 E! G8 T9 O" |      (if (/= which_tiles (logior 1 2 4 8 16))
8 \' ]; T  M0 y  J        (setq a (1+ a))
. L: `7 P1 Q1 s8 L        (setq a (sslength ss))
/ }! A, `3 @) L+ z8 K' Z0 j/ c      )
7 K0 q2 s; {" X7 S0 C! T4 Q) d$ y/ U    )
# p1 D4 h& n5 {( X% m    ;; Layer Button and Text Field; s* [5 O( [0 I4 S. H
4 X+ r; b- \, a$ y7 t; t# A
    (if (/= 1 (logand 1 which_tiles))
  {4 \) R1 s& n. c      (progn
& V2 U: Y8 t: o9 x. V        (mode_tile "t_layer" 1)  ^! w+ \$ T1 I: ?7 E2 U/ S/ {
        (mode_tile "b_name" 1)5 z2 W1 Y- @6 X
      )
; x3 l8 a5 Q( z: L% t! n0 f! Q    )3 p$ I" _$ g8 N9 h
( j2 L! F3 F- l
    ;; Color Button and Text Field
" o9 N8 c7 B2 N, a( O0 E& J    (if (/= 2 (logand 2 which_tiles))- e( C% x! h1 H, t2 C! A6 Q: {5 a
      (progn
/ o" ~6 W$ z) `8 T# d+ H        (mode_tile "t_color" 1)0 R) x% b* q$ j( U0 k# g/ Z
        (mode_tile "b_color" 1)8 L/ }- N& i2 z( S- V# K
        (mode_tile "show_image" 1)
4 T  U+ k4 O9 ^7 W8 U      ), x, H3 f5 p5 U8 k# s- M2 \
    )/ a3 r5 K7 h* e. d9 {
    ;; Linetype Button and Text Field
4 _9 `: e/ ^( c6 a$ J3 e; k! P1 b8 g/ g# k    (if (/= 4 (logand 4 which_tiles))
8 I: ]' X8 ?. v* V      (progn
; [6 z1 {+ e# Z- w. n        (mode_tile "t_ltype" 1)
) J8 K2 m7 ~- h& @# Y/ u* F        (mode_tile "b_line" 1)
4 J' n  R( U5 F5 `3 x3 a% P( b      ); J' _. Z; v$ d+ M2 t
    )6 x* C2 J- W  w! r  t1 k1 n4 f
    ;; Linetype Scale Edit Field" O* u; H* ^* v% V/ \
    (if (/= 8 (logand 8 which_tiles))
2 G: |9 }9 a: t% C; e1 {3 K* ^- a      (progn+ ^; t& P- I) j
        (mode_tile "eb_ltscale" 1)$ k, S5 h" t" C6 u1 M& x% `% i
      )9 m" R$ g5 A0 M6 a2 r
    )
9 y- n) ^! c, ]    ;; Thickness Edit Field.5 f4 L. {9 \! q3 x2 Q" k7 }
    (if (/= 16 (logand 16 which_tiles))
# S  |+ R- x8 n9 S% ]      (progn0 \! v* I6 U. \* V. W. s
        (mode_tile "eb_thickness" 1)/ d7 D* N- C. [, Q
      )1 d5 j; B# S& T5 a4 Y4 x! Q
    )- J5 t. O; ]" D0 L4 d

& r/ |) k5 {1 e% j! C    ;; Polyline box and tiles          @rk 10:05 AM 1/30/97
( W& H3 x7 l& K* H8 p: U# I) X    (if (not (= 2 (logand 2 eflag)))
' K4 p: p: V' m- j        (progn
) ?. }& ^, s' V. i' _         (mode_tile "text_hgt" 1)) C. r1 V, o. g5 i" |8 n
         (mode_tile "text_style" 1)
6 y7 F( k  k5 [9 d0 S8 A$ }        );progn3 `1 x' }' R0 I
    );if
6 n: o- r; j4 [$ ?$ G; V    (if (not (= 1 (logand 1 eflag)))% f, B- E8 l) j7 {, s) X# B" @
        (progn
' w6 P/ `6 S5 p) _         (mode_tile "poly_wid" 1)# `# P' c. J+ [3 J9 c: l
         (mode_tile "poly_elev" 1)* k+ G8 j9 n" S" {! ~8 `
        );progn then disable polyline fields
, |7 \0 h4 z" h) p( N    );if; H0 J. c' J: [% e' m5 v; [3 X" v

/ t8 X' Y1 L0 h    ;; Define action for tiles
8 P0 X; c# e0 R) m1 h- h7 M    (action_tile "b_color" "(setq ecolor (getcolor))")9 b: K7 ^; C. G+ z
    (action_tile "show_image" "(setq ecolor (getcolor))")
% R+ `# S7 b* b/ c# H( h+ k6 ~    (action_tile "b_name" "(setq elayer (getlayer))")
6 i6 }, f- i* F5 z! ?    (action_tile "b_line" "(setq eltype (getltype))")
8 [$ ^9 f- B0 |1 |* k    (action_tile "eb_ltscale"  "(getscale $value)"), ^2 i! n" b! j6 y% @$ M( B7 N
    (action_tile "eb_thickness"  "(getthickness $value)")  K; l$ ^$ o/ X3 U/ A( C
    (action_tile "poly_wid" "(getwidth $value)")
* y. Z& t3 a- b- g& J    (action_tile "poly_elev" "(getelevation $value)")6 s- S7 E! P2 Q
    (action_tile "text_hgt" "(getheight $value)")" D( b  c2 W8 _9 y8 T8 K# t9 i
    (action_tile "text_style" "(getstyle $value hair_style_list)")
5 [' q! T& C% ]2 v: \" R$ X. s+ [* _    (action_tile "help" "(help \"AC_BONUS.HLP\" \"EXCHPROP\")")6 R% R8 ~1 a# W6 `  K' L0 D
    (action_tile "accept" "(test-main-ok)")9 o0 ~: I/ T4 a) }! E7 M3 k

& z$ k1 F0 W1 h" D! t) I% u    (if (= (start_dialog) 1)
- o$ l8 M, M  z' D2 _' e; S# B) D      (progn; O3 [9 q# R2 N: q# ~
        ; Update special properties for polyline and text selection-sets.- `, N: J- `: u9 ^
! a5 R: l- c) M  R/ F9 t6 h' X
        (if (and (= 1 (logand 1 eflag))   ; polylines rk chprop
1 P5 j8 d  z$ \; r5 U                 (or ewidth! Z( }; u* f0 e7 C# \- @
                     eelevation+ Z% H4 f- ~9 C: R: M: [! Y: O- q
                 );or6 x" S6 h- f& r+ b" Z
            );and3 S* y! a3 p) h; g7 W
            (progn) G$ q' |# j$ H( O& K! }
             (setq  ss-index 0
0 Q- Q- [3 r  L! S' K9 W                   ss-length (sslength poly_ss)
; F; R$ t- I2 ?. w$ d- r! a             );setq
/ k1 q$ C3 }  N             (while (< ss-index ss-length)
" m/ B$ I7 i! f; b+ j, c               (setq ename (ssname poly_ss ss-index)
9 n" _4 d3 V) E0 g                     elist (entget ename)
* f) m) |: y4 i" ?               );setq$ v  n: {7 c1 U4 y0 s7 G# b4 j) Q* Y
               (ucs_2_ent (cdr (assoc 210 elist)));this function lives in ac_bonus.lsp
" V. y! l# }" Z& M8 Y0 i' L               (if ewidth
' U+ ^- a1 z' a: j                   (command "_.pedit" ename "_W" ewidth "_x")" a' s) v+ g' u: e% M8 S
               );if - ]7 S% ]  L1 O: u% H+ B* I8 m
               (if eelevation
; {  x) C6 t2 w                   (progn# h* k2 i( g4 P6 L7 q
                    (setq p2 (list 0.0 0.0 eelevation));setq
' X7 o8 T( x- j/ J% I- x6 ?0 D6 W/ W                    (if (equal (cdr (assoc 0 elist)) "POLYLINE")* U, T2 L. r& Y7 a9 P- b
                        (setq p1 (list 0.0 0.0/ ~! C1 s  s2 `3 @7 W
                                       (caddr (cdr (assoc 10 elist)))7 S& H" ?' f# X+ O9 E
                                 );list4 Q4 c+ v) `. \: x  M5 a
                        );setq
3 ~  @8 I+ ?: Z' y) J' q7 x  A                        (progn
% M& @1 s0 ~. I6 I4 s7 s0 `                         (if (assoc 38 elist)
: N  Y! x* ]) o' g, E7 J0 F                             (setq p1 (list 0.0 0.0
7 M% s$ f% U! e# K' {2 s                                            (cdr (assoc 38 elist))
! a5 c" t9 t, k                                      );list
7 v+ s# K* f0 P' i                             );setq3 ?% m! d  g1 f7 e, `8 T( @
                             (setq p1 '(0.0 0.0 0.0))
4 b4 g$ T: J) ]0 N                         );if4 |" b- l6 ?6 U6 B
                        );progn ( a6 a! p( U+ f' D# g4 R8 E9 L9 ^
                    );if2 u1 D8 ^+ \0 M$ F* A. p' S" O3 q
                    (command "_.move" ename "" p1 p2)  j" R! c1 {; z4 L* C1 p
                   );progn then change the elevation of the polyline- @5 ^* I1 U1 H/ ^2 a0 D
               );if' o9 U! \3 E6 x' C: `( e
               (command "_.ucs" "_p")7 z" R1 B3 f  i1 I% e0 _/ J# r4 s
               (setq ss-index (1+ ss-index))
+ ^0 B2 a. B0 r3 T             );while
. m* i- m5 Z7 z" k4 b, t           );progn then polylines are in the selset+ O1 D" Q6 l. |" s% U
         );if
$ v; x4 [; [& P! H         (if (and (= 2 (logand 2 eflag))     ; text- Q) ]2 a+ j4 S' s) m$ y
                  (or eheight 9 m' B/ Q/ d3 U, d. D& ]
                      estyle$ Q/ O: }0 }( W  I
                  );or0 w2 i# p# w8 q
             );and, }9 i. b+ T/ e- {! D, ?) H/ L8 |
             (progn. P  }1 r0 f! ]- `5 O
              (setq ss-index 0 ss-length (sslength txt_ss))
/ [; W( w: Q) ~& `9 G' P& f4 C2 t  T# u              (while( u. |  E6 F  j
                (< ss-index ss-length)- C3 L5 j$ R  ]5 o" C/ H
                (setq elist (entget (setq ename (ssname txt_ss ss-index))))$ y! c. {% m* C6 P8 h
                (if (numberp eheight)
, y# _7 U1 d9 E$ [! _0 l! y                    (setq elist (subst (cons 40 eheight)
: G  {+ Y. N' q' B! K2 g9 e" f7 F% u: H                                       (assoc 40 elist)
; l3 v' {, d. V& H; D8 a, ^                                       elist
* }9 a' {& \! d8 v- S* H, E                                );subst
" ]: _" e4 b' g" p6 U                    );setq( n* s5 b% \8 w: f$ I9 A
                );if
1 ]4 d) i( X$ J6 j% a                (if (and estyle ;(not (equal estyle ""))
* W3 l/ J% u- k  f8 |) y$ q  M                         (not (equal estyle (cdr (assoc 7 elist))))# G9 P2 O4 g  p+ t5 ~
                    );and. f# ]* B$ J& Y' Q, w
                    (progn  
3 t( m' w. S* P2 n                     ;rk. This needs to be implemented as per mtext font issue in                                                                                                          ;    ddchprop_notes.txt
+ y8 I' L0 |7 x" h( {* L, n3 `                     ;(if (equal "MTEXT" (cdr (assoc 0 elist)))
, o9 v9 R  Z  p/ B: Z' z3 U                     ;    (setq elist (fix_mtext_fonts estyle & c3 C, O( Q) r; D. I+ E/ k
                     ;                                 elist/ ~3 E3 p! k/ _9 I' p
                     ;                )! L2 o. R  e: x1 b+ C7 [0 T
                     ;    );setq then
- Z. w) q3 P1 x+ ?5 A                         (setq elist (subst (cons 7 estyle)
( g% {; {( f: y( D& j1 @                                            (assoc 7 elist)
7 w; v. m  l! e- B% |                                            elist* P$ V- ^5 ]1 G9 j# X1 Q3 B- n  V
                                      );subst% G6 b7 {- d, Q  B- `2 m; X& S
                         );setq else; s9 J: F5 C- _/ ?8 \5 y
                     ;);if 0 J6 U2 r$ x  u. @+ @
                    );progn4 J3 j7 x1 y( A8 }8 E* I
                );if
! M) ^0 B) a% k( y3 J& F4 k* G                (entmod elist)
& M/ \- o! `# n, U                (setq ss-index (1+ ss-index))( U/ t' l* a9 Y9 `
              );while
( ^+ V; _) h+ V+ J             );progn then# w6 m% G- o' T3 A* _7 h" }, V. D* M
         );if8 J$ v7 g' I! N1 u/ C2 |% s
" D( Q- a& r# e9 M  F
        (setq cmdact (getvar "cmdactive"))2 s" n9 J9 v. s
        (command "_.chprop" ss "")
! s+ \  v6 ^; [+ e" n7 j        (if (/= cmdact (getvar "cmdactive"))  ; Is CHPROP actually running?' W; f! K) Y. n; ^# f: n  m. ?
          (progn/ \8 y# j0 @8 s+ B% @% e6 F- [
            (if ecolor* ~, o9 J4 ~. D6 U: d$ m( F. O* a9 M
                (progn- F$ L) o. s6 ]* R* U; T! I* v
                 (if (= 0 ecolor)   (setq ecolor ;|MSG0|;"BYBLOCK"))
% d6 z# E2 ^6 ]/ \                 (if (= 256 ecolor) (setq ecolor ;|MSG0|;"BYLAYER"))
9 A! V* q, B0 W- l+ ?                 (command "_c" ecolor)' \1 b- p. L, d
                );progn then
/ C) c  s) r7 t; H0 v, y; W& B+ T            )% y" v! O6 B  k* \- ~( H4 f8 o
            (if (and lt-idx$ C( K7 @5 v  k7 P; e
                     (/= eltype ;|MSG0|;"Varies")
2 N6 e6 ]; ^' ?. g2 a                )
+ N! T& f( e8 Z2 w7 E, _                (command "_lt" eltype)
" L9 {' x3 |3 e, l8 E            )* l. t5 [9 q: G7 ?
            (if (and lay-idx ) J: u: V; m4 E; u
                     (/= elayer ;|MSG0|;"Varies")
6 Y# w! s$ W( [' ]; D5 X" V                )
8 ~; b7 U" R- p/ L; {+ @                (command "_la" elayer)
" J) W$ w+ p/ m" c( {2 l( a, Y6 }            )
$ ]2 ]7 H5 g7 }6 }) F            (if (and ethickness ; _% i+ C* z8 B2 Y
                     (/= ethickness "")
- B* ~0 _2 `4 i                     (/= ethickness "Varies")
6 K* o0 y6 w" X1 I                )5 d* B& r0 J3 D! h
                (command "_t" ethickness)' l3 `& O: B' C! Q' k7 O  s
            )" U! \5 Z0 q5 l7 P% W
            (if (and  eltscale (/= eltscale ""))
2 D2 J# S9 {2 A2 p0 |; c                (command "_lts" eltscale); s, ^- I% [, _' P; l/ V
            );if' q2 `6 q7 u5 K$ W  {1 n
            (command "")
: c3 ^1 S! I3 s+ k. }2 S* o) R          )- c0 @0 t4 J6 R) D+ G
          (princ "\nProperties unchanged")  ; CHPROP didn't like our SS set) U! X- \- W- _0 K$ D: D& X7 s! u
        )
8 P. m1 z* `+ K) f. g. q% g; |/ Z! L6 ^0 K
      );progn then OK was picked in the dialog.# ~/ o# C# l0 Z! y8 E+ q6 r
1 N) m0 g2 E' m5 a: @' z; ^) C
      ;; Fred GERBER - 25-AUG-947 X$ L2 z1 D; n; A: W* ^$ |# @7 ^2 B
      ;; Don't print the "Properties unchanged" message when the user cancels) U/ f- P9 K% z: C  M, H
      ;; the dialog because he knows that already (otherwise he would have, V1 h9 v  [4 z! w
      ;; hit the "OK" button). Display the message only if CHPROP fails for6 n+ m9 n- Z, \) D) y. i& x
      ;; some reason, because it is not the expected behavior of the command.
1 h  H2 t# t6 V      ;;  A0 c7 Y5 m& C- Y
      ;; (princ ;|DDCHPROP2_LSP_8|;"\nProperties unchanged")
2 X" G7 N' k- s' E& T& w" E    );if
; V% t- G. C# h    (princ)6 b4 L8 z( L2 ~' }3 K6 D
  );defun call_chp25 b; F; ]1 f) b- M
  ;;: x" M+ Q9 k% {1 \' {
  ;; Function to set the Color text tile and swab to the current color value.
' Y8 S' Z8 V0 r' z, H: J  ;;
/ T- L  n, |+ K' _5 E0 h  (defun set_col_tile()
2 J& a) `/ I- g( a8 y0 T    (cond
: h" z9 b" G  _, H6 z      ((= ecolor nil)  Q$ h. ~" e. Q, N
        (set_tile "t_color" "Varies")! T( s$ g% k- k) {
        (col_tile "show_image" 0 nil)& ]. k& A1 t0 q' B
      )
, M1 _/ [  ?2 v% K6 }. J- z. L  e0 U, X      ((= ecolor 0). V' ~3 W( |8 J4 y' `
        (set_tile "t_color" "BYBLOCK")
* p" @' g" L( _' J        (col_tile "show_image" 7 nil)    ; show BYBLOCK as white
; N3 e* l9 ?1 S; b) k7 {; e      )9 n) M/ x0 |7 [/ b  x. ?
      ((= ecolor 1)
: G6 N2 b  P1 m        (set_tile "t_color" "1 red")$ r" ~$ B7 c' z( B- m$ G
        (col_tile "show_image" 1 nil)
( k5 g  x0 d2 `9 G- F1 l# [! B      )0 I# y' c, w! m* g" l
      ((= ecolor 2)% s3 R8 u( v; z9 R
        (set_tile "t_color" "2 yellow")4 K7 K( z- e5 Q' S; C! `
        (col_tile "show_image" 2 nil)
% K" a& v4 U7 t0 I& w9 Z8 ^      )
* s$ ^: Q. r! F) t      ((= ecolor 3)
- ~  `; m+ i& B; A  e: M0 \' F        (set_tile "t_color" "3 green")- {; J0 A$ d' @2 \
        (col_tile "show_image" 3 nil)
3 q; j0 Z/ _/ C( d' ^      )4 M+ D5 K( \" ^
      ((= ecolor 4)/ |, d2 c( e' o$ y6 Z
        (set_tile "t_color" "4 cyan"), w- v& F1 O' |" f8 N4 y8 P
        (col_tile "show_image" 4 nil)
9 _! C: Z. q8 h4 A5 v6 L      )
: `4 {$ A) K0 u; F- H      ((= ecolor 5)2 t6 o& c/ O: ]7 d% v1 g0 l/ g
        (set_tile "t_color" "5 blue")
* M$ i) d. M- S, [2 J# T3 g        (col_tile "show_image" 5 nil)' v$ u9 z* y6 h' l1 q
      )6 k' m5 u: i) Z2 i+ e& ^8 _; x
      ((= ecolor 6)
0 [8 m4 m( v; _8 k4 ^; `        (set_tile "t_color" "6 magenta")$ ~6 c3 }, o: n
        (col_tile "show_image" 6 nil)* C! Q0 n( w" R( @! R; X" z; f) X
      )
; K8 p" P2 o' Z% s3 K+ k      ((= ecolor 7)
9 @, v6 T  q) v6 l7 E        (set_tile "t_color" "7 white")
/ W6 O! u2 O7 F$ ?        (col_tile "show_image" 7 nil)6 l3 J  C8 [% D& N. c0 r% C
      )( \" ]4 k& u9 l3 z! d. N
      ;; If the color is "BYLAYER", then set the tile to
8 ^$ }  Q, {# S* ?, K6 U+ |      ;; show it's set By layer, but also indicate the
6 P. c& g' _9 {      ;; color of the layer - i.e. By layer (red)5 T) d" R! ~, s  d7 b& R  \4 w; y
      ((= ecolor 256)* U. P( t# B- U8 ^
        (set_tile "t_color" (bylayer_col))
5 Y: t2 O' B2 T& a& H4 F  a        (col_tile "show_image" cn nil)
! C+ g: Z8 z: }/ E7 U0 N      )
. K+ ?7 Z2 u( d      (T
" |$ P5 E, }/ l6 y" S* ~        (set_tile "t_color" (itoa ecolor))
8 N& j  U2 W3 l$ A' j        (col_tile "show_image" ecolor nil)# W. ]4 z5 C/ M: p! s- m3 D9 V
      )& \, `5 G% e, m& c$ ^3 H7 i, ]0 P
    )
7 a6 g' B0 f/ o  c  )
( U0 s. D7 W' I! C, t  ;;1 m' I8 C9 f6 O
  ;;  Function to put up the standard color dialogue.
/ F2 X. M$ y1 ]3 F# R0 K/ P  ;;
) O* Y& n# p* l9 b) ]  (defun getcolor(/ col_def lay_clr temp_color)
; b9 G* i% s3 M" S0 T/ ]    ;; col_def is the default color used when rq_color is called.  If ecolor
) q- Y# ?' V- ?8 V2 D& d    ;; is nil (varies) then set it to 1, else use the value of ecolor.) i( {5 v5 i5 l9 s+ z& _6 W
    (if ecolor
% q( Y3 ]9 p9 o7 ^3 a' r      (setq col_def ecolor)0 l' j0 @+ p  X
      (setq col_def 1)
% T2 x5 k1 {4 i# [5 Q- G    )
: ]5 q) p% \' a, \4 f* H: B
& U6 b6 t9 D- |, P    ;; If we're working with a single layer, get its color
& h1 P0 J! d" H4 m8 C" J) D    ;; for use in the color swatch if the user selects color BYLAYER.; `* |+ f$ J; m: Q, d
    (if (/= elayer ;|MSG0|;"Varies")
* V) z0 {' ?( w& Y# N7 I+ I$ ]      (setq lay_clr (cdr (assoc 62 (tblsearch "layer" elayer))))( [$ n0 n% D/ O
      (setq lay_clr 0)$ w$ G  c3 q! j9 B9 c. d. U' r
    )
& y0 h4 }9 B6 z6 w6 X    (if (numberp (setq temp_color (acad_colordlg col_def T lay_clr)))
1 e/ [5 s5 K$ h: _: @! O9 [      (progn- W, |+ z9 A0 k; l
        (setq ecolor temp_color)
; a: n8 [! {, E: e        (set_col_tile)
: R, T# d9 k, J9 {  C7 P        ecolor
' ]/ O+ l2 y) H; e  J      )
8 b& ]( S! U, B" y0 o. @6 v      ecolor
$ c3 Z( I! ^, j    )
! i% \# T/ ]+ b6 i  )( l! j( U& @1 v& l9 f
  ;;
7 [* X! y! h3 G8 w& v8 |- h2 b  ;; This function pops a dialogue box consisting of a list box, image tile,
8 `' w3 }1 v. U! f  ;; and edit box to allow the user to select or type a linetype.  It returns: ?" u# x  w2 s( a, ?  o) R
  ;; the linetype selected.! e0 N  P, G0 p: Y
  ;;" i6 f  w6 x: h. w* d7 R" }
  (defun getltype (/ old-idx ltname)
+ Z; j; Q( W! H4 c- `7 O' t# W* p    ;; Initialize a dialogue from dialogue file
- Z" G& j2 X$ j; R  a+ h! G    (if (not (new_dialog "setltype" dcl_id)) (exit))
( V/ R; ~9 H; v' d  X$ D    (start_list "list_lt"). X% t: E0 o# f* W0 V
    (mapcar 'add_list ltnmlst)         ; initialize list box$ E: `0 @  T1 Q& u, t0 T
    (end_list)
/ E; B9 R  I: l4 g% O, @    (setq old-idx lt-idx)
( a# P  n, a; o- _1 k3 {0 k1 G  w    ;; Show initial ltype in image tile, list box, and edit box
3 k+ A) r5 N! {/ c4 K    (if (/= lt-idx nil). D# c; N' G" I" H# b; f/ S3 I
        (ltlist_act (itoa lt-idx))
" |* Z$ |0 q1 O( u- {5 \& K        (progn
2 O5 a3 b) e, h: H. x         (set_tile "edit_lt" "")5 x9 y0 w' n$ I
         (col_tile "show_image" 0 nil); a: x' J8 X5 S; U  F
        );progn else
% t( h2 H% S, s9 r* v. Z" V1 r5 }    );if
+ U/ s* z" u1 j  G. l( _; @7 m( ~3 n    (action_tile "list_lt" "(ltlist_act $value)")0 Q6 ]; {5 l' v; l
    (action_tile "edit_lt" "(ltedit_act)")
$ d* l1 n/ I+ U2 Y& d. S    (action_tile "accept" "(test-ok)")
% f$ O" a8 o  ?" `9 T    (action_tile "cancel" "(reset-lt)")
4 o9 l2 k% j, W    (if (= (start_dialog) 1)           ; User pressed OK1 }' |) t! G- ~$ m3 D. l
        (cond% D! e7 H6 i& P5 Z& W; q& g
         ((or (= lt-idx nil)
8 q: K* T; Z& E- C% J* I* g( v* x, L              (= lt-idx (1- (length ltnmlst)))
2 |8 O9 k  P" X( e  r1 t7 [          );or
4 l3 Z. `& W5 e/ o* E* W: w: c          (set_tile "t_ltype" "Varies")6 H% n! Z% D1 F. t: f( y
          ;|MSG0|;"Varies"
! K& t4 p, ~  Q         )# `& c8 {, I) Q' y+ B
         ((= lt-idx 0)
) h6 {- ^: A. W3 C8 q& ]          (set_tile "t_ltype" (bylayer_lt))& j6 {  J0 T5 y  k: N0 V. ?
           ;|MSG0|;"BYLAYER"
; R  h( ]9 Z5 Z5 `         )
: \. _4 ^( k4 T- C' {         ((= lt-idx 1)
8 m( X: h  F  d  w           (set_tile "t_ltype" "BYBLOCK")
" y9 l7 ]7 Y, c3 V           ;|MSG0|;"BYBLOCK"" K1 G/ a5 M& k* j) s& c
         )5 @# a4 H: j$ I1 r# o+ c
         (T
+ i& N. r" k) @5 j8 k& \9 }           (set_tile "t_ltype" ltname)/ P2 h' y5 c  Z1 o
           ltname- h, F4 [; `) @
         )8 z1 u, I- J( Y7 I
        );cond then3 v% m; \9 d5 p) i! p
        eltype: x; y/ c" v) Z, F! N& X
    );if
2 ?7 U1 u% c/ a4 {2 o' D) }  );defun
% p/ o, [/ w% @0 i  ;;
) ?- R) X' l4 k6 S0 B! y/ `  ;; Edit box entries end up here+ j* k# C, i0 U8 Z6 V
  ;;
. S3 Q! c8 D/ V# b7 q  (defun ltedit_act ( / flag), n3 ~' T& i5 y
    ;; If linetype name,is valid, then clear error string,
. B( r" z( m! X4 Q  R$ L    ;; call ltlist_act function, and change focus to list box." x5 R- I# ^7 v# h: k9 ~4 p
    ;; Else print error message.% o+ _' \9 ]8 u  }2 x; W% W
$ U* F" W4 }# J7 C
    (setq ltvalue (xstrcase (get_tile "edit_lt")))  Z% ]0 c1 F4 u1 o+ ]. x% H
    (if (or (= ltvalue ;|MSG0|;"BYLAYER")6 G- v6 W- F9 w7 E# T$ B
            (= ltvalue "BY LAYER")
9 k% E9 ]+ v: {6 a: Y( z  y        )- C3 }( f8 l8 n( h8 o- C
        (setq ltvalue "BYLAYER")
* {) ^% v8 u+ P5 c) h" S    )* `) ]" d. y% D$ I7 w) A  H6 R
    (if (or (= ltvalue ;|MSG0|;"BYBLOCK")3 C3 R7 G4 g# M9 q2 E
            (= ltvalue "BY BLOCK")
9 X7 ?8 B4 a2 u! G" @        )
/ [3 c3 ?- C6 D( K5 v' q        (setq ltvalue "BYBLOCK")
& W  V5 G, h& v- w    )1 D: }8 k. f3 ~- I; v
    (if (setq lt-idx (getindex ltvalue ltnmlst))
7 ]- ]6 J/ ?3 Z5 R7 o( D! \        (progn- Q* c& n" G4 T) N# k6 y
         (set_tile "error" "")! K+ \6 u' \, V! {
         (ltlist_act (itoa lt-idx))  z2 b0 D5 i7 C% d8 g/ w8 P
         ;(mode_tile "list_lt" 2)
  p, k8 o8 Y7 G+ X5 \7 Z& ?        );progn then- Z# Z0 h# D& ^/ j( ~$ `: \, U
        (progn9 H1 j; o7 Q* q% ~0 N
         (if (/= ltvalue ""). k. D! M! R' x' ^' L% K
             (progn- T# i+ |1 [$ K9 L7 o2 p
               (set_tile "error" "Invalid linetype.")
# R2 H& n- t2 Y2 S( J               (setq flag T)
4 `4 I% d! ~$ \' G  o- X             );progn5 c8 }$ R6 u4 i7 y
         )# m+ P& H9 N; E$ m5 S" \. D5 s
         (setq lt-idx old-idx)+ p- F8 Y: ~: [8 U- I1 Q) M
        );progn else
# ~( @; }4 a8 [- R8 Y    );if
* g, {1 i5 v" |* k5 ^    (if (and (not flag) ;added so a return will take you out of the dialog.
; C0 W, W; u" [             (= $reason 1)- r' T4 t% S. B5 F  c6 C6 T: v5 J
        );and
9 h$ M4 c9 x$ P4 N, Z6 h) ~' `        (done_dialog 1)
. z9 j7 |+ E7 J! g6 D3 y! Q    );if
/ H: G; ?2 x( r" x% S! a2 T  );defun ltedit_act
. }% I9 U: n; x8 z' z" M6 K+ y$ C! X  ;;1 Y: N$ J' S0 j
  ;; List selections end up here
- H( e$ o& h9 S/ \  ;;6 c7 Y6 ]# b$ g' x) g
  (defun ltlist_act (index / dashdata)
7 U5 s# M% V# {5 p. [4 t( b" I! d    ;; Update the list box, edit box, and color tile
4 u+ g; Z0 M  f6 E& O9 I    (set_tile "error" "")- Y5 g: Q$ o/ Y& L7 }! c! ]
    (setq lt-idx (atoi index))
: e' B2 x5 ^& L4 T- m    (setq ltname (nth lt-idx ltnmlst)), ^" B3 t& q+ a& u$ W( R
    (setq dashdata (nth lt-idx mdashlist))1 }6 F# j. ?" J) J8 a1 E
    (col_tile "show_image" 0 dashdata). c4 {) R) k% ?* t! h  `) f
    (set_tile "list_lt" (itoa lt-idx))' l3 D% J5 |% Z, Z+ l: \3 X, S* Z
    (set_tile "edit_lt" ltname)  ~5 T  |3 a7 {% Y) R# Y. t
  )
; s2 @  U; `3 p# p. f" M  ;;
/ C% j% }3 ~  a& w  ;; Reset to original linetype when cancel it selected
! M0 b  F. S* M5 G" m$ z+ Y  ;;8 e8 d4 q) D& l9 C6 M; ]
  (defun reset-lt ()( E  U6 H4 ]. k6 y( i* h) U
    (setq lt-idx old-idx)
5 i( g7 g$ @$ m9 Y! X$ B2 d    (done_dialog 0)
$ _6 P/ ~3 f& T. S8 K6 u  )
0 Q9 T+ s  F; E! J7 i9 r  ;;" B1 S1 q; T& `# M
  ;; This function pops a dialogue box consisting of a list box and edit box to
; U1 r* c+ J3 O8 }  ;; allow the user to select or type a layer name.  It returns the layer name- n* P8 n4 K  J4 I; C4 ?
  ;; selected.  It also the status (On, Off, Frozen, etc.) of all layer in the( y1 p6 C2 c# J
  ;; drawing.
' h, G7 j& ?0 D; [; b' k  ;;
' g( |6 a  ?6 x  (defun getlayer (/ old-idx layname on off frozth linetype colname)4 C; _; `, ^; F' m0 A, ~7 a
    ;; Create layer list the first time the layer9 @$ M$ _/ E3 Y* u/ u7 q
    ;; dialogue is called.2 @' v* G( t. Q4 A8 K/ y4 ?7 C
    (if (not lay-idx)% l( z: z! X9 W2 T% b
        (progn1 k! Q- z+ L9 X) w) _* ]& f) ?# X/ z
         (makelaylists)                     ; layer list - laynmlst# N* r$ {( S) D  \" w: ~: c
         ;rk7 f, z) V$ p2 P% V% _9 x
         (setq lay-idx (getindex elayer laynmlst))! D9 H' D% w' X; M* K
        );progn/ A& m3 c' d& {' _5 V# t
    );if2 H- m$ X6 m9 R3 ~1 F

1 X& u* H5 l, s, e% `6 D- ^% e! s2 P    ;; Load a dialogue from dialogue file
; ^/ U8 P- o( v+ ?) ~    (if (not (new_dialog "setlayer" dcl_id)) (exit))
- E  B; h5 O$ b; E; |1 ^: @5 j9 P    (start_list "list_lay")
# U& ?, y  k2 L9 U  `! q7 Z6 R0 h: t    (mapcar 'add_list longlist)        ; initialize list box
7 Q2 A# E# u' k, e2 e; h6 |    (end_list)* P8 P, z; r- \# |' _6 f
    ;; Display current layer, show initial layer name in edit
6 h. x* Y9 C' g    ;; box, and highlight list box.
6 T- n; w6 x& S% R7 [! G* y    (setq old-idx lay-idx)
9 c* T, F. _5 {' v' v    (if (/= lay-idx nil) (laylist_act (itoa lay-idx)))/ J/ b; ?+ P% }5 q) }0 O" v7 h
    (set_tile "cur_layer" (getvar "clayer"))
2 Y, `% p) h# [: ~+ Q% }1 G    (action_tile "list_lay" "(laylist_act $value)")6 L% E6 p/ v0 P4 f1 O1 Z9 D, y/ v
    (action_tile "edit_lay" "(layedit_act)")# F( _( Z0 R. K
    (action_tile "accept" "(test-ok)"); Z" q6 a4 Z5 D7 H& t0 o- y
    (action_tile "cancel" "(reset-lay)")* Z2 n( P/ _& Y4 y, K- e) s
    (if (= (start_dialog) 1)           ; User pressed OK9 Q3 U. m1 b9 Q- E8 {! ]
       (progn: Q" I" N9 ?  L* o- h# ^4 ?9 a' i
         (if (or (= lay-idx nil)) ~- `4 Q% g/ o+ z! ^# b: f
                 (= lay-idx (1- (length laynmlst)))
& S! `; s8 j) x, B             );or
9 |: Q5 f  B* G# V             (progn+ z& N2 M# Y# J0 _
              (setq lay-idx nil)  $ y: p; o+ Z. `
              (setq layname ;|MSG0|;"VARIES")
9 I1 _1 }: b8 D# Z! `( c# Z0 L+ D7 }              (set_tile "t_layer" "Varies")- Y5 I4 w$ a# [: t( A  L- G
              (setq layname "")! |/ p/ j9 _6 @
             );progn
8 s: U9 n7 v. s# _             (set_tile "t_layer" layname)
  B2 v0 q* y7 J: C( d1 }         );if0 e) I* b  p, @1 q& P& u
         ; If layer or ltype equals bylayer reset their tiles
& d: b0 ?- P; D3 o         (if (= lt-idx 0)* h: u7 o& _# y7 z' S
             (set_tile "t_ltype" (bylayer_lt))% W! Q( E! c6 P0 T  H5 M
         );if
4 j. G3 D0 O8 A         (if (= ecolor 256)! c9 K9 o# u# c/ j
             (progn3 J9 y  I: s/ V0 u) `3 \5 o; z: n5 ?
              (set_tile "t_color" (bylayer_col))
- Z/ s4 \" N' T2 d* ]              (col_tile "show_image" cn nil)8 W/ a% R% c) [7 d  D1 E/ z
             )! ~" z9 b1 V/ P. ]" Z
         );if
7 b/ j) g2 X& A2 T         layname5 p! s1 K3 L: y; Q
       );progn
6 M2 }. A; }3 R7 k       elayer
$ ^, b! F- w7 n- g9 A" {    );if4 ^0 G7 I9 f) C9 _5 W
  )
3 Y- L' {* m8 n3 y- c  ;;9 y% ^7 l4 t/ ]2 ], p
  ;; Edit box selections end up here3 V7 V- j/ z, @& N% T; k7 f6 O# a4 K! l
  ;;: P: x& ~- Z" G8 Y2 ~" O+ U" ?
  (defun layedit_act()
7 p4 k2 x! O6 y4 Q0 ]    ;; Convert layer entry to upper case.  If layer name is$ u) n7 V! G0 v4 L
    ;; valid, clear error string, call (laylist_act) function,
. I' E* {7 a6 Q; z! ]7 e    ;; and change focus to list box.  Else print error message.
: {& a4 N6 a$ z& u% j" x3 N    (setq layvalue (xstrcase (get_tile "edit_lay")))( R2 m2 }9 F0 ^5 V& e5 L2 L, P
    (if (setq lay-idx (getindex layvalue laynmlst))
& O5 _/ w7 V7 ?* x3 S! Q7 O0 i        (progn+ B& z% x" g2 N! Y' I3 m! Y( G3 w+ \
         (set_tile "error" "")
1 ~! W6 `2 T  U: Z+ e0 a         (laylist_act (itoa lay-idx))
2 L8 A" [2 E* x        )) D- Z3 ^& Y; D( C) n4 X
        (progn/ a+ ?" }3 W7 w3 {; n' O
         (set_tile "error" "Invalid layer name.")
& G) ]" b$ a  w% ~# S  S) I7 r" z' o2 p         (mode_tile "edit_lay" 2)* R, K$ ^+ q' D0 o7 d
         (setq lay-idx old-idx)  p5 n, w5 f4 J/ p$ f2 I! p5 l
        )5 H) W  B: K7 D, x/ d
    );if- ^) F, A- h' u& n2 Z& O% r3 Y3 b
  );defun1 `: H$ t' [; ]$ @) d
  ;;
" V2 G) M! N9 i, g  ;; List entry selections end up here  m4 Q0 a5 z$ y- n; J" n  ?
  ;;
5 b. z% O- {/ J! K( n  (defun laylist_act (index / layinfo color dashdata)- }# {. L5 X7 \% I. k5 w
    ;; Update the list box, edit box, and color tile
% y1 {. q, ]3 U6 T- \& m    (set_tile "error" "")
. p2 T7 J4 |$ W3 H    (setq lay-idx (atoi index))/ U9 u' h. H1 o- c% {( M0 [
    (if (not (equal lay-idx (1- (length laynmlst))))
; I0 k* y2 O0 B' {- c- R9 n        (progn 9 {" x6 C. y7 k2 }9 K" _: A4 w6 O* m" L
         (setq layname (nth lay-idx laynmlst))
4 s) `9 s" n: _! f- O         (setq layinfo (tblsearch "layer" layname))
9 V5 `2 P" T$ _5 o         (setq color (cdr (assoc 62 layinfo)))* n2 P, P" H* L
         (setq color (abs color))
7 I/ Y4 k: w: B- ~/ F' H& S% V$ S         (setq colname (colorname color))
2 e: w5 E$ [2 y5 T3 l5 N         (set_tile "list_lay" (itoa lay-idx))
$ Y/ D  @& A4 y9 f: d$ w) d/ q         (set_tile "edit_lay" layname)
( t3 s8 W, @6 x         ;(mode_tile "list_lay" 2)7 m* w! |# b' W  Y/ h3 L6 a
        );progn then ( j& Y& d3 R. e
        (set_tile "edit_lay" "") ' G6 n  I, d% _4 n7 y8 b" m
    );if
  J( x% ^, b+ A, d( f+ O  );defun laylist_act
! w/ r& p. y9 u1 S2 m+ \; P+ R  ;;
$ \7 ^3 r0 M" Y  u3 t/ u  ;; Reset to original layer when cancel is selected  ], E3 e; ^3 m7 r( J
  ;;. o9 X* `# |& v( }. Y+ ?/ n
  (defun reset-lay ()3 O# q6 G% B, L8 T6 T
    (setq lay-idx old-idx)
2 q% f7 C* x( U, i$ p    (done_dialog 0): c0 y, L- f6 S+ B
  )7 _$ a% n% b- n  X8 d7 g- U

, I6 T1 k  I; P0 i& ~) k  ;; Checks validity of linetype scale from edit box.  It checks to1 l- I$ ?0 F5 m$ c. f) p6 U
  ;; see if the value equals "Varies".4 k2 {3 M' q0 W1 F7 a  f" X. e
; A! K) j0 y. Y9 K+ y$ p& |8 L
  (defun getscale (value / rval)( _4 w+ t+ ?* O& d' A' u. B
    (setq value (strcase value)  ~6 [7 k0 b" z4 V
           rval (distof value)
- w- J+ A# B- H8 g    );setq' u) D) M, `4 Q/ e/ N
    (if (or (= value "")! U, U$ W$ |! {
            (> rval 0.0)
8 @( Z0 s! p0 H+ w" C  y1 w        )
# U! \* P! h* T8 g! ?$ d) b        (progn
+ E, L/ b- y# J3 Z8 ^3 _3 n9 x          (set_tile "error" "")
" W+ L9 |  l; U          (if (= value "")
1 g4 f, v. N/ ^              (progn2 N, t" L; K5 ]
               (set_tile "eb_ltscale" "")3 @1 k1 D' i9 Q
               (setq eltscale nil)  t4 x$ W& D+ t6 U  _
              );progn then* K5 e5 t5 Z2 h0 q8 ?4 b
              (progn- F  i+ J6 P  d1 b. {" j# _0 Z- |& N/ z' `
               (setq eltscale (distof value))! Z( u- ?' d" H- e; m
               (set_tile "eb_ltscale" (ai_rtos eltscale))! a6 B5 p; g2 V# Q! _- g* U5 E5 v( m$ C
               eltscale( V9 N; o) K1 b8 u' C5 \
              );progn else$ O' \9 a& k. V7 |& |7 O
          );if
* {. B1 h, O$ N# R3 d9 F( F        );progn0 `( W; _2 u- L
        (progn' y% w8 g2 x" F, H
         (set_tile "error" "Invalid ltscale.")
- H, j4 R* D, V" V$ ]% }         nil
) t+ Z' B1 y4 S6 B" E* w, N/ T        );progn else
+ _9 W  o4 A& t9 U$ D    );if3 V; f: G6 A5 F! F
  );defun
1 \7 v% V5 ?# s; u  ;;! [1 m8 R" y. M' H' {
  ;; Checks validity of thickness from edit box. Since (atof) returns 0 when a% V1 a0 C- ~6 e" l) y! W
  ;; string can't be converted to a real, this routine checks if the first/ B0 v8 `8 ]) Q7 U5 E" U4 u
  ;; character is "0".  It also checks to see if the value equals "Varies".
+ C5 \! @3 u) k$ G4 G# C% P) P$ _  ;;
9 p1 }* I( C; f$ f( |  (defun getthickness (value)/ d  l) R) y! [2 G+ ?& n  X
    (setq value (strcase value))0 M1 y8 C0 e2 F! I$ f
    (if (or (= value "")
; {8 F6 f, Q2 `2 H9 j; I9 G/ x            (distof value)! Q, \7 N8 `+ U- T1 ~  u7 B; }
        );or  e* X: z% {: [, ^9 y# _1 p3 u
        (progn
) ^0 F. N8 O4 w6 C6 H; d; o0 o# l         (set_tile "error" "")
) n$ a* \6 o& ]         (if (= value "")
3 j/ _4 P4 ]% r* k! S- K6 P             (progn( M: q1 T; `. f% F% G% h, L
              (set_tile "eb_thickness" "")* I( I3 m+ E8 Z# R
              (setq ethickness nil)
# m1 u& [" B  O' W             );progn
; ]) r$ Q' [' [0 f0 C: @             (progn# @+ y- V5 v7 N! t; ]. a5 T& ^
              (setq ethickness (distof value))
6 W: z, `3 [4 W! P# x8 n' F              (set_tile "eb_thickness" (ai_rtos ethickness))1 \  a* ]& L0 i( c2 w
              ethickness
" \* H& a9 I. s; x0 l; m             );progn0 f' X" i$ U* r/ U& ?4 u/ a
         );if
& P! c7 m3 [; {, C% ~8 O        );progn/ c* Q$ u( D# x3 f, a5 |, S
        (progn
0 R4 T' f4 ~6 E% A2 \          (set_tile "error" "Invalid thickness.")
* G0 U+ w6 F4 l          nil
, V- p& e( g* z        );progn/ C& k' b, p9 S* t# l1 n, z/ v
    );if0 J: F8 x. p) E4 g& b8 `" j3 v
  );defun + v: N: R* Y5 U, Y3 f6 d! d
  ;;
5 A- ~; w( i& T% @6 S  ;; Checks validity of polyline elevation from edit box.$ T' V+ T0 A0 X: l6 b4 j* ^
  ;;
4 R7 c4 ?5 N' W  (defun getelevation (value)
4 H' D( U2 A; k7 g% r    (setq value (strcase value))5 B/ b4 z0 g% Y& E6 k( W& S
    (if (or (= value "")
0 ~( ^" l1 u# h  `' p            (distof value)
* o1 k# ~9 @) j1 w$ C: Z        )
" Y/ N3 q/ j' k( c! o# P6 ]- X        (progn! v& b* G9 v+ @" D- ^6 o& x
         (set_tile "error" "")9 }" |- ?* ~- I6 n! f: w
         (if (= value "")
" }  o4 O6 `" s4 C" q& M3 J             (progn' \- ?, n/ a7 q, B, M5 @- \! {
              (set_tile "poly_elev" "")+ {- p$ g2 C" B' U) w! w
              (setq eelevation nil)8 t! I/ Q$ O# x; [' ^# U
             );progn3 n, F% C' S$ ~: r
             (progn0 ~* T- E; {- D+ a6 j8 Z
              (setq eelevation (distof value))
# C7 p5 X- w2 b  W" d! R, C              (set_tile "poly_elev" (ai_rtos eelevation))
: O) l. c+ r* G. Q2 n7 \% W              eelevation
3 y' j$ ~3 D$ m+ |             );progn4 W* t$ Z3 u, N6 a9 F' w* h& Q- C
         );if4 i" R- D  Q+ ?3 `. ~, z1 P' k# ]4 Z
        );progn
2 ]% i  b9 d2 z2 j* M        (progn
: I, W4 H+ K1 p$ H         (set_tile "error" "Invalid elevation.")
( z$ I$ z. V% P9 Z1 e         nil- g9 l8 F2 [7 u" \* c$ q4 ?
        );progn( x0 L' _/ s; H
    );if# l! G8 T7 q, ~- Q4 |
  );defun
& w3 o; j, I$ [; x4 a  ;;
+ l2 O+ ~+ F8 L- k* W  ;; Checks validity of polyline width from edit box.% Z: e: l" i: a4 s
  ;;" Z7 T4 y# n8 ]6 q8 l
  (defun getwidth (value / rval)% d! A0 f- |3 i% c5 h2 m# j& r
    (setq value (strcase value)6 [( e) `* _, ?! S
           rval (distof value)& x6 b+ ?0 a9 _% t; V# W& H; n  {
    )# q% B' W+ k6 P; o2 y% U
    (if (or (= value "")$ J' X$ q3 g7 K" m3 o' f
            (>= rval 0.0)
2 x: b( T& v, e7 g* ?7 I% C        )) x* X& n  J$ r
        (progn$ n4 V# L3 Z* C- r" W! @( h4 s
         (set_tile "error" "")
2 b2 K# R! A; Y& i$ m/ _1 Y         (if (= value "")7 B3 Z0 ^/ n1 f8 a# n
             (progn1 h/ ?7 |& W3 |
              (set_tile "poly_wid" ""). T: h( s3 Q1 f, S1 h; a" m
              (setq ewidth nil)4 k6 A1 _5 a0 \. |: ?7 ^
             );progn' [7 H' i9 @% c8 `
             (progn& g: `/ }1 u% Q/ f( Q$ Y
              (setq ewidth (distof value))8 C9 D' G6 F. ^1 x
              (set_tile "poly_wid" (ai_rtos ewidth))% ?& A  x+ ~# ~
              ;width
5 G. t4 ?) N! I+ r: F# [4 s9 z             );progn: z( U9 N" S# M# N# J7 G* ~
         );if3 F% i& O! U5 G
        );progn
7 E( R8 E4 q1 p        (progn  p) N6 N" b+ V5 }4 Q( X
         (set_tile "error" "Invalid width.")
! H2 J8 y) @5 \5 p8 Y         ;(setq ewidth nil)
3 n( p- g; z/ o         nil
: j6 x# M4 X7 `3 I0 s) k8 s        );progn
! Z- C  ^! @! k    );if
# T; `1 b; U* M  );defun
: v5 B" g# B) |3 o, m4 p  ;;
" H9 x/ B2 c" m  L  ;; Checks validity of text height from edit box.$ o/ R2 c. \7 M$ s. Q
  ;;, o" U7 w' L7 U& ~
  (defun getheight (value / rval)" F1 ]/ w4 o) _6 y
    (setq value (strcase value)" }  F' H; d7 R/ ^: ^$ Q! |0 G
           rval (distof value)
4 a5 {4 y& c: c: g* |0 `    )
- P9 K8 s" E* \$ B1 Q    (if (or (= value "")/ t6 G; X/ X' A7 [. s3 ^
            (> rval 0.0)
1 Z" Y1 T) R$ q3 d$ c* H8 E        )
# |' O5 V. D( e; r5 W7 S        (progn! g: v: V; A/ F# @! B2 D: }
         (set_tile "error" ""); s3 U- |; t0 f+ K
         (if (= value "")
) i0 v4 f3 n0 E" p             (progn
! [+ j5 d% N( c( j2 C& Y/ j              (set_tile "text_hgt" ""): D: x1 R7 x/ t, h5 r9 U6 I7 Y
              (setq eheight nil)* O+ y& F( @4 q! u! y
             );progn! _, t# s! n( K) p. w) E# a# P) }
             (progn) [/ J- B, y- U5 b
              (setq eheight (distof value))
4 J# r: {9 N* |5 E" P              (set_tile "text_hgt" (ai_rtos eheight))
9 j3 k. E% |' J- j' Y              eheight
& J# r/ y; w2 n" r             );progn
; x; @2 Q6 }- f2 {         );if
2 r7 R3 S" W; y/ d( A! |        );progn1 M! r/ ?' \! ^4 M7 Q+ P
        (progn7 G) V) x& E, P
         (set_tile "error" "Invalid height.")
; j" u* R) ~! v' V! m; S         nil
  D/ \! [; d3 g: ~( r" @2 j& s        );progn+ U- Y. N1 _" ~
    );if
+ ?% r: e5 a1 L3 H1 K$ P  );defun
3 p  k: j* B# w* Z& D6 e' P7 r' b$ b
  (defun getstyle (value lst / rval)8 M+ }6 s2 l, b0 j
    ;(setq value (strcase value))
! M$ @8 P+ h2 M& C* e8 _    (set_tile "error" "")
$ f: l, q1 w! F$ J1 G3 I  }    (setq estyle (nth (atoi value) lst)), _# g$ H0 O/ Q) G: q. Y0 U/ ]
    (if (equal estyle "")
" ]4 l% v/ y- _! Y: V        (setq estyle nil)
7 y; h$ H+ i( S; A( N- m0 A9 V    );if& s! Q- a6 c; q/ H8 k* ?
# R' C6 n9 _8 g( j+ p
  );defun getstyle5 m7 p' R3 Z& ^, L$ v
7 T" w+ k8 s4 L$ e; W
  ;;
% \" [  s) N  ^# u* o  ;; This function make a list called laynmlst which consists of all the layer; j, R9 T" V/ v& C" ~0 U5 k- L
  ;; names in the drawing.  It also creates a list called longlist which; K6 f* Q, B& @: y' Y
  ;; consists of strings which contain the layer name, color, linetype, etc." L1 p+ k, q$ a+ @! P0 y- B
  ;; Longlist is later mapped into the layer listbox.  Both are ordered the" J4 ~* e  ^5 u" H5 R3 ~7 K
  ;; same.
) ?& L9 e/ l4 L& W& d, q  ;;5 B% w4 a, v8 o' O
  (defun makelaylists (/ layname onoff frozth color linetype lock vpf vpn ss cvpname6 r; E3 y, a$ p! A' y, ^7 V
                         xdlist vpldata sortlist name templist bit-702 N2 O2 M- b+ R" p% l! C- G9 E
                         layer_number
# S; U  m* v% H4 s( m) ?9 ?& u! `                      )
" I7 c( _& ^# M  N! [  _" e    (if (= (setq tilemode (getvar "tilemode")) 0); y9 }% i+ O) D
      (progn% @* O- U! M- }' t" L* p: E# N
        (setq ss (ssget "_x" (list (cons 0 "VIEWPORT")
! e- m+ j0 b0 E9 _, a- m                                  (cons 69 (getvar "CVPORT"))* @1 r- z7 o. x3 b  T
                            )5 P/ ~0 S2 R# m/ B7 P1 X' o
                 )) n* O# ?" v) e0 T) R
        )
* V8 \% O; e, R        (setq cvpname (ssname ss 0))
1 _! [6 O5 r3 O: Z$ p        (setq xdlist (assoc -3 (entget cvpname '("acad"))))" N0 \# h: I( n# P
        (setq vpldata (cdadr xdlist))
5 Q6 G: z1 l3 j( R: U0 L0 T      )
4 N. G& V. q, e, `    )$ X; a% M% t6 s) k& C
    (setq sortlist nil)  B* Q1 N/ @+ [! S
    (setq templist (tblnext "LAYER" T))) H1 [% {* I9 A) y2 G
    (setq layer_number 1)
. D5 w+ L) s9 ~8 y4 w2 A  R% f/ f7 ~    (while templist
5 I" R* g0 o! e3 e$ Y      (if (not (equal 16 (logand 16 (cdr (assoc 70 templist)))))6 _  G) Z* h- n6 f- x
          (progn  
" S( s, ?5 M5 R  j           (setq name (cdr (assoc 2 templist)))
- p5 l$ t. G7 d# i           (setq sortlist (cons name sortlist))  ^( Y% T0 V& u5 M- E. f
           ;; Not dead message...% p$ q/ E( _6 }7 A" w( Z
           (setq layer_number (1+ layer_number))3 q% f7 Z: n- G- b
          );progn  [+ g2 L1 o! E0 A* e  ?, M# S
      );if
2 g1 @( P! V3 e/ q8 Z      (setq templist (tblnext "LAYER"))
  a7 A) Y7 `& p4 A+ ~7 q8 R# d& d      (if (= (/ layer_number 50.0) (fix (/ layer_number 50.0)))* e7 B+ _1 c1 Z+ K- t9 e( B
          (set_tile "error" (strcat "Collecting..." (itoa layer_number)))
& _' m7 Q2 z( w: d7 o; v) p      );if
5 a2 [* `* h8 m. g! |/ E    )
8 U) B/ g+ k  c+ }    (set_tile "error" "")
% O5 `. k& s4 U  s' f    (if (>= (getvar "maxsort") (length sortlist))( j- @6 b- u3 n) \: w, b- p
      (progn6 X' y! p$ h. P  Q
        (if (> layer_number 50)
- N+ m+ T$ o, I8 x          (set_tile "error" "Sorting...")
( \, g6 r7 b% E0 Z( Y        )
8 {- L, w8 O7 d9 ~+ ~$ [/ l        (setq sortlist (acad_strlsort sortlist))4 b' i3 Q( p/ _
      )
1 z" D* J' i0 ?8 n; t9 r; x3 I      (setq sortlist (reverse sortlist))+ J: v# k% D; v6 G) U
    )1 Z! R, t) s1 @. \
    (set_tile "error" "")6 X( p- ?( J) o6 _# B
    (setq laynmlst sortlist)
) \8 j& G& [. k0 p9 y+ ]3 G' w    ;rk 0 G; G' a/ ~7 t' v  I/ t/ Q6 d
    (setq laynmlst (append laynmlst (list "")))     
0 G: T: K1 X! f- ^1 p3 ?; R% s1 R' ^, F- b/ T0 J# U
    (setq longlist nil)
4 S3 M3 m  V4 Q( Q! w& i1 M7 @; l    (setq layname (car sortlist))% i. C) ~' C9 f& x! {+ ~, [- L
    (setq layer_number 1)$ S; |8 h5 @+ X$ y
    (while layname7 {. o0 K* o2 i% J/ e! E
      (if (= (/ layer_number 50.0) 7 d/ R7 J0 e* P- Z
             (fix (/ layer_number 50.0))
/ }& H% i" h9 {) D4 ^( w% Y          )' o. k; q0 c3 G) j+ U4 U* {
          (set_tile "error" (strcat "Analyzing..." (itoa layer_number)))5 p* ~$ H* X# y2 |
      );if, _( t( ^% f2 F& V5 R8 [
      (setq layer_number (1+ layer_number))
, s; O! T! Z" Y" f  Z) Z0 U6 A      (setq laylist (tblsearch "LAYER" layname))) C* a( d- o2 U$ ?. s' P0 |
      (setq color (cdr (assoc 62 laylist)))
9 a5 T( y  H  ?( Q      (if (minusp color)4 `  F1 q6 M+ R* g, b0 L5 Z
        (setq onoff ".")! ]5 T$ L+ c* U' ~
        (setq onoff "On")
1 E0 H/ M, s6 i% E7 M( c. d      )5 b. L& E3 t! R5 `
      (setq color (abs color))' I% \# ~; K- I) c- [: J" x# s5 ^1 j
      (setq colname (colorname color))6 S2 U; l' u4 ?: f! c# G2 Q
      (setq bit-70 (cdr (assoc 70 laylist)))6 k& t) t- b) h8 _" g# r/ I
      (if (= (logand bit-70 1) 1)
; p" ~! T9 g5 ]! I" }/ Q2 G2 g        (setq frozth "F" fchk laylist), K; r. Y0 w" F; D  Y* q: o8 x% v
        (setq frozth ".")9 N0 {, r2 k1 _! t( U5 Q, }4 F7 x
      )
$ m  ~5 r( V* I) W2 \  J      (if (= (logand bit-70 2) 2)0 ~, k5 L* k7 h0 s
        (setq vpn "N")
3 o" H" m8 H; v2 Z        (setq vpn ".")
. ]+ \& d' b0 r4 G      )
# N- }1 _/ M$ @7 ?      (if (= (logand bit-70 4) 4)
- b8 n! x, Z6 d* l% ~        (setq lock "L")' K+ Q, E5 J3 y
        (setq lock ".")
7 }- Q! Z2 e* S# d      )' U# U8 Q, Y. F- |* k8 s
      (setq linetype (cdr (assoc 6 laylist)))/ R' I8 ]& p3 j" q* w/ M
      (setq layname (substr layname 1 31))' Z" C# F9 ?3 J* d* y1 g, Y
      (if (= tilemode 0)
! p' C+ P" y+ c) `+ X5 p% y# D# `' T& [        (progn" d$ W+ z5 C, O) I
          (if (member (cons 1003 layname) vpldata)
2 u/ M- E, b2 P            (setq vpf "C")1 d4 P% |; D4 ~5 X$ n
            (setq vpf ".")5 ~; Y) g  f5 g( }4 S
          )
+ r" C( C8 e# b+ n. z8 `0 E$ K        )
3 r9 \# W& Q. m2 x' M  _- ?9 s        (setq vpf ".")5 p) V( Q: |1 e4 p$ ]
      )
: ~1 j. r; F. }% I1 U, J      (setq ltabstr (strcat layname "\t"% b: b# O% L3 J9 n7 O
                              onoff "\t") w* D- z5 r) F' x& J; o
                             frozth "\t"
; |4 \% b) A, p2 X+ ]; G: u- V+ X                               lock "\t"
. F* P# T: n) J7 A3 ]; H3 I                                vpf "\t"  p0 V: e  G  k% j" v
                                vpn "\t"
# O1 F7 T, B0 L0 v, ?* k, i                            colname "\t"& d, n9 }# L# T& q8 L
                           linetype
" g/ p  p( L( P' B                    ), @. ^( s+ J. s$ G7 J
      )+ S3 i! c( L8 N" K2 Z# u
      (setq longlist (append longlist (list ltabstr)))
# j' x2 N5 ?; c, Y7 ]  G( x      (setq sortlist (cdr sortlist))
3 n: R8 {" g7 k- K  w# W' q/ s5 k, `1 O      (setq layname (car sortlist))
8 s' r+ U/ F" a, g    );while: L  f8 c$ w8 C* n1 w
    (setq longlist (append longlist (list ""))): R$ D" G5 t  }, b" n5 L. n7 \
    (set_tile "error" "")2 [) q( u9 O6 U( s% [
  )
- v0 \- h" w7 z  ;;0 O& H  M3 m) o6 D
  ;; This function makes 2 lists - ltnmlst & mdashlist.  Ltnmlst is a list of
% l/ M# _& `$ T0 g6 E# [: S/ P" k7 Y! j  ;; linetype names read from the symbol table.  Mdashlist is list consisting
8 Q9 A) }, z" s% p  ;; of lists which define the linetype pattern - numbers that indicate dots,
+ j& V$ f! b; B  ;; dashes, and spaces taken from group code 49.  The list corresponds to the) a* [4 x4 h2 u' {, u6 f
  ;; order of names in ltnmlst.8 x: R4 F9 y8 T
  ;;4 K8 p0 w0 [3 i
  (defun makeltlists (/ ltlist ltname)
. x& m0 Y; D+ `. n' L    (setq mdashlist nil)
' U* C" G  l  O2 }* p    (setq ltlist (tblnext "LTYPE" T))
2 e9 M# E) l. x' V2 o3 @    (setq ltname (cdr (assoc 2 ltlist)))
" K- i; h% m% R1 ^9 F- P: |9 k    (setq ltnmlst (list ltname))
6 \  k( k$ ]# Q4 H/ M/ e1 M4 n    (while (setq ltlist (tblnext "LTYPE"))
0 K# D) l1 a+ W% i. v" j+ g     (if (not (equal 16 (logand 16 (cdr (assoc 70 ltlist)))))) G% A, S+ F+ @& R: i0 }  X
         (progn   |6 H3 }2 a# H3 L' K: h8 n
          (setq ltname (cdr (assoc 2 ltlist)))
: y0 _0 `( a2 c8 \7 r          (setq ltnmlst (append ltnmlst (list ltname)))
5 L* e  |, W( V         );progn
' \. Q: T3 i6 W# ?) f9 N) `( Q     );if
: M3 U* U2 p' d; `    );while
6 J* H1 E, y- E: E/ C    (setq ltnmlst (acad_strlsort ltnmlst))
, \# d% a( T/ o0 g    (setq ltnmlst (append ltnmlst (list "")));add by rk 6 i- _  ~7 _9 d& z+ ?
    (foreach ltname ltnmlst
0 k/ X, `8 a" D) H) k; I; O      (setq ltlist (tblsearch "LTYPE" ltname))
" K1 P9 m/ C3 s+ X. d6 Q2 ^      (if (= ltname "CONTINUOUS")1 I" ^- N3 n: ]
        (setq mdashlist (append mdashlist (list "CONT"))): [' i+ f: N$ W3 o. I+ i# \
        (setq mdashlist7 ^6 x- d" G$ A- g% N
            (append mdashlist (list (add-mdash ltlist)))5 _8 e5 J1 E# X' F5 c+ Y/ i
        )% F  o% R0 ~* M+ L* i
      )
8 X$ H5 R% v  c  s# h0 c8 t& \    )
* z+ ~' E8 Z  Z, g8 n    (setq ltnmlst (cons "BYBLOCK" ltnmlst))! n& F2 `$ P9 e5 ~) ^
    (setq mdashlist  (cons nil mdashlist))( K, \( M- o( k3 d. i5 Y* d2 _
    (setq ltnmlst (cons "BYLAYER" ltnmlst))
9 F! C6 l& M% n% O; f5 W    (setq mdashlist  (cons nil mdashlist))
: @8 x$ ?3 c1 O  )9 y8 \9 f1 {! E) A; h' D
  ;;
$ b9 y# }) o/ y$ d1 S  ;; Get all the group code 49 values for a linetype and put them in a list5 P% K9 r8 B1 @9 d
  ;; (pen-up, pen-down info)
0 ~2 x. T; [2 T( ?3 O. W6 S  ;;
1 |; N& ^- m2 i) v& H  (defun add-mdash (ltlist1 / dashlist assoclist dashsize)  v; J- d+ Y! ^5 C; f2 ^8 _
    (setq dashlist nil)
, C/ f! \  Q  g! w9 a& i3 D    (while (setq assoclist (car ltlist1))/ C, g. U0 F9 ^3 J. [9 E. u9 b% n6 o
      (if (= (car assoclist) 49)
  E/ P4 _, ?. _& ]. \9 M        (progn
" x) ]( f/ W& S          (setq dashsize (cdr assoclist))& m' j) \/ |- @. J7 I$ A
          (setq dashlist (cons dashsize dashlist))
1 T! ^" F+ Q. q/ b# b4 a        )
6 J( s/ F9 ^! u2 ?" T5 }  J! M      )
6 m8 o; a% H6 W5 p( i% o      (setq ltlist1 (cdr ltlist1))
: f% Y& M$ v" u6 z( M    )0 A, S+ X; g( l0 l' o8 i6 k
    (setq dashlist (reverse dashlist))
+ q2 Y5 f7 r/ k# I+ m) N" W# V& ^  )& F( z; e: D6 E
  ;;% o: h, L3 j0 y4 V! Q
  ;; Color a tile, draw linetype, and draw a border around it
$ ?; j# M/ ]+ B  ;;9 f3 \8 v# O: E& i3 ]& D  X. K+ \/ o
  (defun col_tile (tile color patlist / x y)1 ?  u8 Y4 t& A( C4 C9 b
    (setq x (dimx_tile tile))
; p3 V* `! w# ?    (setq y (dimy_tile tile))
  p5 b5 L+ R5 R6 A2 ~& }3 M" N    (start_image tile)
4 E; ?; y- [8 y    (fill_image 0 0 x y color)) Y1 M5 N, ]0 X: e- i2 ?
    (if (= color 7)
; Z% D: X- F# K( H) q" Z      (progn
& d# R8 h$ o0 J: x/ z; o        (if patlist (drawpattern x (/ y 2) patlist 0))
0 B* B; F9 V7 h& b, ?        (tile_rect 0 0 x y 0)
9 o! }- V9 O. M1 l      )
& `4 ]; E3 H! j4 E/ l      (progn3 X: n( b7 L& }( h  ^8 w: A3 J
        (if patlist (drawpattern x (/ y 2) patlist 7))5 i- G  P  w  d" y6 q" R1 u! K: g5 h
        (tile_rect 0 0 x y 7)
- z" c, I/ @9 D# d' h2 T' p6 ~      )
0 j: e8 X$ ?- X: w0 ?- i- j/ A7 H    )7 h; r2 P; V7 R* k
    (end_image)
: w; c. [# f9 p" w3 D, r  )5 i! {. d! Q% D* _
  ;;
) y! h5 o" R8 H9 V  ;; Draw a border around a tile
- [% c* A! R0 s( u" a  ;;
7 H0 h+ \+ J2 J- Y$ h  e  (defun tile_rect (x1 y1 x2 y2 color)
% p" p: A* t3 h% ]- H% u    (setq x2 (- x2 1))/ n$ {9 _9 @6 E
    (setq y2 (- y2 1))
: g* H; d* }/ Y2 w+ Z7 _    (vector_image x1 y1 x2 y1 color)
( P5 [$ l7 G# X# q, X; Q    (vector_image x2 y1 x2 y2 color)
5 o5 D0 l& k! L8 B    (vector_image x2 y2 x1 y2 color)
1 L$ H) o5 J$ c! n6 D4 s5 {9 K    (vector_image x1 y2 x1 y1 color): }4 ~% V- |& W" g
  )8 [* L: T' _- y6 q( {/ h
  ;;
) P6 v; e+ K1 ?6 |& o) S+ F  ;; Draw the linetype pattern in a tile.  Boxlength is the length of the image
# ^' G- {( a* g# i& I# J  ;; tile, y2 is the midpoint of the height of the image tile, pattern is a7 C% R2 q1 O7 m1 l
  ;; list of numbers that define the linetype, and color is the color of the
3 s4 H" H- J! e1 f; ?# `% B  ;; tile.
! T8 W. o6 ^$ ?5 Q) W  ;;! @4 n4 F/ T9 y% W
  (defun drawpattern (boxlength y2 pattern color / x1 x26 k9 T: }* v- j) v8 D8 K
                      patlist dash)
' d, D( m% z. X5 ?0 m3 j9 K    (setq x1 0 x2 0)4 X2 u6 C! s4 y+ o8 B- q1 a
    (setq patlist pattern)
; N2 T! r/ w2 z7 v$ O% H    (setq fx 30)9 H, n. L9 f- t: f. D
    (if (= patlist "CONT")& `) K0 y% t! b4 O0 ^* P
      (progn) u: }( F" q# T+ D
        (setq dash boxlength)2 @" g* J- G  A8 s5 C2 ?
        (vi)" Q2 r- c. U- c. _5 z
        (setq x1 boxlength), w% \( F& r# @1 S# {* g
      )+ k4 p4 \5 X0 r- y2 G3 @& b2 e
      (foreach dash patlist
: h# e  C8 L9 i6 X6 D        (if (> (abs dash) 2.5)
3 C4 q7 t& l  q' O( A% K& g3 G% T          (setq fx 2), n  v; P7 T9 ^
        )
( L+ r) I3 {# S' g      )
+ G6 }  Y) k7 Y4 n# p3 a    )
5 j* C  n" u8 w. ]9 |/ {    (while (< x1 boxlength), p# F8 c2 Q2 B0 q0 W
      (if (setq dash (car patlist))
7 \) t% y. c$ D) T        (progn" [, X7 x: K! l! U8 R! Z  E. _
          (setq dash (fix (* fx dash))): q( M& x7 O- k
          (cond
. \/ M7 |+ L* p; f            ((= dash 0)
% C; q1 p* ~. v              (setq dash 1)- O- t) f2 A2 }; s  r/ u
              (vi): Z. U: @5 L  V+ {6 H" S( V' x
            )
, S+ _$ \) ^3 [5 H* M            ((> dash 0)9 \5 F+ T7 `1 h0 E
              (vi)
* G8 z; T1 I6 }4 J6 _' J8 @4 r4 d            ): `- L+ W4 K  M
            (T
" G% h# S! U+ V" }- P  @0 u9 W              (if (< (abs dash) 2) (setq dash 2))( B$ u9 D. a# C  L* f( j, A4 O# S, S
              (setq x2 (+ x2 (abs dash)))  R' ]' u2 s$ O9 C% |
            )4 C' J. L8 R" ]8 m& v* X# L& q1 \
          )
1 c- e9 c" A( J; `5 h8 q' R9 ~7 u" G2 D          (setq patlist (cdr patlist))
4 Y# f" n) d$ a. u, j5 V          (setq x1 x2)
  }4 t3 l; s6 w! m$ H9 J  C: ?        )
5 j7 y2 C4 G2 j: g8 c9 |: ^! V2 |4 ^        (setq patlist pattern)
) L' X$ o5 E! D6 f3 C3 `      )
5 y% ~/ r6 M6 p4 U, h( H+ _    ). {6 R: N2 i7 z. \9 I5 O8 i
  )6 F8 m; X" D( ]4 ?8 W* e+ v
  ;;% E: ]5 k1 y/ a; T% t
  ;; Draw a dash or dot in image tile, @) {+ y" i( O- P6 r
  ;;
* ]! p9 S7 T+ G3 }  (defun vi ()
4 Q7 P& i) Y7 n" t0 z% V* q    (setq x2 (+ x2 dash))) r) d! L0 ~3 |& |0 @- v
    (vector_image x1 y2 x2 y2 color). M' v7 b1 y1 T4 D3 F9 ~2 U
  )
* l/ F2 k- m6 {7 f+ a3 t; x' s9 m1 t! Z' o* h
  ;; This function takes a selection and returns a list of the color,
: H1 C6 v  K8 _$ ?7 M" h. B  ;; linetype, layer, linetype scale, and thickness properties that
  R& F4 y" H0 g4 `5 x, J  ;; are common to every entities in the selection set - (color
4 z, ^) X$ h" f& N  ;; linetype layer thickness).  If all entities do not share the same
  L5 {* x5 m7 @9 d; i" R. S" p  ;; property value it returns "Varies" in place of the property
& `3 i3 _/ F; W6 T% V% h0 [$ ~  ;; value.  i.e.  ("BYLAYER" "DASHED" "Varies" 0)$ T5 F9 r3 e; k
  ;; The last item in the return list is an integer flag for the
! d/ q9 J8 a- W, r3 B  ;; homegenity of the selection-set object types.3 d! t1 C& Y8 H% T/ B. q' r  A
  ;;   1 = All polylines
+ T& K: z2 y3 Z. h# |  ;;   2 = All text or mtext or attdef, or a combination of the three( e3 U/ x8 c$ V& R
  ;;  -1 = Any other mix of objects$ C: Y$ v! j8 ?# T) a
. u+ P. r) [9 Z+ [# p$ C* V$ I' K
  (defun getprops (selset / sslen elist color ltype layer ltscale thickness- C  V* b0 r, [% W, b6 {: S
                          width elevation height go ctr
5 V& Y, Y+ d  z) m! ^, {, a, ]                          eflag
; r: N0 B$ [& F5 e& U" q                          etype temp
, O+ D. w# U6 S9 U+ s- Y! t9 F3 [2 e% A                          txt_ss     ;;;;rk 11:24 AM 1/30/97# ~( z3 J0 G9 M0 X, D0 k. q- [
                          tmp
8 \. V0 q4 H) `7 R6 J1 ^                          poly_ss   
3 R# w* x, U9 c* [# |7 r2 P% f+ Q                          style
; X/ _% U# t. J$ y4 L* f9 t) o5 X                  )5 \3 x+ R% Y3 d& ~" u4 B+ v

  b; Y$ w) F  c' F2 j3 T* r# b
* q* ?! Y8 Q# r  |( ?; O1 t    (setq     sslen (sslength selset)
6 d9 j* B  ?9 B" s              elist (entget (ssname selset 0)); f& _( G& n- s5 q
              etype (strcase (cdr (assoc 0 elist)))
% Q8 Y6 t1 W* P* ^, D; z5 l              color (cdr (assoc 62 elist))' \1 e6 {, M9 D, x0 E
              ltype (cdr (assoc 6 elist))/ a2 [; U- X! X: \. I9 P( t
              layer (cdr (assoc 8 elist))
% t% T1 V8 h7 ^) K: \8 X          thickness (cdr (assoc 39 elist))& Q7 s* A- J. L( X* v/ M
            ltscale (cdr (assoc 48 elist))/ ^% w7 k8 z4 N5 V
    );setq% M. H* [7 B& `. Y/ w( I" `6 z. ]' Y
) D5 `7 M0 h& I
    (if (not color)     (setq color 256))
" O. S5 ^; U6 U; c/ c) X5 d- U    (if (not ltype)     (setq ltype "BYLAYER"))
9 ~; p& X" n  s    (if (not thickness) (setq thickness 0))
- }5 V, q2 a' P% U, A    (if (not ltscale)   (setq ltscale 1))0 U* P" W' g, W

& q$ P) a5 G6 l& A    (if (not width)     (setq width ""))
+ l1 q9 W2 M/ H3 V- O7 ~6 H    (if (not elevation) (setq elevation ""))7 e6 r2 h% ?! ^: J
    (if (not height)    (setq height ""))+ B6 n4 D1 w, f" x3 T- T* b

3 ^4 u7 y$ `2 v; y" U& ]) G    (setq      go T
! [7 @; H& X' O) D          chk-col T $ g# V; T6 E+ |' W
           chk-lt T
" {% Y4 D0 D  o% B1 \: U6 \* }          chk-lay T
6 ~' X1 q% `% E; M- A  I5 [          chk-lts T
0 V9 r3 W6 c: ^           chk-th T & a; H7 Z- @: G0 h7 J; }  x" M! @
              ctr 0# B  {' A* h  I! ?: `
    );setq/ Q3 O  d% a/ ^% V" O. ]4 U- B

4 P, P3 l  h4 {# W    ;; Page through the selection set.  When a property1 E1 Y) }, }) C# S1 `
    ;; does not match, stop checking for that property.
2 Y% o7 j" ^% A    ;; When the selection set is not homogenous, stop checking.
0 Z5 k: G$ y/ V: Q! p, K    ;; If all properties vary and the set is not a type 1
6 M2 S' P) i! w    ;; (polyline) or type 2 (attdef/text/mtext) set, stop paging.
* h0 `) s7 J/ t4 j) W1 K1 z9 i5 V3 G' G6 j# X3 ?: l' E
    ;Lets set the eflag so we know if the selection set includes any 7 V. C* v  f, P' y% P/ Z( v& d
    ;combination of polylines, lwpolylines, text, mtext or attdefs.: T' x9 n; s) g1 C

2 Z, b  K( ~3 w4 g7 ^2 K9 E    ;watch out for 3dpolyline and 3dmeshes here! @rk 10:17 AM 1/30/97; B( A' S5 s, g
    (setq eflag 0)
! s5 p  Y9 E3 V+ ^: H5 ^    (if (setq poly_ss 3 B3 d" A. L* |) e- I7 m
              (ssget "P" (list '(0 . "*POLYLINE")9 k$ d0 e" U% G! g* q
                               '(-4 . "<AND")
3 G  m* Q+ m" \; L$ i4 S8 J4 h' _4 @; ~                                  '(-4 . "<NOT") '(-4 . "&=") '(70 . 8)  '(-4 . "NOT>")( w9 n* y3 V" x  K5 G3 ]9 N3 U
                                  '(-4 . "<NOT") '(-4 . "&=") '(70 . 16) '(-4 . "NOT>")1 |8 I0 k+ D) M$ Q+ u8 Y) Z1 |+ [
                                  '(-4 . "<NOT") '(-4 . "&=") '(70 . 64) '(-4 . "NOT>")5 d5 s" `* I; k8 l$ O6 E' H
                               '(-4 . "AND>") 0 N; X$ K& k: P
                         );list
( O2 M/ J* S9 y; B0 T, q0 |              );ssget get 2d polylines (legacy and lw)
3 _2 @6 \9 b" F) ]3 H        );setq1 g( G: T( s) [: g1 p! ^; x/ {( ?
        (progn, r4 a9 p; L5 e; c
         (setq eflag (+ eflag 1))
6 w5 u& j, \# x5 n
; W/ z, i8 K8 C& Z         (setq tmp (entget (ssname poly_ss 0)));setq
% Q& I1 a; D0 L8 g
8 |& r* c7 K5 A! F, |         (if (equal "POLYLINE" (cdr (assoc 0 tmp)))( A4 N( c8 B. i; ~' Y; T
             (setq elevation (last (cdr (assoc 10 tmp))))+ g& }/ B, c1 S4 }# ?( U' k8 w$ V
             (setq elevation (cdr (assoc 38 tmp)))
2 h1 X7 z4 y9 ]* |* E         );if; F# \5 Q7 \6 h$ q# o
         (if (not elevation)
- M! e* O8 ~: Y             (setq elevation 0.0);setq5 Y) q( F9 l& |0 U$ O* w
         );if7 s/ {8 o& i/ G+ i; r3 m3 N
: G6 i3 c- R  X# {5 I
         (setq tmp (ssget "P" ; N" \: x' l+ I6 A* N; H
                          (list ; `3 {/ `4 v* t: c* _" ^! B- z
                             '(-4 . "<OR")$ r0 h1 p5 f/ G# \0 Z
                               '(-4 . "<AND")
1 V" E- z, Z+ @. a, @7 Z) V                                 '(0 . "LWPOLYLINE")+ g' M* r/ b  I; ^/ ?1 u& ?* S
                                  (cons 38 elevation)/ v7 M7 f) a2 E2 i. D' P
                               '(-4 . "AND>")
. s3 g$ H. l% T3 ~5 V                               '(-4 . "<AND")' p7 ]" J. ?# L* S3 W9 M% W
                                 '(0 . "POLYLINE")
, F$ ]/ E/ B) @                                 '(-4 . "*,*,=")
3 @# f& _% C% }9 ~6 H' H5 A                                  (cons 10 (list 1.0 1.0 elevation))
9 V# @, Q# ?7 o                               '(-4 . "AND>") ' d$ j" K" R( T; U
                              '(-4 . "OR>")
/ E0 @4 r; y3 o4 Z1 O+ w                         );list
! O: \% B9 S2 ?, U  N. w% d                   );ssget4 s' W3 O3 A* J
         );setq
+ _  j% c0 K  d. H$ K0 d
# I- V! A. g) L9 b. C( ]3 O         (if (and tmp
! a/ H5 g3 j* m- M# S+ A                  (equal (sslength tmp) (sslength poly_ss))0 R4 C! U4 u7 {! R, B9 ]
             );and% W/ J4 {; J' Z/ r
             (setq elevation (ai_rtos elevation));setq
: I; N4 ?+ A; ^) P5 m- P/ d             (setq elevation "")
8 Q$ O# L. j1 m, @! B) ?         );if* r) M6 {; `* d: u

2 w& w! ]( k, A8 F1 a/ \+ C& x2 N         (setq width (pl_width_getter poly_ss));setq
" T) s4 v: B( o7 P& s$ o2 b
7 C6 M+ s2 G2 W9 E& _0 s- q+ O( @        );progn then 2d polylines and/or lwpolylines are in the HHHHHOUSE!) U! s! l1 b3 g
    );if. P! L6 r2 U2 f3 c
    (command "_.select" selset "")0 A4 W# y. a$ T: @4 E1 T
' K! ]/ ?, e2 B# ~) k
    (if (setq txt_ss
7 z* e- c- l" p# j" g* ~              (ssget "P" '((-4 . "<OR") (0 . "TEXT") (0 . "MTEXT") , n* b* P; b4 ]. f9 p
                           (0 . "ATTDEF") (-4 . "OR>"))
7 ^  R* T; C9 F" U& u# @! d              )  
) [+ D4 i: p! Q. l, ]( z        );setq$ g# Q+ W! D. v8 I  M5 p9 M* e# H
        (progn
2 m& I/ T& W& w- {4 H. B' v1 {& M! Z         (setq eflag (+ eflag 2))0 ?3 R0 Q$ O0 L  f
         (setq height (cdr (assoc 40 (entget (ssname txt_ss 0))))
& P4 k. y6 x9 R/ T) a" o& Q; x0 e                  tmp (ssget "P" (list (cons 40 height))) ' z  M: `, v8 y& D0 A0 p; S7 h
         );setq
# |; g; g8 n+ a5 u         (if (and tmp
- w5 H" i# Z: e) v' ]# ~+ S                  (equal (sslength txt_ss) (sslength tmp))                    4 j: v2 C# P$ `7 t* @
             );and% N% v; r! l% C8 v
             (setq height (ai_rtos height));setq  ;@rk need to translate from float + c2 {! ?' ^8 T2 `
                                                   ;to string and back again easily
7 a/ ^: y( [# x7 C( r0 [             (setq height "");setq else the height varies - I; p% Y( X3 a2 B0 j8 D2 c
         );if1 u" h) @( ?0 J! V4 X% t9 d$ g+ b
         (command "_.select" txt_ss "")
% l  ]% a/ ^$ f3 |7 d9 n' f* c, P         (setq style (cdr (assoc 7 (entget (ssname txt_ss 0))))
3 j4 H. F9 `: n                 tmp (ssget "P" (list (cons 7 style))) ( Q0 J3 m, g: ?' _
         );setq
9 g+ ^: c% G2 ^6 ]5 W! N8 D         (if (not (and tmp- q; S  v( S( \+ ?6 z) r' X
                       (equal (sslength txt_ss) (sslength tmp))                    0 i3 [) w' L# a. g
                  );and
) a- a9 b: X$ h# c  I             );not
( h2 K5 ]0 a7 J, y& E" v             (setq style "");setq then the style varies
- ~- T7 s% K, F( b+ K! A- H         );if
9 B- Q3 ^8 Y7 D" x/ F( q6 [        );progn the text type objects are in the selection set3 d% ~; K; D6 t' K5 O* Y4 F
    );if! r, P" g& I$ G1 a, h3 z' p5 r3 i5 }
    (command "_.select" selset "")
  ~% W- X+ p( B5 @% u# C/ X
# ?9 r8 ~. e- u- Q5 Y# }    (while (and (> sslen ctr) % y7 Y+ ?" k# A" g$ A2 B- T1 ?3 t+ R
                go1 C' y) T- o& R: X
           );and: [% \2 a7 P8 _" z1 v7 F  u
      (setq elist (entget (setq en (ssname selset ctr))))2 _0 ?. }* x4 u
; ~5 J& V/ s+ W! Y6 N6 w* k' L
      (if chk-col (match-col))
) ~* O( k; D3 T& d, f      (if chk-lt (match-lt))
# x- J4 h! T4 F7 P+ n, C      (if chk-lay (match-lay))3 g& C; n5 a  @' R
      (if chk-lts (match-lts))* z2 S- s. A% k- d" r
      (if chk-th (match-th))8 _" z* a5 e. N6 s5 p
  u! M! `$ g! u4 a/ h0 y$ \) a) }6 b7 u
      ;(if chk-etype (match-etype))
2 ~& O' A8 s8 a; y0 o: G7 d5 A4 I1 f( Y9 _8 Y& ~
      (setq ctr (1+ ctr))
7 z2 _2 \% c3 I3 Q6 q      (if (and (not chk-col)$ V6 A7 ]& X' K$ A; ^; V
               (not chk-lt)) G. ]) C" M1 Z- Y7 x
               (not chk-lay)+ n% `' ~% m9 P% n
               (not chk-lts)2 C$ j" p9 k3 k  z9 Y& X9 L: a4 o
               (not chk-th)
4 \& l% ]7 N8 h8 }               ;(not chk-etype)& @, x: ^( H  ^* E+ @2 S. u: o
          );and4 B. L! o% _$ X! U1 h& y7 S+ m3 \
          (setq go nil)
* `9 G% {- X& |/ C2 ]. W: K" d# U      );if
. e& n" s7 K8 M- K' G( v' w    );while
+ P9 F9 h3 R6 ]
; H- r  a7 I2 K- z; b    (list color ltype layer thickness ltscale' w* l. Y. N4 _
          width elevation height eflag
, g: L$ V0 g4 H  Y) ], s( e9 w% |- \          style poly_ss txt_ss
4 i$ J9 d( E6 U$ D6 L    )- q2 E7 X  j/ ^; p" V6 g
  );defun getprops1 y6 m0 Y6 i! x, u* s
2 L7 m0 V0 n! a$ t/ ~' z
  ;  This is a speedy little routine to tell whether the polylines in
$ D, v# k- k+ ~- Y) M* R! n  ;the selection set argument are of varying width or a constant value.
( f7 I9 ~* f( V  ;Looping through the vertex's has to be done for old polylines when / ]1 C* N1 L, ^# I1 T$ {
  ;the polyline header has width values of 0.0. Basically, in this case, % {! m) f1 G5 @: o1 g
  ;information in the polyline entity header is abmiguous. Width values - K5 p! f1 w' P$ H' R' b5 \
  ;of 0.0 in the header entity could mean the polyline has a constant 8 p7 m' G! P( a
  ;width of 0.0 or it could mean that the polyline has vertex's of varying
1 w( S/ t8 ~5 m" p  ;width.
: T- i( {* }- ]9 I5 I  ;
$ h% l8 R+ E' k: o# E+ D1 T  ;  It's all in wrist. Err a.., I mean it's all in the 'if'
  a2 q% T# I( f0 ?  ;;8 p. i" h5 ~' q7 ~- f& C
  (defun pl_width_getter ( ss / ss2 ss3 n na e1 width width_a width_b flag flag2)& J9 q- ^7 h; c) U. s& _" j& q1 c
$ t4 s* k" i# b( `5 g8 u
   (if ss
6 h1 A: u; q- B9 M       (command "_.select" ss "")
$ m1 v, S$ j- y- n   );if: C" |7 b8 B, v
   (setq width ""
3 v1 n# h; i4 E          flag nil: P, Y2 m  [. n7 w/ R. L  L
         flag2 nil8 p1 O% `, `# R8 `  k( x7 F, Y
   );setq
: u$ f9 s, c# A# @- q2 |7 a   (if (not   G# f2 Z3 v$ N) l$ i& l
         (and ss- e- Z5 ]$ O5 J7 O5 L  X/ I- T
              (setq ss2 (ssget "p" '((0 . "LWPOLYLINE"))));setq
# u/ k+ s4 x5 N' N0 ~              (setq    na (ssname ss2 0)/ \2 @2 b- Y. w( s3 U, N2 {0 b
                    width (cdr (assoc 43 (entget na)))0 ]  ]  \$ W' ?, |0 J
              );setq# c5 K& x4 X( e4 O
              (setq ss3 (ssget "p" (list '(0 . "LWPOLYLINE")
$ ]% H5 ~9 z; Q  E                                          (cons 43 width)
; ]5 W& i4 Q! n3 U# k4 f                                   );list4 f! g" G+ Q/ P
                        );ssget# \% I% u& a5 F7 l1 O; ~
              );setq
8 y( {) ?. n$ ~. K3 F6 d              (setq flag T) ' C6 Z4 x7 }/ p3 z
              (equal (sslength ss2) (sslength ss3))
' e% Y" A2 e/ Z$ J7 ^4 h9 |4 v         );and
" |' l5 ?, O# N" ^       );not
3 s* y& G8 h4 B$ p       (progn# N. S8 D7 R4 ~6 v! d% n! T, m
        (if flag; I* n. N7 S" w) ]4 q+ L0 H
            (setq width nil)
/ l6 [8 v5 y! E! N9 L        );if4 [# a9 j& T6 E/ I0 Q$ M$ m8 q" g% i
       );progn* Q$ |; Q2 v9 Y5 E) B# }) e5 _6 g
   );if
" Q8 a- a) T& b5 o7 _3 e. z9 A) ~; u& w4 e2 O
   (if (not / P: W( K4 `  R0 Y
        (and 9 S6 U  j& V6 z& \4 }" E# o
             ss
* s" _1 h7 _4 u" E% N% v4 o7 k2 U             (progn (command "_.select" ss "") $ i  u- w" }* n
                    (setq ss2 (ssget "p" '((0 . "POLYLINE"))));setq0 J7 S6 ?9 ^) i1 G  @# }
             )
) r$ d1 t/ E7 R5 f# m             (setq      na (ssname ss2 0)
7 U4 q9 M: O3 A6 v" {* O- o. y                        e1 (entget na)
' K" L2 D3 g5 Z% E' @( u                   width_a (cdr (assoc 40 e1))# W; }  n- {9 b4 }* h: z
                   width_b (cdr (assoc 41 e1))8 M8 e+ Z0 s/ |1 p, A) N8 ]
             );setq
; C# S" b3 a3 L: \$ P8 |' H. ]             (equal width_a width_b)
# g( i& h* ~* t" R             (setq ss3 (ssget "p" (list '(0 . "POLYLINE")" V. g$ C9 ~# Q/ @6 X# F
                                         (cons 40 width_a)
  _) X* y/ Y9 r- r- y6 x                                         (cons 41 width_b)
7 w. y- N& ?. k                                  );list
5 J% |$ y& Q0 b  t& a5 f9 ^                       );ssget
/ S" G- h( i+ n& z0 h             );setq
& j: t7 O4 a* j7 e; Z" A! c             (setq flag2 T)
  ^; W, e* ?: n. f7 j             (equal (sslength ss2) (sslength ss3))
, n/ l4 s% }% h  S# X5 ?" q        );and * M2 x; r' b& R5 U& i
       );not 8 {+ i# @* h; b( q
       (progn$ F1 ^  f7 e$ m# D2 A/ X7 O+ n
        (if flag2
, m) x* ~% |, a0 T            (setq width nil);setq
, x" V' x- }; D. {! ~        );if6 {- q  o& m! \1 V9 L  M
       );progn then/ j% R! q. ^9 \+ K* ]
       (progn
/ z( e. o) {) a2 N8 G( s, y3 r' ?        (if (or (equal width "")9 {  y0 C4 v9 b2 v
                (not flag)# a9 [4 M) v+ O' ~
            );or! x0 s& T1 y' E9 P+ j: k
            (setq width width_a)
6 ?6 I) m' I- S7 q            (progn
% f' Q6 E$ i* U# b6 y; V, f             (if (not (equal width width_a))8 N7 t" `; l- |4 p5 R- ~( `  p
                 (setq width "")4 A2 s5 J8 M* M: S. U6 Q
             );if  $ ~$ n# d$ C, ~" e
            );progn- H( _/ u8 Q$ q4 R
        );if# @! F" x, M; D; U- P7 i) j3 ^
       );progn% n3 i% M( T3 u. i# p
   );if
& D7 g" B7 S9 M( B8 z- U! `% Z6 z0 G, d
" D7 {) u, ^5 f3 V8 l
   ;now for the special handling for old polylines9 `5 ~6 [9 X0 r# Y+ h5 T8 ?$ D
   (if (and width : p: M1 b6 s) s5 p4 M
            (equal width 0.0)
% m3 e' ~2 Y) Y) V6 b/ ^- q' g            flag2
: z1 x0 ?& t" s# Z/ {" n8 Z. V+ Z       );and " Q% |$ Q9 ~3 e
       (progn! Q5 C" h! A/ B! u' ^/ Z% T5 E

. P$ H& ~0 f3 L0 N% C        (setq n 0);setq
2 \# l! S  W  S8 m8 `# O# C1 c        (while (and (equal width 0.0)) O; X& A. f" I2 a9 r3 H! y
                    (< n (sslength ss3))
0 ^* [* F# m9 {               );and
% G: h' H7 F. o4 h) _5 ~8 |         (setq flag nil
# n3 _! \# o* o( R9 N3 T" G0 H# j% k                 na (ssname ss3 n)' F( W: r; F  f/ I7 J: e
                 na (entnext na)8 u, P6 i3 y4 f# b' w9 n2 Z  F. v
                 e1 (entget na)) G8 ~/ f& P" u, F; ^& p6 z
         );setq
3 a* u. d. ?# O! w9 Y5 F         (while (not flag)
- f4 @) q* g% w          (if (or (equal (cdr (assoc 0 e1)) "SEQEND")0 U$ y0 q# b8 A# X5 Z' R6 Z( i
                  (not (equal (cdr (assoc 40 e1)) 0.0))
1 v. x1 j5 h2 m                  (not (equal (cdr (assoc 41 e1)) 0.0))
* l6 K) `' N  [              );or
+ [5 Z3 t& Y4 d+ q0 k              (progn+ z& y. d! B) |5 b) o
               (setq flag T);
2 z  ]1 N6 s: h/ K- S! J               (if (not (equal (cdr (assoc 0 e1)) "SEQEND"))0 |* x1 X( e0 T! b9 u
                   (setq width nil) ' W# g9 C, a; x2 T
               );if
* l: E/ I1 E( {7 Q* r' ^3 N* q/ @8 L' ]/ H! X              );progn then jump out of the loop8 s# V/ N5 P# k1 z! c' o
              (setq na (entnext na)% h3 H& b+ {; I( F7 K& Q- g+ _
                    e1 (entget na)
& L9 N5 `% C0 ]+ ]; o8 w6 H              );setq . f! ]! L3 {, ~% c1 a3 H
          );if & Z) I& \( J' @7 k/ J9 |; \
         );while
% ~; m  a0 D# o2 m: t: Q        (setq n (+ n 1));setq  
0 |' n. T( g5 a" }) v2 p        );while
# D9 i9 U. r8 v8 R% x* f5 c/ a9 Y+ Y6 Z. w
       );progn then it's a legacy
: |) L, O3 a- K4 M% E; f   );if    ;legacy polylines that may have varying widths  
6 Z& |0 J; g- Q( q  N! F
1 K- s1 S4 F. d8 ~0 W4 A3 M   (if (not width)8 p! p: `' n/ Y% B7 ~& O1 Q2 Z8 g
       (setq width "");setq; \& L" Y2 C- G  f7 [8 ~
   );if5 o- u+ K9 y! h8 p" b
   (if (not (equal 'STR (type width)))# q8 a% }7 l' y, j) X6 c; }
       (setq width (ai_rtos width));setq 3 ^' F4 x! g- C
   );if
& Z" @6 p+ z- U: d. j" q7 o
+ K; M' V3 t6 ]" n   width     _2 q) M7 k( P8 L- J7 {
  );defun pl_width_getter# }2 R7 X4 `! G, ]: a

+ U! L) `1 M4 w: \7 b& P2 A* O% g+ I. z
  (defun match-col (/ ncolor); S# T$ `5 [3 k8 @
    (setq ncolor (cdr (assoc 62 elist)))6 C( F" H7 G* n, c; o7 Y# `' {
    (if (not ncolor) (setq ncolor 256))7 R" ?+ q  B& B% I
    (if (/= color ncolor)
% k( s1 g# U8 W/ Q: }% u7 S% ^      (progn
2 n1 \+ h- W& ^; P% `0 {        (setq chk-col nil)
! H) \! X' H; p( c# u        (setq color nil)
- f; D4 D$ n2 Z, V% \1 {' t! ?( c      )
8 O9 |; f6 S% a% I8 |    )
6 R) }3 I$ d7 J+ \  )- U: E  ~! u! g( L( D+ R1 H6 A+ m
2 C1 |+ g  K) s
  (defun match-lt (/ nltype); X& S& g2 [0 V- A
    (setq nltype (cdr (assoc 6 elist)))
; l# G, D2 e) \2 p    (if (not nltype) (setq nltype "BYLAYER"))8 v& ~  F# ]4 F% V' n0 J  y
    (if (/= ltype nltype)
1 I3 P4 m! n  L2 h* g  `      (progn
: q* G1 u4 S! G6 v* ]        (setq chk-lt nil)3 n, J( g0 X# ^$ [# ^9 w; V
        (setq ltype ;|MSG0|;"Varies")4 T) O" X( A) ]0 f+ Q' F+ N
      )% I8 E( X) M/ d* D4 s( F
    )+ g5 S5 a6 \! z( e% \3 v
  )$ E/ e; ?$ m3 J$ \  {, o

) ]% z6 A) T. M  (defun match-lay (/ nlayer); s5 R# E+ ^) H5 a" c- R
    (setq nlayer (cdr (assoc 8 elist)))! u2 ]' t: N8 b1 A' ]
    (if (/= layer nlayer)' k% X* d: Y* [5 d0 y4 Y9 L5 W
      (progn" `8 S! n2 T9 H9 `( E# m# q
        (setq chk-lay nil)9 a9 c3 P/ Z7 ]9 s8 x
        (setq layer ;|MSG0|;"Varies"), {$ h2 X* n1 I2 T' d
      )
! ^' g' s2 j2 ~. j) f    )$ @/ \0 h# p) N
  )
: j" f: v  T9 ^; D; g# B; s0 s/ g* @5 L) X  e$ R3 S4 T
  (defun match-th (/ nthickness)- x8 z& ?9 i. _9 I. X; m
    (setq nthickness (cdr (assoc 39 elist))), ^1 U0 }7 T! @
    (if (not nthickness) (setq nthickness 0))
" i5 }* U* i7 W! E. {7 O    (if (/= thickness nthickness)
& s# J6 M8 i* Y, O      (progn
% }6 X+ b7 b* E! R7 `* G) e        (setq chk-th nil)$ a7 G/ a6 U$ |0 e: O7 ~; p+ ^
        (setq thickness ;|MSG0|;"Varies")
- {- `! u7 F2 g3 }% W      )
  v, a4 \6 K$ J' A% }    )
+ V1 L' o4 f1 y$ p, X4 w) W  )+ v$ m1 H; u+ r

7 a! a& B/ ~; O; j( [  (defun match-lts (/ nltscale)
! ~) x7 ^7 h5 E8 v* O  g* j0 g: U    (setq nltscale (cdr (assoc 48 elist)))+ N, y$ D/ ~! D; b  z
    (if (not nltscale) (setq nltscale 1))+ i; A  b  A. E6 z! h
    (if (/= ltscale nltscale)
8 J  T; [8 w) C( A9 Y! e$ A      (progn
5 a# B  z( O6 X) _/ k' e        (setq chk-lts nil)
8 y/ {/ d8 e! K5 y$ y        (setq ltscale ;|MSG0|;"Varies")4 ~, _& Q2 p! c) v8 j$ r8 q
      )
6 u- g$ B+ {* j' n7 `' l- G0 ?& P    )
+ _' A, B- x7 L8 A1 i  )
; I& D) {0 F6 `4 l) B
$ g( p3 D! b4 u  ;;
  R/ A/ r/ N9 b  t  ;; If an item is a member of the list, then return its index number, else
: d, d$ ~9 G- b) t: |  ;; return nil.: w6 l. U/ Z. k
  ;;
2 F; X; z; `0 n7 F5 c& f6 P( N  (defun getindex (item itemlist / m n)
) x# {5 b% q+ Q9 n& P: _+ B& y    (setq n (length itemlist)); x% {' x% X) o4 s
    (if (> (setq m (length (member item itemlist))) 0)$ h7 n& ^$ }3 s! v
        (- n m)
" F4 R/ C/ M& b6 T2 {        nil
7 U5 @* g" }& H6 r4 |: e# R    )
, ^( X3 q* H6 e8 B* U2 Y  )2 Z  B3 \/ H7 l& |; z9 v! _
  ;;
! Z+ J% H) z. Z+ a& r& p, V& T  ;; This function is called if the linetype is set "BYLAYER". It finds the) F$ g: x4 W7 v& f, d6 I
  ;; ltype of the layer so it can be displayed beside the linetype button.# i. y1 l+ s/ H9 _2 a" a6 p
  ;;+ I8 w3 l) a/ [& @5 k# {9 k& F
  (defun bylayer_lt (/ layname layinfo ltype)
+ M6 @1 k, o" ]3 W: N% ~; m5 M5 M    (if lay-idx
- y6 S; B  M" W: f      (progn0 v' j3 @) u8 e7 f) R
        (setq layname (nth lay-idx laynmlst))* B9 b$ L! l, i$ e; {% Y
        (setq layinfo (tblsearch "layer" layname)); e. V0 T" U, M0 B8 `4 l1 z% ^
        (setq ltype (cdr (assoc 6 layinfo)))1 d2 b0 o. V4 e! |' i3 T
        (strcat "BYLAYER" " (" ltype ")")9 Y9 e; g7 f& d5 Y
      )
& h/ T5 w/ c5 g# O+ h8 [( ~" H      "BYLAYER") m8 u0 B, s+ H5 K4 g$ i
    )! A: j( d7 g: `$ w; s
  )& y- x+ B# r9 c/ Z. V) [- c7 }5 s
  ;;* L* v4 l  }9 j% a3 ^. {; E$ k
  ;; This function is called if the color is set "BYLAYER".  It finds the
7 V. U. n" ]1 g7 G0 F  ;; color of the layer so it can be displayed  beside the color button.
- t7 s4 x: `- w3 T2 j& x$ l2 Q  ;;! A; K: f' i& r2 c/ k1 c
  (defun bylayer_col (/ layname layinfo color)* @5 n5 p6 t2 v
    (if lay-idx( Y; J" M; B" V# @: C: A6 \) r
      (progn
+ v$ _; C; A& b: _& l5 s$ G' q        (setq layname (nth lay-idx laynmlst))
  y7 Y( x4 O) ?        (setq layinfo (tblsearch "layer" layname))
- G5 [$ E6 m3 b8 A        (setq color (abs (cdr (assoc 62 layinfo))))
. x; s# ~4 Q" _0 V( t; r        (setq cn color). v' K* t5 x# Q& ]$ }( V& r! m
        (strcat "BYLAYER" " (" (colorname color) ")")- {, K' i5 h$ A' o' [1 p% ^" P
      )9 M' \+ Z# ^) `2 l
      (progn
# k8 ~2 Y$ W2 X! r# I        (setq layname elayer)
# m! ?' n9 [2 _+ w        (if (and (/= elayer "")
8 x& O4 A$ z; |" t( t; S! K                 (/= elayer "Varies")
% M# Y) `9 n1 ^; K  C- j            );and
8 Z% H% a1 ^6 r+ }- O            (progn! v$ G+ y0 O6 K+ h6 h5 B7 B
             (setq layinfo (tblsearch "layer" elayer))( R: U* d; y7 X% h7 l+ s2 O' g, [
             (setq color (abs (cdr (assoc 62 layinfo))))
; N9 B: L1 T: ~9 W4 p1 b* R             (setq cn color)5 Z% F; G2 q; h, B1 Z
             (strcat "BYLAYER" " (" (colorname color) ")")
" p7 G* e; e0 P  |! F            )
1 z9 p/ G0 {* n0 ?            (progn
4 P$ n$ p! w* k             (setq cn 0)
4 P) R( K8 j, [             "BYLAYER"
- `6 `# l$ t- B- @            )
" P7 }+ v. ], d7 n4 T: R        );if6 T) |4 E' }3 X! q* N2 X, _+ F
      );progn
/ l" U5 P( A  \    );if
  s; L6 c* J  j+ ~) t: h  )0 d# n% Q& L9 C6 ~6 Q( P3 }5 Q
  ;;* C/ ]) j9 c; a
  ;; If there is no error message, then close the dialogue
# ]# k0 {, Z' k/ @  ;;1 H! |2 `6 [" ]) Y
  ;; If there is an error message, then set focus to the tile1 Q7 e% S) A4 v! D' ?/ d
  ;; that's associated with the error message.
, N, B2 c) A5 L* H% a  ;;* G$ _5 w5 z' X. E8 k5 a
  (defun test-ok ( / errtile)
$ q! K9 W- E0 s  p+ Y& [; a4 V( j    (setq errtile (get_tile "error"))3 M+ n& E& |: H3 V& c' K
    (cond
: U5 n; @8 m* X4 o" G# \$ Z      (  (= errtile "")( {( M+ ?: s7 R% i4 v$ b
         (done_dialog 1))# F7 \+ j7 `: ^0 X- c
      (  (= errtile "Invalid thickness.")1 y4 N8 O8 ?0 [4 |; W( Y7 |
         (mode_tile "eb_thickness" 2))
& ?7 S$ R0 Y# ^. R9 I    )) @, m: y9 |- i, z
  )  Y+ p9 ~; h  b8 {" k! O: {
  ;;
. R# f2 K' d# t, x. K  ;; OK in main dialogue.* ?, {$ }1 U: z5 o7 O4 n$ @/ f/ c
  ;;- R: L8 E1 Z/ L' E7 a- _
  (defun test-main-ok ( / flag)
/ B  O/ \/ h: ?: P" ?; S6 W/ `   (setq flag T)
: Y& W- A. H9 e   (if (not (or (distof (get_tile "eb_thickness"))% C6 n6 q+ p& b" ^0 o# O4 ^$ q
                (= "" (get_tile "eb_thickness"))5 u# R" k6 d# `. ^1 q. r. H3 ]
            );or
: Q. V! A/ p$ N7 O       );not
) @4 U; U( ?$ M0 @       (progn
0 B% A) }. A* \2 ^5 R) F" ]+ E        (set_tile "error" "Invalid thickness.")
; @5 _& b; A  `9 w# W7 x3 Y        (mode_tile "eb_thickness" 2)8 @0 v4 W$ s. P) d" v3 [$ ^- P
        (setq flag nil);setq  b* |/ U0 J9 d8 y
       );progn/ s$ L7 {9 l* Q4 p* e8 U
   );if8 B7 _( f1 O+ }. D8 n; |
   (if (and flag" O, I# }$ W8 h& o5 I! E
            (not (or (< 0 (distof (get_tile "eb_ltscale")))
. ]9 u& n. L$ _' D                     (= "" (get_tile "eb_ltscale"))
* u2 R5 y3 S8 l                 );or      4 k+ }+ W# H2 x2 X' [% L5 X' c2 @- {
            );not4 t# I$ \# ]8 \2 ?2 s
       );and
7 m6 R& ~! i0 F" X       (progn5 [  a5 @9 i* D! l8 f
        (set_tile "error" "Invalid ltscale.")6 [  }+ @& {3 x3 \$ _: l
        (mode_tile "eb_ltscale" 2)
# s! t' H" @' _        (setq flag nil); 9 l) y( T7 v9 Y# k* @7 h, ]
       );progn then% I0 f' L2 a; R$ X
   );if
; ~( v! a8 J  n; F   (if (and flag- c3 F( t% V" {- L
          ; Don't test the tile's value unless it's enabled.) Y2 G  j! S6 o" e7 _4 ]9 ~
          ; We're not set up for the display-only value! [, z( K0 ^1 ~; ~2 B: B) u& K
          ; of "" here in the error handler.
6 k! k4 s9 ?9 Y: v          (= 2 (logand 2 eflag)). @- ~. d3 A/ S, r% F# K
          (not (or (< 0 (distof (get_tile "text_hgt")))
$ ?, K# r; }3 C( T  C) I                   (= "" (get_tile "text_hgt"))3 u6 Q; o# `- d0 c6 G1 ^9 t
               );or& b! Q) @! e( K, u4 r: p9 g
          );not
5 j; l% r7 J& O, |; j( y# s; u        );and6 _$ r+ D% t1 ^* y4 I' t# {
        (progn5 [# O2 N3 c# t
         (set_tile "error" "Invalid height.")4 t, @; R1 R5 X0 P4 u4 N! |
         (mode_tile "text_hgt" 2)
8 p( d+ J; [) F$ p8 g  _         (setq flag nil);* `% M- p! z' G
        );progn then
7 c# p% j2 [1 q$ d8 A! \   );if3 l% U' @1 t7 [) M6 T
   (if (and flag
$ q% E" u, P% y5 E: Z            (= 1 (logand 1 eflag))
4 X* I# `7 c# a( o/ t  z            (not (or (<= 0 (distof (get_tile "poly_wid")))
% \4 Y0 J4 q! T# S; J) f7 U9 Y5 B                     (= "" (get_tile "poly_wid"))
- f) Q1 M7 G0 F                 );or" q8 h7 [2 o1 c% ?8 y! J: R0 \2 M
            );not
1 H/ k/ P1 [" H" h       );and
. H( X: v  i5 @' A       (progn% @0 O- V' G! c0 m
        (set_tile "error" "Invalid width."). D" R! x; b' s9 G
        (mode_tile "poly_wid" 2)5 V9 V5 S  y+ |% A, Y4 r. K
        (setq flag nil)8 G/ h9 x) T. \- q
       );progn then* g$ A/ @1 ^2 _: t. j
   );if
5 y3 J6 [( `% l  N& w8 a5 Z   (if (and flag
* i* f" m8 A- @; y: b            (= 1 (logand 1 eflag))  {6 B- T3 ?4 W1 _9 i
            (not (or (distof (get_tile "poly_elev"))9 V: s7 ]/ L: _% S9 t4 r
                     (= "" (get_tile "poly_elev"))
: |. n- M6 Z& \# h                 );or+ s* ?7 H. e& P. [' ~
            );not% K' k0 x9 l# `) s& L
        );and, n* p2 m: {" h7 h/ g
        (progn
, F9 B) [  a9 {; u         (set_tile "error" "Invalid elevation.")4 J8 n0 C5 a, D8 b% O
         (mode_tile "poly_elev" 2)
; z" }4 K- o# i4 G" n         (setq flag nil)
. }' |+ Z' A  z' y/ T        );progn then8 L+ s+ z2 m9 c3 @2 d
   );if  + N* V$ o# w( j5 U
   (if flag + m' |: U$ ]! L9 b
       (done_dialog 1)
! \9 m3 P' s0 b9 a7 o   );if. C1 k5 e$ F4 V$ N1 ?1 T
  );defun test-main-ok- |! F! B: Z6 ^3 K, P
) [( _6 T' i2 F; Y; x  C, e, Q& H$ W
  ;;) D) I2 W& f! ^  r; ~
  ;; A color function used by getlayer.
8 Z6 k  @/ G' K( Y/ T  ;;( z" O- |& q) s- q2 k* l, t. {1 t
  (defun colorname (colnum)0 b2 t6 f4 p( W, w# M( A
    (setq cn (abs colnum))
, @4 \* b8 q+ B    (cond ((= cn 1) "red")& s: r% X: n7 [- g* L' _
          ((= cn 2) "yellow")9 D$ m2 h+ L6 j1 }! y
          ((= cn 3) "green")( T4 q# b# W  o# Q3 ]
          ((= cn 4) "cyan")$ ?. A: q  E- `5 F! p" L
          ((= cn 5) "blue"); O/ ^4 p$ {8 ?5 }+ L
          ((= cn 6) "magenta")) d  c) K! k* A; l: E
          ((= cn 7) "white")2 N" i7 `) ]2 T- i3 a0 n$ W
          (T (itoa cn))9 n0 s7 l" s4 y- ]) p$ G# V! C
    )  `7 i; I2 V5 n; s1 z6 k( x
  );defun
2 e$ i! I; N; z2 _9 E
; M( j# @1 A3 ~7 W;;; Construct layer and ltype lists and initialize all
8 U3 N1 F. i' r6 L;;; program variables:
9 G) R! n- ^% g' u# I: [1 g) i* s& j0 H6 N. y
;  (makelaylists)                     ; layer list - laynmlst
  n9 I! U! j8 W& ]6 }: M4 A& u) f. {5 \
2 [+ t+ {4 |1 i+ Z% ]9 T
  (makeltlists)                      ; linetype lists - ltnmlst, mdashlist8 P  [7 O1 x( T3 j
4 j2 i# s: Q; u- v
  ;; Find the property values of the selection set.( w4 n+ X2 @9 v# w! Z6 _9 e
  ;; (getprops ss) returns a list of properties from
* ^& s0 s8 E  j  ;; a selection set - (color ltype layer thickness HEGHT STYLE WIDTH).
6 g# ~. v4 P$ n: o# q
; u$ d- R. }/ Y$ s9 ~4 j& p8 F  (setq proplist (getprops ss));@rk interesting things happen here
% _5 p+ a/ _. D- i
6 G" {: C' w( w5 z  (setq
/ g% X2 c9 q) r; f& ^            ecolor (car proplist)
, L8 o/ G- N0 C9 B) n            eltype (nth 1 proplist)
- e" z. e: x: {4 W* h" }& f8 x            elayer (nth 2 proplist)
* L8 D3 T4 v& ?! O* |* U! z5 g8 l        ethickness (nth 3 proplist)& v3 b8 {' E! r0 [; S
          eltscale (nth 4 proplist)
. _8 A9 X; h1 R& }. Z            ewidth (nth 5 proplist)' ^9 P# j8 O- u  ]& U' z# }
        eelevation (nth 6 proplist)
9 r5 L  x. Z  |% r           eheight (nth 7 proplist)2 t0 l3 {* e" f: w. K. X7 B
            ;etype (nth 8 proplist);commented out and replaced with the line below. RK.
1 R3 A- D! T3 J* Z5 ~             eflag (nth 8 proplist)
" K" `) [8 W0 U1 i            estyle (nth 9 proplist)
+ o( j7 C; H2 _! i4 Q           poly_ss (nth 10 proplist)  U$ K+ e2 H2 I1 j& ^1 g; b
           txt_ss  (nth 11 proplist)
1 I1 |% V7 t& O1 O/ s$ {  Z+ ]  );setq
# X+ |5 i1 t# e% F/ D
) a0 f, W, f, b+ i0 }# U( M  ;; Find index of linetype, and layer lists
' Z6 H0 B) Z2 R3 v, {! I9 n+ y6 C  (cond
$ P, m. l6 h6 q/ n  {# G: l    ((= eltype "Varies") (setq lt-idx nil))8 [2 w! J2 @* _2 m& o& b8 T% n
    ((= eltype "BYLAYER")2 c. V  M1 X( u! p
     (setq lt-idx (getindex "BYLAYER" ltnmlst)))& O2 \4 h8 @8 r5 r2 W2 u7 t' @
    ((= eltype "BYBLOCK")
$ n+ A6 K- P; j0 \     (setq lt-idx (getindex "BYBLOCK" ltnmlst)))% |& P+ r* d1 B# t0 V  M1 m% a
    (T (setq lt-idx (getindex eltype ltnmlst)))% Z% X4 j( W/ w! J' j  F3 ^
  )
% g, Z. v, n. ^6 v0 O! ^$ w; J  (if (= elayer "Varies")% Z  s7 I) i+ P) {5 [
      (setq lay-idx nil)
, r- B' i  E4 E- q# Q5 }      (setq lay-idx (getindex elayer laynmlst))& q: n) U9 i" \$ x% [- p( Q1 N
  );if
" f* D% R2 [; P$ h  b8 t" a- z& C  (if (= ethickness "")
- d9 Q" Q. a; O7 f      (setq ethickness nil)
8 ~- O( c9 y2 R  );if
* O% N" F" q/ x4 {- J" l# P  (if (= eltscale "")7 q& `; ]; k; A. d' ^3 }: d: B
      (setq eltscale nil)
+ S% I4 y: R, T, R# ~  );if
. E0 l' u4 @) w) E7 S. C, T8 `! c. _( P* ^6 H9 T; [. w& ]/ I3 D
);defun ddchprop2_init   ; end (ddchprop2_init)' q% ?  [/ J% U$ U4 g4 J
) ?3 Q1 @' Z0 M: ^; H2 L( r. n
;;; (ddchprop2_select)) b# W* c8 Q* g
;;;  T+ g  I2 y. z2 |4 U) T0 E5 y
;;; Aquires selection set for DDCHPROP2, in one of three ways:* O1 }1 n3 I& _3 n5 W/ c: X9 q2 c
;;;
. t3 M6 ~6 X" ^  S; u;;;   1 - Autoselected.$ `# R$ q: P1 F5 }
;;;   2 - Prompted for.3 ^( g* A5 _3 Z5 V& g1 T6 K
;;;   3 - Passed as an argument in a call to (ddchprop2 <ss> )
  l8 ^  o4 N2 M& @$ G# `3 V;;;3 d2 S9 B% L' P4 L4 J: L
;;; The (ddchprop2_select) function also sets the value of the  b- P3 o3 M+ E) L# m& C( R+ e) ?
;;; global symbol AI_SELTYPE to one of the above three values to
% ?& r2 W( R! r;;; indicate the method thru which the entity was aquired.) F% H; U, f; n" M' N/ L: f

3 R6 x7 f! ?( Q$ V4 g% S6 F3 I) G( i% J
(defun ddchprop2_select ( / )
9 Y8 ^, M: Z5 M1 b
$ l1 r: t* I9 w
5 _8 u; O) b4 K9 e;returns only entities in ss that are in the current space. 1 f/ Q3 f0 k- P+ Q
(defun ss_in_current_space ( ss / a cur_space ss2)
: q) w2 @  C7 p! z1 X1 B) j% @0 M, R! |! {6 L1 Q' B
(if ss% F* V/ y; }' k5 G# F* d+ k
     (progn; f+ W- Z- k' c0 T4 |8 Q
      (if (and (equal (getvar "tilemode") 0)! G0 P' m2 \4 e4 M1 K
               (equal (getvar "cvport") 1)- }5 z1 _9 I0 ~! c
          );and 1 ^$ g4 P+ a& N  K" h
          (setq cur_space 1);then paper space is where we are.- |. h4 J# J$ |
          (setq cur_space 0);else model space.
( h( ]7 m* g7 e. K3 L1 E      );if. O- y; \$ H0 k  c, g3 H2 ^5 {& F
      (command "_.select" ss "")- \; o4 v4 p0 H% w# o
      (setq ss2 (ssget "p" (list (cons 67 cur_space))));setq$ f. U, Y* W. U1 T, w  g
      (cond                              ;;;;;tell the user what's going on.
3 m9 r% f' k+ m! l" y       ((not ss2) (princ "\nNo objects found in current space."))
- A4 Q- b2 D' c) n/ ?9 E! B' q* D       ((not (equal (sslength ss) (sslength ss2))), f% x& q' p) i5 r, R( A9 _
        (princ (strcat "\n" (itoa (- (sslength ss) (sslength ss2)))+ z, ]# Y, j8 Z% a4 \5 K+ }" B
                       " object(s) were not in current space."
: m, w, M4 _) F; G# q               ), Z( R; ~; N& t5 r2 p' _
        )( d# Y* d# V& s0 c: V
       )
! `& d2 t! P. S  M- ^      );cond ' r% s1 L; v( c6 M  ?# o: ~$ S
     );progn then
" P, k. d, T# M# d0 A );if  ! Q" s4 V1 k6 o1 Q. u
ss28 G4 i, Z! V; W8 h
);defun ss_in_current_space
7 \2 D* i5 s0 K" |8 g! C3 t4 O* P3 I

! e0 N. t% l6 I4 a: x& D) U;;;begin the work of ddchprop2_select
  f0 d" ?, ]  Z0 C' Y
1 j- Z% a, c! m& J) F( M: u ;; temporarily restore original highlight setting.
& C" a, D  C+ c; X$ E3 e- M (b_set_sysvars (assoc "HIGHLIGHT" (car bonus_varlist)))
- e3 b1 R2 h% b5 x (cond  Z# n3 B6 i/ Q3 s: Z1 I4 d4 I
   ((and ss ) Q5 \* z/ F* e7 I0 O# Z! V* m
         (eq (type ss) 'pickset)1 l. Y7 F4 G1 y5 |( ^5 Q2 Y* b. h
    )        ; selection set passed to
! |8 \* X3 m$ ^5 |3 a    (cond                                   ; (ddchprop2) as argument5 R+ g! u# [6 K& Q
     ((not (zerop (sslength ss)))       ;   If not empty, then( M; E/ d3 l# ], J5 D- {) i
      (setq ai_seltype 3)               ;   then return pickset.
5 f  \: ]0 ]  s1 x  _. v* b( d      (ai_return ss)9 x: `- n) O3 `$ R" c; R! j
     )# |9 C/ L: W' ]; H+ E
    );cond close: c4 F4 `: A' m  I& F
   );cond #1
! u9 k$ m4 H$ O* a/ L7 `$ u$ \   ((setq ss (ai_aselect)))                          ; Use current selection- }# q* U4 p# d( r/ f7 F9 D
                                                     ; set or prompt for objects
9 \( Z4 A4 }2 ?* f   (T (princ "\nNothing selected.")& L! E4 H# h* u: C+ i
      (ai_return nil)8 A4 U' b" s) G/ ~  B1 ~: ]
   )3 ?+ i3 `. U4 `1 P0 f  e
);cond close. ~. X6 J: b( [. r& W2 G' K
(b_restore_sysvars)
3 r3 a4 p+ V. e! x8 M0 l8 G5 {: E$ ^6 }
;(if ss  |! r0 k# I* p0 c0 W" l. q
;    (setq ss (ss_remove_locked ss)) 8 w$ x# c1 m* I# l/ ?
;);if
" {) r* T5 r! Z$ Q: v/ a (if ss$ r; L' U) o( R3 r% \! y' C
     (setq ss (ss_in_current_space ss))
& o! H* t$ U% y1 w0 Z9 A9 ? );if
9 S9 h6 \8 ?# t4 R+ M* }7 q1 n1 b2 M: l1 ]! E
ss
% C( v  B/ B+ B);defun ddchprop2_select5 z; |% b/ v! |5 r) w
1 V+ `4 f% x3 q3 ~$ d
$ x5 r( O& M% n% \( y% m& `9 S
;;; Define command function.
% f; t8 G' ^5 C7 v& }(defun C:CCH ()
6 k8 c% U1 G/ C/ F* f  (ddchprop2 nil)
! x% f3 b* F% r4 e  [- Y5 s6 J  (princ)
+ s( p/ _3 c6 B, u1 e( Q);defun- L3 b, @: l, ~4 }  X6 }
4 G9 V* w# Y+ a# Q/ W- q: w' G" ~

4 S- \: o) d& Y7 E) u) Y  r' l1 Q;;; Main program function - callable as a subroutine.
6 S$ u2 L( [9 |9 Q;;;
3 g: Y( W4 C+ \. T3 H;;; (ddchprop2 <pickset> )3 Q. M8 c1 K# p' z  r& ]
;;;
; i' S5 h5 c" ?/ t& B3 X: H# S;;; <pickset> is the selection set of objects to be changed.
+ Z& F1 D7 p( G;;;& n2 m  f4 f+ D( ~2 g0 Y
;;; If <pickset> is nil, then the current selection set is. J- _7 x% i! v3 t0 [+ \  S
;;; aquired, if one exists.  Otherwise, the user is prompted& L- h' M. q! J* M& t/ S* |
;;; to select the objects to be changed.- f4 ^! B. q4 s6 t; n" m
;;;
9 S6 S: U0 P* i& j;;; Before (ddchprop2) can be called as a subroutine, it must5 M# w0 u7 Q4 _8 G+ k! U; A
;;; be loaded first.  It is up to the calling application to
9 x8 i7 m7 w* Y4 q;;; first determine this, and load it if necessary.
9 w% F8 Q- |: f. G& V, l7 L: @& W: t( d6 H/ G
(defun ddchprop2 (ss  /
; A: u; z8 @" S
+ X# [) h: x: P; O                  a" a' b; E$ h/ o$ n5 n  X
                  add-mdash% m! H* S8 Y6 a
                  assoclist. g$ t. ]4 w+ Q/ t$ T$ A- f
                  bit-70$ M! s+ e" K* m4 F8 ?
                  boxlength
3 m1 c9 u  t, E% q: H! r                  bylayer-lt
- P) e" R& H8 i                  bylayer_col% W0 q5 D2 ]; S: K  X" F2 J$ J, s
                  bylayer_lt
' X7 H5 \* C7 b3 C2 ~2 a; g                  call_chp2$ w9 L) s! a- \* }; t
                  chk-col: Y/ w& c0 s- q: n" G1 o
                  ;chk-etype        ;var removed by rk ( k# }- Z; r! P8 |; P/ Z
                  chk-lay    % G- p2 C3 v: Y
                  chk-lt
. n( d0 T4 E' Z! x                  chk-lts           ;var added by rk
6 {! A2 S( X5 c6 F& T& D( m                  chk-th: H; t' N7 O4 d, T6 K* W: {
                  cmd! d, G4 O; T7 V3 O2 h7 f
                  cmdecho3 H  d" ~# E* y" u) M
                  cn
" j% n5 D7 i! I                  cnum
! [7 F1 S4 [2 V. Q$ v% M. ]                  col-idx  b' j. J! G/ |1 S; R
                  col_def
& v% y$ Z2 [( u4 y6 x. \4 c                  col_tile8 J# K* F% w3 o0 f, V8 B/ b
                  colname6 Y( J$ `! s) P9 G1 ~5 R
                  colnum. [% d* K/ v* @( a0 H2 i5 T
                  color4 V* n6 R+ g& y& d
                  colorname
/ G8 @$ C+ k* c) H, P                  cvpname$ f" c' |$ L( f/ z/ T1 T5 u/ U. [
                  dash+ @2 }; g" X( y1 A4 c
                  dashdata. ?0 p! |6 M, t& c1 ?
                  dashlist& P; L$ Z) W; \# E9 _/ w
                  dashsize
% r0 P0 c8 o5 k( d                  dcl_id) k( \7 U) K0 R' x* e8 y
                  ddchprop-err
0 _7 R# ^+ K$ _                  drawpattern  ~( K6 c/ ^; m* [9 E$ j
                  ecolor
' e1 x9 B& s" R9 i                  eelevation
, i. l$ T& U+ J2 p                  eflag/ i7 l0 S% @  \& X6 L/ m2 W& `7 n: g
                  eheight
1 V' q: X1 _1 q; e: q) b                  elayer
+ ?$ j: g% r! e% s) A                  elevation
. R' @4 q+ Z4 t) F- w( b                  elist! \% u1 H" K; [- v  j) h
                  eltscale
# t8 {2 i0 ~2 G! @8 a                  eltype0 m" M* M9 U/ O) `0 e
                  en
* u3 n5 c" s, `; D                  ename
, r& r  V6 V" x& `                  ESTYLE             ;var added by rk$ ^" j0 X0 B! i7 _$ s6 P5 ^& ^" b
                  ethickness, w0 e5 I* c1 N
                  ;etype             ;var removed by rk
9 d1 Y0 E8 _% {$ @                  ewidth
! e1 L/ p" M+ ]/ A/ [9 m/ F                  fchk
6 P) B9 Y: K: s                  frozth& C$ E+ O2 V1 G. G( h8 s4 k. u* U
                  fx
" j+ t8 \( i4 P( k7 v4 z                  getcolor4 }6 ~% G+ L. l) R; Y' i
                  GETELEVATION      ;function added by rk
% C7 v! l( Z9 D, X  }& G                  GETHEIGHT         ;function added by rk; c3 l! y: Z3 e* Y; j5 K0 B2 C
                  getindex
  y  |! L4 F5 B                  getlayer% Q/ B* z. H8 A2 R/ a
                  ;get_locked_layers ;function added and then removed by rk 0 h$ b. Y* q  b
                  getltype4 r* g( T. T0 B7 g' F
                  getprops1 p! J2 j1 S! i$ |1 ~. y
                  getscale          ;function added by rk5 y) D( o6 \3 e, U
                  GETSTYLE          ;function added by rk
; Y4 r- j/ a" y( K/ `. _                  getthickness
' @" }: H2 {. V# K  B                  GETWIDTH          ;function added by rk$ ?1 b1 u# Y# s* T4 U& y6 T
                  globals, k9 {( ~8 z3 C
                  HAIR_STYLE_LIST   ;var added by rk
1 b. }' }0 B0 W# D" N) W                  height
4 P2 S  P; l3 s                  index' Q$ T# L0 _' t/ A
                  item. a4 O1 \' ?; `( l  O2 X# [
                  item1, T8 g5 a) c/ U( o9 ~# g/ N
                  item24 u3 o5 W3 g9 w4 O0 t
                  itemlist
* |% a' E  S) @. e                  lay-idx: H5 G3 R( o' o/ T; U9 r; F' z0 l
                  layedit_act2 a4 X2 u$ Y. @" C  ~' Y
                  layer8 @" m' b) e$ K" h8 J8 k) `1 c
                  layinfo
0 |- x& B8 l; T5 u1 i$ a' y( k                  laylist+ g7 k8 U3 |; D! W! _4 n4 F/ R5 [
                  laylist_act0 d. _. ], m4 r1 R6 @3 s
                  layname% x" B9 R0 G7 T* D) _
                  laynmlst
  S! A! x, U: ?0 c3 e1 z                  layvalue+ H3 W) o& V  W- z* n4 i
                  linetype% z" K- o" X9 o' U$ p% L
                  list1
! j# g, g; e: M, c6 G                  longlist
4 q0 K+ C. ^, d' V                  lt-idx+ z# e0 r. |0 I7 @3 ?* Z7 c
                  ltabstr4 e2 P6 `. W( X) u: y7 j; _
                  ltedit_act+ [9 Z/ k( A) \
                  ltidx, o+ c7 {5 T/ I5 L! @' z2 q# _
                  ltlist
( h* Q& A. Z/ f0 z3 B5 f. R9 W                  ltlist1
( r8 w' `0 v4 n$ Y) T3 ^. A                  ltlist_act
+ b. C" B) M) j1 Z                  ltname
+ `4 l  Z" ?7 ~( l* t0 O! a+ Y# V                  ltnmlst
. t  u7 R; n( P5 @4 o                  ltvalue& I  {4 @  s) O5 s6 |9 S9 |
                  ltype% u5 L1 f3 |! L$ u& `8 B2 x
                  m
; d1 I, s7 j9 w9 k' M0 C                  makelaylists; c7 h$ k* s9 h( }+ f+ W
                  makeltlists
* c3 D. e2 U# H7 i7 N$ U, J                  match-col
: }$ U: `  X; v' {, c. t. r! G                  ;match-etype          ;function removed by rk
& \1 P, ^& Z7 f' ^                  match-in6 u  K; F8 ~& Y. Y4 ]9 Q# J! u
                  match-lay6 W7 \3 `" C; p0 m# p* C" K
                  match-lt% b; |: [6 a) c# s
                  match-lts
$ _8 W4 ^# O9 f# p7 O9 J- C                  match-th7 i) o( m' B% [3 ^
                  match_col( w3 A8 _" j; a9 E4 ^  H
                  mdashlist" E. F" u2 k2 X6 y2 W. C
                  ;MPOPLST               ;function added and then move to ac_bonus.lsp by rk
/ f  Q/ @& g6 `$ s' Y3 m                  n
; j* [1 N- j; q8 b2 |                  name6 |2 \0 z! \) y7 n1 h2 l3 `" Y
                  ncolor, k9 J7 {5 I0 p. ?% f. s
                  nlayer
8 W5 a5 S4 ]3 ~+ w                  nltype
* E/ j' A$ M8 e4 g3 G5 ~                  nthickness
" Z5 H% g; K, v  W% v6 L                  off. l# R7 Q! U, b
                  old-idx% o; ~$ r, Q" O& Q$ ]4 }
                  olderr- ~3 w5 b! [0 S$ \% Q+ o
                  on
2 y5 l/ G  ]$ t& _, p8 K                  onoff# l9 c! D4 G6 N
                  patlist! j( n8 a( p; t3 |) h2 o1 w3 h/ U
                  pattern
0 Z6 c& f# D. p+ }                  PL_WIDTH_GETTER       ;function added by rk2 x6 S& `9 a  \! D! c
                  POLY_SS               ;var added by rk
) I  N1 g3 w4 @% {3 T% J% b                  ;POSITION              ;function added by rk and then moved to ac_bonus.lsp
7 {" h4 }7 d. o                  proplist
- N6 X5 O3 O+ I1 v                  reset-lay
2 @6 Q2 T. O7 D4 d: e                  reset-lt
( h# C8 P/ k$ `0 R2 I                  s7 ?+ h0 |4 |8 m" Y% Q, o
                  selset2 Z- E2 U3 K; s0 v
                  set_col_tile' N& j8 H: N  }% m: ]: B4 h  e: C
                  sortlist
8 _) N2 h* G& N& i/ s) m2 @$ j. L                  ss
, v# i6 x) T. B+ v2 \                  ss_in_current_space  ;function add by rk.; p8 D* [6 @, n5 J+ T* G( J) M
                  ss-index
4 H) {5 {% ~0 u  @! s                  ss-length& p- o- z: r) `: X0 w3 U2 j
                  ;ss_remove_locked     ;function added and then removed by rk.8 {; M% I. y% n" X
                  sslen, |8 I% G  m1 G/ t0 f  v- n
                  temp_color
: o0 _1 e0 |+ ~, i6 `, X" F                  templist. U, w% c* S: s
                  test-main-ok
5 i9 J6 f0 C2 U" d1 D                  test-ok& A& s# ]5 g* K7 A
                  testidx; {! W$ {* k+ Q) |# b2 a+ `, l/ X% N
                  testlay  j; d# ~1 b6 ?3 [7 J
                  th-value
* ]$ X6 g4 g2 X                  thickness6 q7 C/ y" A) w) r8 A3 J
                  tile
/ }* `% d5 j: n' i% y/ K. {+ S2 z7 @                  tile_rect  h/ O5 Q8 Q0 D2 h  \) C
                  tilemode
& r7 [3 _; W" |7 |; a( S5 F6 ~                  ;TNLIST           ;function removed and moved to ac_bonus.lsp by rk
, ^+ G& _( [4 W8 g+ r                  TXT_SS            ;var added by rk
7 r: z* ]8 |0 l                  ;undo_init        ;removed by rk.# i0 @! q( c& a5 b
                  vi
& F; \1 G' }# Z% E! e/ p5 F                  vpf
+ A5 [6 D/ F6 v' T                  vpldata4 B; {6 n* n5 P
                  vpn
" U) G" r. F) j/ {1 d, z                  which_tiles
( R$ j5 Y0 P2 {5 a4 {& A% e                  width
  \8 w- o& O, ?  `5 \+ o                  x
* n1 _+ [- {4 b                  x11 w  h1 |8 u6 M% a
                  x2$ u$ o1 c4 k' \- y1 E
                  xdlist; s5 K- J; G% E5 v6 {9 K
                  y
3 T. N: h# z) r8 T                  y1$ l2 Z6 I! \+ M, x. k
                  y26 P( S& P  o6 k# p9 Q
                )
! M; P6 M  I: f  n) m3 G
, s4 o6 C% v+ E- A- k9 y! B, j  (if (and (not init_bonus_error) 8 B- a/ ?9 t* M9 {! x0 L3 q
           (equal -1 (load "ac_bonus.lsp"  -1))
. s: u" W' {  ]! n2 y+ _! m      );and
; b+ S  k. P! w8 ]  O/ Z      (progn (alert "Error:\n     Cannot find AC_BONUS.LSP.")(exit))* ]" o2 |8 t5 ?) B' J! n5 B+ Q; H
  );if2 |0 ]( o1 ~  R5 t' z
  (init_bonus_error (list/ C% p' J" I" _/ b0 D
                     (list   "cmdecho" 0
9 L2 y' @) ^. e+ d& s5 x* f                           "highlight" 0
% V7 M( \, H& G: d) Z" Y* D                           "regenmode" 1
# x0 |6 m$ e  c5 A/ g  Z9 w2 G8 Z                             "ucsicon" 06 o: f. P# q3 z; k0 \  X
                     ) 5 `# S% |4 u4 r, c1 B1 V6 `
                     T     ;flag. True means use undo for error clean up.                    0 T5 W& x( @/ U( g/ F3 `7 c, \
                    );list  
; a, `" ~7 }* F7 A# Z8 o. X" x  );init_bonus_error
4 ?& f8 @+ Y0 g* b5 H' a
7 ^9 J- o$ }# v: j+ b' A( l  (cond
; B; c$ q& A& P9 v( C, ]$ Q# _     (  (not (ai_notrans)))                       ; Not transparent?
# u) Z* q4 l; J$ L) n' z     (  (not (ai_acadapp)))                       ; ACADAPP.EXP xloaded?7 X7 p2 H- k* l2 n$ q( ?, T/ C
     (  (not (setq dcl_id (ai_dcl "exchprop")))) ; is .DCL file loaded?
- x& d# O4 u: R1 [* ]     (  (not (setq ss (ddchprop2_select))))       ; objects to modify?* W( \: \0 U$ s
     (t % u# I( O) z1 t
        ;(ai_undo_push)
- N5 M! b- F, ~. d4 ]; a        (ddchprop2_init)                          ; Everything's cool,9 Y/ G5 l) _1 B9 ]8 z
        (call_chp2)                               ; so proceed!
- N7 _. b6 `' l# _. R! N' t, Y# p        ;(ai_undo_pop)
  U- {/ [0 j( z% ]  [  D* Y     ), [1 ]  \; r, u0 |5 f& ?
  );cond close
9 o3 O0 A3 c" [- C% \9 w2 W! k) k/ {1 Y4 b  q. F; V
  (restore_old_error)
$ w. W7 r4 Q! T; T7 [* W& c  h  ?. \0 X( d5 T" j% J) D+ A6 d* [3 Z
(princ)
8 O7 n3 K. z: l* {5 q);defun ddchprop2
  x  F/ M4 j& T" x  M, `4 x0 O1 i/ j, Q: o$ W
;;;----------------------------------------------------------------------------
  }3 w2 r+ O  d; {' Y5 i
: M2 e( \3 ]/ ]$ H' j: e+ z(princ "   EXCHPROP loaded.")& ?* T. _* d+ h5 V3 T0 l+ D
(princ)8 [  o5 |2 p7 C6 Q& u" G& z

' w% ]8 I7 a/ U( M$ p;;;----------------------------------------------------------------------------! T3 Q# D$ ^: K# z! e0 {; c0 h- F
;;;---------------------------------DDCOLOR_LSP--------------------------------
+ q, c/ }* A, W3 d. t8 w# ?4 M;;;----------------------------------------------------------------------------/ W7 [/ M/ F! |$ f9 V
- O+ e7 v/ ~! {, Q" d# z/ m
; Next available MSG number is    24 0 \1 B: Y+ C1 E# e) I( B# K! V
; MODULE_ID DDCOLOR_LSP_3 T0 w0 c% I5 g" V+ [$ |1 d
;;;
+ J& P7 W4 b( w) r, n# ^, e;;;    ddcolor.lsp
" e1 ~5 x% \  P;;;   
0 D, F+ S9 |; Q* E3 m) B- {;;;    Copyright 1990, 1992, 1994, 1996 by Autodesk, Inc." k; d: g, ^, k3 a8 A
;;;( W# k& d1 k: m* I. j
;;;    Permission to use, copy, modify, and distribute this software
3 P- p7 v: ~0 {6 v  j; P5 J;;;    for any purpose and without fee is hereby granted, provided
  s% ], w) d, j0 E$ W: V, ^;;;    that the above copyright notice appears in all copies and& p$ b3 j* \  Q+ P! W% e" o# @
;;;    that both that copyright notice and the limited warranty and5 e$ e- @. m7 u
;;;    restricted rights notice below appear in all supporting
" ]- Y' o( M" M$ B0 L5 y;;;    documentation.
' k# h% k5 L# s, E;;;  U* A: P( ]$ P$ h
;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.1 O' }- J/ P. L- Y  E' _0 G
;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
  v( [& Z% m) q' A' d;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.+ }3 t* \  }& L( h) a  J) }* |
;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
$ ^0 a% D4 [3 k;;;    UNINTERRUPTED OR ERROR FREE.* r) v" {4 ]) |. a- A$ G& {
;;;- Q7 X. S! q2 p0 z- B
;;;    Use, duplication, or disclosure by the U.S. Government is subject to
5 L1 U/ V! }2 j/ E7 m  n$ Y9 r;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer2 C: j/ P* H* P# ]( `" L8 o9 O
;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)   z* e+ Z6 Q+ l) G5 D% S
;;;    (Rights in Technical Data and Computer Software), as applicable.7 Y2 N; [( `3 A$ F6 l8 f/ w( K
;;;; D4 Y( d" U' g9 T
;;;.; E$ T( p- U0 \
;;;- a$ q7 C. W, ~: u! {  p
;;;----------------------------------------------------------------------------5 D: _% }' h8 `# Y
;;;    DESCRIPTION
+ B. ?. w( O' J, c, I' L( T  Y' h;;;     " ?4 _. p, x5 z* K5 x" X
;;;    Chromatic Pallete style color selection dialog./ w5 G$ `5 i3 e: J
;;;    # h2 U$ l' A( L6 Z* W7 o
;;;    Globals:1 T4 H: b( h8 s  c: w- ~
;;;    7 }% P' u, ]$ X8 R
;;;          chroma_color - Integer color index.  The last value selected
8 @" u" g8 f$ b( E. d5 n1 F5 h;;;              by the user in chroma dialog.  It is not cleared or reset9 `' t  p, o6 @
;;;              by a cancel.  Only used for communication between callback* p9 w) j/ y1 ^- `# z# C7 }& l
;;;              functions and the (chroma) funciton.
/ f: E) r. Z9 Z$ {# p9 O;;;   
" m8 `6 |, w6 n+ D;;;    Depends on the definitions for the dialog provided in chroma.dcl.
: O  U1 Q$ V% {& f7 h! W;;;   
( A8 ^, F6 b: U- i! i;;;! l6 n8 r! |/ B* F! \
;;; C:DDCOLOR -- Dialogue front end to the CECOLOR sysvar.  Uses the chroma
& X3 y- S: ]$ t, R1 N; n& r5 C;;; pallete style color selector.
% P" U+ L/ m- p+ j. _. o' o" n0 I* o;;;; C7 M( K/ D3 x4 J/ W
;;; ===========================================================================2 `% z* y  o/ {3 c4 N
;;; ===================== load-time error checking ============================
; l% ?8 n& _6 I;;;0 R* z0 Y- l% N1 G

* m  R) u$ H/ L; |# W: @6 {  (defun ai_abort (app msg)# j: H! m) s' A9 o4 y0 q$ G
     (defun *error* (s)9 g( W$ U& e: C$ a
        (if old_error (setq *error* old_error)), j8 {; Y: w; \8 n9 G% P2 K8 b
        (princ)0 t( C- H" `" F" P6 i
     )
) H: B3 v) h* ]     (if msg! B. l4 M% |( k1 A% A; p, q. {
       (alert (strcat " Application error: "
; |0 @, n, {9 e, [2 T                      app6 H. ~  S3 |8 u4 ?9 i+ v+ S
                      " \n\n  "
: o3 e& J2 o7 x8 t5 L0 U                      msg
4 F' n5 v2 C3 F+ ^) v6 @                      "  \n"
0 S9 v5 _5 a2 `* l              )9 @0 R% G* X4 e+ ?. O( n
       )9 D) f$ u# J5 u1 \
     )! O$ j( z5 H% I8 E" L# Q
     (exit); V" k, \. h& m5 }1 ]; ]% [5 v
  )
: Q* z: D8 i7 m$ e5 e0 A5 c( h  H4 `( m+ e1 q' ]. ]0 w
;;; Check to see if AI_UTILS is loaded, If not, try to find it,
) y( ~! F1 o, \1 D  E  o;;; and then try to load it.8 {* Q8 M4 N: t) Z9 I$ a4 U/ j
;;;$ f( z) y& v% V# F7 \) N
;;; If it can't be found or it can't be loaded, then abort the
( ]2 {7 `9 \$ q+ X+ h# G, R;;; loading of this file immediately, preserving the (autoload)
0 g' ]9 P3 h+ I3 V; h3 `& \;;; stub function.! x* n* c' {! I! h& x4 v0 K% s3 x
$ ~0 V5 k) z5 ]: R3 f. ~- A1 j
  (cond- z  f- T3 ^! m
     (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.% M: G5 y4 v- W) w* [

5 i( I' O2 X' g  n- s4 a     (  (not (findfile "ai_utils.lsp"))                     ; find it
9 K* r5 V1 r9 u) h        (ai_abort "DDCOLOR"& }$ b1 f: x9 `1 ^
                  (strcat "Can't locate file AI_UTILS.LSP."
4 N$ T6 L% Z3 J8 w) F. \$ I) E                          "\n Check support directory.")))
3 H$ f' ^9 E) S2 Q* T% P/ W9 x+ G* }6 D. a" n+ \; v4 e# s
     (  (eq "failed" (load "ai_utils" "failed"))            ; load it
5 V( P( h& a; K        (ai_abort "DDCOLOR" "Can't load file AI_UTILS.LSP"))
; v% n9 u- k/ @4 _- W, q; Y1 G  ). \9 X. r& o( }( \" z8 Y
2 r/ M! }+ I  s/ p0 ]8 w
  (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP5 @1 K6 T: _, T+ K) t( y
      (ai_abort "DDCOLOR" nil)         ; a Nil <msg> supresses" M3 [1 ?; @( [
  )                                    ; ai_abort's alert box dialog.
9 @  y# A' u0 z* [
; g; j7 X( |1 N* ~;;; ==================== end load-time operations ===========================
5 _5 {! R% ]' V3 }( p2 l6 C8 z/ |" a6 r) Q) J6 D+ O8 x
(defun c:ccc (/ co_oce clrx co_err co_oer lay_clr)
, z0 _+ E+ t; ?' j+ g) y  _' ^
, t  c7 V9 k) g) t2 S# r$ n& ~0 x" s! m  ;; Main Color function, called by setup code.& ^" \. V8 {8 n
  (defun ddcolor_main()
  v( }5 @6 }+ w% d; [( _+ c. ]& ^% `, K0 X) X, v
    (graphscr)* b/ B/ i3 y5 |" W' e5 h
. B( d2 s/ v! [1 ^, W7 w
    ;; Get the color of the current layer, for possible BYLAYER color swatch.$ G6 O5 d8 @- i% g/ W# I
    (setq lay_clr (cdr (assoc 62 (tblsearch "layer" (getvar "clayer")))))  n% L5 t5 W$ C8 x( i( U

/ \4 W7 `8 v2 V: t* U6 q    ;; Call the dialog here...
5 y/ U6 g; r; [# a/ _- |  V    (setq clr (acad_colordlg (cstoci (getvar "cecolor")) T lay_clr))
9 x: i" r' q8 c
! y# \2 ]: y9 P" w/ Q    (if clr
1 s5 }4 T4 G1 ^7 S      (setvar "CECOLOR" (citocs clr)))/ T; d" s) s6 `' M5 d, A1 [
  )
* K# s# Y1 q" r; f, P; V( B6 O- J4 n- X& E  S' X
  ;;;
% Z7 w; h  e5 [1 ~0 ?  ;;; CSTOCI -- Color string to color index
, M( z- Y. o) q+ b  ;;;   Convert an arbitrary case string into a color index.
; @5 t& J5 h9 o; u  ;;;   Returns nil if string is not a valid color.9 w' r5 i) O+ C' e, d% G! S- T
  ;;;2 d- Z. s' v# |
  (defun cstoci (str)4 D* w' k4 q- j
    (setq str (strcase str)), z) i& t; ^$ E9 x
    (cond
  a/ `" Y  I/ P/ R) k5 O* l9 K     ((= str "RED")        1)2 ]3 w( W( j; U6 A8 q5 a
     ((= str "YELLOW")     2)' ]' L: g* x4 {" f* Z% ~2 n0 S' b
     ((= str "GREEN")      3)
# h: }! d* B+ P. Q2 U     ((= str "CYAN")       4)
/ G7 a" m+ d2 ]7 `6 _     ((= str "BLUE")       5)
1 [# l3 C& `6 v# [- C' H# x     ((= str "MAGENTA")    6)1 h2 ]8 J( S6 ?5 S
     ((= str "WHITE")      7)
4 ]: M& w  y' l     ((= str "BYLAYER")  256)
/ O; b7 }& ]& D4 l: O2 B     ((= str "BYBLOCK")    0); J3 F4 D" L* O6 N3 P& u+ B
     ((= str "BY LAYER") 256)& e/ m% G1 v" L4 f) R7 a
     ((= str "BY BLOCK")   0)
  |. T9 @  l3 r9 {& z8 S) d* Q     ((and (< 0 (atoi str)) (> 256 (atoi str))) (atoi str))6 }1 g0 o, C* n8 m4 }7 X" O+ W, t2 X# Y
     (nil))
) _3 R$ J; d5 ^' P+ E+ f  )* k4 l; r4 m3 H3 G( _/ n0 D: i: `- q

  t) `1 A. n4 L) S! k$ w1 C9 }" L. I7 {! @) R. \; E
  ;;;. l& b, x. [  G0 }8 g
  ;;; CITOCS -- Convert color index into standard color name.
, k/ I! V* ]2 Q- ?; A- h6 v5 a2 x0 S  ;;;    Will return the standard and logical color names as text- w6 W2 k+ I5 v* a
  ;;;    strings.  Returns nil for out-of-range color indicies.7 I( B! l* X7 k; X* E+ Q; ]
  ;;;9 m: x4 R# V( e  n1 g
  (defun citocs(i)5 ~" E% Z* B! g" d+ T
    (cond  K# u3 `1 W. M. E( E6 m
     ((= i 0)   "BYBLOCK")
0 P! d/ ?4 a$ \: y" x     ((= i 1)   "red")
4 i# d/ N. a  a     ((= i 2)   "yellow")
7 G+ g$ a: w: T* {5 l     ((= i 3)   "green")4 ^1 w. l4 [% C' s
     ((= i 4)   "cyan"): f$ `$ n2 Z" W4 z  J
     ((= i 5)   "blue")  ?1 b, q) `4 m! D
     ((= i 6)   "magenta")
" l2 S1 ]8 M/ \+ r% ^" p     ((= i 7)   "white")
7 @3 L% D* Q' {) M8 n     ((= i 256) "BYLAYER"); g) k; y0 q  Q
     ((and (< 0 i) (> 256 i)) (itoa i))' p( v% }; y* p) ~6 f
     (nil))1 _* {4 a# ~; Y6 G) h# s1 c1 ~$ \8 d
  )6 Y% n$ ^4 y/ \( m) w  }- Z

7 Y+ _+ Q7 e: S% \  ;; Start of ddcolor( ?, N' D' W* L3 V+ z# d% z4 X# u
  (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho6 K, |5 `7 t. w3 s* |
        old_error  *error*            ; save current error function3 d( C' r& L% K5 ?7 z# {
        *error* ai_error              ; new error function( Q# T1 ]- }5 j( C5 i( R/ H
  ): K' v9 H  l3 {7 {0 r% ~  o8 k) ^

$ O6 F3 N) ^. {0 J% I  (setvar "cmdecho" 0)
& I7 `3 z: ^9 I: S5 x* ^& D5 C! o+ R8 s+ ~4 \1 w/ k
  (cond- r; P2 t( \; s" I! g% j* w1 {3 ?
     (  (not (ai_trans)))                        ; transparent OK- p- g! t  q1 [. ~
     (  (not (ai_acadapp)))                      ; ACADAPP.EXP xloaded?
* O/ Z( @6 z3 d+ J8 n7 r( \* `. X; b$ ~4 a( k3 V2 K
     (t (if (and (/= 1 (logand 1 (getvar "cmdactive")))
! g% L( Y( }: l- }                 (/= 8 (logand 8 (getvar "cmdactive")))$ V' U4 t5 }" _7 h7 b
            )
) I& e/ M- k- l+ B% H* J/ c         (ai_undo_push)
2 V) E7 v4 O0 K3 b  U4 J        )/ W3 t8 u& K% x
1 c( T4 i% e2 [0 `/ I
        (ddcolor_main)                          ; proceed!& [& b$ X2 D& n+ q+ @
0 W. L. W, H: p
        (if (and (/= 1 (logand 1 (getvar "cmdactive")))+ G. |0 y0 i$ q0 b9 W
                 (/= 8 (logand 8 (getvar "cmdactive")))5 o5 a8 v* M1 a7 h& X, _, U
            )
) A) c  N% _1 E) B1 C         (ai_undo_pop)
' m* s) f6 y7 Y0 }) L        )! u2 j  _0 W* Z6 Q
     )2 E( U3 V. T) Q4 {9 S
  ): V! ?. `# S% f. I+ |

& v- S5 _2 P9 i! ~2 F  (setq *error* old_error) 8 l  t0 M% c- @8 v6 R$ M% @- T
  (setvar "cmdecho" old_cmd)5 n2 ^$ [' G; y
  (princ)6 w2 ?- ~; ?4 n0 }+ v- B! G, O1 k
$ S" q7 {! I* l$ @9 y
)
+ {5 t( S3 X) h) E6 Q& d, X: \- u
;;;----------------------------------------------------------------------------4 u5 E* z2 {# C. T6 q1 l/ W

5 {0 H+ y) w; c+ b(princ "  DDCOLOR loaded.  ")7 D- u, z1 [* D
(princ)' o( |, K' k. O& \

! W# m. G4 R& W  X# I;;;--------------------------------------------------------------------------;$ `& v! I7 j5 l- N3 T( O+ `/ ~
;;;---------------Chon NHANH Nhieu Doi Tuong GIONG THUOC TINH----------------;% @) [: ]7 @0 e# I! G+ T
;;;--------------------------------------------------------------------------;
) M) w$ ?4 z6 k: N; m;;;   ssx.lsp
: c+ D' n) y* d1 H0 ]3 K;;;   Copyright (C) 1990 by Autodesk, Inc.7 V, U7 M1 d' V; P5 |
;;;   Copyright (C) 1991 by Control Systems, Inc.
2 j/ e, }+ `: S/ h  K6 b;;;! d; L. [6 V% |. j7 ]
;;;   Permission to use, copy, modify, and distribute this software and its# n' m: U$ `  B8 K4 q
;;;   documentation for any purpose and without fee is hereby granted.; n) c# g9 y! I* V+ F  g0 G
;;;
2 V) J: h. v0 Z9 `) w& g;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.6 U3 m3 U8 h1 d- A/ w3 G
;;;   ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
- C1 Y# }5 v' ]6 k6 v;;;   MERCHANTABILITY ARE HEREBY DISCLAIMED.
; v0 u! E! Z( X9 p( n( w;;;& A, ?* J$ z% H) @3 |- K8 {
;;;   Larry Knott                        Version 2.0    7/18/88
4 }8 y  w/ Q; w% r/ @3 o$ s! R;;;   Carl Bethea & Jan S. Yoder         Version 3.0
2 w  U, Q; W7 R: I* X;;;   Enhancements to (ssx).
' K" R/ Y" \& o# q  a& K! m( {;;;   15 March 1990
/ T' D3 C' ~8 ?# d( X7 m6 e1 S;;;
, l. ^) n8 I( H# s$ ];;;   ARTIST Software, Inc               Version 4.0   December 1991
! c, b! Z& o. @, ]5 r2 Y;;;   Modified for FLEXICON usage. If the variable FLEXVAR = 1,
/ c9 [# u( C8 N. j" N% C, c# @; e;;;   use Flexicon menus8 N# X5 `5 `- g: y
;;;7 E: f$ l! K+ E: P  \
;;;--------------------------------------------------------------------------;. p& L4 w$ C' J& u6 I7 I( Z
;;; DESCRIPTION
, g2 c, p0 ]2 q  t! d2 u0 d- P' w;;;                              SSX.LSP                                 
0 C1 k3 u8 N' n8 r;;;                                                                          
; W2 }: |, R" _. V; s7 T; J;;;   "(SSX)" -  Easy SSGET filter routine.                                    
" P/ \! R$ k6 u# @7 o;;;                                                                           
( I) r+ ^: \0 Q' w( U;;;   Creates a selection set.  Either type "SSX" at the "Command:" prompt   / l4 N, w$ z7 [1 ~3 P4 Q6 P# `
;;;   to create a "previous" selection set or type "(SSX)" in response to 3 Q7 F2 X# v0 U8 V* `
;;;   any "Select objects:" prompt.  You may use the functions "(A)" to add
* {1 y( a4 E2 u$ E% Z$ K;;;   entities and "(R)" to remove entities from a selection set during
& ~5 d7 }. i' _# y8 ^7 T;;;   object selection.  More than one filter criteria can be used at a
1 k9 D1 S- L. e6 J;;;   time.         
8 v/ ~8 X6 Q) N$ K/ |& };;;                                                                          ) K0 l4 I8 E# C; M
;;;   SSX returns a selection set either exactly like a selected8 ^& o! `6 |( {6 M
;;;   entity or, by adjusting the filter list, similar to it.# h+ h; g, [3 }# Z
;;;
' j% S: f( R3 b1 R;;;   The initial prompt is this:" T4 m% z& a2 A9 Y  Y; d, K+ v% p
;;;   
* c6 c$ P4 Y, E& b! ^;;;     Command: ssx
6 h, e. F% j% o/ s/ z* E( b* u;;;     Select object/<None>: (RETURN)
6 o4 Q- S7 ]$ L& X+ F. M;;;     >>Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector:
# y3 Y+ N' a% j1 _;;;   
7 c: d- N4 ^3 S: }% M; u" o;;;   Pressing RETURN at the initial prompt gives you a null selection
0 J; c" n( R4 t$ o8 H; Q, n) i;;;   mechanism just as (ssx) did in Release 10, but you may select an 4 O! X- N3 S0 A! p
;;;   entity if you desire.  If you do so, then the list of valid types + E+ e+ C9 B8 u3 `" M# m5 w0 h( F
;;;   allowed by (ssget "x") are presented on the command line.% p( r! q* m1 i8 F/ U  ]8 a
;;;   
! [8 J! d: Z* r- r- o' M2 [9 m; W0 x;;;     Select object/<None>:  (a LINE selected)
( N6 l9 g# O; `;;;     Filter: ((0 . "LINE") (8 . "0") (39 . 2.0) (62 . 1) (210 0.0 0.0 1.0))
. u- X( ^+ y  z; m6 r. D) _9 o;;;     >>Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector: 7 r0 q6 ~3 H0 Y4 S1 d
;;;   
' C; E9 Q2 V) K5 y8 f( a6 c;;;   At this point any of these filters may be removed by selecting the
  G( U+ f; O. W3 I. R5 ];;;   option keyword, then pressing RETURN.# ?" U7 l' A, R" Z  {+ h3 [
;;;   
/ |" e! X4 r4 g4 S" J& F+ e;;;     >>Layer name to add/<RETURN to remove>: (RETURN)* d2 I, K4 Z1 k3 r9 c
;;;         
: H  n7 c& L! W+ |+ F  q  t;;;     Filter: ((0 . "LINE") (39 . 2.0) (62 . 1) (210 0.0 0.0 1.0))1 u- K* A: e+ }& b/ S
;;;     >>Block name/Color/Entity/Flag/LAyer/LType/Pick/Style/Thickness/Vector:
- f- {2 f, h: F9 i# M  I4 b9 K2 ~;;;   
' ]7 |: o: s  u* W) r" t;;;   If an item exists in the filter list and you elect to add a new item,
1 u9 r( E, V. p- W;;;   the old value is overwritten by the new value, as you can have only
/ q6 B& _0 j- b( r8 y;;;   one of each type in a single (ssget "x") call.
  I* j# s( A1 `1 X) E9 K;;;: d5 w" u3 A8 i
;;;--------------------------------------------------------------------------;
4 {: c9 C% C, i% ?/ y8 g;;;
" _' G  b' ~7 m9 ]; i3 W5 N;;; Find the dotted pairs that are valid filters for ssget! A. C# \) a$ A8 R+ D& e9 M, X. X
;;; in entity named "ent".
/ J0 C4 A( I( S;;;2 b9 A! i" \5 u8 `! u
;;; ssx_fe == SSX_Find_Entity1 Q" `6 v3 q) w4 a8 h% J
;;;
8 T9 L) ^6 I3 @+ Y" G9 z9 r(defun ssx_fe (/ x data fltr ent)- x% {# M- i% P% U1 [- P
  (if (and (= flexvar 1)(/= t2 "Pick"))5 N, x& J. Z! ^) {$ Z
   (setq ent nil)" p2 d  d5 {; Z
   (setq ent (car (entsel "\nSelect object/<None>: ")))7 y8 l! O0 C# P) n
  ), f' I  \; y+ Y3 n/ y  B, l: x
  (if ent
6 b; i, U" ]. J& h2 L5 p* B# a    (progn
3 e+ u0 B# W. |. U+ ^. c$ g      (setq data (entget ent))4 }* n2 ^- R. @
      (foreach x '(0 2 6 7 8 39 62 66 210) ; do not include 380 G  V& }4 P% W
        (if (assoc x data): k7 G2 a2 ^5 d  {- u
          (setq fltr , C& c8 \0 l4 S: c6 P7 [% `; w
            (cons (assoc x data) fltr); u/ j# P6 P! M7 ]9 M
          )9 _' G# ~( B$ ~9 M6 e1 B/ u. c
        )
; P( Q) t8 u. e6 x+ c: h      )    7 g9 Q/ z% [( J
      (reverse fltr)* T& @3 L7 L: E+ ~% x
    ), ?4 R: S6 I% H: ?, ^* b
  ) 6 s$ C- l# N+ G5 f9 {% ?
)6 O# W) [, K- J. p1 o2 n
;;;
1 a! f( W! m4 l: y;;; Remove "element" from "alist".  L/ ~; I8 I" y6 R
;;;
4 V& D, n0 b+ H$ r1 W;;; ssx_re == SSX_Remove_Element
8 |/ f/ ?/ [+ |$ M% x;;;
! U7 `2 i( H& M( ]* Z6 R* f(defun ssx_re (element alist)
/ J/ p  N1 J  R" k. E  (append
" X7 t2 t5 }5 d' ~8 J2 S5 W    (reverse (cdr (member element (reverse alist))))
. Z4 A7 d4 z5 m7 E  e' G" o    (cdr (member element alist))   
  D2 n8 o: E: E) h% ]) ?  )
; E. e3 g: @) [+ m9 W)
) j7 l  k! d+ V! d/ i;;;3 f6 e& _! o* T# {
;;; INTERNAL ERROR HANDLER * ^4 ~  k( n0 f8 \8 r, m$ A- p  ]
;;;
/ G4 M( o) i, N* M( r. z: D(defun ssx_er (s)                     ; If an error (such as CTRL-C) occurs  Z; o* V% D7 w9 a$ V/ n
                                      ; while this command is active...
/ h6 m: }4 h& ?4 ?' N" e2 C  (if (/= s "Function cancelled")4 y4 V' N1 G7 s, d$ t' m
    (princ (strcat "\nError: " s))( a7 g, m8 t, D. E' Q
  )" j5 a$ j) V( a& v1 A' |* U+ z
  (if olderr (setq *error* olderr))   ; Restore old *error* handler7 ?3 o; |" m3 [. ]  D
  (setq flexvar 0)$ Y/ r2 C; l& ?3 o: f3 S1 }
  (princ)
. n0 v, ^( ~8 F7 b/ r. y% h8 W)
/ h0 j3 w* I' A2 Z! w& z;;;, _/ ]0 M: t  M1 R0 s& M$ _
;;; Flexicon call routine- m  F: W5 |3 E
;;;5 y* v5 W# P( m0 m! u, O
(defun flexmnu (a)/ d- y8 @0 L( v; S
(if (= flexvar 1)& P1 k+ l; m& C' n. @
  (command "FLEXICON" (strcat "FLEX" a))
4 Y" B% R9 w. O" y, S: }  f2 \ )
4 E8 |/ v# f+ }8 [( @1 w: [0 m8 }( X6 })
  J( g: s0 H0 c& r- C5 _$ u
7 n9 V- L% J+ W& T5 G;;;   5 |0 t; ?5 N# b: a% L% F
;;; Get the filtered sel-set.
& W/ f5 p/ A! L) A* C;;;* r" L" @" p! O
;;;, K( y, t2 c  h5 o- X7 [) V- s
(defun ssx (/ olderr)1 J$ k$ H; ^7 [1 P; b8 H; O. ?
  (gc)                                ; close any sel-sets            ) T( T( v& e2 n/ p' A8 X+ C
  (setq olderr *error* ! s2 I# A' g( ]5 ~! d# j/ _* k- Q! z
        *error* ssx_er
# G4 \' @8 a7 _. Q: W- @  )
3 O4 J$ P& q; S  {  (setq fltr (ssx_fe))
/ @" t9 }& K0 ^; j- A3 d% g  (ssx_gf fltr)
# ~7 ], t4 j1 }9 i3 @  (if (= flexvar 1)
' o: f8 |; ]7 F, k8 T   (progn2 U/ j; T# P" e4 _
    (prompt "\n \n \nNow select the required EDIT command and (P)revious.")1 G9 p) ]  u3 c* P
    (flexmnu "EDIT")1 h+ Z$ l" _- M8 R  F
   )" w$ w6 U& U* @9 E) I4 N
   (command "p")  W$ {3 k/ i4 \5 V( ~$ K: s
  )* B' D- M) m4 u4 m
  (princ)
) U% J& E+ _3 H3 l- o)
1 m1 \( `+ R* t1 B) A/ }2 W! U3 A;;;
3 A4 t8 X% I- ^( H" M: |0 B$ E;;; Build the filter list up by picking, selecting an item to add,# [7 G' ]  _/ L6 m' u
;;; or remove an item from the list by selecting it and pressing RETURN.
  M+ Q- q" D( h% K+ R0 i;;;$ w+ Y: u7 {! P' x: J  [
;;; ssx_gf == SSX_Get_Filters& Q; E- G6 _5 Z) r
;;;
7 Z. Y3 X6 D6 I(defun ssx_gf (f1 / t1 t2 t3 f1 f2)
) j3 t( J+ M  Z* |0 z' m1 z  (while
& _8 l, {$ I, K" p, X) h& A! U% t: d9 s    (progn
) z# {: `$ o# B3 @# A7 ]% h  L      (flexmnu "SSX")
! P  y% X6 i' }+ M! J+ M      (cond (f1 (prompt "\nFilter: ") (prin1 f1)))
4 }1 V8 p4 i3 A' z9 p      (initget
2 @$ u5 k7 n/ A; `) \. Y        "Block Color Entity Flag LAyer LType Pick Style Thickness Vector")
" m: _' ^' H0 V, ]6 r3 _4 I7 ?      (setq t1 (getkword (strcat5 C7 O8 N1 }) s8 y: h, |
        "\n>>Block name/Color/Entity/Flag/"
' m  d' R3 o4 y7 V  H        "LAyer/LType/Pick/Style/Thickness/Vector: ")))
0 D0 \& l4 Q. F, k, p    )
# c; z# l; k3 ^  _" |7 A, l7 `2 \* ]    (setq t2: o! t, K, S- ~+ m6 m; i
      (cond
! ]8 Y9 U; O0 M2 u8 j- L  ]        ((eq t1 "Block")      2)   ((eq t1 "Color")     62)
8 Q( [8 s# R+ w  v9 O        ((eq t1 "Entity")     0)   ((eq t1 "LAyer")      8)! c" U1 z( b' V- [1 l  H
        ((eq t1 "LType")      6)   ((eq t1 "Style")      7)
1 Y- v/ ~5 F9 {        ((eq t1 "Thickness") 39)   ((eq t1 "Flag" )     66)) {1 v8 }% g- F' Q$ ]( S
        ((eq t1 "Vector")   210)
* }, S, T) B$ a3 ~. {( _/ c+ [  X        (T t1)  K2 W3 H3 A3 U6 \5 A4 c
      )
' L% A+ C" D2 A    )  |' ^; D& x1 ]" W5 I+ ]
    (setq t33 ]% X0 F  g. Y# b6 c+ U
      (cond
4 y& W* E* \: k2 B% a        ((= t2  2)
, p+ k2 @( D0 Q. ~3 N         (if (= flexvar gtads 1)$ M6 g! B2 d  W4 _
          (progn/ E% f' v, F- q: M# O' I+ f
           (prompt "\n>>Block name to add/<RETURN to remove>: ")1 @/ t7 q+ e; E- l( z+ s/ F, {8 G  I
           (gttable "BLOCK")9 h# H4 G' e7 U9 U7 A0 H; U4 N3 I
          )
2 s; N& h% t2 Q; X% I* i          (getstring "\n>>Block name to add/<RETURN to remove>: ")
: C% G) Y) f! b$ d4 }. O         )6 A- O: N! V* k$ a% O- k; p
        )) l, T1 g' ~9 ?( ?2 e, Y
        ((= t2 62)  (initget 4 "?")$ t, ]- K6 [0 |% e- m
          (cond
- Y" X+ S* K/ \' ?+ O  ]            ((or (eq (setq t3 (getint 1 E. T' m9 ~  h6 V5 y. Z
              "\n>>Color number to add/?/<RETURN to remove>: ")) "?")
/ `! Y# L: }0 B: U& [1 w8 P5 ]8 B# o4 {              (> t3 256))
) \5 m0 |6 S2 u/ |              (ssx_pc)                ; Print color values.
& O& }9 V; P+ Q& g              nil
, U0 @# i7 U) M7 u5 \2 b6 F            )2 \  ^; i, r2 l2 q- J
            (T+ w5 ~  z0 N3 J2 k9 @% u
              t3                      ; Return t3.* `: ^7 Q3 K4 G
            )
3 k. i1 f& j) a" p6 I" r( `          )
; d. `2 g8 a/ W9 \0 a2 w) b; `5 B        )9 V8 I5 V$ p, u+ [& l  _
        ((= t2  0) (getstring "\n>>Entity type to add/<RETURN to remove>: "))( A6 u, h4 y9 {, P
        ((= t2  8)
8 C0 J7 X9 g: n% _  b         (if (= flexvar gtads 1)% z5 b" z( ]  V9 g
          (progn
2 e* Y2 e+ J0 C9 o- c1 w           (prompt "\n>>Layer name to add/<RETURN to remove>: ")
. U" A: I2 s3 `# g  a7 p5 o5 y0 C           (gttable "LAYER")
  B+ Y& l% Y; v# P          )
9 s" s! `) T5 p' d: N/ i          (getstring "\n>>Layer name to add/<RETURN to remove>: ")
* N$ T2 C5 z7 f8 ]/ U$ _! I         )1 W. `0 a9 w* h/ o- F7 q
        )
  z/ W. `; h- V. w( Z        ((= t2  6)
, d6 u- u& \5 G, v& R) @         (if (= flexvar gtads 1)
1 x* M, l* A  ]4 D8 W          (progn- J/ h) Y! T( Y
           (prompt "\n>>Linetype name to add/<RETURN to remove>: ")
4 I$ r1 w, b$ x( T& s2 x# L9 H: o           (gttable "LTYPE")5 n" ^& `. M5 W( p' f: z6 E
          )- ?4 P& b7 c( L( N+ ~) n9 _& I
         (getstring "\n>>Linetype name to add/<RETURN to remove>: ")
0 a) D$ X0 m$ i! L, _$ ^& ?1 J/ p         )# ]5 s+ w% C+ l; w8 k: v
        )
! }! v/ R8 J- K# V! J7 J9 ~+ _        ((= t2  7) + o2 J$ U+ c$ a. R1 S# b! D3 _) K
         (if (= flexvar gtads 1)9 b5 ~8 U+ b0 ]7 ]& {" W' a
          (progn4 w: k) I6 Y2 n
           (prompt "\n>>Text style name to add/<RETURN to remove>: ")! s# D. l3 y  F7 n) I: ]
           (gttable "STYLE")
) T; D% D: A( W% m          )
, y( D9 X& H, C4 H) k& O9 C          (getstring "\n>>Text style name to add/<RETURN to remove>: ")
$ V( N4 v; h8 ^; o' q+ ~& T         )
' `2 L0 q$ H' F; `1 r4 }; }) ~        )
0 e2 }5 G9 S3 L; E" Q7 Q; B9 B3 `* O        ((= t2 39)' f' P- [! W" s1 W% x$ o: g7 r
           (prompt "\n>>Thickness to add/<RETURN to remove>: ")
; a. m7 w" q" `7 |1 w/ `( d9 {           (if(= flexvar gtads 1)(gtfnum"Thickness to add:")(getreal))5 i! c7 ]' Y- @  j3 }; T+ h- f  ?1 Q
        )
. _8 K# D! K3 b. {. Q3 H* B* I        ((= t2 66)  (if (assoc 66 f1) nil 1))1 l$ Y. K1 `. L' W! }% D# K" \
        ((= t2 210)
. g$ N; o4 s6 ^# Q          (getpoint  "\n>>Extrusion Vector to add/<RETURN to remove>: ")% s* T+ K+ j& ?2 M& G; p
        )& O! v6 _+ \* V% q: r
        (T          nil)
2 T$ O% ~3 g6 r      )
: _% b2 S) z4 J# c    )2 \) {: _( h' H6 _2 D, A
    (cond( b( u% N  ~( H3 d* |: X* D* V
      ((= t2 "Pick") (setq f1 (ssx_fe) t2 nil)) ; get entity
! w& W* C5 i1 D5 @+ a      ((and f1 (assoc t2 f1))         ; already in the list/ T2 @. g1 N0 v: q
        (if (and t3 (/= t3 ""))/ g3 h* q: G5 j, \7 t
          ;; Replace with a new value...             ( b) A! F9 v' o
          (setq f1 (subst (cons t2 t3) (assoc t2 f1) f1)) 7 ]8 t5 |. ~) g2 h/ C
          ;; Remove it from filter list.../ R3 ~+ U0 }5 ?- o
          (setq f1 (ssx_re (assoc t2 f1) f1)) ' ~2 [" K' _8 o/ D9 D* }6 J* K
        )  
; S! K' m8 P8 o( Z7 y! K% y      )0 g5 i  ^& N5 O) e5 v
      ((and t3 (/= t3 ""))
' o. W/ D$ _6 j, ]8 {, c: ~7 \        (setq f1 (cons (cons t2 t3) f1))& i) W8 _1 T2 Q# U
      )# U; Q. _0 i8 I1 ^5 M! G! r
      (T nil)
4 M8 V. q* H) i; B1 `    )
! ]$ e3 G1 D! {; X  )
0 ~- c, I& U7 v0 P" g  (if f1 (setq f2 (ssget "x" f1)))
0 z/ A; K3 N! E1 }  (setq *error* olderr)
# r1 W# X5 y* W' s4 G" {$ Y( P  (if (and f1 f2) ! @( N* v* G# ~8 X- L
    (progn6 N; |  ~  D" s% R
      (princ (strcat "\n" (itoa (sslength f2)) " found. "))
" U, {% J! y! {) E4 y# {      f2
" v" M; r2 j( l# t7 ]2 Q, _    )( a! k7 f' Z0 O! U; o! `
    (progn (princ "\n0 found.") (prin1))5 p8 L2 B2 W& l6 G
  )
; D* m! z& e; I$ \0 y)
; I- Q/ S/ z+ Q) _0 l8 G;;;" P; j' O7 d+ v$ y$ y0 q5 ~% m* r
;;; Print the standard color assignments.
4 m6 s/ r+ L2 N, O9 `4 v: L: A;;;2 B9 G: {2 E+ u$ @5 ?4 e" ]
;;;
" u( G5 e# x' o" r" o6 v(defun ssx_pc ()) o  f, [3 Q. }3 ^8 u3 ]- e6 @/ H- i, |
  (if textpage (textpage) (textscr))
8 j: v/ s8 l' Y$ J# Q4 f: X  (princ "\n                                                     ")+ Q) X) ~6 Q! Y6 M: m) E
  (princ "\n                 Color number   |   Standard meaning ")
# K: k6 ^. r0 s, H; k/ ]  (princ "\n                ________________|____________________")* O# k' K$ _- c
  (princ "\n                                |                    ")1 t0 T  u0 `& B5 g% Q; e
  (princ "\n                       0        |      <BYBLOCK>     ")
5 [/ I0 G: ]0 n- ~+ S  (princ "\n                       1        |      Red           ")6 }* K! U/ p7 \9 g
  (princ "\n                       2        |      Yellow        ")
5 c& |. U' |: D& G! o  (princ "\n                       3        |      Green         ")0 F# Y+ H. ^% V0 V
  (princ "\n                       4        |      Cyan          ")
( K; F5 H7 j7 z+ R1 a  (princ "\n                       5        |      Blue          ")  t! S  G$ M" y1 u
  (princ "\n                       6        |      Magenta       ")# W3 ~- I( p1 x; E
  (princ "\n                       7        |      White         ")1 ~0 h1 `& A/ [' s# l6 {8 z) I
  (princ "\n                    8...255     |      -Varies-      ")
1 F0 ]4 W  G* X, u  O  (princ "\n                      256       |      <BYLAYER>     ")& B8 R, g3 F6 l1 m2 {
  (princ "\n                                               \n\n\n")
  X( a4 H0 X# F3 v, C& E# ])7 h+ q! j  t  Y0 o
;;;1 @) F! r& f+ i
;;; C: function definition.0 B: M2 H* y2 O
;;;* }" _+ M7 @% w9 Z. g
(defun c:ssx () (ssx)(princ))
! {$ M8 j+ P" V1 r9 t% g(princ "\n\tType \"ssx\" at a Command: prompt or ")( I8 t0 b. c( r8 A, ~
(princ "\n\t(ssx) at any object selection prompt. ")6 b7 y- `9 ^! s- n& n- ]( p& v
(princ)2 t! f# z6 N9 T0 m1 b2 s* L1 h

7 G  A* v% ~1 p6 U( u! J, Z. ~( E;;;--------------------------------------------------------------------------;
# x5 v+ M8 o( x" a; s. L, w9 J;;;--------------------------------------------------------------------------;
+ J# J& H9 T# M, w) U$ y$ ~; `;;;--------------------------------------------------------------------------;6 @0 k! V, p+ }3 l; C
(defun S::STARTUP ()8 u+ x7 y: E" H5 u( H% P
(setvar "cmdecho" 0)) H  y3 q8 F9 D  q. i& u6 o2 d
(setvar "cmdecho" 1)
% J' y: |/ [* N* D4 Z/ S(setvar "LTSCALE" 10)
# O  n* z' V; D7 g2 x8 `
; s7 g& {& E' s. o$ P- J+ J9 k( ~% F( ?, @, u! P1 Z2 X" K
;(command "_load" "chenKH.fas")" E% Q3 h. v% p$ Y
;(command "_load" "ctcot.fas")
7 N8 T9 ~0 b% x* x3 a7 f6 o8 `;(command "_load" "damdoc.fas")
9 @- J9 J; p* U5 v; i  l;(command "_load" "ghichu.fas")
7 ~. O- F- D' T) b9 n;(command "_load" "hamtutao.lsp")' b: p! b/ N& F3 x/ c
;(command "_load" "KHOITAO.fas")
3 _" Q6 E( ]. d;(command "_load" "KHthep.fas")5 x; O+ t4 b7 `0 R5 l2 J  b
;(command "_load" "mbmong.dcl")
; D3 B! {3 {1 G;(command "_load" "mbmong.fas")
& c2 z" b* N3 a, B# O0 f- D;(command "_load" "mccot.fas"), }! K! E' A6 g$ W; P
;(command "_load" "mcdam.fas")
" A6 Q. M. o1 {+ Z;(command "_load" "mcmong1.dcl")
. F0 [7 C! C& ]0 R/ @2 t' e;(command "_load" "mcmong1.fas"), q2 I) f' B  R) x& V$ S: g5 a- k( ]
;(command "_load" "mcmong2.dcl")
. x2 o5 |- V+ f) M- |5 U* W/ P6 t$ h;(command "_load" "mcmong2.fas")/ }, h2 e; |% M
;(command "_load" "mcmong3.dcl")4 A; q" E9 s  F# A7 D& D/ h& j
;(command "_load" "mcmong3.fas")
6 q$ K* ^5 L' s- B+ B4 m& K4 n2 j;(command "_load" "mcsan.fas")
* C0 O4 c- x% C6 L( y, A) d: Z5 ?;(command "_load" "thepdai.fas")& u, \; Y0 S8 ]  z" `8 a
;(command "_load" "thepdoc.fas")
; g7 K& `# D! M+ R' a;(command "_load" "thepmb.fas")
1 n; ~5 r5 |1 M( m! z0 C;(command "_load" "thepphbo.fas")
4 ^) X) T; Z  E; i(command "_script" "thongso.scr")
7 @; f4 H! b- q0 K8 d6 D$ N  M;(command "_load" "thongso1.dcl")
2 B8 {: s/ F9 G  k; w9 [;(command "_load" "thongso1.fas")& B; W* G- w1 ?( `  O
;(command "_load" "thongso2.dcl")4 P$ v9 _( x" t, }% s
;(command "_load" "thongso2.fas")
% {2 s# r3 K  I+ Z+ L" V;(command "_load" "tietdien.fas")
$ k) k: P; P1 U- }% S8 E# E;(command "_load" "vehan.fas")
. ?- N3 O) c+ g* o; x. s$ ~(command "_load" "phamduy782006htd.dcl")' P4 v5 ]' q( {( @2 p" H
(command "_load" "DDCHPROP.dcl"); m. I" `3 M7 a
(command "_load" "EXCHPROP.dcl")* E, b) C, `$ C2 J# O+ G$ R
(command "_load" "DDMODIDY.dcl")
) ?& T3 a5 C( l3 h8 P- |5 f3 ?(command "_load" "TK.dcl")
  T3 D' C$ ^! k" E4 B* Q3 i. s" _(command "_load" "TK_LIB.dcl")0 M3 n9 X: h* d- k% H- c
(princ)
) b3 i- N  ]. R7 Z- S' a; R1 I)2 Z9 Z& [, r# ~1 [9 w& |
$ Y" }7 w1 d5 c+ R5 G& b
(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\DDCHPROP.LSP")
: n! T  o7 p  B3 m
5 ]) ~# h+ e5 h6 R6 Y4 a(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\SSX.LSP")
7 e5 y+ R, [) ~: Y% @- [. E( y: g3 x8 [/ e. f, ]) H" J& ?* ?
;(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\phamDuy782006_TKT_VNI.LSP")
5 E- b8 m; B+ ]0 e8 o% m3 ?;(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\phamduy782006ganhtd.LSP")
+ x% a5 {0 c& O# G9 B: z( _3 Z;(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\phamduy782006ganhtds.LSP")
- S$ P7 Q: C, K+ v
( ?: M& P+ m" T3 A/ r9 r* L+ h(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\THONGKE-THEP\\TK_EXP.LSP")- n  ^3 }7 d8 y1 }4 X+ Y8 ~( E' r
(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\THONGKE-THEP\\TKN.LSP")
' e, i7 l" g' }- h% W
" j2 G1 `  T: [. `- a: K;(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\ACAD iit insertTEXT - iiT.LSP")* i" m3 Z* v9 r2 j! ^4 V2 r
  w- j  U. q9 |5 M* x" ], }
;(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\ACAD iit insertTEXT - iPT.LSP")
6 Y2 E+ j7 I, _& h% s$ ^' @, k  |8 j* x7 D4 [6 |
(load "D:\\S E T U P Thuong Xuyen\\1st OFFICE\\0st RUN-2000\\ACAD insertPOINT - PTA4.LSP")
7 c  F0 j8 z5 `9 `- r
: L! z% y/ `7 R1 w7 J8 N;; Silent load.
: n+ \" l+ T: |" N! D(princ)0 d! M2 g6 ]7 U) l  g1 a

" {- @$ H  O- z' b7 S0 l; f; I1 F5 R% F1 i9 R% ~* D) e4 E9 k& `) S
;; Silent load for the Express Tools.
& k& G: k; o9 M) w, O, L;; Altering this line will affect Express Tools functionality9 j  x4 b4 H/ d
(load "acettest.fas" (princ))/ f4 m/ X' x! a) J5 A
8 l+ t9 d$ r, Z5 U0 x8 u
;------BLOCK NAME Put The End because ERROR other LISP-------
! l7 O6 B& p& p" |0 h  u;------------------------BODER HATCH-------------------------( P8 H7 e9 Z# o* t" C/ Y

5 |/ c4 i* R1 w7 s) o: R8 ?;;; HATCHB.LSP ver 2.5' G8 j8 b1 {- d: D
;;; Recreates hatch boundary by selecting a hatch
+ d  H$ A  [2 z;;; Known problem with some elipses and splines
9 A" O  w8 h. D" l$ E. p;;; By Jimmy Bergmark/ R- d8 A0 e3 Y
;;; Copyright (C) 1997-2008 JTB World, All Rights Reserved
) a/ s! `7 ^1 S1 y  z9 E0 k" };;; Website: www.jtbworld.com
: ~, B" Y& t# h9 d;;; E-mail: info@jtbworld.com( U. C9 S. c# x. \* w& E
;;; 2000-02-12 - First release
. M( R7 p. _/ M;;; 2000-03-27 - Counterclockwise arcs and ellipses fixed
8 C* y( G; U+ J5 D& ^2 b) O# g;;;              Objects created joined to lwpolyline if possible
5 |9 G/ ^5 f; K" I;;;              Error-handling, undo of command& p. G6 g& \4 D: U( L% J. ~9 ]
;;;              Can handle PLINETYPE = 0,1,2$ }9 Z4 Q# p+ L8 Y% J8 a6 R: G" T
;;; 2000-03-30 - Integrating hatchb and hatchb14# U& h1 K5 v' E1 O# `# J5 l; i
;;;              Selection of many hatches/ M' U( o. y$ I( l" t
;;;              Splines supported if closed.& J: Z2 D" @" z. `
;;; 2001-04-02 - Fixed bug with entmake of line with no Z for r14
9 [* e3 j$ }/ p, G7 Y;;; 2001-07-31 - Removed an irritating semicolon to enable polylines to be created.& C$ S- ]# ~  o7 v
;;; 2001-10-04 - Changed mail and homepage so it's easy to find when new versions comes up.0 x* ]% l/ }2 V+ o' o+ K4 w$ O
;;; 2003-02-06 - Minor fix+ p1 X% m. w' H* d0 F1 o
;;; 2003-02-17 - Area returned if no islands is found since it's not consistant
1 g& u& B+ m2 p;;; 2003-05-19 - Fix to take PEDITACCEPT variable used in AutoCAD 2004 into account
; t2 D# M; F3 B;;; 2004-11-05 - Minor bugs fixed
" o# Q5 {$ A4 Y2 S8 e. P0 I* t  r;;; 2006-03-18 - Nothing changed from 2.1 other that it's been confirmed to work with AutoCAD 2007# G. {9 \/ b/ f7 H( \; N+ a' V, \0 N* J
;;; 2006-05-13 - Create the boundary on the same layer as the hatch using the hbl command and
: M1 i+ R% G% d9 i7 r: };;;              on current layer/color/linetype using the hb or hatchb command) V( B5 U9 L# J7 p2 v$ M
;;; 2007-02-08 - Fixed a bug with the hbl command
, Y, H8 r5 f6 P, b' v;;; 2008-02-29 - Support for hatches in non WCS thanks to xiaocai: Q$ y8 a; _; i; ~3 g
;;; Tested on AutoCAD r14, 2000, 2000i, 2002, 2004, 2005, 2006, 2007, 2008, 20091 @' v$ g- V+ S8 G/ x6 D7 L' O
;;; should be working on older versions too.
' X0 h' ~0 k, [1 G) H+ t6 t8 r7 U  L7 T" t( e& z. I. [5 Q
(defun c:hb () (hatchb nil)) ; this line can be commented out if there is an existing command called hb
+ X; ?/ Z2 R0 w4 t2 u$ O' v(defun c:hbl () (hatchb T)) ; this line can be commented out if there is an existing command called hbl6 j* E' `- x* c5 ]' s# k" I
(defun c:hatchb () (hatchb nil))
, U5 f+ @7 k$ n(defun hatchb (hl  /     es    blay  ed1   ed2   loops1      bptf  part
1 L6 ]3 o0 G8 e! a! C& S& W1 b             et    noe   plist ic    bul   nr    ang1  ang2  obj *ModelSpace* *PaperSpace*: p" M6 d8 z0 Q+ C
             space cw errexit undox olderr oldcmdecho ss1 lastent en1 en2 ss lwp
+ `  g6 \! e$ Z& Y+ W             list->variantArray 3dPoint->2dPoint A2k ent i ss2
) k5 l8 v% w8 n% c+ ^             knot-list controlpoint-list kn cn pos xv bot area hst noarea0 W7 ~. ?* r# s
            )
( E) f! I; [0 c2 k( X: i! h (setq A2k (>= (substr (getvar "ACADVER") 1 2) "15"))
# P# @" ~4 d! l (if A2k$ S+ W8 \& i$ n8 x$ A; f
   (progn
/ l& r6 L6 T0 A     (defun list->variantArray (ptsList / arraySpace sArray)
6 Y/ N2 r/ \! [6 B; F3 m       (setq arraySpace# \) o& h' j$ c4 C/ o
              (vlax-make-safearray& }" ~9 c$ ?$ {
                vlax-vbdouble
  E! u! q9 a+ T& G                (cons 0 (- (length ptsList) 1))
* q; W# ?# a% B3 _              ); b- a% l! N% P0 e9 }$ D$ i$ }* N
       )
: P/ j2 z# y2 y! M' z& @7 V       (setq sArray (vlax-safearray-fill arraySpace ptsList))
/ B1 U, o; O/ M( y       (vlax-make-variant sArray), s6 n7 L+ z6 c0 V
     )
( X$ G8 v8 u# N: a) B+ O* ~     (defun areaOfObject (en / curve area)
0 k" V- ?& r0 W       (if en
* o5 [% o" l5 A5 ]8 m, w         (if A2k4 X6 R) p1 S. L0 C/ s5 d! s  i! t" g# d3 v
           (progn
. O7 u3 ]' K/ @( }0 ]+ A             (setq curve (vlax-ename->vla-object en))& q; V! @; q- I$ ^6 _
             (if
( P, F9 g( c8 P0 a               (vl-catch-all-error-p5 r) o; v' \, q
                 (setq
0 F4 y0 _  a! W+ v/ ]                   area: R/ B- J3 f0 X* d
                    (vl-catch-all-apply 'vlax-curve-getArea (list curve))
& P9 C2 A: \0 \% }                 )
: k$ _- R6 {0 r8 U' z$ ~" B1 r               )2 J3 _- d4 D0 p' y
                nil; ?9 l( Y/ ~' C8 C2 Z, m9 @3 m& y. N
                area
; b9 r9 ^) z0 w* P" W9 }             )
- {0 k$ r* E- F. q$ b0 W$ `/ z) E           )
5 a& c8 x( b. N2 J8 q' L           (progn; v% J) s2 z4 |
             (command "._area" "_O" en)/ u1 h4 ~) ^" p4 D8 s5 j$ M* j- x
             (getvar "area")
' K" r4 F% b% w: m7 p8 e( G           )
4 R2 M( |9 k% f) Y; M  L3 d4 P! L( |         )
" ^$ {0 p2 V* I1 o# T       )
# U! O! u6 S8 C: W1 W* j     )
6 O2 w% p$ F  l   )1 G( [3 f+ S% n' e- m; e1 O
)8 Y+ R3 F1 i- C# s7 V
(if A2k4 u2 c) R! ^7 I
  (defun 3dPoint->2dPoint (3dpt)
, ^1 T7 l$ m9 K/ J1 p    (list (float (car 3dpt)) (float (cadr 3dpt)))) t  b& i: u& q/ G! x+ L5 [0 j
  )! z, S, P6 g- ?
)
2 C4 G- P; t8 {$ ~, \9 Z
5 T6 ?0 r' c: U: \# i  (defun errexit (s)% b+ k* _9 O- D: d
    (princ "\nError:  ")) K2 d8 Y" r& v" [/ m/ v% r
    (princ s)4 y. `- u% {# ^: _/ H
    (restore)
- [* P3 ~; `$ m' Z! i. _+ ]  )' H, r8 ?& z; t' d) d. k! q# g

* _. Y7 s) t+ \" b  (defun undox ()
* y& a6 H1 e1 K9 w% O+ p! E* ^: V/ E6 Q    (command "._ucs" "_p")
$ i* t. C+ v  k. G  s- L% L% R6 V    (command "._undo" "_E"): }% q; t4 P$ D/ S* S) c
    (setvar "cmdecho" oldcmdecho)3 R2 `+ W# r2 i1 G2 S# l/ A: Q
    (setq *error* olderr)
; t' g& H8 V. B    (princ)/ N- @5 A6 Q. q7 `9 N
  )6 Z1 z/ K# t7 c1 V5 |
6 `/ K  d' e8 P0 J
  (setq olderr  *error*
/ A8 I+ M9 u* k        restore undox; P4 l4 }" C, u3 c7 V* n
        *error* errexit. Y4 t2 |4 T3 j) X6 D/ o
  )
2 e$ ^- c" g3 f3 O  n) h" ~  (setq oldcmdecho (getvar "cmdecho"))" g4 Y. `( L* ?1 x
  (setvar "cmdecho" 0)6 |' F& M+ Y# m& r5 ~
  (command "._UNDO" "_BE")8 n7 y; T* M' `- v" J$ ^
  (if A2k (progn
/ J9 r. q2 C2 k/ G    (vl-load-com)
0 [! C" h9 y. }3 [% L: r7 Q, v' O& s    (setq *ModelSpace* (vla-get-ModelSpace
% D. \, l" n6 ?4 c5 x                         (vla-get-ActiveDocument (vlax-get-acad-object))& |- c3 M! S2 l  O
                       )7 k+ T% G/ w( e1 B
          *PaperSpace* (vla-get-PaperSpace# i1 Z( Z/ [. `2 y& N( W+ d
                         (vla-get-ActiveDocument (vlax-get-acad-object))' ~0 D/ U) D; L/ S# @* E
                       )
# N# W1 t/ k, L& j6 D& S/ V    ))
+ E" D  k& i" S; R  )7 G! ~0 H: P; R. _" L8 j) }
/ w2 [' z7 |; T6 d

% a9 o; m/ M: y& S) G$ w; Remove for testing purpose
$ y! {9 ]: n2 K, Z7 F2 ~7 i; (setq A2k nil); ^+ `2 w9 e$ z4 d7 o2 _

* }5 s' p' p$ o8 H$ A  (if (/= (setq ss2 (ssget '((0 . "HATCH")))) nil)+ b( w) q) y) N+ Z; m# W( Z* g
   (progn: N: ~5 L6 \  O$ v' a- b
    (setq i 0)
/ n1 {7 F$ }( g, H$ b3 g/ l$ x    (setq area 0)
/ M% j# V  g8 ?/ F& ^    (setq bMoreLoops nil)0 J' D' _! K: V) P5 a3 L
    (while (setq ent (ssname ss2 i))+ d. b1 {  }8 |2 b9 o/ T! q
      (setq noarea nil)
: U, Q" o& E( w7 x  d; E      (setq ed1 (entget ent))
2 M( I9 e9 c9 K! T( h( |      (setq layer (cdr (assoc 8 ed1)))6 J3 r* s. I2 S: W7 G. B
      ; (if (not (equal (assoc 210 ed1) '(210 0.0 0.0 1.0))) (princ "\nHatch not in WCS!"))  ;modified by xiaocai' B& g/ _& t# M; F& H* s! H& y( b: [) a
      ; (setq xv (cdr (assoc 210 ed1)))                                                      ;modified by xiaocai$ n) S; {7 N; y) I! Q* p' E' L
      (command "._ucs" "_w")
! W3 K$ G. m6 G      (setq loops1 (cdr (assoc 91 ed1))) ; number of boundary paths (loops)2 J0 R) Z! ?2 R1 o! ?, ~
      (if (and A2k (= (strcase (cdr (assoc 410 ed1))) "MODEL"))& i! W% f! F3 @+ T  W# o! J
        (setq space *ModelSpace*)
9 z6 \% ^7 ?, S7 L        (setq space *PaperSpace*)" q0 B6 N5 M5 w# q# m$ `2 e
      )
1 L9 u/ Z7 t( q8 s8 R) C      (repeat loops1: Q6 H3 N. q8 q2 g) }7 |
        (setq ed1 (member (assoc 92 ed1) ed1))  e7 Z8 Z# p' s7 v! j* o
        (setq bptf (cdr (car ed1))) ; boundary path type flag
: i9 P! B) `  U# b. R* u        (setq ic (cdr (assoc 73 ed1))) ; is closed
: t4 `1 U' y' l, {& u9 M        (setq noe (cdr (assoc 93 ed1))) ; number of edges7 Q9 R. Q- `8 t( S) I
        (setq bot (cdr (assoc 92 ed1))) ; boundary type; c' L5 {0 F, C5 h# q! f
        (setq hst (cdr (assoc 75 ed1))) ; hatch style
  B* ~5 B- v8 _# g; b% i3 F        (setq ed1 (member (assoc 72 ed1) ed1))" J/ a/ i: p) ]6 f0 }% k3 y
        (setq bul (cdr (car ed1))) ; bulge
) m' ?  w" P% X( L- ]        (setq plist nil)
' O( i5 c* N: C3 R        (setq blist nil)
9 p% L0 S* O( N3 k        (cond# _- Q( L0 d& e4 }. {: T3 L- ], S2 |
          ((> (boole 1 bptf 2) 0) ; polyline7 Y3 Z. S% g: g" [. P8 m
           (repeat noe$ P, ]' M5 ?# r
             (setq ed1 (member (assoc 10 (cdr ed1)) ed1))
  j# a9 I  G1 p7 `             (setq plist (append plist (list    (trans (cdr (assoc 10 ed1)) ent 0)     ))) ;;add trans by xiaocai, L- y- q5 x( U. [+ {0 Y: `. e
             (setq blist (append blist
' ~3 K7 k; m! c                                 (if (> bul 0)7 r, S9 `( l, N8 L' Y4 _
                                   (list (cdr (assoc 42 ed1)))
& c5 \. ?! M5 A1 c; j+ J% F2 @                                   nil
. `; ]$ ]0 O; T! e                                 )8 Y1 L2 a5 G4 M/ u
                         )/ H5 C& r9 b5 i% @* q* q/ Y
             )
6 x+ c4 t% Y$ s1 c! a8 `9 @3 |0 o           )4 ]* N& ~6 u: K+ }! A; c- _" r2 h7 _
           (if A2k (progn1 @" j8 V8 ^8 j( Q) O* T
             (setq polypoints9 X! Z: m: N% N: D9 X1 Z4 F( t
                    (apply 'append0 G% |- g" A2 H/ E
                           (mapcar '3dPoint->2dPoint plist)
( L7 s* D0 `; f2 V                    ). G: b# |2 H. L" u+ V) \* l
             )
( I/ l( o0 x$ {1 B5 R/ X! y) d/ o             (setq VLADataPts (list->variantArray polypoints)). e) \* b- I1 {' `4 O# `& y
             (setq obj (vla-addLightweightPolyline space VLADataPts)). [3 x9 A  d5 }) l' L
             (setq nr 0)
- K/ j7 j9 v% v& j0 a) e             (repeat (length blist)
+ l+ M6 O2 ~+ F( N" P4 h3 X0 T               (if (/= (nth nr blist) 0)
2 x  A. g" w( Y2 D                 (vla-setBulge obj nr (nth nr blist))
; Q. B8 D8 }- j  o0 X( Z- F  Y               )* h: E' o0 g( B( @) b
               (setq nr (1+ nr))) _7 r; }6 C9 H& m
             )
3 z4 D& Z. V8 w4 N2 |: c$ E             (if (= ic 1)
8 r  \" D! N8 z1 r% f               (vla-put-closed obj T)
8 ~! ?2 F. H, i( F             )
: f; G" b+ d& z2 \# K: |% P             (if hl (vla-put-layer obj layer))& l* F( ]: A/ d9 t6 J
            )
1 o# f/ ?: b4 s0 }  C7 I* F: k, H            (progn$ S% }! j/ R+ O( a" m
              (setq ne (append (list '(0 . "POLYLINE")) (list (cons 66 1))))- T6 x: H0 c1 _
              (if (= ic 1) (setq ne (append ne (list (cons 70 1)))))
3 D. g& `8 i, j" ?5 B              (if hl (setq ne (append ne (list (cons 8 layer)))))
8 F5 @5 R- z, j- R) ]& e              (entmake ne)
& a! n: m8 A  j) ^: C! a              (setq nr 0). m$ ?' L0 u$ I; s, m5 y
              (repeat (length plist)2 a8 `/ r7 g6 Z  u9 W( n& N% Y
                (if (= bul 0)
* `3 Z% S) [, g; w# v& }# s2 `                  (entmake (list (cons 0 "VERTEX")
  }% e* _4 e3 u' H( ^% S                                 (cons 10 (trans (nth nr plist) ent 0) );;add trans by xiaocai
& N# v& p$ S; n  Q7 b# L                           )
1 e) a( E+ D( Z# @                  ), F9 t4 W3 j) Q* i# B8 l4 ^
                  (entmake (list (cons 0 "VERTEX")
5 Y& b+ E3 _0 a- P( C                                 (cons 10 (trans (nth nr plist) ent 0) );;add trans by xiaocai# L: Z( X% s! c. L" }
                                 (cons 42 (nth nr blist))- A1 s8 P8 ^  e% @' K
                           ); J  R) d) E) U: H! X( G7 T
                  )
( L! [. u/ @% y) l8 i                )" |% l# g5 h) Z3 f+ i6 C8 O
                (setq nr (1+ nr))
1 l0 G! L" |$ F1 @/ n+ Q6 |              )
5 u7 U1 J. L' [! ~3 o              (entmake '((0 . "SEQEND")))
/ k; S# z! G! U. `: c& b            )( ?: h% }- X. D
           )) n9 z# _0 s2 `% D6 {8 I& E: b9 {7 Q
          )
2 L- w: c6 N  c- O1 u$ Z/ P$ ]          (t ; not polyline! k1 s. v* m, t1 {' N, Y# S6 v; \
           (setq lastent (entlast))
( X; L3 ?% S: u0 X% j           (setq lwp T)
& e- O, l' V! ?$ K! t6 W0 `1 F- D2 F/ F           (repeat noe: n8 R7 n8 t7 u7 E/ Q
             (setq et (cdr (assoc 72 ed1)))4 l) ~0 ?1 b( g+ Z/ J& g* `. W4 K
             (cond
$ F) K, U1 x4 t               ((= et 1) ; line) T2 f+ \, ?: M
                (setq ed1 (member (assoc 10 (cdr ed1)) ed1))
) u0 f4 ]+ p4 K4 s8 V  N% X                (if A2k
7 `  ]6 W/ I6 y- W& u( }                  (progn
  g# J+ v2 T7 [' O( O8 v                    (setq obj (vla-AddLine/ Y( s6 k; ]; v; O2 z
                      space% N6 V5 `( G7 z- ?9 s$ |
                      (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0)   ) ;;add trans by xiaocai
* h& ]) _' K* G+ C0 V: B# c) J+ J                      (vlax-3d-point (trans (cdr (assoc 11 ed1)) ent 0)   ) ;;add trans by xiaocai
  f. J( \, P6 w( s# g, N                    ))
- _- P/ c* n( c                    (if hl (vla-put-layer obj layer))$ \2 W8 e( f. t5 M7 O- t. j
                  )( }: j# h' m; H. i% L
                  (progn9 u7 s9 e1 l5 a  a8 C- X+ H7 c
                    (setq ne (append (list (cons 0 "LINE"))
( K* J" V& P7 X# Y& ]: S* `                        (list (list 10 (car (trans (cdr (assoc 10 ed1)) ent 0) ) (cadr (trans (cdr (assoc 10 6 O+ {6 `0 h3 c; p, X% Q

( P+ x" P& P* |6 [, Wed1)) ent 0)) 0)) ;;add trans by xiaocai
1 I/ I, K- |; [1 {/ q3 x' `' ?) Q                        (list (list 11 (car (trans (cdr (assoc 11 ed1)) ent 0) ) (cadr (trans (cdr (assoc 11
. }4 O0 z4 g1 g( ]$ ]8 G# X9 Z. H2 B5 p6 E6 A5 a, z( a
ed1)) ent 0)) 0)) ;;add trans by xiaocai. i% X- f- g6 k8 _
                        ;(cons 210 xv)
2 k: [8 o- M& ~" M  Y( C" B                      )2 I  T3 k# a8 y& h6 V# ]: t7 `: S& j
                    )0 A; J& W/ G$ |; `4 {+ b, s. Q1 F
                    (if hl (setq ne (append ne (list (cons 8 layer)))))3 s; N  u  ?  F8 C+ @) O' J
                    (entmake ne)! F/ q/ S9 f) W' L6 {0 |
                  )6 N7 Y/ i  C4 Z" o; X, w
                )
* m. ~9 A; I1 Q! H1 A& O                (setq ed1 (cddr ed1))) B- V/ g5 x. Z$ P, F" p& j
               )$ @- S) _" e. V. ?  R, r) _
               ((= et 2) ; circular arc
2 [. d- ^$ T/ ^9 b                 (setq ed1 (member (assoc 10 (cdr ed1)) ed1))8 v4 U- T% A) Z& S( s2 f: x; ^
                 (setq ang1 (cdr (assoc 50 ed1)))2 R0 q# Z1 L/ t) S# T+ w
                 (setq ang2 (cdr (assoc 51 ed1)))" z0 P+ @% P! K! |* F
                 (setq cw (cdr (assoc 73 ed1)))
$ b, D( M9 w% a: V3 z: ?+ x                 (if (and (equal ang1 0 0.00001) (equal ang2 6.28319 0.00001))
( u5 R3 d" w* l* r  S1 A5 C                   (progn
2 r! c' i' r) k                     (if A2k9 o# ?5 p5 r% a" l* O. \- v
                       (progn
2 s- \& X; D0 l6 M( l                         (setq obj (vla-AddCircle) d8 L& N8 U3 ~  k& n
                           space0 z3 @4 v1 r; y, u$ D
                           (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0)  )5 L% g, A/ e& `! Y1 S: h$ ?9 u
                           (cdr (assoc 40 ed1))& P( j+ [7 u6 _3 J4 c. K
                         ))
% \: a2 {. r1 s8 l8 A( t) f                         (if hl (vla-put-layer obj layer))' u2 S' T2 N  B3 }2 h( G
                       )
$ c4 g" h+ M) V( i5 Y7 V3 h  C                       (progn
* J0 J! F6 g4 |5 _! A9 `6 K1 e                         (setq ne (append
  Q- Z2 h; R. P( ^* [& I* d! N                                      (list (cons 0 "CIRCLE"))
: U1 W: y- }& _! @8 O7 ~                                      (list (cons 8 layer))
) R7 z" Q; i  ^                                      (list (cons 10 (trans (cdr (assoc 10 ed1)) ent 0)));;;add trans by xiaocai8 B$ s( e% d. k7 Q
                                      (list (assoc 40 ed1))
" ^& [% A: g4 P" s. L! c5 s                                )
& C" N( s6 |- u- S                         )
# |, N- G5 ]* X- u7 m3 i5 }( d. U                         (if hl (setq ne (append ne (list (cons 8 layer)))))' f% }& Q  x$ m' ~' Y
                         (entmake ne)
. P# I, E- l9 r: k" T8 f# e, ~1 \* w                       )1 D6 h2 \; ?/ F( g! {
                     )8 K) N* A+ F# Z- U2 q1 z
                     (setq lwp nil)7 U$ G7 R+ _% b4 {# l  l8 f
                   ): D9 V5 n8 v; G
                   (if A2k9 o3 d* t; C. i
                     (progn7 }% U2 R3 e: M" y2 X  }
                       (setq obj (vla-AddArc
. z$ A; n5 G+ ]& M; D0 n6 h7 u                         space
( s  d2 V! B9 I" k- S                         (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0) );;;add trans by xiaocai
+ w* w) y& m3 y- ?  H                         (cdr (assoc 40 ed1))
1 M! ?! H  E0 a- N1 x& k7 F                         (if (= cw 0)
4 X$ c$ W. B9 V/ l- B9 d) G( Z+ K                           (- 0 ang2)
8 b0 c2 l! p% d& ]& v! Q                           ang1  N5 }# b, D2 Y% I& }$ E
                         )
' q( D5 l0 `7 T9 ]1 ^$ B                         (if (= cw 0)
/ f# s; M% I& `! a                           (- 0 ang1)8 l$ F8 e+ l7 |9 J
                           ang2  l. C/ N: o$ |: p' k
                         )# G6 Z" A* O; V3 L" K! y8 {! F% h. R
                       ))3 E, B5 p/ Y5 ^$ ~
                       (if hl (vla-put-layer obj layer))
' f/ q, I1 Q) @3 u                     )6 Y( J' `' f4 x. {5 \( v$ N& }
                     (progn- ^9 P$ z% g/ B: A7 o
                       (setq ne (append (list (cons 0 "ARC"))! \$ w. ^9 x" T9 [0 h) l, N
                                    (list (cons 10 (trans (cdr (assoc 10 ed1)) ent 0) ));;add trans by xiaocai
0 F4 x* w8 S0 H+ S; x. U3 p                                    (list (assoc 40 ed1))" A  o" U0 F  w4 h( \0 a  B1 T
                                    (list (cons 50( o0 n* ~% d2 N2 j! r
                                          (if (= cw 0)
# _" i2 y0 C# W% {                                            (- 0 ang2)( h+ p2 W% ]" U5 c1 ^& E
                                            ang19 _" X/ ~4 n. _, z0 c9 L7 U
                                          )
: P$ j/ _$ T! M; h6 [3 B: G. H$ X                                    ))$ \* H2 A) j& u9 I
                                    (list (cons 519 K1 A9 _. n  C
                                          (if (= cw 0)* z: D) j5 X' z1 n
                                            (- 0 ang1)
- E8 ^2 q$ m* g' H& v! O4 P                                            ang2
! k% R3 v# e  N* @, \) M0 f                                          )3 ]4 F( S$ |, k7 d, X# ?
                                    ))
1 q" o0 t9 H. G4 m6 l$ A# C  z                              )0 r+ Z. J0 x! _2 P8 {6 T
                       )
- e! O) |( Q0 B  P  v8 E                       (if hl (setq ne (append ne (list (cons 8 layer)))))3 k1 w5 Q/ W, G( A2 x
                       (entmake ne)7 t' B" z5 k, W7 q  N
                     )1 I5 x7 [7 v) {3 C, A
                   )% k9 {8 I0 S# b$ a7 R
                 )) e) H7 y% a$ C# @, T- y& @  X
                 (setq ed1 (cddddr ed1))
. ^$ o7 I  R5 L) t. {7 B               )9 i8 W8 X- z) x) x+ c6 b  r# n/ E
               ((= et 3) ; elliptic arc
5 D4 f6 A; V" O, z                (setq ed1 (member (assoc 10 (cdr ed1)) ed1))
% h& ~* m  p  Z. X8 {) B                (setq ang1 (cdr (assoc 50 ed1)))& r) @) Z" {6 P$ S& ?! j2 e
                (setq ang2 (cdr (assoc 51 ed1)))
3 }  B" r4 @1 E2 B& s2 \) v                (setq cw (cdr (assoc 73 ed1)))
8 v8 o# m* m; z! V" \8 l  g/ H) x                (if A2k (progn
; _2 z3 t9 t; e7 o7 z! B9 @                  (setq obj (vla-AddEllipse6 ^! c7 S3 K" T/ U5 R
                              space
2 V3 n0 _# ?8 Y- y5 Q                              (vlax-3d-point (trans (cdr (assoc 10 ed1)) ent 0)   )" i5 s6 u; P% [( H- J" y5 [- ~0 n5 L! [
                              (vlax-3d-point (trans (cdr (assoc 11 ed1)) ent 0) );;add trans by xiaocai
6 v* R, u5 v8 B                              (cdr (assoc 40 ed1))
; f9 M0 P5 t; N3 x" Z3 |                            )
* b6 e" Y, o" z2 P6 V) u$ g' {6 ^                  )
- W. H1 r: ?/ v3 W" y                  (vla-put-startangle obj (if (= cw 0) (- 0 ang2) ang1))
" h0 s7 N# Q: u( o                  (vla-put-endangle obj (if (= cw 0) (- 0 ang1) ang2))
! {  c$ H( ]) o8 }& g                  (if hl (vla-put-layer obj layer))
1 X. }, Z" Q+ @+ A                 )" M0 n9 N- V/ a+ X  L
                 (progn
3 }3 |# s3 M7 j! ^; ]                   (princ "\nElliptic arc not supported!")
0 \. x8 U2 h; V2 Z/ [                   (setq noarea T)
& w! Q( n6 N3 [# {" U                 )
: V% w$ ~8 q: c8 @                )
' N2 @4 }4 u- h& i% X                (setq lwp nil)6 Q3 B" }, ^) N) ?+ ~
               )
9 }6 v% d6 e: j( M' H) `1 U! U2 t2 n. |               ((= et 4) ; spline
, |5 P/ q' V) B  u( ]                (setq ed1 (member (assoc 94 (cdr ed1)) ed1))
, X0 z& \5 u# f. r/ h( n3 C                (setq knot-list nil)# ^$ {4 ^* a& I7 U: {9 }* i3 }
                (setq controlpoint-list nil)
( y. F9 V! N4 U* U                (setq kn (cdr (assoc 95 ed1)))( t6 `3 J8 Y1 b9 G
                (setq cn (cdr (assoc 96 ed1))), \6 x( ~0 Y6 o$ J1 K" A
                (setq pos (vl-position (assoc 40 ed1) ed1))
9 u# l) W  p3 q( h. ^2 B2 T                (repeat kn
8 _# p9 I" I; p, e                  (setq knot-list (cons (cons 40 (cdr (nth pos ed1))) knot-list))
* N5 ~/ N( `& p, p  q. D# T9 Z                  (setq pos (1+ pos))  Y, \7 S4 M) E! n# U
                )
; _1 q' E8 p' }2 v3 J                (setq pos (vl-position (assoc 10 ed1) ed1))" d# Z6 [  O6 g' s/ c3 M
                (repeat cn
, d8 s) k: f8 l. P* j8 Q4 f- P2 s                  (setq controlpoint-list (cons (cons 10 (trans (cdr (nth pos ed1)) ent 0)   ) controlpoint-
6 [$ u- T6 o: \0 }: v& k6 P" m  l. j9 P5 k# O; d
list));;add trans by xiaocai" {" G4 p1 I7 b/ T* p% @' u) x8 ?
                  (setq pos (1+ pos))* X, ~8 X+ y9 k# [  _
                )$ I8 B- y! Y( `) W4 o; R/ }9 e
                (setq knot-list (reverse knot-list)); x* c. o) L; @; x6 `
                (setq controlpoint-list (reverse controlpoint-list))2 L4 f7 P' K' m0 Q1 i+ G- M" u5 M
                (setq ne (append
7 z& S( Z$ `7 B+ d. N  p% D% M                               (list '(0 . "SPLINE"))! s) }# H, [' X7 h2 d+ a
                               (list (cons 100 "AcDbEntity"))
: C$ [* p2 B1 Y2 }) K* F- s                               (list (cons 100 "AcDbSpline"))- J5 `& m% j) R( m+ r
                               (list (cons 70 (+ 1 8 (* 2 (cdr (assoc 74 ed1))) (* 4 (cdr (assoc 73 ed1))))))
. Y# O  ?, ]% G' `, @. v" h8 g                               (list (cons 71 (cdr (assoc 94 ed1)))); R9 j3 n* A+ t3 g8 \. @* _" E
                               (list (cons 72 kn))
2 h% e% I! H$ Q# U3 G& Z1 Z- I& C& v                               (list (cons 73 cn))
; ~( ^4 ?2 J! M& e, @                               knot-list1 N" M$ }& v3 l; i, H, o* E0 N
                               controlpoint-list3 a$ w" A6 ]4 ]. N
                      )
- L% V1 G2 X6 I$ p0 n# z                )
! v: B- p4 N) s% T* c) J" i                (if hl (setq ne (append ne (cons 8 layer))))$ g- U2 x% V) Q( L3 U7 Z4 O3 w% I
                (entmake ne)
0 ~' {" W5 Y- }* n3 U                (setq ed1 (member (assoc 10 ed1) ed1))( z0 c' N: [: j
                (setq lwp nil)
  t: O5 U: _8 A& m1 B. B+ Y# U4 O               )
3 \, G% c0 O, o& O             ) ; end cond; Y0 y( Z" z4 {5 w3 z
           ) ; end repeat noe# H# v$ ~( R. B4 g" t% e! d
           (if lwp (progn
; A& H5 p* {/ D             (setq en1 (entnext lastent))
0 L! D. i6 G6 h2 S             (setq ss (ssadd))4 ^# u0 U4 `3 H/ n! Z7 I+ y
             (ssadd en1 ss)& D/ J* c, T2 ~/ \' k, s
             (while (setq en2 (entnext en1))4 Q8 k, ^2 v/ d* h( Q% e( q& t' C
               (ssadd en2 ss)
9 p% s) ?, u1 P, f4 p- Z               (setq en1 en2)
9 p; |: \: w# ]1 t* x8 V! ~             )& G5 W- V3 s  I/ G
             (if (= (getvar "peditaccept") 1): r, y3 x; J$ `. n2 _2 C
               (command "_.pedit" (entlast) "_J" ss "" "")
3 |9 j0 v: E0 G0 N0 s               (command "_.pedit" (entlast) "_Y" "_J" ss "" "")* k5 U4 d$ `5 \" y% \
             )4 T  e2 u1 H. [) D
          ))
' o1 b2 E; U& P6 a  d: J
9 {0 a3 v7 ~9 _" V1 [          ) ; end t# d$ O$ A$ `4 P* M- `+ @. D
        ) ; end cond5 ^% p9 A$ Y4 k# O
;        Tries to get the area on islands but it's not clear how to know if an island is filled or not! B& V) ~: v- X- c3 Z2 x5 Z
;        and if it should be substracted or added to the total area.
$ ^( B& v- Y, N# `4 B9 C. w;        (if (or (= bot 0) (= (boole 1 bot 1) 1)) (setq area (+ area (areaOfObject (entlast)))))
4 f6 u. A0 Y7 M5 }5 R;        (if (and (/= hst 1) (/= bot 0) (= (boole 1 bot 1) 0)) (setq area (- area (areaOfObject (entlast)))))
  V; R) |* F2 {7 A( X2 k;        (princ "\n") (princ bot) (princ "\n") (princ hst) (princ "\n")
* J) d( y* v2 w;        (princ (areaOfObject (entlast)))$ W' |$ @9 w  E) A* ~# t
      ) ; end repeat loops13 [5 w: Y# s& w  f8 H4 Y
      (if (and (= noarea nil) (= loops1 1)) (setq area (+ area (areaOfObject (entlast)))) (setq bMoreLoops T))
% D/ J# M8 A( C' |% |. q      (setq i (1+ i))
/ ~% c6 W; y* d3 K3 p( |9 d    )
. f: m2 Y! {) `* c% Z' A/ y   )/ i' S0 q4 V/ j- i' K
  )) z  ~) T, A% e: D  L, U& N* o* ~5 {9 i
  (setq ss2 nil)
9 W" v" i) R5 X$ `& i+ e% S1 S  (if (and area (not bMoreLoops)) (progn9 P- g. ^# \8 |& D2 `7 g! U, s
    (princ "\nTotal Area = ")) G. b& e3 n, g
    (princ area)
( d+ W* f0 U, {) Z$ M  ))) ~& e6 v" b* ^( r9 f- X2 H8 O0 W
  (restore)
7 n6 O' ]5 M, v. r  (princ)
/ I! V0 Q/ i4 ]){\rtf1}
+ ^8 }6 U8 _  m/ t" c2 X# B1 V$ g% G6 G2 ~! U7 C4 T6 p6 B
(defun C:BN ()4 {4 }  ^! T( O
  (princ "\nAdd block name to drawing.")7 h; c6 K- R, B
  (setq pt(cadr(entsel"\nSelect Block:")))
9 p; m8 m5 B# _5 Z# M% f' L  (setq e1(ssget pt))
4 u8 n# X( F) D+ |5 f3 v, |, [  (setq e2 (entget (ssname e1 0)))
. |3 [0 w  \7 A% J8 r, O) S  (setq blname (cdr(assoc 2 e2)))9 T, n) r6 o7 G6 q2 a
  (setq pt1 (getpoint"\nSelect point for block title:"))8 ~+ T/ d- ~. [0 V. \& e/ E' C! U
  (command "text" "c" pt1 "" blname)). h. k" U0 n# A5 q" N5 {
(princ "\nType BN to execute)
, K, M+ W& Y$ K. `9 p1 a  {$ D�32
$ f) H2 q' V- q$ Y( O' r: M9 V. b+ f4 K9 V) l3 V7 Y/ M( g
9 S4 `; m8 p9 N: n" d6 U  g/ b8 v

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

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