Struct scad_generator::ScadObject
[−]
[src]
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.
//Create the parent let mut obj = ScadObject::new(ScadElement::Union); //add some children obj.add_child(ScadObject::new(ScadElement::Cube(vec3(1., 1., 1.)))); //...Run
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.
Methods
impl ScadObject
[src]
fn new(element: ScadElement) -> ScadObject
fn add_child(&mut self, statement: ScadObject)
fn get_code(&self) -> String
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.
fn is_important(&mut self)
Marks the object as important. This will prepend the object code with an ! which tells scad to only render that object and its children.
Trait Implementations
impl Clone for ScadObject
[src]
fn clone(&self) -> ScadObject
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more