zsjwlp 发表于 2003-12-24 10:27:00

各位大侠速来救火!!!!!

如何把SPLINE线转换为PLINE线,请告之,先谢了,急急急急急急急急急!!!!!!

pencilliny 发表于 2003-12-24 11:27:00

pedit

BDYCAD 发表于 2003-12-24 11:27:00

本站有
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=13685
(defun c:sptrace (/ ent spline cur pl end keep)
(setq cur nil)
(setq pl '((0 . "LWPOLYLINE")
   (100 . "AcDbEntity")
   (67 . 0)
   (8 . "0")
   (100 . "AcDbPolyline")
   (90 . 7)
   (70 . 0)
   (43 . 0.0)
   (38 . 0.0)
   (39 . 0.0)
    )
   )
(setq end '(210 0.0 0.0 1.0));define polyline group codes
(while (not (progn (princ "\rSelect Spline: ") ;select spline to convert
    (setq spline (ssget ":s" '((0 . "SPLINE"))))
   )
)
)
(initget "Yes No")
(setq keep (getkword "Keep Original Spline : "));keep original line or not
(setq spline (ssname spline 0)); get ename
(if (/= keep "No")
   (progn
   (entmake (entget spline));copy spline
   (setq spline (entlast));get ename of new spline
   )
   )
(setq ent spline); copy ename to new variable
(command "splinedit" ent "refine" "elevate" 26 "x" "x");add extra control points
(setq ent (entget ent)); get data for spline
(setq pl (subst (assoc 8 ent) (assoc 8 pl) pl)); set polylines layer to same as spline
(if (= (rem (cdr (assoc 70 ent)) 2) 1);is spline closed
   (setq pl (subst (cons 70 1) (assoc 70 pl) pl));set polyline closed
   (setq pl (subst (cons 70 0) (assoc 70 pl) pl));set polyline open
)
(repeat (length ent);loop
   (progn
   (if (eq (car (car ent)) 10);get control point data
(setq cur (append cur (list (car ent))))
   )
   (setq ent (cdr ent));get next element in list
   )
)
(setq pl (subst (cons 90 (length cur)) (assoc 90 pl) pl));set number of points in polyline
(repeat (length cur);loop
   (progn;add polyline point data
   (setq pl
    (append
      pl
      (list (car cur) (cons 40 0.0) (cons 41 0.0) (cons 42 0.0))
    )
   )
   (setq cur (cdr cur));get next element in list
   )
)
(setq pl (append pl (list end)));add normal vector to polyline data
(entmake pl);make polyline
(entdel (cdr (assoc -1 (entget spline))));entdel spline, original or copy
(princ);exit quietly
)
页: [1]
查看完整版本: 各位大侠速来救火!!!!!