Revit API

Reply
Active Contributor
mfleming.stantec
Posts: 32
Registered: ‎10-06-2009
Message 1 of 4 (985 Views)

Text Style Set Background, Color, Arrow Style

985 Views, 3 Replies
09-16-2012 05:28 PM

 

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?

 

Active Contributor
mfleming.stantec
Posts: 32
Registered: ‎10-06-2009
Message 2 of 4 (978 Views)

Re: Text Style Set Background, Color, Arrow Style

09-16-2012 09:48 PM in reply to: mfleming.stantec

Received info on Text Style Background.

 

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

ADN Support Specialist
Joe.Ye
Posts: 334
Registered: ‎03-05-2010
Message 3 of 4 (958 Views)

Re: Text Style Set Background, Color, Arrow Style

09-19-2012 03:08 AM 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
Distinguished Contributor
krispy
Posts: 316
Registered: ‎11-01-2004
Message 4 of 4 (613 Views)

Re: Text Style Set Background, Color, Arrow Style

07-09-2013 11:43 PM 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)

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.