cadlisp獲取當前檢視座標,cadlisp獲取當前檢視座標 30

時間 2021-06-11 15:20:59

1樓:雪v歌

複製下面的指令碼到命令列回車即可載入,輸入pldd,程式會提示選擇pline,選擇pline後會列印所有的三維座標

(defun c:pldd (/ wb cc ss1 aa pts bhbz ent)

(setq ent (car (entsel "\n請選擇pline")))

(setq wb (entget ent) cc nil bhbz (cdr (assoc 70 wb)) )

(cond

((= (cdr (assoc 0 wb)) "polyline")

(setq ss1 (entnext ent))

(while (/= ss1 nil)

(setq aa (entget ss1))

(if (= (cdr (assoc 0 aa)) "vertex") (progn

(setq aa (cdr (assoc 10 aa)))

(if (/= aa nil) (progn

(if (= (length aa) 2)

(setq aa (list (car aa) (cadr aa) 0.0) )

)(if (= cc nil)

(setq pts aa)

)(setq cc (cons aa cc))

))(setq ss1 (entnext ss1))

)(setq ss1 nil)))

(if (= bhbz 1)

(setq cc (cons pts cc))))

((= (cdr (assoc 0 wb)) "lwpolyline")

(setq wb (member (assoc 10 wb) wb))

(while (assoc 10 wb)

(setq aa (cdr (assoc 10 wb)))

(if (= (length aa) 2)

(setq aa (list (car aa) (cadr aa) 0.0) )

)(if (= cc nil)

(setq pts aa)

)(if (= (length aa) 2)

(setq aa (list (car aa) (cadr aa) 0.0) )

)(setq cc (cons aa cc) wb (cdr wb))

(if (assoc 10 wb)

(setq wb (member (assoc 10 wb) wb))))

(if (= bhbz 1)

(setq cc (cons pts cc))))

((= (cdr (assoc 0 wb)) "spline")

(setq wb (member (assoc 11 wb) wb))

(while (assoc 11 wb)

(setq aa (cdr (assoc 11 wb)))

(if (= (length aa) 2)

(setq aa (list (car aa) (cadr aa) 0.0) )

)(if (= cc nil)

(setq pts aa)

)(setq cc (cons aa cc) wb (cdr wb))

(if (assoc 11 wb)

(setq wb (member (assoc 11 wb) wb))))

2樓:

貼上這個**就可以實現獲取圓心座標

(vlax-get (vlax-ename->vla-object (car (entsel))) 'center )

求修改lisp程式,如何提取cad圖中多段線的座標(要當前ucs座標系)

3樓:匿名使用者

(defun c:tqzb (/)

(setq cm (getvar "cmdecho"))

(setvar "cmdecho" 0)

(if (setq wjm (getfiled "請指定要儲存的座標檔案" "e:\\" "txt" 1))

(if (setq ssa (ssget '((0 . "lwpolyline"))))

(progn

(setq fff (open wjm "w")

n (sslength ssa)

i 0

no 0

)(repeat n

(setq dxf (entget (ssname ssa i))

i (1+ i)

ptb (mapcar 'cdr (vl-remove-if-not '(lambda(x)(= (car x) 10)) dxf))

ptb (mapcar '(lambda(x)(trans x 0 1)) ptb)

)(foreach pt ptb

(setq no (1+ no))

(write-line (strcat (itoa no) ","

(rtos (car pt) 2 2) ","

(rtos (cadr pt) 2 2) ","

)fff))

)(close fff)

(princ (strcat "\n座標已存入\"" wjm "\"中"))))

)(setvar "cmdecho" cm)

(princ))

求一個lisp程式,關於提取cad影象座標

4樓:設計人生

方案一:直接讀取dwg格式檔案有點難度,估計高手會做方案二:若是檔案有很多要做的話,可以用c#,c++,vb通過com去開發,用com方式依次開啟dwg圖檔,然後遍歷圖元來進行你的要求來運算

方案三:若是檔案有很多要做的話,也可以用autolisp來做,自動開啟你的檔案列表,然後遍歷圖元來進行你的要求來運算

方案四:若是檔案不是很多的話,也可以手動開啟dwg檔案,然後編寫lisp函式遍歷圖元來進行你的要求來運算

或者你發一些cad參考圖檔給我,我來幫你看看到底怎麼做合適若是覺得滿意的話還請採納

求助:如何用lisp讀取cad中許多散點的座標

5樓:

請檢視附件,寫的lisp程式,輸入tt執行程式,批量選擇cad中的點,然後將座標寫入txt檔案。

指定儲存檔案的位置及名稱,然後選擇點就歐克了。