来自明经- (defun c:tt(/ modelspace)
6 _7 S0 {! D) [7 N1 T - $ a5 C* `" M9 m
- (setq oldosmode (getvar "osmode")7 y, R, k% C7 X6 e3 J U
- oldcmdecho (getvar "cmdecho")- k3 R$ a2 R+ u* M
- )
0 c, p% l! b9 f4 G- _2 K - (setq modelspace (vla-get-ModelSpace (vla-get-activedocument(vlax-get-acad-object))))
8 x) U1 _( ^6 z9 i% E4 \ - (setvar "osmode" 0)
4 P# L. d% {/ W7 D* { - (setvar "cmdecho" 0)4 b+ v( F9 ?) C0 w, q
- (setq ss (ssget '((0 . "circle")))); B5 H5 J6 [! L. Z+ w
- (setq k 0)
5 f: y6 d/ J" h1 U) x3 c( i - (if ss
" S1 W/ j. {+ ?* H. f% I2 @9 p0 } - (repeat (sslength ss)
! u. C/ f* p: T5 Q9 ^+ [* c1 ] - (setq en (ssname ss k))
6 }% k! ^2 m- r/ C( z" s. N - (setq cp (cdr (assoc 10 (setq enl (entget en)))). T" L; i5 y! X0 C
- r (cdr (assoc 40 enl))
2 ~ Q- X! W3 R8 B - )5 S6 ?/ }" J. P; V8 y2 m+ N
- (setq p1 (polar cp pi r)
' f2 ~0 _: f8 v+ s$ L. Q - p2 (polar cp 0 r)
2 b2 A7 R5 v1 B - )! n% l1 d" M, f. v2 K) l4 w( I2 }
- (setq pts (list p1 p2); R4 F ^3 u% \- R1 l7 V; Z$ d
- pts (mapcar '(lambda (x) (list (car x) (cadr x))) pts)
( n$ q6 S" ?) W( B' F* m - n (* 2 (length pts))0 ^9 i6 q/ ?1 ~9 b) e8 D& o5 c
- )
+ _& o9 U; e2 b2 ^ - (setq arypts (vlax-make-variant# K! @8 C9 R3 A6 O R' d
- (vlax-safearray-fill
" y( K' E7 A9 _3 p& j - (vlax-make-safearray vlax-vbdouble (cons 1 n)). H, u! T" v% b7 _6 B6 B) Y
- (apply 'append pts)
9 J% O' c) ~% F7 J0 z% @ - ) ;_ vlax-safearray-fill( K% P! S: ^4 P% v, O
- ) ;_ vlax-make-variant
$ ]5 K8 S* L7 i( _& o' K - ) ;_ setq+ {1 G3 k# O ?
- (setq obj (vla-AddLightWeightPolyline modelspace arypts))
0 \& L5 U, s7 i - (vla-put-Closed obj :vlax-true)
& N4 l2 S8 D$ W+ ? [; x+ h5 m5 W - (vla-SetBulge obj 0 1)
/ U% x4 b3 g+ d# D$ t - (vla-SetBulge obj 1 1), J H! W6 U# f- }" W' r
- (setq k (1+ k))( b' Q( F Y- J. H& p% h' ?
- (command "_matchprop" en (entlast) "")
8 M1 L5 H/ `) j/ ]% r% H6 k, G- `& O - (entdel en)6 B# r; ], L* d/ r' R
- )0 W" _; ^# w9 b
- )
5 T) z% d X3 `6 B L1 e6 ~5 W9 x! U - (setvar "osmode" oldosmode)
6 P( v3 t& _- {& B4 M; R - (setvar "cmdecho" oldcmdecho)8 n. V% f' s1 E6 z2 J' I
- )
复制代码 |