In @Alban_de_Chasteigners package, Genius Loci, you can find an IFC export node that allows for some costumization. But if you open the node and look into the python, I believe he’s included loads of actions but commented them out in the script. Have a look and add what you need
I have looked inside the Pyton code and only found a few that could help me.
Any idea which one of these options it is and how to include the costum setup?
Neat!
Uhm, I have only very limited knowledge of coding, how did you get that dropdown menu working?
I only ever need one specific setting so it would make it easier if I could preselect that and have a one click IFC export.
But thanks so far!
*Also: What packages are you using?
I can send the DYN file in like half an hour or something.
The dropdown menu is from datashapes, but you could also just fill in the name in the script and never change it if thats what you want.
This dyn file uses datashapes and GeniusLoci
If my limited coding is correct, there seems to be an issue with the Name of the IFC Export Setup.
Either the format of the Name makes issues or it’s another problem.
The name on the code fragment and the one listed in the Export Setup are the same.
Sorry, last time I coded was probably 4 years ago for an arduino ^^’
Edit: I installed all packages referenced in this project, so it should work
I really don’t know.
Tried central models, local models and cloud models, all return the same error.
Couldn’t even find which directory they normally would be stored in
I guess I figured it out with a collegue of mine by accident.
Context: We are from Germany.
While exporting a IFC File manually, we realised some values weren’t beeing exported as expected.
Turns out, launching Revit with the english language pack causes variables to change names, which breakes the IFC settings.
I suspect the german base version has other value names, would make sense it returns null.
As launching Revit in English didn’t fix the issue, maybe the paths and variables at instalation matter.
If it works on another english Version of Revit, it’s a local issue
import clr
import sys
import System
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
from Autodesk.Revit.Attributes import *
from Autodesk.Revit.DB.IFC import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application
sdkNumber = int(app.VersionNumber)
IFCExportConfiguration = None
IFCExportConfigurationsMap = None
pf_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFilesX86)
pf_data_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData)
ifc_bundle_path = "{0}\\Autodesk\\ApplicationPlugins\\IFC {1}.bundle\\Contents\\{1}".format(pf_data_path, sdkNumber)
if System.IO.Directory.Exists(ifc_bundle_path):
# 1st try
sys.path.append(ifc_bundle_path)
clr.AddReference("IFCExporterUIOverride")
from BIM.IFC.Export.UI import IFCExportConfigurationsMap, IFCExportConfiguration, IFCCommandOverrideApplication
else:
ifc_addin_path = "{}\\Autodesk\\Revit {}\\AddIns\IFCExporterUI".format(pf_path, sdkNumber)
if System.IO.Directory.Exists(ifc_addin_path):
# 2nd try
sys.path.append(ifc_addin_path)
clr.AddReference("Autodesk.IFC.Export.UI")
from BIM.IFC.Export.UI import IFCExportConfigurationsMap, IFCExportConfiguration, IFCCommandOverrideApplication
import json
ifc_dict_config = {}
if IFCExportConfigurationsMap is not None:
idfdocA = IFCCommandOverrideApplication.TheDocument
if idfdocA is None:
propinfo = clr.GetClrType(IFCCommandOverrideApplication).GetProperty('TheDocument')
propinfo.SetValue(None, doc)
configurationsMap = IFCExportConfigurationsMap()
configurationsMap.AddBuiltInConfigurations()
configurationsMap.AddSavedConfigurations()
for config in configurationsMap.Values:
print(config.GetType())
#dict_ifc_version_str = {"IFC_Version_str": config.IFCVersion.ToString() }
#dict_config = json.loads(config.SerializeConfigToJson())
# merge dictionaries
#merge_dict_3 = dict(dict_ifc_version_str,**dict_config)
ifc_dict_config[config.Name] = config
OUT = ifc_dict_config
code 2
import sys
import clr
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
from Autodesk.Revit.Attributes import*
from Autodesk.Revit.DB.IFC import*
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
sdkNumber = int(app.VersionNumber)
my_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments)
myIFCExportConfiguration = IN[0]
TransactionManager.Instance.EnsureInTransaction(doc)
options = IFCExportOptions()
#Define the of a 3d view to export
exportViewId = ElementId.InvalidElementId
# Pass the setting of the myIFCExportConfiguration to the IFCExportOptions
myIFCExportConfiguration.UpdateOptions(options, exportViewId)
TransactionManager.Instance.TransactionTaskDone()
doc.Export(my_path, "test330.ifc", options)
OUT = options, options.FileVersion
I copied it, but it fails to return anything. Must be something going on on my end, no idea.
I found the directionaries, so they exist, but it fails to catch them.