I have made a DC which has a Material embedded within in, which was assigned to both a hidden Face and also to the single Instance of the DC in the creation model before I saved the Component out. The DC has the canned “Material” attribute set to the name of that Material.
When I load this DC (Sketchup.active_model.definitions.load ) into a completely empty scene, both the Component and the Material appear in their respective browser dialogs, as expected.
When I instance the Component for the first time, the Material appears to be attached to the Instance, which is what I want to happen every time.
However, when I instance it a second time, the Instance Material is nil, although the Component Options dialog still shows the material name. I have to type a different Material name (e.g. “red”) into that attribute, at which point that Material is attached to the Instance (and created first, if it doesn’t already exist).
The Component Options dialog only updates to show the correct Material for each Instance if there is actually a Material attached, but retains the name of the Material of the previously visited Instance if you pick one which has no Material attached, the dialog is therefore misleading.
How can I make an Instance always have that Material attached when created?
This is all within the context of a custom Extension, so presumably I could do some kind of Observer trickery to spot the new Instance and make it good, but I’d really rather not have to.
Thanks in advance.