folkertdev / freestyle-svg-exporter

a Blender addon for exporting stylized lines created by the Freestyle render engine to an SVG format.
54 stars 18 forks source link

DXF Exporter #6

Open DaveCoventry opened 8 years ago

DaveCoventry commented 8 years ago

I want to generate 2D DXF drawings from my Blender models.

Currently I use a "visible" linetype and a "hidden" linetype, which I save as SVG and then use Inkscape to convert to DXF. Unfortunately both linetypes end up on the same layer "strokes" and I need them on separate layers to edit them.

Also, would it be possible to convert directly to DXF? It handles circles and arcs so much better than SVG.

I know a bit of python (although I'm not sure if I'm up to this as I doubt it would be trivial) and am familiar with the DXF file format. While files would I need to edit?

xuv commented 8 years ago

Not sure this is what you're looking for, but there seems to exists already a DXF exporter for Blender. http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/DXF_Importer

The way I understand Freestyle-SVG-exporter, as you said, it will not be trivial to change this plugin to export to DXF. I don't think it would even make a "useful" DXF as lines out of Freestyle are mostly not continuous.

DaveCoventry commented 8 years ago

Hi Xuv, thanks for the response.

After a bit of thought, I think a better approach may be to convert the simple paths from the generated SVG file and convert these to DXF preserving the linetypes on separate layers.

The DXF exporter that you link to exports a full 3D model rather than the plan, side-elevation and end-elevation orthographic projections I want. The old 'pantograph' exporter for Blender 2.49 was closer to that ideal, but alas it has been discontinued.

~ Dave

folkertdev commented 8 years ago

Hi Dave,

The separation into layers is based on (1) render layer and (2) line set (not style!). All line sets get their own svg layer that you can manipulate in inkscape. The set layers have sublayers for strokes and fills. This means that all strokes from a line set will be joined into one layer.

So (and I´m not totally sure what your use case is) you want to put what need to become different svg layers in different Freestyle Line Sets. Then, I hope that the Inkscape -> DXF converter is smart enough to do what you want.

As @xuv said, making a Freestyle DXF exporter is non-trivial (though, I assume, quite doable). The discrete, pointwise nature of Freestyle lines is also not ideal as input for a discrete format (but the same could be said of conversion to SVG, of course).

If you experience any further problems, please let me know.