Follow this topic :
https://thebuildingcoder.typepad.com/blog/2014/05/on-handling-warnings-and-failures.html
We just can dismiss warning when we committed transaction,we want some of warnings to process with commit , and some of warning to cancel. But to save time ,we dont allow revit regenerate document many times so we commit transaction of the end of process.
Can I dismiss warning before I commit transaction,
Solved! Go to Solution.
Solved by MarryTookMyCoffe. Go to Solution.
not in the way you thing, but I thing you can do a subtransaction in transaction to catch warring of part that are important for you to progress further in your app.
https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/Revit-API/files/GUID-...
http://www.revitapidocs.com/2015/801e5f17-cab0-044d-835c-a39592374f89.htm
Thank mary so much ,
But i have some trouble , try catch my code but i didnt get any message from catch but my sub transaction return rollback. Please help me, how do we know why subtransaction rollback
I never tested it in full, but maybe when subtranasction end or roll back, the main transaction get warring or errors to a failuresPreprocessor class:
https://help.autodesk.com/view/RVT/2015/ENU/?guid=GUID-52A45CC1-3BB4-48B4-BFC7-F6F8666C2AA4
unfortunately revit api was made for small macros.
It is possible that you will need to make many transaction, many times there is just no easy way out in Revit API.
what exactly you try to do? some times it is easier to catch invalid parameters before transaction.
Thank marry so much,
I found reason why because my model has too many warning so they always return rollback, I solve all warning and they return committed , everything now is fine. Thank you for your help. Have a good day 🙂
One more thing, to improve performance of code I use this syntax:
Snippet
[Regeneration(RegenerationOption.Manual)]
but the document still regenerates when I commits transaction. Do you have any solution to limit number of times the document regenerates?
commit always will regenerate document there is nothing you can do about it.
the
[Regeneration(RegenerationOption.Manual)]
is thing from past(I thing before 2013 or something like that) when we could make it automatic. There is not much you can do about optimization, my suggest is to use:
if you create many object
document.Create.NewFamilyInstances2 - I thing it work a little faster than making all element with document.Create.NewFamilyInstances.
One more question, I dont know why I cannot get failure handle when transaction return rollback , i can not get list of element cause error. Do you have any idea?
I thing that answer is here:
http://www.revitapidocs.com/2016/d99de9ee-168e-a114-1255-0cea9f317efb.htm
you can add handling option to a roll back
Can't find what you're looking for? Ask the community or share your knowledge.