API IFC Export with shared parameters

API IFC Export with shared parameters

R.Huettig
Explorer Explorer
218 Views
1 Reply
Message 1 of 2

API IFC Export with shared parameters

R.Huettig
Explorer
Explorer

Hello there,

 

i have a functioning c# plugin for revit 2024 that creates in ifc (2x3CV2 )file via IFCExportOptions and sends it to an adress.

 

In this progess i struggle to include shared parameters in the ifc.

I have a shared parameters .txt file and allready set up ifc configuration but i dont find a method of accesing these.

An additional challenge is that i would like to export special groups of shared parameters also when they have no value. So to speak the parameters are untouched and have no value yet. Until now i need to first set a value to them to export.

Any resources or tips fo this case?

 

 

IFCExportOptions ifcOptions = new IFCExportOptions
{
    FileVersion = IFCVersion.IFC2x3CV2, // IFC Schema in Zukunft ifc4x3/ifc4 testen
    ExportBaseQuantities = true,       // Basis-Mengen exportieren
};


string exportDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "IFC_Exports");
Directory.CreateDirectory(exportDirectory); // Ensure directory exists

string fileName = $"{ifcFileName}.ifc";
string exportPath = Path.Combine(exportDirectory, fileName);


using (Transaction trans = new Transaction(doc, "Export IFC"))
{
    trans.Start();
    doc.Export(exportDirectory, fileName, ifcOptions);
    trans.Commit();
}

 

 

 Revit 2024, .Net 4.8

Thank You

0 Likes
219 Views
1 Reply
Reply (1)
Message 2 of 2

R.Huettig
Explorer
Explorer

This seems to solve the export all parameters, even the shared parameter part:

AddOption Method 

string userDefinedPset = "true";

ifcOptions.AddOption("ExportUserDefinedPsets", userDefinedPset);

0 Likes