Last active
November 2, 2021 07:47
-
-
Save vmario89/4b173c0ad4a03d3773ef8dd938c54621 to your computer and use it in GitHub Desktop.
Convert DXF to SVG using ezdxf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import matplotlib.pyplot as plt | |
import ezdxf | |
from ezdxf.addons.drawing import RenderContext, Frontend | |
from ezdxf.addons.drawing.matplotlib_backend import MatplotlibBackend | |
doc = ezdxf.readfile(YOURFILE) | |
fig = plt.figure() | |
out = MatplotlibBackend(fig.add_axes([0, 0, 1, 1])) | |
Frontend(RenderContext(doc), out).draw_layout(doc.modelspace(), finalize=True) | |
#fig.savefig(os.path.join(temp_output_dir, outputfilebase + ".png"), dpi=300) | |
fig.savefig(os.path.join(temp_output_dir, outputfilebase + ".svg")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment