Autodesk / revit-ifc

IFC for Revit and Navisworks (2019+)
471 stars 193 forks source link

Overwrite File Header Information #308

Open rayray4105 opened 3 years ago

rayray4105 commented 3 years ago

Hi,

Is there a way to overwrite the value for 'Organization' ? There a lot of options available in IFCExportConfiguration but I can't seem to find File Header information.

regards, Raymond

WawanSolihin commented 3 years ago

There is an option in the export dialog and it allows you to specify the Organization and Author information in the header (see attached) image That should work.

rayray4105 commented 3 years ago

I know about the dialog, but I would like to overwrite using the API.

zivi78 commented 1 year ago

to overwrite the FileHeader using the API you should do this:

`import clr from System.Collections.Generic import *

clr.AddReference("RevitAPI") import Autodesk.Revit.DB as RvtDB

clr.AddReference("RevitAPIUI") import Autodesk.Revit.UI as RvtUi import Autodesk.Revit.UI.Selection as RvtUiSelection

clr.AddReference("RevitServices") from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager

clr.AddReferenceToFileAndPath("C:\ProgramData\Autodesk\ApplicationPlugins\IFC 2023.bundle\Contents\2023\IFCExporterUIOverride.dll") import BIM.IFC.Export.UI as IFCExporterUI

clr.AddReferenceToFileAndPath("C:\ProgramData\Autodesk\ApplicationPlugins\IFC 2023.bundle\Contents\2023\Revit.IFC.Common.dll") import Revit.IFC.Common as IFCCommon

uiApp = DocumentManager.Instance.CurrentUIApplication uiDoc =DocumentManager.Instance.CurrentUIDocument doc = uiDoc.Document activeView = doc.ActiveView

FileHeaderItem

fileHeaderItem = IFCCommon.Extensions.IFCFileHeaderItem(doc) fileHeaderItem.AuthorName = "Axel Gehring" fileHeaderItem.AuthorEmail = "axel.gehring@bimotion.de" fileHeaderItem.Organization = "BiMOTiON GmbH" fileHeader = IFCCommon.Extensions.IFCFileHeader() fileHeader.UpdateFileHeader(doc,fileHeaderItem) #ForUpdate the DataStorage Object in the RVT (useful, if you open up the Exporter UI) IFCCommon.Utility.OptionsUtil.FileHeaderIFC = fileHeaderItem #To Write the FileHeader in the IFC File`