Please write help me set funtion outer shell with component “obj” use Ruby code
Untitled.skp (176.7 KB)
I am very grateful for your help
Please write help me set funtion outer shell with component “obj” use Ruby code
OuterShell is a boolean operation that requires two (2) objects …
obj = Sketchup.active_model.selection.first
obj.outer_shell(obj2)
Both groups must be manifold (watertight) solids, otherwise the operation will do nothing.
REF: Class: Sketchup::Group — SketchUp Ruby API Documentation
If there is no other way, please help me write code to scan the groups and outer shell in turn,
You need to at least TRY. (I am not going to write your extension for you.)
Post failing code so we can help you see any errors.
AND … be more specific about what you need code to do.
If you cannot explain well in English, then use Google Translator to make English questions.
I did it
def self.remove_subcomps(definition)
definition.entities.each{|e|
if e.is_a?(Sketchup::Group)
self.comp_to_group(e)
elsif e.is_a?(Sketchup::ComponentInstance)
self.comp_to_group(e)
end#if
}
end#def
def self.comp_to_group(inst)
inst.explode
end #def
model = Sketchup.active_model
entities = model.active_entities
gg = entities.find_all {|ent| ent.name == ‘Obj’ }
gg.each { |a|
self.remove_subcomps(a.definition)
}
Please edit the post above and correctly delimit the code block. See …