Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Close

.NET

- Autodesk Community
- >
- AutoCAD Customization
- >
- .NET
- >
- Re: How to find the intersection of a two lines.

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

495 Views, 6 Replies

06-20-2012 02:52 PM

I'm trying to write a command that breaks polylines / lines along a polyline. Is there any way to

A. Find all intersection points of two polylines?

B. Break the polyline at points gained previously?

Any help is appreciated, but keep in mind these are polylines with 30k+ vertices... so try to tailor a response around speed if possible.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-20-2012 03:46 PM in reply to:
joshua.prettyman

yes.

You rotate both lines so one is vertical, then see if horizontal one has x values surrounding the vertical one.

Other approaches work too, but in real programs you must also deal with a really close intersection, where mayeb there is a gap of .0000001 and you wantb to consider that an intersection.

Then my approach works.

I've written this for arcs too, so anything can chop anything.

Arcs are not trivial, though you can use acad's api to cut the corner of doing your own code...

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-20-2012 04:01 PM in reply to:
joshua.prettyman

Hi,

Did you try IntersectWith method ?

SomePolyLine.IntersectWith(OtherPolyline, Intersect.ExtendThis/OrNot, PointCollectionVariable, New IntPtr(0), New IntPtr(0))

Gaston Nunez

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-21-2012 12:00 AM in reply to:
joshua.prettyman

You can search for this issue here:

http://www.acadnetwork.com/board-8.0/

~'J'~

_____________________________________

C6309D9E0751D165D0934D0621DFF27919

C6309D9E0751D165D0934D0621DFF27919

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-23-2012 11:01 AM in reply to:
joshua.prettyman

another suggestion, you could use each poly's vertices to form a geometry curve and use those pairwise to form a curvecurveintersector object which can return intersections as doubles/points, which in turn you could use as a collection parameter in the getsplitcurves method of the original poly*. whether it's worth the trouble may to depend on how many intersections you expect, and whether it is certain that there actually is an intersection between any two polys

*i'm wary though of how reliable it is to 'carry' intersections over from geometry to database curve, so you'd have to stick to the geometry curve for the splits, which means you'd need a final conversion back into polys (if that's what you need after all)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-24-2012 12:29 AM in reply to:
joshua.prettyman

In the end, you must compare each segment to each segment, that does not scale well unfortunately. So you must weed out segments whose bounding box do not cross the compare sets box. Its not trivial, but has a huge speed advantage. I did this for a program that finds all closed shapes formed by any set of lines and arcs. Plines included. The box compare is a must.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-24-2012 12:30 AM in reply to:
joshua.prettyman

Acadnetwork.com? That is fishy, needs my email to just view posts?

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements

If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Start with some of our most frequented solutions to get help installing your software.

Upgrading to a 2015 product? Make sure to check these out 1st!

- Privacy | Legal Notices & Trademarks | Report Noncompliance | Site map | © Copyright 2014 Autodesk Inc. All rights reserved

Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Please see the Autodesk Creative Commons FAQ for more information.