Menu

Create property set with custom exporter

2018-01-22
2018-01-23
  • Einar Raknes

    Einar Raknes - 2018-01-22

    I have tried to follow the examples given in the handout and presentation given by Angel Velez in AU2013. I am trying to create an exporter based on the existing IFC exporter, and my goal is simply to add a custom propery set.

    Here is what I have so far, and now I wonder where and what I call to include the new propery set to the export?

    namespace EiBreIFC
    {
        public class EiBreExporter : Exporter
        {
            .....
            .....
            public EiBreExporter()
            {
                InitPropertySetRebar(); //How to add the new property set?
            }
    
            private static void InitPropertySetRebar(IList<PropertySetDescription> userDefinedPropertySets)
            {
                PropertySetDescription propertySetRebar = new PropertySetDescription();
                propertySetRebar.Name = "REBAR";
                propertySetRebar.EntityTypes.Add(IFCEntityType.IfcElement);
                propertySetRebar.AddEntry(PropertySetEntry.CreateIdentifier("Rebar Number"));
                userDefinedPropertySets.Add(propertySetRebar);
            }
        }
    

    If someone has a more complete sample to share, that would be appreciated too!

     
  • Angel Velez

    Angel Velez - 2018-01-23

    Hi Einar,

    There's an easier way to add a property set now using the user-defined property set table. Still, I will take the above code in the spirit of "trying to make an exporter on top of the existing exporter". In this case, you want to make sure that you add something like this:

        protected override void InitializePropertySets()
        {
            if (m_PropertySetsToExport == null)
                m_PropertySetsToExport = InitializeMyPropertySets;
            else
                m_PropertySetsToExport += InitializeMyPropertySets;
            base.InitializePropertySets();
        }
    

    This will add your property sets to the list.

    Regards,
    Angel

     
  • Einar Raknes

    Einar Raknes - 2018-01-23

    Thank you Angel! I know the easy way(s), but I was tired of mapping parameter values in Revit and manually remember to combine and calulate them before export. I was hoping to achieve this with the method above and a couple of PropertyCalculator Classes. Hopefully I'm on the right track here.

    Example:
    I want a IFC-propery to be a combination of the revit paramters"Partition" and "Rebar Number",
    another calculated as Mass = Volume*7850

     
  • Angel Velez

    Angel Velez - 2018-01-23

    Sounds like the right track to me. Hopefully that trick works for you.

     

Log in to post a comment.