Hey there everyone!
After one of the last updates, i’ve noticed that it became completely impossible to create a new instance of ViewSheet class in Revit using API from GHpython’s shell.
t = Transaction(doc, "creaete_new_sheet")
new_sheet = ViewSheet.Create(doc,title_block)
the code throws the following exception:
Runtime error (InternalException): A managed exception was thrown by Revit or by one of its external applications.
Simultaneously everything works perfect in a local (non-workshared) model. The same issue occurs both in Revit 2020.2 and Revit 2021.1, using Rhinoceros’ direct Python shell also doesn’t fix the situiation. In the same time the code works as usually in Dynamo’s Python prompt.
This error didn’t occur a week ago; Also it became impossible to duplicate FloorPlanView, but Creating a new instance has proceeded successfully; I have also been trying to open and set the worksets to Editable state (this had helped me to solve some similar problems in the past), but it didn’t help in my case.It is also possible to create/duplicate views manually from UI.
The problem is that i can’t even understand what type of exception i am facing.
Any help appreciated
Tested on the other machines, transaction does not succeed as well
Hmm. The only thing that I can think of is that there might be something wrong with the worksets. Try syncing and releaseing your model and then creating a new cache by opening from central.
Let me know if this doesn’t solve the problem. This is such an odd issue
Thank you for the reply!
Well, now i noticed, that it doesn’t work with the local models anymore too.
I left the test files (*.rvt and *.gh), i’ve used for this post, below. Maybe you could try this on your machine and check if this works? I’ve got the latest BETA version of Rhino and the most recent Revit 2020.2
TEST_create_sheet.gh (5.4 KB) TEST_create_sheet.rvt (3.0 MB)
Okay. Seems like RIR is not playing well with the transaction that is inside the script for some reason. I modified the script to use the RIR queue for execution. See the guide
new_sheet = ViewSheet.Create(doc, title_block)
@kike Would you mind taking a look at this bug? Download the problematic GH definition and Revit model from the previous post please.
TEST_create_sheet.gh (4.7 KB)
Still lloking into this but is not a transaction problem, but a bug related on how
doc goes from one component to an other.
Here a workaround TEST_create_sheet-trigger.gh (15.1 KB).
Thanks a lot!
This looks like a really better solution to provide transaction. Everything works fine now.