public void ModelPathBuilder_NCfileToolpathIsGood_ReturnsModelPath() { string inputFile = "STRAIGHT-TEST-8-3-15.nc"; double increment = .01; ToolPath5Axis toolpath = CNCFileParser.CreatePath(inputFile); Assert.AreEqual(1, toolpath[1].Position.X, "Xtp0"); Assert.AreEqual(1, toolpath[1].Position.Y, "Xtp0"); Assert.AreEqual(2, toolpath[1].Position.Z, "Xtp0"); ConstantDistancePathBuilder mpb = new ConstantDistancePathBuilder(); ModelPath mp = mpb.Build(toolpath, increment); int i = 0; while (!mp[i].JetOn) { i++; } Assert.AreEqual(1, mp[i].Position.X, "Xentity0"); Assert.AreEqual(1, mp[i].Position.Y, "Yentity0"); Assert.AreEqual(0, mp[i].Position.Z, "Zentity0"); Assert.AreEqual(1.0089, Math.Round(mp[i + 1].Position.X, 4), "Xentity1"); Assert.AreEqual(1.0045, Math.Round(mp[i + 1].Position.Y, 4), "Yentity1"); Assert.AreEqual(0, Math.Round(mp[i + 1].Position.Z, 4), "Zentity1"); Assert.AreEqual(10, mp[i + 1].Feedrate.Value, "Fentity1"); Assert.IsFalse(mp[0].JetOn, "Jentity0"); }
public void CNCFileParser_ParseNCIFile_toolpathhasCorrectValues() { string inputFile = "SPLINE-CHANNEL-CONTOURPATH.NCI"; var cncfp = new CNCFileParser(); IToolpath toolpath = cncfp.CreatePath(inputFile); Assert.AreEqual(-3.876529, toolpath[0].Position.X, "Xentity0"); Assert.AreEqual(0.05, toolpath[0].Position.Y, "Yentity0"); Assert.AreEqual(3.307008, toolpath[0].Position.Z, "Zentity0"); Assert.AreEqual(-2, toolpath[0].Feedrate.Value, "Fentity0"); Assert.IsFalse(toolpath[0].JetOn, "Jentity0"); Assert.AreEqual(-3.876529, toolpath[1].Position.X, "Xentity1"); Assert.AreEqual(0.05, toolpath[1].Position.Y, "Yentity1"); Assert.AreEqual(1.407008, toolpath[1].Position.Z, "Zentity1"); Assert.AreEqual(-2, toolpath[1].Feedrate.Value, "Fentity1"); Assert.IsFalse(toolpath[1].JetOn, "Jentity1"); Assert.AreEqual(BlockType.RAPID, toolpath[1].Type, "type 1"); Assert.AreEqual(-3.565848, toolpath[3].Position.X, "Xentity3"); Assert.AreEqual(0.05, toolpath[3].Position.Y, "Yentity3"); Assert.AreEqual(1.357217, toolpath[3].Position.Z, "Zentity3"); Assert.AreEqual(10, toolpath[3].Feedrate.Value, "Fentity3"); Assert.IsTrue(toolpath[3].JetOn, "Jentity3"); Assert.AreEqual(BlockType.LINEAR, toolpath[3].Type, "type 3"); }
public void CNCFileParser_ParseNCIFile_pathNotNull() { string inputFile = "SPLINE-CHANNEL-CONTOURPATH.NCI"; var cncfp = new CNCFileParser(); IToolpath toolpath = cncfp.CreatePath(inputFile); Assert.IsNotNull(toolpath); }
public void CNCFileParser_ParseNCFile_PathNotNull() { string inputFile = "2-CELL-TEST.2.nc"; var cncfp = new CNCFileParser(); IToolpath toolpath = cncfp.CreatePath(inputFile); Assert.IsNotNull(toolpath); }
public void CNCFileParser_filenameIsNull_toolpathIsZerolength() { string inputFile = null; ToolPath5Axis toolpath = CNCFileParser.CreatePath(inputFile); Assert.AreEqual(0, toolpath.Count); }
public void CNCparser_toolpathIsEmpty_ToolPathIsNotNull() { string inputPath = ""; ToolPath5Axis toolpath = CNCFileParser.CreatePath(inputPath); Assert.IsNotNull(toolpath); }
public void CNCFileParser_ParseNCIFile_toolpathIsNotZerolength() { string inputFile = "SPLINE-CHANNEL-CONTOURPATH.NCI"; var cncfp = new CNCFileParser(); IToolpath toolpath = cncfp.CreatePath(inputFile); int count = toolpath.Count; Assert.IsFalse(count == 0); }
public void abmSurfBuilder_buildFromPath_returnSurfOK() { string inputFile = "STRAIGHT-TEST-8-3-15.nc"; double increment = .01; ToolPath toolpath = CNCFileParser.ToPath(inputFile); ConstantDistancePathBuilder mpb = new ConstantDistancePathBuilder(); ModelPath mp = mpb.Build(toolpath, increment); }
public void toolpath_const_pathisOK() { string inputFile = "STRAIGHT-TEST-8-3-15.nc"; ToolPath5Axis tp = CNCFileParser.CreatePath(inputFile); Assert.AreEqual(1.0, tp[0].Position.X); Assert.AreEqual(1.0, tp[0].Position.Y); Assert.AreEqual(2.0, tp[0].Position.Z); }
public void CNCFileParser_fileIsGood_toolpathIsNotZerolength() { string inputFile = "2-CELL-TEST.2.nc"; var cncfp = new CNCFileParser(); IToolpath toolpath = cncfp.CreatePath(inputFile); int count = toolpath.Count; Assert.AreNotEqual(0, toolpath.Count); }
public void ModelPathBuilder_PathIsGoodButIncrementIsZero_ReturnsEmptyPath() { string inputPath = "SPLINE-CHANNEL-CONTOURPATH.NCI"; ToolPath5Axis toolpath = CNCFileParser.CreatePath(inputPath); double increment = 0; ConstantDistancePathBuilder mpb = new ConstantDistancePathBuilder(); ModelPath mp = mpb.Build(toolpath, increment); }
public void ModelPathBuilder_toolpathIsEmptyAndIncrementIsZero_ReturnsEmptyPath() { string inputPath = null; ToolPath5Axis toolpath = CNCFileParser.CreatePath(inputPath); double increment = 0; ConstantDistancePathBuilder mpb = new ConstantDistancePathBuilder(); ModelPath mp = mpb.Build(toolpath, increment); }
public void Toolpath_const_pathisOK() { string inputFile = "STRAIGHT-TEST-8-3-15.nc"; var cncfp = new CNCFileParser(); IToolpath tp = cncfp.CreatePath(inputFile); Assert.AreEqual(1.0, tp[0].Position.X); Assert.AreEqual(1.0, tp[0].Position.Y); Assert.AreEqual(2.0, tp[0].Position.Z); }
void initPath() { string inputFile = "STRAIGHT-TEST-8-3-15.nc"; ToolPath toolpath = CNCFileParser.ToPath(inputFile); var mpb = new ConstantDistancePathBuilder(); path = mpb.Build(toolpath, meshSize); }
public void CNCFileParser_ParseNCFile_toolpathhasCorrectValues() { string inputFile = "SPLINE-CHANNEL-CONTOURPATH.NC"; var cncfp = new CNCFileParser(); IToolpath toolpath = cncfp.CreatePath(inputFile); int last = toolpath.Count - 1; string position; Assert.AreEqual(0, toolpath[0].Position.X, "x entity0"); Assert.AreEqual(0.0, toolpath[0].Position.Y, "y entity0"); Assert.AreEqual(3.307, toolpath[0].Position.Z, "z entity0"); Assert.AreEqual(0, toolpath[0].Feedrate.Value, "f entity0"); Assert.IsFalse(toolpath[0].JetOn, "j entity0"); position = "1"; Assert.AreEqual(-3.8765, toolpath[1].Position.X, "x entity1"); Assert.AreEqual(0.05, toolpath[1].Position.Y, "y entity1"); Assert.AreEqual(3.307, toolpath[1].Position.Z, "z entity1"); Assert.AreEqual(0, toolpath[1].Feedrate.Value, "f entity1"); Assert.IsFalse(toolpath[1].JetOn, "entity1"); Assert.AreEqual(BlockType.RAPID, toolpath[1].Type, "type 1"); position = "2"; Assert.AreEqual(-3.8765, toolpath[2].Position.X, "X entity 2"); Assert.AreEqual(0.05, toolpath[2].Position.Y, "Y entity 2"); Assert.AreEqual(1.407, toolpath[2].Position.Z, "Z entity2"); Assert.AreEqual(0, toolpath[2].Feedrate.Value, "F entity2"); Assert.IsFalse(toolpath[2].JetOn, "J entity3"); Assert.AreEqual(BlockType.RAPID, toolpath[2].Type, "type 2"); position = " 6"; Assert.AreEqual(-3.5658, toolpath[6].Position.X, "X entity" + position); Assert.AreEqual(0.051, toolpath[6].Position.Y, "Y entity" + position); Assert.AreEqual(1.3572, toolpath[6].Position.Z, "Z entity" + position); Assert.AreEqual(10, toolpath[6].Feedrate.Value, "F entity" + position); Assert.IsTrue(toolpath[6].JetOn, "J entity" + position); Assert.AreEqual(BlockType.LINEAR, toolpath[6].Type, "type " + position); position = "last-1"; Assert.AreEqual(4.6218, toolpath[last - 1].Position.X, "X entity" + position); Assert.AreEqual(0.05, toolpath[last - 1].Position.Y, "Y entity" + position); Assert.AreEqual(1.0623, toolpath[last - 1].Position.Z, "Z entity" + position); Assert.AreEqual(10, toolpath[last - 1].Feedrate.Value, "F entity " + position); Assert.IsFalse(toolpath[last - 1].JetOn, "J entity" + position); Assert.AreEqual(BlockType.DELAY, toolpath[last - 1].Type, "type " + position); position = "last"; Assert.AreEqual(4.6218, toolpath[last].Position.X, "X entity" + position); Assert.AreEqual(0.05, toolpath[last].Position.Y, "Y entity" + position); Assert.AreEqual(3.307, toolpath[last].Position.Z, "Z entity" + position); Assert.AreEqual(0, toolpath[last].Feedrate.Value, "F entity " + position); Assert.IsFalse(toolpath[last].JetOn, "J entity" + position); Assert.AreEqual(BlockType.RAPID, toolpath[last].Type, "type " + position); }
public void modelpathbuilder_buildpath_isfiveAxisTrue() { string inputFile = "2-CELL-TEST.2.nc"; double increment = .01; ToolPath5Axis toolpath = CNCFileParser.CreatePath(inputFile); ConstantDistancePathBuilder mpb = new ConstantDistancePathBuilder(); ModelPath mp = mpb.Build(toolpath, increment); Assert.IsTrue(mp.IsFiveAxis); }
public void ModelPathBuilder_toolpathIsNull_modelpathIsEmpty() { string inputPath = null; ToolPath5Axis toolpath = CNCFileParser.CreatePath(inputPath); double increment = .005; ConstantDistancePathBuilder mpb = new ConstantDistancePathBuilder(); ModelPath mp = mpb.Build(toolpath, increment); Assert.AreEqual(0, toolpath.Count); }
public void ModelPathBuilder_toolpathIsEmpty_modelPathIsNotNull() { string inputPath = ""; ToolPath5Axis toolpath = CNCFileParser.CreatePath(inputPath); double increment = .005; ConstantDistancePathBuilder mpb = new ConstantDistancePathBuilder(); ModelPath mp = mpb.Build(toolpath, increment); Assert.IsNotNull(mp); }
private void buttonOpenNciFile_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "nci files (*.nci)|*.nci"; if (openFileDialog.ShowDialog() == DialogResult.OK) { nciFilename = openFileDialog.FileName; labelNciFilename.Text = nciFilename; nciFile = FileIO.ReadDataTextFile(nciFilename); toolpath = CNCFileParser.CreatePath(nciFilename); textBoxNCI.Lines = nciFile.ToArray(); } }
public void ModelPathBuilder_NCIfileToolpathIsGood_ReturnsModelPath() { string inputFile = "SPLINE-CHANNEL-CONTOURPATH.NCI"; double increment = .005; ToolPath5Axis toolpath = CNCFileParser.CreatePath(inputFile); ConstantDistancePathBuilder mpb = new ConstantDistancePathBuilder(); ModelPath mp = mpb.Build(toolpath, increment); Assert.AreEqual(-3.876529, mp[0].Position.X, "Xentity0"); Assert.AreEqual(0.05, mp[0].Position.Y, "Yentity0"); Assert.AreEqual(3.307008, mp[0].Position.Z, "Zentity0"); Assert.AreEqual(0, mp[0].Feedrate.Value, "Fentity0"); Assert.IsFalse(mp[0].JetOn, "Jentity0"); }
public void modelpathbuilder_buildpath_BoundingBoxOK() { string inputPath = "SPLINE-CHANNEL-CONTOURPATH.NCI"; ToolPath5Axis toolpath = CNCFileParser.CreatePath(inputPath); double increment = .001; ConstantDistancePathBuilder mpb = new ConstantDistancePathBuilder(); ModelPath mp = mpb.Build(toolpath, increment); Assert.AreEqual(-3.876529, mp.BoundingBox.Min.X, "min x"); Assert.AreEqual(.05, mp.BoundingBox.Min.Y, "min y"); Assert.AreEqual(0.465482, mp.BoundingBox.Min.Z, "min z;"); Assert.AreEqual(4.621802, mp.BoundingBox.Max.X, "max x"); Assert.AreEqual(.05, mp.BoundingBox.Max.Y, "max y"); Assert.AreEqual(3.307008, mp.BoundingBox.Max.Z, "max z"); }
void buildPathFromFile(string inputFile) { try { //inputFile = "STRAIGHT-4.NC"; //string inputFile = "SURF-TEST-1.nc"; ToolPath5Axis toolpath = CNCFileParser.CreatePath(inputFile); ConstantDistancePathBuilder mpb = new ConstantDistancePathBuilder(); path = mpb.Build(toolpath, meshSize); int pathCount = path.Count; label2.Text = "path count:" + pathCount.ToString(); label4.Text = path.BoundingBox.Min.X.ToString(); label5.Text = path.BoundingBox.Min.Y.ToString(); label6.Text = path.BoundingBox.Min.Z.ToString(); label7.Text = path.BoundingBox.Max.X.ToString(); label8.Text = path.BoundingBox.Max.Y.ToString(); label9.Text = path.BoundingBox.Max.Z.ToString(); Refresh(); } catch (Exception) { throw; } }
public void CNCparser_toolpathIsEmpty_ToolPathIsNotNull() { string inputPath = ""; var cncfp = new CNCFileParser(); IToolpath toolpath = cncfp.CreatePath(inputPath); }
public void CNCparser_toolpathIsNull_throwsException() { string inputPath = null; var cncfp = new CNCFileParser(); IToolpath toolpath = cncfp.CreatePath(inputPath); }