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!
🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
Component definition name
-
Hi,
How to get the definition name from a selected component?
I tried the code below, assuming only one component selected which is correct. But this returns just the name not the definition name which is set when the component is created.model = Sketchup.active_model; selection = model.selection componentdef = selection[0] UI.messagebox(componentdef.name) -
You are making a reference to an Instance not a Definition.
An Instance can have a name separate from its Component's name...
Do it this waymodel = Sketchup.active_model; selection = model.selection component_instance = selection[0] component_definition = component_instance.definition ci_name = component_instance.name cd_name = component_definition.name ### to be clever count the instances too ;) num = component_definition.instances.length.to_s UI.messagebox("Component Definition Name = "+cdname+"\nComponent Instance Name = "+ciname+"\nThere are "+num+" Instances.") -
Works great, thanks.
Advertisement