Multiple Fixture ToolsCognex VisionPro

The CogFixtureTool and CogFixtureNPointToNPointTool work by establishing a new space in an image's coordinate space tree. Typically, you define this new space based on the location of one or more image features.

When you create a new CogFixtureTool or CogFixtureNPointToNPointTool, the SpaceToOutput of the new fixtured space defaults to Fixture for the CogFixtureTool and N-Point Fixture for the CogFixtureNPointToNPointTool (although you can specify any name).

Whenever you add a new space to an image's coordinate space tree, if the space tree already contains a space with the same name as the space being added, the new space replaces the existing space. This behavior can cause unexpected results in cases where multiple fixture tools are used to add fixtured spaces to the same image, such as when a single job or tool group needs to create multiple fixtures in the input image. Unless you take care to specify different names for each fixture tools' fixtured space name, each fixture tool will replace the previous fixture tool's fixtured space with its fixtured space. Graphics and vision tool results will then all be displayed and reported in the last fixture's space, not their correct spaces.

This issue is referred to as fixtured space name collision.

Fixtured Space Name Collision Handling

Starting with version 6.0, VisionPro provides more sophisticated handling of fixtured space name collisions.

When a CogFixtureTool or CogFixtureNPointToNPointTool's underlying operator adds the fixtured space to the image's space tree, which happens as part of the operator's Execute method , it checks to see if a space with the same name is already present in the image's space tree. If the image's space tree already contains a space with the given name, the function still replaces the existing space with the new space. In addition, if the Execute method determines that the existing space was added by a different tool (as would be the case if two fixture tools were adding spaces to the same image), it throws an exception (CogSpaceTreeFixturedSpaceNameCollisionException). If the operator is being called by a fixture tool, the tool catches the exception and adds it to the tool's RunStatus, which causes it to appear as a message in the status bar of the tool's edit control window.

Using the New Feature

If you have properly configured the fixture tools in your application so that each distinct fixtured space has a unique name, the change to fixtured space name collision handling will have no effect on your application. If your application contains multiple independent fixture tools that attempt to update the same image's coordinate space tree using the same fixtured space name, you will see a warning message in the tool's status bar, if you are running QuickBuild, or your program will encounter an exception, if you are programming against the operators directly.

Maintaining Compatibility

The new collision handling behavior is enabled by default for newly created fixture tools and disabled by default for existing tools that are depersisted from .VPP files. You can explicitly enable the new collision handling behavior by setting the FixturedSpaceNameDuplicateHandling property to CogFixturedSpaceNameDuplicateHandlingConstants or disable it by setting the FixturedSpaceNameDuplicateHandling property to CogFixturedSpaceNameDuplicateHandlingConstants. You can also use the fixture tool's edit controls to set the property.