Пример #1
0
        static public CylGridData ColorCodeData(Barrel barrel, DataOutputOptions options, CylGridData correctedRingList, COLORCODE colorOption)
        {
            try
            {
                var resultGrid = new CylGridData();
                foreach (var cylstrip in correctedRingList)
                {
                    var resultStrip = new CylData(correctedRingList[0].FileName);
                    foreach (PointCyl pt in cylstrip)
                    {
                        var c = System.Drawing.Color.LightGray;
                        switch (colorOption)
                        {
                        case COLORCODE.GREEN_RED:
                            c = MapGreenRedColor(barrel, pt);
                            break;

                        case COLORCODE.RAINBOW:
                            c = MapRainbowColor(barrel, pt);
                            break;
                        }
                        pt.Col = c;
                        resultStrip.Add(new PointCyl(pt.R, pt.ThetaRad, pt.Z, c, pt.ID));
                    }
                    resultGrid.Add(resultStrip);
                }
                return(resultGrid);
            }
            catch (Exception)
            {
                Debug.WriteLine(" exception in colorCodeData");
                throw;
            }
        }
Пример #2
0
 static public void SaveProfileFile(Barrel barrel, DataOutputOptions options,
                                    BarrelInspProfile barrelInspProfile, string fileName, IProgress <int> progress)
 {
     try
     {
         var headings   = BuildFileHeader(barrel, fileName);
         var filePoints = new List <string>();
         filePoints.AddRange(headings);
         filePoints.Add("Z(in),Min Land Diameter(in),Ave Land Diam(in), Ave Groove Diameter(in)");
         for (int i = 0; i < barrelInspProfile.AveGrooveProfile.Count; i++)
         {
             double aveGrooveDiam = 2.0 * barrelInspProfile.AveGrooveProfile[i].R;
             double minLandDiam   = 2.0 * barrelInspProfile.MinLandProfile[i].R;
             double aveLandDiam   = 2.0 * barrelInspProfile.AveLandProfile[i].R;
             double z             = barrelInspProfile.AveLandProfile[i].Z;
             string line          = string.Concat(z.ToString(), ",", minLandDiam.ToString(), ",", aveLandDiam.ToString(), ",",
                                                  aveGrooveDiam.ToString());
             filePoints.Add(line);
         }
         FileIOLib.FileIO.Save(filePoints, fileName);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public BarrelXsectionProfile(Barrel barrel, DataOutputOptions options, int currentPassCount, double axialLocation, string machineSpeedFileName)
        {
            _options       = options;
            _currentPassCt = currentPassCount;

            _barrel   = barrel;
            _axialLoc = axialLocation;

            _nominalLandDiam = _barrel.DimensionData.ActualLandDiam;


            _machineSpeedList = new MachineRasterSpeeds(machineSpeedFileName);

            BuildMeasurementSet();
        }
Пример #4
0
 /// <summary>
 /// build stl files from ring data
 /// </summary>
 /// <param name="correctedRingList"></param>
 /// <param name="flatFileName"></param>
 /// <param name="rolledFileName"></param>
 static void SaveRolledSTLFile(Barrel barrel, DataOutputOptions options, CylGridData correctedRingList, double unrollRadius, string fileName, IProgress <int> progress)
 {
     try
     {
         var v3rolledPtList = correctedRingList.AsCartGridData();
         var _flatStlFile   = new StlFile();
         var trimesh        = new TriMesh();
         trimesh.BuildFromGrid(v3rolledPtList);
         StlFile.SaveBinary(trimesh, fileName);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #5
0
        static void SaveFlatPlyFile(Barrel barrel, DataOutputOptions options, CylGridData correctedRingList, double unrollRadius, string fileName, IProgress <int> progress)
        {
            try
            {
                var outputFilename = BuildFileName(fileName, "_flat", ".ply");
                var colorCodedData = DataColorCode.ColorCodeData(barrel, options, correctedRingList, options.SurfaceColorCode);

                var v3FlatStripList = DataUtil.UnrollCylinder(colorCodedData, options.SurfaceFileScaleFactor, unrollRadius);
                SavePly(v3FlatStripList, outputFilename, progress);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #6
0
        static void SaveRolledPlyFile(Barrel barrel, DataOutputOptions options, CylGridData correctedRingList, string fileName, IProgress <int> progress)
        {
            try
            {
                var outputFilename = BuildFileName(fileName, "_rolled", ".ply");

                var colorCodedData = DataColorCode.ColorCodeData(barrel, options, correctedRingList, options.SurfaceColorCode);

                var v3StripList = colorCodedData.AsCartGridData();
                SavePly(v3StripList, outputFilename, progress);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #7
0
 static public void SavePlyFile(Barrel barrel, DataOutputOptions options, CylGridData correctedRingList, double unrollRadius, string fileName, IProgress <int> progress)
 {
     try
     {
         if (options.SaveSurfaceFlat)
         {
             SaveFlatPlyFile(barrel, options, correctedRingList, unrollRadius, fileName, progress);
         }
         else
         {
             SaveRolledPlyFile(barrel, options, correctedRingList, fileName, progress);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #8
0
        static void SaveFlatSTLFile(Barrel barrel, DataOutputOptions options, CylGridData correctedRingList, double unrollRadius, string fileName, IProgress <int> progress)
        {
            try
            {
                Debug.WriteLine("writing STL file " + fileName);
                var _flatStlFile = new StlFile();


                var v3flatptList = DataUtil.UnrollCylinder(correctedRingList, options.SurfaceFileScaleFactor, unrollRadius);
                var trimesh      = new TriMesh();
                trimesh.BuildFromGrid(v3flatptList);
                StlFile.SaveBinary(trimesh, fileName);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #9
0
        /// <summary>
        /// output csv file
        /// </summary>
        /// <param name="ring"></param>
        /// <param name="csvFileName"></param>
        static public void SaveCSVFile(Barrel barrel, DataOutputOptions options,
                                       CartData data, string fileName, IProgress <int> progress)
        {
            try
            {
                //var outputFilename = BuildFileName(fileName,"_out", ".csv");
                var headings = BuildFileHeader(barrel, fileName);

                var filePoints = new List <string>();
                filePoints.AddRange(headings);
                filePoints.Add("ID,X(in),Y(in),Z(in)");
                foreach (var pt in data)
                {
                    string line = string.Concat(pt.ID.ToString() + "," + pt.X.ToString(), ",", pt.Y.ToString(), ",", pt.Z.ToString());
                    filePoints.Add(line);
                }
                FileIOLib.FileIO.Save(filePoints, fileName);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #10
0
        /// <summary>
        /// output csv file from ring data
        /// </summary>
        /// <param name="correctedRingList"></param>
        /// <param name="csvFileName"></param>
        static public void SaveCSVFile(Barrel barrel, DataOutputOptions options, CylGridData correctedRingList, string fileName, IProgress <int> progress)
        {
            try
            {
                var headings = BuildFileHeader(fileName);

                var filePoints = new List <string>();
                filePoints.AddRange(headings);
                filePoints.Add("ID,Theta(Radians),R(in),Z(in)");
                foreach (var ring in correctedRingList)
                {
                    foreach (var pt in ring)
                    {
                        string line = string.Concat(pt.ID.ToString() + "," + pt.ThetaRad.ToString(), ",", pt.R.ToString(), ",", pt.Z.ToString());
                        filePoints.Add(line);
                    }
                }
                FileIOLib.FileIO.Save(filePoints, fileName);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #11
0
        public static InspDataSet BuildDataAsync(CancellationToken ct, IProgress <int> progress, RasterInspScript script, double[] rawDataSet, DataOutputOptions options)
        {
            try
            {
                var sw = new Stopwatch();
                progress.Report(sw.Elapsed.Seconds);

                var dataSet = BuildRasterPoints(script, rawDataSet);

                return(dataSet);
            }
            catch (Exception)
            {
                throw;
            }
        }