/// <summary> /// 提取指定状态,指定位置的模组 /// </summary> /// <param name="md">接受返回模组</param> /// <param name="idx">指定位置,默认不指定</param> /// <param name="res">指定状态,默认待测模组</param> /// <returns></returns> public EM_RES Pull(ref MdDat md, int idx = -1, EM_CM_RES res = EM_CM_RES.UNTEST) { PosInf posInf = list_pos.Find(s => { if (idx == -1 || s.idx == idx) { if (s.md != null && s.md.res == (int)res) { return(true); } } return(false); }); if (posInf != null) { md = posInf.md.Clone(); posInf.md = null; } else { md = null; return(EM_RES.END); } return(EM_RES.OK); }
public EM_RES LoadDat(string filename = "") { if (filename.Length < 3) { filename = strCfgPath; } if (filename.Length < 3) { return(EM_RES.PARA_ERR); } if (!File.Exists(filename)) { return(EM_RES.PARA_ERR); } IniFile inf = new IniFile(filename); //cofig string str_section = "TRAY"; row = inf.ReadInteger(str_section, "ROW", 0); col = inf.ReadInteger(str_section, "COL", 0); tl.x = inf.ReadDouble(str_section, "TL_X", 0); tl.y = inf.ReadDouble(str_section, "TL_Y", 0); tl.z = inf.ReadDouble(str_section, "TL_Z", 0); tl.a = inf.ReadDouble(str_section, "TL_A", 0); tr.x = inf.ReadDouble(str_section, "TR_X", 0); tr.y = inf.ReadDouble(str_section, "TR_Y", 0); tr.z = inf.ReadDouble(str_section, "TR_Z", 0); tr.a = inf.ReadDouble(str_section, "TR_A", 0); bl.x = inf.ReadDouble(str_section, "BL_X", 0); bl.y = inf.ReadDouble(str_section, "BL_Y", 0); bl.z = inf.ReadDouble(str_section, "BL_Z", 0); bl.a = inf.ReadDouble(str_section, "BL_A", 0); //data list_pos.Clear(); for (int n = 0; n < row * col; n++) { str_section = string.Format("P{0}", n); PosInf posInf = new PosInf(); posInf.Pos.x = inf.ReadDouble(str_section, "X", 0); posInf.Pos.y = inf.ReadDouble(str_section, "Y", 0); posInf.Pos.z = inf.ReadDouble(str_section, "Z", 0); posInf.Pos.a = inf.ReadDouble(str_section, "A", 0); posInf.Col = inf.ReadInteger(str_section, "col", 0); posInf.Row = inf.ReadInteger(str_section, "row", 0); posInf.idx = inf.ReadInteger(str_section, "idx", 0); posInf.isDisable = inf.ReadBool(str_section, "disable", false); list_pos.Add(posInf); } return(EM_RES.OK); }
public PosInf Clone() { PosInf posInf = new PosInf(); posInf.Pos = Pos.Clone(); posInf.idx = idx; posInf.Row = Row; posInf.Col = Col; posInf.isEmpty = isEmpty; posInf.isDisable = isDisable; posInf.rect = new Rectangle(rect.X, rect.Y, rect.Width, rect.Height); posInf.md = md.Clone(); return(posInf); }
public void CreatePos(int row, int col, ST_XYZA tl, ST_XYZA bl, ST_XYZA tr) { list_pos.Clear(); ST_XYZA[][] PointArray = Utility.Array(tl, tr, bl, col, row); for (int r = 0; r < PointArray.Length; r++) { for (int c = 0; c < PointArray[0].Length; c++) { PosInf p = new PosInf(); p.Pos = PointArray[r][c]; p.Pos.z = tl.z; p.Pos.a = tl.a; p.Row = r; p.Col = c; p.idx = PointArray[0].Length * r + c; p.isDisable = false; p.md = null; list_pos.Add(p); } } }
public EM_RES SaveDat(string filename = "") { if (filename.Length < 3) { filename = strCfgPath; } if (filename.Length < 3) { return(EM_RES.PARA_ERR); } //if (!File.Exists(filename)) return EM_RES.PARA_ERR; IniFile inf = new IniFile(filename); //cofig string str_section = "TRAY"; inf.WriteInteger(str_section, "ROW", row); inf.WriteInteger(str_section, "COL", col); inf.WriteDouble(str_section, "TL_X", tl.x); inf.WriteDouble(str_section, "TL_Y", tl.y); inf.WriteDouble(str_section, "TL_Z", tl.z); inf.WriteDouble(str_section, "TL_A", tl.a); inf.WriteDouble(str_section, "TR_X", tr.x); inf.WriteDouble(str_section, "TR_Y", tr.y); inf.WriteDouble(str_section, "TR_Z", tr.z); inf.WriteDouble(str_section, "TR_A", tr.a); inf.WriteDouble(str_section, "BL_X", bl.x); inf.WriteDouble(str_section, "BL_Y", bl.y); inf.WriteDouble(str_section, "BL_Z", bl.z); inf.WriteDouble(str_section, "BL_A", bl.a); //data PosInf posInf = new PosInf(); for (int n = 0; n < row * col; n++) { str_section = string.Format("P{0}", n); if (n < list_pos.Count) { posInf = list_pos.ElementAt(n); } else { posInf = new PosInf(); } inf.WriteInteger(str_section, "col", posInf.Col); inf.WriteInteger(str_section, "row", posInf.Row); inf.WriteInteger(str_section, "idx", posInf.idx); inf.WriteBool(str_section, "disable", posInf.isDisable); inf.WriteDouble(str_section, "X", posInf.Pos.x); inf.WriteDouble(str_section, "Y", posInf.Pos.y); inf.WriteDouble(str_section, "Z", posInf.Pos.z); inf.WriteDouble(str_section, "A", posInf.Pos.a); } for (int n = row * col; n < 20 * 20; n++) { str_section = string.Format("P{0}", n); inf.WriteString(str_section, null, null); } return(EM_RES.OK); }