I’ve been using a component definition to generate various solids that I move with a transform and instantiate. I wanted to do this for extruding a face, but am having problems.
For solids, I define a component that creates a face and pushpull’s it into a solid. I then add_instance the definition with a transform to put it where I want it.
What I tried to do to extrude a face was to make a component that just makes a face (add_face). I then add_instance it with a transform. I then try a followme on it to extrude, but the instance doesn’t seem to be a vanilla face anymore. I now see it as a “ComponentInstance”, not real surprising. I tried various ways of extracting the raw face but can’t. Any guidance on how to extrude it? Code below. Thanks.
def self.create_component_definition_molding() @componentDefinitionMoldingfirstname.lastname@example.org "molding" moldingFace = @componentDefinitionMolding.entities.add_face [0, 0, 0], [1, 0, 0], [3, 0, 2],[8,0,4],[8,0,5],[7,0,5],[0,0,2],[0,0,0] end # Draw top/trim molding # Create a molding face self.create_component_definition_molding() @transform=Geom::Transformation.new([128,18,94]) moldingFaceemail@example.com_instance(@componentDefinitionMolding,@transform) UI.messagebox("moldingFace type: " + moldingFace.typename) # Create the extrusion path path = @entities.add_edges [128,18,94],[128,6.75,94],[0,6.75,94] # Extrude the molding along the rectangular path moldingFace.explode.entities.face.followme path (line 426)
This results in:
Error:NoMethodError: undefined method
entities' for #<Array:0x0000000cc55c90>> C:/users/gkd/sketchuprubyscripts/shelfUnitAnthony.1.rb:426:inmodule:Shelving’
C:/users/gkd/sketchuprubyscripts/shelfUnitAnthony.1.rb:12:in `<top (required)>’
Update: Looks like you can’t “explode” in place, since changing the last line to the 2 below seems to work as expected:
array=moldingFace.explode array.followme path