How to create and add a decal to a wall, from code, using Revit API and C#? I would like to insert a decal (image) to a wall.

How to create and add a decal to a wall, from code, using Revit API and C#? I would like to insert a decal (image) to a wall.

konrad.pEGTVF
Contributor Contributor
1,204 Views
7 Replies
Message 1 of 8

How to create and add a decal to a wall, from code, using Revit API and C#? I would like to insert a decal (image) to a wall.

konrad.pEGTVF
Contributor
Contributor

1. Create the decal from code (adding an image and a cutout image to it)

2. Apply the decal to a Wall

 

decalReference.jpg

0 Likes
1,205 Views
7 Replies
Replies (7)
Message 2 of 8

jeremy_tammik
Alumni
Alumni

I suggest creating such a decal manually via the end user interface and analysing the resulting changes in the Revit database via an API-based db exploration tool such as RevitLookup:

   

   

Decal is apparently accessible and supported via the API, since it is mentioned in the Revit 2024 API news:

  

  

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

konrad.pEGTVF
Contributor
Contributor

Hello Jeremy,

 

Thank you very much for getting back to me within such a short time.

 

With a filtered element collector, the decal is returned as an ElementType, however, after checking the ElementType class it seems, that it uses an Object Proxy, however, it is not clear, what proxy that can be.

 

konradpEGTVF_0-1697544498380.png

 

 

While it is used as an ElementType, I cannot see any details for this Decal, meaning, I do not see position, size, image, cutout image etc. I would like to add two images to this decal, or maybe even create a decal from scratch via code.

 

My questions would be:

What is the actual type (more specific than the ElementType) of the Decals?

How to create a Decal via Revit API, from C# code?

How to set the position? How to attach images and cutout to it?

How to attach it to a wall?


Revit Lookup was partially helpful, as it showed me that it is an ElementType, but I still cannot find the position or a way to add the images, and I am suspecting, this is due to the fact the type that I use is not right.

 

Similar things happens if something is not declared as a Wall maybe, just an element, several fields and properties will not be available, that is why I suspect that the ElementType is not specific enough.

0 Likes
Message 4 of 8

jeremy_tammik
Alumni
Alumni

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 8

konrad.pEGTVF
Contributor
Contributor

Thank you very much 🙂, we appreciate it a lot, meanwhile I will try on my own, if there are any updates or solutions, I will let you know.

 

Can I somehow access that link you sent, by the way?

0 Likes
Message 6 of 8

jeremy_tammik
Alumni
Alumni

They say: No, I do not believe there is any exposure through public API, particularly for placing decals. Sorry for the bad news. You could file a wish list entry in the Revit Idea Station and tag is as API. Maybe one already exists?

  

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

konrad.pEGTVF
Contributor
Contributor

Thank you Jeremy, I will check out the suggestions.


As a temporary measurement, do you have any suggestion how to achieve a similar effect, using the RevitAPI as a workaround?

Untitled.jpg

 

Meaning that putting a single logo on a glass wall, with frosting, and the logo as a cutout or something. The logo's position etc. is also important. Any suggestion?

0 Likes
Message 8 of 8

jeremy_tammik
Alumni
Alumni

Well, the only method that I have worked with personally is by using the analysis visualisation framework AVF:

  

  

A cleaner way would probably be to define a family to represent the logo and insert an instance of that.

  

You could also implement the logo as a direct shape and place that appropriately.

  

I am sure there are many other and better possibilities as well. Search a bit for yourself:

  

  

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