コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public void ToolRun(string jobName, int toolIndex, int inputItemNum, TreeNode selectNode, List <IToolInfo> L_toolList)
        {
            Caliper   myCaliper = (Caliper)L_toolList[toolIndex].tool;
            VisionJob myJob     = VisionJobParams.pVisionProject.Project[jobName];

            for (int j = 0; j < inputItemNum; j++)
            {
                if (L_toolList[toolIndex].toolInput[j].IOName == "InputImage" && L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value == null)
                {
                    selectNode.ForeColor = Color.Red;
                    Logger.LoggerClass.WriteLog($"{L_toolList[toolIndex].toolName} 无输入图像");
                    break;
                }
                else
                {
                    if (L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value != null)
                    {
                        string sourceFrom     = L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value.ToString();
                        string sourceToolName = Regex.Split(sourceFrom, " . ")[0];
                        sourceToolName = sourceToolName.Substring(3, Regex.Split(sourceFrom, " . ")[0].Length - 3);
                        string toolItem = Regex.Split(sourceFrom, " . ")[1];
                        if (L_toolList[toolIndex].toolInput[j].IOName == "InputImage")
                        {
                            myCaliper.inputImage = myJob.GetToolInfoByToolName(sourceToolName).GetOutput(toolItem).value as HObject;
                        }
                        if (L_toolList[toolIndex].toolInput[j].IOName == "inputCenterRow")
                        {
                            myCaliper.expectRecStartRow = myJob.GetToolInfoByToolName(sourceToolName).GetOutput(toolItem).value as HTuple;
                        }
                        if (L_toolList[toolIndex].toolInput[j].IOName == "inputCenterCol")
                        {
                            myCaliper.expectRecStartColumn = myJob.GetToolInfoByToolName(sourceToolName).GetOutput(toolItem).value as HTuple;
                        }
                        if (L_toolList[toolIndex].toolInput[j].IOName == "inputPhi")
                        {
                            myCaliper.expectAngle = myJob.GetToolInfoByToolName(sourceToolName).GetOutput(toolItem).value as HTuple;
                        }
                    }
                }
            }
            myCaliper.Run(SoftwareRunState.Release);
            if (myCaliper.toolRunStatu == ToolRunStatu.Succeed)
            {
                myCaliper.DispMainWindow(FormImageWindow.Instance.myHWindow);
                myJob.FormLogDisp(L_toolList[toolIndex].toolName + "  运行成功", Color.Green, selectNode);
            }
            else
            {
                myJob.FormLogDisp(L_toolList[toolIndex].toolName + "  运行失败", Color.Red, selectNode);
            }
        }
コード例 #3
0
        public void CreateVisionJobTest()
        {
            VisionSettings visionSettings = new VisionSettings();

            visionSettings.Vendor = VisionSettings.VendorEnum.GOOGLEVISION;
            List <VisionSettings.DetectionTypesEnum> detectionTypes = new List <VisionSettings.DetectionTypesEnum>();

            detectionTypes.Add(VisionSettings.DetectionTypesEnum.LABEL);
            visionSettings.DetectionTypes  = detectionTypes;
            visionSettings.StorageProvider = VisionSettings.StorageProviderEnum.SUPPLIER;

            visionJob = instance.CreateVisionJob(visionSettings);
            Assert.IsInstanceOf <VisionJob> (visionJob, "response is VisionJob");
            Assert.AreEqual("UPLOADRESOURCES", visionJob.State.ToString());
        }
コード例 #4
0
        public void ToolRun(string jobName, int toolIndex, int inputItemNum, TreeNode selectNode, List <IToolInfo> L_toolList)
        {
            Type       a            = this.GetType();
            HalconTool myHalconTool = (HalconTool)L_toolList[toolIndex].tool;
            VisionJob  myJob        = VisionJobParams.pVisionProject.Project[jobName];

            myHalconTool.Run(SoftwareRunState.Release);
            if (myHalconTool.toolRunStatu != ToolRunStatu.Succeed)
            {
                myJob.FormLogDisp($"{L_toolList[toolIndex].toolName} 运行失败,失败原因:{myHalconTool.runMessage}", Color.Red, selectNode, Logger.MsgLevel.Exception);
            }
            else
            {
                myJob.FormLogDisp($"{L_toolList[toolIndex].toolName} 运行成功,{myHalconTool.runTime}", Color.Green, selectNode);
                FormImageWindow.Instance.myHWindow.HobjectToHimage(myHalconTool.outputImage);
            }
        }