<?xml encoding=”UTF-8″>By Adam Nagy
You can do it in a similar way to Borders:
http://adndevblog.typepad.com/manufacturing/2012/07/getset-the-prompted-text-in-the-border-of-a-sheet-in-inventor-api.html
We have the following drawing with a single SketchedSymbolDefinition and instance of it:
If we select it in the UI then the following VBA code will change its PrompterEntry value to “NewValue“:
Sub MofidyPromptedEntry()
Dim oSS As SketchedSymbol
Set oSS = ThisApplication.ActiveDocument.SelectSet(1)
Dim oTB As TextBox
For Each oTB In oSS.Definition.Sketch.TextBoxes
If oTB.Text = "<MyPrompt>" Then
Call oSS.SetPromptResultText(oTB, "NewValue")
End If
Next
End Sub
The result:
You could also use the same API from an iLogic rule:
' Set the value for the first sketched symbol
' on the current sheet
Dim oSS As SketchedSymbol
oSS = ActiveSheet.Sheet.SketchedSymbols(1)
Dim oTB As TextBox
For Each oTB In oSS.Definition.Sketch.TextBoxes
If oTB.Text = "<MyPrompt>" Then
Call oSS.SetPromptResultText(oTB, "NewValue")
End If
Next



Leave a Reply