Create a Boundary around a set of disconnected polyline objects

Create a Boundary around a set of disconnected polyline objects

Terence3YCFB
Participant Participant
2,008 Views
20 Replies
Message 1 of 21

Create a Boundary around a set of disconnected polyline objects

Terence3YCFB
Participant
Participant

 

I design irrigation in and around landscape beds for large gated communities. Often, when we recieve the plans for the landscape beds, instead of getting a plan showing the edges of each landscape bed, we get a plan showing the segments of each bed where different plants are grouped.

 

Terence3YCFB_0-1722435959776.png

 

 

I've been tasked with simplifying these beds, to show a continuous plant bed edge, regardless of planting segments.

 

I'm attempting to use Boundry and have had some luck.

 

im using exoffset to overlap the segments before using boundry, but the issue im running in to is exoffset doesnt work on closed polylines that overlap themselves, and boundry doesnt work consistently on large selections.

 

am I over complicating this? there must be a way to manipulate tolerances for the Boundry command. In this example, each planting segment is separated 6" off of the adjacent segment. but it isn't quite uniform. if i could just set a 1' tolerance I could wrap all these pretty easily into each landscape bed through the whole community all at once.... 

 

Any help would be appreciated tremendously... 

0 Likes
Accepted solutions (2)
2,009 Views
20 Replies
Replies (20)
Message 2 of 21

Terence3YCFB
Participant
Participant

I hope I'm not over explaining... I'm just trying to turn each group of Landscape Plantings into one large Landscape bed without having to draw and form a polyline around them... it would save me hours every day.

0 Likes
Message 3 of 21

Sea-Haven
Mentor
Mentor

There is a create boundary software out there, which may do what you want, it is not free. Trying to find it again.

 

Maybe try Outline Objects | Lee Mac Programming (lee-mac.com)

0 Likes
Message 4 of 21

ronjonp
Advisor
Advisor
Accepted solution

@Terence3YCFB  You're not over explaining. How I've done this in the past is to offset the boundaries outward, convert to region then union. It works pretty well but unfortunately in that drawing you posted many of those objects throw an error when offsetting out. Here's some code modified from this old post you can try out.

 

(defun c:foo (/ _getbiggest ad l of r r2 s s2 sp)
  ;; RJP » 2024-07-31
  (defun _getbiggest (o d / _off l r)
    (defun _off	(o d / r)
      (if (= 'list (type (setq r (vl-catch-all-apply 'vlax-invoke (list o 'offset d)))))
	r
      )
    )
    (cond ((setq r (append (_off o d) (_off o (- d))))
	   (setq l (vl-sort r '(lambda (r j) (> (vla-get-area r) (vla-get-area j)))))
	   (mapcar 'vla-delete (cdr l))
	   (car l)
	  )
    )
  )
  (cond
    ((setq s (ssget "_:L" '((0 . "lwpolyline") (8 . "*LP-SHAR-BRDR-CONT") (-4 . "&=") (70 . 1))))
     (foreach e	(vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
       (and (setq of (_getbiggest (vlax-ename->vla-object e) 7)) (setq r (cons of r)))
     )
     (setq l "PlantBoundary")
     (setq sp (vla-get-modelspace (setq ad (vla-get-activedocument (vlax-get-acad-object)))))
     (vla-add (vla-get-layers ad) "PlantBoundary")
     (setq r2 (vlax-invoke sp 'addregion r))
     (mapcar 'vla-delete r)
     (setq s2 (ssadd))
     (foreach x r2 (vla-put-layer x l) (ssadd (vlax-vla-object->ename x) s2))
     (setvar 'cmdecho 0)
     (command "_.union" s2 "")
     (setvar 'cmdecho 1)
    )
  )
  (princ)
)

 

2024-07-31_16-47-43.gif

 

Message 5 of 21

Kent1Cooper
Consultant
Consultant
Accepted solution

@ronjonp wrote:

.... How I've done this in the past is to offset the boundaries, extrude outward, convert to region then union. ... many of those objects throw an error when extruding out. .....


[Should be offset instead of extrude, just so as not to get confused with what AutoCAD means by the word/command EXTRUDE, which is something quite different.]

Kent Cooper, AIA
Message 6 of 21

ronjonp
Advisor
Advisor

@Kent1Cooper wrote:

@ronjonp wrote:

.... How I've done this in the past is to offset the boundaries, extrude outward, convert to region then union. ... many of those objects throw an error when extruding out. .....


[Should be offset instead of extrude, just so as not to get confused with what AutoCAD means by the word/command EXTRUDE, which is something quite different.]


Oops .. changed above. Words incorrect code correct 🙂

0 Likes
Message 7 of 21

john.uhden
Mentor
Mentor

@Terence3YCFB ,

Are the "planting sections" depicted by the various hatch patterns?  Did you have to draw the polylines around the hatch boundaries?

Might you be able to use the -HATCHEDIT command to recreate the hatch boundaries?

OR, I don't know if vanilla AutoCAD or other verticals have it, but Civil3D has a SHRINKWRAP command to draw an exact boundary around a collection of objects.

OR, if the planting plan is outsourced then can't the provider include the hatch boundaries in what he delivers?  He had to have had them.

Oh, and what's wrong with the hatches anyway?  I especially liked that reverse curvy one.

Also, if their hatch boundaries don't touch or cross themselves (whether they are drawn or not), then the hatches have the area property, if you need that.

John F. Uhden

0 Likes
Message 8 of 21

john.uhden
Mentor
Mentor

@ronjonp ,

Please excuse my brain fart, but why do you need to offset?

John F. Uhden

0 Likes
Message 9 of 21

ronjonp
Advisor
Advisor

@john.uhden 

The example boundaries are not close enough together to union together to make an outer boundary so they need to be a little bit bigger for it to work. 

 

@Kent1Cooper Is the official librarian for this forum with his expert contribution. 

Message 10 of 21

john.uhden
Mentor
Mentor

@ronjonp ,

"union" doesn't look/sound correct as a verb, mainly because it's a noun. 🤔

 I think the correct verb should be "unite." 👫

John F. Uhden

0 Likes
Message 11 of 21

ronjonp
Advisor
Advisor

@john.uhden wrote:

@ronjonp ,

"union" doesn't look/sound correct as a verb, mainly because it's a noun. 🤔

 I think the correct verb should be "unite." 👫


My code is concise and I try to describe it as well as I can.

TBH those previous messages are from my phone and a bit Google-fied. Shall we move on? 😉

0 Likes
Message 12 of 21

john.uhden
Mentor
Mentor

@ronjonp wrote, "Shall we move on?"

Sure, which way are we headed?

I've been trying an approach to find the boundary around a set of random objects.

Using boundingbox on each of the selected objects, I derive the Xmin, Ymin, Xmax, and Ymax of the entire set, then create a circle at the midpoint of the opposite corners with a diameter equal to the greater of (- Xmax Xmin) and (- Ymax Ymin).  Then, working around the circle one degree at a time, I (ssget "_F" circle to center) and ssnamex to find the closest intersection point, and then connect them all into one polyline.

But it's not working as suspected.  From my recent experiences I though that selecting by fence returned an order of the closest point first, so that all you had to do was get the intersection point from (ssnamex ss 0).  But that's not apparently working, so I may have to test each point to find which is closest to the circle.

 

John F. Uhden

0 Likes
Message 13 of 21

john.uhden
Mentor
Mentor

Forget it.  The approach does not work well enough, even after correcting mistakes.

John F. Uhden

0 Likes
Message 14 of 21

ronjonp
Advisor
Advisor

@john.uhden 

I tried a variation of my code that offsets inward then uses that object to offset out 2x the distance. It fixes the problem using the command offset but with vla-offset POOF. Unwind exception and CAD explodes.😂

2024-08-03_12-14-08.gif

 

Some of those boundaries have many duplicated sections. IMO .. garbage in garbage out.

ronjonp_1-1722708992842.png

 

Message 15 of 21

john.uhden
Mentor
Mentor

@ronjonp ,

I may have come with an alternate solution:

  1. Create a circle that surrounds the extents of all the polylines.
  2. Hatch (non-associative) by just picking a point inside the circle but outside all the polylines.
  3. Use -HATCHEDIT to (re)create the boundaries.
  4. Delete the hatch and the circle and its boundary.
  5. What's left inside should be the polyline wanted that wraps around the originals.

I can't test it because I have only 2002 without the additional hatch editing options.

John F. Uhden

0 Likes
Message 16 of 21

Kent1Cooper
Consultant
Consultant

@john.uhden wrote:

....

Using boundingbox on each of the selected objects, I derive the Xmin, Ymin, Xmax, and Ymax of the entire set, then create a circle at the midpoint of the opposite corners with a diameter equal to the greater of (- Xmax Xmin) and (- Ymax Ymin).  ....


I think that's your problem [or at least one of them]:

Kent1Cooper_0-1722875931063.png

The objects are red, their individual bounding boxes are yellow, the collective bounding box is green, and the Circle as you describe it is white, which doesn't enclose everything.

Should not the Circle be from the middle of it all with not a diameter of the larger dimension of the overall bounding box, but rather with a radius from the middle to a corner of the overall bounding box?

Kent Cooper, AIA
0 Likes
Message 17 of 21

Kent1Cooper
Consultant
Consultant

@ronjonp wrote:

I tried a variation of my code that offsets inward then uses that object to offset out 2x the distance. ....


There's something of a danger there, in the possibility of an original shaped such that Offsetting it inward will result in more than one object.  White original, approaching itself closely enough in relation to the Offset distance that it makes two resulting Polylines [yellow]:

Kent1Cooper_1-1722880492576.png

So if a routine Offsets that inward and goes to then Offset the last object twice as far in the other direction, it will get only one of them [red result].  But Offsetting outward directly gets what's wanted [green].

Kent Cooper, AIA
Message 18 of 21

ronjonp
Advisor
Advisor

@Kent1Cooper Yes that could happen. In the example drawing and using an offset distance of 7 it was not a problem that I could see.  TBH I did not look too closely though. My original code posted takes care of multiple offset items and the OP seems to be satisfied.

Message 19 of 21

Terence3YCFB
Participant
Participant

"Garbage in garbage out" 

 

My thoughts exactly. Im honestly sick of some Landscape architects pumping out terrible work and getting paid 4 times what i make 😂

0 Likes
Message 20 of 21

ronjonp
Advisor
Advisor

@Terence3YCFB wrote:

"Garbage in garbage out" 

 

My thoughts exactly. Im honestly sick of some Landscape architects pumping out terrible work and getting paid 4 times what i make 😂


@Terence3YCFB Hahaha 🙂 FWIW, I am an irrigation designer as well ( 25 years worth 😬 ).

0 Likes