pub struct ScadObject { /* fields omitted */ }
An scad object which is a single scad element and can have zero or more child objects
#How it works
An scad object is a single ScadElement
optionally followed by any number of child
objects. This represents the following scad code:
translate([1,2,3]) //parent
{
cube([3,5,1]); //Child
//...
}
Without using the scad!
macro, you would create an scad object by doing the
following.
let mut obj = ScadObject::new(ScadElement::Union);
obj.add_child(ScadObject::new(ScadElement::Cube(vec3(1., 1., 1.))));
This would be quite tedious to type each time you want to create a new object
which is why the scad!
macro exists. This does mean that if you want to add
more children to an scad object created by the macro, you can simply use the
add_child
function on the result of the macro.
Returns the scad code for the object.
If there are no children, only the code for the ScadElement of the
object followed by a ;
is returned. If children exist, the code for
the element is returned first, followed by the code for each child surrounded
by {}
and indented 1 tab character.
Marks the object as important. This will prepend the object code
with an ! which tells scad to only render that object and its children.
Takes ownership over the object, marks it as important and returns it.
Usefull if you want to mark something as important without having to
change the binding to mut
Performs copy-assignment from source
. Read more