Jump to content

Recommended Posts

Posted (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 by pyou
Posted (edited)
9 hours ago, 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.

 

Long story short, I am looking for a lisp which could create Contours at desired interval over 3DFaces. For example at 0.2m 1.0m interval and label them up along at specific distance.

sample.dwg

Edited by pyou
Posted

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)
)

 

  • Thanks 1
Posted
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.

Posted
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!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...