How do I do this?
-
I have basically figured out how to load a "ruby"
but I do not know how to deal with this kind of text, it comes in not in a folder or an icon, so I got this text.
what to do with it?tt_remove_material.rb
#-----------------------------------------------------------------------------
Version: 1.1.0
Compatible: SketchUp 7
#-----------------------------------------------------------------------------
Removes a given material for a selection.
#-----------------------------------------------------------------------------
Changelog
1.0.0 - 04.03.2009
* Remove Material
1.1.0 - 16.03.2009
* Remove All Materials
* Remove Edge Materials
#-----------------------------------------------------------------------------
Thomas Thomassen
thomas[at]thomthom[dot]net
#-----------------------------------------------------------------------------
require 'sketchup.rb'
#-----------------------------------------------------------------------------
Add some menu items to access this
if( not file_loaded?('tt_remove_material.rb') )
plugins_menu = UI.menu('Plugins')
sub = plugins_menu.add_submenu('Remove Materials')
sub.add_item('Specific From Selection') { TT_Remove_Material::remove() }
sub.add_item('From Entire Model') { TT_Remove_Material::remove_all() }
sub.add_item('From All Edges') { TT_Remove_Material::remove_edge_materials() }
end
#-----------------------------------------------------------------------------
file_loaded('tt_remove_material.rb')
#-----------------------------------------------------------------------------module TT_Remove_Material
def self.remove # Variables model = Sketchup.active_model sel = model.selection definitions = [] # Prompt for material to remove materials = [] model.materials.each { |m| materials.push(m.name) } materials = materials.join('|') prompts = ['What material to remove?'] defaults = ['Enter name'] results = UI.inputbox(prompts, defaults, [materials], 'Remove material.') if results == nil return else material = model.materials[ results[0] ] end Helping_Hand.start_operation('Remove Material') # Iterate entities sel.each { |e| if e.kind_of?(Sketchup::ComponentInstance) || e.kind_of?(Sketchup::Group) parent = e.definition if e.kind_of?(Sketchup::ComponentInstance) parent = e.entities.parent if e.kind_of?(Sketchup::Group) next if definitions.include?(parent) parent.entities.each { |ents| # Remove material ents.material = nil if ents.material == material if ents.kind_of?(Sketchup::Face) ents.back_material = nil if ents.back_material == material end } definitions.push(parent) else e.material = nil if e.material == material if e.kind_of?(Sketchup::Face) e.back_material = nil if e.back_material == material end end } model.commit_operation end def self.remove_all # Variables model = Sketchup.active_model Helping_Hand.start_operation('Remove All Materials') # Iterate entities model.entities.each { |e| e.material = nil if e.kind_of?(Sketchup::Face) e.back_material = nil end } model.definitions.each { |d| d.entities.each { |e| e.material = nil if e.kind_of?(Sketchup::Face) e.back_material = nil end } } model.commit_operation end def self.remove_edge_materials # Variables model = Sketchup.active_model Helping_Hand.start_operation('Remove Edge Materials') # Iterate entities model.entities.each { |e| if e.kind_of?(Sketchup::Edge) e.material = nil end } model.definitions.each { |d| d.entities.each { |e| if e.kind_of?(Sketchup::Edge) e.material = nil end } } model.commit_operation end ### HELPER METHODS ### --------------------------------------------------- module Helping_Hand def self.start_operation(name) model = Sketchup.active_model # Make use of the SU7 speed boost with start_operation while # making sure it works in SU6. if Sketchup.version.split(".")[0].to_i >= 7 model.start_operation(name, true) else model.start_operation(name) end end end # module Helping_Handend
-
sometimes the rubies come in like that when downloading (that's the actual writing)
try right clicking on the link and choose 'download linked file'..
you'll get a file whos icon will look like a .txt file...

drop that into:
macintosh HD/library/application support/google sketchup 7/sketchup/pluginsrestart sketchup and the ruby will load
-
Thanks again Guys,
I spent most of the day trying to sort this out, 9:51pm, finally seem to have something I can send my engineer that works.
I did not have a "download linked file" options, tried a few things, and finally out of frustration tried, once again to drag if from the downloads folder to the suggested location, I got a "not authorized to modify SU" notice or something like that...but after giving my password, it seemed to have worked.
thanks for your insights and perspectives.I do hope this is not a "typical SU' situation.
aloha
red -
What browser do you use?
If you end up with the pure text of a ruby, you can, from the browser, so a Save As, and save it into your plugin folder. But make note of what the file name should be. -
When I download a plugin, whether .zip or .rb, while in Firefox, I right click on the target, a context menu pops up with "Save link as.." option. I default the destination to desktop so that I can distribute to both SU6 and SU7. Occasionally, I have seen where it transfers as a .php or a .txt--why? I don't know. I just dump these and retry the transfer.
-
You get .php some times because the link goes to a PHP script which redirects you to the download. When that happens you have to link the link instead of Save As.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement