Creating a Vision Application: Working with the Generated ApplicationCognex VisionPro
Working with the Generated Application

The application that the Application Wizard generated is designed to be easy for your users to operate. It's also designed to make it easier for you to make adjustments without having to regenerate the application. In this section, you'll learn how to run the generated application, and how to make changes to the underlying QuickBuild application.

Setup

When you run your application you have the option to display a logo on the screen in the lower right-hand corner, and to include a text message that is displayed when the operator clicks the About.. button. To add a logo include a file containing the bit-mapped logo and named "logo.bmp" in the same directory as your application's .exe file. To include a text message include the text in a file named "about.txt" in the same directory.

The following is the initial screen.

storyGA gabegin

  1. Our example was created with a login requirement. Since the example will require changing the application configuration we need to login at the Administrator level. Choose Administrator from the Current login: pull-down list.
  2. The Password dialog appears. Enter the Administrator password and click OK.

    storyGA gapassword

    The Configuration button becomes enabled and is no longer greyed out.

    storyGA gaappoption 1

  3. Click the Configuration... button. The Configuration dialog appears.

    storyGA gaappoption 2

    Click on the Application Options... button.

    storyGA gaappoption 3

    The options shown are the default options created for the application when you ran QuickBuild. You can change the options here if you wish and the changes will become permanent. The default state starts your application Online. This makes your I/O lines active while running the application. The state Online or Offline state is always displayed at the top of the screen. For more information about I/O lines and their Online/Offline state see Online and Offline.

  4. Click OK to continue.
Running the Generated Application

  1. Click the Run Once button to run your application.

    storyGA garuntwice

  2. Each time you click the button, a new result image appears in the display.
  3. The values of the items in the CogJob1 tab are updated.
  4. Each result appears in the job history. A green circle indicates an accept-level result; a red square indicates a reject-level result. Since the initial value of the NumberToFind field is -1, you're not going to encounter any failures. However, remember that this field is connected to an input property in the Results Analysis tool that specifies the minimum number of coins to find.
  5. Change the NumberToFind to 3.

    storyGA garunfail

  6. Click Run Once until you see an image with fewer than 3 coins. The reject-level result is added to the job history.
  7. Click the Run Continuously button to see how the application is working.
Making Changes in the QuickBuild Application

As your application runs, you may notice that the PMAlign tool is finding the minimum number of coins, but not finding all the coins in an image.

  1. The problem is that the ApproxNumberToFind parameter is set to 3.

    storyGA gaunfound

  2. So while the application is finding coins, it sometimes misses one that's above the approximate number to find. Remember that the ApproxNumberToFind field here is from the Posted Items list and reflects the Approx. no. to find setting in the PMAlign tool.
  3. If your application is still running, click the Stop button.
  4. Click the Configuration button.

    storyGA gaconfig

  5. When the Configuration dialog opens, click QuickBuild.
  6. A QuickBuild window opens in front of the generated application. Double-click on CogJob1 to open the Job Editor.

    storyGA gaquickbuildoverga

  7. When the Job Editor appears, double-click CogPMAlignTool1 to open the PMAlign tool edit control.
  8. In the PMAlign tool edit control, click the Run Params tab.

    storyGA gapmrunparams

  9. Change the Approx. no. to find parameter to 10.
  10. Close the QuickBuild window. This will close the PMAlign tool, the Job Editor, and QuickBuild.
  11. QuickBuild asks you if you want to save the changes you have made to the underlying QuickBuild application. Click Yes.

    storyGA gaconfirmchange

  12. Click the Run Once button once more.

    storyGA gaafterchange

  13. The change to the Approx. no. to find field in the PMAlign tool appears for this run of the application.
  14. Remember that fields displaying Posted Items contain historical results. If you click on one of the previous results in the job history, you'll see the old value of ApproxNumToFind.
Where To Go Next

You've learned the basics of creating a QuickBuild application. VisionPro and QuickBuild provide a very rich development environment.