• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Unique Groups

Scheduled Pinned Locked Moved Developers' Forum
5 Posts 3 Posters 533 Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    medeek
    last edited by 3 Sept 2016, 19:05

    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?

    Nathaniel P. Wilkerson PE
    Medeek Engineering Inc
    design.medeek.com

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 3 Sept 2016, 19:45

      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
      }
      
      

      TIG

      1 Reply Last reply Reply Quote 0
      • M Offline
        medeek
        last edited by 3 Sept 2016, 20:31

        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.

        Nathaniel P. Wilkerson PE
        Medeek Engineering Inc
        design.medeek.com

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 3 Sept 2016, 21:01

          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...

          TIG

          1 Reply Last reply Reply Quote 0
          • S Offline
            slbaumgartner
            last edited by 7 Sept 2016, 18:35

            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.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              4/5
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement