Create a custom Material Asset

Create a custom Material Asset

guilhem_monty
Explorer Explorer
1,074 Views
8 Replies
Message 1 of 9

Create a custom Material Asset

guilhem_monty
Explorer
Explorer

Hello everyone,

 

I would like to know if it is possible to create a personalised material asset with personalised properties that can be displayed in the Material Browser. For example, a material asset called "Test" placed after "Thermal". And in "Test" put a property like "Address".
If this isn't possible, is it possible to add the "Adress" property to an asset that already exists, for example "Identity"?
If so, can we then create a new section in the Identity asset as "Additional information"?

 

Is there a way to do that through the API? 


Thanks in advance,

 

0 Likes
Accepted solutions (1)
1,075 Views
8 Replies
Replies (8)
Message 2 of 9

jeremy_tammik
Alumni
Alumni

Thank you for bringing this up here in the public forum. As I mentioned in my previous private answer, similar questions have already been discussed and solved several times over here in the forum. You can find some of them searching for something like "create asset":

  

  

In one of the threads, Gary J. Orr shared a solution that sounds very comprehensive including what you ask for. I even highlighted and edited his solution for The Building Coder blog: 

  

  

Does that not cover your needs?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 9

guilhem_monty
Explorer
Explorer

Thank you for your reply.
I looked at Gary J.Orr's material tool file (thanks for that). I may not have understood everything, but I was able to create a custom material but not to create a new type of asset (in addition to the 5 default Identity, Graphics, Appearance, Physical and Thermal) and to create an "Address" property in it (as in the attached image).
I'm going to continue trying to understand this material file if you tell me that the solution is in there

0 Likes
Message 4 of 9

jeremy_tammik
Alumni
Alumni

To be on the safe side, I asked the development team for you.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 5 of 9

jeremy_tammik
Alumni
Alumni

The development team replied: To my knowledge there is no way to create a new material asset as these are tethered to the Autodesk Material Library and not Revit specific. The same is also true that you cannot create custom properties on a specific material or material asset.

  

Could I ask what your intended use case is here? Across Autodesk, we are investigating the current Material Data Architecture, and it would be great to understand your desire for custom asset classes and properties.

  

As a work around, you can try duplicating an asset already in the project. That is the hack which Dynamo users have leveraged for awhile now.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 6 of 9

guilhem_monty
Explorer
Explorer

Thank you for the reply. 
I would like to create a type of asset specific to my company so that I can bring together the data I'm interested in in a single asset and add new properties specific to my company.

Duplicating an asset won't let me change the name of the asset type and select the properties I want to display, will it please ?


0 Likes
Message 7 of 9

GaryOrrMBI
Collaborator
Collaborator
What you're looking for is not possible in either the UI or via the API.

Adding a custom Asset type (Appearance, Thermal, Physical, My Private Asset) simply can't be done.
It is also impossible to add a custom Parameter (Shared or Project) to a material.

Materials are very rigid in nature.

There are, however, properties/parameters that can be set and later searched for on each Material Asset as well as the Material itself. A common one across all aspects of a material is "Keywords".

Sorry for the bad news.
-G
Gary J. Orr
GaryOrrMBI (MBI Companies 2014-Current)
aka (past user names):
Gary_J_Orr (GOMO Stuff 2008-2014);
OrrG (Forum Studio 2005-2008);
Gary J. Orr (LHB Inc 2002-2005);
Orr, Gary J. (Gossen Livingston 1997-2002)
Message 8 of 9

jacob.small
Autodesk Support
Autodesk Support
Accepted solution

Some quick 'info' on what I think I know about material assets.:

 

The only "asset types" in the UI are Appearance, Thermal, and Physical. In the API these are called Appearance, Thermal, and Structural (because why would they match?). I'll be using the API names going forward because we're in that forum (perhaps someone curious can ask about the UI stuff in the other forum). 

The Thermal and Structural asset types can be deleted from a material in the UI and set as an invalid Element Id in the API. The Appearance asset cannot. 

The other tabs in the material editor are collections of properties and parameters of the material element itself, not a linked asset - but are masquerading as an asset due to how they are presented in the UI.  For example to get the name (shows in the identity tab) you get the Name property of a material element. To get the foreground surface pattern (shows in the graphics tab) you'd get the SurfaceForegroundPatternId property. To set the Comments in the Identity tab you'd use a Set method on the comment parameter. 

The only thing unavailable is the keywords (noted as missing in 2019 and as far as I know still unavailable). 

 

So the question becomes, how can you accomplish what you're after? 

You could map a property from the identity tab (URL looks like an option) to an extensible storage object with the data you need; however users won't be able to edit it in the material editor. Personally I would make 'non-UserModifiable' parameters on the materials category, and associate them to the materials in your template, and let them be edited/reviewed via an add-in which would also allow updating the rest of the assets. This add-in could also ensure that materials added via your tool would have these hidden parameters quickly set when materials from your library (a sub-component of your add-in) are added to the model.

It'd be a big lift but likely one which many beyond your company would benefit.

Message 9 of 9

guilhem_monty
Explorer
Explorer

Thank you @jeremy_tammik , @GaryOrrMBI , @jacob.small  for your answers. I'll probably create an addin with the desired parameters. I agree with Jacob's solution for closing the subject

0 Likes