dxf2papercraft
dxf2papercraft is an open source flattener, available at https://sourceforge.net/projects/dxf2papercraft/files
command line options
Usage: ./dxf2papercraft [options] infile3D.dxf outfile2D.dxf
convert a polygonal 3D object into a 2D cut-out sheet for
producing a paper model of the object using glue and scissors
Copyright by Thomas Haenselmann <givenname@familyname.de>
Options:
-m, --nomerge no merging of faces into single polygon
-n, --number print face numbers
-d, --divide draw each face separate
-o, --overlap allow overlapping faces in cut-out sheet
-h, --hide hide glue tabs
-f, --force force glue tabs, even if intersecting faces
-p, --split 8,17 face number 8 and 17 get disconnected from the rest
(use -n to see face numbers in 2D DXF file)
-s, --strategy 0..5 0: draw smallest polygon first / 1: draw largest first
2: as ordered in file / 3: keep adjacent faces continuous
4: stretch 2D layout wide / 5: keep layout dense
-?, --help display this text
Converting dxf2papercraft generated DXF file output to SVG
Using dxf2papercraft generates 2D DXF output from 3D DXF input. We can use some tools to convert away the DXF to a neutral format like SVG.
kabeja (works)
Some tests with conversion of dxf2papercraft dxf output to SVG files
./dxf2papercraft/dxf2papercraft -d test3d.dxf test2d.dxf
sed -i 's/ENDSEQ/ENDSEC/g' test2d.dxf
cd kabeja/
java -jar launcher.jar -nogui -pipeline svg ../test2d.dxf ../test2d.svg
cd ../
inkscape test2d.svg
OpenSCAD (failed)
The dxf generated output from dxf2papercraft is not usable with openscad (we could use openscad to convert).
import(file="/home/tomate/mightyscape/papercraft_unfold/test.dxf");
WARNING: Unsupported DXF Entity 'SEQEND' (170) in "test.dxf".
WARNING: Unsupported DXF Entity 'VERTEX' (63c) in "test.dxf".
WARNING: Unsupported DXF Entity 'POLYLINE' (170) in "test.dxf".
How to create usable input files for dxf2papercraft?
dxf2papercraft only handles 3D DXF files. A lot of files are not shipped in this format. So how we can convert models to 3D DXF to use dxf2papercraft?
Blender "Import AutoCAD DXF format (.dxf) Addon
On Linux and Windows we can use Blender to import models like STL or OBJ. We can write a usable DXF file for dxf2papercraft.
admesh
admesh is a simple tool which works well to make 3D DXF files
sudo apt install admesh
admesh 3dprint-bolt.stl --write-dxf 3dprint-bolt.dxf
admesh is able to generate DXF files from STL files too. But trying to import larger files may give error
dimeModel::largestHandle: 0
terminate called after throwing an instance of 'std::bad_alloc'
hat(): std::bad_alloc
Aborted (core dumped)
How to improve dxf2papercraft?
In conclusion there are some ToDos to make dxf2papercraft better
- fix ENDSEQ bug (must be named "ENDSEC")
- update dime library to most recent one
- add native SVG file export option
- make colored output
- add STL input option (integrate admesh into conversion toolchain)
- allow to disable printing out numbers
- remove duplicate lines