- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have the following code to update the names in my assembly browser tree in Inventor 2021. It works fine but the model tree does not show the updates until the rule is done so the message box is shown before the model tree is visually updated.
in the code debug.print() just wraps messagebox.show() in a custom library I have for debugging my code. This is a remnant of days before Logger.
For Each oCompOcc In oCompDef.Occurrences
occNum = GetDigitsAfterColon(oCompOcc.Name)
If occNum Is Nothing Then badOcc = True
debug.Print(2, "occNum " & occNum, ruleName)
sPartNum = iProperties.Value(oCompOcc.Name, "Project", "Part Number").Trim()
sPartDesc = iProperties.Value(oCompOcc.Name, "Project", "Description").Trim()
If Len(sPartDesc) = 0 Then badOcc = True
newBrowserName = sPartNum & " ~ " & If(len(sPartDesc) > 0, sPartDesc, "▲▲▲ Missing Description ▲▲▲") & ":" & If(occNum IsNot Nothing, occNum,"▲▲▲ Missing Instance ID ▲▲▲")
oCompOcc.Name = newBrowserName
Next
If badOcc Then
debug.Print(0,"You have 1 or more parts with a missing Description or a missing instance ID." & vbCrLf & vbCrLf & "Please edit the part and update the Description iProperty using the Model Properties Form and save the part." & vbCrLf & vbCrLf & "For a missing Instance ID, please edit the description in the assembly model tree and add one. "":1""", ruleName)
End If
This is how it behaves.
This is how it should look
I want that view before the messagebox pops up so the user can identify the nonconforming parts while the error is on screen.
This is problematic. How can I ensure that the browser tree is visually updated prior to showing the messagebox using my debug.print()?
Solved! Go to Solution.