Unique Groups
-
I am trying to figure out the behaviour of the "Unique" function. When I have a component that is composed of a number of groups and I make one of these component instances unique, then I edit the component and select one of the groups, it then will say something like: "Solid Group (11 in model)".
How do I make sure that the groups within a component are also unique?
-
Get a reference to each group, then check if it has multiple instances, if so make them unique...
For example...groups.each{|group| d = group.entities.definition if d.instances[1] ### i.e. more than one instance d.instances[1..-1].each{|i| i.make_unique } end } -
I thought groups were always unique. Right clicking a component allows you to make it unique, however the same option does not appear for a group. The weird thing is if you select a group that has multiple instances and a component and then right click and select unique this will also make the group unique, strange.
-
Groups are just a special sort of component-instance.
A group's definition doesn't appear in the Component Browser.
Groups should be unique... but...
You can have multiple instances of a group.
To do it manually just copy a group several times...
Select one and Entity Info shows several instances.
But if you then edit a copied group, it becomes unique automatically - unlike a component.
So the make_unique method applied to a group [instance] is the same same as editing that group [which is not possible within the API otherwise].
Of course it also works with component-instances, just like the 'make_unique' tool within the context-menu.Incidentally, definitions can either be usual 'vanilla' Components, or Groups [as outlined above], OR Images...
The definition.group? and definition.image? methods are there to help you determine the type of definition it is... -
Groups are implemented as a special case of Components. They add some convenience methods that expose some aspects of the associated ComponentDefinition, and also a "lazy uniqueness" mechanism. By that I mean that when you copy a Group, it behaves just like a Component does - another instance is added to the ComponentDefinition. Only when you perform some action on that requires it to be unique does SketchUp clone a second ComponentDefinition and wire the Group to it (same thing as the make_unique method does). Any other copies remain associated with the original ComponentDefinition until you also alter them. For Group copies, it is a one-at-a-time thing.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement