IFC Export by Dynamo : Internal Revit Property Set

Hi,
The available code for exporting IFC files does not export Revit Property Sets. you can find the code below:

#python nodes in dynamo 0.7
#proposed by Nicklas Verdier Østergaard, nvo@niras.dk
#Based on tools.dwf by Julien Benoit @jbenoit44
#http://aecuandme.wordpress.com/
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#The inputs to this node will be stored as a list in the IN variable.
#dataEnteringNode = IN

folder=UnwrapElement(IN[0])
name=UnwrapElement(IN[1])
fileversion = IN[2]
wallandcolumnsplitting = IN[3]
exportbasequantities = IN[4]


#IFCVersion=UnwrapElement(IN[2])

# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

options=IFCExportOptions()

#if fileversion != None:
#	options.FileVersion = fileversion
if fileversion == "IFC4":
	options.FileVersion = IFCVersion.IFC4
if fileversion == "IFC2x2":
	options.FileVersion = IFCVersion.IFC2x2
if fileversion == "IFC2x3":
	options.FileVersion = IFCVersion.IFC2x3
if fileversion == "IFC2x3":
	options.FileVersion = IFCVersion.IFC2x3CV2
if fileversion == "IFCBCA":
	options.FileVersion = IFCVersion.IFCBCA
if fileversion == "IFCCOBIE":
	options.FileVersion = IFCVersion.IFCCOBIE
if fileversion == "":
	options.FileVersion = IFCVersion.Default
	
	
options.WallAndColumnSplitting = wallandcolumnsplitting
options.ExportBaseQuantities = exportbasequantities

#IFCVersion Version = (IFCVersion) Enum.Parse( typeof(IFCVersion), UnwrapElement(IN[2]), true );
#x.FileVersion = IFCVersion.IFC2x3CV2

c=doc.Export(folder, name, options)

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

if fileversion == "":
	OUT="Defult settings used"
else:
	OUT=c`

How can I export an IFC file by “Revit Property Sets” using Dynamo?

Sincerely,
Sobhan

1 Like

Hi @sobhan.kouhestani,

Thanks for the new thread.

You need to add a new line in the python script after “options.ExportBaseQuantities :”

	options=IFCExportOptions()

	options.WallAndColumnSplitting = wallandcolumnsplitting
    	options.ExportBaseQuantities = exportbasequantities
    	options.AddOption("ExportInternalRevitPropertySets","true");

        c=doc.Export(folder, name, options)
        result.append(c)

You can also find all the IFC export options in the python script of the node “Export IFC” from Genius Loci package (including the new Project Origin option).

2 Likes

Is there a limit off the number off exported views? I have 20 views that i would like to export, i only got 10.


only%2010%20exports

Can anyone help me with this question?

All file sizes are the same, something else might be wrong aswell

Hi,

I just did a quick test with an export of 27 IFC. It works.
Check that you have no forbidden characters like “/”

IFC%20export
image

1 Like

Thank you, you did point me in the right direction. There were some forbidden characters in my view names, I still don’t know which characters were forbidden. I think that the problem lies in the Excel file that i’d used to create the views. But my problem is solved!

Hi Alban, do you have an idea if this script uses the latest update of the ifc exporter plugin? or does it use the standard built in IFC exporter?

Hi,

I recommend installing the Autodesk IFC exporter plugin.
I’m not sure that the custom node can work without him because of the options like project origin, phase…

Thanks for the fast answer. I do have the latest version but i want to be sure that the custom node won’t use the standard one.

Alban, i have a question…
i got a problem with exporting roof that has an opening.
the openings appear to be far away from the model so i get the following warning in solibri:


*when i export the same roof using the IFC exporting pluging i dont get this problem.

ifc_exporter-RoofTest.dyn (17.0 KB)
roofTest.rvt (3 MB)

Hi Mohamad,

You can reproduce this error when you change the level of detail in the Revit exporter.
With a value “high” the openings will be displaced.

The bug on sourceforge :
https://sourceforge.net/p/ifcexporter/discussion/general/thread/3b8fdceb/?limit=25#ed16

If I change the level of detail (0,5) in the custom node, there is no more error :

1 Like

thanks Alban by me it worked when i set the level of detail on “0”.

thanks Erfajo, that makes it more clear that via the python custom nodes we are not using the ifc exporter but we do export using the revit api.
it will be nice if there is a way to export using the prebuilt schemas from the IFC exporter team in Python.
i will try your custom nodes as well.