来自明经- (defun c:tt(/ modelspace)3 ~3 @: k, H: u# J+ u
- 0 O* `1 _2 S" T A6 U. `2 |
- (setq oldosmode (getvar "osmode")
; ^& }0 @5 R. `# U+ e; M7 o - oldcmdecho (getvar "cmdecho")1 j' l; T+ Y! `5 S, j. q# r4 h
- )
+ \; \3 C- a: N* C: W - (setq modelspace (vla-get-ModelSpace (vla-get-activedocument(vlax-get-acad-object))))
$ R8 ?" q( H5 V% T7 c, s( r. D - (setvar "osmode" 0)8 P3 y( R" _$ N' Q; S( x/ v
- (setvar "cmdecho" 0)6 U2 d" k; i! `5 [
- (setq ss (ssget '((0 . "circle"))))4 |5 _ _) L0 C/ o( p
- (setq k 0)
* Z& I7 c. F, P; c - (if ss& ]% p' x; t% M
- (repeat (sslength ss)5 V& d! L# w- _% Z6 C/ T: I/ \
- (setq en (ssname ss k))
0 R$ r1 d* J3 ^% c0 T - (setq cp (cdr (assoc 10 (setq enl (entget en))))0 e0 M6 a3 Q, I
- r (cdr (assoc 40 enl))
& h! T8 m2 \$ Y' o, x/ A - )- y6 r/ F1 T, }; ^: @2 g6 F g- g# ^; Y
- (setq p1 (polar cp pi r)
$ ^! h( r8 c+ h8 y3 | - p2 (polar cp 0 r)
5 f' d" D( C1 U- \% | - )
- \6 J$ V$ L M0 G- o - (setq pts (list p1 p2)
$ ]" T: L% G6 B% L( p$ C- d7 `8 c - pts (mapcar '(lambda (x) (list (car x) (cadr x))) pts)8 B4 \, j' T! `/ q8 m i
- n (* 2 (length pts)); i+ _: I+ v$ S* m6 w' l" C
- )
/ ?5 u: M$ I% i3 F - (setq arypts (vlax-make-variant
! c. v1 k5 L3 v4 } - (vlax-safearray-fill; |9 D7 A# V8 N3 f9 Y4 \9 G
- (vlax-make-safearray vlax-vbdouble (cons 1 n)): T: G( Y+ M/ i6 u x8 l
- (apply 'append pts); V. T* G1 e W" ?
- ) ;_ vlax-safearray-fill
* O# l# @# ^7 w1 ?. }# F* q - ) ;_ vlax-make-variant
/ F+ d# G! Q' m$ x - ) ;_ setq
# V# I8 Q- g9 y( s' @ - (setq obj (vla-AddLightWeightPolyline modelspace arypts)); ^2 x7 i8 n; l) P) i9 \# Z
- (vla-put-Closed obj :vlax-true)/ K2 C2 U2 _, d4 F9 @3 g% t r* X
- (vla-SetBulge obj 0 1): d. r a/ u8 Z7 x2 K4 M
- (vla-SetBulge obj 1 1)
" n; ^2 E" H4 G% B - (setq k (1+ k))
1 K/ J# K& f. a( v/ T - (command "_matchprop" en (entlast) "")& A; H2 r$ X$ D: x7 {( d1 ~
- (entdel en)
% g$ m( R' v; H, _. s7 n5 g3 K - )
# {( f: \3 ]7 U; {% W - )
: ]( U r9 K" k, P t$ W# o- q - (setvar "osmode" oldosmode)& _/ v' o* i" z+ g& g. q
- (setvar "cmdecho" oldcmdecho)1 {( i, i: W/ N5 A: f- K
- )
复制代码 |