/// <summary>
        /// Finds contained elements.
        /// </summary>
        /// <param name="ifcRelHandle">The relation handle.</param>
        void ProcessIFCRelContainedInSpatialStructure(IFCAnyHandle ifcRelHandle)
        {
            HashSet <IFCAnyHandle> elemSet = IFCAnyHandleUtil.GetAggregateInstanceAttribute <HashSet <IFCAnyHandle> >(ifcRelHandle, "RelatedElements");

            if (elemSet == null)
            {
                Importer.TheLog.LogMissingRequiredAttributeError(ifcRelHandle, "RelatedElements", false);
                return;
            }

            foreach (IFCAnyHandle elem in elemSet)
            {
                try
                {
                    IFCProduct product = IFCProduct.ProcessIFCProduct(elem);
                    if (product != null)
                    {
                        product.ContainingStructure = this;
                        m_IFCProducts.Add(product);
                    }
                }
                catch (Exception ex)
                {
                    Importer.TheLog.LogError(elem.StepId, ex.Message, false);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Processes IfcObject handle.
        /// </summary>
        /// <param name="ifcObject">The IfcObject handle.</param>
        /// <returns>The IfcObject object.</returns>
        public static IFCObject ProcessIFCObject(IFCAnyHandle ifcObject)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcObject))
            {
                IFCImportFile.TheLog.LogNullError(IFCEntityType.IfcObject);
                return(null);
            }

            IFCEntity cachedObject;

            if (IFCImportFile.TheFile.EntityMap.TryGetValue(ifcObject.StepId, out cachedObject))
            {
                return(cachedObject as IFCObject);
            }

            if (IFCAnyHandleUtil.IsSubTypeOf(ifcObject, IFCEntityType.IfcProduct))
            {
                return(IFCProduct.ProcessIFCProduct(ifcObject));
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcObject, IFCEntityType.IfcProject))
            {
                return(IFCProject.ProcessIFCProject(ifcObject));
            }

            IFCImportFile.TheLog.LogUnhandledSubTypeError(ifcObject, IFCEntityType.IfcObject, true);
            return(null);
        }