0
我有一個可以從三維折線創建樣條曲線的工作語句。我的問題是我不能讓它工作來選擇多個三維多段線或整個圖層,並且一個lisp會將結果圖層更改爲默認圖層。它應該保持原來的。 這是我的工作口齒不清:將三維折線更改爲在Autocad中用lisp進行樣條曲線
(defun c:3p2spl (/ *error* line2spl loop pl e s ss sss)
(vl-load-com)
(defun *error* (msg)
(vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))
)
(defun line2spl (e/sp ep d)
(setq sp (cdr (assoc 10 (entget e)))
ep (cdr (assoc 11 (entget e)))
d (distance sp ep)
)
(entdel e)
(entmakex
(list
'(0 . "SPLINE") '(100 . "AcDbEntity") '(100 . "AcDbSpline") '(210 0.0 0.0 1.0) '(71 . 1) '(73 . 2)
'(42 . 1.0e-010) '(43 . 1.0e-010) '(40 . 0.0) '(40 . 0.0) (cons 40 d) (cons 40 d) (cons 10 sp) (cons 10 ep)
)
)
)
(vla-startundomark (vla-get-activedocument (vlax-get-acad-object)))
(setq loop T)
(setq sss (ssget "_I"))
(if (and sss (eq (cdr (assoc 0 (entget (setq pl (ssname sss 0))))) "POLYLINE") (< 7 (cdr (assoc 70 (entget pl))) 14)) (setq loop nil))
(while loop
(setq pl (car (entsel "\nPick 3DPOLYLINE to convert it to SPLINE")))
(if (and (eq (cdr (assoc 0 (entget pl))) "POLYLINE") (< 7 (cdr (assoc 70 (entget pl))) 14)) (setq loop nil))
)
(setq e (entlast))
(command "_.explode" pl "")
(setq ss (ssadd))
(while (setq e (entnext e))
(if (eq (cdr (assoc 0 (entget e))) "LINE")
(progn
(setq s (line2spl e))
(ssadd s ss)
)
)
)
(command "_.join" (ssname ss 0) ss "")
(*error* nil)
(princ)
)
如果我改變ssget "_I"
到ssget "_:E"
我可以選擇多行但它會改變樣條線只有第一個。