Beispiel #1
0
        public static GCodeValue Intepret(string value)
        {
            value = value.ToLower();

            var result = new GCodeValue();

            var fc = value [0];

            var valuestring = value.Remove(0, 1);


            result.Value = double.Parse(valuestring, CultureInfo.InvariantCulture);

            switch (fc)
            {
            case  'x':
                result.Type = GCodeValueType.XAxis;
                break;

            case  'y':
                result.Type = GCodeValueType.YAxis;
                break;

            case  'z':
                result.Type = GCodeValueType.ZAxis;
                break;

            case  'e':
                result.Type = GCodeValueType.ExtruderAxis;
                break;

            case  's':
                result.Type = GCodeValueType.ExtruderTemperatur;
                break;

            case 'f':
                result.Type = GCodeValueType.FeedRate;
                break;

            default:
                break;
            }

            return(result);
        }
Beispiel #2
0
        public static GCodeValue Intepret(string value)
        {
            value = value.ToLower();

            var result = new GCodeValue ();

            var fc = value [0];

            var valuestring = value.Remove (0, 1);

            result.Value = double.Parse(valuestring,CultureInfo.InvariantCulture);

            switch (fc)
            {
            case  'x':
                result.Type = GCodeValueType.XAxis;
                break;
            case  'y':
                result.Type = GCodeValueType.YAxis;
                    break;
            case  'z':
                result.Type = GCodeValueType.ZAxis;
                    break;
            case  'e':
                result.Type = GCodeValueType.ExtruderAxis;
                    break;
            case  's':
                result.Type = GCodeValueType.ExtruderTemperatur;
                    break;
            case 'f':
                result.Type = GCodeValueType.FeedRate;
                break;
            default:
                break;
            }

            return result;
        }
Beispiel #3
0
        public void IntepretLine(string line)
        {
            line = line.Split(';') [0];

            if (line != string.Empty)
            {
                line = line.Trim();

                var splits = line.Split(new String[] { " " }, StringSplitOptions.RemoveEmptyEntries);

                var cmd = splits [0];
                List <GCodeValue> values = new List <GCodeValue> ();
                if (splits.Length > 1)
                {
                    for (int i = 1; i < splits.Length; i++)
                    {
                        values.Add(GCodeValue.Intepret(splits [i]));
                    }
                }

                switch (cmd)
                {
                case "G1":                 // liniear
                    G1(values);
                    break;

                case "G1R": // liniear relative
                    G1R(values);
                    break;

                case "G21":                 //Set Milimeter
                    break;

                case "G28":                 //Home
                    G28(values);
                    break;

                case "G90":                 //Set Absolute position
                    break;

                case "G92":                 //Set Position
                    G92(values);
                    break;

                case "M82":                 //Set extruder to absolute mode
                    break;

                case "M84":                 //Stop idle hold
                    break;

                case "M104":                 // Set Extruder Temperature
                    M104(values);
                    break;

                case "M109":                 // Set Extruder Temperature and Wait
                    M109(values);
                    break;

                case "M106":                 //Fan on:
                    break;

                case "M107":                 //Fan off:
                    break;

                default:
                    TextPrinter.WriteLine("Unbekanntes Kommando:{0}", cmd);
                    break;
                }
            }
        }