IFC Export by Dynamo : User Defined Property Set

Hi,

i want to Export my Revit file as an ifc file by Dynamo. I found this Code and it works. But i Need my own propertySet, but it is not part of the revit Export ifc function. Is there a possibility to solve this?

[code]#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]
view = UnwrapElement(IN[5])
userdefinedpropertyset = IN[6]


#IFCVersion=UnwrapElement(IN[2])

# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
total_export = []

for i,v in enumerate(view):
	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 == "IFC2x3CV2":
		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
	options.FilterViewId = v.Id
	#options.userdefinedpropertysets = userdefinedpropertyset


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

	c=doc.Export(folder, name[i], options)
	total_export.append(c)

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

if fileversion == "":
	OUT="Default settings used"
else:
	OUT=total_export,IN[1]
[\Code]

Regards Niki

1 Like

Unbenannt

Hi,

You can try to add below the line “options.FilterViewId = v.Id” the lines :

 	options.AddOption("ExportUserDefinedPsets","true")
	options.AddOption("ExportUserDefinedPsetsFileName","your filepath")

thanks for the fast answer.

    options.WallAndColumnSplitting = wallandcolumnsplitting
	options.ExportBaseQuantities = exportbasequantities
	options.FilterViewId = v.Id
	options.AddOption("ExportUserDefinedPsets","true")
	options.AddOption("ExportUserDefinedPsetsFileName","Y:\da\2017\20170636\revit\IFC\KKI_DefaultUserDefinedParameterSets.txt")

doesn’t work. Or do i have do Input the filepath in an other way?

Solved: I had do Change the “\” to “/” in the filepath. Thanks a lot

1 Like

You’re welcome.

If you use backslash, you need to double it :
“Y:\\da\\2017\\20170636\\revit\\IFC\\KKI_DefaultUserDefinedParameterSets.txt”

You can mark a post as solution.

2 Likes

Hi,

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


Sincerely,
Sobhan

Hi,

I will answer your question but please start a new topic.
The original post about User Defined Property Sets was already answered.
Your query is about internal Revit Property Sets.

I found the answer. But, I will open the topic for other viewers in case they need it.

Thanks,