This JAVA application is helpful to get a 2D or 3D object from a simple SVG sketch.
Usually you can import a stl 3D printer object directly into OpenSCAD. You can resize it, you can transate it, rotate it, everything you want.
But you won't get the points used in the object. to edit the lines or single points you must have these values within the scad command list.
What I made is a program to convert the XML based information from SVG-files to point values for OpenSCAD.
- import the values
- set a specific point for every single value
- create polygon 2D-objects
- create optional 3D-objects
- calculate the center points of single objects within the SVG (each line inner and outer, circles is a single object, in XML identifiable by the M-index for starting position and L-index for line vectors)
- get information to min and max values of the object
What you can do now is import a STL file, make a 2D projection of it (maybe cut into slices) and export this result from OpenSCAD to a SVG file.
Now open this file with the java program, select the source, and specify the target scad file, let the tool work and open the SVG file and create a new OpenSCAD project.
When you open this new file you will see every object.
Per each there is a single module named p with a rising number.
I have rounded each value to 1/100mm automaticly.
You can exclude single points from the polygon, insert new points, move points, get simple measurements (the center of rotated objects could not be measured by simple X-Y-distances, look at the red arrow markers)
the modules and parts will be named with the name of the file. if multiple generated file are used (use and use ) it's confusing which "p0" is ment.
so it is now file1_p0 and file2_p0.
only with center-point-names and modules. p000... p9999 ff. are within the modules, would not matter.
There is a error caused by a unknownhostexception when parsing the xml-(input)file.
Solution is: https://stackoverflow.com/questions/4002885/unknown-host-exception-while-parsing-an-xml-file. New version, 2017-10-01