Welcome! Log In Create A New Profile

Advanced

import dxf example?

Posted by Vuokko 
import dxf example?
February 17, 2016 08:15AM
I have some DXFs which have bolt holes etc. For this forum I could give example as stepper motor which has four smaller holes in the corners and one bigger in center.

So far I have done my .scad files by hand but I'm wondering if I could extrude from dxf drawing the part. And can I just somehow tell openscad to take from layer this and center it and extrude it? The manual is rather brief about import().

So does anyone have nice DXF examples to share?
Re: import dxf example?
February 17, 2016 11:08AM


Edited 1 time(s). Last edit at 02/18/2016 05:56AM by rhmorrison.


Bob Morrison
Wörth am Rhein, Germany
"Luke, use the source!"
BLOG - PHOTOS - Thingiverse
Re: import dxf example?
February 17, 2016 11:22AM
With the latest OpenScad version you can drag & drop the DXF file into the editor window which will automatically create an import command with the full path to your DXF file. e.g.:

import("C:/Data/dxf/large-gear.dxf");

(Of course you can also enter the command manually)

Press F5 or F6 to render the DXF as a 2D object (drawn 1mm thick). You can then linear_extrude or rotate_extrude that object. e.g.

linear_extrude(height = 20, center = true, convexity = 10,twist=10)
import("C:/Data/dxf/large-gear.dxf");

See [en.wikibooks.org]

I've attached the DXF as an example, but obviously any DXF should work the same.

Dave
Attachments:
open | download - large-gear.dxf (29.4 KB)
Re: import dxf example?
October 10, 2016 03:15AM
I am trying to turn a 2D scalable vector image from inkscape into an OpenSCAD file. Unfortunately, bringing the file into OpenSCAD as a DXF file looked terrible and using the inkscape extension didn't work either. Any ideas on getting this to work?

Here is the link to the files I tried using: [drive.google.com]
Re: import dxf example?
October 16, 2016 10:51AM
Figured out how to bring the file in:

1 - Draw object in Inkscape
2 - Move object to lower left corner of page, align left/right center marker to left page border, align top/bottom center marker with the bottom page border (it may help to turn off the page shadow in Document Properties)
3 - Select Objects you want to export
4 - Convert to Path: Path --> Object to Path (Ctrl+Shift+C)
5 - Flatten Beziers: Extensions --> Modify Path --> Flatten Beziers (adjust the value based on granularity you need; I use 0.3 or 0.1 for most things)
6 - Save as Desktop Cutting Plotter (Autocad DXF R14) .DXF file
7 - Make sure the ROBO-Master spline option is unchecked, LWPOLYLINE option is checked. I keep the base units in mm to be consistent with OpenSCAD.
8 - import the file in OpenSCAD (e.g. import ("drawing.dxf"); ) dragging and dropping the file will insert the command - then say preview
Sorry, only registered users may post in this forum.

Click here to login