Inserting Pline Verticies

Inserting Pline Verticies

Anonymous
Not applicable
210 Views
6 Replies
Message 1 of 7

Inserting Pline Verticies

Anonymous
Not applicable
I have encountered a stumbling block on a project I am working on. I have a
series of lwplines which form polygons. I need to be able to draw a pline
over these polygons, with vertices being automatically inserted where my
overlay pline intersects a polygon. It doesn't matter if these intersection
vertices are inserted while the line is being drawn or afterwards. Having
the user use OSNAP while drawing the overlay pline isn't an option

I don't know of any routine that will do this automatically. Does anyone
have any suggestions about existing routines or how to go about this in VBA?
I am using ACAD 2000/LDD 2 and am fairly new to VBA.

Thanks,
Ursula Dillon
0 Likes
211 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
You can use the IntersectWith method to determine where your new pline
intersects your polygon:
iPts = pline.IntersectWith(polygon, acExtendNone)

iPts will contain three doubles for every intersection (if any). You can
take the first two out of each set of three and use them to construct a 2D
point which you then use as the vertex argument to the AddVertex. The one
part you'll have to have to keep a close eye on is the Index argument.
You'll have to determine what two existing vertices your new vertex will
fall between.

Here's an idea: use a loop and starting with the first vertex N, check to
see if your intersection point lies on a line drawn between vertex N to
vertex N +1. If not, increment N by 1 and repeat. When you find the
intersection, N + 1 is the index you feed to AddVertex along with your
point.

One potential snag: I'm not sure what effect working in a coordinate system
other than the WCS would have on this method. Since all the points we're
dealing with are WCS coordinates, I'd like to say none but I simply don't
know. Hope this helps.

--
Visit AcadXtreme for a chance to win a copy of AutoCAD LT 2000
Contest ends 5/26/00
http://www2.stonemedia.com/franko

"ud" <4ud@qlink.queensu.ca> wrote in message
news:ef071ec.-1@WebX.SaUCah8kaAW...
>
> I have encountered a stumbling block on a project I am working on. I have
a
> series of lwplines which form polygons. I need to be able to draw a
pline
> over these polygons, with vertices being automatically inserted where my
> overlay pline intersects a polygon. It doesn't matter if these
intersection
> vertices are inserted while the line is being drawn or afterwards.
Having
> the user use OSNAP while drawing the overlay pline isn't an option
>
> I don't know of any routine that will do this automatically. Does anyone
> have any suggestions about existing routines or how to go about this in
VBA?
> I am using ACAD 2000/LDD 2 and am fairly new to VBA.
>
> Thanks,
> Ursula Dillon
>
0 Likes
Message 3 of 7

Anonymous
Not applicable
BTW, my method of checking for intersections makes no allowances for bulges.

--
Visit AcadXtreme for a chance to win a copy of AutoCAD LT 2000
Contest ends 5/26/00
http://www2.stonemedia.com/franko
0 Likes
Message 4 of 7

Anonymous
Not applicable
Instead of following along with the kludge-o-rama that
Frank is proposing (which will not work, because Frank
forgot one important thing relating to the way the
IntersectWith() method works), post an example drawing
showing exactly what you want, and I will show you how
to do it. You have to treat the polyine that is to have
vertices inserted as a curve, and you must sort the
points of intersection by their distance from the start
of the polyline. There's several ways to do that, and
how complicated it will be will depend on whether your
polyline has curved segments.

My AcadX(TM) server has all of the methods needed to
accomplish what you want with only a few lines of VBA
code (curved segments or not), without it, you will
need to use Bozo hacks (calling Visual LISP from VBA),
and a lot of additional VBA code to do the required
sorting of the points returned by IntersectWith().

ud wrote:
>
> I have encountered a stumbling block on a project I am working on. I have a
> series of lwplines which form polygons. I need to be able to draw a pline
> over these polygons, with vertices being automatically inserted where my
> overlay pline intersects a polygon. It doesn't matter if these intersection
> vertices are inserted while the line is being drawn or afterwards. Having
> the user use OSNAP while drawing the overlay pline isn't an option
>
> I don't know of any routine that will do this automatically. Does anyone
> have any suggestions about existing routines or how to go about this in VBA?
> I am using ACAD 2000/LDD 2 and am fairly new to VBA.
>
> Thanks,
> Ursula Dillon

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://www.caddzone.com */
/*********************************************************/
0 Likes
Message 5 of 7

Anonymous
Not applicable
I've attached a simple drawing (test.dwg) to help show what I want to do. I
want to insert a new vertex on any white pline that is crossed by the red
pline. The hope is that these new vertices will be used to create closed
polylines of the intersection of the white pline boxes and the red pline
overlay. Right now I am doing this with the topology features in ACAD MAP
but am looking to simplify the process.

Thanks,
Ursula
0 Likes
Message 6 of 7

Anonymous
Not applicable
Ursula Dillon wrote:

> The hope is that these new vertices will be used to create closed
> polylines of the intersection of the white pline boxes and the red pline
> overlay.

I have to assume the ultimate goal is to breakup the boundary to write
back the appropriate chunk to each tiled sheet.

> Right now I am doing this with the topology features in ACAD MAP
> but am looking to simplify the process.

Under the Map pulldown, Tools, Boundary Break ...

1) Choose the Select Boundaries button, do a crossing on all the lines.

2) Under Objects to Break, select your red polyline.

Does an excellent job at this, and you don't need to create topologies.

But this did make an interesting tool, my results attached. The MOST
interesting part is when a 3DPOLY is processed across a selection set of
3D geometry, creating a profile.

Terry
0 Likes
Message 7 of 7

Anonymous
Not applicable
Thanks for the input Terry. I was experimenting with this method yesterday.

Ursula
0 Likes