Creating an AppearanceAssetElement through the RevitAPI with a texture that is located on Autodesk Docs or BIM360

Creating an AppearanceAssetElement through the RevitAPI with a texture that is located on Autodesk Docs or BIM360

MartijnKalec
Participant Participant
617 Views
5 Replies
Message 1 of 6

Creating an AppearanceAssetElement through the RevitAPI with a texture that is located on Autodesk Docs or BIM360

MartijnKalec
Participant
Participant

Dear RevitAPI forum,

 

I've been searching on the API forum, API documentation and thebuildingcoder blogposts, but couldn't find the answer to my question anywhere. So I decided to create this post.

 

The question I have: how can I create an AppearanceAssetElement through the RevitAPI with a texture that is located on Autodesk Docs?

 

I already know how I can create the AppearanceAssetElement, but the part I'm struggling with is how to use a path that is pointing to Autodesk Docs, instead of a local absolute path.

 

My investigation up to now:

When I'm using the Material browser UI, I can simply change the texture location. By selecting a texture that is stored on Autodesk Docs, it recognizes that it's stored on Autodesk Docs and creates the ExternalResourceReference.

martijn4LRWW_0-1675766783886.png

martijn4LRWW_1-1675766811270.png

 

When I use the RevitLookup add-in (great tool btw!), I can confirm that I see both the ExternalReference pointing to Autodesk Docs, and the local absolute path on my disk:

martijn4LRWW_2-1675767284178.png

 

Same goes for using the API. I can get both the ExternalResourceReference and the local absolute path to the texture (kinda in the same way as you would edit the path as you can read in this blog https://thebuildingcoder.typepad.com/blog/2017/11/modifying-material-visual-appearance.html).

And after doing some further research, I was able to find out how I could create an ExternalResourceReference from an absolute path on the user's PC.

martijn4LRWW_5-1675767985741.png

 

But now the final step would be to create of modify an existing Material/AppearanceAssetElement to use this ExternalResourceReference.

I know that I can modify the path parameter in the AppearanceAssetElement. But as far as I can see, that would make it an absolute path on the machine, instead of a path to Autodesk Docs that multiple users can use. However, I don't see any way to edit the ExernalResourceReference the texture is using. Only how to get an already assigned ExternalResourceReference within the AppearanceAssetElement.

 

Is this even possible within the RevitAPI? Am I missing something obvious?

0 Likes
Accepted solutions (1)
618 Views
5 Replies
Replies (5)
Message 2 of 6

jeremy_tammik
Alumni
Alumni

Wow! Great research, brilliant question. Thank you for that. Tricky, maybe? I asked the development team for you. 

  

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

MartijnKalec
Participant
Participant
Thanks Jeremy! I'll await the response from the developers.
0 Likes
Message 4 of 6

jeremy_tammik
Alumni
Alumni
Accepted solution

Good news from the development team: The ExternalResourceReference for the material texture feature supports the AppearanceAssetElement editing API; to set the path of a property, just set it to your local desktop connector local cache path (absolute path). Revit will create the external reference for it automatically. So, there's no need to create the external reference manually. Just note that the ExternalResourceReference support for material texture starts from Revit 2023.

    

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

MartijnKalec
Participant
Participant

Hi Jeremy,

 

Thanks a lot, just tried it and it seems to work!

0 Likes
Message 6 of 6

jeremy_tammik
Alumni
Alumni

Glad to hear it. Thank you for confirming!

  

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