※ 引述《yp520 (阿育)》之銘言:
: ※ 引述《MTLOVER (我要加油~~~)》之銘言:
: : 請問在AutoCAD中
: : 如果我框選了ㄧ個範圍
: : 此範圍中包含許多點
: : 有辦法ㄧ次取得所有點的座標值嗎??
: : 謝謝囉~~
: 脫離autocad已有五年詳細已記不清,我只能告訴你邏輯
: 框選並取得「點」元素內的座標直--->匯出文字檔或交由後續程式處理。
: 詳情建議請教板上的sjgau大,他很懂lisp也很主動、熱心助人!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.245.76.180
程式寫好了,如下,請參考
; 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