[讨论]如何把拟合二维线转为多段线?
<p>我需要把CAD图转入其它格式,他只能点对点转换,对于拟合的点却转不过去,多段线就没有这个问题,这是我转的线,却是有一部分重合的,谁有更好的方法。</p><p> </p> (defun c:tt (/);;;作者:wkq004@qq.com 2012-11-28
;;;功能:将二次拟合的二维多段线转为轻多段线
(setq ss (ssget ":S" '((0 . "POLYLINE"))))
(setq e (ssname ss 0))
(setq a e)
(setq ela (entget a))
(setq pts '())
(setq i 0)
(while
(and (setq e (entnext e)) (/= "SEQEND" (cdr (assoc 0 (entget e)))))
(setq el (entget e))
(if (= 8 (logand (cdr (assoc 70 el)) 8))
(progn (setq pt (cdr (assoc 10 el)))
(setq pts (append pts (list pt)))
)
)
)
(if pts
(progn (entdel a)
(entmake (append (list '(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
;;; (assoc 8 ela)
;;; (assoc 62 ela)
(cons 38 (caddr (assoc 10 ela)))
(cons 90 (length pts))
)
(if (= (logand (cdr (assoc 70 ela)) 1) 1) ;_判断闭合
(list (cons 70 1))
)
(mapcar '(lambda (x) (cons 10 x)) pts)
'((210 0. 0. 1.))
)
)
)
)
(princ)
)
页:
[1]