Can I in any way see if the Design Doctor "is active" - i.e. detect if I have a Red Cross:
There is a sample in the help, "Using Inventor's error dialog API Sample", but I can only record errors. I am running a long configuration rule, and I want to make sure that I don't start out with "legacy" errors.
Solved! Go to Solution.
Solved by BrianEkins. Go to Solution.
There were plans at one point to expose the Design Doctor through the API but it never happened. However, you can still get some failure or error information by interrogating the model. The VBA macro and function below check to see if any of the features in a part have problems. To do a full check you would also want to check the health state of sketches and work features.
Public Sub TestProblems() Dim partDoc As PartDocument Set partDoc = ThisApplication.ActiveDocument If PartHasProblems(partDoc) Then MsgBox "Part has problems" Else MsgBox "Part is OK" End If End Sub Public Function PartHasProblems(partDoc As PartDocument) As Boolean Dim feature As PartFeature For Each feature In partDoc.ComponentDefinition.Features If feature.HealthStatus <> kUpToDateHealth And _ feature.HealthStatus <> kBeyondStopNodeHealth And _ feature.HealthStatus <> kSuppressedHealth Then PartHasProblems = True Exit Function End If Next PartHasProblems = False End Function
There is currently zero API capability for the drawing functionality.
Gang...
It's Inventor 2023 now. Any update on this? Still have to use VBA?
We are now putting welds into assemblies and when they fail, it's easily over-looked. Just want a message box that pops up when the the red cross is active telling the user that something is wrong. Plan on triggering it before a save. Unsure if I want to do just welds or when anything is wrong in an assembly. Might open a can of worms, but ohh well 🙂
Best,
Steve H.
I am seeing success by testing the button state (assuming the design doctor button is on the drawing quick access toolbar)
Dim rb = ThisApplication.UserInterfaceManager.Ribbons.Item("Drawing").QuickAccessControls.Item("AppDesignDoctorCmd")
If rb.ControlDefinition.Enabled Then
MsgBox("Drawing has broken elements!")
End If