Re: Algorithm
Posted by
dumbdrive
on 2002-07-09 18:23:21 UTC
--- In CAD_CAM_EDM_DRO@y..., "Luc Vercruysse" <luc.vercruysse@p...>
wrote:
suggest you look into the open source code "ACE CONVERTER" written by
Yeager Automation... check the web for the URL.... This will give you
a good starting point, because frankly, what you are asking is a
little more complicated than just sorting the end points of each line
segment.... The dxf information does not give the end points for
arcs, you have to calculate them, some polylines have a bulge factor
you have to contend with, and some are closed polylines, circles have
no beginning or end, or if you choose a begining, it's end will be
the same... But the biggest thing when sorting is: what if three
lines share the same endpoint, as an example, a "Y"... which line
segment do you choose as the next in the path? What if a line is
drawn tangent to a circle?
As one professional author of a dxf-gcode conversion program once
told me... take all the lines, arcs, block, polylines, vertex's,
circles, points, etc in the dxf file, pretend they are toothpicks...
toss them into a fishbowl, and shake them up... now pick one up,
choose one end to be the starting point, now go look thru all the
remaining toothpick until you find the "closest" match to it opposite
end... (remembering that whoever drew the drawing may not have
snapped to any end points but merely drew the line close to the other
line).... now remove that toothpick from the bowl and look for the
closest match to it's other end in the remaining toothpicks... do
this until all the toothpicks are out of the bowl... simple huh?
And if three or four match? Oh-Oh... better think about that one...
Hope this gives you some starting points... but if time is money, go
buy "VectorCAM" or something... but then again there's absolutely
nothing wrong with saying you did it yourself!!!
Mike
wrote:
> Hi all,for
>
> I do'nt know if this is the right place to put my question ?
> I 'm writing an application that will convert DXF (2D) to G-code
> cuttong out contours on a plasma cutter.those
>
> I have a list of lines (X,Y coordinates) and I want to find out if
> lines make part of a closed contour (so if the endpoint of theprevious line
> fits to the startpoint of the next line). The coordinates are notsorted.
> Following is an example of two closed rectangles. How do I sortthose
> coordinates ?Not knowing what language you are using... if it's "C", I would
suggest you look into the open source code "ACE CONVERTER" written by
Yeager Automation... check the web for the URL.... This will give you
a good starting point, because frankly, what you are asking is a
little more complicated than just sorting the end points of each line
segment.... The dxf information does not give the end points for
arcs, you have to calculate them, some polylines have a bulge factor
you have to contend with, and some are closed polylines, circles have
no beginning or end, or if you choose a begining, it's end will be
the same... But the biggest thing when sorting is: what if three
lines share the same endpoint, as an example, a "Y"... which line
segment do you choose as the next in the path? What if a line is
drawn tangent to a circle?
As one professional author of a dxf-gcode conversion program once
told me... take all the lines, arcs, block, polylines, vertex's,
circles, points, etc in the dxf file, pretend they are toothpicks...
toss them into a fishbowl, and shake them up... now pick one up,
choose one end to be the starting point, now go look thru all the
remaining toothpick until you find the "closest" match to it opposite
end... (remembering that whoever drew the drawing may not have
snapped to any end points but merely drew the line close to the other
line).... now remove that toothpick from the bowl and look for the
closest match to it's other end in the remaining toothpicks... do
this until all the toothpicks are out of the bowl... simple huh?
And if three or four match? Oh-Oh... better think about that one...
Hope this gives you some starting points... but if time is money, go
buy "VectorCAM" or something... but then again there's absolutely
nothing wrong with saying you did it yourself!!!
Mike
Discussion Thread
Luc Vercruysse
2002-07-09 14:26:01 UTC
Algorithm
dumbdrive
2002-07-09 18:23:21 UTC
Re: Algorithm
Raymond Heckert
2002-07-10 12:10:33 UTC
Re: [CAD_CAM_EDM_DRO] Algorithm
Luc Vercruysse
2002-07-10 12:34:52 UTC
Re: [CAD_CAM_EDM_DRO] Algorithm