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: 

Text Style Set Background, Color, Arrow Style

4 REPLIES 4
Reply
Message 1 of 5
mfleming.stantec
2206 Views, 4 Replies

Text Style Set Background, Color, Arrow Style

 

I have been working with creating text types for awhile.

 

I'm currently using C#: - Revit 2013

 

                        // Create a duplicate
                        Element ele = textNote.TextNoteType.Duplicate(txtType);
                        TextNoteType noteType = ele as TextNoteType;

 I can easily change Font Type to Arial Narrow along with almost everything else.

noteType.get_Parameter("Text Font").Set("Arial Narrow");

 

I cannot find any information on the following:

  1. How do I set Text Style Background?
  2. How do I set Text Style Color?
  3. How do I set Text Style Keep Readable option?
  4. How do I set Text Style Project Leader Arrowhead Style?

 

4 REPLIES 4
Message 2 of 5

Received info on Text Style Background.

 

// Text Background 1 = Transparent or 0 =Opaque
noteType.get_Parameter("Background").Set(1);

Message 3 of 5
Joe.Ye
in reply to: mfleming.stantec

 

>>> How do I set Text Style Background?
In the previous update, you mentioned the mothod to call the line.
noteType.get_Parameter("Background").Set(1);
Actually this doesn't help. I checked that for any color, the text style object's "Background“ Parameter value is always 1. Revit API cannot set specific color as the text style back ground.

 

>>>How do I set Text Style Color?
Text color can be set by changing the text style object's "Color" parameter value. The color value in the RGB value in decimal.
for example: noteType.get_Parameter("Color").Set(16744448); //16744448 = (R=155 G=128 B=0)

 

>>>How do I set Text Style Keep Readable option?
Directly chang ethe text object's "Keep Readable" parameter value to 1. Note this parameter doesn't belong to the text type, but text element itself.
For example:
textnote.get_Parameter("Keep Readable").Set(1)

 

>>>How do I set Text Style Project Leader Arrowhead Style?
noteType.get_Parameter("Leader Arrowhead").set(headTypeElementId) //Here input the head type element's ElementId.



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 4 of 5
krispy
in reply to: Joe.Ye

Ahh... you had me pulling my hair out until I realised that your colour value was incorrect!

Color(R=155, G=128, B=0) actually equals 32923 (and NOT 16744448)... this is confirmed with RevitLookup utlity in Revit 2013.

 

For those interested you can convert a "Color" object to the int that Revit requires with ColorTranslator.ToWin32(color)

Message 5 of 5
dbehner
in reply to: krispy

What about font width?

 

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community