Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Algorithm to reconstruct polyline-arcs

48 views
Skip to first unread message

Risto Mäkelä

unread,
Oct 7, 2002, 8:55:56 AM10/7/02
to
Would you mind posting your code?

Rakesh Rao <rakes...@vsnl.net> schrieb in im Newsbeitrag:
3D9BD29A...@vsnl.net...
>
> Hello,
>
> Does anyone have the algorithm to reconstruct exactly an LWPOLYLINE
> given the list of points and associated bulge factors. I have got as far
> as being able to properly reconstruct the polyline if there are no more
> than one arc segment next to each other in the polyline. If there are
> more than one arc segments, my method fails. I am not able to account
> for the bulge factors that are specified at both the start and end of
> each segment. Any pointers are appreciated.
>
> Thanks
> Rakesh
>
> --
>
> AutoCAD customization for Engineering/Mapping/GIS
> Get GeoTools @ http://www.4d-technologies.com/geotools
> Build MyGeoTools @
> http://www.4d-technologies.com/geotools/my_geotools.htm
> FREE downloads : http://www.4d-technologies.com/techcenter
>
>


John Uhden

unread,
Oct 7, 2002, 1:26:06 PM10/7/02
to
40 = start width
41 = end width
42 = bulge (positive is a curve to the left, negative is a curve to the right)

Use the same approach as you did for getting the vertices, except with 42
instead of 10.

--
John Uhden, Cadlantic/formerly CADvantage
http://www.cadlantic.com
Sea Girt, NJ


"Rakesh Rao" <rakes...@vsnl.net> wrote in message
news:3D9BD29A...@vsnl.net...

Risto Mäkelä

unread,
Oct 7, 2002, 4:37:40 PM10/7/02
to
Rakesh,

You didn't attach the function pl_getbulgelst. May we see that, too, please.

I quickly looked through it but haven't tested it yet.

Risto

Rakesh Rao <rakes...@vsnl.net> schrieb in im Newsbeitrag:

3DA1B44A...@vsnl.net...
>
> Hello,
>
> I have attached the Lisp I have written so far - ARC.LSP and a test
drawing
> ARC.DWG
>
> Let me know if you have some pointers.
>
> regards
> Rakesh

Risto Mäkelä

unread,
Oct 7, 2002, 5:12:20 PM10/7/02
to
I suddenly got a humorous thought. Rakesh, what do you need it for? I mean,
if the arched polyline already exists and you want to make a similar one but
from lines and arches, then why don't you just explode it?

Yes I read it, you said "given the list..." but your code looks as if you
just wanted a copy of it in lines and arches.

Risto


--

Risto Makela
au...@cadapter.com
Cadapter Software
http://www.cadapter.com

Rakesh Rao

unread,
Oct 10, 2002, 8:36:48 AM10/10/02
to

Hi John,

Thanks for responding. This works if there is only one arc segment followed by a
straight line segment. If there are more than one arc segments next to each other,
it somehopw fails.

I have just now posted the completed source file ARC.LSP in response to Risto's
reply.

Let me know if you have any pointers in writing the code for correctly handliing
multiple arcs, some possibly going in left or right directions and next to each
other.

Regards
Rakesh

John Uhden

unread,
Oct 10, 2002, 8:47:50 AM10/10/02
to
I think you're problem is in being consumed with all the flags. The only one to
weed out is 16 (spline control point).

--
John Uhden, Cadlantic/formerly CADvantage
http://www.cadlantic.com
Sea Girt, NJ


"Rakesh Rao" <rakes...@vsnl.net> wrote in message

news:3DA57460...@vsnl.net...

Rakesh Rao

unread,
Oct 10, 2002, 8:40:22 AM10/10/02
to

Hi Risto,

I am trying to read just one polyline info from a DXF file and reconstruct only
that in the DWG file. So, I am not starting with the polyline info but instead
have the vertices and bulge factors extracted from the DXF file and now have to
rebuild the polyline. It will be an overkill to bring the whole DXF in.

Regards
Rakesh

Risto Mäkelä

unread,
Oct 10, 2002, 11:47:26 AM10/10/02
to
Hi, Rakesh,

I took a look at your code. The problem is in your way to set the loop with
foreach of bulges. The line command doesn't get the last point since the
bulge counter is out by that. Consider laying the loop out with <while point
list length> instead and pick the bulges by nth.

Further, you should terminate the line command each time after the second
point is issued, i.e. put a (command) after it. THe arc command ends alone
but line wants to continue unless you terminate it.

I tested it with these two corrections and it did run through.

Another thing is that the bulge radius function you have doesn't return
greater than semicircle radii. If the bulge is more than pi, you get a
truncated arc. Consider remaking that, too.

Risto

--

Risto Makela
au...@cadapter.com
Cadapter Software
http://www.cadapter.com

Rakesh Rao <rakes...@vsnl.net> schrieb in im Newsbeitrag:
3DA572CB...@vsnl.net...
>
> Hi Risto,
>
> Sorry for the late response. Here is the ARC.LSP program with the
PL_BulgeLst
> function.
>
> Now, I am able to reconstruct the polyline if not more than one arc is
present
> in the polyline.
>
> If there are more than one arcs just next to each other, I have difficult
in
> establishing the arc geometry correctly.


>
> Regards
> Rakesh
>
>
>
> "Risto Mäkelä" wrote:
>

0 new messages