[REQ] Component 'Name' Stripper
- 
 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. 
- 
 @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? 
- 
 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
- 
 Thank you! I'll give it a go. Was just thinking about taking apart another .rb so I could tinker with it. 
- 
 Did that, and this is what I get: Error Loading File namestripper.rb undefined method ` ' for main;Object
- 
 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...
- 
 Hmm. Pasted it into TextEdit on the Mac. Will try something else. 
- 
 Here's the code in a .rb - compare it with yours... 
 Test both in turn in the Plugins folder, with a restart...
 
- 
 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
- 
 Your copy is working fine directly placed in my Plugins folder... so, Thanks! 
Advertisement



 
                             
                             
                             
                             
                             
                             
                            