Exemplo n.º 1
0
        /// <summary>
        /// Processes an IfcPort object.
        /// </summary>
        /// <param name="ifcPort">The IfcPort handle.</param>
        /// <returns>The IFCPort object.</returns>
        public static IFCPort ProcessIFCPort(IFCAnyHandle ifcPort)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcPort))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcPort);
                return(null);
            }

            try
            {
                IFCEntity cachedPort;
                if (IFCImportFile.TheFile.EntityMap.TryGetValue(ifcPort.StepId, out cachedPort))
                {
                    return(cachedPort as IFCPort);
                }

                if (IFCAnyHandleUtil.IsSubTypeOf(ifcPort, IFCEntityType.IfcDistributionPort))
                {
                    return(IFCDistributionPort.ProcessIFCDistributionPort(ifcPort));
                }
            }
            catch (Exception ex)
            {
                HandleError(ex.Message, ifcPort, true);
                return(null);
            }

            Importer.TheLog.LogUnhandledSubTypeError(ifcPort, IFCEntityType.IfcPort, false);
            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Processes an IfcProduct object.
        /// </summary>
        /// <param name="ifcProduct">The IfcProduct handle.</param>
        /// <returns>The IFCProduct object.</returns>
        public static IFCProduct ProcessIFCProduct(IFCAnyHandle ifcProduct)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcProduct))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcProduct);
                return(null);
            }

            try
            {
                IFCEntity cachedProduct;
                if (IFCImportFile.TheFile.EntityMap.TryGetValue(ifcProduct.StepId, out cachedProduct))
                {
                    return(cachedProduct as IFCProduct);
                }

                if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcProduct, IFCEntityType.IfcSpatialStructureElement))
                {
                    return(IFCSpatialStructureElement.ProcessIFCSpatialStructureElement(ifcProduct));
                }

                if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcProduct, IFCEntityType.IfcElement))
                {
                    return(IFCElement.ProcessIFCElement(ifcProduct));
                }

                if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcProduct, IFCEntityType.IfcGrid))
                {
                    return(IFCGrid.ProcessIFCGrid(ifcProduct));
                }

                if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcProduct, IFCEntityType.IfcProxy))
                {
                    return(IFCProxy.ProcessIFCProxy(ifcProduct));
                }

                if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcProduct, IFCEntityType.IfcDistributionPort))
                {
                    return(IFCDistributionPort.ProcessIFCDistributionPort(ifcProduct));
                }
            }
            catch (Exception ex)
            {
                HandleError(ex.Message, ifcProduct, true);
                return(null);
            }

            Importer.TheLog.LogUnhandledSubTypeError(ifcProduct, IFCEntityType.IfcProduct, false);
            return(null);
        }