Is there a quick trick to nesting an existing single Group into a New Component?
Fundamentally I am using Profile Builder and I need to preserve the Assembly (Group). I need the Component for my BIM workflow.
If I use Convert Group to Component the Grouping is lost. I need to keep the Group so I can come back later and add details / or other Groups to the Component. I can get around it by duplicating the group, making the component and then deleting the copy, but that doesn’t feel very efficient.
This quick plugin, will give you a context menu: “Wrap Group into component” if you right click on a group. There shouldn’t be any other object selected otherwise you wont get the context menu.
A nesting component definition name will be as the original group name + “-nest”. (E.g. if the group name is “mygroup” the component definition will be “mygroup-nest”, it there is no name of group, it will be “-nest” ).
You can undo it.
module Dezmo
module WrapGroupToComponent
extend self
@@loaded = false unless defined?(@@loaded)
def wrap_to_comp(group)
model = Sketchup.active_model
entities = model.active_entities
model.start_operation("Wrap Group into component", true)
wrap_group = entities.add_group(group)
wrap_instance = wrap_group.to_component
wrap_instance.definition.name = group.name+"-nest"
model.commit_operation
end
def sel_group
sel = Sketchup.active_model.selection
if sel.single_object? && sel.first.is_a?(Sketchup::Group)
return sel.first
end
nil
end
unless @@loaded
UI.add_context_menu_handler{|context_menu|
if sel_group
context_menu.add_item("Wrap Group into component"){
wrap_to_comp(sel_group)
}
end
}
@@loaded = true
end
end
end
Without extensions or plug ins - create your new component, select the group, CMD X the group to delete it (temporarily), open the new component for editing, paste in place the group, close the component edit and you have a nested group inside the component.