Here is an example of a script file (sourced from en.wikibooks.org/wiki/OpenSCAD_User_Manual/First_Steps):
difference() {
cube(30, center = true);
sphere(20);
}
translate([0, 0, 30]) {
cylinder(h=40, r=10);
}
Objects are created at the origin, and then are translated into position. In the code above, the 30x30x30 cube is centered on the origin (0,0,0); if center = false, it would be located in the first octant (lower left corner of the box is at 0,0,0). Cubes also create rectangular boxes.
Other objects, such as the 20-unit sphere, are always centered on the origin. The 10x40 cylinder is moved up to 0,0,30. Cylinders also create cones.
Also available are other transformations (rotate, scale, etc), Booleans, and calculations, such as trig, vector and scalar math. The debug modifier (#) renders removed objects in transparent pink, useful for debugging.
Extrusions
A second modeling method is available: OpenSCAD reads DXF files, and then applies extrusions (thickness) to 2D objects. (The program also reads and writes STL and OFF files.)
What is the good of a script-driven CAD system? It externalizes the history, aka the designer's intent. The drawback to all history-based CAD systems (starting with Pro/E onwards) is that the history is proprietary, internal to the model, and cannot be exported.
Through using scripts, the "history" becomes open, external to the model, easily shared.
openscad.org
This reminds me of the early Knowledge-Based Engineering (KBE) systems like ICAD which were based on Lisp. Same thing, the models created were used to capture the intent. Interesting product.
Posted by: Dave | Dec 29, 2009 at 05:37 AM
Ralph this isn't new. The original solid modelling systems used to run via command line entry like this on mainframes. I did my university thesis on ROMULUS building a car suspension system like this - over the space of several months, overnight, back in 1986. I really don't "get" the relevance of this approach today. Besides this is what all solid modelling systems do "under the hood".
Posted by: Kevin Quigley | Dec 29, 2009 at 03:02 PM