growing a polyline

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
slbarker
Posts: 12
Joined: 03 Nov 2005, 23:39
Location: New Zealand

growing a polyline

Post by slbarker » 22 Apr 2009, 10:05

Hi,

Can anyone assist with the maths?

I have a polyline (usually closed) that needs to be grown by a specified distance perpendicular to each edge line.

Think of a house plan showing the outside walls. I need to grow this polyline by adding 600mm all round for the roof eaves to get the roof footprint.

My polyline is stored as a set of vertices and is drawn onto the canvas of an underlying sgimage. I need to calculate the new set of vertices.

thanks,
Steve

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: growing a polyline

Post by support » 22 Apr 2009, 15:13

Hello Steve,

We suppose this task could be solved by the following way:
  1. get every section of a poliline;
  2. draw a line parallel to the section;
  3. repeat steps 1 and 2 for every section of the polyline;
  4. find intesections between every pare of neighbouring parallel lines;
  5. draw new polyline on a list of intersection points.
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

slbarker
Posts: 12
Joined: 03 Nov 2005, 23:39
Location: New Zealand

Re: growing a polyline

Post by slbarker » 23 Apr 2009, 03:30

Hi Sergey,

Thanks for the quick response. I figured that would be the way to do it but was hoping someone else already had code to do it or parts of it.
e.g. finding parallel lines, intersection points, determining which side (outside the area) to place parallel line etc.
My maths is a bit rusty here.

I know AutoCAD does it with the offset command etc and wondered if anyone else had done anything similar using your components, or even another CAD package where source is available.

cheers,
Steve

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: growing a polyline

Post by support » 23 Apr 2009, 09:32

Hello Steve,

We have similar function in ABViewer v.7 (Web page is http://www.cadsofttools.com/en/products/abviewer.html): "Tools -> Modify -> Scale" menu item. If you'd like to have our code example, it sounds like a kind of commercial offer. So, if you are interested please contact us to info@cadsofttools.com accordingly to this question.

Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply