I work on polyhedra and their construction and rendering. A rather complex part is the production of a net from a solid. i'd like to laser-cut these nets, but this needs two layers - one for the outline to cut through, the other for the interior lines to score. I see there has been some discussion on the issue list re layer export but until it is implemented, what work-arounds have folk used? I guess I could export two separate DXFs and merge them somehow?
If you aren't averse to using other programs, a couple options pop into my alleged mind.
If you're starting from an STL file, consider that the free program Slic3r provides for export to a DLP 3D printer, in the form of sliced segments determined by the user-defined layer thickness. Sending your STL to the program, setting zero infill and layer thickness to your requirements should result in a set of graphic images, although I've forgotten the format of those images. Even if they are JPG, BMP, PNG, one can easily convert them to your laser format.
Another option is to use Inkscape to import the flattened image and modify the lines as needed. I selected Inkscape because it's free, but any vector editing program should provide for your requirements. If you haven't checked out Pepakura, you may find it contains even better answers. Although not free, it's astonishingly low priced considering the features.
Ronaldo - thanks - it's a bit of a monster and still growing. It's great that OpenSCAD can do this stuff - multiple hat-tips to the team (but oh for an associative array)
Fred -thanks for the suggestions. It seems both those approaches go via images and that will loose accuracy and require manual work. I feel that merging the 2 DXF files should work - I'm looking for, say, a python script which does this.
I took one of your polyhedra net files and played around with it. As there's no way of drawing lines, let alone exporting them, from OpenSCAD, I resigned to drawing them by hand. I added a projection cut to get the net in 2D, then exported a dxf and svg.
If you're exporting a dxf, you're probably going to have to reconnect the lines at some point anyway, as OpenSCAD exports dxfs as individual line segments. Opening the dxf in a drawing package (eg Inkscape) should give you the outline (or cut line). You can reconnect the points easily in Inkscape, or if you export from OpenSCAD as an SVG, they stay connected.
To draw the internal 'fold' lines in Inkscape, create a new layer, and select the line tool (pen tool). Set the cursor to snap to 'cusp nodes' ( View > Show/Hide > Snap Controls Bar), and the cursor should snap to the nearest point, and allow you to draw the lines accurately to the points. Inkscape's drawing tools are somewhat of an acquired taste (especially after years using Illustrator!), so if you need extra guidance on the above, let me know, though there is extensive online help. You can, of course, do something similar in other vector drawing packages.
Once all the lines are drawn, export the file as a dxf (uncheck 'use ROBO-master...' but check 'use LWPOLYLINE...'). If you have problems importing the dxf into the laser cutter software, you may need to resave it with a better dxf creation tool than Inkscape; I use QCAD. This opens Inkscape dxfs (and OpenSCAD's and Illustrator's), and allows you to resave them in a version other software will understand. I tend to use R15 dxf version, which seems to have the broadest support for my uses.
Haven't tried laser cutting the resulting file yet, but will... soon...
Hi Chris - great progress.
I'd be inclined to load them into inkscape and select the paths and group them there. The advantage being that the result can be scaled and exported as SVG with useful dimensions.
Exporting from Inkscape as a PDF for printing, or send the SVG straight to someone like Ponoko - which takes svg files from inkscape and laser cuts them using their templates as a guide (colours define cut or score).
(all templates here: https://www.ponoko.com/starter-kits/inkscape)
Having said that a lot of laser cutters also take DXF - but its such a crusty format. Looks like you'll always be using straight lines though, so more chance of success...
I switched to exporting SVG since its easier to manipulate. However, even the SVG paths are difficult to simplify to single lines for the laser cutter because the thin rectangles get joined into complex areas if they touch. After a struggle, I suddenly realised that I could construct the complete SVG in openscad as text, with lines as lines rather than rectangles and outer and inner lines as two differently coloured paths. This works fine even if I have to copy and paste echoed output to create the file.
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
The TPP is no simple “trade agreement.”Fight it! http://www.ourfairdeal.org/ time is running out!
These OpenSCAD functions generate SVG from multiple 'paths' as list of line segments. No attempt is made to join up connected lines since laser cutter software seems to do this anyway and it doest matter when displaying SVG. Paths are enclosed in a g element so that transformations can be added to the SVG later.
function bounding_box(vertices) =
[ [ min([for (v = vertices) v.x]),
min([for (v = vertices) v.y]),
min([for (v = vertices) v.z])],
[ max([for (v = vertices) v.x]),
max([for (v = vertices) v.y]),
max([for (v= vertices) v.z])]
function dash_line(line,dash_length) =
let (v = line- line)
let(n = floor(line_length/dash_length))
let(a = v * i / n)
let(b = v *(i + 0.5) /n)