If you've worked with the Revit API you'll know that often there are holes... That is, things you can "almost" do, but there will be one item you can't access through the API that makes it impossible or require some obscure workaround. This can be frustrating, as it can easily make a task you expected to take a day, take a week or even longer as you trial & error every possible approach and research a solution!
The Revit Material API is no exception. Through the API you can create a new Material and set all its identity data, create new Thermal & Physical Assets and set all their properties, create an Appearance Asset and Apply Assets to the Material.
However, you cannot set/modify the properties of an Appearance Asset. So how do you create high quality and "render ready" materials through the API. Well effectively you can't... However, what you can do is create families containing the pre-setup materials and through the API, load those families into the project and then delete them.
As you may know, loading a family also loads all the materials and those materials will remain after you delete the family. It also won't overwrite existing materials/assets if they already exist in the project. So you can be sure it won't ruin any modifications a user has made.
Unfortunately if you are dealing with a Paint Manufacturer's colour palette they could have thousands of materials, and you are going to have to create all of these Appearance Assets manually using a duplicate and change the colour approach (and perhaps change the reflectivity depending on the finish). Maybe a job for outsourcing...
Perhaps this will change in the future, but given the hundreds of different options available on Appearance Assets, I don't expect it will happen soon.
The Revit Material API is no exception. Through the API you can create a new Material and set all its identity data, create new Thermal & Physical Assets and set all their properties, create an Appearance Asset and Apply Assets to the Material.
However, you cannot set/modify the properties of an Appearance Asset. So how do you create high quality and "render ready" materials through the API. Well effectively you can't... However, what you can do is create families containing the pre-setup materials and through the API, load those families into the project and then delete them.
As you may know, loading a family also loads all the materials and those materials will remain after you delete the family. It also won't overwrite existing materials/assets if they already exist in the project. So you can be sure it won't ruin any modifications a user has made.
Unfortunately if you are dealing with a Paint Manufacturer's colour palette they could have thousands of materials, and you are going to have to create all of these Appearance Assets manually using a duplicate and change the colour approach (and perhaps change the reflectivity depending on the finish). Maybe a job for outsourcing...
Perhaps this will change in the future, but given the hundreds of different options available on Appearance Assets, I don't expect it will happen soon.
3 comments:
Hi,
there is one workaround to use template Revit file for copy material in current Revit file and then set it assets to correct except appearance asset. Appearance asset values must be correct in template file. There is a function ElementTransformUtils.CopyElements in Revit API which can copy material between rvt files.
Cheers
Veli V.
Thanks Veli,
I was aware of this, but as our main issue was with Appearance assets, it doesn't really provide a better solution than simply using a Revit Family file. The difference is its using a project instead, which is likely to be slower to open in the background.
Thanks for sharing this workaround! Our customers have been complaining alot about this, and we never had any solution at all. They had to manually adjust all materials which is very time consuming!
Post a Comment