Material not in model, DC error
-
Hi everyone,
I'm not new to Sketchup but have recently decided to try and start creating some dynamic components.
I design wine cellars for a living and have various models that I use repeatedly which I would like to change the material of by selecting an option.
Thought it would be simple but I'm struggling.
I've created two custom materials ''Oak main & Walnut main" which I would like to apply to a various components. When I try to add the material attribute in dynamic options I keep getting the error ''#=Material not in model:Walnut main" which is confusing as I have added it, the component is covered in it!I'm probably being really stupid and the answer is looking me in the face but if anyone can offer some advice or help I would really appreciate it.
Thank you
mitch7780 -
To ensure the DC 'ships' with the desired materials you need to include those materials inside the DC itself.
It's possible to add tiny faces [aka 'swatches'] which use each material, nested inside some 3d-geometry in the DC.
Then the seemingly unused material will be found by name in the model's materials.See here for more details, and also how to get the right 'name' for the material in the DC - because material.name and material.display_name are not always the same !
https://sketchucation.com/forums/viewtopic.php?p=615154#p615154
-
Hi TIG,
Thank you so much for answering this post.
I have added swatches to the DC but now when I use the drop down box to select the material it changes the colour of the swatches but not the colour of the DC.What am I doing wrong?
mitch7780
-
Reread the details in the link I provided, about how to set up the material-swatches...
The material-swatches need to be separated from the main geometry parts of the DC - e.g. put them inside a nested group.
That way they'll retain their materials even when another material is given to the 'parent' containing the swatches.
Then your DC code needs to change the material of the 'parent' container, by 'name'...
Make something very simple to test your ideas out, before going into complexity... -
Thanks TIG,
I will definitely have a look again.
To be honest this is turning into a bit of a headache, all I'm trying to achieve is turning one thing a different colour and back, just thought if I gave it a go it would save me time in the long run.I'll give this another go in a day or so but for now I'm just going to have to do things the old fashioned way and make two of everything in different colours.
This DC stuff has gotten me well and truly beaten for now.Thank you so much for commenting TIG, I really appreciate the help.
Kind regards
mitch7780
Advertisement