Change occurrence color, then reset it back to how it was before

Change occurrence color, then reset it back to how it was before

bshbsh
Collaborator Collaborator
323 Views
1 Reply
Message 1 of 2

Change occurrence color, then reset it back to how it was before

bshbsh
Collaborator
Collaborator

Hi,

I'm changing colors (appearances) of occurrences within an interactive vba macro, then when it's done, they need to be changed back (reset) to how they were before.

But the way I do this (storing appearance and appearance source) doesn't work perfectly, as it discards any possible previous overrides. But dealing with overrides is really too awkward just for this.

Unless there's a simple way to achieve this, that I don't know of.

Making temporary design views isn't great either.

Does anyone have any hints or ideas how to do this?

0 Likes
324 Views
1 Reply
Reply (1)
Message 2 of 2

clutsa
Collaborator
Collaborator

Can you try this? It undoes everything. 

Dim app As Inventor.Application = ThisApplication
Dim TransMgr As TransactionManager = app.TransactionManager
Dim myTrans As Transaction = TransMgr.StartTransaction(app.ActiveDocument,"ColorChanges")

'Your code here
'...
'...

myTrans.End
TransMgr.UndoTransaction

Otherwise you can use it in your code to break up sections and just undo those sections.

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes