3

I would like to know where I can find a reliable tool/library for conversion of svg to dxf. In between formats are also allowed as long as the dxf output is an exact replica of the svg. So that means conversion of the paths (and in particular bezier curves and arcs). I've looked at the svg2dxf export in inkscape but that's cutting corners (literally as that it draws straight lines between some curved endpoints). A library should be preferable in java, perl or python as I'm most familiar with these languages. I also would be willing to spend a small amount for a commercial product. I've done some googling but strange enough the majority of entries are over 5 years old. I'm also interested in a more readable specification of the dxf as the one published on the autocad website is not very verbose.

1 Answer 1

1

The company I work for has a library for Windows that supports many vector formats, including SVG and DXF.

Although the vector DLLs are mainly for C/C++, it should be easy to call them from other languages like Java, as shown in this forum post: HOWTO: Call a LEADTOOLS API Function from Java

The code to load an SVG file and save it as DXF looks like this:

VECTORHANDLE LeadVector = { 0 };
L_VecLoadFile("inputFile.svg", &LeadVector, NULL, NULL); 
L_VecSaveFile("outputFile.dxf", &LeadVector, FILE_DXF, NULL);
L_VecFree(&LeadVector);

There’s a free evaluation edition you can try to see if the resulting DXF preserves the vector objects the way you need. You can obtain the evaluation from this page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.