void OnGUI() { //To display //test_str = GUI.TextArea(new Rect(10, 10,300, 500), test_str); GUI.Label(new Rect(140, 80, 100, 20), "请输入程序号:"); text_field = GUI.TextField(new Rect(245, 80, 195, 20), text_field); //运行时,可重新输入不同的NC程序名字,反复启动 if(GUI.Button(new Rect(140, 110, 300, 30), "启动")) { Load(text_field); } if(GUI.Button(new Rect(140, 160, 300, 30), "检查")) { FANUC_OI_M check = new FANUC_OI_M(); check.ModalClone(current_modal); Debug.Log(check.CompileEntrance(SourceCode, text_field, ref compile_info_list, current_position, ref motion_info_list, virtual_position)); Debug.Log(check.ExecuteFlag); Debug.Log(check.CompileInfo.Count); Debug.Log(compile_info_list.Count); if(check.CompileInfo.Count > 0) foreach(string error_str in check.CompileInfo) Debug.Log(error_str); if(compile_info_list.Count > 0) foreach(DataStore compile_info in compile_info_list) Debug.Log(compile_info.ToString()); } if(GUI.Button(new Rect(140, 200, 300, 30), "Clone")) { CloneTest(); } }
public bool AutoCodeCompile(List <string> original_code, ref string errorString) { int compile_result = -1; SourceCodeFarmat(original_code); FANUC_OI_M AutoFanuc_OI_M = new FANUC_OI_M(); CurrentModal.SetCooZero(CooSystem_Script.AbsoluteZero); AutoFanuc_OI_M.ModalClone(CurrentModal); compile_result = AutoFanuc_OI_M.CompileEntrance(SourceCode, CooSystem_Script.absolute_pos, motion_info_list, Auto_Script.CurrentVirtualPos(), original_motion_info_list, tool_motion_list); if (compile_result == (int)ResultType.Success) { errorString = ""; CreatePathLine(ref PathLineDraw_Script.lineDrawer, Color.green, motion_info_list); CreatePathLine(ref PathLineDraw_Script.lineOriginalDrawer, Color.red, original_motion_info_list); // Debug.Log(original_motion_info_list.Count + "<||>" + motion_info_list.Count); // foreach(MotionInfo motion_info in motion_info_list) // Debug.Log(motion_info.ToString()); // for(int i = 0; i < motion_info_list.Count && i < 300; i++) // { // Debug.Log(motion_info_list[i].ToString()); // Debug.Log(original_motion_info_list[i].ToString()); // } // for(int i = 0; i < original_motion_info_list.Count && i < 300; i++) // { // Debug.Log(motion_info_list[i].ToString()); // Debug.Log(original_motion_info_list[i].ToString()); // } return(true); } else if (compile_result == (int)ResultType.CompileError) { errorString = "代码编译错误!"; // Debug.Log(AutoFanuc_OI_M.CompileInfo.Count); for (int i = 0; i < AutoFanuc_OI_M.CompileInfo.Count && i < 300; i++) { // Debug.Log(AutoFanuc_OI_M.CompileInfo[i]); Warnning_Script.object_description += AutoFanuc_OI_M.CompileInfo[i] + "\n"; } Warnning_Script.object_description += "代码编译错误!\n"; if (!Warnning_Script.come_forth) { Warnning_Script.motion_start = true; } return(false); } else { errorString = "程序中含有宏代码,本系统暂不支持宏代码!"; Warnning_Script.object_description += "程序中含有宏代码,本系统暂不支持宏代码!\n"; if (!Warnning_Script.come_forth) { Warnning_Script.motion_start = true; } return(false); } }
void SimulateFunc(List<List<string>> source_code, string prog_name, ref List<DataStore> compile_data, Vector3 current_position, ref List<MotionInfo> motion_data) { FANUC_OI_M SimulatClass = new FANUC_OI_M(); SimulatClass.ModalClone(current_modal); SimulatClass.CompileEntrance(source_code, prog_name, ref compile_data, current_position, ref motion_data, virtual_position); }