public void ToolRun(string jobName, int toolIndex, int inputItemNum, TreeNode selectNode, List <IToolInfo> L_toolList)
        {
            FindLine  myFindLine = (FindLine)L_toolList[toolIndex].tool;
            VisionJob myJob      = VisionJobParams.pVisionProject.Project[jobName];

            for (int j = 0; j < inputItemNum; j++)
            {
                if (L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value == null)
                {
                    selectNode.ForeColor = Color.Red;
                    Logger.LoggerClass.WriteLog(L_toolList[toolIndex].toolName + "  无输入图像", Logger.MsgLevel.Exception);
                }
                else
                {
                    string sourceFrom = L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value.ToString();
                    if (L_toolList[toolIndex].toolInput[j].IOName == "InputImage")
                    {
                        string sourceToolName = Regex.Split(sourceFrom, " . ")[0];
                        sourceToolName = sourceToolName.Substring(3, Regex.Split(sourceFrom, " . ")[0].Length - 3);
                        string toolItem = Regex.Split(sourceFrom, " . ")[1];
                        myFindLine.inputImage = myJob.GetToolInfoByToolName(sourceToolName).GetOutput(toolItem).value as HObject;
                    }
                }
            }
            myFindLine.Run(SoftwareRunState.Release);
            if (myFindLine.toolRunStatu == ToolRunStatu.Succeed)
            {
                myFindLine.DispMainWindow(FormImageWindow.Instance.myHWindow);
                myJob.FormLogDisp(L_toolList[toolIndex].toolName + "  运行成功", Color.Green, selectNode);
            }
            else
            {
                myJob.FormLogDisp(L_toolList[toolIndex].toolName + "  运行失败", Color.Red, selectNode, Logger.MsgLevel.Exception);
            }
        }
Exemple #2
0
 public FormFindLine(ref object findLine)
 {
     InitializeComponent();
     _instance  = this;
     myToolInfo = (IToolInfo)findLine;
     myFindLine = (FindLine)myToolInfo.tool;
     //myFindLine.inputImage = ComGlobalParams.inputImageGlobal; // 暂时直接将图像传递给该工具
     myFindLine.DispImage();
 }
Exemple #3
0
 public FormFindLine(ref object findLine)
 {
     InitializeComponent();
     _instance = this;
     if (findLine.GetType().FullName != "System.Object")
     {
         myToolInfo = (IToolInfo)findLine;
         myFindLine = (FindLine)myToolInfo.tool;
         //myFindLine.inputImage = ComGlobalParams.inputImageGlobal; // 暂时直接将图像传递给该工具
         myFindLine.DispImage();
     }
 }