Пример #1
0
        protected override void Process(IFCAnyHandle ifcCurve)
        {
            base.Process(ifcCurve);

            bool   found  = false;
            double radius = IFCImportHandleUtil.GetRequiredScaledLengthAttribute(ifcCurve, "Radius", out found);

            if (!found)
            {
                Importer.TheLog.LogError(ifcCurve.StepId, "Cannot find the radius of this circle", false);
                return;
            }

            if (!IFCGeometryUtil.IsValidRadius(radius))
            {
                Importer.TheLog.LogError(ifcCurve.StepId, "Invalid radius for this circle: " + radius, false);
                return;
            }

            try
            {
                SetCurve(Arc.Create(Position.Origin, radius, 0, 2.0 * Math.PI, Position.BasisX, Position.BasisY));
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("too small"))
                {
                    string lengthAsString = IFCUnitUtil.FormatLengthAsString(radius);
                    Importer.TheLog.LogError(Id, "Found a circle with radius of " + lengthAsString + ", ignoring.", false);
                }
                else
                {
                    Importer.TheLog.LogError(Id, ex.Message, false);
                }
                SetCurve(null);
            }
        }