Create Revit Document from IFC File using RevitPythonShell

Create Revit Document from IFC File using RevitPythonShell

victor.bastidas
Enthusiast Enthusiast
1,195 Views
6 Replies
Message 1 of 7

Create Revit Document from IFC File using RevitPythonShell

victor.bastidas
Enthusiast
Enthusiast

Hello!

 

I'm trying to create a Revit document from an IFC file on my desktop. I'm using RevitPythonShell on Revit 2022. 

 

However, when I try to execute the program, I end up with this exception:

" Autodesk.Revit.Exceptions.InternalException: A managed exception was thrown by Revit or by one of its external applications."

 

victorbastidas_0-1682392755847.png

 

This is all I get. Happens the same when trying to create a new project from scratch: 

 

victorbastidas_1-1682392842332.png

 

Any ideas would help a lot!

 

Thanks and have a nice day!

0 Likes
Accepted solutions (2)
1,196 Views
6 Replies
Replies (6)
Message 2 of 7

architect.bim
Collaborator
Collaborator
Accepted solution

Hi! I assume you're trying to run the code without any open Revit document. RPS refers to an open Revit document during code execution. And if it's not there, an exception is thrown. So open some document first. And then try to call the methods shown on the screenshot.


Maxim Stepannikov | Architect, BIM Manager, Instructor
Message 3 of 7

victor.bastidas
Enthusiast
Enthusiast

Hi Maxim, thanks for your quick reply. 

 

I indeed have no document opened. 

 

Do you mean, opening any document and then after that trying to open my IFC Files? 

 

I want to do this because we are handling hundreds of IFC Files, so what I want to do is open them one by one and save them as a Revit Cloud model (I got that part sorted, I just need to create the new doc for each IFC File) 

 

Thanks again! 

Message 4 of 7

architect.bim
Collaborator
Collaborator
Accepted solution

Hi!

Yes, I mean exactly that. Just open some empty Revit file and don't close it until you finish working with IFC files. After that start openning and closing necessary IFC files. In that case the Exception should not appear.


Maxim Stepannikov | Architect, BIM Manager, Instructor
0 Likes
Message 5 of 7

victor.bastidas
Enthusiast
Enthusiast

This worked! I'll read the init python file again and see what changes. 

 

Thanks again, Maxim!

Message 6 of 7

Goody_GudarzianVUMSA
Explorer
Explorer

Hi Guys, 

I tried to do the same; it runs without a problem and seems to process the ifc file. But in the ifc folder, no rvt file is created. Shouldn't the rvt file be created in the same folder as the ifc file? am I missing something?

0 Likes
Message 7 of 7

victor.bastidas
Enthusiast
Enthusiast

Hi, are you just opening the IFC file? If so you'll have to save the model with another command. 

If you want the same functionality as the one that happens when you link an IFC file, you'll have to refer to how links work on the open source project revit-ifc

Autodesk/revit-ifc: IFC for Revit and Navisworks (2019+)

Hope it helps.

0 Likes