- 积分
- 19100
- 明经币
- 个
- 注册时间
- 2003-8-16
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2003-9-8 14:03:00
|
显示全部楼层
真誠向你代表我深深的謝謝,經過幾天的不斷改進,小包現在把解決這個問題的程序開發出來了,現在和各位分享下,希望大家保持一种樂于交流的心態,讓我們的有更大的進步:
以下是程序的源代碼:
(defun c:y02a(/ a selectpoint os ssa ssl endp sp n endata spo end
distfulla distfullb distuser ss ssc ass newpo)
(setq a (entsel))
(setq selectpoint (cadr a ))
(setvar "cmdecho" 0)
(setq os (getvar "osmode" ))
(setvar "OSMODE" 0)
(COMMAND "_measure" a 2 )
(setq ssa (ssget "X" '((0 . "OINT"))))
(setq ssl (sslength ssa))
(setq endp (cdr (assoc 10 (entget (ssname ssa 0)))));;諉輪SPLINE笝萸腔珨跺SPLINE奻腔萸
(setq sp (cdr (assoc 10 (entget (ssname ssa (- ssl 1))))));;;諉輪SPLINE萸腔珨跺SPLINE奻腔萸
(setq n 0)
(setq ;ssn(ssname a n);;;枑SPLINER腔萸釴梓
endata (entget (car a))
spo (CDR (assoc 10 endata)));;;自動取得spline的起點座標.設成spo變量
(repeat (length endata);;;枑SPLINER腔笝萸釴梓
(setq end (cdr (nth n endata)));;;自動取得spline的終點座標,設成end變量,
(setq n (1+ n)))
(setq distfulla(distance spo selectpoint))
(setq distfullb(distance end selectpoint))
(if (> distfullb distfulla)
(progn
(princ "\nPlease get dist for lengthen spline:")
(setq distuser (getdist spo pause));;;繪出spline延長的長度,用鼠標選點确定
(command "line" spo sp "")
(setq ss (entlast))
(command "erase" a "");;;刉壺埻懂腔SPLINE
(command "lengthen" "de" distuser spo "" "" "")
(setq ssc (entlast))
(setq ass (entget ssc))
(setq newpo (cdr (assoc 10 ass)));;;取得要延長spline延長到的點坐標.
(command "erase" ssa "");;;刉壺垀衄腔萸
(command "erase" ss "");;;刉壺最唗赻賒腔腔盄
(command "erase" ssc "");;;刉壺最唗赻賒腔腔盄
(entmake endata);;;遠埻最唗眕刉壺腔SPLINE
(setq a (entlast))
(command "_splinedit" a "m" "s" spo newpo "x" "");;; spline edit
)
(progn
(princ "\nPlease get dist for lengthen spline:")
(setq distuser (getdist end pause));;;繪出spline延長的長度,用鼠標選點确定
(command "line" end endp "")
(setq ss (entlast))
(command "erase" a "");;;刉壺埻懂腔SPLINE
(command "lengthen" "de" distuser end "" "" "")
(setq ssc (entlast))
(setq ass (entget ssc))
(setq newpo (cdr (assoc 10 ass)));;;取得要延長spline延長到的點坐標.
(command "erase" ssa "");;;刉壺垀衄腔萸
(command "erase" ss "");;;刉壺最唗赻賒腔腔盄
(command "erase" ssc "");;;刉壺最唗赻賒腔腔盄
(entmake endata);;;遠埻最唗眕刉壺腔SPLINE
(setq a (entlast))
(command "_splinedit" a "m" "s" end newpo "x" "");;; spline edit
))
(setvar "cmdecho" 1)
(setvar "osmode" os)
(princ "\n在命令行揄入y02喚起這個功能:")
(princ)) |
|