Example #1
0
        internal void DrawExpectLine(HWindow_Final myHwindow)
        {
            if (inputImage != null)
            {
                try
                {
                    myHwindow.DrawModel = true;
                    myHwindow.Focus();
                    HOperatorSet.SetColor(myHwindow.hWindowControl.HalconWindow, new HTuple("green"));
                    HOperatorSet.DrawRectangle2Mod(myHwindow.hWindowControl.HalconWindow, expectRecStartRow, expectRecStartColumn, expectAngle, length1, length2,
                                                   out expectRecStartRow, out expectRecStartColumn, out expectAngle, out length1, out length2);

                    if (inputPose != null)
                    {
                        templatePose.X = inputPose.X;
                        templatePose.Y = inputPose.Y;
                        templatePose.U = inputPose.U;
                    }
                    // 输入
                    FormCaliper.Instance.tbx_expectCenterRow.Text = expectRecStartRow.TupleString("10.3f");
                    FormCaliper.Instance.tbx_expectCenterCol.Text = expectRecStartColumn.TupleString("10.3f");
                    FormCaliper.Instance.tbx_expectPhi.Text       = expectAngle.TupleString("10.3f");
                    // 参数
                    FormCaliper.Instance.tbx_caliperLength1.Text = length1.TupleString("10.3f");
                    FormCaliper.Instance.tbx_caliperLength2.Text = length2.TupleString("10.3f");

                    myHwindow.DrawModel = false;

                    // Run();
                }
                catch (Exception ex)
                {
                    FormCaliper.Instance.TextBoxMessageDisp(ex.Message, System.Drawing.Color.Red);
                }
            }
            else
            {
                FormCaliper.Instance.TextBoxMessageDisp("图像为空", System.Drawing.Color.Red);
            }
        }
Example #2
0
        internal void DrawExpectLine(HWindow_Final myHwindow)
        {
            if (inputImage != null)
            {
                try
                {
                    myHwindow.DrawModel = true;
                    myHwindow.Focus();
                    HOperatorSet.SetColor(myHwindow.hWindowControl.HalconWindow, new HTuple("green"));
                    Stopwatch sw = new Stopwatch();
                    sw.Restart();
                    HOperatorSet.DrawLineMod(myHwindow.hWindowControl.HalconWindow, newExpectLineStartRow, newExpectLineStartCol, newExpectLineEndRow, newExpectLineEndCol, out expectLineStartRow, out expectLineStartCol, out expectLineEndRow, out expectLineEndCol);

                    if (inputPose != null)
                    {
                        templatePose.X = inputPose.X;
                        templatePose.Y = inputPose.Y;
                        templatePose.U = inputPose.U;
                    }

                    FormFindLine.Instance.tbx_expectLineStartRow.Text = expectLineStartRow.TupleString("10.3f");
                    FormFindLine.Instance.tbx_expectLineStartCol.Text = expectLineStartCol.TupleString("10.3f");
                    FormFindLine.Instance.tbx_expectLineEndRow.Text   = expectLineEndRow.TupleString("10.3f");
                    FormFindLine.Instance.tbx_expectLineEndCol.Text   = expectLineEndCol.TupleString("10.3f");
                    myHwindow.DrawModel = false;

                    Run(SoftwareRunState.Debug);
                }
                catch (Exception ex)
                {
                    FormFindLine.Instance.SetToolStatus($"编辑卡尺时工具出现异常!{ex}", ToolRunStatu.Tool_Run_Error);
                }
            }
            else
            {
                FormFindLine.Instance.SetToolStatus("输入图像为空!", ToolRunStatu.Not_Input_Image);
            }
        }
Example #3
0
        internal void DrawExpectLine(HWindow_Final myHwindow)
        {
            if (inputImage != null)
            {
                try
                {
                    myHwindow.DrawModel = true;
                    myHwindow.Focus();
                    HOperatorSet.SetColor(myHwindow.hWindowControl.HalconWindow, new HTuple("green"));
                    HOperatorSet.DrawLineMod(myHwindow.hWindowControl.HalconWindow, newExpectLineStartRow, newExpectLineStartCol, newExpectLineEndRow, newExpectLineEndCol, out expectLineStartRow, out expectLineStartCol, out expectLineEndRow, out expectLineEndCol);

                    if (inputPose != null)
                    {
                        templatePose.X = inputPose.X;
                        templatePose.Y = inputPose.Y;
                        templatePose.U = inputPose.U;
                    }

                    FormFindLine.Instance.tbx_expectLineStartRow.Text = expectLineStartRow.TupleString("10.3f");
                    FormFindLine.Instance.tbx_expectLineStartCol.Text = expectLineStartCol.TupleString("10.3f");
                    FormFindLine.Instance.tbx_expectLineEndRow.Text   = expectLineEndRow.TupleString("10.3f");
                    FormFindLine.Instance.tbx_expectLineEndCol.Text   = expectLineEndCol.TupleString("10.3f");
                    myHwindow.DrawModel = false;

                    Run();
                }
                catch (Exception ex)
                {
                    FormFindLine.Instance.TextBoxMessageDisp(ex.Message, System.Drawing.Color.Red);
                }
            }
            else
            {
                FormFindLine.Instance.TextBoxMessageDisp("图像为空", System.Drawing.Color.Red);
            }
        }