Example #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;
                }
            }
        }
Example #2
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;
                }
            }
        }