Assign material through Revit API

Hello,
I am importing a SAT file to Revit through Python, based on example code from help.autodesk.

SAT file geometry is imported as a Autodesk.Revit.DB.DirectShape, with ‘Generic Models’ category.

Is it possible to assign a Material to this ‘Generic Models’ through Revit API?

I was thinking maybe I can assign a material through Parameter Name, but the issue is that this imported ‘Generic Models’ does not have any Material/Structural Material parameter:
image

I attached a test SAT file.
test.sat (98.8 KB)

Any help is welcomed, as I don’t know how to solve this. Thank you in advance.

I do not believe you can set a parameter for materials of direct shapes via the api, but would love to hear otherwise. Other element types (ie: free form elements in a family instance) can certainly have materials, but which of the many options is right to utilize in your instance will depend on what type of geometry you’re working with, and what your downstream uses are.

1 Like

I suggest remaking the shape via Revit/Dynamo from the sat and assigning a subcatrgory to the geometry when you do. You can then associate materials to these in the object styles tab on manage. We use this inhouse at a large firm typically as it’s easy to control globally as well when dealing with lots of facade panels using common materials.

1 Like

Personally I’m a fan of the ‘make it a family with a solid shape and a parameter for the material’; Added bonus if you can convert the SAT to an extrudable form in that you can utilize that as a user editable shape.

2 Likes

Thank you for all the replies both @GavinCrump and @jacob.small

This is exactly what I am trying to do:

Gavin, is there some preview of how I can do this?

Unfortunately we use rhino inside so not 100% across the API of it. Maybe check out springnodes, I recall their being Python nodes there that worked similarly.

1 Like