Exemple #1
0
        /// <summary>
        /// Processes an IFCElementComponent object.
        /// </summary>
        /// <param name="ifcElementComponent">The IfcElementComponent handle.</param>
        /// <returns>The IFCElementComponent object.</returns>
        /// <remarks>IFCBuildingElementPart has changed from a subtype of the abstract IFCBuildingElement to IFCElementComponent from IFC2x3 to IFC4.
        /// Instead of having different parents, we will keep IFCBuildingElementPart as a child of IFCBuildingElement.  This means, though, that
        /// this function can only return an IFCElement, the (normally) abstract parent of each.</remarks>
        public static IFCElement ProcessIFCElementComponent(IFCAnyHandle ifcElementComponent)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcElementComponent))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcElementComponent);
                return(null);
            }

            IFCEntity elementComponent;

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

            IFCElement newIFCElementComponent = null;

            // other subclasses not handled yet.
            if (IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC4Obsolete) && IFCAnyHandleUtil.IsValidSubTypeOf(ifcElementComponent, IFCEntityType.IfcBuildingElementPart))
            {
                newIFCElementComponent = IFCBuildingElementPart.ProcessIFCBuildingElementPart(ifcElementComponent);
            }
            else
            {
                newIFCElementComponent = new IFCElementComponent(ifcElementComponent);
            }
            return(newIFCElementComponent);
        }
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 IFCElementComponent object.
      /// </summary>
      /// <param name="ifcElementComponent">The IfcElementComponent handle.</param>
      /// <returns>The IFCElementComponent object.</returns>
      /// <remarks>IFCBuildingElementPart has changed from a subtype of the abstract IFCBuildingElement to IFCElementComponent from IFC2x3 to IFC4.
      /// Instead of having different parents, we will keep IFCBuildingElementPart as a child of IFCBuildingElement.  This means, though, that
      /// this function can only return an IFCElement, the (normally) abstract parent of each.</remarks>
      public static IFCElement ProcessIFCElementComponent(IFCAnyHandle ifcElementComponent)
      {
         if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcElementComponent))
         {
            Importer.TheLog.LogNullError(IFCEntityType.IfcElementComponent);
            return null;
         }

         IFCEntity elementComponent;
         IFCImportFile.TheFile.EntityMap.TryGetValue(ifcElementComponent.StepId, out elementComponent);
         if (elementComponent != null)
            return (elementComponent as IFCElement);

         IFCElement newIFCElementComponent = null;
         // other subclasses not handled yet.
         if (IFCImportFile.TheFile.SchemaVersion > IFCSchemaVersion.IFC2x3 && IFCAnyHandleUtil.IsSubTypeOf(ifcElementComponent, IFCEntityType.IfcBuildingElementPart))
            newIFCElementComponent = IFCBuildingElementPart.ProcessIFCBuildingElementPart(ifcElementComponent);
         else
            newIFCElementComponent = new IFCElementComponent(ifcElementComponent);
         return newIFCElementComponent;
      }