
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am begginer at writing code in Inventor VBA Editor, and this is probably something easy, but... I am stuck.
I am editing some code from 'Sample Programs' to get a program, which creates new sketch with text box.
It's working well, but I don't know how to change font and font size of text in text box.
Code:
Sub textbox()
'Create a new part document, using the defauld part template.
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
'Set a reference to the component definition.
Dim oCompDef As PartComponentDefinition
Set oCompDef = oPartDoc.ComponentDefinition
'Create a new sketch on the X-Y work plane
Dim oSketch As PlanarSketch
Set oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes(3))
' Set a reference to the transient geometry object.
Dim oTransGeom As TransientGeometry
Set oTransGeom = ThisApplication.TransientGeometry
' Create a text box at (5mm,5mm)
Dim oTextBox As textbox
Set oTextBox = oSketch.TextBoxes.AddFitted(oTransGeom.CreatePoint2d(0.5, 0.5), "HELLO")
oTextBox.Style.Font = "Verdana"
oTextBox.Style.FontSize = 5
End Sub
But it leaves text with standard font and font size:
Of course I searched forum for solution, but none of the topics with solution helped.
Solved! Go to Solution.