Author Topic: Area of Intersection between two LW Polylines  (Read 2455 times)

0 Members and 1 Guest are viewing this topic.

mailmaverick

  • Bull Frog
  • Posts: 495
Area of Intersection between two LW Polylines
« on: January 31, 2020, 12:36:19 PM »
Hi,
I have searched a lot on the internet but to no success. I have two closed LWpoylines which intersect each other. I want to find out the area of their intersection region. Many LISPS on internet suggest by creating -BPOLY, or by creating Regions and then finding out their intersection area but these solutions cause entity formation and deletion which I want to avoid.
Is is possible programatically / mathematically using LISP / V-LISP ?
Thanks.

jvillarreal

  • Bull Frog
  • Posts: 332
Re: Area of Intersection between two LW Polylines
« Reply #1 on: January 31, 2020, 03:17:55 PM »
Should be possible..Using a trace function on the intersecting segments and applying the resulting point list to the area command is the first thing that comes to mind.

mailmaverick

  • Bull Frog
  • Posts: 495
Re: Area of Intersection between two LW Polylines
« Reply #2 on: January 31, 2020, 10:20:36 PM »
Hi,

Thanks for your reply. Can you help me with some sample code.

Rustabout

  • Newt
  • Posts: 135
Re: Area of Intersection between two LW Polylines
« Reply #3 on: January 31, 2020, 11:09:21 PM »
You could start with Lee Mac's intersection functions:

http://www.lee-mac.com/intersectionfunctions.html

I was hoping I would be able to help because I am working extensively with polylines at the moment. But running the solution through my head (even just one beverage into my Friday evening) proved a bit too much.

jvillarreal

  • Bull Frog
  • Posts: 332
Re: Area of Intersection between two LW Polylines
« Reply #4 on: February 01, 2020, 03:13:14 PM »
Unfortunately, i'll be too busy with work and school until Tuesday evening.

If you want psuedo-code, the way i'd probably tackle it is:
1. Select polylines
2. Determine if direction is clockwise.
3. Create Point Lists using trace function, if polyline direction is counter clockwise, reverse point list.
4. Create Intersection Point List
5. Cycle between polyline point lists to gather traced points from intersection to intersection -
--building a point list for the area command. (Order for cycling would be determined by position of polylines)
6. Pass final point list to area command transparently.

I can help you get started Tuesday, after class, if you're still working on it.



BIGAL

  • Swamp Rat
  • Posts: 1429
  • 40 + years of using Autocad
Re: Area of Intersection between two LW Polylines
« Reply #5 on: February 01, 2020, 10:33:50 PM »
I really dont understand using a 1 line solution Bpoly then erase it. Or is it that you can not pick point ie want a auto for multiple pairs of plines ?
A man who never made a mistake never made anything

mailmaverick

  • Bull Frog
  • Posts: 495
Re: Area of Intersection between two LW Polylines
« Reply #6 on: February 02, 2020, 02:14:27 AM »
I really dont understand using a 1 line solution Bpoly then erase it. Or is it that you can not pick point ie want a auto for multiple pairs of plines ?
The closed polylines are of irregular shape and for creating a BPOLY, we must give a point inside the common area. But problem is to find out a point inside the intersection area. Refer image attached.

Dlanor

  • Bull Frog
  • Posts: 263
Re: Area of Intersection between two LW Polylines
« Reply #7 on: February 02, 2020, 05:09:09 AM »
If they are two closed polylines then make two regions from the polylines and use the intersect command on the regions

jvillarreal

  • Bull Frog
  • Posts: 332
Re: Area of Intersection between two LW Polylines
« Reply #8 on: February 24, 2020, 10:49:43 AM »
I had some time to experiment this morning and wanted to give this a shot; preliminary code is attached.
Selected objects must be clockwise. I left Lee Mac's clockwise test function in case anyone wanted to incorporate it.
Resulting points are passed to the area command without ending the command to allow a preview.