Programmically find all the quadrant points of a polyline

Programmically find all the quadrant points of a polyline

dennis
Advisor Advisor
2,960 Views
22 Replies
Message 1 of 23

Programmically find all the quadrant points of a polyline

dennis
Advisor
Advisor

Scenario: given a spiral as a polyline made up of curves.  I need to find all the quadrant points of that spiral.  Specifically, I need the 'outside' quadrants so I was trying to first build a bounding box, then use vlax-invoke 'intersection.  However, either the bounding box or the 'intersect is not precise enough.  I am finding the lines making up the bounding box are off by e0.000x value so that the intersection isn't found.  Is there a fuzz that could be applied to the 'intersect?

Any other ideas would be appreciated.

0 Likes
Accepted solutions (1)
2,961 Views
22 Replies
Replies (22)
Message 21 of 23

Kent1Cooper
Consultant
Consultant

Kent1Cooper wrote:

....

2) Step through the Polyline, if a spiral like the one in the image is made of relatively few comparatively long arc segments, at a parameter value increment of, say, every .25 ..., and apply (osnap ...thatpoint... "_qua") at each one.  That will return a quadrant point for any segment that includes one, including potentially multiple returns of the same point.  With longer segments there's the possibility that one segment might include more than one quadrant point, which is why you should Osnap at multiple locations along each segment.  ....

3) Eliminate the duplicates, if any, ....


Since the Post-1 concept of finding only those quadrants that lie at the extremes [on the bounding box edges] seems to have disappeared, attached is the way I would do this, taking the approach above, part of Post 4 [without the only-the-extremes elements].

 

It's shorter than what you've come up with, even though:
1)  it will identify quadrant point on not only a Polyline, but also a Circle, Arc or Ellipse;

2)  it includes error handling;

3)  it includes Undo begin/end "wrapping;"

4)  it notifies you if you pick something that can't have quadrant points [or if you miss... maybe I should change the wording].

 

It puts the locations into a 'quadlist' variable that is not localized, so you can use the results in something else afterwards, if you want [for instance, compare them to the bounding box to identify those at the extremes].  For that reason, it does one object, but if you don't need that list, but only the markers, it could easily be altered to accept selection of multiple objects to mark all at once.

 

It does not need to create any temporary objects that then need to be deleted.

 

I chose to mark the quadrants with Points, rather than drawing Lines from 0,0 to each, though there's an alternative in it to do such Lines instead, if you prefer.

 

There are also some things indicated that can be omitted if you want only to mark the quadrants, and don't need the list retained, or vice versa.

Kent Cooper, AIA
0 Likes
Message 22 of 23

john.uhden
Mentor
Mentor

I just couldn't resist trying my own medicine.

 

Attached is GetQuads.lsp for you and others to try out, but there are two (2) annoying things...

 

1.  It does not repeat on the 2nd (or later) objects in the selection set.

2.  Running it a second time causes an elockviolation (I think because of using entmakex).

 

I have only vanilla 2002 installed, and my motherboard is going, but I would love to know what I am doing wrong or what else the cause is.

John F. Uhden

0 Likes
Message 23 of 23

john.uhden
Mentor
Mentor

Dennis:

 

I have been struggling with oddities in a GetQuads.lsp routine.  It would not repeat for selections sets > 1 object., and it would often result in an elockviolation, whatever that is, when run again or an Undo or erasing the "Quads" lines.

 

Attached is GetQuads2.lsp which seems to work well except for the potential elockviolation.  I hope it's due only to my 2002 installation.

 

Apparently the repeat failure was due to using vla-objects, but I'm not sure.  So I reverted to using entities except for one call.

 

I hope you get some value out of it.

John F. Uhden