Skip to content

Instantly share code, notes, and snippets.

@madeindjs
Created October 14, 2016 14:59
Show Gist options
  • Save madeindjs/6d1fbfcca2264cbbc73178c7ee63f212 to your computer and use it in GitHub Desktop.
Save madeindjs/6d1fbfcca2264cbbc73178c7ee63f212 to your computer and use it in GitHub Desktop.
Sketchup script to quickly change colors on many Sketchup::ComponentInstance
# search all Sketchup::ComponentInstance included partial_name and apply a material
def apply_material_on_all_instance material_name, partial_name
material = Sketchup.active_model.materials[material_name]
Sketchup.active_model.definitions.each{|d| 
if d.name.include? partial_name
puts d.name
d.instances.each{ |inst|
inst.material = material
puts "\tinstance colored"
}
end
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment