Change text size of a TextBox object in a part document sketch?

Change text size of a TextBox object in a part document sketch?

chuck_b
Enthusiast Enthusiast
1,609 Views
3 Replies
Message 1 of 4

Change text size of a TextBox object in a part document sketch?

chuck_b
Enthusiast
Enthusiast
This code works with no errors but does not change the text size. A user can overide the text size (Font size) so I'm hoping it is possible thru code. Thanks, Chuck

Dim oSketch As Inventor.Sketch
Set oSketch = oPartDoc.ComponentDefinition.Sketches("Sketch1")
Dim oText As Inventor.TextBox
Set oText = oSketch.TextBoxes.AddByRectangle(pnt1, pnt2)
oText.Style.FontSize = 0.1
0 Likes
Accepted solutions (1)
1,610 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Accepted solution

The Font Size control is not for the entire text
box. Rather, it can be applied to individual characters within the text box.i.e.
different characters can have different overrides. So you'll need to use the
FormattedText property to define such overrides.

 

oTextBox.FormattedText = "<StyleOverride
FontSize = '.6096'>" & "some text" &
"</StyleOverride>"

 

Note that the font size is specified in
centimeters.

 

Sanjay-
0 Likes
Message 3 of 4

Anonymous
Not applicable

but the formatted text will put default text like "some text".

 

What if we want   

 

 "<StyleOverride 
FontSize = '.6096'>" & opartOcc.name & 
"</StyleOverride>"

 

kind of output????

0 Likes
Message 4 of 4

Anonymous
Not applicable

Yup... Got it mate... Cheers...

0 Likes