VBA / iLogic drawing control of Red Cross

VBA / iLogic drawing control of Red Cross

torbjorn_heglum2
Collaborator Collaborator
466 Views
3 Replies
Message 1 of 4

VBA / iLogic drawing control of Red Cross

torbjorn_heglum2
Collaborator
Collaborator

I am making a VBA macro that performs some updates and checks of Inventor drawings when saved, currently in Inventor 2020. One of the things to check is if there are any Inventor errors in the drawing, i.e if the red cross is lit (Typically pink dimensions, pink center lines etc). After tips from this forum I am using the following to check if red cross is lit:

 

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

 

I need to check each individual sheet, but that's no problem. The challenge is that the Red Cross seems to be turned off when a drawing is saved even for sheets with errors. The challenge is to get it updated to be lit again. I have tried a few ways:

  • document.update / document.update2
  • sheet.update
  • I noticed that if i manually move a view in a sheet with errors, I can manually update it via the lightening bolt, and the Red Cross is lit. Replicated this is VBA, but then it still doesn't trigger the Red Cross.
  • I noticed that if I set all views imprecise, then back to precise the Red Cross is lit. Replicated this in VBA, and if this is done once for each sheet the Red Cross for the sheet is actually lit and the check works.

The challenge with this workaround is that it is time consuming for larger drawings, you can imagine that it is a bit slow to imprecise/precise all views x 10 in a 10 sheet drawing with 100 views.

 

So the question; do anyone have a tip for a more effective way to find the sheets with inventor errors?

 

Torbjørn

0 Likes
Accepted solutions (1)
467 Views
3 Replies
Replies (3)
Message 2 of 4

A.Acheson
Mentor
Mentor
Accepted solution

It would probably be better to target errors more directly. Here is one such approach target dimensions that are unnatached. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 4

WCrihfield
Mentor
Mentor

Hi @torbjorn_heglum2.  Have you considered just checking if DrawingDocument.RequiresUpdate or DrawingDocument.Dirty properties?  The next, and more specifically accurate thing you could be checking is the Sheet.Status property of each sheet.  The value of that property is a variation of the DrawingSheetStatusBits Enumerator.  It has only one variation for when everything is OK, and its value is zero, so that one is easy to check.  However, if there is more than one type of issue, it can be a bit complicated to figure out which issues those are, because it requires 'bit operations'.  If that is not good enough, the next suggestion would be to loop through all the 'usual suspects', checking them individually, similar to what is shown in the link in the other response, but far more robust.  That second route would certainly require a lot of code though.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 4

torbjorn_heglum2
Collaborator
Collaborator

Thanks guys, I followed the tip of checking the health of all dimensions, centerlines etc individually. Not that much code, but still quite quick to run, even on a 15 sheet drawing.

 

Torbjørn

0 Likes