sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    [REQ] Component 'Name' Stripper

    Scheduled Pinned Locked Moved Plugins
    11 Posts 3 Posters 382 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.
    • sdmitchS Offline
      sdmitch
      last edited by

      bmike, no plugin needed just a single statement entered in the Ruby Console will do the trick.

      Sketchup.active_model.entities.each{|e| e.name='' if e.is_a?(Sketchup;;ComponentInstance)}
      
      

      Will remove any Name assigned to a component instance. The Definition Name can be changed but not erased.

      Nothing is worthless, it can always be used as a bad example.

      http://sdmitch.blogspot.com/

      1 Reply Last reply Reply Quote 0
      • bmikeB Offline
        bmike
        last edited by

        @sdmitch said:

        bmike, no plugin needed just a single statement entered in the Ruby Console will do the trick.

        Sketchup.active_model.entities.each{|e| e.name='' if e.is_a?(Sketchup;;ComponentInstance)}
        > 
        

        Will remove any Name assigned to a component instance. The Definition Name can be changed but not erased.

        Thanks, will give it a go!
        I don't want to mess with the definition name - but I get into trouble when someone sends me a drawing with 100 'Posts' in it, an 80 of them are different from each other. Exports out to materials lists wrong.

        Is there a way to 'plugin'ize this so that I can pull it down from a menu, as opposed to keeping a bit of text handy?

        mike beganyi design + consulting llc

        1 Reply Last reply Reply Quote 0
        • sdmitchS Offline
          sdmitch
          last edited by

          Copy this code and paste into a pure text editor program,ie Notepad, and save
          it to the Sketchup Plugins folder. Execute it by choosing Name Stripper from
          the plugins menu.

          #
          require 'Sketchup'
          #
          if not file_loaded?(File.basename(__FILE__))
            UI.menu('Plugins').add_item('Name Stripper') { Component_Name_Stripper.doit }
            file_loaded(File.basename(__FILE__))
          end
          #
          module Component_Name_Stripper
            def self.doit
              Sketchup.active_model.entities.each{|e| e.name='' if e.is_a?(Sketchup;;ComponentInstance)}
            end
          end
          
          

          Nothing is worthless, it can always be used as a bad example.

          http://sdmitch.blogspot.com/

          1 Reply Last reply Reply Quote 0
          • bmikeB Offline
            bmike
            last edited by

            Thank you!

            I'll give it a go. Was just thinking about taking apart another .rb so I could tinker with it.

            mike beganyi design + consulting llc

            1 Reply Last reply Reply Quote 0
            • bmikeB Offline
              bmike
              last edited by

              Did that, and this is what I get:

              Error Loading File namestripper.rb
              undefined method ` ' for main;Object
              

              mike beganyi design + consulting llc

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                Looks like you have a ` rather than a ' somewhere in the code 😕
                You must use a plain-text editor - like Notepad.exe.
                It can't be a wordprocessor because that will/could 'format' text breaking the tight syntax required by Ruby...
                Simple select all of the code and copy its text from the code-pane and paste into the empty file...

                TIG

                1 Reply Last reply Reply Quote 0
                • bmikeB Offline
                  bmike
                  last edited by

                  Hmm. Pasted it into TextEdit on the Mac. Will try something else.

                  mike beganyi design + consulting llc

                  1 Reply Last reply Reply Quote 0
                  • TIGT Offline
                    TIG Moderator
                    last edited by

                    Here's the code in a .rb - compare it with yours...
                    Test both in turn in the Plugins folder, with a restart...


                    namestripper.rb

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • bmikeB Offline
                      bmike
                      last edited by

                      Thanks Tig!

                      Here's what I get when I pated them both into TextEdit on the Mac:

                      TIG;
                      
                      require 'Sketchup'
                      if not file_loaded?(File.basename(__FILE__))
                          UI.menu('Plugins').add_item('Name Stripper') { Component_Name_Stripper.doit }
                          file_loaded(File.basename(__FILE__))
                      end
                      module Component_Name_Stripper
                          def self.doit
                              Sketchup.active_model.entities.each{|e| e.name='' if e.is_a?(Sketchup;;ComponentInstance)}
                          end
                      end
                      
                      
                      Original;
                      
                      #
                      require 'Sketchup'
                      #
                      if not file_loaded?(File.basename(__FILE__))
                        UI.menu('Plugins').add_item('Name Stripper') { Component_Name_Stripper.doit }
                        file_loaded(File.basename(__FILE__))
                      end
                      #
                      module Component_Name_Stripper
                        def self.doit
                          Sketchup.active_model.entities.each{|e| e.name='' if e.is_a?(Sketchup;;ComponentInstance)}
                        end
                      end
                      

                      mike beganyi design + consulting llc

                      1 Reply Last reply Reply Quote 0
                      • bmikeB Offline
                        bmike
                        last edited by

                        Your copy is working fine directly placed in my Plugins folder... so, Thanks!

                        mike beganyi design + consulting llc

                        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