Lisp lệnh EX3F trong chủ đề “không explore được đối tượng 3D face!!”
Lệnh ex3f (explode 3dFace) dưới đây sẽ làm điều đó.
(defun c:ex3f () (defun ex3fone (ent) (setq p1 (dxf ent 10) p2 (dxf ent 11) p3 (dxf ent 12) p4 (dxf ent 13) ) (ml p1 p2) (ml p2 p3) (ml p3 p4) (ml p4 p1) ) (sudung ex3fone (setq ss (ssget '((0 . "3DFACE"))))) (initget "Yes No") (if (/= (getkword "\nErase 3DFace(s)? (<Yes>/No): ") "No") (command ".erase" ss "") ) (princ) ) (defun dxf (ent c) (cdr (assoc c (entget ent))) ) (defun ml (p1 p2) (entmake (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2))) ) (defun sudung (ham ss / sodt index entdt soapp) (setq sodt (if ss (sslength ss) 0 ) soapp 0 index 0 ) (repeat sodt (setq entdt (ssname ss index) index (1+ index) ) (if (ham entdt) (setq soapp (1+ soapp)) ) ) soapp )
Bác Hoành ơi!
Cái lisp này có explode được hình Polyface Mesh không? Hoặc bác cho em cái Lisp để Explode hình Polyface Mesh nhé! Thanks!
VD cái hình này!
- Tải lisp
- 365354_ex3f.lsp
Cách dùng
- Tải tệp 365354_ex3f.lsp về máy.
- Trong AutoCAD gõ lệnh APPLOAD, chọn tệp vừa tải rồi bấm Load. Cũng có thể kéo thả tệp .lsp vào cửa sổ bản vẽ.
- Gõ lệnh EX3F để chạy lisp.
Mã nguồn 365354_ex3f.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/2524-kh%C3%B4ng-explore-%C4%91%C6%B0%E1%BB%A3c-%C4%91%E1%BB%91i-t%C6%B0%E1%BB%A3ng-3d-face/
(defun c:ex3f ()
(defun ex3fone (ent)
(setq
p1 (dxf ent 10)
p2 (dxf ent 11)
p3 (dxf ent 12)
p4 (dxf ent 13)
)
(ml p1 p2)
(ml p2 p3)
(ml p3 p4)
(ml p4 p1)
)
(sudung ex3fone (setq ss (ssget '((0 . "3DFACE")))))
(initget "Yes No")
(if (/= (getkword "\nErase 3DFace(s)? (<Yes>/No): ") "No")
(command ".erase" ss "")
)
(princ)
)
(defun dxf (ent c)
(cdr (assoc c (entget ent)))
)
(defun ml (p1 p2)
(entmake (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2)))
)
(defun sudung (ham ss / sodt index entdt soapp)
(setq sodt (if ss
(sslength ss)
0
)
soapp 0
index 0
)
(repeat sodt
(setq entdt (ssname ss index)
index (1+ index)
)
(if (ham entdt)
(setq soapp (1+ soapp))
)
)
soapp
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề không explore được đối tượng 3D face!!. Xem đúng bài viết #365354 để đọc hướng dẫn và trao đổi thêm.