New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import SVG files directly #119
Comments
Indeed, this would be a nice improvement! One nice side-effect of the SVG->EPS->DXF conversion was the reduction to basic geometry objects (lines, circles, arcs). I do not know the SVG specification, but I could imagine, that it allows more (complicated) geometry primitives. (just wild guessing) |
SVG does have additional, more complicated geometric primitives (quadratic and cubic bezier splines), but for now we can have it perform linear interpolation of all non-Line object, just like DXFImport does with arcs and circles. |
I am looking into "python3-svg.path" for now. It seems to be simple (interpreting only simple path types), but this should be suitable for us. |
Previously inkscape and pstoedit were chained in order to convert SVG files to DXF and import the result. This process turned out to be error prone (besides requiring additional dependencies): * #118 The new implementation uses svg.path for interpreting basic SVG paths directly in Python without calling external commands. For now only a few SVG entities are supported (paths and rectangles). More entities will probably follow (on demand), like circles and simple transformations. Full SVG support would be very demanding and is probably not worth the effort, thus it is not a design goal. Interested users can always execute the simplication to a path on their own (e.g. via inkscape). Closes: #118, #119
Implemented in f29c90a. |
Previously inkscape and pstoedit were chained in order to convert SVG files to DXF and import the result. This process turned out to be error prone (besides requiring additional dependencies): * #118 The new implementation uses svg.path for interpreting basic SVG paths directly in Python without calling external commands. For now only a few SVG entities are supported (paths and rectangles). More entities will probably follow (on demand), like circles and simple transformations. Full SVG support would be very demanding and is probably not worth the effort, thus it is not a design goal. Interested users can always execute the simplication to a path on their own (e.g. via inkscape). Closes: #118, #119 (cherry picked from commit f29c90a)
Currently PyCAM does not open SVG files directly. SVG files are first converted to EPS by shelling out to inkscape, then the EPS is converted to DXF using pstoedit, then PyCAM reads the DXF file. This is inefficient and error prone (for example #118).
It would be better to teach Importers.SVGImporter to parse SVG files and convert them directly to PyCAM's internal Geometry representation.
There are several python SVG libraries packaged for Debian Stretch we could investigate to see if they're appropriate for this:
The text was updated successfully, but these errors were encountered: