Hello all,
I’ve been creating a dynamo script with the ability to export the file to dwfx and to ifc. On the forum I found a really helpfull python script from Julien Benoit with some modifications by Nicklas Verdier. And I have been using it since. But now i want to add an extra RunIt option (boolean), I’ve been trying some things in the python script but I can’t get it to work. Could someone please help me with this?
#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
#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