[OpenSCAD] FIlling gaps between complex hollow objects
arnholm at arnholm.org
Tue Jan 2 15:39:03 EST 2018
On 02. jan. 2018 15:19, Troberg wrote:
> That I agree with. I find it endlessly frustrating that I can't just do
> something like:
> and then later, after it's been moved around and all that do a:
> Or, stuff like my parts list. Since variables are kind of wonked compared to
> other languages, I have to echo a line for each part, then copy the echo
> output to another program I wrote which parses it and sums things up.
> I've been thinking a lot about encapsulating the 3D markup in some framework
> Rexx, but I haven't got around to actually doing anything.
I guess this is the recurring talk about the functional language in
OpenSCAD. The features you describe imply a procedural language. I have
had similar ideas regarding use of a scripting language. Your example
can be expressed as below using my AngelScript* implementation.
*AngelScript is a procedural language with strong types
The @ notation refers to "object handles".
solid@ sph = translate(200,300,400)*sphere(r:50);
sphere@ s = cast<sphere@>(sph);
pos3d@ c = s.box().center();
cylinder(r:s.radius(),h:1000) + s;
It may be possible to eliminate the second line to make it more compact,
but this runs as shown now creating an explicit union of a cylinder and
the given sphere 's', much like you explained.
The attached OpenSCAD file was generated from the above script.
-------------- next part --------------
// This file was created using AngelCAD (as_csg) v1.0-04
// Copyright(C) 2015-2018 Carsten Arnholm, http://arnholm.org/
// Open it with OpenSCAD for display or further processing
$fn = 60;
$fa = 6.0;
$fs = 1.0;
cylinder( r1=50, r2=50, h=1000, center=false );
sphere( r=50 );
More information about the Discuss