Calculating areas of two Plines

Calculating areas of two Plines

alexandre_benekowski
Advocate Advocate
1,113 Views
4 Replies
Message 1 of 5

Calculating areas of two Plines

alexandre_benekowski
Advocate
Advocate

Hi people,

 

Is possible to calculate area of two diferents plines by just select then ? someone could give me ideas of how to create it?

 

I create an autlisp that calculate areas but I have to click (lisp by boundary)

 

Sem título.jpg

 

anyway, thank you!!!

 

Att.

 

 

 

0 Likes
Accepted solutions (1)
1,114 Views
4 Replies
Replies (4)
Message 2 of 5

john.uhden
Mentor
Mentor

Just a rough answer (no error or undo or cmdecho or formatting of output or deletion of boundary polyline or even checking to see that a boundary polyline was created).

 

(defun c:polyarea ( / p area)
  (and
     (setq p (getpoint "\nPick point inside two polylines: "))
     (vl-cmdf "-boundary" p "")
     (vl-cmdf "_.area" "e" (entlast))
     (setq area (getvar "area"))
  )
  area
)

But we can spice all that up if you have troubles with that.

John F. Uhden

Message 3 of 5

alexandre_benekowski
Advocate
Advocate

Hello People!!!

 

Someone help me please!!!!!!!  Smiley Indifferent Smiley Sad

 

I created a lisp (by boundary) but I´d like to create one that just need to select differents plines and it gives me value area.

 

Sem título.jpg

 

0 Likes
Message 4 of 5

Kent1Cooper
Consultant
Consultant
Accepted solution

@alexandre_benekowski wrote:

.... I´d like to create one that just need to select differents plines and it gives me value area.


If you mean that you want the area bounded between them, the same as what you get from your BOUNDARY result, I doubt that's possible from a mere selection of them, especially given that at least one of them extends beyond the boundary of that area.

 

If they always meet at their ends [i.e. without either one extending beyond as in your images], and in a way such as in the left side of this image:

Areas.PNG

then you could do it.  AutoCAD can find an area for each as if they were closed along the straight line [dashed gray] between their open ends, and add them.  But if either would ever cross that line, as in the right side, that will throw off the result.  The "area" of the magenta Polyline is that of all three triangles bounded by it and the dashed gray line, so its area overlaps the yellow one's area, and the result will be more than that enclosed by the two Polylines.

 

The areas of your Polylines will include consideration of the far end of the extension beyond the area you want, so what AutoCAD can determine of their individual areas won't work for your purpose.  It might be possible to do some shenanigans to evaluate whether [for example] a Polyline's start or end point doesn't lie on the other Polyline, but if both of them extend off to the right end there and overlap, it won't know to exclude those end segments from consideration, or if there might be more than one vertex outboard of the area you want, or ... it all gets very complicated very fast.  If that can somehow be overcome, it might be possible to build a sequence of points to use in an AREA command, but it would have to somehow figure out whether they were drawn in the same or opposite general directions, and ... more daunting complications.  And they get yet more complicated if the places where the two do meet might not always be at vertices on both of them, but they might sometimes cross in mid-segment.  Or, if either might ever include any arc segments, an AREA command using their vertices can't give the right result.

 

It might be possible to have it do the Boundary command for you, and get the area of the result, but the daunting complication there is for a routine to calculate a point to "pick" that is guaranteed to be within that area, just from what it knows about the two Polylines.  That's a complex enough thing to do for a single closed Polyline [do some Searching, and you'll see], but infinitely more so in a situation like your image.

Kent Cooper, AIA
Message 5 of 5

john.uhden
Mentor
Mentor

@Kent1Cooper knows about what he is talking.  How about if you just accept the solution you were provided?

John F. Uhden

0 Likes