Listp to calculate area at various X-coordinates or Y-coordinates

Listp to calculate area at various X-coordinates or Y-coordinates

Anonymous
Not applicable
1,737 Views
9 Replies
Message 1 of 10

Listp to calculate area at various X-coordinates or Y-coordinates

Anonymous
Not applicable

Hi All,

 

I need a lisp to calculate the areas between a line or curve and an axis at the various X-coordinates or Y-coordinates.

 

Does anyone has something like this or suggest me how to create this lisp?

 

I've attached a simple case as follows. In this example, the areas of the regions A1, A2,..., A5 is based on the Y-coordinates at the various height (interval 200mm).

 

Area.PNG

 

Many thanks for your help.

 

Khanh

0 Likes
1,738 Views
9 Replies
Replies (9)
Message 2 of 10

john.uhden
Mentor
Mentor
If the red object is a line, then the math doesn't look very difficult, but if the red object were a polyline or spline with multiple vertices and bulged segments, then the solutions could be a lot more tedious, probably requiring the use of the HATCH command to create each of the areas.

John F. Uhden

0 Likes
Message 3 of 10

SeeMSixty7
Advisor
Advisor

Essentially it is pretty easy. Build a polyline boundary from a point inside the area and then get the area of that pline.

 

 

Do you really want a lisp routine for this or are you just looking for a way to get the area?

 

If you just want to know how, erase your hatch lines. Then use bpoly command and pick a point inside the area. You will then have a new pline entity. The type LIST[enter] then L[Enter] for last entity and then enter again and you will see the are of the pline.

 

You could automate the same process with a lisp routine, either via user selected points, or via a point list coded into the lisp routine or by selecting entities in the drawing.

 

Good luck

 

Message 4 of 10

john.uhden
Mentor
Mentor
That's what I was trying to say. <G>

John F. Uhden

Message 5 of 10

Anonymous
Not applicable

Bạn phải nói rõ hơn chứ nói thế thì mọi người cũng chỉ góp ý chung chung thế thôi 🙂

0 Likes
Message 6 of 10

john.uhden
Mentor
Mentor
Translated to English, does that mean "A wet bird never flies at night?"

John F. Uhden

0 Likes
Message 7 of 10

Anonymous
Not applicable

Hi John, 🙂

 

I mean: including more detailed for him idea then someone can help.

 

Sorry. I don't mean  "A wet bird never flies at night?" if i understand your idioms from scripture.

 

^_^

0 Likes
Message 8 of 10

Anonymous
Not applicable
Hi,

Many thanks for your help.

Do you have any related lisp available?

Thanks.
Khanh
0 Likes
Message 9 of 10

SeeMSixty7
Advisor
Advisor
Try something like this:


(defun c:QGA() ;Quick Get Area
(setq qgaPoint (getpoint "\nSelect Point inside Area:"))
(if qgapoint
(progn
(setq currlastent (entlast))
(command "BPOLY" qgapoint "")
(setq newlastent (entlast))
(if (equal currlastent newlastent)
(princ "\nFailed to generate Boundry Polyline")
(progn
(setq qga-plobject (vlax-ename->vla-object newlastent)
qga-area (vla-get-area qga-plobject)
qga-Output (strcat "\nAREA:" (rtos qga-area 2 4))
)
(entdel newlastent)
(princ qga-Output)
)
)
)
(princ "\nPoint not Valid")
)
(princ)
) Good luck
0 Likes
Message 10 of 10

Anonymous
Not applicable

Hi SeeMSixty7,

 

Many Thanks for your lisp.

 

I will try and let you know the result soon.

 

Cheers.

Khanh

0 Likes