CogCADToRange Execute Method (String, Cog3DBox)Cognex VisionPro 9.7
Opens the CAD file and renders a range image.

Namespace: Cognex.VisionPro.CAD
Assembly: Cognex.VisionPro.CAD (in Cognex.VisionPro.CAD.dll) Version: 73.0.0.0
Syntax

public CogCADToRangeResult Execute(
	string fileName,
	Cog3DBox region
)

Parameters

fileName
Type: System String
The CAD file name. Supported file types are STEP(.STEP) and IGES(.igs) files.
region
Type: Cognex.VisionPro3D Cog3DBox
The 3D box region. The portion of the cad-shape that lies within this region is rendered. If the supplied region object is null, the entire cad-shape is rendered. The 3D region is interpreted in Projection3D coordinate space. The SelectedSpaceName3D of the region is ignored.

Return Value

Type: CogCADToRangeResult
The object containing the rendered range image.
Exceptions

ExceptionCondition
CogSecurityViolationException Licensing for this operation cannot be confirmed. See Understanding VisionPro Security for more information.
CogTimeoutExpiredException The pattern search took longer than the enabled Timeout value.
ArgumentNullException If the FileName is null.
ArgumentException If the FileName does not exist.
ArgumentException If the Region is degenerate.
ArgumentException If the FileName extension is not .step or .igs.
ArgumentNullException If the Projection3DFromCAD3DTransform is null and the RotationMode is UseRotationTransform.
ObjectDisposedException If the object has been disposed.
Remarks

The rendering process is very CPU intensive; It is recommended that you enable multithreading. The rendering process consists of the following steps:

  • The operator will open the user specified CAD file and load the cad-shape. The cad-shape is specified in CAD3D, and the coordinates are in physical units. The cad-shape is an internal object and it is not accessible to the user through the VisionPro API.
  • The cad-shape is then rotated to the viewing direction specified by Projection3D space. The rotation is done by mapping the cad-shape through a 3D rotation transform. This Projection3DFromCAD3DTransform can be provided explicitly by the user, or it can be computed internally from a user-supplied vector(in CAD3D) that specifies the 3D viewing direction.
  • The operator will then perform the orthographic projection to identify the highest intersection points between lines drawn vertically through the center of each pixel in Projection3D and the cad-shape. The projection is done from positive infinity to negative infinity along the z-axis. Optionally, the user can choose a portion of the cad-shape to render by specifying a 3D box region. The region is always interpreted in Projection3D, and any points outside the 3D box will not be rendered.
  • The intersection points are then mapped to 16-bit values using the X, Y, and Z scales that are supplied by the user.
  • If no intersection point is found, the pixel is marked as non-visible.
  • When mapping a z-value to a 16-bit integer we need to be concerned with overflow. Overflow is handled by clamping the z-value to 65535, if necessary. Underflow cannot occur because the bottom surface of the 3D region box is internally mapped to a grey level slightly above zero; therefore all points within the box will have a positive z grey-level.
  • The operator returns a final result object containing the resulting range image, a flag to indicate if overflow occurred when rendering, and the number of clamped pixels.
  • The 3D coordinate space tree in the rendered range image will have three spaces Sensor3D, Projection3D and CAD3D. The RootFromSensor3DTransform has a diagonal matrix based off the scaling factors, and the translation holds the offset between Root(@) and Sensor3D. Sensor3DFromCAD3DTransform is a rotation transform and the translation between the Sensor3D and CAD3D origins. Sensor3DFromProjection3D has only translation between Sensor3D and CAD3D origins.
  • The 2D coordinate space tree in the rendered range image will have a single space: Sensor2D. The RootFromSensor2DTransform has a the diagonal matrix based off the scaling factors, and the translation holds the offset between Root and Sensor2D.
  • Both PixelFromRootTransform3D and PixelFromRootTransform in the range image are set to identity.

See Also