09-17-2020
04:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-17-2020
04:41 AM
Like this then? ![]()
Sub Main' SketchTextAdd() ' a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument ' Create a new sketch on the active sheet. Dim oSketch As Inventor.Sketch 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 'Identify border type Dim oBorder = ActiveSheet.Border Dim oTG As TransientGeometry 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 sText As String sText = InputBox("Enter new Title Text", "Secondary Title ", "") iProperties.Value("Custom", "Second Title "& ActiveSheet.Name) = sText Dim oTextBox As Inventor.TextBox If oBorder = "A3" Then oTextBox = oSketch.TextBoxes.AddByRectangle(oTG.CreatePoint2d(22.7, 3.2),oTG.CreatePoint2d(35,2.4), sText) Else If oBorder = "A4" Then oTextBox = oSketch.TextBoxes.AddByRectangle(oTG.CreatePoint2d(10.39, 3.2),oTG.CreatePoint2d(22,2.4), sText) Else If oBorder = "A4_P" Then oTextBox = oSketch.TextBoxes.AddByRectangle(oTG.CreatePoint2d(11.15, 6.195), oTG.CreatePoint2d(20.25, 4), sText) Dim oStyle As TextStyle = oTextBox.Style oStyle.Font = "Arial" oStyle.FontSize = 1 End If oSketch.ExitEdit End Sub
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website