[−][src]Struct scad::ScadObject
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]
fn clone(&self) -> ScadObject
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl Send for ScadObject
impl Sync for ScadObject
impl Unpin for ScadObject
impl UnwindSafe for ScadObject
impl RefUnwindSafe for ScadObject
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,