Question:
The title blocks that we use have prompted entries. I would like to find a way using iLogic to copy the entries from one title block to another within the same drawing.
Solution:
In API, every title block has the corresponding title block definition which defines the prompt text. When the end user tries to insert a title block, the mechanism behind is inserting an instance of the title block definition. The user will be asked to input the final text for the prompt text. the API object TitleBlock provides the method GetResultText to know the final text. Conversely, if you want to set the final text, you can call TitleBlock.SetPromptResultText.
Following iLogic code assumes the drawing has two sheets which use the same title block. In the title block, there is one prompt text named "MY_PROMPT". It will get the result string in sheet1 and copies to sheet2.
' assume sheet1 and sheet use the same title block definition Dim oDoc oDoc = ThisApplication.ActiveDocument 'get first sheet Dim oSheet1 oSheet1 = oDoc.Sheets(1) 'get titleblock of sheet1 Dim oTB1 oTB1 = oSheet1.TitleBlock ' search the textbox in definition Dim oPromptText Dim oEachText Dim I For I = 1 To oTB1.Definition.Sketch.TextBoxes.Count oEachText = oTB1.Definition.Sketch.TextBoxes(I) If (oEachText.Text = "MY_PROMPT") Then ' found the prompt text we want to copy oPromptText = oEachText Exit For End If Next I 'get the result string of the prompt text Dim oPromptEntry oPromptEntry = oTB1.GetResultText(oPromptText) 'get sheet2 Dim oSheet2 As Sheet oSheet2 = oDoc.Sheets(2) 'get titleblock of sheet2 Dim oTB2 As TitleBlock oTB2 = oSheet2.TitleBlock ' copy the result string of the prompt text to the prompt text in sheet2 oTB2.SetPromptResultText(oEachText, oPromptEntry)