Assign Material Into Blocks

Hello there,

I was digging into the command RenderAssignMaterialToObjects and found that it prompts with the option “RecurseIntoBlocks”. With this feature I can assign a material to a block without having to use BlockEdit to access the geometry inside.

Is there a way for me to make it standard so whenever I assign a material to a block it automatically sets “RecurseIntoBlocks” as “Yes”? It resets it to “Ask” every time.

Ideally it would just apply material to geometry inside the block when you click “Assign To Objects”

I had the same problem and ended up creating a button which runs the following python script.

Many of my files contain materials from archicad or other CAD software which I don’t really need so I created a filter for the materials.

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("\s", mat.Name)) and len(mat.Name) <= 10:

result = rs.ListBox(materialNames, "", "Materials")

cmdString = "-_RenderAssignMaterialToObjects " + result + " " "n"
rs.Command(cmdString, False)
cmdString = "-_RenderAssignMaterialToObjects " + result + " " "y"
rs.Command(cmdString, False)

1 Like