# Export Revit categories to FBX through Dynamo

**URL:** <https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368>\
**Category:** Uncategorized\
**Created:** [December 20, 2016, 7:31pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368 "2016-12-20T19:31:20Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![faisalB](https://avatars.discourse-cdn.com/v4/letter/f/b4bc9f/32.png) [@faisalB](https://forum.dynamobim.com/u/faisalB)\
**Post date:** [December 20, 2016, 7:31pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368/1 "2016-12-20T19:31:20Z")

</div>

Hi,  
I am trying to filter categories by level, and name then export these to an FBX through Dynamo. Can the FBX export be called in Dynamo through python?  
The OUT in the attached image is what needs to be exported to FBX

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/0/f00839aa25172389a2d53b4163d3d0a157c9045d.PNG)

Thanks,

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [December 20, 2016, 7:50pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368/2 "2016-12-20T19:50:50Z")

</div>

Hi @faisalB ,  
There is a node in data-shapes package to export views to fbx. You could do the filtering in a revit view through “VV” menu then use “export view to fbx” node .

---

<div class="post-metadata">

**Author:** ![faisalB](https://avatars.discourse-cdn.com/v4/letter/f/b4bc9f/32.png) [@faisalB](https://forum.dynamobim.com/u/faisalB)\
**Post date:** [December 20, 2016, 7:59pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368/3 "2016-12-20T19:59:14Z")

</div>

Thanks @Mostafa_El_Ayoubi  
I am trying to automate the filtering process by level instead of having to create views and “VV” each view. This is to export big files as smaller FBXs, then automate an import/assembly in 3DS Max(given that is possible there…).

I was checking your python code, it seemsthat the doc.Export requires a “view” param/input. Probably it has to do with how Revit exports “views” rather than selected objects

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [December 21, 2016, 7:16pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368/4 "2016-12-21T19:16:01Z")

</div>

Sorry for the late reply @faisalB ,  
indeed the export to FBX method only works with viewsets :

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

you can still automate the creation of the views to export and the filtering of the elements they contain before you export !

---

<div class="post-metadata">

**Author:** ![faisalB](https://avatars.discourse-cdn.com/v4/letter/f/b4bc9f/32.png) [@faisalB](https://forum.dynamobim.com/u/faisalB)\
**Post date:** [December 21, 2016, 7:22pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368/5 "2016-12-21T19:22:59Z")

</div>

This is what I am trying at the moment, duplicate the 3D view, Set the visibility to certain categories ,then export. The python API doc is not the best ( there seems to be differences between the pythonshell and that in Dynamo…)…

Any Help would be appreciated 😉

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [December 21, 2016, 7:46pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368/6 "2016-12-21T19:46:09Z")

</div>

@faisalB  
Almost everything you need is already here thanks to the comunity !

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

![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/0/30e9fc0c3b141f697403bd4ecee6865f4605fb49.gif)

---

<div class="post-metadata">

**Author:** ![faisalB](https://avatars.discourse-cdn.com/v4/letter/f/b4bc9f/32.png) [@faisalB](https://forum.dynamobim.com/u/faisalB)\
**Post date:** [December 21, 2016, 8:03pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368/7 "2016-12-21T20:03:46Z")

</div>

Oooh. Thanks Mustafa!  
One last thing, in your FBX python code, do you need to change the t.start(), to start the transaction to : TransactionManager.Instance.EnsureInTransaction(doc)  
and the t.commit() to : TransactionManager.Instance.TransactionTaskDone() ?

Thanks Again!!!

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [December 21, 2016, 8:10pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368/8 "2016-12-21T20:10:50Z")

</div>

t.start and t.commit work the same , to my knowledge, they just allow to name the transaction .

I just tried the export and it works fine but I realized that the input description was very bad, and the code was trying to get one directory path per view to export, which doesnt make a lot of sens… it’s a rather old node 😄 … I changed it, you can download the latest version of the package :

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/b/5b1421235a01b547350c459136860caf96e04b89.png)

or use this code:

```
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

t = Transaction(doc,'export')
t.Start()

folder = IN[0]
name = IN[1]
views = IN[2]
result = []
vset = ViewSet()

for n,v in zip(name,views):

    vset.Insert(UnwrapElement(v))
    result.append(doc.Export(folder,n,vset,FBXExportOptions()))

t.Commit()
OUT = 'You Have successfully exported %d 3D views to FBX format' %(result.count(True))
```

---

<div class="post-metadata">

**Author:** ![faisalB](https://avatars.discourse-cdn.com/v4/letter/f/b4bc9f/32.png) [@faisalB](https://forum.dynamobim.com/u/faisalB)\
**Post date:** [December 21, 2016, 9:27pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368/9 "2016-12-21T21:27:48Z")

</div>

👍 . I tried the FBX code, it didn’t run until I changed the transaction as mentioned above.  
This is mentioned in the GitHub Wiki

> **[DynamoDS/Dynamo](https://github.com/DynamoDS/Dynamo/wiki/Python-0.6.3-to-0.7.x-Migration)**
>
> Dynamo - Open Source Graphical Programming for Design

  
Check the transaction section.

And it Work!!  
Thanks Again Mustafa

---

<div class="post-metadata">

**Author:** ![faisalB](https://avatars.discourse-cdn.com/v4/letter/f/b4bc9f/32.png) [@faisalB](https://forum.dynamobim.com/u/faisalB)\
**Post date:** [December 22, 2016, 11:31pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368/11 "2016-12-22T23:31:13Z")

</div>

Hey @Mostafa_El_Ayoubi , did some adjustments to your code (visibility of certain category by view, so that each category can be exported to a separate FBX. This is given that the visibility of all Categories is of in the initial 3D view).  
Just wanted to share

> import clr  
> clr.AddReference(‘RevitAPI’)  
> from Autodesk.Revit.DB import\*  
> clr.AddReference(‘RevitServices’)  
> from RevitServices.Persistence import DocumentManager  
> from RevitServices.Transactions import TransactionManager  
> import System

> doc = DocumentManager.Instance.CurrentDBDocument

> TransactionManager.Instance.EnsureInTransaction(doc)

> folder = IN[0]  
> name = IN[1]  
> views = UnwrapElement( IN[2])  
> categories = UnwrapElement(IN[3])

> result =

> for n,v,category in zip(name,views,categories):  
> v.SetVisibility(category,System.Boolean(True))  
> vset = ViewSet()  
> vset.Insert(v)  
> result.append(doc.Export(folder,n,vset,FBXExportOptions()))

> TransactionManager.Instance.EnsureInTransaction(doc)  
> OUT =‘You Have successfully exported %d 3D views to FBX format’ %(result.count(True))

---

<div class="post-metadata">

**Author:** ![waqarkhan9494](https://avatars.discourse-cdn.com/v4/letter/w/a5b964/32.png) [@waqarkhan9494](https://forum.dynamobim.com/u/waqarkhan9494)\
**Post date:** [August 18, 2021, 2:01pm UTC](https://forum.dynamobim.com/t/export-revit-categories-to-fbx-through-dynamo/8368/12 "2021-08-18T14:01:22Z")

</div>

Hello Mostafa,  
I am new to Dynamo. I want to convert several revit family models (.rfa files) (more than 30) to .fbx through dynamo. Is it possible or Is there a script already made?
