IFC Export by Dynamo : Internal Revit Property Set

dynamo
#1

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

0 Likes

#2

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).

1 Like

#3

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?

0 Likes

#4

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

0 Likes

#5

Hi,

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


1 Like

#6

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!

0 Likes

#7

I have just released an update which includes IFC export…

0 Likes

#8

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?

0 Likes

#9

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…

0 Likes

#10

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.

0 Likes

#11

I have a set of nodes for IFC export, which also covers the latest build from Autodesk IFC exporter

0 Likes

#12

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)

0 Likes

#13

is this what you expect?

from this input from Revit…

well…then use these nodes.
I processed it without changing anything from my sample graph
Ifc.dyn (30.3 KB)

2 Likes

#14

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

#15

This is only a problem if you use “In-Session Setup”, if you use the prebuild schemas then is this not a problem, since you cant set LOD in example “IFC2x3 CV”. But then you need to use a node which can capture the schemas made by the IFC exporter team… and not the workarounds which builds using the Revit API IFC Exporter.

If the code behind the node uses this options.AddOption("someVariable", "someValue")
http://www.revitapidocs.com/2019/74b280e6-bccb-703b-e63d-341bc64ed729.htm
then it is not using the IFC Exporter API,

If it is build using the IFC exporter API, then it should implement methods from here

This is done by a reference to the assembly and then use the methods provided in here.
image

However, the problem is still around, if you use the IFC exporter as “In-Session” and use either 2x3 or 4 fileformat, then will you get an error. using 2x2 format went well for me combined with high.

If you want to know more then please contact me at my Github --> https://github.com/erfajo/OrchidForDynamo

1 Like

#16

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

0 Likes

#17

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.

0 Likes

#18

@Mohamad_Kayali, I did implement the IFCexporter from the first time I started coding these set of nodes.
If you want to know more then please contact me at my Github --> https://github.com/erfajo/OrchidForDynamo

1 Like