Class: CrystalScad::CSGModifier
- Inherits:
-
Primitive
- Object
- CrystalScadObject
- Primitive
- CrystalScad::CSGModifier
- Defined in:
- lib/crystalscad/CrystalScad.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Primitive
Attributes inherited from CrystalScadObject
Instance Method Summary collapse
-
#initialize(object, attributes) ⇒ CSGModifier
constructor
A new instance of CSGModifier.
- #to_rubyscad ⇒ Object
Methods inherited from Primitive
#mirror, #rotate, #rotate_around, #scale, #transform, #translate, #union
Methods inherited from CrystalScadObject
#method_missing, #save, #walk_tree, #walk_tree_classes
Constructor Details
#initialize(object, attributes) ⇒ CSGModifier
Returns a new instance of CSGModifier.
453 454 455 456 457 |
# File 'lib/crystalscad/CrystalScad.rb', line 453 def initialize(object, attributes) @transformations = [] @children = [object] @attributes = attributes end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CrystalScad::CrystalScadObject
Instance Method Details
#to_rubyscad ⇒ Object
459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/crystalscad/CrystalScad.rb', line 459 def to_rubyscad # Apparently this doesn't work for CSGModifiers, like it does for other things in RubyScad? # also this is a dirty, dirty hack. @attributes = @attributes.gsub("fn","$fn").gsub("$$","$") ret = "#{@operation}(#{@attributes}){" @children ||= [] @children.each do |child| begin ret +=child.walk_tree rescue NoMethodError end end ret +="}" end |