コード例 #1
0
ファイル: IFCOpeningElement.cs プロジェクト: whztt07/RevitIFC
        /// <summary>
        /// Processes IfcOpeningElement attributes.
        /// </summary>
        /// <param name="ifcOpeningElement">The IfcOpeningElement handle.</param>
        protected override void Process(IFCAnyHandle ifcOpeningElement)
        {
            base.Process(ifcOpeningElement);

            ICollection <IFCAnyHandle> hasFillings = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcOpeningElement, "HasFillings");

            if (hasFillings != null)
            {
                // Assume that there is only one filling for the opening, and take first found.
                foreach (IFCAnyHandle hasFilling in hasFillings)
                {
                    IFCAnyHandle relatedFillingElement = IFCAnyHandleUtil.GetInstanceAttribute(hasFilling, "RelatedBuildingElement");
                    if (IFCAnyHandleUtil.IsNullOrHasNoValue(relatedFillingElement))
                    {
                        continue;
                    }

                    IFCEntity filledByElement;
                    IFCImportFile.TheFile.EntityMap.TryGetValue(relatedFillingElement.StepId, out filledByElement);
                    if (filledByElement == null)
                    {
                        FilledByElement = IFCElement.ProcessIFCElement(relatedFillingElement);
                    }
                    else
                    {
                        FilledByElement = filledByElement as IFCElement;
                    }
                    FilledByElement.FillsOpening = this;
                    break;
                }
            }
        }
コード例 #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);
        }