DrawingText (Object)

Represents a drawing text in a drawing view.

Properties


Property AnchorPosition() As
Returns or sets the anchor position of the drawing text.
Example:
This example sets the anchor position of the MyText drawing text to top left position.
 MyText.AnchorPosition = TopLeft
 
Property Angle() As
Returns or sets the angle of the drawing text. The angle is measured between the axis system of the drawing view and the local axis system of the drawing text. The angle is measured in radians and is counted counterclockwise.
Example:
This example sets the angle of the MyText drawing Text to 90 degrees clockwise. You first need to compute the angle in degrees and set the minus sign to indicate the rotation is clockwise.
 Angle90Clockwise = -90
 MyText.Angle = Angle90Clockwise
 
Property AssociativeElement() As
Returns or sets the associative object of the drawing text.
Example:
This example sets an associative line of the MyText drawing text to top left position.
 MyText.AssociativeElement = line
 
Property FrameType() As
Returns or sets the frame type of the drawing text.
Example:
This example sets the frame type of the MyText drawing text to an ellipse.
 MyText.FrameType = catEllipse
 
Property Leaders() As (Read Only)
Returns the drawing leader collection of the drawing text.
Example:
This example retrieves in LeaderCollection the collection of leaders of the MyText drawing text.
 Dim LeaderCollection As DrawingLeaders
 Set LeaderCollection = MyText.Leaders
 
Property NbLink() As (Read Only)
Returns the number of attributes link
Example:
This example gets number of attributes link of MyText drawing text.
 nbLink = MyText.NbLink
 
Property OrientationReference() As
Returns or sets the orientation reference of the drawing text.
0 : Sheet orientation
1 : View/Label/2Dcomponent orientation
Example:
This example sets the orientation reference of MyText drawing text to sheet orientation
 MyText.OrientationReference = 0
 
Property Text() As
Returns or sets character string that makes up the text.
Example:
This example retrieves in CharString the character string of the MyText drawing text.
 CharString = MyText.Text
 
Property TextProperties() As (Read Only)
Returns the text properties of the drawing text. Allows to modify the whole text properties. To manage a sub part of the text use GetParameterOnSubString
Example:
This example retrieves in TextProperties the text properties of the MyText drawing text.
 Dim TextProperties As DrawingTextProperties
 Set TextProperties = MyText.TextProperties
 
Property WrappingWidth() As
Returns or sets the wrapping width of the drawing text.
Example:
This example sets the wrapping width of the MyText drawing text to 50.
 MyText.WrappingWidth = 50.
 
Property x() As
Returns or sets the x coordinate of the text. It is expressed with respect to the current view coordinate system. This coordinate, like any length, is measured in meters.
Example:
This example retrieves the x coordinate of the text MyText drawing text.
 X = MyText.x
 
Property y() As
Returns or sets the y coordinate of the text. It is expressed with respect to the view coordinate system. This coordinate, like any length, is measured in meters.
Example:
This example sets the y coordinate of the text MyText drawing text to 5 inches. You need first to convert the 5 inches into meters.
 NewYCoordinate = 5*25.4/1000
 MyText.y =  NewYCoordinate
 

Methods


Sub ActivateFrame( itype)
Activates the text frame of the drawing text.
Example:
This example adds a rectangle frame to MyText drawing text.
 CatTextFrameType ityp = catRectangle
 MyText.ActivateFrame(itype)
 
This example removes the frame to MyText drawing text.
 CatTextFrameType ityp = catNone
 MyText.ActivateFrame(itype)
 
Func GetFontName( iFirst, inbCharacter) As
Returns the font name on a substring of the drawing text.
Parameters:
iFirst
The first character to which the property should apply
inbCharacter
The number of characters to which the property should apply
Returns:
oFontName The name of the font
Example:
This example gets the MyText drawing text font.
 oFontName = MyText.GetFontName(0, 0)
 
Func GetFontSize( iFirst, inbCharacter) As
Returns the font size on a substring of the drawing text.
Parameters:
iFirst
The first character to which the property should apply
inbCharacter
The number of characters to which the property should apply
Returns:
oFontSize The size of the font
Example:
This example gets the MyText font size.
 oFontSize = MyText.GetFontSize(0, 0)
 
Func GetModifiableIn2DComponentInstances() As
Returns if the text is modifiable or not in 2D component instances. The text must own to a 2D component (NOT to a view)
Example:
This example retrieves if MyText drawing text is modifiable or not
 IsModifiable = MyText.GetModifiableIn2DComponentInstances
 
Func GetParameterLink( iIndex) As
Returns the pointed parameter link
Parameters:
iIndex
The index of the pointed parameter link. 1 <= iIndex <= NbLink
Example:
This example gets the first parameter link of MyText drawing text.
 Dim MyParm As Parameter
 MyParm = MyText.GetParameterLink(1)
 If MyParm.Value<>"Front view" Then
   'Do something
 End If
 
Func GetParameterOnSubString( iParam, iFirst, inbCharacter) As
Returns a property on a substring of the drawing text.
Parameters:
iParam
The drawing text property
iFirst
The first character to which the property should apply
inbCharacter
The number of characters to which the property should apply
Returns:
oval The value corresponding to the property
Example:
This example gets the parameter Italic on MyText drawing text.
 CatTextProperty iParam = catItalic 
 iFirst = 0
 inbCharacter = 0
 oval = MyText.GetParameterOnsubString(iParam, iFirst, inbCharacter)
 
Sub InsertVariable( iFirst, inbCharacter, ibase)
Sets a Parameter in a string of the drawing text.
Parameters:
iFirst
The first character from which the parameter is inserted
inbCharacter
The number of characters the parameter will replace
iParameter
The parameter to be inserted
Example:
This example sets a parameter right at the end of MyText drawing text.
 Dim DrwDocument As DrawingDocument
 Set DrwDocument = CATIA.ActiveDocument

 Dim iParameter As Parameter
 Set iParameter = DrwDocument.Parameters.Item("Drawing\Sheet.1\ViewMakeUp.1\Scale")

 MyText.InsertVariable 0, 0, iParameter
 
Sub SetFontName( iFirst, inbCharacter, iFontName)
Sets the font size on a substring of the drawing text.
Parameters:
iFirst
The first character to which the property should apply
inbCharacter
The number of characters to which the property should apply
iFontName
The name of the font
Example:
This example sets the MyText drawing text font as Courrier 10 BT.
 MyText.SetFontName 0,  0, "Courrier 10 BT"
 
Sub SetFontSize( iFirst, inbCharacter, iFontSize)
Sets the font size on a substring of the drawing text.
Parameters:
iFirst
The first character to which the property should apply
inbCharacter
The number of characters to which the property should apply
iFontSize
The size of the font
Example:
This example sets the MyText font size to 3.5.
 iFontSize = 3.5
 MyText.SetFontSize 0,  0, iFontSize
 
Sub SetModifiableIn2DComponentInstances()
Sets the text as modifiable in 2D component instances.The text must own to a 2D component (NOT to a view).then ,its content will be modifiable inside instances of this 2D component.
Example:
This example sets the MyText drawing text as modifiable.
 MyText.SetModifiableIn2DComponentInstances 
 
Sub SetParameterOnSubString( iParam, iFirst, inbCharacter, iVal)
Sets a property on a substring of the drawing text.
Parameters:
iParam
The drawing text property
iFirst
The first character to which the property should apply
inbCharacter
The number of characters to which the property should apply
iVal
The value to be applied according to the property
Example:
This example sets all MyText drawing text in bold character.
 CatTextProperty iParam = catBold 
 iFirst = 0
 inbCharacter = 0
 ival = 1
 MyText.SetParameterOnsubString iParam, iFirst, inbCharacter, ival