コード例 #1
0
 public ToleranceEntry()
 {
     this.geometricSymbol = ToleranceGeometricSymbol.None;
     this.tolerance1      = null;
     this.tolerance2      = null;
     this.datum1          = null;
     this.datum2          = null;
     this.datum3          = null;
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <c>ToleranceEntry</c> class.
 /// </summary>
 public ToleranceEntry()
 {
     this.geometricSymbol = ToleranceGeometricSymbol.None;
     this.tolerance1 = null;
     this.tolerance2 = null;
     this.datum1 = null;
     this.datum2 = null;
     this.datum3 = null;
 }
コード例 #3
0
ファイル: Tolerance.cs プロジェクト: tcz1237/MissionPlanner
        private static ToleranceEntry ParseToleranceEntry(string line)
        {
            string[] values = Regex.Split(line, "%%v");

            ToleranceGeometricSymbol geom = ToleranceGeometricSymbol.None;
            ToleranceValue           t1   = null;
            ToleranceValue           t2   = null;
            DatumReferenceValue      d1   = null;
            DatumReferenceValue      d2   = null;
            DatumReferenceValue      d3   = null;

            if (!string.IsNullOrEmpty(values[0]))
            {
                if (values[0].StartsWith("{"))
                {
                    // geometric symbol
                    CharEnumerator chars  = values[0].GetEnumerator();
                    char           symbol = Symbol(chars);
                    geom = ParseGeometricSymbol(symbol);
                }
            }

            for (int i = 1; i < values.Length; i++)
            {
                string value = values[i];

                switch (i)
                {
                case 1:
                    t1 = ParseToleranceValue(value);
                    break;

                case 2:
                    t2 = ParseToleranceValue(value);
                    break;

                case 3:
                    d1 = ParseDatumReferenceValue(value);
                    break;

                case 4:
                    d2 = ParseDatumReferenceValue(value);
                    break;

                case 5:
                    d3 = ParseDatumReferenceValue(value);
                    break;

                default:
                    throw new FormatException("The tolerance string representation is not well formatted");
                }
            }

            ToleranceEntry t = new ToleranceEntry
            {
                GeometricSymbol = geom,
                Tolerance1      = t1,
                Tolerance2      = t2,
                Datum1          = d1,
                Datum2          = d2,
                Datum3          = d3
            };

            return(t);
        }