Exemple #1
0
        private IFCCurve ProcessIFCCompositeCurveSegment(IFCAnyHandle ifcCurveSegment)
        {
            bool found = false;

            bool sameSense = IFCImportHandleUtil.GetRequiredBooleanAttribute(ifcCurveSegment, "SameSense", out found);

            if (!found)
            {
                sameSense = true;
            }

            IFCAnyHandle ifcParentCurve = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcCurveSegment, "ParentCurve", true);
            IFCCurve     parentCurve    = null;

            using (TemporaryVerboseLogging logger = new TemporaryVerboseLogging())
            {
                parentCurve = IFCCurve.ProcessIFCCurve(ifcParentCurve);
            }

            if (parentCurve == null)
            {
                Importer.TheLog.LogWarning(ifcCurveSegment.StepId, "Error processing ParentCurve (#" + ifcParentCurve.StepId + ") for IfcCompositeCurveSegment; this may be repairable.", false);
                return(null);
            }

            if (parentCurve.IsEmpty())
            {
                Importer.TheLog.LogWarning(ifcCurveSegment.StepId, "Error processing ParentCurve (#" + ifcParentCurve.StepId + ") for IfcCompositeCurveSegment; this may be repairable.", false);
                return(null);
            }

            return(parentCurve);
        }
        private IList <Curve> ProcessIFCCompositeCurveSegment(IFCAnyHandle ifcCurveSegment)
        {
            bool found = false;

            bool sameSense = IFCImportHandleUtil.GetRequiredBooleanAttribute(ifcCurveSegment, "SameSense", out found);

            if (!found)
            {
                sameSense = true;
            }

            IFCAnyHandle ifcParentCurve = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcCurveSegment, "ParentCurve", true);
            IFCCurve     parentCurve    = null;

            using (TemporaryVerboseLogging logger = new TemporaryVerboseLogging())
            {
                parentCurve = IFCCurve.ProcessIFCCurve(ifcParentCurve);
            }

            if (parentCurve == null)
            {
                Importer.TheLog.LogWarning(ifcCurveSegment.StepId, "Error processing ParentCurve (#" + ifcParentCurve.StepId + ") for IfcCompositeCurveSegment; this may be repairable.", false);
                return(null);
            }

            bool hasCurve     = (parentCurve.Curve != null);
            bool hasCurveLoop = (parentCurve.CurveLoop != null);

            if (!hasCurve && !hasCurveLoop)
            {
                Importer.TheLog.LogWarning(ifcCurveSegment.StepId, "Error processing ParentCurve (#" + ifcParentCurve.StepId + ") for IfcCompositeCurveSegment; this may be repairable.", false);
                return(null);
            }

            IList <Curve> curveSegments = new List <Curve>();

            if (hasCurve)
            {
                curveSegments.Add(parentCurve.Curve);
            }
            else if (hasCurveLoop)
            {
                foreach (Curve subCurve in parentCurve.CurveLoop)
                {
                    curveSegments.Add(subCurve);
                }
            }

            return(curveSegments);
        }
      private IList<Curve> ProcessIFCCompositeCurveSegment(IFCAnyHandle ifcCurveSegment)
      {
         bool found = false;

         bool sameSense = IFCImportHandleUtil.GetRequiredBooleanAttribute(ifcCurveSegment, "SameSense", out found);
         if (!found)
            sameSense = true;

         IFCAnyHandle ifcParentCurve = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcCurveSegment, "ParentCurve", true);
         IFCCurve parentCurve = null;

         using (TemporaryVerboseLogging logger = new TemporaryVerboseLogging())
         {
            parentCurve = IFCCurve.ProcessIFCCurve(ifcParentCurve);
         }

         if (parentCurve == null)
         {
            Importer.TheLog.LogWarning(ifcCurveSegment.StepId, "Error processing ParentCurve (#" + ifcParentCurve.StepId + ") for IfcCompositeCurveSegment; this may be repairable.", false);
            return null;
         }

         bool hasCurve = (parentCurve.Curve != null);
         bool hasCurveLoop = (parentCurve.CurveLoop != null);
         if (!hasCurve && !hasCurveLoop)
         {
            Importer.TheLog.LogWarning(ifcCurveSegment.StepId, "Error processing ParentCurve (#" + ifcParentCurve.StepId + ") for IfcCompositeCurveSegment; this may be repairable.", false);
            return null;
         }

         IList<Curve> curveSegments = new List<Curve>();
         if (hasCurve)
         {
            curveSegments.Add(parentCurve.Curve);
         }
         else if (hasCurveLoop)
         {
            foreach (Curve subCurve in parentCurve.CurveLoop)
            {
               curveSegments.Add(subCurve);
            }
         }

         return curveSegments;
      }