本帖最后由 Gu_xl 于 2010-12-7 19:01 编辑
我也来一个,ActiveX方法的!
- (defun c:tt(/ modelspace)
-
- (setq oldosmode (getvar "osmode")
- oldcmdecho (getvar "cmdecho")
- )
- (setq modelspace (vla-get-ModelSpace (vla-get-activedocument(vlax-get-acad-object))))
- (setvar "osmode" 0)
- (setvar "cmdecho" 0)
- (setq ss (ssget '((0 . "circle"))))
- (setq k 0)
- (if ss
- (repeat (sslength ss)
- (setq en (ssname ss k))
- (setq cp (cdr (assoc 10 (setq enl (entget en))))
- r (cdr (assoc 40 enl))
- )
- (setq p1 (polar cp pi r)
- p2 (polar cp 0 r)
- )
- (setq pts (list p1 p2)
- pts (mapcar '(lambda (x) (list (car x) (cadr x))) pts)
- n (* 2 (length pts))
- )
- (setq arypts (vlax-make-variant
- (vlax-safearray-fill
- (vlax-make-safearray vlax-vbdouble (cons 1 n))
- (apply 'append pts)
- ) ;_ vlax-safearray-fill
- ) ;_ vlax-make-variant
- ) ;_ setq
- (setq obj (vla-AddLightWeightPolyline modelspace arypts))
- (vla-put-Closed obj :vlax-true)
- (vla-SetBulge obj 0 1)
- (vla-SetBulge obj 1 1)
- (setq k (1+ k))
- (command "_matchprop" en (entlast) "")
- (entdel en)
- )
- )
- (setvar "osmode" oldosmode)
- (setvar "cmdecho" oldcmdecho)
- )
|