Hello,
I am trying to create a dynamo graph that exports a specif view of my Revit model in IFC format.
I have found some useful custom Python code in this topic: http://dynamobim.org/forums/topic/export-to-dwf-or-ifc-via-dynamo/
I would like to know if there is a way to export in IFC with user defined property sets directly from dynamo.
At the moment this this is my graph:
I need to create this graph in order to use it with dynamoAutomation on multiple revit projects.
Thanks in advance for your support.
1 Like
Here is a slightly extended IFC dynamo script, created by Based on tools.dwf by Julien Benoit @jbenoit44
and improved byNicklas Verdier Ăstergaard, nvo@niras.dk .
IFC extended functionality is from here:
//
// BIM IFC export alternate UI library: this library works with Autodesk(R) Revit(R) to provide an alternate user interface for the export of IFC files from Revit.
// Copyright (C) 2012 Autodesk, Inc.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
using System;
This file has been truncated. show original
refer to the discussion here:
https://sourceforge.net/p/ifcexporter/discussion/general/thread/9ec16258/#d36e
here is the fix:
#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])
#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 == "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
options.FilterViewId = v.Id
options.AddOption("ExportInternalRevitPropertySets","true");
options.AddOption("ExportAnnotations ","true");
options.AddOption("SpaceBoundaries ", "0");
options.AddOption("VisibleElementsOfCurrentView ", "true");
options.AddOption("Use2DRoomBoundaryForVolume ", "true");
options.AddOption("UseFamilyAndTypeNameForReference ", "true");
options.AddOption("ExportInternalRevitPropertySets ","true");
options.AddOption("ExportIFCCommonPropertySets","true");
options.AddOption("Export2DElements", "false");
options.AddOption("ExportPartsAsBuildingElements", "false");
options.AddOption("ExportBoundingBox", "false");
options.AddOption("ExportSolidModelRep", "true");
options.AddOption("ExportSchedulesAsPsets", "false");
options.AddOption("ExportLinkedFiles", "false");
options.AddOption("IncludeSiteElevation","true");
options.AddOption("UseActiveViewGeometry", "false");
options.AddOption("ExportSpecificSchedules", "false");
options.AddOption("TessellationLevelOfDetail", "0.5");
options.AddOption("StoreIFCGUID", "true");
options.AddOption("ExportRoomsInView", "false");
#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
1 Like
Maybe iâm missing the solution, but it seems that the export does not export the âUser Sefined Property setsâ. Am i right?
Hope to hear from you!
You are right, havenât found a solution yet.
Hi everyone,
I am trying to export only the elements of the 3D view, since I am hiding a lot of things, but the sentence below doesnât work :
options.AddOption("VisibleElementsOfCurrentView ", âtrueâ);
Do you have any ideas about how to make it possible ?