/// <summary> /// Initialize halcon procedures /// </summary> public static void InitializeProcedures() { hDevEngine.SetEngineAttribute("execute_procedures_jit_compiled", "true"); hDevEngine.SetProcedurePath(Directory.GetCurrentDirectory()); HDevProcedure hDevProcedureCheckColor = new HDevProcedure("CheckColor"); hDevprocedureCallCheckColor = new HDevProcedureCall(hDevProcedureCheckColor); HDevProcedure hDevProcedureCreateLogos = new HDevProcedure("CreateLogos"); hDevprocedureCallCreateLogos = new HDevProcedureCall(hDevProcedureCreateLogos); HDevProcedure hDevProcedureCheckLogos = new HDevProcedure("CheckLogos"); hDevprocedureCallCheckLogos = new HDevProcedureCall(hDevProcedureCheckLogos); HDevProcedure hDevProcedureCheckText = new HDevProcedure("CheckText"); hDevProcedureCallCheckText = new HDevProcedureCall(hDevProcedureCheckText); HDevProcedure hDevProcedureCheckShapes = new HDevProcedure("CheckShapes"); hDevProcedureCallCheckShapes = new HDevProcedureCall(hDevProcedureCheckShapes); }
private void Form1_Load(object sender, EventArgs e) { LoadModelID(); loadMastertrain(); loadPLCSetting(); loadCamera(); _procderduce.SetProcedurePath(path_Procerduce); LoadModel(); //connectCam(_interfacename, _device); //connectPLC(); //// Status Light //if (_status_connect_cam) //{ // btnlightcam.BackColor = Color.Green; //} //else //{ // btnlightcam.BackColor = Color.Green; //} //if (_status_connect_plc) //{ // btnlightPLC.BackColor = Color.Green; //} //else //{ // btnlightPLC.BackColor = Color.Green; //} connectPLC(); ////Thread get bit TT _threadTT = new Thread(new ThreadStart(rungetbitfromplc)); _threadTT.IsBackground = true; _threadTT.Start(); }
private void FormTest_Load(object sender, EventArgs e) { _threadAuto = new Thread(new ThreadStart(getDataLive)); _threadAuto.IsBackground = true; _threadAuto.Start(); _producerEngin.SetProcedurePath(procerducePath); }
private void frmMain_Load(object sender, EventArgs e) { loadPLCSetting(); loadCamera(); loadpattern(); loaddataAling(); //Load Producer _procderduce.SetProcedurePath(path_Procerduce); }
public void InitialEngine() { if (MyEngine == null) { MyEngine = new HDevEngine(); } MyEngine.SetProcedurePath(Environment.CurrentDirectory + "\\Engine\\"); MyEngine.SetEngineAttribute("execute_procedures_jit_compiled", "true"); engineIsnitial = true; }
public void initialengine(string filename) { programPath = System.Environment.CurrentDirectory + @"\" + filename + ".hdev"; procedurePath = System.Environment.CurrentDirectory + @"\"; if (!HalconAPI.isWindows) { programPath = programPath.Replace("\\", "/"); procedurePath = procedurePath.Replace("\\", "/"); } engine.SetProcedurePath(procedurePath); // viewPort.HalconWindow.SetLineWidth(4); MyHDevOperatorImpl = new HDevOpMultiWindowImpl(viewPort.HalconWindow); engine.SetHDevOperators(MyHDevOperatorImpl); }
private void LoadHalconEnginee() { HOperatorSet.SetSystem("filename_encoding", "utf8"); string CurrentPath = Directory.GetCurrentDirectory(); MyEngine.SetProcedurePath(CurrentPath); string ProgramPathString = Directory.GetCurrentDirectory() + @"\ini\MeasureSize.hdev"; string ProcedureCallName = "MeasureSizeLibrary"; Program = new HDevProgram(ProgramPathString); Procedure = new HDevProcedure(Program, ProcedureCallName); ProcedureCall = new HDevProcedureCall(Procedure); }
private void ExecExtProcForm_Load(object sender, System.EventArgs e) { // path of external procedures string halconExamples = HSystem.GetSystem("example_dir"); string ProcedurePath = halconExamples + @"\hdevengine\procedures"; if (!HalconAPI.isWindows) { // Unix-based systems (Mono) ProcedurePath = ProcedurePath.Replace('\\', '/'); } MyEngine.SetProcedurePath(ProcedurePath); // disable Execute button ExecuteBtn.Enabled = false; }
private void ExecExtProcForm_Load(object sender, System.EventArgs e) { // path of external procedures PathPJ = PathPJ.Replace("bin\\Debug", ""); string ProcedurePath = PathPJ + "\\hdev\\teaching_hdev"; ProgramPathString = PathPJ + "\\hdev\\test_teaching.hdev"; shotComboBox.SelectedIndex = 0; if (!HalconAPI.isWindows) { // Unix-based systems (Mono) ProcedurePath = ProcedurePath.Replace('\\', '/'); } MyEngine.SetProcedurePath(ProcedurePath); // disable Execute button StartBtn.Enabled = false; LoadBtn_Click(sender, e); }
private void ExecProceduresForm_Load(object sender, System.EventArgs e) { // path of external procedures string halconExamples = HSystem.GetSystem("example_dir"); string ProcedurePath = halconExamples + @"\hdevengine\procedures"; ProgramPathString = halconExamples + @"\hdevengine\hdevelop\fin_detection.hdev"; if (!HalconAPI.isWindows) { // Unix-based systems (Mono) ProcedurePath = ProcedurePath.Replace('\\', '/'); ProgramPathString = ProgramPathString.Replace('\\', '/'); } MyEngine.SetProcedurePath(ProcedurePath); // disable buttons InitAcqBtn.Enabled = false; ProcessImageBtn.Enabled = false; VisualizeDetailsBtn.Enabled = false; }
//C:/Program Files/MVTec/HALCON-13.0/procedures/ public Vision() { try { InitSaveImageFilePath(); string path = System.Environment.CurrentDirectory + "\\Programs"; //视觉引擎加载过程 myEngine.SetProcedurePath(path); //视觉脚本程序加载 HDevProgram myProgram = new HDevProgram(path + "\\Main.hdev"); //将过程挂载到视觉脚本 //cam1ProcedureCall1 = new HDevProcedureCall(new HDevProcedure(myProgram, "TileImage")); cam1ProcedureCall2 = new HDevProcedureCall(new HDevProcedure(myProgram, "HS9Operate")); //cam1ProcedureCall3 = new HDevProcedureCall(new HDevProcedure(myProgram, "TileImage3")); OpenCameraAsync(); } catch (Exception ex) { GlobalVar.AddMessage(ex.Message); } }
private void 主界面_Load(object sender, EventArgs e) { #region 加载hdvp文件 try { m_HDevEngine.SetProcedurePath(m_sHDevEnginePath); m_CamProcedure = new HDevProcedure("_829test"); m_CamProcedureCall = m_CamProcedure.CreateCall(); } catch (Exception df) { string s = "a"; // Fun_Add_lb_Info("文件读取失败!" + df.Message); } #endregion #region 开启作业线程 m_AutoRunThread = new Thread(Fun_AutoRun); m_AutoRunThread.IsBackground = true; m_AutoRunThread.Start(); Console.WriteLine("自动作业线程已开启!" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff")); #endregion }
private void Form1_Load(object sender, EventArgs e) { String path = @".\hdev\ocr_mvtec_using_a_camera.hdev"; String procPath = @".\procedure"; engine.SetProcedurePath(procPath); program = new HDevProgram(path); programCall = new HDevProgramCall(program); ocr_NHP = new HDevProcedure(program, "ocr_NHP"); ocr_NHP_Call = new HDevProcedureCall(ocr_NHP); charArray2String = new HDevProcedure(program, "charArray2String"); charArray2String_Call = new HDevProcedureCall(charArray2String); t = DateTime.Now; dgv = dataGridView1; mainWindowList[0] = hSmartWindowControl1.HalconWindow; mainWindowList[1] = hSmartWindowControl2.HalconWindow; //mainWindowList[2] = hSmartWindowControl3.HalconWindow; //mainWindowList[3] = hSmartWindowControl4.HalconWindow; //hSmartWindowControl5.Hide(); //hSmartWindowControl6.Hide(); sideWindowList[0] = hSmartWindowControl3.HalconWindow; sideWindowList[1] = hSmartWindowControl4.HalconWindow; //sideWindowList[2] = hSmartWindowControl7.HalconWindow; //sideWindowList[3] = hSmartWindowControl8.HalconWindow; //hSmartWindowControl7.Hide(); //hSmartWindowControl8.Hide(); initSetup(); setCamera(); updateSetting(); dgv.AutoSize = false; this.dgv.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; this.dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; dgv.RowHeadersDefaultCellStyle.BackColor = Color.DarkSalmon; }
public HDevelopExport() { string ProcedurePath = this.GetType().Assembly.GetAssemblyDirectoryPath(); MyEngine.SetProcedurePath(ProcedurePath); }
private void SetForm_Load(object sender, EventArgs e) { #region 初始化ComboBox控件 string PathLiaoHao = Global.m_sLiaoHaoPath; if (!Directory.Exists(PathLiaoHao)) { Directory.CreateDirectory(PathLiaoHao); } comBox_TypeNow.Items.Clear(); string[] str = null; using (FileStream fsRead = new FileStream(Global.m_sLiaoHaoPath + "\\LiaoHao.ini", FileMode.Open)) { int fsLen = (int)fsRead.Length; byte[] heByte = new byte[fsLen]; int r = fsRead.Read(heByte, 0, heByte.Length); string myStr = System.Text.Encoding.UTF8.GetString(heByte); str = myStr.Split(','); } for (int i = 0; i < str.Length - 1; i++) { comBox_TypeNow.Items.Add(str[i]); } string S1 = ""; S1 = IniAPI.INIGetStringValue(Global.m_sConfigPath + "\\System.ini", "SYSTEM", "常用料号", ""); if (S1 != "") { comBox_TypeNow.Text = S1; } #endregion #region 读取曝光和增益的最大值 int IntexposureMax = 0; int IntgainMax = 0; string StrexposureMax = string.Empty; string StrgainMax = string.Empty; StrexposureMax = IniAPI.INIGetStringValue(Global.m_sConfigPath + "\\System.ini", "SYSTEM", "ExposureMax", "10000"); StrgainMax = IniAPI.INIGetStringValue(Global.m_sConfigPath + "\\System.ini", "SYSTEM", "GainMax", "15"); bool b1 = int.TryParse(StrexposureMax, out IntexposureMax); if (b1 != true) { IntexposureMax = 10000; } numUD_Exposure.Maximum = IntexposureMax; bool b2 = int.TryParse(StrgainMax, out IntgainMax); if (b2 != true) { IntgainMax = 15; } numUD_Gain.Maximum = IntgainMax; IniAPI.INIWriteValue(Global.m_sConfigPath + "\\System.ini", "SYSTEM", "ExposureMax", StrexposureMax); IniAPI.INIWriteValue(Global.m_sConfigPath + "\\System.ini", "SYSTEM", "GainMax", StrgainMax); #endregion #region 加载hdvp文件 try { m_HDevEngine.SetProcedurePath(m_sHDevEnginePath); m_CamProcedure = new HDevProcedure("_829test"); m_CamProcedureCall = m_CamProcedure.CreateCall(); } catch (Exception df) { string s = "a"; // Fun_Add_lb_Info("文件读取失败!" + df.Message); } #endregion }