CAD lisp二次开发 注释与完善【补充完善的追加至100分】 30
下面的lisp语言请高手逐句解释,该段程序的功能是在CAD中生成多段线的各点坐标,但如果有多个闭合的多段线的话一个一个点击生成太麻烦了,想请高手麻烦帮修改下,每个语句注释...
下面的lisp语言请高手逐句解释,该段程序的功能是在CAD中生成多段线的各点坐标,但如果有多个闭合的多段线的话一个一个点击生成太麻烦了,想请高手麻烦帮修改下,每个语句注释好的,给分,另外帮修改好的另给至100分,谢谢O(∩_∩)O~
;生成土地坐标表
(defun c:tdd()
(vl-load-com)
(setvar "cmdecho" 0)
(command "osnap" "none")
(setq pll(car (entsel "\n请选择界址线:")))
(setq fname (getfiled "土地数据文件" "" "txt" 1))
(setq fs (open fname "w"))
(setq vlaPLL (VLAX-EName->VLA-object pll))
(setq ptt (VLAX-Get-Property vlapll "Coordinates"))
(setq plist (vlax-safearray->list (vlax-variant-value ptt)))
(setq i 0)
(while plist
(setq x (car plist))
(setq plist (cdr plist))
(setq y (car plist))
(setq plist (cdr plist))
(setq sx (rtos x 2 3))
(setq sy (rtos y 2 3))
(setq i (+ i 1))
(setq si (itoa i))
(setq ss (strcat "," sy))
(setq ss (strcat sx ss))
(setq ss (strcat ",1," ss))
(setq ss (strcat "j"si ss))
(write-line ss fs)
)
(close fs)
(VLAX-Release-object vlapll)
) 展开
;生成土地坐标表
(defun c:tdd()
(vl-load-com)
(setvar "cmdecho" 0)
(command "osnap" "none")
(setq pll(car (entsel "\n请选择界址线:")))
(setq fname (getfiled "土地数据文件" "" "txt" 1))
(setq fs (open fname "w"))
(setq vlaPLL (VLAX-EName->VLA-object pll))
(setq ptt (VLAX-Get-Property vlapll "Coordinates"))
(setq plist (vlax-safearray->list (vlax-variant-value ptt)))
(setq i 0)
(while plist
(setq x (car plist))
(setq plist (cdr plist))
(setq y (car plist))
(setq plist (cdr plist))
(setq sx (rtos x 2 3))
(setq sy (rtos y 2 3))
(setq i (+ i 1))
(setq si (itoa i))
(setq ss (strcat "," sy))
(setq ss (strcat sx ss))
(setq ss (strcat ",1," ss))
(setq ss (strcat "j"si ss))
(write-line ss fs)
)
(close fs)
(VLAX-Release-object vlapll)
) 展开
展开全部
可以参考我个人编写的获取点坐标到xls的lisp程序,不过不是批处理,需要单点
http://wenku.baidu.com/view/8cfd9732ee06eff9aef80744.html?st=1
http://wenku.baidu.com/view/8cfd9732ee06eff9aef80744.html?st=1
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
改程序还不如变新的,
追问
那麻烦您帮变一下新的也行,能达到目的就行啦·
追答
(defun c:tdd( / I JZXJH)
(vl-load-com)
(setvar "cmdecho" 0)
(command "osnap" "none")
(setq fname (getfiled "土地数据文件" "" "txt" 1));该句位置前移==
(setq fs (open fname "w"));该句位置前移==
(SETQ JZXJH (ssget "X" (LIST (CONS 8 (GETSTRING "界址线所在图层")) '(0 . "LWPOLYLINE"))));全部选择界址线=我认为你的界址线全在同一个图层,并且该层没有非界址线对象
(SETQ kI 0)
(REPEAT (SSLENGTH JZXJH);;循环=
(setq pll (SSNAME JZXJH kI))
(setq vlaPLL (VLAX-EName->VLA-object pll))
(setq ptt (VLAX-Get-Property vlapll "Coordinates"))
(setq plist (vlax-safearray->list (vlax-variant-value ptt)))
(setq i 0)
(while plist
(setq x (car plist))
(setq plist (cdr plist))
(setq y (car plist))
(setq plist (cdr plist))
(setq sx (rtos x 2 3))
(setq sy (rtos y 2 3))
(setq i (+ i 1))
(setq si (itoa i))
(setq ss (strcat "," sy))
(setq ss (strcat sx ss))
(setq ss (strcat "," (ITOA KI) "," ss));我把1改成了I,因为不知道1有啥用,我用来区分线=
(setq ss (strcat "j" si ss))
(write-line ss fs)
)
(SETQ kI (1+ kI))
)
(close fs)
(VLAX-Release-object vlapll)
)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你好,写程序加我 1375045156 我帮你搞定
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询