明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1244|回复: 2

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

[复制链接]
发表于 2003-12-24 10:27:00 | 显示全部楼层 |阅读模式
如何把SPLINE线转换为PLINE线,请告之,先谢了,急急急急急急急急急!!!!!![em00]
发表于 2003-12-24 11:27:00 | 显示全部楼层
pedit
发表于 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 [Yes/No]: "));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金钱 +10 贡献 +2 激情 +3 收起 理由
bluemoon + 10 + 2 + 3 【好评】好帖

查看全部评分

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 20:19 , Processed in 0.253929 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表