Exemple #1
0
		private void InitLoad()
		{
			_last = new Point3D();
			_minpt = new Point3D() { X = int.MaxValue, Y = int.MaxValue };
			_maxpt = new Point3D() { X = int.MinValue, Y = int.MinValue };
			_stream = new CommandStream();
			_IsPenUp = true;
			_color = Color.Black;
		}
Exemple #2
0
		public virtual bool ReadFrom(CommandStream stream)
		{
			Point3D ep = new Point3D();

			if (stream.NextChar == '.')
			{
				stream.Next();
				SubCode = stream.GetInt().ToString();
			}

			if (PositionValid)
			{
				while (true)
				{
					switch (stream.SkipSpacesToUpper())
					{
						case 'X': ep.X = ReadVariable(stream, stream.NextCharToUpper, false); break;
						case 'Y': ep.Y = ReadVariable(stream, stream.NextCharToUpper, false); break;
						case 'Z': ep.Z = ReadVariable(stream, stream.NextCharToUpper, false); break;
						case 'F': ReadVariable(stream, stream.NextCharToUpper, true); break;
						case 'R':
						case 'I':
						case 'J':
						case 'K': ReadVariable(stream,stream.NextCharToUpper, false); break;
						default:
							{
								ReadFromToEnd(stream);
								return true;
							}
					}
				}
			}
			else
			{
				ReadFromToEnd(stream);
			}

			return true;
		}
Exemple #3
0
		protected double? ReadVariable(CommandStream stream, char param, bool allow)
		{
			stream.Next();
			stream.SkipSpaces();
			if (stream.NextChar == '#')
			{
				stream.Next();
				var paramNr = stream.GetInt();
				AddVariableParam(param,paramNr.ToString());
				return 0;
			}

			stream.SkipSpaces();

			if (stream.IsInt())
			{
				var val = stream.GetDouble();
				AddVariable(param, val);
				return val;
			}
			else
			{
				AddVariableNoValue(param);
				return null;
			}
		}
Exemple #4
0
		private void ReadFromToEnd(CommandStream stream)
		{
			GCodeAdd = "";
			while (!stream.IsEOF())
			{
				GCodeAdd += stream.NextChar;
				stream.Next();
			}
		}