Results 1 to 9 of 9

Thread: closed polyline

  1. #1
    All AUGI, all the time
    Join Date
    2004-06
    Location
    Slidell, Louisiana
    Posts
    964
    Login to Give a bone
    0

    Default closed polyline

    If you have a polyline that appears to be closed but isn't, is there a way or lisp file that can detect which vertices have the gap?

  2. #2
    I could stop if I wanted to
    Join Date
    2014-08
    Posts
    441
    Login to Give a bone
    0

    Default Re: closed polyline

    Hi
    simple select the pline go to properties window check in the box for vertices and run it around the line

  3. #3
    Certified AUGI Addict cadtag's Avatar
    Join Date
    2000-12
    Location
    Cairo - no, not Illinois
    Posts
    5,061
    Login to Give a bone
    0

    Default Re: closed polyline

    Using Properties palette and running though vertices will work -- just be cautions and pay attention to the vertex number, as it will leap across the gap and go back to vertex number one.

    An alternative, is to use the Pedit command, Edit vertex, and Next to step through all the vertices. This will stop at the last vertex and not jump the gap and start over.

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,302
    Login to Give a bone
    0

    Default Re: closed polyline

    Something else to keep in mind is that the pline may have the first and last vertices snapped together but still not be "closed". For example, take a rectangle. You need 4 vertices, but users tend not to use the CLOSE option to finish a polygon. They will add a 5th vertex with the location the same as the first vertex. This is still an open pline.The pline's Closed property needs to by TRUE. Your lisp should check that property.
    C:> ED WORKING....

  5. #5
    Member
    Join Date
    2016-05
    Posts
    17
    Login to Give a bone
    0

    Default Re: closed polyline

    This lisp will draw a circle on the starting point of the open polyline.

    HTML Code:
    (defun c:openpl ( /  *DOCUMENT* *MODELSPACE* CIR_OBJ N PO POBJ PO_LIST SS SSL X)
      
    (setq *ModelSpace* (vla-get-ModelSpace (setq *Document* (vla-get-ActiveDocument (vlax-get-acad-object)))))
    
    (command-s "_undo" "_g")
      
    (defun red:cir (p r)
    (setq cir_Obj (vla-AddCircle *ModelSpace* (vlax-3d-point p) r)) 
    (vlax-put-property cir_Obj'color 1)
    cir_Obj
    )
    
    (setq ss (ssget '((0 . "LWPOLYLINE")(70 . 0))))
    (setq ssl (sslength ss))
    (setq n 0)
    (repeat ssl
    (setq pobj(ssname ss n))
    (setq po(cdr (assoc 10 (entget pobj))))
    (setq po_list(append po_list (list po)))
    (setq n (1+ n))
    )
    
    (mapcar '(lambda (x) 
    (red:cir  x (getvar"textsize"))
    ) 
    po_list
    )
    
    (command-s "_undo" "_e")
    
    )

  6. #6
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,302
    Login to Give a bone
    0

    Default Re: closed polyline

    I see that you are checking for dxf gc 7= 0. You could just set it to 1 to close it.
    C:> ED WORKING....

  7. #7
    Member
    Join Date
    2016-05
    Posts
    17
    Login to Give a bone
    0

    Default Re: closed polyline

    If you just close it, sometimes it can go messy if some of the polylines have an overlap in the corner.
    Here just to mark the open polygons.

  8. #8
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,302
    Login to Give a bone
    0

    Default Re: closed polyline

    Yes. I wouldn’t do it without some error checking, like seeing if the first and last vertices are coincident. I might even delete the last vertex.
    C:> ED WORKING....

  9. #9
    Member
    Join Date
    2016-05
    Posts
    17
    Login to Give a bone
    0

    Default Re: closed polyline

    there is a kind of trick for such case you can explode the open polygons if it's not shared their boundaries and then polyline edit then multiple and select all the exploded polygons then Join and put a tolerance according to the drawing units and scale, that rejoin the polygons as a closed polygons.

Similar Threads

  1. ssget closed polyline
    By rad.77676 in forum AutoLISP
    Replies: 31
    Last Post: 2009-04-16, 07:26 AM
  2. Quick adding of multiple closed polyline areas
    By CBLENDERMANN in forum AutoLISP
    Replies: 6
    Last Post: 2008-05-29, 04:21 PM
  3. C# - closed Polyline length
    By RoSiNiNo in forum ARX
    Replies: 1
    Last Post: 2005-03-02, 03:17 PM
  4. Getting the centroid of closed polyline
    By csgohjmj in forum AutoLISP
    Replies: 24
    Last Post: 2004-10-15, 06:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •