Dynamo Revit IFC export level of detail

dynamo

#1

Hi,

I’m want to specify the level of detail of the IFC export with in revit. can someone help me out?
using the following Phyton 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])

#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("UseActiveViewGeometry", "true");
options.AddOption("TessellationLevelOfDetail", "1");

#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

As you can see I tried adding the “TessellationLevelOfDetail”, but that doesnt seem to work as my file size isnt getting anything less.

Thanks in advance!

Greetings, Guido


#2

its working now. post can be removed.

Thanks


#3

Hi @g.honders,

Maybe you tell how you solved it and share the code that is working, so others can also benefit from it.

Kind regards,
Mark


#4

adding the following code to the phyton script (as above):

options.AddOption(“TessellationLevelOfDetail”, “1”);

filling in a value from 0 to 4. with 0 being extra low.

Cheers!