Jump to content

Find gaps in polygon


Recommended Posts

I don't mean to sound like I'm talking down to you - not my intent AT ALL - but can I ask why not just select the polyline and look for two grip that are close together?  I'm sure there's more than one reason this may not be an ideal solution (multiple/many gaps and you want something to handlethem all at once, gaps so small that it's had to discern the multiple endpoint grips, etc)... just asking

Link to comment
Share on other sites

Thanks Colin,  I  am a newbie and will take any and all advice. Usually the gaps I have are very tiny, and cannot see grips that are close together.  I   have to take every point where two segments meet, and zoom right down into that intersection. All very time consuming and tedious, and it doesn't always show the gap if the gap is so small.. there is always one more zoom needed :)
Hence my question, surely there must be a better way ;)

Edited by PJ01
Link to comment
Share on other sites

I'm guessing there probably is a way.  On the other hand, what leads to the gaps?  Are you drawing just by trying to place the end of a new PLINE at the end of another one "by eye"?  Are you using the Snaps so that the next PLINE you draw is geometrically starting from teh exact endpoint of the previous PLINE?  

  • Agree 1
Link to comment
Share on other sites

I would run the join command to make it a polyline. then this will add a circle to current layer at the start point of any open polyline selected.

 

;;----------------------------------------------------------------------;;
;; Marks Polyline start and end points
(defun C:OP (/ mspace SS)
  (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
  (while (setq SS (ssget '((0 . "*POLYLINE") (70 . 0))))
    (foreach poly (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
      (setq cir (vla-AddCircle mspace (vlax-curve-getstartpoint poly) 1)) ;change 1 to a radius you want.
      (vla-put-color cir 3)
      (setq cir (vla-AddCircle mspace (vlax-curve-getendpoint poly) 1))
      (vla-put-color cir 1)
    )
  )
  (princ)
)

 

Edited by mhupp
  • Like 1
Link to comment
Share on other sites

The best way to fix a gap is not to draw it in the first place. Is it possible to draw a polyline to represent your polygon? That way the nodes are guaranteed to close, especially if you use the Close option to finish it.

  • Like 1
  • Agree 1
Link to comment
Share on other sites

If it was me, and it is an occasional occurrence - sometimes happens - I'd break at a point then selecting either side of the break will select the part up to the gap, then you can fix the gap, join it all together. However it is only an occasional thing for me so I have never needed to do any more than that (most often if (ahem) "Someone else" draws a polyline to be hatched with a gap - but my drawings don't have a lot of hatching)

  • Like 1
Link to comment
Share on other sites

Good thinking, thanks Steve, this approach makes sense.The only problem I see ( for me)  is joining them all up again where I  broke the lines :)

Edited by PJ01
Link to comment
Share on other sites

That method of breaking the loop worked beautifully. Found the break immediately. Strange, because I  was able to fill the polygon with HATCH, which to me indicated that there was no  break!

Many thanks Steven P

 

  • Like 1
Link to comment
Share on other sites

11 hours ago, PJ01 said:

Good thinking, thanks Steve, this approach makes sense.The only problem I see ( for me)  is joining them all up again where I  broke the lines :)

 

 

'Join' comment or pedit (polyline edit) and use the option join (depends which version of CAD you are using when the join command was added)

Link to comment
Share on other sites

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