Trying to change custom parameter with a material type to some other material

Trying to change custom parameter with a material type to some other material

Anonymous
Not applicable
977 Views
4 Replies
Message 1 of 5

Trying to change custom parameter with a material type to some other material

Anonymous
Not applicable

Hi! I've been trying to change several parameters in Revit, I've managed to do so with normal "string" parameters and for yes/no parameters. Now I'm trying to do the same to change a material type. The problem is that with the methods i've used before (parameter.set(integer) or parameter.setvalueasstring("Value")) don't seem to work.

 

Do I need to do something else for this to work with material types? (Not sure if that's the right word for it either, I mean materials I can select in the material browser). After some searches online I found something about declaring an elementid for a material, but I really would not know where to find which ID to use.

 

When executing the code there is no error message, and the other appends do come through, however no changes to the material are visible.

 

My code looks something like this. As said before, I've been using para.set(int) to change values up til now.

 

Thanks in advance!

 

                                    Element testgevel = doc.GetElement(new ElementId(Convert.ToInt32(subelement)));
                                    Parameter para = testgevel.LookupParameter("materiaal_metselwerk");

0 Likes
Accepted solutions (1)
978 Views
4 Replies
Replies (4)
Message 2 of 5

MarryTookMyCoffe
Collaborator
Collaborator

this is parameter of type elementid, try set up with ElementID of your chosen material and it should work

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
0 Likes
Message 3 of 5

Anonymous
Not applicable

Thanks for the reply, but where can I find this elementID?Knipsel.PNG

0 Likes
Message 4 of 5

MarryTookMyCoffe
Collaborator
Collaborator
Accepted solution

you can use FilteredElementCollector filteredElementCollector = new FilteredElementCollector(document).ofClass(typeof(Material));

to find all materials

I sugest for you to get a revit lookup, to see what is what in revit
https://github.com/jeremytammik/RevitLookup

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
0 Likes
Message 5 of 5

Anonymous
Not applicable

thanks, using that I found the ID!

0 Likes