コード例 #1
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);
            }
        }
コード例 #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);
            }

            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);
        }