elliotf / heekscad

Automatically exported from code.google.com/p/heekscad
0 stars 0 forks source link

Linework Cleanup Tools #271

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am a fan of the edge detection software in Inkscape but the small splines
that are produced are much smaller than I need and the large number of them
makes the imported file almost unusable inside HeeksCAD.

It would be nice if we could come up with a mechanism to cleanup the
linework in a sketch.  eg: If a sketch is made up of a large number of very
short spline elements, it might be simplified into a handful of lines
and/or arc elements with very little deviation from the original shape. 
This would make the resultant file much easier to work with due to the
reduced number of elements required for both malloc and rendering.

I played with an idea (but I've lost the code now) whereby I used the
BRepMesh::Mesh tool to 'stroke' elements into lines with a specified
maximum deviation from the original element.  I tried to generate a BSpline
element using the endpoints of all these lines combined in the hope that
the single BSPline curve would be more simple than the large number of
points that made it up.  I got this far.  Unfortunately I was unable to use
the BRepMesh::Mesh() tool on the resultant BSpline curve.

I was never sure whether this would be a successful process anyway.

I have had this problem many times where I have used raster artwork as a
source of design for a machining operation.  The time spent cleaning up
overly complex files has easily been the largest part of the machining
project.  My computer isn't fast enough to keep up with the large models so
even the linework cleanup process is slow.

I just thought I would float this problem as an issue in the hope that
other people would contribute their ideas or at least air their common
frustrations.

Original issue reported on code.google.com by David.Ni...@gmail.com on 5 May 2010 at 12:37

GoogleCodeExporter commented 9 years ago
I should have added one more wish to this list.  One of the features for 
cleaning up
the linework would be to attempt to join the selected graphical objects with
ever-decreasing tolerance values until the linework became 'closed'.

Original comment by David.Ni...@gmail.com on 5 May 2010 at 12:40

GoogleCodeExporter commented 9 years ago
I second your proposal. I have run into the same issue with files generated from
Adobe Illustrator. Somehow Illustrator generates DXF files with thousands of 
lines on
top of lines. I can honestly say that I spent the better part of two days 
trying to
uncover and clean up all the tiny line segments on one project alone. That 
process
can be very frustrating.

Original comment by ddfalck2...@yahoo.com on 11 May 2010 at 7:19

GoogleCodeExporter commented 9 years ago
I have added 'Simplify Sketch to Lines' and 'Simplify Sketch to BSplines' menu
options for selected sketch objects.

In my example I had performed an edge detection on a raster image using 
Inkscape. 
The resultant file was in the order of 10MB in size.  Most of this was extremely
complex bspline elements whose length was measured at the atomic level.  I have 
been
able to cleanup this file using the 'Simplify Sketch To Lines' option such that 
the
resultant file looks every bit as good (max deviation 0.001 mm) and is about 
250kB in
size.  The file opens within a second rather than, previously, in 5 minutes or 
so.

Personally, I am happy to close this enhancement off now.  The tools that are 
there
now are good enough for me.

The only other thing I might do is explain the extra options in either an 
existing or
a new wiki page.

Original comment by David.Ni...@gmail.com on 29 May 2010 at 11:44