示例#1
0
        public void copyFrom(MachineStatus cpFrom)
        {
            this.modalVars                  = cpFrom.modalVars;
            this.modals                     = cpFrom.modals;
            this.machineCoordinates         = cpFrom.machineCoordinates;
            this.originalMachineCoordinates = cpFrom.originalMachineCoordinates;
            this.newPosition                = cpFrom.newPosition;
            this.newLine                    = cpFrom.newLine;
            this.rotAxMode                  = cpFrom.rotAxMode;
            this.ToolAxis                   = cpFrom.ToolAxis;
//          this.coordinatesOld = cpFrom.coordinatesOld ;
            this.machineOffsets = cpFrom.machineOffsets;
        }
示例#2
0
 public virtual void end(GCodeParser parser, MachineStatus machineStatus)
 {
 }
示例#3
0
        public virtual void endBlock(GCodeParser parser, MachineStatus machineStatus, IDictionary <String, ParsedWord> currentBlock)
        {
            String   currentLine    = parser.getCurrentLine();
            String   MachiningPlane = machine.getActivePlane();
            String   motionMode     = machine.getMotionMode();
            bool     helixMode      = false;
            Vector3D toolAx         = motion.GetToolAxis(MachiningPlane, machineStatus);

            if (parser.findWordInBlock(new StringBuilder(currentLine)) != null)
            {
                if (currentBlock.ContainsKey("A") || currentBlock.ContainsKey("B") || currentBlock.ContainsKey("C"))
                {
                    helixMode = true;
                }
                else
                {
                    helixMode = machineStatus.rotAxMode;
                }

                foreach (String key in currentBlock.Keys)
                {
                    switch (key)
                    {
                    case "G91":
                        SCM_CW.Append("SET/MODE;INCR");
                        SCM_CW.Append('\n');
                        break;

                    case "G90":
                        SCM_CW.Append("SET/MODE;ABSOL");
                        SCM_CW.Append('\n');
                        break;

                    case "G0":
                        SCM_CW.Append("RAPID");
                        SCM_CW.Append('\n');
                        break;

                    case "F":
                        SCM_CW.Append("FEDRAT/MMPM" + ";" + machine.getFeedrate());
                        SCM_CW.Append('\n');
                        break;

                    case "M5":
                        SCM_CW.Append("PAINT/TOOL;NOMORE");
                        SCM_CW.Append('\n');
                        break;

                    case "G41":
                        SCM_CW.Append("CUTCOM/LEFT");
                        SCM_CW.Append('\n');
                        break;

                    case "G40":
                        SCM_CW.Append("CUTCOM/OFF");
                        SCM_CW.Append('\n');
                        break;

                    case "G42":
                        SCM_CW.Append("CUTCOM/RIGHT");
                        SCM_CW.Append('\n');
                        break;
                    }
                }

                if (currentBlock.ContainsKey("TURN"))
                {
                    //		Console.WriteLine(machine.getTURN()) ;
                }

                if (currentBlock.ContainsKey("C"))
                {
                    Tolerance = 0.03;
                    string CM_CW_string = motion.NX_ROT_AX_C_TABLE(motionMode, MachiningPlane, machineStatus, Tolerance, MachineStatus.Axis.C, machine.getMC(), machine.getC(), MachineStatus.Axis.X, machine.getMX(), machine.getX(), machine.getOMX(), machine.getOX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), machine.getOMY(), machine.getOY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getOMZ(), machine.getOZ()).ToString();
                    SCM_CW.Append(CM_CW_string);
                }
                if (currentBlock.ContainsKey("A"))
                {
                    Tolerance = 0.03;
                    string CM_CW_string = motion.NX_ROT_AX_A_TABLE(motionMode, MachiningPlane, machineStatus, Tolerance, MachineStatus.Axis.A, machine.getMA(), machine.getA(), MachineStatus.Axis.X, machine.getMX(), machine.getX(), machine.getOMX(), machine.getOX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), machine.getOMY(), machine.getOY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getOMZ(), machine.getOZ()).ToString();
                    SCM_CW.Append(CM_CW_string);
                }
                if (currentBlock.ContainsKey("B"))
                {
                    Tolerance = 0.03;
                    string CM_CW_string = motion.NX_ROT_AX_B_TABLE(motionMode, MachiningPlane, machineStatus, Tolerance, MachineStatus.Axis.B, machine.getMB(), machine.getB(), MachineStatus.Axis.X, machine.getMX(), machine.getX(), machine.getOMX(), machine.getOX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), machine.getOMY(), machine.getOY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getOMZ(), machine.getOZ()).ToString();
                    SCM_CW.Append(CM_CW_string);
                }

                if (motionMode == "G1" && helixMode == false)
                {
                    SCM_CW.Append("GOTO/" + machine.getMX().ToString("F6") + ";" + machine.getMY().ToString("F6") + ";" + machine.getMZ().ToString("F6") + ";" + toolAx.X.ToString("F6") + ";" + toolAx.Y.ToString("F6") + ";" + toolAx.Z.ToString("F6")).Replace(',', '.');
                    SCM_CW.Append('\n');
                }
                if (motionMode == "G0" && helixMode == false)
                {
                    SCM_CW.Append("GOTO/" + machine.getMX().ToString("F6") + ";" + machine.getMY().ToString("F6") + ";" + machine.getMZ().ToString("F6") + ";" + toolAx.X.ToString("F6") + ";" + toolAx.Y.ToString("F6") + ";" + toolAx.Z.ToString("F6")).Replace(',', '.');
                    SCM_CW.Append('\n');
                }

                if (motionMode == "G2" && helixMode == false)
                {
                    if (currentBlock.ContainsKey("I") || currentBlock.ContainsKey("J") || currentBlock.ContainsKey("K"))
                    {
                        string CM_CW_string = motion.NX_circular_motion_CW(MachiningPlane, machineStatus, 0.01, MachineStatus.Axis.X, machine.getMX(), machine.getX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getI(), machine.getJ(), machine.getK(), machine.getTURN()).ToString();
                        //		string Helix_string = motion.NX_helical_motion_CW(MachiningPlane, machineStatus, 0.01, MachineStatus.Axis.X, machine.getOMX(), machine.getOX(), MachineStatus.Axis.Y, machine.getOMY(), machine.getOY(), MachineStatus.Axis.Z, machine.getOMZ(), machine.getOZ(), machine.getI(), machine.getJ(), machine.getK()).ToString() ;
                        //		string Helix_string = motion.NX_helical_motionCW(MachiningPlane, machineStatus, 0.01, MachineStatus.Axis.X, machine.getMX(), machine.getX(), machine.getOMX(), machine.getOX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), machine.getOMY(), machine.getOY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getOMZ(), machine.getOZ(), machine.getI(), machine.getJ(), machine.getK()).ToString() ;

                        SCM_CW.Append(CM_CW_string);
                    }
                    if (currentBlock.ContainsKey("CR"))
                    {
                        string CM_CW_string = motion.NX_circular_motion_CW(MachiningPlane, machineStatus, 0.01, MachineStatus.Axis.X, machine.getMX(), machine.getX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getCR(), machine.getTURN()).ToString();
                        SCM_CW.Append(CM_CW_string);
                        //						SCM_CW.Append('\n') ;
                    }
                }

                if (motionMode == "G3" && helixMode == false)
                {
                    //					string toolAxis = "tAxisX"+ machineStatus.mbase.M31.ToString("F9")+ " " + "tAxisY" + machineStatus.mbase.M32.ToString("F9") + " " + "tAxisZ" + machineStatus.mbase.M33.ToString("F9");
                    if (currentBlock.ContainsKey("I") || currentBlock.ContainsKey("J") || currentBlock.ContainsKey("K"))
                    {
                        string CM_CW_string = motion.NX_circular_motion_CCW(MachiningPlane, machineStatus, 0.005, MachineStatus.Axis.X, machine.getMX(), machine.getX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getI(), machine.getJ(), machine.getK(), machine.getTURN()).ToString();
                        //			Console.WriteLine(CM_CW_string) ;
                        SCM_CW.Append(CM_CW_string);
                        //			SCM_CW.Append('\n') ;
                    }
                    if (currentBlock.ContainsKey("CR"))
                    {
                        string CM_CW_string = motion.NX_circular_motion_CCW(MachiningPlane, machineStatus, 0.01, MachineStatus.Axis.X, machine.getMX(), machine.getX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getCR(), machine.getTURN()).ToString();
                        //				Console.WriteLine(CM_CW_string) ;
                        SCM_CW.Append(CM_CW_string);
                        //				SCM_CW.Append('\n') ;
                    }
                }

                if (currentBlock.ContainsKey("M30") || currentBlock.ContainsKey("M2"))
                {
                    SCM_CW.Append("END-OF-PATH");
                    SCM_CW.Append('\n');
                }
            }
        }
示例#4
0
 public virtual void startBlock(GCodeParser parser, MachineStatus machineStatus, IDictionary <String, ParsedWord> currentBlock)
 {
     machine.setMachineStatus(machineStatus);
 }
示例#5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public abstract void postVerify(MachineStatus machineStatus) throws com.rvantwisk.gcodeparser.exceptions.SimException;
        public abstract void postVerify(MachineStatus machineStatus);
示例#6
0
 public void setMachineStatus(MachineStatus machineStatus)
 {
     this.machineStatus = machineStatus;
 }