Filled projection cut?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Filled projection cut?

Ian.Wakeling
I want to get some components etched, so I need to produce masks for the top and bottom of the etch. It occurred to me that I could draw the etched component with OpenScad, then use projection(cut) to get the top and bottom surfaces and export them as dxf files, from which I can then convert to a format the etcher will accept (e.g. postscript). Unfortunately, what I discovered was that the dxf export gives me a set of paths for the outlne(s), which doesn't help me at all: I need surfaces to be solid.

I did try loading the dxf into inkscape and telling it to fill the surface, but it claims that the area isn't bounded. I'm not wildy enthusiastic about pursuing that path any further, because even if it can be made to work, it's going to be incredibly tedious.

Searching the forum and the internet, I haven't found anything that looks like it will do the job, so I may have a go at creating something, (probably by parsing a sub-set of the scad language and translating direct to postscript), but before I embark on such a project, I thought it was worth checking here in case I've missed an existing way of doing this.
tp3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filled projection cut?

tp3
Maybe have a look at http://pcbmode.com/

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filled projection cut?

Neon22
In reply to this post by Ian.Wakeling
dxf support is highly variable. its an old format but with so many variations now. if you want to try this kind of interchange - look for a different format.
Torsten's pcbmode link by Saar is fantastic but you need to edit some json format files. IMHO its worth getting into. It will do the job for you.
Github here: - https://github.com/boldport/pcbmode
docs here: http://pcbmode.readthedocs.io/en/latest/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filled projection cut?

Ian.Wakeling
In reply to this post by tp3
OK, thanks, I'll take a look at that.

Ian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filled projection cut?

droftarts
Ian.Wakeling wrote
I did try loading the dxf into inkscape and telling it to fill the surface, but it claims that the area isn't bounded.
The dxfs that OpenSCAD export are all just line segments, ie if you export a square from OpenSCAD it comes out as four unconnected lines, which is why Inkscape won't fill it - because the lines don't define an area. However, the endpoints (or nodes) for each line should be at the same position as the next line, so you can join them easily enough in Inkscape. If you need instructions to do that, let me know, I've got them somewhere...

Alternatively, you could just export your file as SVG from OpenSCAD, which is Inkscape's preferred format. All lines export joined up correctly. Just make sure you're using a recent version of OpenSCAD; older versions created SVGs with no units, so they open in Inkscape with the units set to 'pixels' rather than 'mm', and your artwork will be scaled. This was fixed last year, see: https://github.com/openscad/openscad/issues/1253

Ian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filled projection cut?

Ian.Wakeling
droftarts wrote
Alternatively, you could just export your file as SVG from OpenSCAD, which is Inkscape's preferred format. All lines export joined up correctly. Just make sure you're using a recent version of OpenSCAD; older versions created SVGs with no units, so they open in Inkscape with the units set to 'pixels' rather than 'mm', and your artwork will be scaled. This was fixed last year, see: https://github.com/openscad/openscad/issues/1253
Ah, interesting, I had discovered the lack of units with the SVG export, which was why I went down the DXF route. I'll try upgrading then.

Thanks,

Ian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filled projection cut?

droftarts
You can edit svg files in a text editor to add the units. Here's a guide I wrote a little while ago, with some extra information.

With SVGs, you have to make sure that the units are specified correctly, or you can get your design scaled to some peculiar sizes. The SVG output of OpenSCAD doesn't include the units, so any program opening it assumes that, rather than using mm, it's specified in pixels (see http://www.w3.org/TR/SVG/coords.html#Units ). Both Illustrator and Qcad use 72dpi to do this conversion (a 100mm line incorrectly interpreted as pixels rather than mm comes out 100 * 25.4 / 72 = 35.278mm), while Inkscape uses 90dpi as per the SVG spec (so a 100mm line comes out 100*25.4/90=28.222mm), so it can seem like you end up with scaled artwork if you don't set the units in the SVG file.

However, it's quite easy to change the units from pixels to mm. Open the SVG output from OpenSCAD in a text editor, and change the document 'width' and 'height' in the first couple of lines from no units to mm. eg, edit:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="846" height="1025" viewBox="-451 -870 846 1025" xmlns="http://www.w3.org/2000/svg" version="1.1">
<title>OpenSCAD Model</title>
...

to...

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="846mm" height="1025mm" viewBox="-451 -870 846 1025" xmlns="http://www.w3.org/2000/svg" version="1.1">
<title>OpenSCAD Model</title>
...

This should then open the SVG the correct size in the various applications.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filled projection cut?

MichaelAtOz
Administrator
Perhaps a 'unit' option should be added at some stage.
Admin - PM me if you need anything,
or if I've done something stupid...

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!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filled projection cut?

droftarts
Yes, seems like a simple addition. I'm sure the guys who work OpenSCAD in inches would appreciate it! In Inkscape there's eight absolute units - mm, cm, m, inch, ft, point, pica and pixel.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filled projection cut?

Ian.Wakeling
Just wanted to confirm that I built an up to date version and exported SVG from that and it worked a treat. Thanks for all the help.
Loading...