TransactionManager - issue

TransactionManager - issue

Rene_Gerlach
Advocate Advocate
700 Views
7 Replies
Message 1 of 8

TransactionManager - issue

Rene_Gerlach
Advocate
Advocate

Hello,

 

I tried to use the TransactionManager to grouping changes.

So I'm calling

oTrans = StartTransaction(ActiveDocument, "Grouped changes")

do some stuff

oTrans.End

in the Undo/Redo I can see my "Grouped changes", but all other Transactions are lost.

 

I'm calling this inside the ApplicationEvents::OnNewDocument(..kAfter...)

after the user closed the mirror dialog.

 

If i'm not using the Transaction, the mirror command will be visible in the Undo/Redo. So I think no document will be closed in the mirror action.

 

What I'm want to achieve: Add my doing to the mirror transaction, as a child transaction. 

 

What I'm doing wrong, how to solve this?

 

Regards

Rene

 

 

0 Likes
701 Views
7 Replies
Replies (7)
Message 2 of 8

AlexFielder
Advisor
Advisor

If you can share what code you have so far we can help you work it out.

 

Specific examples of any error messages (both pages of the error dialogue) will help too.

 

🙂

0 Likes
Message 3 of 8

Rene_Gerlach
Advocate
Advocate

I have simplyfy my code and find out which call resets the TransactionManager:

 

ApplicationEvents.OnNewDocument( DocumentObject As Document, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, HandlingCode As HandlingCodeEnum )

  DocumentObject.Save2(true) '<<--- this one resets the TransactionManager

0 Likes
Message 4 of 8

AlexFielder
Advisor
Advisor

That would be the expected behaviour, after all you can't undo a save operation manually. Glad you found the issue! 🙂

0 Likes
Message 5 of 8

Rene_Gerlach
Advocate
Advocate

I think this is not the expected behavior.

Please try the following:

1) Create a new part

2) create a box, or something else

3) save this

--> in the Undo/Redo you can see:

transaction-new file.png

so after a save the undo should be possible.

 

0 Likes
Message 6 of 8

chandra.shekar.g
Autodesk Support
Autodesk Support

@Rene_Gerlach ,

 

Just, I checked with engineering team. It is not recommended to use Document.Save method in a transaction. It is "As Designed" by Inventor API.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 7 of 8

Rene_Gerlach
Advocate
Advocate

Hi Chandra,

i didn't find any information in the API documentation about this, also not in the "Dos and Dont's" of the API documenation.

 

BTW: This is also only a workaround for the missing OnPopulateFileMetadata with EventTiming, see IdeaStation OnPopulateFileMetadata

 

Best

Rene

0 Likes
Message 8 of 8

chandra.shekar.g
Autodesk Support
Autodesk Support

@Rene_Gerlach ,

 

Documentation on Transaction may be updated in the upcoming releases of Inventor.

 

Regarding OnPopulateFileMetadata with EventTiming, engineering team may look into this and review the same.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes