F_VN_ConvertContainerType

F_VN_ConvertContainerType 1:

Converts a container to another type (Struct element types are not supported).

Syntax

Definition:

FUNCTION F_VN_ConvertContainerType : HRESULT
VAR_INPUT
    ipSrcContainer  : ITcVnContainer;
    ipDestContainer : Reference To ITcVnContainer;
    nDestTypeGuid   : GUID;
    hrPrev          : HRESULT;
END_VAR

F_VN_ConvertContainerType 2: Inputs

Name

Type

Description

ipSrcContainer

ITcVnContainer

Source container

ipDestContainer

Reference To ITcVnContainer

Returns the converted container

nDestTypeGuid

GUID

Specifies the destination container type for the conversion

hrPrev

HRESULT

HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.)

F_VN_ConvertContainerType 3: Return value

HRESULT

Further information

The function F_VN_ConvertContainerType converts a container into a container type that is to be specified.

The global ContainerType constants can be used to determine the container type via the parameter nTypeGuid.

HRESULT

70E

INCOMPATIBLE

The same interface pointer is used as the input container and result container, or a container that has specified a different type to that in nDestTypeGuid is used as an interface pointer.

Application

A typical use case, for example, is the conversion of a container so that it can be drawn in an image. A contour of the type ContainerType_Vector_TcVnPoint2_REAL, as is returned among others by the function F_VN_LocateEllipseExp, can be converted into the type ContainerType_Vector_TcVnPoint2_DINT in order to be able to draw it in an image using the function F_VN_DrawContours:

hr := F_VN_LocateEllipseExp(ipImage, stEllipse, […], ipContourPoints, hr);
hr := F_VN_ConvertContainerType(
    ipSrcContainer  :=  ipContourPoints,
    ipDestContainer :=  ipContourToDraw,
    nDestTypeGuid   :=  ContainerType_Vector_TcVnPoint2_DINT,
    hr
);
hr := F_VN_DrawContours(ipContourToDraw, -1, ipImageDisp, aBlue, 5, hr);

Required License

TC3 Vision Base

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4024.54 or later

PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU

Tc3_Vision