# Material selection in command line drop-down style

**URL:** <https://discourse.mcneel.com/t/material-selection-in-command-line-drop-down-style/193861>\
**Category:** Rhino Developer\
**Tags:** windows, command, materials\
**Created:** [October 28, 2024, 3:00am UTC](https://discourse.mcneel.com/t/material-selection-in-command-line-drop-down-style/193861 "2024-10-28T03:00:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![svichare](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/svichare/32/611460_2.png) [@svichare](https://discourse.mcneel.com/u/svichare)\
**Post date:** [October 28, 2024, 3:00am UTC](https://discourse.mcneel.com/t/material-selection-in-command-line-drop-down-style/193861/1 "2024-10-28T03:00:11Z")

</div>

Hi,  
I am trying to create a command to apply materials to objects.  
For the material selection step, I want to create a drop-down style UI in the command line which will look for material names in RhinoDoc.RenderMaterials and autocomplete similar to how the regular Rhino command line UI works for all commands.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/5/4/4/54460cabb01b2b8de397a03ccc56448c4095ecd3.png)

how can i achieve this ? I want to add my own options (which are material names) and the user selects a material, which I can then use to apply to objects.

Thanks,  
Srujan

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [October 28, 2024, 6:54am UTC](https://discourse.mcneel.com/t/material-selection-in-command-line-drop-down-style/193861/2 "2024-10-28T06:54:32Z")

</div>

Seen this topic?

> [@Assign material with a macro](https://discourse.mcneel.com/t/assign-material-with-a-macro/168180/3):
>
> I’m using this script as a macro in Rhino. It raises an error when there’s no material in the material table. Other than that it works fine. You get to choose the material name in a popup: [image] import rhinoscriptsyntax as rs import scriptcontext as sc import re ids = rs.GetObjects("Select objects to change material", preselect=True) rmats = [rm for rm in sc.doc.RenderMaterials] materialNames = [] for mat in rmats: if not bool(re.search(r"\s", mat.Name)) and len(mat.Name) \<= 10: …

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/685184_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [October 28, 2024, 4:21pm UTC](https://discourse.mcneel.com/t/material-selection-in-command-line-drop-down-style/193861/3 "2024-10-28T16:21:42Z")

</div>

Hi @svichare,

> [@svichare](#):
>
> I want to create a drop-down style UI in the command line which will look for material names in RhinoDoc.RenderMaterials and autocomplete similar to how the regular Rhino command line UI works for all commands.

Adding a dropdown to the command line is currently not possible. You probably should consider a different UI approach.

– Dale

---

<div class="post-metadata">

**Author:** ![svichare](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/svichare/32/611460_2.png) [@svichare](https://discourse.mcneel.com/u/svichare)\
**Post date:** [October 28, 2024, 11:24pm UTC](https://discourse.mcneel.com/t/material-selection-in-command-line-drop-down-style/193861/4 "2024-10-28T23:24:11Z")

</div>

Thanks for the suggestion @martinsiegrist  
Cheers

---

<div class="post-metadata">

**Author:** ![svichare](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/svichare/32/611460_2.png) [@svichare](https://discourse.mcneel.com/u/svichare)\
**Post date:** [October 28, 2024, 11:24pm UTC](https://discourse.mcneel.com/t/material-selection-in-command-line-drop-down-style/193861/5 "2024-10-28T23:24:29Z")

</div>

Thanks for getting back, @dale  
Will do
