Hi @ all!
ich hätte da gern mal wieder ein Problem.
Ich möchte in eine Zeichnungsableitung (DrawingDocument) eine Inventor Textbox mit Text aus einem String einfügen. Das Problem liegt darin, dass ich es bisher nur geschafft habe eine Textbox als Skizze in die Zeichnung einzufügen und auch nur mit vorab bestimmter Position. Das ganze ist jedoch n bischen umständlich, weshalb ich fragen möchte, ob jemand weiß wie man eine Textbox mit bereits vorhandenem Inhalt direkt in die Zeichnung einfügen kann, so dass sie an der Maus hängt und sie an der richtigen Stelle abgelegt werden kann.
Mit der etwas unpraktischen Methode sieht der Code wie folgt aus:
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
' Create a new sketch on the active sheet.
Dim oSketch As DrawingSketch
Set oSketch = oDrawDoc.ActiveSheet.Sketches.Add
' Open the sketch for edit so the text boxes can be created.
' This is only required for drawing sketches, not part.
oSketch.Edit
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
' Create text with simple string as input. Since this doesn't use
' any text overrides, it will default to the active text style.
Dim oTextBox As Inventor.TextBox
Set oTextBox = oSketch.TextBoxes.AddFitted(oTG.CreatePoint2d(30, 1), TextBox1.Text)
oSketch.ExitEdit
Vielen Dank für Vorschläge ohne unnötige Skizze!
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP