日期:2014-05-18  浏览次数:22445 次

C#中如何对List中的List进行赋值操作
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;
using System.Text.RegularExpressions;
//using System

namespace CNC
{  
   
   
  //class GMGemerate_List
  //{
  // static DataInfoList[] GMGenerate_List_Info;
  //}
   
  class GMGenerate
  {
  public struct AxisABS
  {
  public double x;//坐标x
  public double y;//坐标y
  public double z;//坐标z
  public double a;//?
  }
  public struct GCode
  {
  public int GCodeID;//G代码ID
  public double GCodePar1;//G代码第一部分
  public double GCodePar2;//G代码第二部分
  public int GCodeParType;//G代码类型
  }
  public struct MCode
  {
  public int MCodeID;//M代码ID
  public double MCodePar1;//M代码第一部分
  public double MCodePar2;//M代码第二部分
  public int MCodeParType;//M代码类型
  }
  public struct PSCode
  {
  public int PSCodeID;//代码ID
  public double PSCodePar1;//代码第一部分
  public double PSCodePar2;//代码第二部分
  public int PSCodeParType;//代码类型
  public string name;
  }

  public struct DataInfoList
  {
  public int Num_pro;//行号
  public AxisABS axis;//坐标
  public List<GCode> G_Data_Code;//G代码列表
  public List<MCode> M_Data_Code;//M代码列表
  public List<PSCode> PS_Data_Code;//整体代码列表
  //public GCode G_Data_Code;//G代码
  //public MCode M_Data_Code;//M代码
  }

  /// <summary>
  /// 刀补 G40 G43 G42 G41 G44
  /// </summary>
  private const int TOOL_Length_COMPEN_NONE = 0;
  private const int TOOL_Length_COMPEN_Pos = 1;//刀具长度正向补偿;
  private const int TOOL_Length_COMPEN_Neg = 2;//刀具长度负向补偿
  private const int TOOL_Length_COMPEN_Left = 3;//刀具长度左向补偿;
  private const int TOOL_Length_COMPEN_Right = 4;//刀具长度右向补偿

  /// <summary>
  /// 坐标值类型 G90 G91
  /// </summary>
  private const int DIMENSION_TYPE_ABS = 0;//绝对地址
  private const int DIMENSION_TYPE_INC = 1;//增量地址

  /// <summary>
  /// 运动类型 G00 G01 G02 G03 G04 
  /// </summary>
  private const int MOTION_TYPE_NOT_INIT = -1; ////  
  private const int MOTION_TYPE_RAPID = 0;//注:MOTION_TYPE_WAIT 等待未处理 //点定位
  private const int MOTION_TYPE_LINE = 1;//G01直线插补
  private const int MOTION_TYPE_CW = 2;//G02顺时针圆弧插补
  private const int MOTION_TYPE_CCW = 3;//G03逆时针圆弧插补
  private const int MOTION_TYPE_WAIT = 4;//G04 暂停

  /// <summary>
  /// G M Code
  /// </summary>
  private const int GCODE_MAX_NO_ONELINE = 10; //max G code total number in one line
  private const int MCODE_MAX_NO_ONELINE = 18; //max M code total number in one line
  private const int PROGRAM_MAX = 200;//程序的最大行