Yes, this is possible. There is this kind of operator syntax, where you use
children() to refer to one or more (then curly bracketed) operands.
eps = 0.01;
inset_width = 0.3;
inset_height = 0.2;
// An arbitrary part wich is placed at z=0.
module my_part() {
difference() {
translate([-5, -5, 0]) cube([10, 10, 5]);
cube([6, 6, 20], center=true);
}
}
// The arbitrary part with first layer inset.
module my_part_with_first_layer_inset() {
difference() {
children(0); // <<==== pass this as an arg
cube([100, 100, 2*inset_height], center=true);
}
linear_extrude(height=inset_height+eps)
offset(r = -inset_width)
projection(cut=true)
my_part(); // <<==== pass this as an arg
}
my_part_with_first_layer_inset() my_part();
--
View this message in context: http://forum.openscad.org/Passing-objects-as-arguments-tp19877p19883.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Parkinbot wrote
Yes, this is possible. There is this kind of operator syntax, where you
use
children() to refer to one or more (then curly bracketed) operands.
Thanks Parkinbot. I think this is what I am looking for.
Is there a way to get the min z value of children() ?
BTW, I went through the cheatsheet but completely missed the intended usage
of this function. I propose to emphasize in the cheatsheet the operator
module capability of the language.
--
View this message in context: http://forum.openscad.org/Passing-objects-as-arguments-tp19877p19897.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
zapta wrote
Is there a way to get the min z value of children() ?
no, there is no function for this. Due to its declarative character OpenSCAD
is not designed to query information on objects. OpenSCAD uses CSG for
preview (F5) and CGAL for final rendering (F6). As a CSG representation is
interpreted by the graphics subsystem only, there is no explicit
representation structure that could be queried. In principle this
information could be retrieved by executing an intermediate render(), which
passes the object to CGAL and returns a querable representation. Even this
functionality as well as simpler ones like boundaryboxes of imported objects
or the need to get hands on the triangles and points of an STL import are
frequently discussed in this forum, no such "progress" is in sight.
BTW, I went through the cheatsheet but completely missed the intended
usage of this function. I propose to emphasize in the cheatsheet the
operator module capability of the language.
I'd say it is one of the advanced concepts of OpenSCAD. The help text behind
children() is very informative, but you have to read it well. Usually people
stumble over it, reading other peoples code. There is also a tips and
tricks collection
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Tips_and_Tricks where
you can find things like that.
--
View this message in context: http://forum.openscad.org/Passing-objects-as-arguments-tp19877p19904.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hi,
The best practical explanation on children() I found, was at:
http://www.tridimake.com/2014/11/how-to-use-openscad-4-children-and.html
http://www.tridimake.com/2014/11/how-to-use-openscad-4-children-and.html
The blog http://tridimake.com http://tridimake.com is very interesting
also.
Cheers!
--
View this message in context: http://forum.openscad.org/Passing-objects-as-arguments-tp19877p19907.html
Sent from the OpenSCAD mailing list archive at Nabble.com.