Rhino.Inside - Material Parameter Applied to all Model Elements

Hello I created this definition to bring in a rhino model element with direct shape and I created a material parameter to apply to the Direct Shape. I now notice, that not only does my direct shape have this material parameter but so does every other model element in my project. How do I apply this parameter to just my direct shape?

This is what my script looks like below and I also attached it.

Material Parameter to all elements in project.gh (31.6 KB)
Thank you for the help.

Hi Olivia, DirectShapes are a little different and only take a material as a Paint, not parameter based. The Material Parameter you are adding to the Project won’t be applied to the DirectShape Geometry.

Creating Families allows you to have Instance based material parameters.

1 Like

Oh that is really interesting. Thank you for confirming this. So is there a way to create a family and import my geometry through that family so the imported rhino geometry can show up with that parameter? If so could you point me to a script on that? Many thanks.

Can you describe the workflow & desired outcomes a bit?

It looks like you are bringing a custom wall, if we do this with the family its going to require placement locations and manually associating the Instance Family Parameter to the geometry in the family.

Hello Japhy, I set this example up as a way to vet the issue. My actual project is a set of stairs that I would like to bring in. So as I understand I need to use an add family component and create a custom stair template for that component I can see how to do that here: (11) Create custom family templates in Revit using Rhino.Inside.Revit - YouTube
Is this correct? I am testing out some things now I have this laid out below

The Add Family seems to take issue with the Built in Category picker. Am I on the right track? I think I am suppose to use a “Model Category Picker” for the Category input but I can’t find that component.

Once I get this setup can I apply a material parameter to this? If so how?

Thank you again for all the help.

OK I added a family with my geometry successfully.

I am still unsure how to instantiate it in Revit with a material. Is this the right track?

Nice. Now open the Family and Add a new family parameter set to instance.

Then in the family select the Geometry and associate the instance family parameter.

Oh I see, so we are adding the material parameter through traditional methods. There is no way to set this within grasshopper with components?

One more question I am having trouble bringing in this model with the correct category. What component should I use here:

I see in examples on your resources you are using a “model category picker” but I can’t find that exact picker and all other alternatives seem to not work. Right now its a generic model.

Setting up the instance parameter now allows you to change the material in each instance in the project separately.

You can use the Query Categories. Right click on the Type to expose the picker for model.

To setup and then create the association of family parameters via the Revit API is possible but has a lot of variables and needs to be done in the Family Document. Assigning the material (not as an associated family parameter) is easy in RiR, but adding a shared or family parameter and associating programmatically to particular breps in families is complex and not often requested.

Hello Japhy, thank you for this workflow. I have two more questions regarding this. I noticed that the script below that imported my geometry last week no longer pulls in my geometry into my Revit file. Shouldn’t this script below import my brep?

Also I used your strategy for establishing the model category and it it seems to error when I plug it into the Add Family component.

Attached is my Grasshopper script.
Bringing in roof Family.gh (15.4 KB)
Thank you so much for your speedy help

Hi Olivia, Everything looks ok on your definition. Is this being placed in the same project or a new project? Is the family being updated?

What is the error? Does the Category conflict with the template being used?

I’ll be slow responding today but will be able try and look at this in more detail this evening. Thanks.

thank you Japhy, The error in the add Family component is “1. The input category id cannot be assigned as the new category for this family.
Parameter name: categoryId” This still shows up if I unplug the file template file so I don’t think that is the conflict.

this is a new file with a different template from the other day so in the mean time. I am going to try to recreate the same exact environment to see if this still happens.

Thank you again.

Hello Japhy, I tried out this same script in other revit files and it seems to work. I am not sure why this one revit file is not accepting the geometry like the others.

So now I only have two challenges.

  1. I am not sure how to properly set the family category
  2. I am not sure where to place the element parameter in my script so it will show up in my property panel as I select the family. I am fine with this being an instance parameter. I recreated the element parameter similarly to how you showed it earlier.

    Bringing in roof Family.gh (19.9 KB)
    Let me know how to proceed. Many thanks, Olivia

Olivia, Please review Scott’s tutorial on creating custom category templates.

The Family Parameter needs to be created in the Family Document.

Ok this solution makes a lot of sense. So initially my hope was that I could load a family into my main Revit file with its own parameter. It seems like to make the material parameter side of it work correctly though, the “Add Parameter” component needs to run in an isolated Revit family session.

1 Like