Hello together,
how could I read / change prompted entry through code from titleblock (for example DIN) within VB.Net?
Thank you Georg
I made something like that some days ago, my code is very simple, using parts from the Programming help, but its working :).
I just put it linked to a form and some parameters, So ai can change the text from any Prompted Entry in the title block:
I cleaned the code because it was too long, if you dont understand plz post it, that ill try explain a little better:
Imports Inventor.UnitsTypeEnum ' Create Custom Paramteres if not done.Dim oPartDoc as DrawingDocument = ThisDoc.Document Dim userParams As UserParameters = oPartDoc.Parameters.UserParameters Dim parametro As String Dim oSheet As Sheet Dim oTitleBlock as TitleBlock Dim oTextBox As TextBox Dim oTextBoxes as TextBoxes Dim carimbo As String oSheet = ThisApplication.ActiveDocument.ActiveSheet If oSheet.TitleBlock Is Nothing Then Exit Sub oTitleBlock = oSheet.TitleBlock If oTitleBlock.Definition.Sketch.TextBoxes Is Nothing Then Exit Sub oTextBoxes = oTitleBlock.Definition.Sketch.TextBoxes '---------------------------------------------------------------------------------------------------------------'read the Prompted entryTry parametro = "PROMPTED ENTRY PARAMETER NAME" i = oPartDoc.Parameters(parametro) Catch For Each oTextBox In oTextBoxes If oTextBox.Text = "PROMPTED ENTRY NAME" Then Exit For Next If oTitleBlock.GetResultText(oTextBox) = "X" Then criacao = True Else criacao = False End If Dim newParam As UserParameter = userParams.AddByValue(parametro,criacao,kBooleanUnits) End Try '--------------------------------------------------------------------------------------------------------------- '------------------------------ 'write the Prompted entry For Each oTextBox In oTextBoxes If oTextBox.Text = "PROMPTED ENTRY NAME" Then Exit For Next If Parameter("PROMPTED ENTRY PARAMETER NAME") = True Then carimbo = "X" Else carimbo = "" End If If oTextBox Is Nothing Or oTextBox.Text <> "Botão - P/ Referência" Then Exit Sub oTitleBlock.SetPromptResultText( oTextBox, carimbo )
Hi GeorgK,
the code of tuliobarata is nice. one more blog may help you:
Please mark tuliobarata's message as a solution if you think it helps you.