Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

polyline selection

1 REPLY 1
Reply
Message 1 of 2
Anonymous
496 Views, 1 Reply

polyline selection

Using visual lisp how can I find if two polylines intersect and have a common area.

Thanks.
1 REPLY 1
Message 2 of 2
Kent1Cooper
in reply to: Anonymous

For *any* object type(s), with obj1 and obj2 being their entity names, if they are in the same plane, this will tell whether they intersect:

{code}
(if
(safearray-value
(variant-value
(vla-intersectwith
(vlax-ename->vla-object obj1)
(vlax-ename->vla-object obj2)
acExtendNone
); end vla-intersectwith
); end variant-value
); end safearray-value
(alert "\nObjects intersect."); then
(alert "\nObjects do not intersect."); else
); end if
{code}

However, that will also say that they intersect if they only *touch* each other, without any overlapping area.

If the return of (safearray-value) contains three numbers, representing the XYZ coordinates of one intersecting point, then if the objects are closed Polylines, they only touch, most likely at a common vertex, but do not have a common area.

But even if that returns more than three numbers, representing multiple intersection points, it doesn't necessarily mean that they overlap; they could have coincident edges without any overlapping area. It may well be possible, though I think it would be complicated, to determine whether there is any actual overlap.

Also, if one is completely inside the other, without touching it, the above would say they do not intersect, but would not know that they have a common area.

--
Kent Cooper


salman_nsr wrote...
....how can I find if two polylines intersect and have a common area.
Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report