sketchucation logo sketchucation
    • Login
    ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

    Plugin to make all components in model unique?

    Scheduled Pinned Locked Moved Plugins
    6 Posts 4 Posters 484 Views
    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.
    • D Offline
      danbig
      last edited by

      Hi -

      Is there a plugin that will make all components unique?

      I"m not looking for a fix where I have two different components that share the same name, but I'm looking for something that will make all instances of the same component unique.

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        Hmm, I cant think of one off the top of my head.

        It would be a great script for someone to write who is trying to learn ruby....'eh Dan?? πŸ˜„

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • D Offline
          danbig
          last edited by

          @chris fullmer said:

          Hmm, I cant think of one off the top of my head.

          It would be a great script for someone to write who is trying to learn ruby....'eh Dan?? πŸ˜„

          Who? Me?

          Agreed. Haha. I'm still working on script #1, which hasn't progressed much for the last few months.

          Interestingly, Fredoscale has a utility built in that makes all selected instances of a component unique. TIG also posted a snippet that does the same, but I had a hard time getting it to work.

          1 Reply Last reply Reply Quote 0
          • M Offline
            mac1
            last edited by

            Check out make_components by Matthieu Noblet. It has a minor bug. You have to include a line in the selection

            1 Reply Last reply Reply Quote 0
            • honoluludesktopH Offline
              honoluludesktop
              last edited by

              Place in plugin folder, open Ruby Console, and type alluinque [enter] in the command window:

              def allunique
                model = Sketchup.active_model
                entities = model.entities
                entities.each do |e|
                  if e.is_a? Sketchup;;ComponentInstance
                     e.make_unique
                  end
                end
              end
              
              1 Reply Last reply Reply Quote 0
              • D Offline
                danbig
                last edited by

                Hi Honolulu -

                Thanks a million for this script. This is exactly what I needed. It's nice that this isn't recursive, which fits the workflow nicely for what I'm using this for.

                I've edited the script slightly, to make it operate on just the selected components. (Chris, you'll be very proud...)

                Same instructions for use, but select the components you wish to make unique first, then type "allsunique" into the console and hit enter.

                def allsunique
                  model = Sketchup.active_model
                  selection = model.selection
                  selection.each do |e|
                    if e.is_a? Sketchup;;ComponentInstance
                       e.make_unique
                    end
                  end
                end
                
                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement