/// <summary> /// 工站点位存取测试 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btLoadSaveAxisPos_Click(object sender, EventArgs e) { JFXCfg cfg = new JFXCfg(); cfg.Load("StationDemoPosTable.xml", true); List <JFMultiAxisPosition> maPoses = new List <JFMultiAxisPosition>(); JFMultiAxisPosition maPos1 = new JFMultiAxisPosition(); maPos1.Name = "Pos1"; maPos1.Positions.Add(JFAxisPos.Create("X", 1.23)); maPos1.Positions.Add(JFAxisPos.Create("Y", 4.56)); maPoses.Add(maPos1); JFMultiAxisPosition maPos2 = new JFMultiAxisPosition(); maPos2.Name = "Pos2"; maPos2.Positions.Add(JFAxisPos.Create("Y", 9.87)); maPos2.Positions.Add(JFAxisPos.Create("Z", 6.54)); maPoses.Add(maPos2); if (!cfg.ContainsItem("Positions")) { cfg.AddItem("Positions", maPoses); } else { cfg.SetItemValue("Positions", maPoses); } cfg.Save(); JFXCfg cfgAnother = new JFXCfg(); cfgAnother.Load("StationDemoPosTable.xml", false); List <JFMultiAxisPosition> maPoses1 = cfgAnother.GetItemValue("Positions") as List <JFMultiAxisPosition>;//测试OK,可获取 }
double _piece2HandEdge = 0; //料仓送料完成后,料片左边缘到夹手右边缘的距离 /// <summary> /// 准备运行所需要的参数 /// </summary> void _BuildTaskParam() { _currPieceID = JFHubCenter.Instance.SystemCfg.GetItemValue(SYS_CurrentRecipeID) as string; if (string.IsNullOrEmpty(_currPieceID)) { ExitWork(WorkExitCode.Exception, " 系统数据项:" + SYS_CurrentRecipeID + " 未设置"); } JFDLAFProductRecipe productRecipe = JFHubCenter.Instance.RecipeManager.GetRecipe("Product", _currPieceID) as JFDLAFProductRecipe; if (null == productRecipe) { ExitWork(WorkExitCode.Exception, "产品配方:" + _currPieceID + " 不存在"); } if (string.IsNullOrEmpty(productRecipe.magezineBox)) { ExitWork(WorkExitCode.Exception, "产品配方:" + _currPieceID + " 未包含BoxID配置项"); } JFDLAFBoxRecipe boxRecipe = JFHubCenter.Instance.RecipeManager.GetRecipe("Box", /*productRecipe.magezineBox*/ _currPieceID) as JFDLAFBoxRecipe; if (null == boxRecipe) { ExitWork(WorkExitCode.Exception, "产品配方:" + _currPieceID + " BoxID:" + productRecipe.magezineBox + " 在配方管理器中不存在"); } //_trackIntervel = boxRecipe.FrameWidth; if (boxRecipe.FrameWidth <= 0) { ExitWork(WorkExitCode.Exception, " BoxID:" + productRecipe.magezineBox + " 参数项FrameWidth = " + _trackIntervel + " 为非法值!"); } _feedDistance = (double)GetCfgParamValue(SCN_FeedDistance); if (_feedDistance <= 0) { ExitWork(WorkExitCode.Exception, "运行参数:" + SCN_FeedDistance + " =" + _feedDistance + " 为非法值"); } _singleTripLength = (double)GetCfgParamValue(SCN_PushLength); if (_singleTripLength <= 0) { ExitWork(WorkExitCode.Exception, "运行参数:" + SCN_PushLength + " =" + _singleTripLength + " 为非法值"); } _piece2HandEdge = (double)GetCfgParamValue(SCN_Piece2Hand); if (_piece2HandEdge <= 0) { ExitWork(WorkExitCode.Exception, "运行参数:" + SCN_Piece2Hand + " =" + _piece2HandEdge + " 为非法值"); } _trackOrg = (double)GetCfgParamValue(SCN_TrackOrgWidth); if (_trackOrg <= 0) { ExitWork(WorkExitCode.Exception, "运行参数:" + SCN_TrackOrgWidth + " =" + _trackOrg + " 为非法值"); } //检查待机点位是否设置 JFMultiAxisPosition standbyPos = GetWorkPosition(WPN_Standby); string axisXName = GetDecChnGlobName(NamedChnType.Axis, DevAN_AxisFeed); if (string.IsNullOrEmpty(axisXName)) { ExitWork(WorkExitCode.Exception, "轴替身:" + DevAN_AxisFeed + " 未邦定全局轴名称"); } if (standbyPos.AxisNames.Length != 1 || !standbyPos.ContainAxis(axisXName)) { ExitWork(WorkExitCode.Exception, "进料待机点位设置错误!只能包含进料X轴"); } }