Accessing Dirty Bits from API

Accessing Dirty Bits from API

brady.deslippe
Explorer Explorer
362 Views
2 Replies
Message 1 of 3

Accessing Dirty Bits from API

brady.deslippe
Explorer
Explorer

Is there any way to determine which bits are set for a dirty document? I can see dirty bits in the ctrl+d window (see picture). I want to access this information within the api for an addin. I.e. I want to be able to say "if dirty because of migration then..." or "if dirty from property edit then ..." etc. 

bradydeslippe_1-1716810178527.png

For more context, we are upgrading our system and have quite the rabbit hole of customizations. I want to be able to catch certain dirtying events, or at least check which have occurred via this dirty bits entry.

 

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

Frederick_Law
Mentor
Mentor
Accepted solution

https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-52286817-FBE8-4891-9909-C1FD6700AAEA

 

Looks like the Ctrl-d has more dirty "reasons".

Sub Main()
Dim oDoc As Document
Dim oCompDef As ComponentDefinition
Dim oModelStates As ModelStates
Dim oModelState As ModelState
Dim oOccu As ComponentOccurrence
Dim oOccuDef As ComponentDefinition
Dim oOccuDoc As Document
Dim CommandEnum As Integer

'break

oDoc = ThisDoc.Document
Logger.Info(oDoc.DisplayName & " Changed " & oDoc.RecentChanges)
CommandEnum = oDoc.RecentChanges
If (CommandEnum >= 1024) Then
	Logger.Info("View Rep Switch " & CommandEnum)
	CommandEnum = CommandEnum - 1024
End If
If (CommandEnum >= 512) Then
	Logger.Info("ModelState Switch " & CommandEnum)
	CommandEnum = CommandEnum - 512
End If
If (CommandEnum >= 256) Then
	Logger.Info("ModelState Update, dirty " & CommandEnum)
	CommandEnum = CommandEnum - 256
End If
If (CommandEnum >= 128) Then
	Logger.Info("File Format Change, dirty " & CommandEnum)
	CommandEnum = CommandEnum - 128
End If
If (CommandEnum >= 64) Then
	Logger.Info("Reference Change, dirty " & CommandEnum)
	CommandEnum = CommandEnum - 64
End If
If (CommandEnum >= 32) Then
	Logger.Info("NonShapeEdit, dirty " & CommandEnum)
	CommandEnum = CommandEnum - 32
End If
If (CommandEnum >= 16) Then
	Logger.Info("Reference File Change, dirty " & CommandEnum)
	CommandEnum = CommandEnum - 16
End If
If (CommandEnum >= 8) Then
	Logger.Info("Properties Change, dirty " & CommandEnum)
	CommandEnum = CommandEnum - 8
End If
If (CommandEnum >= 4) Then
	Logger.Info("File Op, dirty " & CommandEnum)
	CommandEnum = CommandEnum - 4
End If
If (CommandEnum >= 2) Then
	Logger.Info("Query " & CommandEnum)
	CommandEnum = CommandEnum - 2
End If
If (CommandEnum >= 1) Then
	Logger.Info("Geometry Change, dirty " & CommandEnum)
End If
End Sub
Message 3 of 3

brady.deslippe
Explorer
Explorer

This is it! Thank you so much. I knew I was going to need to decompose some value but didn't know where it was stored (I was not aware of the "RecentChanges" property).

 

 

0 Likes