CogCoordinateSpaceTree AddSpace Method Cognex VisionPro 9.22 SR1
Add a new coordinate space, with the given name and transform, to this tree. Attach it to the specified pre-existing parent space.

Namespace: Cognex.VisionPro
Assembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 87.1.0.0
Syntax

public void AddSpace(
	string parentSpaceName,
	string newSpaceName,
	ICogTransform2D parentFromNew,
	bool copyTransform,
	CogAddSpaceConstants duplicateHandling
)

Parameters

parentSpaceName
Type: System String

A valid nonqualified or fully-qualified space name that indicates the parent space.

newSpaceName
Type: System String

A valid nonqualified or fully-qualified space name for the user coordinate space to add.

parentFromNew
Type: Cognex.VisionPro ICogTransform2D

An CogTransform2D that transforms points from the space you are adding to the parent user space.

copyTransform
Type: System Boolean

If True, CogCoordinateSpaceTree adds a copy of the transform to the tree; if False, a reference to the transform is added. . defaults to True.

duplicateHandling
Type: Cognex.VisionPro CogAddSpaceConstants

A CogAddSpaceConstants value that specifies what do if the parent coordinate space already contains an immediate child with the same name as newSpaceName. The options are to return an error, replace the transform of the named child, or do nothing. . defaults to DuplicateIsError: it treats a duplicate as an error.

Exceptions

ExceptionCondition
CogSpaceTreeInvalidNameSyntaxException

newSpaceName is not a valid nonqualified name.

ArgumentException

parentFromNew is NULL.

ArgumentException

duplicateHandling value is not a member of CogAddSpaceConstants.

CogSpaceTreeDuplicateChildNameException

Both newSpaceName is a child of the parent space and duplicateHandling is set to DuplicateIsError.

CogSpaceTreeInvalidNameSyntaxException

parentSpaceName value is not a legal space name.

CogSpaceTreeNameNotUniqueException

parentSpaceName is a nonqualified space name and more than one instance of it exists in this tree.

Remarks

Adds a new user coordinate space to a CogCoordinateSpaceTree object. You must specify the name of the parent space for the newly added space, and supply a transformation that defines the relationship between the parent space and the new space.

To indicate that the parent space is the root space, use the name syntax "@"; to indicate that the current selected space is the parent space, use "." as the name syntax.

By default, AddSpace(String, String, ICogTransform2D, Boolean, CogAddSpaceConstants) saves a copy of the supplied transform. You can also add the transform by-reference. Although this is more efficient, it may result in errors for users who unknowingly continue to modify the original transform object.

See Also