- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Folks,
I have been attempting to automate some prompted entry (PE) values using iLogic and the SetPromptResultText command.
The command works on the customer-supplied template I have if I create a new PE called <DELETEME> - my code also works on this new PE even if I delete the "<" & ">" from either end of the string so it becomes "DELETEME".
The command doesn't work on the customer supplied fields of "PURPOSE OF ISSUE" & "PROJECT REF No" but if I add < & > to either end (so they become "<PROJECT REF No>" & "<PURPOSE OF ISSUE>" respectively) and modify my code to look for that instead, lo and behold it works.
Can anybody shed any light on why it works with the "<" & ">" on the ends of the string but not without?
My guess is that the "<" & ">" allow the PE to have spaces and without it Inventor 2013 throws the dummy in the dirt and refuses to play nice! - Just tested that theory and it's clearly cobblers...
Thanks,
Alex.
Edit: Here's the sub-routine I wrote (with the working "<" & ">" still in place) before anyone asks to see it:
Sub UpdatePromptedEntries(oDoc As DrawingDocument) 'assumes the oDoc is activated Dim oPromptEntry Dim actSheet As Sheet = ThisApplication.ActiveDocument.ActiveSheet 'For Each oSheet In ThisApplication.ActiveDocument.Sheets For Each oSheet In oDoc.Sheets 'MessageBox.Show(oSheet.Name, "Sheet Name") ActiveSheet=ThisDrawing.Sheet(oSheet.Name) If oSheet.TitleBlock Is Nothing Then Exit Sub 'MessageBox.Show("Title OKAY!", "Go Gadget Go") oTitleBlock=oSheet.TitleBlock oTextBoxes=oTitleBlock.Definition.Sketch.TextBoxes For Each oTextBox In oTitleBlock.Definition.Sketch.TextBoxes 'comment this ASAP otherwise it will break! ALOT! ' If Not oTitleBlock.GetResultText(oTextBox) = String.Empty Then ' MessageBox.Show(oTitleBlock.GetResultText(oTextBox), oTextBox.Text) ' Else ' MessageBox.Show(oTextBox.Text, "Empty PE Found!") ' End If Select oTextBox.Text Case "<PROJECT REF No>": oPromptEntry = ThisProjectNo Call oTitleBlock.SetPromptResultText(oTextBox, oPromptEntry) Case "<PURPOSE OF ISSUE>": oPromptEntry = ThisPurposeForIssue 'MessageBox.Show(oTitleBlock.GetResultText(oTextBox), "PURPOSE OF ISSUE") MessageBox.Show("BEFORE Intended Purpose for issue: " & ThisPurposeForIssue, "PURPOSE OF ISSUE") Call oTitleBlock.SetPromptResultText(oTextBox, oPromptEntry) MessageBox.Show("AFTER Intended Purpose for issue: " & ThisPurposeForIssue, "PURPOSE OF ISSUE") Case "DELETEME": oPromptEntry = "BUGGER ME IT WORKS!" Call oTitleBlock.SetPromptResultText(oTextBox, oPromptEntry) Case "DELETE ME": oPromptEntry = "WTF DUDES?" Call oTitleBlock.SetPromptResultText(oTextBox, oPromptEntry) End Select Next Next actSheet.Activate InventorVb.DocumentUpdate() End Sub
Alex Fielder
Inventor Expert
https://github.com/alexfielder/
LinkedIn - Github Inventor Extension Server - Bonkers polygon iLogic thing
Top ten iLogic Tips - API Shortcut In Google Chrome - Assembly Extrusion Example
Solved! Go to Solution.