请教怎样把“含有弧段pline线”转化为pline?
请教高手一个问题:请教怎样把“含有弧段pline线”转化为pline?楼主的意思是用小的直线段来拟合圆弧。早期的线切割机床有些没有圆弧功能,就需要做这种处理。
楼主希望小的直线段的长度是多少?或者说对应的圆角是多大? 一个思路
先以 Divide / measure
取得点集后以 Line 绘制
用 OverKill 合并共线之直线
再 Pedit ...
(defun c:FitPl
(/ ENT FGX VERTEXSNUM N SECDEV PLIST D1 D2 D K D0 PARAM obj)
;;直线拟合多段线 By Gu_xl
(while (not (setq ent (car (entsel "\n选择多段线:")))))
(setq obj (vlax-ename->vla-object ent))
(setq fgx (getdist "\n输入最小分割间距<0.5>:"))
(if (null fgx)
(setq fgx 0.5)
)
(setq vertexsNum
(fix (vlax-curve-getEndParam ent))
n 0
)
(repeat vertexsNum
(if (setq secdev (vlax-curve-getSecondDeriv ent n))
(if (equal '(0.0 0.0 0.0) secdev 1e-8)
(setq plist (cons (vlax-curve-getPointAtParam ent n) plist))
(progn
(setq d1 (vlax-curve-getdistAtParam ent n)
d2 (vlax-curve-getdistAtParam ent (1+ n))
d (- d2 d1)
k (fix (/ d fgx))
d0 (/ 1.0 (1+ k))
param n
)
(setq plist (cons (vlax-curve-getPointAtParam ent n) plist))
(if (equal d0 1.0 0.001)
(setq plist
(cons (vlax-curve-getPointAtParam ent (+ 0.5 param))
plist
)
)
(repeat k
(setq plist (cons (vlax-curve-getPointAtParam
ent
(setq param (+ param d0))
)
plist
)
)
)
)
)
)
)
(setq n (1+ n))
)
(if (not (vlax-curve-isClosed ent))
(setq plist (cons (vlax-curve-getEndPoint ent) plist))
)
(reverse plist)
(command "pline")
(foreach p plist
(command "_non" (trans p 0 1))
)
(command "")
(if (vlax-curve-isClosed obj)
(vla-put-closed
(vlax-ename->vla-object (entlast))
:vlax-true
)
)
(princ)
) 根据线段上的弧 计算出等分点 然后把凸度去除 添加顶点 非常感谢超级版主Gu_xl,您超牛! Gu_xl 发表于 2013-3-27 11:55 static/image/common/back.gif
试用了,不过好像不太完美,弧、SP均有些问题 (acet-autoload2 '("FLATTENSUP.LSP" (acet-flatn ss hide)))
(acet-flatn (ssget) t) Gu_xl 牛逼
页:
[1]