Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TransactionGroup Rollback

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
589 Views, 4 Replies

TransactionGroup Rollback

Hi all. Maybe someone across this problem. 
I do rollback transactionGroup after commiting some transactions in this group. But it isn't works in local file which was done from central model. It successfully works in usual local file. Can anyone help me?

 using (TransactionGroup transactionGroup = new TransactionGroup(Doc, "TransGroup"))
                {
                    transactionGroup.Start("Numerating Sheets");
                    Transaction transaction = new Transaction(Doc, "Transaction");
                    foreach (var sheet in sheets)
                    {
                        if (_flag)
                        {
                            transactionGroup.RollBack();
                            break;
                        }
                        transaction.Start("Numbering Sheet");
                        ViewSheet viewSheet = Doc.GetElement(sheet.ElementId) as ViewSheet;
                        viewSheet.SheetNumber = sheet.Number;
                        MainWindow.ProgressBar.Dispatcher.Invoke(new ProgressBarDelegate(UpdateProgress),
                            DispatcherPriority.Background);
                        transaction.Commit();
                    }
                    if (!_flag)
                        transactionGroup.Assimilate();
4 REPLIES 4
Message 2 of 5
naveen.kumar.t
in reply to: Anonymous

Hi @Anonymous ,

These links will help you to solve your issue

https://thebuildingcoder.typepad.com/blog/2013/12/saving-a-new-central-file-to-revit-server.html 

https://thebuildingcoder.typepad.com/blog/2013/12/saving-a-new-central-file-to-revit-server.html#4 

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 5
Anonymous
in reply to: naveen.kumar.t

Thank you for reporting, but in that article Jeremy said about naming of transactions. In my case, i just can't rollback group of transactions. TransactionStatus is RolledBack, but changes still accepted.

Message 4 of 5
jeremytammik
in reply to: Anonymous

All you are doing in each individual transaction is renumbering a sheet.

 

Why waste an entire transaction for that task?

 

Why not do all the renumbering of all sheets in one single transaction?

 

What possible causes can you have to want to roll back the modification?

 

From this minimal snippet of your, it looks to me as if you could simplify your process.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 5
Anonymous
in reply to: jeremytammik

Thank you for answer! I did renumbering in single transaction as you say. My sollution was really hard 🙂
I want to user can abort numbering and don't wait for ending of operation. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report