Set shared material parameter value


I have a list of 300+ families which have a material parameter that needs a specific value. I’d like to get a Dynamo script working for this because I can see this being used in the future. Here’s what I have so far.

The shared parameter Fitting Material is loaded into all of the families in the list.

I don’t understand why the script isn’t seeing the parameter when it is clearly there. The only reasons I can think that this is happening is because I need to get a list of family types from the filtered list of families and then set the parameter.

looks like its a type parameter…try…element element type node after your filter by bool mask

Please let me know if I understand correctly, @sovitek . A shared parameter is an element. The element in the Element.SetParameterByName is the shared parameter, NOT the family/family type that contains the shared parameter.

Hi again…not sure 100…the first node i select a fitting as instance, the second i get its types.
Then i just write to its type parametr…as its what you need in your case…for material you need to ffed in the real material and not the string

the two lowest codeblock its just to show difference between instance/type parameter

Hope it make sense ;)))

Thank you for the reply, @erfajo . Unfortunately I am new to Dynamo, and unfortunately removing the Material.Name node did not work. The Element.SetParameterByName still does not recognize that Fitting Material parameter is loaded into every pipe fitting in my project. Does it make a difference that the parameter is shared?

I should have done this from the get-go, but here’s the .dyn file for what I’m working on.
SetMaterialByCategoryAndFilteredName.dyn (22.5 KB)

Think you still need elementelementtype…have you tried as i shown .

PS i havent tried your graph, so could probably be something else…but give it a try

The Element.ElementType node returns a list of null.

sorry I dont use that clockwork node so often…try something insted of elementelementtype

I apologize, @sovitek . You were correct with the script needing an Element.ElementType node. I revised the script a little bit, but here is the final result.

Thank you for your help!

1 Like