Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug with checking ErrorManager with VBA?

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
pball
1095 Views, 9 Replies

Bug with checking ErrorManager with VBA?

I just want to see if anyone else has this issue or if anyone knows if this is normal before I submit a real bug report.

 

I try and check drawings for errors before exporting them with a script but my function never catches drawings with errors. I just did a little test and found a weird behavior. I took a dimensioned drawing and moved a dimension off the part and accepted the warning that the dimension was unattached to geometry. Then I ran the line of code shown below in the VBA editor Immediate window and it returned True. I then switched to another open part and then back to the drawing with the unattached dimension. The code below now returns False. The design doctor icon is still a red cross and the error is still present but the errormanager api has apparently been reset and won't show any warnings.

 

debug.Print ThisApplication.ErrorManager.HasWarnings

 

The error manager also will not report errors when a drawing is opened and already has an error. It apparently only returns errors when the error occurs while the drawing is open and the drawing has been active since the error occurred.

9 REPLIES 9
Message 2 of 10
skyngu
in reply to: pball

yes, it happened on me. I am not sure if it is a bug.
Autodesk Inventor Professional 2019
Message 3 of 10
Anonymous
in reply to: pball

ErrorManager is for recorded errors / warnings.

Message 4 of 10
pball
in reply to: Anonymous

I don't understand what you are trying to say. Shouldn't an existing error be recorded?
Message 5 of 10
thom-g
in reply to: pball

Hi @pball, I know, it is an old thread, but I got the same problem.

The ErrorManager seems only to record errors who occured inside a transaction in your own add-in (or VBA).

The property we need does not exist yet.

You can support this idea if you like: https://forums.autodesk.com/t5/inventor-ideas/new-property-for-existing-errors/idi-p/8868254

Message 6 of 10
CattabianiI
in reply to: thom-g

I got the same problem and I came up with this workaround:

For Each cc As CommandControl In ThisApplication.UserInterfaceManager.Ribbons.Item("Drawing").QuickAccessControls
If cc.DisplayName.ToUpperInvariant = "DESIGN DOCTOR" Then
Return cc.ControlDefinition.Enabled
End If
Next

Clearly InternalName is better than DisplayName and I didn't test if it works when the red cross is not visible.
Let me know if there are some drawbacks.
Implementation of your Idea would be the better solution.

@pball 

Message 7 of 10
greg_fletcher
in reply to: CattabianiI

ignore me

Message 8 of 10
pball
in reply to: CattabianiI

Haven't implemented this yet in any of my printing or exporting scripts yet but my initial testing looked good. It doesn't matter if the design doctor is shown or not in the quick access controls. I also played around to shorten up the code some more.

 

ThisApplication.UserInterfaceManager.Ribbons.Item("Drawing").QuickAccessControls.Item("AppDesignDoctorCmd").ControlDefinition.Enabled

Thanks @CattabianiI for finding and sharing this.

Message 9 of 10
thom-g
in reply to: pball

@pball  & @CattabianiI: Nice work arround! It also works with .Net add-ins. Thanks for sharing a solution.

Message 10 of 10
maxim.teleguz
in reply to: pball

ThisApplication.CommandManager.ControlDefinitions.Item("AppDesignDoctorCmd").Enabled = True ' or False

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report