Set Prompted Entry for Sketched Symbol

<?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:

SketchedSymbol1

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:

SketchedSymbol2

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

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading