Code and syntax to create a new text style for textboxes in a part file

Code and syntax to create a new text style for textboxes in a part file

Anonymous
Not applicable
387 Views
0 Replies
Message 1 of 1

Code and syntax to create a new text style for textboxes in a part file

Anonymous
Not applicable

Hello,

I am new to VBA and Inventor's API in general. I am attempting to create a new text style in a part file to input into the oSketch.Textboxes.AddFitted Method. I am attempting to extrude a label number onto a flat plane. The file is an iPart with different numbers for variations. The main goal is to reduce the font size of the individual variation without affecting the entire file in order to create labels with numbers in the hundreds. This seems to be a simple question, but how do I create the new text style to use in my AddFitted Method? Here is the relevant code:

 

Set oFrontFace = ThisApplication.CommandManager.Pick(kPartFacePlanarFilter, "Pick the face")
Set oSketch = oCompDef.Sketches.AddWithOrientation(oFrontFace, _
                    oCompDef.WorkAxes.Item(1), True, True, oCompDef.WorkPoints(1))

 

Dim oTextBox as Textbox

 

If Label >= 100 Then
        ' Create a centered textbox
        Set oTextBox = oSketch.TextBoxes.AddFitted(oTransGeom.CreatePoint2d(0.01, 0.4), Label, _____)
    Else
        Set oTextBox = oSketch.TextBoxes.AddFitted(oTransGeom.CreatePoint2d(0.127, 0.4), Label, _____)

End If

0 Likes
388 Views
0 Replies
Replies (0)