pyou Posted September 27 Posted September 27 (edited) Hi all I have many Closed 3dpolyline Triangles with 4 vertices each. Would it be possible with the help of lisp command to track all triangles and remove duplicates, please? Its the first and second vertices with same position. Thank you Edited September 27 by pyou Quote
pyou Posted September 28 Author Posted September 28 (edited) On 28/09/2025 at 10:18, Lee Mac said: OVERKILL should remove the duplicate vertices. not in this case , unless i am doing something wrong. I have attached example dwg. Basically i had 3DFaces as Triangles and converted them using lisp into 3dpolyline Triangles, but it creates 4 Vertices for each Triangle, another lisp which supposed to create contours over triangles refusing to do so and say 3dpolylines are not closed polylines. Edited Thursday at 07:29 PM by pyou Quote
Tsuky Posted September 28 Posted September 28 Hi, With your drawing, this code will correct the polylines. To be adapted if used in another drawing (ssget filter) (vl-load-com) (defun c:Correct3DPL ( / ss AcDoc Space nb n ename obj l_pt lay new_obj) (setq ss (ssget "_X" '((0 . "POLYLINE") (67 . 0) (8 . "CTL_PNT") (66 . 1) (70 . 9)))) (cond (ss (setq AcDoc (vla-get-ActiveDocument (vlax-get-acad-object)) Space (if (= 1 (getvar "CVPORT")) (vla-get-PaperSpace AcDoc) (vla-get-ModelSpace AcDoc) ) nb 0 ) (repeat (setq n (sslength ss)) (setq ename (ssname ss (setq n (1- n))) obj (vlax-ename->vla-object ename) l_pt (vlax-get obj 'Coordinates) lay (vlax-get obj 'Layer) ) (cond ((eq (length l_pt) 12) (vla-delete obj) (setq new_obj (vlax-invoke Space 'Add3dPoly (cdddr l_pt))) (vla-put-Closed new_obj :vlax-true) (vla-put-Layer new_obj lay) (setq nb (1+ nb)) ) ) ) (princ (strcat "\n" (itoa nb) " polylines corrected.")) ) ) (prin1) ) 1 1 Quote
pyou Posted September 28 Author Posted September 28 16 minutes ago, Tsuky said: Hi, With your drawing, this code will correct the polylines. To be adapted if used in another drawing (ssget filter) (vl-load-com) (defun c:Correct3DPL ( / ss AcDoc Space nb n ename obj l_pt lay new_obj) (setq ss (ssget "_X" '((0 . "POLYLINE") (67 . 0) (8 . "CTL_PNT") (66 . 1) (70 . 9)))) (cond (ss (setq AcDoc (vla-get-ActiveDocument (vlax-get-acad-object)) Space (if (= 1 (getvar "CVPORT")) (vla-get-PaperSpace AcDoc) (vla-get-ModelSpace AcDoc) ) nb 0 ) (repeat (setq n (sslength ss)) (setq ename (ssname ss (setq n (1- n))) obj (vlax-ename->vla-object ename) l_pt (vlax-get obj 'Coordinates) lay (vlax-get obj 'Layer) ) (cond ((eq (length l_pt) 12) (vla-delete obj) (setq new_obj (vlax-invoke Space 'Add3dPoly (cdddr l_pt))) (vla-put-Closed new_obj :vlax-true) (vla-put-Layer new_obj lay) (setq nb (1+ nb)) ) ) ) (princ (strcat "\n" (itoa nb) " polylines corrected.")) ) ) (prin1) ) Thank you Tsuky, works exactly as i needed. Quote
BIGAL Posted September 28 Posted September 28 Not sure if the lisp by YMG will read 3dfaces. CIV3d will do it same with other civil packages like Civil Site Design.TriangV0.6.7.LSP 1 Quote
pyou Posted September 28 Author Posted September 28 17 minutes ago, BIGAL said: Not sure if the lisp by YMG will read 3dfaces. CIV3d will do it same with other civil packages like Civil Site Design.TriangV0.6.7.LSP Nice one Bigal, Thank you! Quote
GLAVCVS Posted Tuesday at 10:20 PM Posted Tuesday at 10:20 PM Another option: Keeping the original entity and removing any repeated points along the 3D polyline. (defun supriPts3DPol (e / l p lp vlae) (setq vlae (vlax-ename->vla-object e)) (while (/= (cdr (assoc 0 (setq l (entget (setq e (entnext e)))))) "SEQEND") (if (not (equal (setq p (cdr (assoc 10 l))) (car lp) 1e-4)) (setq lp (cons p lp))) ) (vlax-put vlae 'Coordinates (apply 'append (mapcar '(lambda(p) (mapcar 'float p)) lp))) ) 2 Quote
BIGAL Posted Wednesday at 10:26 PM Posted Wednesday at 10:26 PM Just be aware a 3dface is normally 4 points, making a 3dpoly with 3 sides is a different object so import to CIV3D etc may not work without extra steps. Quote
GLAVCVS Posted Friday at 05:05 AM Posted Friday at 05:05 AM (edited) On 9/29/2025 at 12:23 AM, BIGAL said: Not sure if the lisp by YMG will read 3dfaces. CIV3d will do it same with other civil packages like Civil Site Design.TriangV0.6.7.LSP Hi @BIGAL. I’ve taken a look at TriangV0.6.7.lsp but one of the most important functions, c:Prof, doesn’t seem to work properly. I can’t manage to find correspondence between the intersection points of the selected line and the 3DFACEs with what they should be in reality. Has the correct functioning of this command been proven? PS: SOLVED Edited Friday at 10:44 AM by GLAVCVS Update Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.