OpenSCAD User Manual/DXF Extrusion
||The text in its current form is incomplete.|
With the import() and extrusion statements it is possible to convert 2D objects read from DXF files to 3D objects.
Example of linear extrusion of a 2D object imported from a DXF file.
linear_extrude(height = fanwidth, center = true, convexity = 10) import (file = "example009.dxf", layer = "fan_top");
Example of rotational extrusion of a 2D object imported from a DXF file.
rotate_extrude(convexity = 10, twist = -fanrot) import (file = "example009.dxf", layer = "fan_side", origin = fan_side_center);
Getting Inkscape to work
Inkscape is an open source drawing program. Tutorials for transferring 2d DXF drawings from Inkscape to OpenSCAD are available here:
- http://repraprip.blogspot.com/2011/05/inkscape-to-openscad-dxf-tutorial.html (Very simple, needs path segments to be straight lines)
- http://tonybuser.com/?tag=inkscape (More complicated, involves conversion to Postscript)
- http://bobcookdev.com/inkscape/inkscape-dxf.html (Better DXF Export, native support for bezier curves)
- http://www.bigbluesaw.com/saw/big-blue-saw-blog/general-updates/big-blue-saws-dxf-export-for-inkscape.html (even better support, works as of 10/29/2014, see link below registration window)
Description of extrude parameters
Extrude parameters for all extrusion modes
The convexity parameter specifies the maximum number of front sides (back sides) a ray intersecting the object might penetrate. This parameter is only needed for correctly displaying the object in OpenCSG preview mode and has no effect on the polyhedron rendering. See diagram below.
|file||The name of the DXF file to extrude [DEPRECATED]|
|layer||The name of the DXF layer to extrude [DEPRECATED]|
|origin||[x,y] coordinates to use as the drawing's center, in the units specified in the DXF file [DEPRECATED]|
Extrude parameters for linear extrusion only
|height||The extrusion height|
|center||If true, extrusion is half up and half down. If false, the section is extruded up.|
|twist||The extrusion twist in degrees|
This image shows a 2D shape with a convexity of 4, as the ray indicated in red crosses the 2D shape a maximum of 4 times. The convexity of a 3D shape would be determined in a similar way. Setting it to 10 should work fine for most cases.