We have std titleblocks that have both custom properties and prompted entries.
The custom entries set the fields that are common to all sheets in the drawing set
The prompted entries set the fields that are spicific to each sheet ie drawing number line 3 of the title.
I am creating a form that will have a group tab to fill in the common fields and another to populate the prompted entries.
It is easy to do the custom entries but how do i access the prompted entries and what code do i use to set them from the form?
Solved! Go to Solution.
Solved by VdVeek. Go to Solution.
Thanks for that.
It will take me a while to work through the code. do i need to have VB express or similar to make this work?
You can also use iLogic for this (Easier than VB.net). Have a look at this blog: http://blogs.rand.com/manufacturing/2014/05/drawing-title-block-forms-dump-the-prompted-entries.html There is a clear video of how to do it.
Rob.
Thanks for that.
Our title blocks have a 3 x line title setting the first 2 are normaly common to the drawing set and are custom iproperties. I have a form to set these values and all the other entries that are common to the sheet set.
The third line is for the individual sheet only along with the drawing numbers and sheet revision. These are curently set to prompted entries.
I would like my form to have a second tab that sets these entries for the active sheet only.
Is this possible?
I am thinking of some ilogic code that writes the required entries custom iproperties to the active sheet only?
To change or read a Prompted entry you need to search thru the textboxes in your titleblock. The code below searches for a textbox that starts with "<Prompt ReadOnly". This is a way to identify the prompted entry. In this code the founded Prompted entry wil be shown in a messagebox.
I think this code can help you understand the way to solve your question.
Rob.
Dim oDrawDoc As DrawingDocument Dim oSheet As Sheet Dim tb As Inventor.TextBox Dim oBorder As Border Dim borderDef As BorderDefinition Dim oTB1'oTB1 references to Titleblocks Dim sValue As String oDrawDoc = ThisApplication.ActiveDocument oSheet = oDrawDoc.ActiveSheet oBorder = oSheet.Border borderDef = oBorder.Definition oTB1 = oSheet.TitleBlock For Each tb In oDrawDoc.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes If tb.FormattedText.StartsWith("<Prompt ReadOnly") Then sValue = oTB1.GetResultText(tb) MessageBox.Show("Property Field: " & tb.Text & vbCrLf & "Value: " & sValue & vbCrLf & "Prompted Entry: " & tb.FormattedText, "Prompted entry") End If Next
Rob,
I have had a chance to get your code to work and have been able to identify the unique names for the prompted entries that I wish to populate from a form. I have added reference paramaters to the title block and linked those parameters to the form.
Your code searches for "tb.FormattedText.StartsWith("<Prompt ReadOnly")".
As I am not very experienced in VB code I am not sure what code to use to call up the individual prompted entry ie ("<Prompt ReadOnlyUniqueID='8'>DRAWING NO.</Prompt>")
Any assistance would be appreciated.
Regards Vance
To get acces to your Prompted Entry you can use the code below.
In the screencapture you see that my Prompted Entry name is <TEST>
For Each tb In oDrawDoc.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes
If tb.Text = "<TEST>" Then
MsgBox ("YES!")
Else
MsgBox ("No")
End If
Next
Hi Rob,
I am still having Trouble getting this code to set the prompted entries from a Form.
I can find the prompted entries, and get the value of the prompted entry to show in a message box.
In ther code below I can get as far the highlited section but am unsure of what code to use to set the prompted entry to "oDrwNo"
oDrwNo is set from a reference parameter that is set via my form.
I know there is somthing simple that I am missing, any help would be gratfull recieved.
Dim oDrawDoc As DrawingDocument
Dim oSheet As Sheet
Dim tb As Inventor.TextBox
Dim oBorder As Border
Dim borderDef As BorderDefinition
Dim oTB1'oTB1 references to Titleblocks
Dim sValue As String
Dim oDrwNo
Dim oPromptEnt As String
oDrawDoc = ThisApplication.ActiveDocument
oSheet = oDrawDoc.ActiveSheet
oBorder = oSheet.Border
borderDef = oBorder.Definition
oTB1 = oSheet.TitleBlock
For Each tb In oDrawDoc.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes
If tb.Text = "DRAWING NO." Then
sValue = oTB1.GetResultText(tb)
oDrwNo = DRAWING_NO
MessageBox.Show("Property Field: " & tb.Text & vbCrLf & "Value: " & sValue & vbCrLf & "Prompted Entry: " & tb.FormattedText, "Prompted entry")
MessageBox.Show("Param drw no " & oDrwNo, "Title")
???? Set Prompted entry to = oDrwNo ????
oPromptEnt = oTB1.GetResultText(tb)
MessageBox.Show("Prompted value " & oPromptEnt, "Title")
End If
Next
Regards Vance
Vance Your missing line is:
'???? Set Prompted entry To = oDrwNo ????
Call oDrawDoc.ActiveSheet.TitleBlock.SetPromptResultText(tb, oDrwNo)