# Custom Material Attribute

**URL:** <https://forums.sketchup.com/t/custom-material-attribute/109379>\
**Category:** Dynamic Components\
**Created:** [November 20, 2019, 11:47pm UTC](https://forums.sketchup.com/t/custom-material-attribute/109379 "2019-11-20T23:47:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gkpbydesign](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/gkpbydesign/32/78932_2.png) [@gkpbydesign](https://forums.sketchup.com/u/gkpbydesign)\
**Post date:** [November 20, 2019, 11:47pm UTC](https://forums.sketchup.com/t/custom-material-attribute/109379/1 "2019-11-20T23:47:23Z")

</div>

Hello, I am looking to create a custom attribute called “Finish” that controls the material attribute.

The process would be, the user would select from a list a material from the custom attribute “Finish.” The material attribute would then equal the custom attribute “Finish.” However I have added a custom material as a test called “MDF” and in my custom attribute list “Finish” I have a value also called “MDF” I get the error saying this is not in the model? How do I solve this?

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [November 20, 2019, 11:50pm UTC](https://forums.sketchup.com/t/custom-material-attribute/109379/2 "2019-11-20T23:50:48Z")

</div>

Examine the sample dynamic components that do this kind of thing.

The “ **Cafe Table** ” in the “ **Dynamic Components Training** ” folder is a good one to examine.

Also …

> **[DC Self Paced Tutorials](https://3dwarehouse.sketchup.com/collection/56584c8086c0357ede650492e45fb14f/DC-Self-Paced-Tutorials)**
>
> A collection of Self-Paced Tutorials about making SketchUp Dynamic Components. For correct function, follow the instruction to either IMPORT or OPEN the component.

(You might find that a hidden swatch with all choices of material must be within the dynamic component.)

_See:_

- **[Preserving Textures in a Dynamic Component. | SketchUp Help](https://help.sketchup.com/en/sketchup/preserving-textures-dynamic-component)**
- **[Using Unique Textures in a Dynamic Component | SketchUp Help](https://help.sketchup.com/en/sketchup/using-unique-textures-dynamic-component)**

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [November 21, 2019, 12:04am UTC](https://forums.sketchup.com/t/custom-material-attribute/109379/3 "2019-11-21T00:04:41Z")

</div>

> [@gkpbydesign](#):
>
> However I have added a custom material as a test called “MDF” and in my custom attribute list “Finish” I have a value also called “MDF”

You also need a “ **Material** ” Behavior that points at the “ **Finish** ” attribute in the toplevel component.

Again, … examine the “ **Cafe Table** ” in the “ **Dynamic Components Training** ” folder.  
(Look at the various “Top” subcomponents.)

---

<div class="post-metadata">

**Author:** ![gkpbydesign](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/gkpbydesign/32/78932_2.png) [@gkpbydesign](https://forums.sketchup.com/u/gkpbydesign)\
**Post date:** [November 21, 2019, 12:30am UTC](https://forums.sketchup.com/t/custom-material-attribute/109379/4 "2019-11-21T00:30:23Z")

</div>

Which one is the cafe table?

---

<div class="post-metadata">

**Author:** ![pcmoor](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/pcmoor/32/3427_2.png) [@pcmoor](https://forums.sketchup.com/u/pcmoor)\
**Post date:** [November 21, 2019, 12:36am UTC](https://forums.sketchup.com/t/custom-material-attribute/109379/5 "2019-11-21T00:36:22Z")

</div>

Materials must be already loaded in the model, you could insert a collection of 1" or 10mm square samples within the component for it to reference. Otherwise create a palette of groups which the user can paint and the Dc reference

---

<div class="post-metadata">

**Author:** ![gkpbydesign](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/gkpbydesign/32/78932_2.png) [@gkpbydesign](https://forums.sketchup.com/u/gkpbydesign)\
**Post date:** [November 21, 2019, 12:43am UTC](https://forums.sketchup.com/t/custom-material-attribute/109379/6 "2019-11-21T00:43:05Z")

</div>

The issue I have is I can get it to work, manually, but when I go to elect a different finish from the list it remains unchanged

---

<div class="post-metadata">

**Author:** ![pcmoor](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/pcmoor/32/3427_2.png) [@pcmoor](https://forums.sketchup.com/u/pcmoor)\
**Post date:** [November 21, 2019, 12:54am UTC](https://forums.sketchup.com/t/custom-material-attribute/109379/7 "2019-11-21T00:54:10Z")

</div>

Then, please share your model

Another point, the DC may require a redraw to update, try right click menu, Dynamic Component, redraw. If this works, you can then trigger a redraw in the DC or set a short cut or script to do this

---

<div class="post-metadata">

**Author:** ![MikeWayzovski](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/mikewayzovski/32/98346_2.png) [@MikeWayzovski](https://forums.sketchup.com/u/MikeWayzovski)\
**Post date:** [November 21, 2019, 11:57am UTC](https://forums.sketchup.com/t/custom-material-attribute/109379/8 "2019-11-21T11:57:50Z")

</div>

You can only use general names like ‘Green’ or ‘red’ , hexanumber (#203050) or the native ones from the standard library (not sure about the last)  
If you wanna use your own, you must add them to the model (or as a swatch to the component,as described by @pcmoor)

---

<div class="post-metadata">

**Author:** ![gkpbydesign](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/gkpbydesign/32/78932_2.png) [@gkpbydesign](https://forums.sketchup.com/u/gkpbydesign)\
**Post date:** [November 21, 2019, 12:39pm UTC](https://forums.sketchup.com/t/custom-material-attribute/109379/9 "2019-11-21T12:39:00Z")

</div>

Solved it in the end, deleted the steps I did and re-did them the same and it worked, I think the Ruby API is a little temperamental!

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [November 21, 2019, 1:25pm UTC](https://forums.sketchup.com/t/custom-material-attribute/109379/10 "2019-11-21T13:25:37Z")

</div>

> [@gkpbydesign](#):
>
> Which one is the cafe table?

That would be the component with the name “Cafe Table” perhaps ?
