ext. Autodesk 2014 Platform API
Publicité
Publicité
ext
In the API, the TextNote class represents Text. Its general features are as follows:
Table 38: General Features of TextNote
Function API Method or Property
Add text to the application Document.Create.NewTextNote() Method
Get and set string from the text component TextNote.Text Property
Get and set text component position TextNote.Coord Property
Get and set text component width
Get all text component leaders
TextNote.Width Property
TextNote.Leaders Property
Add a leader to the text component TextNote.AddLeader() Method
Remove all leaders from the text component TextNote.RemoveLeaders() Method
Revit supports two kinds of Leaders: straight leaders and arc leaders. Control the TextNote leader type using the TextNoteLeaderType enumerated type:
Table 39: Leader Types
Function Member Name
-Add a right arc leader
TNLT_ARC_R
TNLT_ARC_L
-Add a left arc leader
-Add a right leader.
TNLT_STRAIGHT_R
-Add a left leader.
TNLT_STRAIGHT_L
Note
Straight leaders and arc leaders cannot be added to a Text type at the same time.
Annotation Symbol
An annotation symbol is a symbol applied to a family to uniquely identify that family in a project.
Figure 75: Add annotation symbol
Figure 76: Annotation Symbol with two leaders
Create and Delete
Annotation symbols can be created using the following overload of the Creation.Document.NewFamilyInstance() method:
Code Region 16-6: Create a new Annotation Symbol
1.
public
FamilyInstance NewFamilyInstance Method (XYZ origin, FamilySymbol symbol, View specView)
The annotation symbol can be deleted using the Document.Delete() method.
Add and Remove Leader
Add and remove leaders using the addLeader() and removeLeader() methods.
Code Region 16-7: Using addLeader() and removeLeader()
1.
public void
AddAndRemoveLeaders(AnnotationSymbol symbol)
2. {
3.
int
leaderSize = symbol.Leaders.Size;
4.
string
message = "Number of leaders in Annotation Symbol before add: " + leaderSize;
5. symbol.addLeader();
6. leaderSize = symbol.Leaders.Size;
7. message += "\nNumber of leaders after add: " + leaderSize;
8. symbol.removeLeader();
9. leaderSize = symbol.Leaders.Size;
10. message += "\nNumber of leaders after remove: " + leaderSize;
11.
12. TaskDialog.Show( "Revit" , message);
13. }
Télécharger
Publicité