/// <summary>
        /// Processes IfcSpatialStructureElement handle.
        /// </summary>
        /// <param name="ifcSpatialStructureElement">The IfcSpatialStructureElement handle.</param>
        /// <returns>The IFCSpatialStructureElement object.</returns>
        public static IFCSpatialStructureElement ProcessIFCSpatialStructureElement(IFCAnyHandle ifcSpatialStructureElement)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcSpatialStructureElement))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcSpatialStructureElement);
                return(null);
            }

            IFCEntity spatialStructureElement;

            if (IFCImportFile.TheFile.EntityMap.TryGetValue(ifcSpatialStructureElement.StepId, out spatialStructureElement))
            {
                return(spatialStructureElement as IFCSpatialStructureElement);
            }

            if (IFCAnyHandleUtil.IsSubTypeOf(ifcSpatialStructureElement, IFCEntityType.IfcSpace))
            {
                return(IFCSpace.ProcessIFCSpace(ifcSpatialStructureElement));
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcSpatialStructureElement, IFCEntityType.IfcBuildingStorey))
            {
                return(IFCBuildingStorey.ProcessIFCBuildingStorey(ifcSpatialStructureElement));
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcSpatialStructureElement, IFCEntityType.IfcSite))
            {
                return(IFCSite.ProcessIFCSite(ifcSpatialStructureElement));
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcSpatialStructureElement, IFCEntityType.IfcBuilding))
            {
                return(IFCBuilding.ProcessIFCBuilding(ifcSpatialStructureElement));
            }

            return(new IFCSpatialStructureElement(ifcSpatialStructureElement));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Processes an IfcBuildingStorey object.
        /// </summary>
        /// <param name="ifcBuildingStorey">The IfcBuildingStorey handle.</param>
        /// <returns>The IFCBuildingStorey object.</returns>
        public static IFCBuildingStorey ProcessIFCBuildingStorey(IFCAnyHandle ifcBuildingStorey)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcBuildingStorey))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcBuildingStorey);
                return(null);
            }

            IFCEntity buildingStorey;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcBuildingStorey.StepId, out buildingStorey))
            {
                buildingStorey = new IFCBuildingStorey(ifcBuildingStorey);
            }
            return(buildingStorey as IFCBuildingStorey);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates or populates Revit elements based on the information contained in this class.
        /// </summary>
        /// <param name="doc">The document.</param>
        protected override void Create(Document doc)
        {
            // We may re-use the ActiveView Level and View, since we can't delete them.
            // We will consider that we "created" this level and view for creation metrics.
            Level level = Importer.TheCache.UseElementByGUID <Level>(doc, GlobalId);

            bool reusedLevel = false;
            bool foundLevel  = false;

            if (level == null)
            {
                if (ExistingLevelIdToReuse != ElementId.InvalidElementId)
                {
                    level = doc.GetElement(ExistingLevelIdToReuse) as Level;
                    Importer.TheCache.UseElement(level);
                    ExistingLevelIdToReuse = ElementId.InvalidElementId;
                    reusedLevel            = true;
                }
            }
            else
            {
                foundLevel = true;
            }

            if (level == null)
            {
                level = Level.Create(doc, m_Elevation);
            }
            else
            {
                level.Elevation = m_Elevation;
            }

            if (level != null)
            {
                CreatedElementId = level.Id;
            }

            if (CreatedElementId != ElementId.InvalidElementId)
            {
                if (!foundLevel)
                {
                    if (!reusedLevel)
                    {
                        ElementId viewPlanTypeId = IFCBuildingStorey.GetViewPlanTypeId(doc);
                        if (viewPlanTypeId != ElementId.InvalidElementId)
                        {
                            ViewPlan viewPlan = ViewPlan.Create(doc, viewPlanTypeId, CreatedElementId);
                            if (viewPlan != null)
                            {
                                CreatedViewId = viewPlan.Id;
                            }
                        }

                        if (CreatedViewId == ElementId.InvalidElementId)
                        {
                            Importer.TheLog.LogAssociatedCreationError(this, typeof(ViewPlan));
                        }
                    }
                    else
                    {
                        if (doc.ActiveView != null)
                        {
                            CreatedViewId = doc.ActiveView.Id;
                        }
                    }
                }
            }
            else
            {
                Importer.TheLog.LogCreationError(this, null, false);
            }

            TraverseSubElements(doc);
        }
        /// <summary>
        /// Processes an IfcBuildingStorey object.
        /// </summary>
        /// <param name="ifcBuildingStorey">The IfcBuildingStorey handle.</param>
        /// <returns>The IFCBuildingStorey object.</returns>
        public static IFCBuildingStorey ProcessIFCBuildingStorey(IFCAnyHandle ifcBuildingStorey)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcBuildingStorey))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcBuildingStorey);
                return null;
            }

            IFCEntity buildingStorey;
            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcBuildingStorey.StepId, out buildingStorey))
                buildingStorey = new IFCBuildingStorey(ifcBuildingStorey);
            return (buildingStorey as IFCBuildingStorey);
        }