• Login
sketchucation logo sketchucation
  • Login
ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

Making identical groups into a shared component.

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 2 Posters 739 Views 2 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.
  • A Offline
    Al Hart
    last edited by 10 May 2011, 11:54

    I have a SpaceDesign client who would like a script to convert groups to components, but thinks it would be handy if copied groups all became the same component.

    @unknownuser said:

    Group Copies eg if 4 of same Group already exists, becomes 1 Component (with 4 Copies).

    Any ideas how I am going to know that copies of a group are the same. This seems like a lot of work.

    Or is this just a pipe dream?

    Al Hart

    http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
    IRender nXt from Render Plus

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 10 May 2011, 12:48

      If the group has not been edited after it's been copied then it's very easy as the group instances all share the same component definition. Selection Toys allow you to do this conversion.

      When you select a group that's been copied you can see in the Entity Info window how many copies there are. If it reports more than one then you're in luck - things are easy to replace.

      If the groups are considered unique then it's more trouble. I began on a script that compared groups and components based on their geometric appearance. http://forums.sketchucation.com/viewtopic.php?f=323&t=30143&p=264517
      Unfortunately I've not had time to work on it and there's currently lots of bugs and limitations. (For instance, it doesn't deal with nesting.)

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • A Offline
        Al Hart
        last edited by 10 May 2011, 13:10

        Very interesting thomthom.

        How to find the groups which can be made into the same component?

        I do not see how to get to the "definition" of a group. (Much less how to find all the groups which use this same definition)

        I see there is a .equals? operator on a group which will let me determine if two groups are identical.

        So I suppose I just need to check all other top level groups to see which are identical, and then create the component, and then replace all the groups with the new component.

        Al Hart

        http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
        IRender nXt from Render Plus

        1 Reply Last reply Reply Quote 0
        • A Offline
          Al Hart
          last edited by 10 May 2011, 13:20

          I see you have addressed the "Definition of a group" in another thread: http://forums.sketchucation.com/viewtopic.php?f=180&t=19765

          It looks like I may have some luck using:

          definition = group.entities.parent

          to get the definition, and

          definition.instances

          to locate the groups which use the same definition.


          My client mentioned there was already a ruby to convert groups to components. Did you write it, or do you, (or anyone), know where it is?

          [Edit: It looks like I am looking for: Selection Toys. I will try to find it]

          Al Hart

          http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
          IRender nXt from Render Plus

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

          Advertisement