Esempio n. 1
0
        override protected void Process(IFCAnyHandle ifcFace)
        {
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcFace, IFCEntityType.IfcFaceSurface))
            {
                // Only allow IfcFaceSurface is the surface is a plane.
                IFCAnyHandle faceSurface = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcFace, "FaceSurface", false);
                if (!IFCAnyHandleUtil.IsNullOrHasNoValue(faceSurface))
                {
                    IFCSurface surface = IFCSurface.ProcessIFCSurface(faceSurface);
                    if (!(surface is IFCPlane))
                    {
                        IFCImportFile.TheLog.LogError(ifcFace.StepId,
                                                      "cannot handle IfcFaceSurface with FaceSurface of type " + IFCAnyHandleUtil.GetEntityType(faceSurface).ToString(), true);
                    }
                }
            }

            base.Process(ifcFace);

            HashSet <IFCAnyHandle> ifcBounds =
                IFCAnyHandleUtil.GetAggregateInstanceAttribute <HashSet <IFCAnyHandle> >(ifcFace, "Bounds");

            if (ifcBounds == null || ifcBounds.Count == 0)
            {
                throw new InvalidOperationException("#" + ifcFace.StepId + ": no face boundaries, aborting.");
            }

            foreach (IFCAnyHandle ifcBound in ifcBounds)
            {
                try
                {
                    Bounds.Add(IFCFaceBound.ProcessIFCFaceBound(ifcBound));
                }
                catch
                {
                    // LOG: WARNING: #: Invalid face boundary ifcBound.StepId, ignoring.
                }
            }

            if (Bounds.Count == 0)
            {
                throw new InvalidOperationException("#" + ifcFace.StepId + ": no face boundaries, aborting.");
            }

            // Give warning if too many outer bounds.  We won't care how they are designated, regardless.
            bool hasOuter = false;

            foreach (IFCFaceBound faceBound in Bounds)
            {
                if (faceBound.IsOuter)
                {
                    if (hasOuter)
                    {
                        // LOG: WARNING: #: Too many outer boundary loops for IfcFace.
                        break;
                    }
                    hasOuter = true;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Create an IFCFaceBound object from a handle of type IfcFaceBound.
        /// </summary>
        /// <param name="ifcFaceBound">The IFC handle.</param>
        /// <returns>The IFCFaceBound object.</returns>
        public static IFCFaceBound ProcessIFCFaceBound(IFCAnyHandle ifcFaceBound)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcFaceBound))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcFaceBound);
                return(null);
            }

            IFCEntity faceBound;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcFaceBound.StepId, out faceBound))
            {
                faceBound = new IFCFaceBound(ifcFaceBound);
            }
            return(faceBound as IFCFaceBound);
        }
Esempio n. 3
0
        override protected void Process(IFCAnyHandle ifcFace)
        {
            base.Process(ifcFace);

            HashSet <IFCAnyHandle> ifcBounds =
                IFCAnyHandleUtil.GetAggregateInstanceAttribute <HashSet <IFCAnyHandle> >(ifcFace, "Bounds");

            if (ifcBounds == null || ifcBounds.Count == 0)
            {
                throw new InvalidOperationException("#" + ifcFace.StepId + ": no face boundaries, aborting.");
            }

            foreach (IFCAnyHandle ifcBound in ifcBounds)
            {
                try
                {
                    Bounds.Add(IFCFaceBound.ProcessIFCFaceBound(ifcBound));
                }
                catch
                {
                    Importer.TheLog.LogWarning(ifcFace.StepId, "Invalid face boundary, ignoring", false);
                }
            }

            if (Bounds.Count == 0)
            {
                throw new InvalidOperationException("#" + ifcFace.StepId + ": no face boundaries, aborting.");
            }

            // Give warning if too many outer bounds.  We won't care how they are designated, regardless.
            bool hasOuter = false;

            foreach (IFCFaceBound faceBound in Bounds)
            {
                if (faceBound.IsOuter)
                {
                    if (hasOuter)
                    {
                        Importer.TheLog.LogWarning(ifcFace.StepId, "Too many outer boundary loops for IfcFace.", false);
                        break;
                    }
                    hasOuter = true;
                }
            }
        }
        /// <summary>
        /// Create an IFCFaceBound object from a handle of type IfcFaceBound.
        /// </summary>
        /// <param name="ifcFaceBound">The IFC handle.</param>
        /// <returns>The IFCFaceBound object.</returns>
        public static IFCFaceBound ProcessIFCFaceBound(IFCAnyHandle ifcFaceBound)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcFaceBound))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcFaceBound);
                return null;
            }

            IFCEntity faceBound;
            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcFaceBound.StepId, out faceBound))
                faceBound = new IFCFaceBound(ifcFaceBound);
            return (faceBound as IFCFaceBound);
        }