By Barbara Han
SetPromptResultText function is the API for changing the prompted text in the Border or TitleBlock or SketchedSymble. Each Border/TitleBlock/SketchedSymble has one correspondent Definition object. One BorderDefinition may have many Borders referring to it, but one Border can only refer to one BorderDefintion. This relationship is similar to the BlockDefintion and BlockReference in AutoCAD API. The first parameter of the SetPromptResultText function is the TextBox in the sketch of the Defintion object.
Below picture shows what is the BorderDefinition and what is the Border in the drawing:
Here is the VB.NET sample code that changes a prompted text in the Border containing prompted entry named "<Sheet Description>" in the active sheet.
' Thisapplication is a global variable of Inventor.Application
Dim doc As DrawingDocument=ThisApplication.ActiveDocument
Dim tb As TextBox
Dim i As Integer= 1
Dim border As Border= doc.ActiveSheet.Border
Dim borderDef As BorderDefinition= border.Definition
For Each tb In borderDef.Sketch.TextBoxes
If tb.Text = "<Sheet Description>" Then
borderDef.Sketch.TextBoxes.Item(i), "first sheet")
i = i + 1
Please note that the SetPromptResultText is designed for changing the prompted text in the Border/TitleBlock/SketchedSymble. If you want to change the prompted text in the BorderDefiniton, you can’t call SetPromptResultText, instead you can directly change the FormattedText or Text property of the BorderDefiniton object. FormattedText is the string containing the XML tag like <Prompt….>, but the Text is just the string that you see when you edit text in the sketch of the Border definition symbol.