Revit API

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

Text Style Set Background, Color, Arrow Style

858 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 (851 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: 328
Registered: ‎03-05-2010
Message 3 of 4 (831 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 (486 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)

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit

Twitter

Facebook

Blogs

Youtube