/// <summary>
        /// Processes an IFCBuildingElement object.
        /// </summary>
        /// <param name="ifcBuildingElement">The IfcBuildingElement handle.</param>
        /// <returns>The IFCBuildingElement object.</returns>
        public static IFCBuildingElement ProcessIFCBuildingElement(IFCAnyHandle ifcBuildingElement)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcBuildingElement))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcBuildingElement);
                return(null);
            }

            IFCEntity buildingElement;

            IFCImportFile.TheFile.EntityMap.TryGetValue(ifcBuildingElement.StepId, out buildingElement);
            if (buildingElement != null)
            {
                return(buildingElement as IFCBuildingElement);
            }

            IFCBuildingElement newIFCBuildingElement = null;

            // other subclasses not handled yet.
            if (SchemaSupportsBuildingElementComponentAsSubType() && IFCAnyHandleUtil.IsValidSubTypeOf(ifcBuildingElement, IFCEntityType.IfcBuildingElementComponent))
            {
                newIFCBuildingElement = IFCBuildingElementComponent.ProcessIFCBuildingElementComponent(ifcBuildingElement);
            }
            else
            {
                newIFCBuildingElement = new IFCBuildingElement(ifcBuildingElement);
            }
            return(newIFCBuildingElement);
        }
Exemple #2
0
        /// <summary>
        /// Processes an IfcElement object.
        /// </summary>
        /// <param name="ifcElement">The IfcElement handle.</param>
        /// <returns>The IFCElement object.</returns>
        public static IFCElement ProcessIFCElement(IFCAnyHandle ifcElement)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcElement))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcElement);
                return(null);
            }

            try
            {
                IFCEntity cachedIFCElement;
                IFCImportFile.TheFile.EntityMap.TryGetValue(ifcElement.StepId, out cachedIFCElement);
                if (cachedIFCElement != null)
                {
                    return(cachedIFCElement as IFCElement);
                }

                // other subclasses not handled yet.
                if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcElement, IFCEntityType.IfcBuildingElement))
                {
                    return(IFCBuildingElement.ProcessIFCBuildingElement(ifcElement));
                }
                if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcElement, IFCEntityType.IfcFeatureElement))
                {
                    return(IFCFeatureElement.ProcessIFCFeatureElement(ifcElement));
                }
                if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcElement, IFCEntityType.IfcElementAssembly))
                {
                    return(IFCElementAssembly.ProcessIFCElementAssembly(ifcElement));
                }
                if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcElement, IFCEntityType.IfcElementComponent))
                {
                    return(IFCElementComponent.ProcessIFCElementComponent(ifcElement));
                }

                return(new IFCElement(ifcElement));
            }
            catch (Exception ex)
            {
                HandleError(ex.Message, ifcElement, true);
                return(null);
            }
        }
Exemple #3
0
        /// <summary>
        /// Processes an IfcElement object.
        /// </summary>
        /// <param name="ifcElement">The IfcElement handle.</param>
        /// <returns>The IFCElement object.</returns>
        public static IFCElement ProcessIFCElement(IFCAnyHandle ifcElement)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcElement))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcElement);
                return(null);
            }

            IFCEntity cachedIFCElement;

            IFCImportFile.TheFile.EntityMap.TryGetValue(ifcElement.StepId, out cachedIFCElement);
            if (cachedIFCElement != null)
            {
                return(cachedIFCElement as IFCElement);
            }

            IFCElement newIFCElement = null;

            // other subclasses not handled yet.
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcElement, IFCEntityType.IfcBuildingElement))
            {
                newIFCElement = IFCBuildingElement.ProcessIFCBuildingElement(ifcElement);
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcElement, IFCEntityType.IfcFeatureElement))
            {
                newIFCElement = IFCFeatureElement.ProcessIFCFeatureElement(ifcElement);
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcElement, IFCEntityType.IfcElementAssembly))
            {
                newIFCElement = IFCElementAssembly.ProcessIFCElementAssembly(ifcElement);
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcElement, IFCEntityType.IfcElementComponent))
            {
                newIFCElement = IFCElementComponent.ProcessIFCElementComponent(ifcElement);
            }
            else
            {
                newIFCElement = new IFCElement(ifcElement);
            }
            return(newIFCElement);
        }
      /// <summary>
      /// Processes an IFCBuildingElement object.
      /// </summary>
      /// <param name="ifcBuildingElement">The IfcBuildingElement handle.</param>
      /// <returns>The IFCBuildingElement object.</returns>
      public static IFCBuildingElement ProcessIFCBuildingElement(IFCAnyHandle ifcBuildingElement)
      {
         if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcBuildingElement))
         {
            Importer.TheLog.LogNullError(IFCEntityType.IfcBuildingElement);
            return null;
         }

         IFCEntity buildingElement;
         IFCImportFile.TheFile.EntityMap.TryGetValue(ifcBuildingElement.StepId, out buildingElement);
         if (buildingElement != null)
            return (buildingElement as IFCBuildingElement);

         IFCBuildingElement newIFCBuildingElement = null;
         // other subclasses not handled yet.
         if (IFCImportFile.TheFile.SchemaVersion <= IFCSchemaVersion.IFC2x3 && IFCAnyHandleUtil.IsSubTypeOf(ifcBuildingElement, IFCEntityType.IfcBuildingElementComponent))
            newIFCBuildingElement = IFCBuildingElementComponent.ProcessIFCBuildingElementComponent(ifcBuildingElement);
         else
            newIFCBuildingElement = new IFCBuildingElement(ifcBuildingElement);
         return newIFCBuildingElement;
      }