Author Topic: Overlapping area 2 closed lwpolylines  (Read 4716 times)

0 Members and 1 Guest are viewing this topic.

Peter Guappa

  • Guest
Overlapping area 2 closed lwpolylines
« on: April 19, 2013, 02:31:28 PM »
Starting with 2 closed lwpolylines (partially overlapping), I'm looking for a solution (lisp) to calculate/create a third polyline which is the boundary of the overlapping area.

The 2 starting polylines have no bulges, only lines.

Can somebody help me out?


Thanks!!!

TheMaster

  • Guest
Re: Overlapping area 2 closed lwpolylines
« Reply #1 on: April 19, 2013, 03:04:57 PM »
Starting with 2 closed lwpolylines (partially overlapping), I'm looking for a solution (lisp) to calculate/create a third polyline which is the boundary of the overlapping area.

The 2 starting polylines have no bulges, only lines.

Can somebody help me out?


Thanks!!!

Unless I'm missing something, the solution seems very straightforward.

Create a region from each of the two polylines, then use the INTERSECT command to obtain the intersection, explode the resulting region and create a new polyline from the exploded lines.

Peter Guappa

  • Guest
Re: Overlapping area 2 closed lwpolylines
« Reply #2 on: April 19, 2013, 03:56:49 PM »
Thanks, I will give it a try

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Overlapping area 2 closed lwpolylines
« Reply #3 on: April 19, 2013, 04:11:13 PM »
Use the command boundary and pick a point in the center of the tow polylines :)


irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Overlapping area 2 closed lwpolylines
« Reply #4 on: April 19, 2013, 04:14:43 PM »
Create a region from each of the two polylines, then use the INTERSECT command to obtain the intersection, explode the resulting region and create a new polyline from the exploded lines.
You might want to set the DelObj (http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS1a9193826455f5ffa23ce210c4a30acaf-6877.htm,topicNumber=d0e95128) system variable to 0 before running the Region command. That way your original polylines are left as is.

Also, if you're only after the area of the intersection, then the region object also has an area property - you need not explode it and convert to another polyline.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Overlapping area 2 closed lwpolylines
« Reply #5 on: April 19, 2013, 04:33:11 PM »
Hi,

Maybe you can get some inspiration this thread (a LISP implementation in reply #3).
It uses the method puposed by Tony for a different task (unioning region instead of intersecting them), but you can adapt it to your suit replacing acUnion with acIntersection.
Speaking English as a French Frog

Peter Guappa

  • Guest
Re: Overlapping area 2 closed lwpolylines
« Reply #6 on: April 19, 2013, 04:45:33 PM »
Thank you all!
Enough info to get me started and reach my goal.
Cheers

TheMaster

  • Guest
Re: Overlapping area 2 closed lwpolylines
« Reply #7 on: April 20, 2013, 03:04:36 PM »
You might want to set the DelObj (http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS1a9193826455f5ffa23ce210c4a30acaf-6877.htm,topicNumber=d0e95128) system variable to 0 before running the Region command. That way your original polylines are left as is.

Also, if you're only after the area of the intersection, then the region object also has an area property - you need not explode it and convert to another polyline.

If the OP needs the original polylines,
Code: [Select]
(if (not (entget <pline>)) (entdel <pline>)) will undelete them without the added burden of having to change/save/restore another sysvar.

« Last Edit: April 20, 2013, 03:15:09 PM by TT »

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Overlapping area 2 closed lwpolylines
« Reply #8 on: April 20, 2013, 05:13:03 PM »
Good point Tony! No need for error handling to reset the var back.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Overlapping area 2 closed lwpolylines
« Reply #9 on: April 20, 2013, 06:10:31 PM »
You might want to set the DelObj system variable to 0 before running the Region command.

Alternatively you could use the ActiveX addregion method, followed by the boolean method whilst retaining all original objects.

mianbaoche

  • Guest
Re: Overlapping area 2 closed lwpolylines
« Reply #10 on: August 06, 2015, 11:56:02 AM »
Do not want to use ActiveX addregion method the。

I try to complete his?

I hope to have a better algorithm!
« Last Edit: August 06, 2015, 08:57:43 PM by Q1241274614 »

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Overlapping area 2 closed lwpolylines
« Reply #11 on: August 06, 2015, 12:37:57 PM »
Do not want to use ActiveX addregion method the。
Why not ? :lol:

catoscuro

  • Mosquito
  • Posts: 4
Re: Overlapping area 2 closed lwpolylines
« Reply #12 on: August 08, 2015, 03:03:03 AM »
use bpoly