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

Weiterführende Informationen

Die Funktion F_VN_ConvertContainerType konvertiert einen Container in einen anzugebenden Container-Typ.

Zur Festlegung des Container-Typs über den Parameter nTypeGuid können die globalen ContainerType-Konstanten verwendet werden.

HRESULT

70E

INCOMPATIBLE

Als Eingangscontainer und als Ergebniscontainer wird derselbe Interface Pointer verwendet oder als Interface Pointer wird ein Container verwendet, der einen anderen Typ als den in nDestTypeGuid angegebenen hat.

Anwendung

Ein typischer Anwendungsfall ist zum Beispiel die Konvertierung eines Containers, um diesen in ein Bild einzeichnen zu können. Eine Kontur von Typ ContainerType_Vector_TcVnPoint2_REAL, wie sie unter anderem von der Funktion F_VN_LocateEllipseExp zurückgegeben wird, kann in den Typ ContainerType_Vector_TcVnPoint2_DINT konvertiert werden, um diese mit der Funktion F_VN_DrawContours in ein Bild einzeichnen zu können:

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