예제 #1
0
        internal override int ReadParameters(List <string> parameters, IgesReaderBinder binder)
        {
            int index = 0;
            var k     = Integer(parameters, index++); // upper index of sum
            var m     = Integer(parameters, index++); // degree of basis functions

            IsPlanar     = Boolean(parameters, index++);
            IsClosed     = Boolean(parameters, index++);
            IsPolynomial = Boolean(parameters, index++);
            IsPeriodic   = Boolean(parameters, index++);
            var n = 1 + k - m;
            var a = n + 2 * m;

            for (int i = 0; i < a + 1; i++)
            {
                KnotValues.Add(Double(parameters, index++));
            }

            for (int i = 0; i < k + 1; i++)
            {
                Weights.Add(Double(parameters, index++));
            }

            for (int i = 0; i < k + 1; i++)
            {
                var x = Double(parameters, index++);
                var y = Double(parameters, index++);
                var z = Double(parameters, index++);
                ControlPoints.Add(new IgesPoint(x, y, z));
            }

            StartParameter = Double(parameters, index++);
            EndParameter   = Double(parameters, index++);
            Normal         = IsPlanar
                ? new IgesVector(Double(parameters, index++), Double(parameters, index++), Double(parameters, index++))
                : IgesVector.ZAxis;

            return(index);
        }
예제 #2
0
파일: DXFSpline.cs 프로젝트: jem-green/DXF
        public override void ParseGroupCode(int groupcode, string value)
        {
            base.ParseGroupCode(groupcode, value);
            switch (groupcode)
            {
            case 210:
                Normal.X = double.Parse(value);
                break;

            case 220:
                Normal.Y = double.Parse(value);
                break;

            case 230:
                Normal.Z = double.Parse(value);
                break;

            case 70:
                Flags = (FlagsEnum)Enum.Parse(typeof(FlagsEnum), value);
                break;

            case 71:
                Degree = int.Parse(value);
                break;

            case 72:
                KnotCount = int.Parse(value);
                break;

            case 73:
                ControlPointCount = int.Parse(value);
                break;

            case 74:
                FitPointCount = int.Parse(value);
                break;

            case 42:
                KnotTolerance = double.Parse(value);
                break;

            case 43:
                ControlPointTolerance = double.Parse(value);
                break;

            case 44:
                FitPointTolerance = double.Parse(value);
                break;

            case 12:
                StartTangent.X = double.Parse(value);
                break;

            case 22:
                StartTangent.Y = double.Parse(value);
                break;

            case 32:
                StartTangent.Z = double.Parse(value);
                break;

            case 13:
                EndTangent.X = double.Parse(value);
                break;

            case 23:
                EndTangent.Y = double.Parse(value);
                break;

            case 33:
                EndTangent.Z = double.Parse(value);
                break;

            case 40:
                KnotValues.Add(double.Parse(value));
                break;

            case 41:
                Weight = double.Parse(value);
                break;

            case 10:
                if (LastControlPoint == null || LastControlPoint.X != null)
                {
                    LastControlPoint = new DXFPoint();
                }
                LastControlPoint.X = double.Parse(value);
                break;

            case 20:
                if (LastControlPoint == null || LastControlPoint.Y != null)
                {
                    LastControlPoint = new DXFPoint();
                }
                LastControlPoint.Y = double.Parse(value);
                break;

            case 30:
                if (LastControlPoint == null || LastControlPoint.Z != null)
                {
                    LastControlPoint = new DXFPoint();
                }
                LastControlPoint.Z = double.Parse(value);
                break;

            case 11:
                if (LastFitPoint == null || LastFitPoint.X != null)
                {
                    LastFitPoint = new DXFPoint();
                }
                LastFitPoint.X = double.Parse(value);
                break;

            case 21:
                if (LastFitPoint == null || LastFitPoint.Y != null)
                {
                    LastFitPoint = new DXFPoint();
                }
                LastFitPoint.Y = double.Parse(value);
                break;

            case 31:
                if (LastFitPoint == null || LastFitPoint.Z != null)
                {
                    LastFitPoint = new DXFPoint();
                }
                LastFitPoint.Z = double.Parse(value);
                break;
            }
        }