zxdcad
发表于 2010-12-7 09:33:19
本帖最后由 zxdcad 于 2010-12-7 09:57 编辑
用PL绘制圆弧再闭合是比较简单的一种方式生成多段线圆,
((= (cdr TC) "CIRCLE")
(setq xy (cdr (assoc 10 b1)))
(setq xy0 (trans xy 0 1))
(setq ra (cdr (assoc 40 b1)))
(setq ks (polar xy0 0 ra))
(entdel ty)
(command "pline" ks "w" kd kd "a" "ce" xy0 "a" 180 "cl")
)
xiaxiang
发表于 2010-12-7 16:18:30
这程序好像不应该收费。。。个人意见
elitefish
发表于 2010-12-7 17:19:55
圆转多线 应该是转成 圆环吧
Gu_xl
发表于 2010-12-7 18:13:11
本帖最后由 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)
)
xyp1964
发表于 2010-12-7 18:29:44
;; circle → 多段线
(defun c:tt ()
(defun dxf (code elist) (cdr (assoc code elist)))
(setq ss (ssget '((0 . "circle")))
n-1
)
(while (setq s1 (ssname ss (setq n (1+ n))))
(setq et (entget s1)
pt (dxf 10 et)
r(* (dxf 40 et) 2)
)
(command "donut" r r "non" pt "")
(entdel s1)
)
(princ)
)
yoyoho
发表于 2010-12-7 21:44:00
感谢诸位高手分享程序!
偏爱云~小吴
发表于 2013-11-11 21:58:45
高手啊,可以来个逆向的么,我需要将多线段转为圆,怎么搞,请高手帮忙
gzbccy
发表于 2013-11-12 07:00:21
都不错。值得学习
500w008
发表于 2013-11-13 20:06:29
ygp820601
发表于 2013-11-14 18:33:38
xyp1964 发表于 2010-12-7 18:29 static/image/common/back.gif
当UCS与WCS不一致时,转换后的多段线的圆与原来的圆不在同一位置哦。