Dear all, how to explode 3dface to line entity? thx
Hi Ken 3DFaces can't explode. - Read 'Coordinates' and draw the lines. - Don't forget to check for 3 sided 3DFace. - If necessary, delete 3DFace. Cheers Juerg
Something like this: (defun MeExplode3DFace (Obj / AcaDoc CurSpc PntCnt PntLst TmpObj) (setq AcaDoc (vla-get-ActiveDocument (vlax-get-acad-object)) CurSpc (if (or (= (getvar "TILEMODE") 1) (> (getvar "CVPORT") 1) ) (vla-get-ModelSpace AcaDoc) (vla-get-PaperSpace AcaDoc) ) PntCnt 0 PntLst (MeTripleUp (vlax-get Obj "Coordinates")) PntLst (if (equal (caddr PntLst) (cadddr PntLst) 1E-8) ;3 edges (append (reverse (cdr (reverse PntLst))) (list (car PntLst)) ) (append PntLst (list (car PntLst))) ) ) (repeat (1- (length PntLst)) (setq TmpObj (vlax-invoke CurSpc "AddLine" (nth PntCnt PntLst) (nth (setq PntCnt (1+ PntCnt)) PntLst) ) ) (vla-put-Color TmpObj (vla-get-Color Obj)) (vla-put-Layer TmpObj (vla-get-Layer Obj)) (vla-put-LineType TmpObj (vla-get-LineType Obj)) (vla-put-LinetypeScale TmpObj (vla-get-LinetypeScale Obj)) (vla-put-Lineweight TmpObj (vla-get-Lineweight Obj)) (vla-put-Visible TmpObj (vla-get-Visible Obj)) ) (vla-delete Obj) (princ) ) ; ; -- Function MeTripleUp ; Converts a list to a triple point list. ; Arguments [Type]: ; Lst = List to convert, eg. '(1 2 3 4 5 6) ; Return [Type]: ; > Converted list '((1 2 3) (4 5 6)) ; Notes: ; Credits to Ken Alexander ; (defun MeTripleUp (Lst / RetLst TmpLst) (if (setq TmpLst Lst) (while (setq RetLst (cons (mapcar '(lambda (l) (nth l TmpLst)) '(0 1 2)) RetLst ) TmpLst (cdddr TmpLst) ) ) ) (reverse RetLst) ) Use: (vl-load-com) (MeExplode3DFace (vlax-ename->vla-object (car (entsel)))) Cheers