Menu

IfcExportOptions.AddOption - ClassificationSettings

LWL
2023-10-18
2023-12-04
  • LWL

    LWL - 2023-10-18

    Dear all,
    as in the title,

    to add option for this IfcExportOption:

    "Export2DElements": false,`

    I can simple write:

    options.AddOption("Export2DElements", "false");

    but how can I programatically add Classification Settings, which in IfcExportOption .json look like this:

    "ClassificationSettings": {
    "ClassificationName": "MyClassificationName",
    "ClassificationEdition": "MyClassificationEdition",
    "ClassificationSource": "",
    "ClassificationEditionDate": "\/Date(-62135596800000)\/",
    "ClassificationLocation": null,
    "ClassificationFieldName": "CostPositionParameter"
    },

    any help much appreciated,
    Lukasz

     

    Last edit: LWL 2023-10-18
  • Teun

    Teun - 2023-11-08

    I have not tested this at the moment.
    But I found an interresting C# example online. Row 703
    https://csharp.hotexamples.com/site/file?hash=0xccd9792b90d64b2dce3d80f89c71ab2db8c4d0a78f6825d843ec1bccf1990610
    It seems a JSONstring should ? work in combination with "ClassificationSettings" or "ProjectAddress" as a Name in the IFCExportOptions .AddOption() method.

     
  • Teun

    Teun - 2023-11-13

    Ok. I cannot get this to work in Python.
    No error whatsoever. And I get an IFC. But the values do not change.

    And I also found some strange things with the Classificationsettings.
    The exporter seems to remember old manually changed values. But I do not know how or where.
    And they also do not show up when you manually want to change values.

    Have you tried it Lukasz?

     
  • LWL

    LWL - 2023-11-17

    Hi Teun,

    Thank you for the hint. I tried it in C#, however no success.... IFC exported, not error, just IfcClassification is missing.
    I followed your advice - at the end we obviously provide serialized string to AddOption method. What is obvious, is that this string is the same as the one saved in Json file, exported from manual settings.

    this is what I have:

                IFCClassification ClassificationSettings = new IFCClassification();
                ClassificationSettings.ClassificationName = "DIN 276";
                ClassificationSettings.ClassificationSource = "Source";
                ClassificationSettings.ClassificationEdition = "Edition";
                ClassificationSettings.ClassificationEditionDate = DateTime.Now;
                ClassificationSettings.ClassificationLocation = "Location";
                ClassificationSettings.ClassificationFieldName = "CostPosition*";
                ClassificationSettings.ClassificationTabMsg = "TabMsg";
    
                JavaScriptSerializer ser = new JavaScriptSerializer();
    
                string classificationJsonStr = ser.Serialize(ClassificationSettings);
                options.AddOption("ClassificationSettings", classificationJsonStr);
    

    When exported manually, everything is fine.
    Is it possible that this setting is saved in Revit Document, instead of being added to IFCExportOptions options ?
    What do you think?

    /Lukasz

     
  • Teun

    Teun - 2023-11-18

    Hi Lukasz,
    The settings seems to be saved in the ExtensibleStorage (GUID 9a5a28c2-ddac-4828-8b8a-3ee97118017a). Beside some other UI settings for the IFC exporter. I think the exporter will read these values and use them while exporting.
    So if this is true it is a part of the Project.
    All the settings seem to be public and changeable. I tried but was not able to change these settings. Not sure why. Perhaps my knowledge of the ExtensibleStorage functionality.

     

    Last edit: Teun 2023-11-18
  • Teun

    Teun - 2023-12-04

    Hi Lukasz.
    I can confirm that it is possible to change the DataStorage. This will effect the export Classification Settings on export. However the Classification Description still has some issues. These issues are already there and are not related to what we are doing here.
    By the way, it possible to create a new Type Text Project Parameter. Attach it to all relevant Categories. The value of this Type Parameter should be: {$this("Assembly Code")+":"+$this("Assembly Description")} Use the new created parameter as a reference for the Classification Parameter. This will create (at the moment) a new Classification with the correct settings. Check these links for more background info.
    https://github.com/Autodesk/revit-ifc/issues?q=is%3Aissue+is%3Aopen+classification
    https://www.bim42.com/2018/03/ifc-for-revit-2/
    https://sourceforge.net/p/ifcexporter/wiki/Notes%20on%20parameter%20expression/
    After some digging there are multiple things not working in the exporter as they should be. But we can get some things to work with multiple workarounds.

     

Log in to post a comment.