Attempt to modify the model outside of transaction.while duplicating WallType

Attempt to modify the model outside of transaction.while duplicating WallType

arvind.maurya37
Contributor Contributor
5,947 Views
2 Replies
Message 1 of 3

Attempt to modify the model outside of transaction.while duplicating WallType

arvind.maurya37
Contributor
Contributor

 

While Creating Duplicate WallType using revit Api

 using (Transaction tr = new Transaction(dbDoc))
                {
                  WallType retValue = refType.Duplicate("WType1") as WallType;
                    tr.Commit();
                }

 

at

refType.Duplicate("WType1") as WallType 

Attempt to modify the model outside of transaction.  as  an exception

and my from is opened as ShowDialog();

 

0 Likes
Accepted solutions (1)
5,948 Views
2 Replies
Replies (2)
Message 2 of 3

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @arvind.maurya37,

First start the transaction

using (Transaction tr = new Transaction(dbDoc))
                {
                     tr.Start("Your transaction name");
                  WallType retValue = refType.Duplicate("WType1") as WallType;
                    tr.Commit();
                }

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

dhilip_seshan
Explorer
Explorer

Can you please post the same code for python, facing same issue in dynamo Python after adding transaction command

0 Likes