bustr 发表于 2022-7-5 15:51:16

Can someone help? I don't

I need a lisp that goes through a drawing and automatically converts all 3D Faces to polylines. I need the polylines to remain on the same layers as the 3D Faces.I have tried this one "3DF2L.lsp" and it causes more work than it saves.

ronjonp 发表于 2022-7-5 16:08:27

Here's a quick one:

(defun c:foo (/ o s sp) (if (and (setq s (ssget ":L" '((0 . "3DFACE"))))   (setq sp (vlax-get (vla-get-activedocument (vlax-get-acad-object))                      (if (= 1 (getvar 'cvport))                        'paperspace                        'modelspace                      )          )   )   )   (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))   (if (setq o (vlax-invoke sp 'add3dpoly (vlax-get (vlax-ename->vla-object x) 'coordinates)))(progn (entdel x) (vlax-put o 'closed -1))   )   ) ) (princ))(vl-load-com)

bustr 发表于 2022-7-5 16:18:13

Thanks. That works.

Grrr 发表于 2022-7-5 16:21:31

Not sure but I think that David Bethel posted something like this in the past.
BTW nice coding Ron!

ronjonp 发表于 2022-7-5 16:39:51

Glad to help
@Grrr .. Thanks!

BIGAL 发表于 2022-7-5 16:48:45

ronjonp I like the idea of passing the co-ords I would have used a list and stepped through them much simpler no need for a seperate co-ord routine.
 
Saved it to my library just called it something I would find. Added your name as a header

David Bethel 发表于 2022-7-5 16:56:59

I have probably written this over the years.
 
But with a clean start :
 

(defun c:3df23dpl (/ ss i en ed) (and (setq ss (ssget "X" (list (cons 0 "3DFACE"))))      (setq i 0)      (princ "\nSearching...\n")      (while (setq en (ssname ss i))             (princ "\t\t\r")             (prin1 en)             (setq ed (entget en))             (entmake (list (cons 0 "POLYLINE")                            (assoc 8 ed)                            (cons 66 1)                            (cons 70 9)                            (list 10 0 0 0)))             (foreach g '(10 11 12 13)               (entmake (list (cons 0 "VERTEX")                              (assoc 8 ed)                              (cons 10 (cdr (assoc g ed)))                              (cons 70 32))))             (entmake (list (cons 0 "SEQEND")                            (assoc 8 ed)))             (entdel en)             (setq i (1+ i)))) (redraw) (prin1))
 
This could tweaked for color.No linetypes or thicknesses allowed.
 
 
-David
页: [1]
查看完整版本: Can someone help? I don't