Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Changing Color of Labels within tags family per tag instance

5 REPLIES 5
Reply
Message 1 of 6
kinjal
2080 Views, 5 Replies

Changing Color of Labels within tags family per tag instance

Dear all, 
 
We have a tag family with three labels in it.
 
I need to change color of the labels in the tag family programmatically for each tag instance (all three labels may have different color)
 
I learned we cannot have instance properties for a Tag families. I thought of having a "shared instance parameter" for tag's host element, however i couldn't find a way to influence color of the label in the tag family.
 
Can someone point a possible approach to set color of a label inside a tag family per tag-instance?
 
Please let me know if any aspect needs elaboration or if anything is unclear.
 
Best regards,
Kinjal.
Kinjal Desai
Fullstack developer @ Dwaravati
Delivering high quality programmatic boosts for your already beautiful Revit


5 REPLIES 5
Message 2 of 6
RPTHOMAS108
in reply to: kinjal

I think the nearest you'll get to this is similar to how tags with differing font sizes are dealt with.

 

If you know you'll only be using certain colours then you can create the different label types in the tag family to represent the different colours. You would then for each of the three original tag positions overlap the different colour labels and control the visibility of them via a yes/no parameter. Likely would have to be an instance parameter otherwise you would need to create a type for every colour permutation.

 

Problem with the API is you can only change colour by category (which will be for every tag) or by element (which will be for everything within the tag).

 

If you are placing the tags as part of the program then you can place three tags and override their colours but not one tag and then change the colour of three parts within it. You'll have no access to tag internal elements unless you want to create the tag family at run time and have a myriad of tag families with differing internal colour combinations.

 

Message 3 of 6
kinjal
in reply to: RPTHOMAS108

Hi RPThomas,

 

Thanks for thorough explanation.

 

It seconds what i've found. Also this means i've hit a real wall there For my particular case i think we'll be able to go around the limitations. 

 

I believe, a systematic better api support for handling colors would be very useful.

 

Thanks again.

 

Best regards,

Kinjal.

 

 

Kinjal Desai
Fullstack developer @ Dwaravati
Delivering high quality programmatic boosts for your already beautiful Revit


Message 4 of 6
jeremytammik
in reply to: kinjal

Dear Kinjal and RPThomas,

 

Thank you for your query and helpful explanation.

 

If you wish to describe exactly how you think a better API support for handling colours would be useful and how it should look, I would suggest you submit a wish for it in the Revit Idea Station.

 

However, remember that the Revit API basically just mirrors the functionality and paradigms of the user interface...

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 6
Revitalizer
in reply to: jeremytammik

Hi Jeremy,

 

a new ParameterType.Color would help here, but how to handle that in formulas etc., how to express and display the value...?

Color parameters are of type "integer", but the raw value may be difficult to read for the user:

 

https://forums.autodesk.com/t5/revit-api-forum/how-to-change-text-color/td-p/2567672

 

 

Cheers,

Rudi




Rudolf Honke
Software Developer
Mensch und Maschine





Message 6 of 6
kinjal
in reply to: Revitalizer

Hi Jeremy, Rudi,

 

Sure, i'll write a use-case for Idea station.

 

Nice thread, Rudi. Yes, new parameter type can help and so would support for some color-functions in formula (probably that's but too much to ask though).

 

But at least parameter type, and possibility to just link colors (in my case label color) with family/shared parameters via formula would be a great addition.

 

Best regards,

Kinjal.

Kinjal Desai
Fullstack developer @ Dwaravati
Delivering high quality programmatic boosts for your already beautiful Revit


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community