Ejemplo n.º 1
0
        /// <summary>
        /// Clear all caches contained in this manager.
        /// </summary>
        public static void Clear()
        {
            if (m_AllocatedGeometryObjectCache != null)
            {
                m_AllocatedGeometryObjectCache.DisposeCache();
            }
            ParameterUtil.ClearParameterCache();

            m_AllocatedGeometryObjectCache = null;
            m_AreaSchemeCache                          = null;
            m_AssemblyInstanceCache                    = null;
            m_BeamSystemCache                          = null;
            m_CategoryClassNameCache                   = null;
            m_CategoryTypeCache                        = null;
            m_CeilingSpaceRelCache                     = null;
            m_ClassificationCache                      = null;
            m_ClassificationLocationCache              = null;
            m_ConditionalPropertySetsForTypeCache      = null;
            m_ContainmentCache                         = null;
            m_CurveAnnotationCache                     = null;
            m_DBViewsToExport                          = null;
            m_DefaultCartesianTransformationOperator3D = null;
            m_DoorWindowDelayedOpeningCreatorCache     = null;
            m_DummyHostCache            = null;
            m_ElementToHandleCache      = null;
            m_ElementsInAssembliesCache = null;
            m_ExportOptionsCache        = null;
            m_FabricAreaHandleCache     = null;
            m_GridCache  = null;
            m_GroupCache = null;
            m_GroupElementGeometryCache = null;
            m_GUIDCache                     = null;
            m_GUIDsToStoreCache             = null;
            m_HandleToElementCache          = null;
            m_HostObjectsLevelIndex         = null;
            m_HostPartsCache                = null;
            m_IsExternalParameterValueCache = null;
            m_LevelInfoCache                = null;
            m_MaterialIdToStyleHandleCache  = null;
            m_MaterialLayerRelationsCache   = null;
            m_MaterialLayerSetCache         = null;
            m_MaterialHandleCache           = null;
            m_MaterialRelationsCache        = null;
            m_MEPCache                    = null;
            m_ParameterCache              = null;
            m_PartExportedCache           = null;
            m_PresentationLayerSetCache   = null;
            m_PresentationStyleCache      = null;
            m_PropertyInfoCache           = null;
            m_PropertyMapCache            = null;
            m_PropertySetsForTypeCache    = null;
            m_RailingCache                = null;
            m_RailingSubElementCache      = null;
            m_SpaceBoundaryCache          = null;
            m_SpaceInfoCache              = null;
            m_SpaceOccupantInfoCache      = null;
            m_StairRampContainerInfoCache = null;
            m_SystemsCache                = null;
            m_TrussCache                  = null;
            m_TypeObjectsCache            = null;
            m_TypePropertyInfoCache       = null;
            m_TypeRelationsCache          = null;
            m_ViewScheduleElementCache    = null;
            m_WallConnectionDataCache     = null;
            m_WallTypeCache               = null;
            m_UnitsCache                  = null;
            m_ZoneCache                   = null;
            m_ZoneInfoCache               = null;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Checks if element is external.
        /// </summary>
        /// <remarks>
        /// An element is considered external if either:
        ///   <li> A special Yes/No parameter "IsExternal" is applied to it or its type and it's value is set to "yes".</li>
        ///   <li> The element itself has information about being an external element.</li>
        /// All other elements are internal.
        /// </remarks>
        /// <param name="element">The element.</param>
        /// <returns>True if the element is external, false otherwise.</returns>
        public static bool IsElementExternal(Element element)
        {
            if (element == null)
            {
                return(false);
            }

            Document document = element.Document;

            // Look for a parameter "IsExternal", potentially localized.
            {
                ElementId elementId = element.Id;

                bool?maybeIsExternal = null;
                if (!ExporterCacheManager.IsExternalParameterValueCache.TryGetValue(elementId, out maybeIsExternal))
                {
                    int    intIsExternal          = 0;
                    string localExternalParamName = PropertySetEntryUtil.GetLocalizedIsExternal(ExporterCacheManager.LanguageType);
                    if ((localExternalParamName != null) && (ParameterUtil.GetIntValueFromElementOrSymbol(element, localExternalParamName, out intIsExternal) != null))
                    {
                        maybeIsExternal = (intIsExternal != 0);
                    }

                    if (!maybeIsExternal.HasValue && (ExporterCacheManager.LanguageType != LanguageType.English_USA))
                    {
                        string externalParamName = PropertySetEntryUtil.GetLocalizedIsExternal(LanguageType.English_USA);
                        if (ParameterUtil.GetIntValueFromElementOrSymbol(element, externalParamName, out intIsExternal) != null)
                        {
                            maybeIsExternal = (intIsExternal != 0);
                        }
                    }

                    ExporterCacheManager.IsExternalParameterValueCache.Add(new KeyValuePair <ElementId, bool?>(elementId, maybeIsExternal));
                }

                if (maybeIsExternal.HasValue)
                {
                    return(maybeIsExternal.Value);
                }
            }

            // Many element types have the FUNCTION_PARAM parameter.  If this is set, use its value.
            ElementType elementType = document.GetElement(element.GetTypeId()) as ElementType;
            int         elementFunction;

            if ((elementType != null) && ParameterUtil.GetIntValueFromElement(elementType, BuiltInParameter.FUNCTION_PARAM, out elementFunction) != null)
            {
                // Note that the WallFunction enum value is the same for many different kinds of objects.
                return(elementFunction != ((int)WallFunction.Interior));
            }

            // Specific element types that know if they are external or not if the built-in parameter isn't set.
            // Categories are used, and not types, to also support in-place families

            // Roofs are always external
            ElementId categoryId = element.Category.Id;

            if (categoryId == new ElementId(BuiltInCategory.OST_Roofs) ||
                categoryId == new ElementId(BuiltInCategory.OST_MassExteriorWall))
            {
                return(true);
            }

            // Mass interior walls are always internal
            if (categoryId == new ElementId(BuiltInCategory.OST_MassInteriorWall))
            {
                return(false);
            }

            // Family instances may be hosted on an external element
            if (element is FamilyInstance)
            {
                FamilyInstance familyInstance     = element as FamilyInstance;
                Element        familyInstanceHost = familyInstance.Host;
                if (familyInstanceHost == null)
                {
                    Reference familyInstanceHostReference = familyInstance.HostFace;
                    if (familyInstanceHostReference != null)
                    {
                        familyInstanceHost = document.GetElement(familyInstanceHostReference);
                    }
                }

                if (familyInstanceHost != null)
                {
                    return(IsElementExternal(familyInstanceHost));
                }
            }

            return(false);
        }
        private void CalculateDoorWindowInformation(ExporterIFC exporterIFC, FamilyInstance famInst,
                                                    ElementId overrideLevelId, Transform trf)
        {
            IFCFile file = exporterIFC.GetFile();

            if (ExportingDoor)
            {
                string doorOperationType = null;

                Element doorType = famInst.Document.GetElement(famInst.GetTypeId());
                if (doorType != null)
                {
                    ParameterUtil.GetStringValueFromElement(doorType, BuiltInParameter.DOOR_OPERATION_TYPE, out doorOperationType);
                }

                DoorOperationTypeString = "NOTDEFINED";
                if (!string.IsNullOrWhiteSpace(doorOperationType))
                {
                    Type enumType = null;
                    if (ExporterCacheManager.ExportOptionsCache.ExportAs4)
                    {
                        enumType = typeof(Toolkit.IFC4.IFCDoorStyleOperation);
                    }
                    else
                    {
                        enumType = typeof(Toolkit.IFCDoorStyleOperation);
                    }

                    foreach (Enum ifcDoorStyleOperation in Enum.GetValues(enumType))
                    {
                        string enumAsString = ifcDoorStyleOperation.ToString();
                        if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(enumAsString, doorOperationType))
                        {
                            DoorOperationTypeString = enumAsString;
                            break;
                        }
                    }
                }

                if (DoorOperationTypeString == "NOTDEFINED")
                {
                    // We are going to try to guess the hinge placement.
                    DoorOperationTypeString = CalculateDoorOperationStyle(famInst);
                }

                if (FlippedX ^ FlippedY)
                {
                    DoorOperationTypeString = ReverseDoorStyleOperation(DoorOperationTypeString);
                }

                if (String.Compare(DoorOperationTypeString, "USERDEFINED", true) == 0)
                {
                    string userDefinedOperationType;
                    ParameterUtil.GetStringValueFromElementOrSymbol(doorType, "UserDefinedOperationType", out userDefinedOperationType);
                    if (!string.IsNullOrEmpty(userDefinedOperationType))
                    {
                        UserDefinedOperationType = userDefinedOperationType;
                    }
                    else
                    {
                        DoorOperationTypeString = "NOTDEFINED";   //re-set to NotDefined if operation type is set to UserDefined but the userDefinedOperationType parameter is empty!
                    }
                }

                // Get override operationtype from parameter Operation
                ParameterUtil.GetStringValueFromElementOrSymbol(doorType, "Operation", out doorOperationType);
                if (!string.IsNullOrEmpty(doorOperationType))
                {
                    if (ExporterCacheManager.ExportOptionsCache.ExportAs4)
                    {
                        Toolkit.IFC4.IFCDoorTypeOperation doorOp = Toolkit.IFC4.IFCDoorTypeOperation.NOTDEFINED;
                        if (Enum.TryParse <Toolkit.IFC4.IFCDoorTypeOperation>(doorOperationType, true, out doorOp))
                        {
                            DoorOperationTypeString = doorOp.ToString();
                        }
                    }
                    else
                    {
                        Toolkit.IFCDoorStyleOperation doorOp = Toolkit.IFCDoorStyleOperation.NotDefined;
                        if (Enum.TryParse <Toolkit.IFCDoorStyleOperation>(doorOperationType, true, out doorOp))
                        {
                            DoorOperationTypeString = doorOp.ToString();
                        }
                    }
                }
            }

            if (HasRealWallHost)
            {
                // do hingeside calculation
                Wall wall = HostObject as Wall;
                PosHingeSide = true;

                BoundingBoxXYZ  famBBox     = null;
                Options         options     = GeometryUtil.GetIFCExportGeometryOptions();
                GeometryElement geomElement = famInst.GetOriginalGeometry(options);
                if (geomElement != null)
                {
                    famBBox = geomElement.GetBoundingBox();
                }

                if (famBBox != null)
                {
                    XYZ bboxCtr = trf.OfPoint((famBBox.Min + famBBox.Max) / 2.0);

                    Curve curve = WallExporter.GetWallAxis(wall);

                    XYZ wallZDir = WallExporter.GetWallHeightDirection(wall);

                    // famInst.HostParameter will fail if FamilyPlacementType is WorkPlaneBased, regardless of whether or not the reported host is a Wall.
                    // In this case, just use the start parameter of the curve.
                    bool   hasHostParameter = famInst.Symbol.Family.FamilyPlacementType != FamilyPlacementType.WorkPlaneBased;
                    double param            = hasHostParameter ? famInst.HostParameter : curve.GetEndParameter(0);

                    Transform wallTrf  = curve.ComputeDerivatives(param, false);
                    XYZ       wallOrig = wallTrf.Origin;
                    XYZ       wallXDir = wallTrf.BasisX;
                    XYZ       wallYDir = wallZDir.CrossProduct(wallXDir);

                    double eps = MathUtil.Eps();

                    bboxCtr     -= wallOrig;
                    PosHingeSide = (bboxCtr.DotProduct(wallYDir) > -eps);

                    XYZ famInstYDir = trf.BasisY;
                    FlippedSymbol = (PosHingeSide != (wallYDir.DotProduct(famInstYDir) > -eps));
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Collect information about material layer.
        ///   For IFC4RV Architectural exchange, it will generate IfcMatrialConstituentSet along with the relevant IfcShapeAspect and the width in the quantityset
        ///   For IFC4RV Structural exchange, it will generate multiple components as IfcBuildingElementPart for each layer
        ///   For others IfcMaterialLayer will be created
        /// </summary>
        private void CollectMaterialLayerSet()
        {
            ElementId typeElemId = m_Element.GetTypeId();

            MaterialIds = new List <Tuple <ElementId, string, double> >();
            IFCAnyHandle materialLayerSet = ExporterCacheManager.MaterialSetCache.FindLayerSet(typeElemId);

            // Roofs with no components are only allowed one material.  We will arbitrarily choose the thickest material.
            PrimaryMaterialHandle = ExporterCacheManager.MaterialSetCache.FindPrimaryMaterialHnd(typeElemId);
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(materialLayerSet))
            {
                List <double> widths = new List <double>();
                List <MaterialFunctionAssignment> functions = new List <MaterialFunctionAssignment>();

                HostObjAttributes hostObjAttr = m_Element.Document.GetElement(typeElemId) as HostObjAttributes;
                if (hostObjAttr == null)
                {
                    // It does not have the HostObjAttribute (where we will get the compound structure for material layer set.
                    // We will define a single material instead and create the material layer set of this single material if there is enough information (At least Material id and thickness)
                    FamilyInstance familyInstance = m_Element as FamilyInstance;
                    if (familyInstance == null)
                    {
                        return;
                    }

                    FamilySymbol            familySymbol = familyInstance.Symbol;
                    ICollection <ElementId> famMatIds    = familySymbol.GetMaterialIds(false);
                    if (famMatIds.Count == 0)
                    {
                        // For some reason Plate type may not return any Material id
                        ElementId baseMatId = CategoryUtil.GetBaseMaterialIdForElement(m_Element);
                        Material  material  = m_Element.Document.GetElement(baseMatId) as Material;
                        if (material == null)
                        {
                            return;
                        }

                        string    layerName    = NamingUtil.GetOverrideStringValue(material, "IfcMaterialLayer.Name", material.Name);
                        double    matWidth     = 0.0;
                        Parameter thicknessPar = familySymbol.get_Parameter(BuiltInParameter.CURTAIN_WALL_SYSPANEL_THICKNESS);
                        if (thicknessPar != null)
                        {
                            matWidth = thicknessPar.AsDouble();
                        }
                        widths.Add(matWidth);

                        if (baseMatId != ElementId.InvalidElementId)
                        {
                            MaterialIds.Add(new Tuple <ElementId, string, double>(baseMatId, layerName, matWidth));
                        }
                        // How to get the thickness? For CurtainWall Panel (PanelType), there is a builtin parameter CURTAINWALL_SYSPANEL_THICKNESS

                        functions.Add(MaterialFunctionAssignment.None);
                    }
                    else
                    {
                        foreach (ElementId matid in famMatIds)
                        {
                            // How to get the thickness? For CurtainWall Panel (PanelType), there is a builtin parameter CURTAINWALL_SYSPANEL_THICKNESS
                            Parameter thicknessPar = familySymbol.get_Parameter(BuiltInParameter.CURTAIN_WALL_SYSPANEL_THICKNESS);
                            double    matWidth     = 0.0;
                            if (thicknessPar == null)
                            {
                                matWidth = ParameterUtil.GetSpecialThicknessParameter(familySymbol);
                            }
                            else
                            {
                                matWidth = thicknessPar.AsDouble();
                            }

                            if (MathUtil.IsAlmostZero(matWidth))
                            {
                                continue;
                            }

                            widths.Add(matWidth);
                            ElementId baseMatId = CategoryUtil.GetBaseMaterialIdForElement(m_Element);
                            if (matid != ElementId.InvalidElementId)
                            {
                                Material material = m_Element.Document.GetElement(matid) as Material;
                                if (material != null)
                                {
                                    string layerName = NamingUtil.GetOverrideStringValue(material, "IfcMaterialLayer.Name", material.Name);
                                    MaterialIds.Add(new Tuple <ElementId, string, double>(matid, layerName, matWidth));
                                }
                            }
                            else
                            {
                                MaterialIds.Add(new Tuple <ElementId, string, double>(baseMatId, null, matWidth));
                            }

                            functions.Add(MaterialFunctionAssignment.None);
                        }
                    }
                }
                else
                {
                    ElementId         baseMatId = CategoryUtil.GetBaseMaterialIdForElement(m_Element);
                    CompoundStructure cs        = hostObjAttr.GetCompoundStructure();

                    if (cs != null)
                    {
                        double scaledOffset = 0.0, scaledWallWidth = 0.0, wallHeight = 0.0;
                        Wall   wall = m_Element as Wall;
                        if (wall != null)
                        {
                            scaledWallWidth = UnitUtil.ScaleLength(wall.Width);
                            scaledOffset    = -scaledWallWidth / 2.0;
                            BoundingBoxXYZ boundingBox = wall.get_BoundingBox(null);
                            if (boundingBox != null)
                            {
                                wallHeight = boundingBox.Max.Z - boundingBox.Min.Z;
                            }
                        }

                        //TODO: Vertically compound structures are not yet supported by export.
                        if (!cs.IsVerticallyHomogeneous() && !MathUtil.IsAlmostZero(wallHeight))
                        {
                            cs = cs.GetSimpleCompoundStructure(wallHeight, wallHeight / 2.0);
                        }

                        for (int ii = 0; ii < cs.LayerCount; ++ii)
                        {
                            double matWidth = cs.GetLayerWidth(ii);
                            //if (MathUtil.IsAlmostZero(matWidth))
                            //   continue;

                            ElementId matId = cs.GetMaterialId(ii);
                            if (matId != ElementId.InvalidElementId)
                            {
                                Material material = m_Element.Document.GetElement(matId) as Material;
                                if (material != null)
                                {
                                    string layerName = NamingUtil.GetOverrideStringValue(material, "IfcMaterialLayer.Name", material.Name);
                                    MaterialIds.Add(new Tuple <ElementId, string, double>(matId, layerName, matWidth));
                                }
                            }
                            else
                            {
                                MaterialIds.Add(new Tuple <ElementId, string, double>(baseMatId, null, matWidth));
                            }
                            widths.Add(matWidth);
                            // save layer function into ProductWrapper,
                            // it's used while exporting "Function" of Pset_CoveringCommon
                            functions.Add(cs.GetLayerFunction(ii));
                        }
                    }

                    if (MaterialIds.Count == 0)
                    {
                        double matWidth = cs != null?cs.GetWidth() : 0.0;

                        widths.Add(matWidth);
                        if (baseMatId != ElementId.InvalidElementId)
                        {
                            Material material = m_Element.Document.GetElement(baseMatId) as Material;
                            if (material != null)
                            {
                                string layerName = NamingUtil.GetOverrideStringValue(material, "IfcMaterialLayer.Name", material.Name);
                                MaterialIds.Add(new Tuple <ElementId, string, double>(baseMatId, layerName, matWidth));
                            }
                        }
                        functions.Add(MaterialFunctionAssignment.None);
                    }
                }

                if (m_ProductWrapper != null)
                {
                    m_ProductWrapper.ClearFinishMaterials();
                }

                // We can't create IfcMaterialLayers without creating an IfcMaterialLayerSet.  So we will simply collate here.
                IList <IFCAnyHandle> materialHnds = new List <IFCAnyHandle>();
                IList <int>          widthIndices = new List <int>();
                double thickestLayer = 0.0;
                for (int ii = 0; ii < MaterialIds.Count; ++ii)
                {
                    // Require positive width for IFC2x3 and before, and non-negative width for IFC4.
                    if (widths[ii] < -MathUtil.Eps())
                    {
                        continue;
                    }

                    bool almostZeroWidth = MathUtil.IsAlmostZero(widths[ii]);
                    if (!ExporterCacheManager.ExportOptionsCache.ExportAs4 && almostZeroWidth)
                    {
                        continue;
                    }

                    if (almostZeroWidth)
                    {
                        widths[ii] = 0.0;
                    }

                    IFCAnyHandle materialHnd = CategoryUtil.GetOrCreateMaterialHandle(m_ExporterIFC, MaterialIds[ii].Item1);
                    if (PrimaryMaterialHandle == null || (widths[ii] > thickestLayer))
                    {
                        PrimaryMaterialHandle = materialHnd;
                        thickestLayer         = widths[ii];
                    }

                    widthIndices.Add(ii);
                    materialHnds.Add(materialHnd);

                    if ((m_ProductWrapper != null) && (functions[ii] == MaterialFunctionAssignment.Finish1 || functions[ii] == MaterialFunctionAssignment.Finish2))
                    {
                        m_ProductWrapper.AddFinishMaterial(materialHnd);
                    }
                }

                int numLayersToCreate = widthIndices.Count;
                if (numLayersToCreate == 0)
                {
                    MaterialLayerSetHandle = materialLayerSet;
                    return;
                }

                // If it is a single material, check single material override (only IfcMaterial without IfcMaterialLayerSet with only 1 member)
                if (numLayersToCreate == 1 && ExporterCacheManager.ExportOptionsCache.ExportAs4ReferenceView)
                {
                    string paramValue;
                    ParameterUtil.GetStringValueFromElementOrSymbol(m_Element, "IfcSingleMaterialOverride", out paramValue);
                    if (!string.IsNullOrEmpty(paramValue))
                    {
                        IFCAnyHandle singleMaterialOverrideHnd = IFCInstanceExporter.CreateMaterial(m_ExporterIFC.GetFile(), paramValue, null, null);
                        ExporterCacheManager.MaterialHandleCache.Register(MaterialIds[0].Item1, singleMaterialOverrideHnd);
                        MaterialLayerSetHandle = singleMaterialOverrideHnd;
                        return;
                    }
                }

                IFCFile  file     = m_ExporterIFC.GetFile();
                Document document = ExporterCacheManager.Document;

                IList <IFCAnyHandle> layers = new List <IFCAnyHandle>(numLayersToCreate);
                IList <Tuple <string, IFCAnyHandle> > layerWidthQuantities = new List <Tuple <string, IFCAnyHandle> >();
                HashSet <string> layerNameUsed = new HashSet <string>();
                double           totalWidth    = 0.0;

                for (int ii = 0; ii < numLayersToCreate; ii++)
                {
                    int    widthIndex  = widthIndices[ii];
                    double scaledWidth = UnitUtil.ScaleLength(widths[widthIndex]);

                    string layerName   = "Layer";
                    string description = null;
                    string category    = null;
                    int?   priority    = null;

                    IFCLogical?isVentilated = null;
                    int        isVentilatedValue;

                    Material material = document.GetElement(MaterialIds[ii].Item1) as Material;
                    if (material != null)
                    {
                        if (ParameterUtil.GetIntValueFromElement(material, "IfcMaterialLayer.IsVentilated", out isVentilatedValue) != null)
                        {
                            if (isVentilatedValue == 0)
                            {
                                isVentilated = IFCLogical.False;
                            }
                            else if (isVentilatedValue == 1)
                            {
                                isVentilated = IFCLogical.True;
                            }
                        }

                        if (ExporterCacheManager.ExportOptionsCache.ExportAs4)
                        {
                            layerName = MaterialIds[ii].Item2;
                            if (string.IsNullOrEmpty(layerName))
                            {
                                layerName = "Layer";
                            }

                            // Ensure layer name is unique
                            layerName = NamingUtil.GetUniqueNameWithinSet(layerName, ref layerNameUsed);

                            description = NamingUtil.GetOverrideStringValue(material, "IfcMaterialLayer.Description",
                                                                            IFCAnyHandleUtil.GetStringAttribute(materialHnds[ii], "Description"));
                            category = NamingUtil.GetOverrideStringValue(material, "IfcMaterialLayer.Category",
                                                                         IFCAnyHandleUtil.GetStringAttribute(materialHnds[ii], "Category"));
                            int priorityValue;
                            if (ParameterUtil.GetIntValueFromElement(material, "IfcMaterialLayer.Priority", out priorityValue) != null)
                            {
                                priority = priorityValue;
                            }
                        }
                    }

                    if (ExporterCacheManager.ExportOptionsCache.ExportAs4ReferenceView)
                    {
                        // Skip component that has zero width (the will be no geometry associated to it
                        if (MathUtil.IsAlmostZero(scaledWidth))
                        {
                            continue;
                        }

                        IFCAnyHandle materialConstituent = IFCInstanceExporter.CreateMaterialConstituent(file, materialHnds[ii],
                                                                                                         name: layerName, description: description, category: category);
                        layers.Add(materialConstituent);

                        IFCAnyHandle layerQtyHnd = IFCInstanceExporter.CreateQuantityLength(file, "Width", description, null, scaledWidth);
                        totalWidth += scaledWidth;
                        layerWidthQuantities.Add(new Tuple <string, IFCAnyHandle>(layerName, layerQtyHnd));
                    }
                    else
                    {
                        IFCAnyHandle materialLayer = IFCInstanceExporter.CreateMaterialLayer(file, materialHnds[ii], scaledWidth, isVentilated,
                                                                                             name: layerName, description: description, category: category, priority: priority);
                        layers.Add(materialLayer);
                    }
                }

                if (layers.Count > 0)
                {
                    Element type         = document.GetElement(typeElemId);
                    string  layerSetName = NamingUtil.GetOverrideStringValue(type, "IfcMaterialLayerSet.Name", m_ExporterIFC.GetFamilyName());
                    string  layerSetDesc = NamingUtil.GetOverrideStringValue(type, "IfcMaterialLayerSet.Description", null);

                    if (ExporterCacheManager.ExportOptionsCache.ExportAs4ReferenceView)
                    {
                        HashSet <IFCAnyHandle> constituents = new HashSet <IFCAnyHandle>(layers);
                        MaterialLayerSetHandle = IFCInstanceExporter.CreateMaterialConstituentSet(file, constituents, name: layerSetName, description: layerSetDesc);
                        foreach (Tuple <string, IFCAnyHandle> layerWidthQty in layerWidthQuantities)
                        {
                            LayerQuantityWidthHnd.Add(IFCInstanceExporter.CreatePhysicalComplexQuantity(file, layerWidthQty.Item1, null,
                                                                                                        new HashSet <IFCAnyHandle>()
                            {
                                layerWidthQty.Item2
                            }, "Layer", null, null));
                        }
                        // Finally create the total width as a quantity
                        LayerQuantityWidthHnd.Add(IFCInstanceExporter.CreateQuantityLength(file, "Width", null, null, totalWidth));
                    }
                    else
                    {
                        MaterialLayerSetHandle = IFCInstanceExporter.CreateMaterialLayerSet(file, layers, layerSetName, layerSetDesc);
                    }

                    ExporterCacheManager.MaterialSetCache.RegisterLayerSet(typeElemId, MaterialLayerSetHandle, this);
                }

                if (!IFCAnyHandleUtil.IsNullOrHasNoValue(PrimaryMaterialHandle))
                {
                    ExporterCacheManager.MaterialSetCache.RegisterPrimaryMaterialHnd(typeElemId, PrimaryMaterialHandle);
                }
            }
            else
            {
                MaterialLayerSetHandle = materialLayerSet;

                MaterialLayerSetInfo mlsInfo = ExporterCacheManager.MaterialSetCache.FindMaterialLayerSetInfo(typeElemId);
                if (mlsInfo != null)
                {
                    MaterialIds           = mlsInfo.MaterialIds;
                    PrimaryMaterialHandle = mlsInfo.PrimaryMaterialHandle;
                    LayerQuantityWidthHnd = mlsInfo.LayerQuantityWidthHnd;
                }
            }

            return;
        }
Ejemplo n.º 5
0
        private void GenerateIFCObjectsIfNeeded()
        {
            if (m_needToGenerateIFCObjects)
            {
                m_needToGenerateIFCObjects = false;
            }
            else
            {
                return;
            }

            IFCAnyHandle materialLayerSet = null;

            if (m_ProductWrapper != null && !m_ProductWrapper.ToNative().IsValidObject)
            {
                m_ProductWrapper = null;
            }

            m_ProductWrapper?.ClearFinishMaterials();

            // We can't create IfcMaterialLayers without creating an IfcMaterialLayerSet.  So we will simply collate here.
            IList <IFCAnyHandle> materialHnds = new List <IFCAnyHandle>();
            IList <int>          widthIndices = new List <int>();
            double thickestLayer = 0.0;

            for (int ii = 0; ii < MaterialIds.Count; ++ii)
            {
                // Require positive width for IFC2x3 and before, and non-negative width for IFC4.
                if (MaterialIds[ii].m_matWidth < -MathUtil.Eps())
                {
                    continue;
                }

                bool almostZeroWidth = MathUtil.IsAlmostZero(MaterialIds[ii].m_matWidth);
                if (!ExporterCacheManager.ExportOptionsCache.ExportAs4 && almostZeroWidth)
                {
                    continue;
                }

                if (almostZeroWidth)
                {
                    MaterialIds[ii].m_matWidth = 0.0;
                }

                IFCAnyHandle materialHnd = CategoryUtil.GetOrCreateMaterialHandle(m_ExporterIFC, MaterialIds[ii].m_baseMatId);
                if (m_PrimaryMaterialHandle == null || (MaterialIds[ii].m_matWidth > thickestLayer))
                {
                    m_PrimaryMaterialHandle = materialHnd;
                    thickestLayer           = MaterialIds[ii].m_matWidth;
                }

                widthIndices.Add(ii);
                materialHnds.Add(materialHnd);

                if ((m_ProductWrapper != null) && (MaterialIds[ii].m_function == MaterialFunctionAssignment.Finish1 || MaterialIds[ii].m_function == MaterialFunctionAssignment.Finish2))
                {
                    m_ProductWrapper.AddFinishMaterial(materialHnd);
                }
            }

            int numLayersToCreate = widthIndices.Count;

            if (numLayersToCreate == 0)
            {
                m_MaterialLayerSetHandle = materialLayerSet;
                return;
            }

            // If it is a single material, check single material override (only IfcMaterial without IfcMaterialLayerSet with only 1 member)
            if (numLayersToCreate == 1 && ExporterCacheManager.ExportOptionsCache.ExportAs4ReferenceView)
            {
                m_MaterialLayerSetHandle = ExporterUtil.GetSingleMaterial(m_ExporterIFC, m_Element,
                                                                          MaterialIds[0].m_baseMatId) ?? materialHnds[0];
                return;
            }

            IFCFile  file     = m_ExporterIFC.GetFile();
            Document document = ExporterCacheManager.Document;

            IList <IFCAnyHandle> layers = new List <IFCAnyHandle>(numLayersToCreate);
            IList <Tuple <string, IFCAnyHandle> > layerWidthQuantities = new List <Tuple <string, IFCAnyHandle> >();
            HashSet <string> layerNameUsed = new HashSet <string>();
            double           totalWidth    = 0.0;

            for (int ii = 0; ii < numLayersToCreate; ii++)
            {
                int    widthIndex  = widthIndices[ii];
                double scaledWidth = UnitUtil.ScaleLength(MaterialIds[widthIndex].m_matWidth);

                string layerName   = "Layer";
                string description = null;
                string category    = null;
                int?   priority    = null;

                IFCLogical?isVentilated = null;
                int        isVentilatedValue;

                Material material = document.GetElement(MaterialIds[ii].m_baseMatId) as Material;
                if (material != null)
                {
                    if (ParameterUtil.GetIntValueFromElement(material, "IfcMaterialLayer.IsVentilated", out isVentilatedValue) != null)
                    {
                        if (isVentilatedValue == 0)
                        {
                            isVentilated = IFCLogical.False;
                        }
                        else if (isVentilatedValue == 1)
                        {
                            isVentilated = IFCLogical.True;
                        }
                    }

                    if (ExporterCacheManager.ExportOptionsCache.ExportAs4)
                    {
                        layerName = MaterialIds[ii].m_layerName;
                        if (string.IsNullOrEmpty(layerName))
                        {
                            layerName = "Layer";
                        }

                        // Ensure layer name is unique
                        layerName = NamingUtil.GetUniqueNameWithinSet(layerName, ref layerNameUsed);

                        description = NamingUtil.GetOverrideStringValue(material, "IfcMaterialLayer.Description",
                                                                        IFCAnyHandleUtil.GetStringAttribute(materialHnds[ii], "Description"));
                        category = NamingUtil.GetOverrideStringValue(material, "IfcMaterialLayer.Category",
                                                                     IFCAnyHandleUtil.GetStringAttribute(materialHnds[ii], "Category"));
                        int priorityValue;
                        if (ParameterUtil.GetIntValueFromElement(material, "IfcMaterialLayer.Priority", out priorityValue) != null)
                        {
                            priority = priorityValue;
                        }
                    }
                }

                if (ExporterCacheManager.ExportOptionsCache.ExportAs4ReferenceView)
                {
                    // Skip component that has zero width (the will be no geometry associated to it
                    if (MathUtil.IsAlmostZero(scaledWidth))
                    {
                        continue;
                    }

                    IFCAnyHandle materialConstituent = IFCInstanceExporter.CreateMaterialConstituent(file, materialHnds[ii],
                                                                                                     name: layerName, description: description, category: category);
                    layers.Add(materialConstituent);

                    IFCAnyHandle layerQtyHnd = IFCInstanceExporter.CreateQuantityLength(file, "Width", description, null, scaledWidth);
                    totalWidth += scaledWidth;
                    layerWidthQuantities.Add(new Tuple <string, IFCAnyHandle>(layerName, layerQtyHnd));
                }
                else
                {
                    IFCAnyHandle materialLayer = IFCInstanceExporter.CreateMaterialLayer(file, materialHnds[ii], scaledWidth, isVentilated,
                                                                                         name: layerName, description: description, category: category, priority: priority);
                    layers.Add(materialLayer);
                }
            }

            ElementId typeElemId = m_Element.GetTypeId();

            if (layers.Count > 0)
            {
                Element type         = document.GetElement(typeElemId);
                string  layerSetName = NamingUtil.GetOverrideStringValue(type, "IfcMaterialLayerSet.Name", m_ExporterIFC.GetFamilyName());
                string  layerSetDesc = NamingUtil.GetOverrideStringValue(type, "IfcMaterialLayerSet.Description", null);

                if (ExporterCacheManager.ExportOptionsCache.ExportAs4ReferenceView)
                {
                    HashSet <IFCAnyHandle> constituents = new HashSet <IFCAnyHandle>(layers);
                    m_MaterialLayerSetHandle = IFCInstanceExporter.CreateMaterialConstituentSet(file, constituents, name: layerSetName, description: layerSetDesc);
                    foreach (Tuple <string, IFCAnyHandle> layerWidthQty in layerWidthQuantities)
                    {
                        m_LayerQuantityWidthHnd.Add(IFCInstanceExporter.CreatePhysicalComplexQuantity(file, layerWidthQty.Item1, null,
                                                                                                      new HashSet <IFCAnyHandle>()
                        {
                            layerWidthQty.Item2
                        }, "Layer", null, null));
                    }
                    // Finally create the total width as a quantity
                    m_LayerQuantityWidthHnd.Add(IFCInstanceExporter.CreateQuantityLength(file, "Width", null, null, totalWidth));
                }
                else
                {
                    m_MaterialLayerSetHandle = IFCInstanceExporter.CreateMaterialLayerSet(file, layers, layerSetName, layerSetDesc);
                }

                ExporterCacheManager.MaterialSetCache.RegisterLayerSet(typeElemId, m_MaterialLayerSetHandle, this);
            }

            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(m_PrimaryMaterialHandle))
            {
                ExporterCacheManager.MaterialSetCache.RegisterPrimaryMaterialHnd(typeElemId, m_PrimaryMaterialHandle);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Collect information about material layer.
        ///   For IFC4RV Architectural exchange, it will generate IfcMatrialConstituentSet along with the relevant IfcShapeAspect and the width in the quantityset
        ///   For IFC4RV Structural exchange, it will generate multiple components as IfcBuildingElementPart for each layer
        ///   For others IfcMaterialLayer will be created
        /// </summary>
        private void CollectMaterialLayerSet()
        {
            ElementId    typeElemId       = m_Element.GetTypeId();
            IFCAnyHandle materialLayerSet = ExporterCacheManager.MaterialSetCache.FindLayerSet(typeElemId);

            // Roofs with no components are only allowed one material.  We will arbitrarily choose the thickest material.
            m_PrimaryMaterialHandle = ExporterCacheManager.MaterialSetCache.FindPrimaryMaterialHnd(typeElemId);

            bool materialHandleIsNotValid = IFCAnyHandleUtil.IsNullOrHasNoValue(materialLayerSet);

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(materialLayerSet) || materialHandleIsNotValid)
            {
                if (materialHandleIsNotValid)
                {
                    UnregisterIFCHandles();
                }
                m_needToGenerateIFCObjects = true;

                List <double> widths = new List <double>();
                List <MaterialFunctionAssignment> functions = new List <MaterialFunctionAssignment>();

                HostObjAttributes hostObjAttr = m_Element.Document.GetElement(typeElemId) as HostObjAttributes;
                if (hostObjAttr == null)
                {
                    // It does not have the HostObjAttribute (where we will get the compound structure for material layer set.
                    // We will define a single material instead and create the material layer set of this single material if there is enough information (At least Material id and thickness)
                    FamilyInstance familyInstance = m_Element as FamilyInstance;
                    if (familyInstance == null)
                    {
                        return;
                    }

                    FamilySymbol            familySymbol = familyInstance.Symbol;
                    ICollection <ElementId> famMatIds    = familySymbol.GetMaterialIds(false);
                    if (famMatIds.Count == 0)
                    {
                        // For some reason Plate type may not return any Material id
                        ElementId baseMatId = CategoryUtil.GetBaseMaterialIdForElement(m_Element);
                        Material  material  = m_Element.Document.GetElement(baseMatId) as Material;
                        if (material == null)
                        {
                            return;
                        }

                        string    layerName    = NamingUtil.GetMaterialLayerName(material);
                        double    matWidth     = 0.0;
                        Parameter thicknessPar = familySymbol.get_Parameter(BuiltInParameter.CURTAIN_WALL_SYSPANEL_THICKNESS);
                        if (thicknessPar != null)
                        {
                            matWidth = thicknessPar.AsDouble();
                        }
                        widths.Add(matWidth);

                        if (baseMatId != ElementId.InvalidElementId)
                        {
                            MaterialIds.Add(new MaterialInfo(baseMatId, layerName, matWidth, MaterialFunctionAssignment.None));
                        }
                        // How to get the thickness? For CurtainWall Panel (PanelType), there is a builtin parameter CURTAINWALL_SYSPANEL_THICKNESS

                        functions.Add(MaterialFunctionAssignment.None);
                    }
                    else
                    {
                        foreach (ElementId matid in famMatIds)
                        {
                            // How to get the thickness? For CurtainWall Panel (PanelType), there is a builtin parameter CURTAINWALL_SYSPANEL_THICKNESS
                            double matWidth = familySymbol.get_Parameter(BuiltInParameter.CURTAIN_WALL_SYSPANEL_THICKNESS)?.AsDouble() ??
                                              ParameterUtil.GetSpecialThicknessParameter(familySymbol);

                            if (MathUtil.IsAlmostZero(matWidth))
                            {
                                continue;
                            }

                            widths.Add(matWidth);
                            ElementId baseMatId = CategoryUtil.GetBaseMaterialIdForElement(m_Element);
                            if (matid != ElementId.InvalidElementId)
                            {
                                Material material = m_Element.Document.GetElement(matid) as Material;
                                if (material != null)
                                {
                                    string layerName = NamingUtil.GetMaterialLayerName(material);
                                    MaterialIds.Add(new MaterialInfo(matid, layerName, matWidth, MaterialFunctionAssignment.None));
                                }
                            }
                            else
                            {
                                MaterialIds.Add(new MaterialInfo(baseMatId, null, matWidth, MaterialFunctionAssignment.None));
                            }

                            functions.Add(MaterialFunctionAssignment.None);
                        }
                    }
                }
                else
                {
                    ElementId         baseMatId = CategoryUtil.GetBaseMaterialIdForElement(m_Element);
                    CompoundStructure cs        = hostObjAttr.GetCompoundStructure();

                    if (cs != null)
                    {
                        double scaledOffset = 0.0, scaledWallWidth = 0.0, wallHeight = 0.0;
                        Wall   wall = m_Element as Wall;
                        if (wall != null)
                        {
                            scaledWallWidth = UnitUtil.ScaleLength(wall.Width);
                            scaledOffset    = -scaledWallWidth / 2.0;
                            BoundingBoxXYZ boundingBox = wall.get_BoundingBox(null);
                            if (boundingBox != null)
                            {
                                wallHeight = boundingBox.Max.Z - boundingBox.Min.Z;
                            }
                        }

                        //TODO: Vertically compound structures are not yet supported by export.
                        if (!cs.IsVerticallyHomogeneous() && !MathUtil.IsAlmostZero(wallHeight))
                        {
                            cs = cs.GetSimpleCompoundStructure(wallHeight, wallHeight / 2.0);
                        }

                        for (int ii = 0; ii < cs.LayerCount; ++ii)
                        {
                            double matWidth = cs.GetLayerWidth(ii);

                            ElementId matId = cs.GetMaterialId(ii);
                            widths.Add(matWidth);
                            // save layer function into ProductWrapper,
                            // it's used while exporting "Function" of Pset_CoveringCommon
                            functions.Add(cs.GetLayerFunction(ii));

                            if (matId != ElementId.InvalidElementId)
                            {
                                Material material = m_Element.Document.GetElement(matId) as Material;
                                if (material != null)
                                {
                                    string layerName = NamingUtil.GetMaterialLayerName(material);
                                    MaterialIds.Add(new MaterialInfo(matId, layerName, matWidth, functions.Last()));
                                }
                            }
                            else
                            {
                                MaterialIds.Add(new MaterialInfo(baseMatId, null, matWidth, functions.Last()));
                            }
                        }
                    }

                    if (MaterialIds.Count == 0)
                    {
                        double matWidth = cs?.GetWidth() ?? 0.0;
                        widths.Add(matWidth);
                        if (baseMatId != ElementId.InvalidElementId)
                        {
                            Material material = m_Element.Document.GetElement(baseMatId) as Material;
                            if (material != null)
                            {
                                string layerName = NamingUtil.GetMaterialLayerName(material);
                                MaterialIds.Add(new MaterialInfo(baseMatId, layerName, matWidth, MaterialFunctionAssignment.None));
                            }
                        }
                        functions.Add(MaterialFunctionAssignment.None);
                    }
                }
            }
            else
            {
                m_needToGenerateIFCObjects = false;

                m_MaterialLayerSetHandle = materialLayerSet;

                MaterialLayerSetInfo mlsInfo = ExporterCacheManager.MaterialSetCache.FindMaterialLayerSetInfo(typeElemId);
                if (mlsInfo != null)
                {
                    MaterialIds             = mlsInfo.MaterialIds;
                    m_PrimaryMaterialHandle = mlsInfo.PrimaryMaterialHandle;
                    m_LayerQuantityWidthHnd = mlsInfo.LayerQuantityWidthHnd;
                }
            }

            return;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Checks if element is external.
        /// </summary>
        /// <remarks>
        /// An element is considered external if either:
        ///   <li> A special Yes/No parameter "IsExternal" is applied to it or its type and its value is set to "yes".</li>
        ///   <li> The element itself has information about being an external element.</li>
        /// All other elements are internal.
        /// </remarks>
        /// <param name="element">The element.</param>
        /// <returns>True if the element is external, false otherwise.</returns>
        public static bool IsElementExternal(Element element)
        {
            if (element == null)
            {
                return(false);
            }

            // Look for a parameter "IsExternal", potentially localized.
            ElementId elementId = element.Id;

            bool isExternal;

            if (ExporterCacheManager.IsExternalParameterValueCache.TryGetValue(elementId, out isExternal))
            {
                return(isExternal);
            }

            bool?maybeIsExternal = IsElementExternalViaParameter(element);

            if (maybeIsExternal.HasValue)
            {
                return(CacheIsElementExternal(elementId, maybeIsExternal.Value));
            }

            ElementId elementTypeId = element.GetTypeId();
            Element   elementType   = null;

            if (elementTypeId != ElementId.InvalidElementId)
            {
                if (ExporterCacheManager.IsExternalParameterValueCache.TryGetValue(elementTypeId, out isExternal))
                {
                    return(isExternal);
                }

                elementType = element.Document.GetElement(element.GetTypeId());
            }
            else if (element is ElementType)
            {
                elementType = element;
            }

            // Many element types have the FUNCTION_PARAM parameter.  If this is set, use its value.
            int elementFunction;

            if ((elementType != null) && ParameterUtil.GetIntValueFromElement(elementType, BuiltInParameter.FUNCTION_PARAM, out elementFunction) != null)
            {
                // Note that the WallFunction enum value is the same for many different kinds of objects.
                // Note: it is unclear whether Soffit walls should be considered exterior, but won't change
                // existing functionality for now.
                isExternal = (elementFunction != ((int)WallFunction.Interior));
                if (elementId != elementTypeId && elementTypeId != ElementId.InvalidElementId)
                {
                    ExporterCacheManager.IsExternalParameterValueCache[elementTypeId] = isExternal;
                }
                return(CacheIsElementExternal(elementId, isExternal));
            }

            // Specific element types that know if they are external or not if the built-in parameter isn't set.
            // Categories are used, and not types, to also support in-place families

            // Roofs are always external
            ElementId categoryId = element.Category.Id;

            if (categoryId == new ElementId(BuiltInCategory.OST_Roofs) ||
                categoryId == new ElementId(BuiltInCategory.OST_MassExteriorWall))
            {
                return(CacheIsElementExternal(elementId, true));
            }

            // Mass interior walls are always internal
            if (categoryId == new ElementId(BuiltInCategory.OST_MassInteriorWall))
            {
                return(CacheIsElementExternal(elementId, false));
            }

            // Family instances may be hosted on an external element
            if (element is FamilyInstance)
            {
                FamilyInstance familyInstance     = element as FamilyInstance;
                Element        familyInstanceHost = familyInstance.Host;
                if (familyInstanceHost == null)
                {
                    Reference familyInstanceHostReference = familyInstance.HostFace;
                    if (familyInstanceHostReference != null)
                    {
                        familyInstanceHost = element.Document.GetElement(familyInstanceHostReference);
                    }
                }

                if (familyInstanceHost != null)
                {
                    return(IsElementExternal(familyInstanceHost));
                }
            }

            return(CacheIsElementExternal(elementId, false));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Clear all caches contained in this manager.
        /// </summary>
        public static void Clear()
        {
            if (m_AllocatedGeometryObjectCache != null)
            {
                m_AllocatedGeometryObjectCache.DisposeCache();
            }
            ParameterUtil.ClearParameterCache();

            m_AllocatedGeometryObjectCache = null;
            m_AreaSchemeCache       = null;
            m_AssemblyInstanceCache = null;
            m_BeamSystemCache       = null;
            BuildingHandle          = null;
            m_CanExportBeamGeometryAsExtrusionCache = null;
            m_CategoryClassNameCache        = null;
            m_CategoryTypeCache             = null;
            m_CeilingSpaceRelCache          = null;
            m_CertifiedEntitiesAndPsetCache = null;
            m_ClassificationCache           = null;
            m_ClassificationLocationCache   = null;
            m_ClassificationReferenceCache  = null;
            m_ContainmentCache = null;
            ComplexPropertyCache.Clear();
            m_CurveAnnotationCache = null;
            m_DBViewsToExport      = null;
            m_DefaultCartesianTransformationOperator3D = null;
            m_DoorWindowDelayedOpeningCreatorCache     = null;
            m_DummyHostCache              = null;
            m_ElementsInAssembliesCache   = null;
            m_ElementToHandleCache        = null;
            m_ElementTypeToHandleCache    = null;
            m_ExportOptionsCache          = null;
            m_FabricAreaHandleCache       = null;
            m_FabricParamsCache           = null;
            m_FamilySymbolToTypeInfoCache = null;
            m_Global3DOriginHandle        = null;
            m_GridCache                     = null;
            m_GroupCache                    = null;
            m_GUIDCache                     = null;
            m_GUIDsToStoreCache             = null;
            m_HandleToDelete                = null;
            m_HandleToElementCache          = null;
            m_HostObjectsLevelIndex         = null;
            m_HostPartsCache                = null;
            m_IsExternalParameterValueCache = null;
            m_LevelInfoCache                = null;
            m_MaterialIdToStyleHandleCache  = null;
            m_MaterialSetUsageCache         = null;
            m_MaterialSetCache              = null;
            m_MaterialConstituentCache      = null;
            m_MaterialConstituentSetCache   = null;
            m_MaterialHandleCache           = null;
            m_MaterialRelationsCache        = null;
            m_MEPCache                    = null;
            m_Object2DCurves              = null;
            OwnerHistoryHandle            = null;
            m_ParameterCache              = null;
            m_PartExportedCache           = null;
            m_PresentationLayerSetCache   = null;
            m_PresentationStyleCache      = null;
            m_ProjectHandle               = null;
            m_PropertyInfoCache           = null;
            m_PropertyMapCache            = null;
            m_PropertySetsForTypeCache    = null;
            m_RailingCache                = null;
            m_RailingSubElementCache      = null;
            m_SiteHandle                  = null;
            m_SpaceBoundaryCache          = null;
            m_SpaceInfoCache              = null;
            m_SpaceOccupantInfoCache      = null;
            m_StairRampContainerInfoCache = null;
            m_SystemsCache                = null;
            m_TrussCache                  = null;
            m_TypePropertyInfoCache       = null;
            m_TypeRelationsCache          = null;
            m_ViewScheduleElementCache    = null;
            m_WallConnectionDataCache     = null;
            // Only for 2022
            //WallCrossSectionCache.Clear();
            m_UnitsCache    = null;
            m_ZoneCache     = null;
            m_ZoneInfoCache = null;
        }