Difference between revisions of "Text"
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Placing text is much more dependent on ActiveSettings, so the command itself is pretty simple. It involves setting up a point (like [[lines]] or [[cells]]) and a rotation matrix, and giving the text to be placed, but otherwise most of the settings are stored in a property of ActiveSettings called TextStyle, which itself has a number of properties like Width, Height, and Justification. | Placing text is much more dependent on ActiveSettings, so the command itself is pretty simple. It involves setting up a point (like [[lines]] or [[cells]]) and a rotation matrix, and giving the text to be placed, but otherwise most of the settings are stored in a property of ActiveSettings called TextStyle, which itself has a number of properties like Width, Height, and Justification. | ||
− | First you have to set up a variable to hold the text element, | + | First you have to set up a variable to hold the text element, [[Rotation Matrix]] and text string: |
<PRE> | <PRE> | ||
Line 9: | Line 9: | ||
</PRE> | </PRE> | ||
− | Before creating the text elements, make sure the ActiveSettings are what you want. For Justification there are a bunch of | + | Before creating the text elements, make sure the ActiveSettings are what you want. For Justification there are a bunch of built-in constants that can be used: |
<PRE> | <PRE> | ||
Line 15: | Line 15: | ||
ActiveSettings.TextStyle.Height = 2 * sca | ActiveSettings.TextStyle.Height = 2 * sca | ||
ActiveSettings.TextStyle.Width = 2 * sca | ActiveSettings.TextStyle.Width = 2 * sca | ||
+ | oMatrix=Matrix3dIdentity | ||
</PRE> | </PRE> | ||
Line 20: | Line 21: | ||
<PRE> | <PRE> | ||
− | Set oText = CreateTextElement1(Nothing, strText, ptStart, | + | Set oText = CreateTextElement1(Nothing, strText, ptStart, oMatrix) |
ActiveModelReference.AddElement oText | ActiveModelReference.AddElement oText | ||
+ | </PRE> | ||
+ | |||
+ | If you aren't rotating the text, you don't have to set up a matrix element and can just put Matrix3dIdentity in the function call. | ||
+ | |||
+ | ==Text Justification Settings== | ||
+ | |||
+ | Text justification is set as shown above. Here are the choices: | ||
+ | |||
+ | <PRE> | ||
+ | msdTextJustificationLeftTop | ||
+ | msdTextJustificationLeftCenter | ||
+ | msdTextJustificationLeftBottom | ||
+ | msdTextJustificationCenterTop | ||
+ | msdTextJustificationCenterCenter | ||
+ | msdTextJustificationCenterBottom | ||
+ | msdTextJustificationRightTop | ||
+ | msdTextJustificationRightCenter | ||
+ | msdTextJustificationRightBottom | ||
</PRE> | </PRE> |
Latest revision as of 15:07, 13 August 2010
Placing text is much more dependent on ActiveSettings, so the command itself is pretty simple. It involves setting up a point (like lines or cells) and a rotation matrix, and giving the text to be placed, but otherwise most of the settings are stored in a property of ActiveSettings called TextStyle, which itself has a number of properties like Width, Height, and Justification.
First you have to set up a variable to hold the text element, Rotation Matrix and text string:
Dim oText as TextElement Dim oMatrix as Matrix3d Dim strText as String
Before creating the text elements, make sure the ActiveSettings are what you want. For Justification there are a bunch of built-in constants that can be used:
ActiveSettings.TextStyle.Justification = msdTextJustificationCenterBottom ActiveSettings.TextStyle.Height = 2 * sca ActiveSettings.TextStyle.Width = 2 * sca oMatrix=Matrix3dIdentity
Then you store the element in your TextElement variable and add it to the drawing:
Set oText = CreateTextElement1(Nothing, strText, ptStart, oMatrix) ActiveModelReference.AddElement oText
If you aren't rotating the text, you don't have to set up a matrix element and can just put Matrix3dIdentity in the function call.
Text Justification Settings
Text justification is set as shown above. Here are the choices:
msdTextJustificationLeftTop msdTextJustificationLeftCenter msdTextJustificationLeftBottom msdTextJustificationCenterTop msdTextJustificationCenterCenter msdTextJustificationCenterBottom msdTextJustificationRightTop msdTextJustificationRightCenter msdTextJustificationRightBottom