明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1433|回复: 5

[求助]:困擾我好久了!

[复制链接]
发表于 2004-8-30 15:16:00 | 显示全部楼层 |阅读模式
如何将spline转换成pline?听说:龙斑竹用LISP编过,实在是搜不到,帮一下小弟!多谢!
发表于 2004-8-30 15:50:00 | 显示全部楼层
;;BY LUCAS(龙龙仔)
;;将spline等分为n个弧,再转为pline
;;只对2D spline有效, 3D spline要改用3dpoly
(defun C:SPLINE_TO_PLINE (/ HOLDECHO OS SSS NUMPT N
ED ED1 PTST PTEND SS2 PT1 PT2
PT3 J ENT NNO SS SSL
)
(defun VAL1 (N SS INDEX)
(cdr (assoc N (entget (ssname SS INDEX))))
)
(defun CH_IT (NOS)
(if (assoc NOS ED)
(progn
(if (assoc NOS ENT)
(setq ENT (subst (assoc NOS ED) (assoc NOS ENT) ENT))
(setq ENT (append ENT (list (assoc NOS ED))))
)
(entmod ENT)
)
)
)
(setq HOLDECHO (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "_.undo" "group")
(setq OS (getvar "osmode"))
(setvar "osmode" 0)
(prompt "\nPlease pick the spline: ")
(setq SSS (ssget '((0 . "spline"))))
(if SSS
(progn
(initget (+ 1 2 4))
(setq NUMPT
(getint
"\nPlease specify the accuracy of conversion: "
)
)
(setq N 0)
(setq SSL (sslength SSS))
(repeat SSL
(prompt (strcat "\r馀 " (itoa (- SSL N)) " 个物件 "))
(setq ED1 (ssname SSS N))
(setq ED (entget ED1))
(setq PTST (cdr (assoc 10 ED))
PTEND (cdr (assoc 10 (reverse ED)))
)
(command "_.divide" ED1 (* 2 NUMPT))
(setq SS2 (ssget "p"))
(if (= (logand (cdr (assoc 70 ED)) 1) 1)
(setq J 1)
(setq J 0)
)
(setq PT3 PTST)
(setq SS (ssadd))
(repeat NUMPT
(setq PT2 (VAL1 10 SS2 J))
(if (/= NUMPT (/ (+ J 2) 2))
(setq PT1 (VAL1 10 SS2 (+ 1 J)))
(setq PT1 PTEND)
)
(command "_.arc" PT3 PT2 PT1)
(ssadd (entlast) SS)
(setq PT3 PT1)
(setq J (+ 2 J))
)
(command "_.pedit" (ssname SS 1) "" "j" SS "" "")
(setq ENT (entget (entlast)))
(foreach NNO '(6 8 62 48)
(CH_IT NNO)
)
(command "_.erase" SS2 ED1 "")
(setq N (1+ N))
)
(prompt (strcat "\r完成转换 ")
)
)
(alert "Nothing selected!!")
)
(setvar "osmode" OS)
(command "_.undo" "end")
(setvar "cmdecho" HOLDECHO)
(princ)
)
发表于 2004-8-30 15:53:00 | 显示全部楼层
看看你的帖子,一个问题不要发很多帖子 http://bbs.mjtd.com/forum.php?mod=viewthread&tid=25455
发表于 2004-8-30 15:54:00 | 显示全部楼层
回了贴之后才看到 meflying 斑竹已经回了,下次尽量不要重复发帖
发表于 2004-8-30 16:11:00 | 显示全部楼层
spring发表于2004-8-30 15:54:00回了贴之后才看到 meflying 斑竹已经回了,下次尽量不要重复发帖

不是说你,是说楼主
 楼主| 发表于 2004-9-1 10:15:00 | 显示全部楼层
各位:不好意思,只是我急於求得此经,新手嘛!以后不会如此了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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