Class: CrystalScad::CSGModifier

Inherits:
Primitive show all
Defined in:
lib/crystalscad/CrystalScad.rb

Direct Known Subclasses

Color, LinearExtrude, Projection, RotateExtrude

Instance Attribute Summary

Attributes inherited from Primitive

#children

Attributes inherited from CrystalScadObject

#args, #transformations

Instance Method Summary collapse

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_rubyscadObject



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