Skip to content
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

Can maker.js convert svg to DXF? #479

Closed
pigLoveRabbit520 opened this issue Dec 28, 2020 · 7 comments
Closed

Can maker.js convert svg to DXF? #479

pigLoveRabbit520 opened this issue Dec 28, 2020 · 7 comments

Comments

@pigLoveRabbit520
Copy link

any simple demo?

@tabeaeggler
Copy link

Here you can find my approach which is not fully working yet: #480

@danmarshall
Copy link
Contributor

Hello, first it is important to note that Maker.js only deals with "outlines" - drawings made of lines, circles, arcs, and Bezier Curves. SVG and DXF both have many concepts beyond this, such as color, fill, line thickness, etc. So during import you would lose some of this information. Also, not every concept in SVG has a counterpart in DXF, so might also lose some features in the translation.
Does your SVG contain any symbols, or use any repeating patterns as a fill? This will be difficult to reconstruct...
But if you are strictly importing / exporting lines, circles and arcs, it may work.

@tabeaeggler
Copy link

@salamander-mh I posted a working version #480

@z3dev
Copy link

z3dev commented Jan 6, 2021

@salamander-mh you might try some other libraries, or applications. There are lots of applications converting between SVG and DXF.

@danmarshall sorry for the negative plug

@pigLoveRabbit520
Copy link
Author

@tabeaeggler how to deal with path element with BezierCurve?

@pigLoveRabbit520
Copy link
Author

pigLoveRabbit520 commented Jan 11, 2021

@z3dev Can you recommend some applications(Open Source)? thks a lot.

@tabeaeggler
Copy link

@tabeaeggler how to deal with path element with BezierCurve?

  1. Get the d attribute: let d = path.getAttribute("d")
  2. Create a makerjs model: let svgPathData = makerjs.importer.fromSVGPathData(d). It will automatically create a model with different curves representing a BezierCurve. It is structured as follows: "models", "p_1", "models", "Curve_1", "Curve_2", "Curve_3", "Curve_4".
  3. Add it to your model: makerjs.model.addModel(model, svgPathData, "type"). Print your svgPathData and figure out your type. For my semi-ellipses I used the type "ellipticarc"

@danmarshall danmarshall changed the title Can marker.js convert svg to DXF? Can maker.js convert svg to DXF? Jul 17, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants