Пример #1
0
        public void NcFile_multiLine_countOK()
        {
            var ncfile = new NcFile();
            var mp1    = new MachinePosition()
            {
                X = 1, Adeg = 0
            };
            var mp2 = new MachinePosition()
            {
                X = 1, Adeg = 360
            };
            var f1 = new Feedrate(FeedrateUnits.InPerMin)
            {
                Value = 20
            };
            var f2 = new Feedrate(FeedrateUnits.InverseMins)
            {
                Value = 2
            };
            var ncp1      = new NcPositionCommand(10, mp1, f1, BlockType.LINEAR);
            var ncp2      = new NcPositionCommand(20, mp2, f2, BlockType.LINEAR);
            var ncMachine = new NcMachine(ControllerType.FAGOR8055, MachineGeometry.XA);

            ncfile.Add(ncp1);
            ncfile.Add(ncp2);
            var file = ncfile.AsNcTextFile(ncMachine);

            Assert.AreEqual(2, ncfile.Count);
            Assert.AreEqual(5, file.Count);
        }
Пример #2
0
        public void NCp_1ptctor_Valueok()
        {
            var mp1 = new MachinePosition();

            var f = new Feedrate(FeedrateUnits.InPerMin);


            int line = 1;
            var ncp  = new NcPositionCommand(line, mp1, f, BlockType.LINEAR);

            Assert.IsNotNull(ncp);
            Assert.IsNotNull(ncp.Feedrate);
            Assert.IsNotNull(ncp.MachinePosition);
            Assert.AreEqual(1, ncp.LineNumber);
        }
Пример #3
0
        public void NCp_2ptCtor_ValueOK()
        {
            var mp1 = new MachinePosition(1, 1, 1, 1, 1);
            var mp2 = new MachinePosition(5, 6, 7, 8, 9);
            var f   = new Feedrate(FeedrateUnits.InPerMin);

            f.Value = 10;

            var ncp = new NcPositionCommand(1, mp1, f, BlockType.LINEAR);

            var ncMachine = new NcMachine(ControllerType.FAGOR8055, MachineGeometry.XYZBC);

            string ncStr = ncp.AsNcString(ncMachine);

            Assert.IsNotNull(ncp);
            Assert.IsNotNull(ncp.Feedrate);
            Assert.IsNotNull(ncp.MachinePosition);
            Assert.AreEqual(1, ncp.LineNumber);
            StringAssert.Contains("N1 G90 G01 X1.0000 Y1.0000 Z1.0000 B1.000 C1.000 F10.00", ncStr);
        }
Пример #4
0
        public void NCp_1ptctorXaMachine_Valueok()
        {
            var f = new Feedrate(FeedrateUnits.InPerMin);

            f.Value = 10;

            var mp1 = new MachinePosition();

            mp1.X    = -4;
            mp1.Adeg = 20;
            int line = 1;
            var ncp  = new NcPositionCommand(line, mp1, f, BlockType.LINEAR);

            Assert.IsNotNull(ncp);
            Assert.IsNotNull(ncp.Feedrate);
            Assert.IsNotNull(ncp.MachinePosition);
            Assert.AreEqual(1, ncp.LineNumber);
            var    ncMachine = new NcMachine(ControllerType.FAGOR8055, MachineGeometry.XA);
            string ncStr     = ncp.AsNcString(ncMachine);

            StringAssert.Contains("N1 G90 G01 X-4.0000 A20.000 F10.00", ncStr);
        }
Пример #5
0
        public void NcFile_multiLine_valuesOK()
        {
            var ncfile = new NcFile();
            var mp1    = new MachinePosition()
            {
                X = 1, Adeg = 0
            };
            var mp2 = new MachinePosition()
            {
                X = 1, Adeg = 360
            };
            var f1 = new Feedrate(FeedrateUnits.InPerMin)
            {
                Value = 20
            };
            var f2 = new Feedrate(FeedrateUnits.InverseMins)
            {
                Value = 2
            };
            var ncp1      = new NcPositionCommand(10, mp1, f1, BlockType.LINEAR);
            var ncp2      = new NcPositionCommand(20, mp2, f2, BlockType.LINEAR);
            var ncMachine = new NcMachine(ControllerType.FAGOR8055, MachineGeometry.XA);

            ncfile.Add(ncp1);
            ncfile.Add(ncp2);
            var ncText      = ncfile.AsNcTextFile(ncMachine);
            var ncfileLine0 = ncText[0];
            var ncfileLine1 = ncText[1];
            var ncfileLine2 = ncText[2];
            var line0       = ";Title";
            var line1       = "N10 G90 G01 X1.0000 A0.000 F20.00";
            var line2       = "N20 G32 G90 G01 X1.0000 A360.000 F2.00";

            StringAssert.Contains(ncfileLine0, line0);
            StringAssert.Contains(ncfileLine1, line1);
            StringAssert.Contains(ncfileLine2, line2);
        }