Class: CrystalScad::Import
- Inherits:
-
Primitive
- Object
- CrystalScadObject
- Primitive
- CrystalScad::Import
- Defined in:
- lib/crystalscad/CrystalScad.rb
Instance Attribute Summary
Attributes inherited from Primitive
Attributes inherited from CrystalScadObject
Instance Method Summary collapse
-
#initialize(args) ⇒ Import
constructor
A new instance of Import.
- #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(args) ⇒ Import
Returns a new instance of Import.
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'lib/crystalscad/CrystalScad.rb', line 392 def initialize(args) @transformations = [] @children = [] if args.kind_of? String filename = args else # assume hash otherwise filename = args[:file] @layer = args[:layer] end # we need to convert relative to absolute paths if the openscad output is not in the same directory # as the crystalscad program. @filename = File.(filename) 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
409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/crystalscad/CrystalScad.rb', line 409 def to_rubyscad layer = "" if @layer layer = ",layer=\"#{@layer}\"" end res = self.children.map{|l| l.walk_tree} if res == [] res = "" end res += RubyScadBridge.new.import("file=\""+@filename.to_s+"\"#{layer}") # apparently the quotes get lost otherwise res end |