Difference between revisions of "OpenSCAD"
(→Sample Files) |
(→Sample Files) |
||
Line 131: | Line 131: | ||
* http://forum.openscad.org/A-small-script-to-make-a-ruler-td22313.html --- elegant parametric ruler | * http://forum.openscad.org/A-small-script-to-make-a-ruler-td22313.html --- elegant parametric ruler | ||
* http://runeman.org/3d/egguardo/ | * http://runeman.org/3d/egguardo/ | ||
+ | * http://www.tridimake.com/2014/11/how-to-use-openscad-4-children-and.html --- chained hull | ||
===Curves=== | ===Curves=== |
Revision as of 09:45, 8 April 2019
Forum user alpha mentioned this in OpenSCAD - The Programmers Solid 3D CAD Modeller, providing sample code for making a mounting plate.
Contents
- 1 Limitations
- 2 Similar tools
- 3 Discussion
- 4 Interactive interface
- 5 Interface w/ Inkscape
- 6 Importing .stl Files
- 7 Import to FreeCAD
- 8 Export to DXF for CAM (alternative to .stl)
- 9 CNC direct interfaces
- 10 Other Support Tools
- 11 Sample Files
- 12 Diamond Circle Square 3D Example
- 13 Tutorials
- 14 References
Limitations
Forum user cvoinescu noted in Re: OpenSCAD - The Programmers Solid 3D CAD Modeller
OpenSCAD exports an exact STL representation of its model. No approximations are made during export. However, the internal model is created as an approximation of what's described in the source code. When you say "cylinder", for instance, OpenSCAD actually creates a prism. You can control how many faces the prism has with the $fa, $fs and $fn variables and arguments. In many 3D prints, you can see the default $fa=12 having generated a 30-sided prism, which I find annoying.
Because OpenSCAD works only with polyhedra internally (or polygons, when using it for 2D stuff), it does not need to approximate anything when exporting STL (but see note below). This is also why its DXF export is rubbish, with everything made out of segments (well, technically, the export is perfect, it's the internal model that's not appropriate for creating DXFs).
Note: Don Bright, a member of the OpenSCAD mailing list pointed out that repeating decimals are of necessity truncated, “For example, a point at (1/3, 0, 0) gets converted into (0.3333333333, 0, 0) but of course, 0.33333333333 is an approximation of 1/3. ”
Similar tools
Note also ImplicitCAD which uses a geometric representation internally.
Discussion
Turning the OpenSCAD into a GUI for other scripting languages
Interactive interface
- SnapSCAD --- an interactive/graphical interface coded in JavaScript (using Waterbear)
- 3ddoctors.net
- http://www.thingiverse.com/thing:3575
Interface w/ Inkscape
Please note that there is a tool for Inkscape which will export files to a format suitable for import into OpenSCAD Inkscape gets OpenSCAD converter. (Also available here.)
Other vector apps
Thingiverse: Export OpenSCAD paths from Adobe Illustrator CS6 --- https://wiki.shapeoko.com/index.php/OpenSCAD#Other_vector_apps [2]
https://github.com/anonlethal-jerk
Exporting to Carbide Create http://forum.openscad.org/OpenSCAD-dimensions-with-importing-to-Carbon-Create-td21810.html
a technique for loading the JSON from an OpenSCAD customizer and using it to generate a PDF or SVG: http://community.carbide3d.com/t/cnc-finger-joint-box/8880
Importing .stl Files
rotate([0, 0, 0]) import_stl("<filename>.stl");
Thingiverse: STL to OpenSCAD converter
Import to FreeCAD
https://www.freecadweb.org/wiki/Import_OpenSCAD_code
Export to DXF for CAM (alternative to .stl)
Rather than attempt to use a traditional CAM program, one may instead flatten a drawing in sections using code like:
projection(cut=true) translate([0, 0, -3]) {...object code / reference here...};
which is suggested in Hints for 2D modeling with OpenSCAD (DXF). This will allow one to export the design as .dxf(s) which may then be used in a traditional CAD/CAM workflow, or by importing into a drawing program and handling each layer by hand.
A similar technique is suggested in OpenSCAD to DXF and a script is provided here.
Using FreeCAD: https://www.reddit.com/r/openscad/comments/6hxhdc/make_2d_projections_from_openscad_models_using/dj1vuf4/
CNC direct interfaces
https://github.com/peberhard/openscad/tree/carving-plugin https://github.com/peberhard/openscad-carving-plugin-doc-examples [3]
Discussion: http://www.mattvenn.net/2013/02/17/using-openscad-for-2d-machining/
https://github.com/mbugert/laserscad [4]
Other Support Tools
- https://github.com/davidson16807/relativity.scad/ Thingiverse wiki[5]
- http://www.cannymachines.com/entries/9/openscad_dimensioned_drawings
- http://dkprojects.net/openscad-threads/ --- ISO standard threads
- https://github.com/jreinhardt/BOLTS [6]
- https://github.com/mbugert/laserscad/ [7]
- https://github.com/HopefulLlama/JointSCAD [8]
- https://bitbucket.org/kosme/openscad2cnc --- C# CLI tool for generating toolpaths for CNC machines from OpenSCAD files.
- Embossanova --- Emboss and impress images onto a surface in OpenSCAD. Tutorial
- PolygonRabbit --- online Flash tool to create polygons
- AIR app to generate polygons
- PuzzleCut OpenSCAD Library --- intended to allow one to divide a large project into smaller parts so as to print in pieces.
- List of OpenSCAD tools (rvanee)
- Threads
- MScrew generator
- http://www.thingiverse.com/thing:27183 --- OpenSCAD ISO metric thread library / functions
- http://dkprojects.net/openscad-threads/ [9]
- OpenScad Height Maps v0.5
- Highly Configurable Wheel
- Box Generator
- Thingiverse: Customizable Box with Finger Joints --- generates a .dxf
- Threads
- List of OpenSCAD tools (drmatrix)
- Thingiverse: Write.scad: http://www.thingiverse.com/thing:16193 [10]
- http://www.thingiverse.com/thing:3575
- MCAD OpenSCAD Parametric CAD Library
- OpenSCAD Seamless, an online module library
- http://aggregate.org/MAKE/TRACE2SCAD/ Trace2SCAD: Converting Images Into OpenSCAD Models
- https://github.com/l0b0/img2scad
- http://kyllikki.github.io/png23d/ 3d mesh generation tool
- boat propeller customizable - OpenSCAD nSpline() libary with show cases
- http://daid.eu/~daid/3d/ --- Polygon Builder --- online tool allowing one to click and create 2D polygons which may then be extruded.
- https://github.com/Axford/OpenSCAD_Machine_Design_Template --- https://github.com/Axford/OpenSCAD_Machine_Design_Template/blob/master/hardware/docs/VitaminCatalogue.md
- http://www.cannymachines.com/entries/9/openscad_dimensioned_drawings
- https://danielupshaw.com/openscad-rounded-corners/
- Tool to generate OpenSCAD coordinates from UIUC Airfoil Coordinates Database --- http://chaaawa.com/airfoils/
- OpenSCAD mechanical design library (omdl) --- provides open-source high-level design primitives with coherent documentation generated by Doxygen using openscad-amu
- Thingiverse: Parametric Pulley DXF [11] Instructable [12]
Labelling and Dimensioning of Parts
http://forum.openscad.org/Dimension-Parameter-labeling-for-part-diagrams-td15172.html
Sample Files
- Polyhedra in OpenSCAD[13]
- http://makezine.com/projects/use-math-design-mazes-openscad/
- http://forum.openscad.org/A-small-script-to-make-a-ruler-td22313.html --- elegant parametric ruler
- http://runeman.org/3d/egguardo/
- http://www.tridimake.com/2014/11/how-to-use-openscad-4-children-and.html --- chained hull
Curves
- https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Surface
- Thingiverse: Bezier Heart in OpenScad
- http://climberg.de/page/openscad-implementation-of-bezier-curves-of-any-degrees/
- https://github.com/JustinSDK/dotSCAD [14] https://openhome.cc/eGossip/OpenSCAD/BezierCurve.html
- http://forum.openscad.org/smooth-3-D-curves-tc7766.html
Diamond Circle Square 3D Example
Creating a test file for this is quite straight-forward in OpenSCAD (code courtesy of Triffid Hunter[15], see the thread (OpenSCAD) machinist's diamond-circle-square test for a tutorial on the ShapeOko wiki for further discussion and notes on how the file shows good working practices):
$fa = 0.01; // allow $fs to work correctly $fs=0.5; // segment length of circle circumference r_square = 50; r_circle = 45; r_diamond = 40; l_height = 3; translate([0, 0, l_height * 0.5]) { cube([r_square,r_square,l_height], center=true); #linear_extrude(height=l_height * 1.5) circle(r=r_circle/2); cylinder(r=r_diamond/2, h=l_height * 2.5, $fn=4); }
Peter Falke provided a nice example as well [16].
The file may then be (Design | ) "Compile and Render"ed to prepare it for exporting as a .stl
file which may then be processed in a CAM program for machining as described in Basic workflow 3D
Tutorials
- http://blog.cubehero.com/2013/11/19/know-only-10-things-to-be-dangerous-in-openscad/
- 3D Printering: Making A Thing With OpenSCAD
- How to use Openscad --- lengthy tutorial w/ several parts covering how to use OpenSCAD "properly" so as to create parametric parts.
- http://www.tridimake.com/2014/09/how-to-use-openscad-tricks-and-tips-to.html
- http://www.tridimake.com/2014/09/howto-openscad-variables-modules-parametric-designs.html
- http://www.tridimake.com/2014/11/howto-openscad-iteration-extrusion.html
- http://www.tridimake.com/2014/11/how-to-use-openscad-4-children-and.html
- http://edutechwiki.unige.ch/en/OpenScad_beginners_tutorial
- https://peak5390.wordpress.com/2013/01/08/an-introduction-to-3d-modeling-with-openscad-openscad-basics/ [17]
http://forum.openscad.org/How-to-make-this-parametric-code-td18352.html
References
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language