作者sjgau (sjgau)
看板Cad_Cae
标题Re: [问题] 框选范围取得座标值
时间Thu May 24 12:27:11 2007
程式写好了,如下,请参考
; file: get-points.LSP
(defun c:get-points( / )
(setq fn1 (getstring "\nInput file name for write: "))
(setq f2 (open fn1 "w"))
; ---------------------------------------------
(princ "\nSelect some points for dump: ")
(setq ss1 (ssget))
(setq l1 (sslength ss1))
; for no= 0, no < l1, no++
(setq no 0)
(while (< no l1)
(setq entn1 (ssname ss1 no))
(setq ent1 (entget entn1))
(setq ent-type (cdr (assoc 0 ent1)))
; (setq ent-type (cdr ent-type)); get "POINT"
; --------------------------------------------
(if (= ent-type "POINT")
(progn; ent-type == "POINT"
(setq xyz (assoc 10 ent1))
(setq x (nth 1 xyz)
y (nth 2 xyz)
z (nth 3 xyz))
(princ (strcat (rtos x 1 6) " "
(rtos y 1 6) " " (rtos z 1 6) "\n") f2)
)); end if
(setq no (1+ no))
); end of while
; ---------------------------------------------
(close f2)
(princ)
); end of c:get-points()
(princ "\nUsage: get-points [Enter]\n")
(princ)
; end of file
※ 引述《yp520 (阿育)》之铭言:
: ※ 引述《MTLOVER (我要加油~~~)》之铭言:
: : 请问在AutoCAD中
: : 如果我框选了ㄧ个范围
: : 此范围中包含许多点
: : 有办法ㄧ次取得所有点的座标值吗??
: : 谢谢罗~~
: 脱离autocad已有五年详细已记不清,我只能告诉你逻辑
: 框选并取得「点」元素内的座标直--->汇出文字档或交由後续程式处理。
: 详情建议请教板上的sjgau大,他很懂lisp也很主动、热心助人!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 60.245.76.180