[][src]Struct scad::ScadObject

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.))));
//...

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]

pub fn new(element: ScadElement) -> ScadObject[src]

pub fn add_child(&mut self, statement: ScadObject)[src]

pub fn get_code(&self) -> String[src]

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.

pub fn is_important(&mut self)[src]

Marks the object as important. This will prepend the object code with an ! which tells scad to only render that object and its children.

pub fn important(self) -> ScadObject[src]

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

Trait Implementations

impl Clone for ScadObject[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>,