Material-Function change issue!

Hello all!

I need help with solving the python issue in dynamo!!

I want to change the function data on material like from Finish1 to Finshi2 using python script. But I failed!!! Please help me so that I can solve it.
I attached two pictures here as references.

Screen Shot 2020-07-15 at 10.28.09 AM

Thank you so much!!

The problem is that you’re giving the method a string instead of a materialfunctionassignment enumeration item.

See the link to the revit API docs website below for the possible inputs.

https://www.revitapidocs.com/2020/1cbeb006-f7a2-f6d2-491f-faa0b9a006fc.htm

Use this code to get the materialFunctionAssignment value depending on the string you’re using as input.

import System
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

input = IN[0]
OUT = list()

x = System.Enum.GetValues(MaterialFunctionAssignment)
for i in x:
	if i.ToString() == input:
		OUT.append(i)

Also for future posts, it would be helpful to post a direct link to the page of the Revit API docs website you’ve been using along side with the picture :smiley: