# Open multiple Ifc's

**URL:** <https://forum.dynamobim.com/t/open-multiple-ifcs/44389>\
**Category:** Revit\
**Created:** [December 12, 2019, 10:05am UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389 "2019-12-12T10:05:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![lennart030](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lennart030](https://forum.dynamobim.com/u/lennart030)\
**Post date:** [December 12, 2019, 10:05am UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/1 "2019-12-12T10:05:06Z")

</div>

since i’m not that developed in Python maybe someone can help me?  
i’m trying to open multiple Ifc’s to batch convert them to .rvt but the script is complaining i’m feeding a list instead of a string. is there a way to let the script accept multiple files?

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/1/d18daca5f604c23367be260b65d6d3f99edfefd6.png)

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [December 12, 2019, 10:29am UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/2 "2019-12-12T10:29:10Z")

</div>

Hi @lennart030,

A For Loops should do the trick :

```
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

#input IFC file paths:
IFCfilepaths = IN[0]

for IFCfilepath in IFCfilepaths :
	IFCopen = app.OpenIFCDocument(IFCfilepath)

#Save resulting Revit file to the destination path:
OUT = IFCopen.SaveAs(IN[1])
```

---

<div class="post-metadata">

**Author:** ![lennart030](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lennart030](https://forum.dynamobim.com/u/lennart030)\
**Post date:** [December 12, 2019, 3:44pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/3 "2019-12-12T15:44:41Z")

</div>

it seems to work but revit keeps looping opening the IFC instead of saving it and opening the next.  
i think I’ll try to replace the out for a [0] and saving the ifc’s via some node’s  
or do you know a better way with Python?

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [December 12, 2019, 4:19pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/4 "2019-12-12T16:19:55Z")

</div>

I tested and it’s necessary to close each IFC.

Here is the [script](https://github.com/albandechasteigner/GeniusLociForDynamo/blob/master/Nodes/Link%20IFC.dyf).

 ![Link IFC](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/2/626ba60b0dc6ff3ec77f96750a0752282173a81b.png)

---

<div class="post-metadata">

**Author:** ![lennart030](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lennart030](https://forum.dynamobim.com/u/lennart030)\
**Post date:** [December 13, 2019, 10:26am UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/5 "2019-12-13T10:26:44Z")

</div>

works like a charm. thanks

---

<div class="post-metadata">

**Author:** ![kleinnagelvoort](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kleinnagelvoort](https://forum.dynamobim.com/u/kleinnagelvoort)\
**Post date:** [January 26, 2022, 1:37pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/6 "2022-01-26T13:37:15Z")

</div>

Hi,

When using the python code u supplied to batch open IFC files it works but;

When linking those .rvt files the geometry shows in a 3D view but not in plan view, where when i link the IFC files directly they do show up in the plan view so it must be something in the workflow/nodes used in the script.

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [January 26, 2022, 2:02pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/7 "2022-01-26T14:02:10Z")

</div>

Hi,  
Try instead with the _Link IFC_ node of the _Genius Loci_ package.  
The script in this thread was only a “work in progress”.

---

<div class="post-metadata">

**Author:** ![Reinier](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/reinier/32/141255_2.png) [@Reinier](https://forum.dynamobim.com/u/Reinier)\
**Post date:** [January 26, 2022, 2:55pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/8 "2022-01-26T14:55:17Z")

</div>

Hi Alban,

I have the script working, but now I’m getting errors.

situation 1: when I run the script, I get the following message at the end of every imported ifc file.  
 ![Schermafbeelding 2022-01-26 154800](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/f/7fee3e3be75c1560ed4c51cbfcfcf299c1674a10.png)

situation 2: if I import the ifc 1 by 1 via manage links, it works fine.

when I look in the folder where the ifc files are located, the file name is also different between situation 1 and 2.  
situation 1: filename.rvt  
situation 2: filename.ifc.rvt

any idea what this could be?

 ![Dynamo_2022-01-26_03-48-32](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/7/97b3c376dadfc86537b0e864fd0dcc09d26d2426.png)

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [January 26, 2022, 3:28pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/9 "2022-01-26T15:28:17Z")

</div>

> [@Reinier](#):
>
> any idea what this could be?

No, I don’t know.

> [@Reinier](#):
>
> the file name is also different

It can be changed in the python script but I’m not sure it is related to the error message.

---

<div class="post-metadata">

**Author:** ![kleinnagelvoort](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kleinnagelvoort](https://forum.dynamobim.com/u/kleinnagelvoort)\
**Post date:** [January 28, 2022, 2:26pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/10 "2022-01-28T14:26:03Z")

</div>

Hi,

This node requires a single file input right?  
I’d like to convert multiple IFC files in a folder to .rvt without linking them into my project.

The reason behind this is; after the models are converted i save them as a cloud model to BIM360 so they work as published models that show up in my own model when publishing.

---

<div class="post-metadata">

**Author:** ![kleinnagelvoort](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kleinnagelvoort](https://forum.dynamobim.com/u/kleinnagelvoort)\
**Post date:** [January 28, 2022, 2:42pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/11 "2022-01-28T14:42:53Z")

</div>

At this moment i also get a “null” returned from my path, this wasnt the case before…

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/8/f8c89188906490d6b818e30890196025b880f077.png)

---

<div class="post-metadata">

**Author:** ![Reinier](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/reinier/32/141255_2.png) [@Reinier](https://forum.dynamobim.com/u/Reinier)\
**Post date:** [January 28, 2022, 2:56pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/12 "2022-01-28T14:56:51Z")

</div>

maybe close your dyn file and reopen can solve it. it is possible to do multiple files as mentioned above

---

<div class="post-metadata">

**Author:** ![kleinnagelvoort](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kleinnagelvoort](https://forum.dynamobim.com/u/kleinnagelvoort)\
**Post date:** [January 28, 2022, 3:21pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/13 "2022-01-28T15:21:56Z")

</div>

Re-creating the script made the null dissapear, sadly it only creates 1 .rvt file while there are 2 .ifc files inside the folder.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/f/6f6a0e68d66caebf16d4f8f12eedcdbabcfdb70b.png)

---

<div class="post-metadata">

**Author:** ![kleinnagelvoort](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kleinnagelvoort](https://forum.dynamobim.com/u/kleinnagelvoort)\
**Post date:** [January 31, 2022, 6:54am UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/14 "2022-01-31T06:54:04Z")

</div>

Any suggestions in how to solve this?

---

<div class="post-metadata">

**Author:** ![l.dorrestijn](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@l.dorrestijn](https://forum.dynamobim.com/u/l.dorrestijn)\
**Post date:** [January 31, 2022, 8:16am UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/15 "2022-01-31T08:16:12Z")

</div>

maybe set list level @1 on the link IFC node

---

<div class="post-metadata">

**Author:** ![Reinier](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/reinier/32/141255_2.png) [@Reinier](https://forum.dynamobim.com/u/Reinier)\
**Post date:** [January 31, 2022, 8:49am UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/16 "2022-01-31T08:49:40Z")

</div>

maybe remove the created rvt file and txt log file and try it again?

---

<div class="post-metadata">

**Author:** ![kleinnagelvoort](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kleinnagelvoort](https://forum.dynamobim.com/u/kleinnagelvoort)\
**Post date:** [February 1, 2022, 10:21am UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/17 "2022-02-01T10:21:19Z")

</div>

That seems to do the trick, i still havent figured out how to use those levels properly 😒  
Thank you for that!

---

<div class="post-metadata">

**Author:** ![l.dorrestijn](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@l.dorrestijn](https://forum.dynamobim.com/u/l.dorrestijn)\
**Post date:** [February 1, 2022, 10:36am UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/18 "2022-02-01T10:36:33Z")

</div>

([Introducing List@Level: Working with Lists Made Easier - Dynamo BIM](https://dynamobim.org/introducing-listlevel-working-with-lists-made-easier/))

---

<div class="post-metadata">

**Author:** ![kleinnagelvoort](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kleinnagelvoort](https://forum.dynamobim.com/u/kleinnagelvoort)\
**Post date:** [February 27, 2023, 12:19pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/19 "2023-02-27T12:19:09Z")

</div>

Back to “null” again with Revit 2023

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/c/8c137cdcc3aeb455a35ae2d6bea0e45c455ee570.png)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/a/ea9c34b8f730d6b4d648a0afc0276ad17e43b4ca.png)

---

<div class="post-metadata">

**Author:** ![kleinnagelvoort](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kleinnagelvoort](https://forum.dynamobim.com/u/kleinnagelvoort)\
**Post date:** [February 27, 2023, 12:24pm UTC](https://forum.dynamobim.com/t/open-multiple-ifcs/44389/20 "2023-02-27T12:24:15Z")

</div>

Referencing directly to the Ifc files also gives a null

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/1/31a0f2546969d3c3c90f74b1338cf580a08acb5d.jpeg)

[Next page](https://forum.dynamobim.com/t/open-multiple-ifcs/44389.md?page=2)
