element to lwpolylines

element to lwpolylines

Anonymous
Not applicable
381 Views
5 Replies
Message 1 of 6

element to lwpolylines

Anonymous
Not applicable
Please,
VBA autocad 2004
I have in my "SelectionSet" a group of line,arcs, lwpolylines,
how can I obtein from then only one lwpolyline with VBA code?

Can anyone help me?
thankyou
0 Likes
382 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
this is my first ever reply to a question as I have been learning, so I hope
it works, and I am sure there is probably a much easier way to do it

After the selection set has been created, iterate through the entities.

Dim oEntity as AcadEntity

For Each oEntity in SelectionSet
If TypeOf oEntity Is AcadLWPolyline Then

End If
Next oEntity

Hope this helps

wrote in message news:[email protected]...
Please,
VBA autocad 2004
I have in my "SelectionSet" a group of line,arcs, lwpolylines,
how can I obtein from then only one lwpolyline with VBA code?

Can anyone help me?
thankyou
0 Likes
Message 3 of 6

Anonymous
Not applicable
Thanks for the answer BrentB,
but as I can transform linens in lwpolyline
and arc in lwpolyline
and therefore to assemble the all in one single lwpolyline?
0 Likes
Message 4 of 6

Anonymous
Not applicable
Hi,

It can be done, but you will need to find the start and end points of each
of the objects you select and then match the various objects so that you can
find which joins to which.

You can then create an array of coordinates of the joining points from which
to define the new polyline. You also need to keep track of which items are
arcs, so that you can add the bulges to the polyline after you have created
it.

You also need to decide how you will treat gaps if you find two objects
which nearly meet, but not quite.

You also need to decide what you will do if three or more objects meet as a
point

You also need to decide if you wish to delete - or keep the original
objects. While coding, I'd keep them for comparison purposes. When it all
works, it up to you what you do with them.

--

Regards,


Laurie Comerford
www.cadapps.com.au


wrote in message news:[email protected]...
Thanks for the answer BrentB,
but as I can transform linens in lwpolyline
and arc in lwpolyline
and therefore to assemble the all in one single lwpolyline?
0 Likes
Message 5 of 6

Anonymous
Not applicable
Thanks thousands of the Laurie answer,
are what I feared, but,
- if the objects in the selection list are already order to you,
- if they do not have discontinuity,
- if they do not concur more in the same point than two objects,
the possibility does not exist to adopt a method similar to those
"Linens to LWPolyLine"
Posted by: Nadotti, Paolo
Given: Jan/03/02 - 06:21 (GMT)
transforming then the SPLINE in LWPOLYLINE?

Gianni
0 Likes
Message 6 of 6

Anonymous
Not applicable
Hi,

If that is the case
AND the lines / arcs etc are drawn in the correct direction so you don't
need to check that, then

You can have code like this pseudo code:
dim pCoords() as double
redim pCoords(0 to SelectionSet.Count * 4 -1)
i = 0
for each object in SelectionSet
if typeof object is LINE then
set oLine = object
vPt = oLine.start
pCoords (i) = vP(0)
pCoords (i + 1) = vP(1)
i = i + 2
vPt = oLine.end
pCoords (i) = vP(0)
pCoords (i + 1) = vP(1)
i = i + 2
elseif typeof object is ARC then
set oArc = object
vPt = oArc .start
pCoords (i) = vP(0)
pCoords (i + 1) = vP(1)
i = i + 2
vPt = oArc .end
pCoords (i) = vP(0)
pCoords (i + 1) = vP(1)
i = i + 2
elseif typeof object is LWPolyline
......
end if

--

Regards,


Laurie Comerford
www.cadapps.com.au

wrote in message news:[email protected]...
Thanks thousands of the Laurie answer,
are what I feared, but,
- if the objects in the selection list are already order to you,
- if they do not have discontinuity,
- if they do not concur more in the same point than two objects,
the possibility does not exist to adopt a method similar to those
"Linens to LWPolyLine"
Posted by: Nadotti, Paolo
Given: Jan/03/02 - 06:21 (GMT)
transforming then the SPLINE in LWPOLYLINE?

Gianni
0 Likes