Inkscape DXF to Openscad

Post questions on how to use or achieve an effect in Inkscape.
GamerDarling
Posts: 7
Joined: Mon Mar 02, 2015 2:44 am

Inkscape DXF to Openscad

Postby GamerDarling » Mon Mar 02, 2015 2:48 am

Hey guys, I'm having trouble creating a DXF file in Inkscape that will actually process in Openscad. I want to make some new cookie cutters, using the code here: http://www.thingiverse.com/thing:28882 but openscad keeps giving me errors about intersecting lines, and that doesn't make any sense to me because I'm literally going as simple as drawing a circle in inkscape, converting object to a path(so it becomes a square), selecting the edit paths by nodes tool, selecting the whole object, make selected segments lines, and exporting to dxf with LWPOLYLINE as type of line output. I'm pretty sure I'm missing something basic.

I've been following this tutorial to a T: http://repraprip.blogspot.co.nz/2011/05 ... orial.html and no dice even just getting it to extrude ten px using the example code in the blog post. I get the same set of errors, so I'm betting it has to do with the DXF file I'm creating, but I have no idea what.

Any tips or suggestions are definitely appreciated!

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Inkscape DXF to Openscad

Postby ragstian » Mon Mar 02, 2015 3:15 am

Hi
GamerDarling wrote:Any tips or suggestions are definitely appreciated!

Open scad can not understand dxf files directly.

Install the Inkscape to scad extension found InkScape_To_OpenSCAD_Extension]here.

Testing:
SVG Image by adjusting nodes from Circle:

Image

Result in openSCAD:

Image

Hope this helps. :)
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

GamerDarling
Posts: 7
Joined: Mon Mar 02, 2015 2:44 am

Re: Inkscape DXF to Openscad

Postby GamerDarling » Mon Mar 02, 2015 3:23 am

Thank you for responding!

My only concern about that one is that I don't know enough about openscad to know if the code for the cookie cutter generation will work on an openscad file, I would assume the code is requiring a DXF, which is why I'm trying so hard to make that work. Since you've actually got it working for displaying your file do you mind trying the cookie cutter code on your scad file for me real quick to see what happens?

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Inkscape DXF to Openscad

Postby ragstian » Mon Mar 02, 2015 3:33 am

Hi.
GamerDarling wrote:My only concern about that one is that I don't know enough about openscad to know if the code for the cookie cutter generation will work on an openscad file, I would assume the code is requiring a DXF, which is why I'm trying so hard to make that work.

The extension works on paths in your open SVG file, no need for a dxf file anywhere, forget about the DXF step! :)

GamerDarling wrote:Since you've actually got it working for displaying your file do you mind trying the cookie cutter code on your scad file for me real quick to see what happens?

Testing:
SVG "PI" image where the text has been converted to path:

Image

Exported with the "Paths to open Scad" extension. opened in openSCAD.
Result:

Image

To make a cookie cutter you would copy the path - use inset on the copied part and subtract the resulting two;

Image

Add one more path to the SCAD file (Cut and Paste in text editor) for something nearly "print ready":

Image
Last edited by ragstian on Mon Mar 02, 2015 4:57 am, edited 1 time in total.
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

GamerDarling
Posts: 7
Joined: Mon Mar 02, 2015 2:44 am

Re: Inkscape DXF to Openscad

Postby GamerDarling » Mon Mar 02, 2015 4:51 am

The reason I want to use the code in the thingiverse file is that the cookie cutters done with it print extremely well on my printer, and once I get one dxf file that I've created working all I have to do to the code for new prints is update the file being referenced. The others tend to be doublewalled and thick, but the ones that generates are single walled slice right through the dough...and I'm not really into openscad coding, so the simpler the process the better for me. >.<
Last edited by GamerDarling on Mon Mar 02, 2015 5:03 am, edited 1 time in total.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Inkscape DXF to Openscad

Postby ragstian » Mon Mar 02, 2015 5:02 am

Hi

The reason I want to use the code in the thingiverse file is that the cookie cutters done with it print extremely well on my printer. The others tend to be doublewalled and thick, but the ones that generates are single walled slice right through the dough.


I used the SVG "code" on thingiverse, which "code" do you want me to try?
("Code normally means something you can "run" on your computer - as opposed to "data" which a program (the code) acts on.)
The "wall thickness" you can control - I deliberately made it "thick" as to give it some "substance". :)
That's also why I added the thicker "rim" at the top ("top" when using - "bottom" when printing?)
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

GamerDarling
Posts: 7
Joined: Mon Mar 02, 2015 2:44 am

Re: Inkscape DXF to Openscad

Postby GamerDarling » Mon Mar 02, 2015 5:08 am

Sorry, totally my fault for not being precise enough...when I was talking about the code on thingiverse I was referring to the scad file he included. Here's the code from the file I was referring to:

Code: Select all

wallThick = 2;
cutterMinimum = 0.4;
baseHeight = 2;
height = 15;
flangeWidth = 6;

minkowski(){
outline();
cylinder(r1 = wallThick/3, r2 = cutterMinimum/3, h = height);
};
//%cube([.5, .5, height*3], true);

flange();

module flange(){
   difference(){
   minkowski(){
   baseShape(baseHeight/3);
   cylinder(r = flangeWidth, h = baseHeight/3);
   }
   translate([0,0,-0.01])baseShape(baseHeight*1.1);
   };
}



module outline(){
   difference(){
   minkowski(){
   baseShape(baseHeight/3);
   cylinder(r = cutterMinimum/3, h = baseHeight/3);
   }
   translate([0,0,-0.01])baseShape(baseHeight*1.1);
   };
};

module baseShape(H){
linear_extrude(file = "drawing-2.dxf", height=H);
}


I just don't know what options the linear extrude function can handle. His instructions seem to imply that it needs a dxf created in a specific way, and his dxf file is working for me just fine, which is why I'm blaming the files I'm creating. If that function can handle the path generated by the openscad extension, awesome! (and seriously, thank you for putting up with my noobness with openscad)

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Inkscape DXF to Openscad

Postby ragstian » Mon Mar 02, 2015 6:25 am

Hi.
(and seriously, thank you for putting up with my noobness with openscad)

We are in the same boat - just installed it to try to answer your questions.

As the input to openScad is entirely text based you can "design" directly in openSCAD.
For simple shapes (squares, rectangles, lines etc.) and volumes (cubes, boxes etc.) this might be easier than the Inkscape route.

I will read some more on openSCAD and try to figure out the "workflow" used in the example.
Stay tuned!
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Inkscape DXF to Openscad

Postby ragstian » Mon Mar 02, 2015 7:59 am

Hi.
ragstian wrote:Stay tuned!


Got DXF import working!
The trick is to convert all lines to straight segments as openSCAD does not "understand" curves!
To do this in Inkscape is easy, for the figure used in my first example;
select all nodes F2 then Ctr A.
Click the Insert Nodes icon on the toolbar until you have "enough" nodes. (256 in example here)
with all nodes selected -
click the "Make All Segments Straight Lines" icon.

Image

Save your file as DXF.
Import into openSCAD.
Render (F6).

Image

Perform the "happy-dance"!

Still have to figure out how to "extrude" the path in openSCAD.
Love the CSG! (Constructive Solid Geometry) of openSCAD - reminds me of making scenes in Vivid2.0 and POV-Ray.

Edit; After reading the tutorial I see where your "code" term comes from. (My bad - Again! :oops: ) No problem running the code in openScad, the only "gotcha" is that both files have to be in the same directory or you will have to specify the full file-path to the DXF file.

My Cookie Cutter; (Now - I really need a 3d printer!!)

Image
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

GamerDarling
Posts: 7
Joined: Mon Mar 02, 2015 2:44 am

Re: Inkscape DXF to Openscad

Postby GamerDarling » Tue Mar 03, 2015 2:59 am

Thank you so much! Now it's working for me too! :D

And I'd be happy to print stuff for you in the meantime just hit me up on etsy:https://www.etsy.com/shop/TresGeekShop , or if you're seriously looking, here's the list I did when shopping for ours to compare featuresets: http://tinyurl.com/mot7otf

I would recommend either the printrbot metal plus or the flashforge creator pro(that's what we have) http://tinyurl.com/mhzdh9m

They've both got solid reputations and some great quality compared to the others in their price range...much cheaper than that and you're going to be sacrficing some serious amounts of quality/ability to tinker.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Inkscape DXF to Openscad

Postby ragstian » Tue Mar 03, 2015 3:14 am

Hi.

You're welcome. Nice "learning experience" for me too!

Please post images of your 3d-printed cookie-cutter (or other projects!)
Also interested in hearing about your 3d-printer - type, software, use etc.
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar


Return to “Help with using Inkscape”