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
#save, #walk_tree, #walk_tree_classes
Constructor Details
#initialize(object, attributes) ⇒ CSGModifier
Returns a new instance of CSGModifier.
477 478 479 480 481 |
# File 'lib/crystalscad/CrystalScad.rb', line 477 def initialize(object, attributes) @transformations = [] @children = [object] @attributes = attributes end |
Instance Method Details
#to_rubyscad ⇒ Object
483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
# File 'lib/crystalscad/CrystalScad.rb', line 483 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 |