Macro count revision tags

Macro count revision tags

maurice.clermont
Observer Observer
719 Views
6 Replies
Message 1 of 7

Macro count revision tags

maurice.clermont
Observer
Observer

Hey everyone! 🙂

 

Does somebody know how to let Inventor count all revision tags on a drawing automatically?

 

We have to count every revision tag one by one and write the amount on the drawing header. This is quite annoying and time consuming.  Therefore, I want to write a macro which does exactly that.

 

I would really appreciate any help from you. 🙂

0 Likes
720 Views
6 Replies
Replies (6)
Message 2 of 7

WCrihfield
Mentor
Mentor

Hi @maurice.clermont.  I may be wrong, because I'm still using Inventor 2022.3.1, but as of that release, there is no variation within the ObjectTypeEnum, nor in the SelectionFilterEnum for a revision tag type object.  And I do not recall seeing that object listed within the API Object Model chart for it either.  There is however a manual selection filter for them, when you are in a drawing.  On the quick access toolbar, there is usually a tool with a drop-down arrow beside it for the selection filter.  When you click that drop-down, then select 'Edit Select Filters...', it brings up a larger dialog.  You can uncheck all others in the list, then scroll down and check the box next to Revision Tag, to limit your selection window to just them.  This should help some.

WCrihfield_0-1663694503608.png

WCrihfield_1-1663694689529.png

 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 7

WCrihfield
Mentor
Mentor

I'm thinking the closest we could get to a code for revision related data would be to get the current revision level, and count how many rows there are in the revision table.  Here is an API sample (link below) in VBA (not iLogic) which accesses the revision table, and its contents in a drawing.  Unfortunately, there is no mention of revision tags, because they simply are not included in the API yet...at least not in a way that is accessible to us.

https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=RevisionTable_Sample 

https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-6F886A82-A35E-4C4F-BF73-AF44F538793D 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 7

tyler.warner
Advocate
Advocate

At our company we made a sketch symbol that we use instead of the revision tags but looks the same. You can then use the info above to populate your revision tag sketch symbols & then you're able to count the sketch symbols using the API.

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
Message 5 of 7

maurice.clermont
Observer
Observer

Thank you all for your fast and helpful replies. I'm not sure if our company will allow me to use sketch symbols instead of revision tags. However, I'll try it. 

Alternatively, I'll count them with the specialized selection filter.

 

@tyler.warner do you have a VBA code for counting those "revision tag" sketch symbols that you would share with me? 🙂

 

In my opinion it's a shame that it isn't possible to count those tags automatically. Hopefully, Autodesk will update this in the next Inventor version.

0 Likes
Message 6 of 7

tyler.warner
Advocate
Advocate

@maurice.clermont here is some VB.NET iLogic code to do what you asked, should be easy enough to convert to VBA.

 

 

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument		
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
Dim oSketchedSymbols As SketchedSymbols = oSheet.SketchedSymbols
Dim oSymbolCount As Integer = 0

For Each oItem As SketchedSymbol In oSketchedSymbols	
	If oItem.Name = "REV. TRIANGLE" Then oSymbolCount += 1	
Next

MsgBox("There are " & oSymbolCount & " Revision Tag sketched symbols on this drawing.")

 

 

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
Message 7 of 7

holgerb-mardmoeller
Contributor
Contributor
0 Likes