MC_AddAxisToGroup
TF5410  | TF5420  | |
|---|---|---|
  | MC Group with Pick-and-Place  | MC Group Coordinated Motion  | 
  | 
  | 
  | 
The function block MC_AddAxisToGroup adds an axis to a group.
![]()  | From V3.1.10.1, stationary axes can be added to and removed from a CA group in the GroupMoving group state. If a moving axis is added to a group, the command is rejected with an error message (a change of the group state with a moving axis is also rejected).  | 
![]()  | Only axes in GroupDisabled or GroupErrorDisabled state can be added to a MC group.  | 
 Inputs
VAR_INPUT
    Execute               : BOOL;
    IdentInGroup          : IDENT_IN_GROUP_REF;
END_VARName  | Type  | Description  | 
|---|---|---|
Execute  | BOOL  | The command is triggered by a rising edge at this input.  | 
IdentInGroup  | IDENT_IN_GROUP_REF  | Defines the interpretation of the axis to be added to the group. For multi-dimensional motions, this can be the Cartesian interpretation. The global variables (e.g. MCS_X) must be used. For Collision Avoidance the function UDINT_TO_IDENTINGROUP must be used.  | 
 Inputs/outputs
VAR_IN_OUT
    AxesGroup             : AXES_GROUP_REF;
    Axis                  : AXIS_REF; 
END_VARName  | Type  | Description  | 
|---|---|---|
AxesGroup  | AXES_GROUP_REF  | Reference to a group of axes (see Cyclic Group Interface).  | 
Axis  | AXIS_REF  | Reference to an axis (see AXIS_REF).  | 
 Outputs
VAR_OUTPUT
    Done                  : BOOL;
    Busy                  : BOOL;
    Error                 : BOOL;
    ErrorId               : UDINT;
END_VARName  | Type  | Description  | 
|---|---|---|
Done  | BOOL  | This output becomes TRUE when the command was successfully executed.  | 
Busy  | BOOL  | This output becomes TRUE when the command is started with Execute and remains so as long as the function block executes the command. If Busy becomes FALSE again, the function block is ready for a new command. At the same time one of the outputs Done, CommandAborted (if available) or Error is set.  | 
Error  | BOOL  | This output becomes TRUE if an error has occurred during command execution.  | 
ErrorId  | UDINT  | Contains the command-specific error code of the last executed command. Details of the error code can be found in the ADS error documentation or in the NC error documentation (error codes 0x4nnn and 0x8nnn).  | 
Sample for TwinCAT 3 Motion Pick-and-Place
Multi-dimensional movements
![]()  | Multi-dimensional movements are only applicable when TF5420 is used.  | 
VAR_GLOBAL CONSTANT
    cAxesCount           : UINT := 4;
END_VAR 
VAR
    stGroupRef            : AXES_GROUP_REF; // link to MC Group
    stAxis                : ARRAY[1..cAxesCount] OF AXIS_REF;
    fbAddAxis             : ARRAY[1..cAxesCount] OF MC_AddAxisToGroup;
    i                     : UINT;
END_VARfbAddAxis[1].IdentInGroup := MCS_X; //X-Axis
fbAddAxis[2].IdentInGroup := MCS_Y; //Y-Axis
fbAddAxis[3].IdentInGroup := MCS_Z; //Z-Axis
fbAddAxis[4].IdentInGroup := MCS_C1;//1st rotation is C-rotation (around Z-Axis)
FOR i:=1 TO cAxesCount DO
    fbAddAxis[i](
    AxesGroup:=stGroupRef, 
    Axis := stAxis[i], 
    Execute := TRUE);
END_FORSample for TF5410 TwinCAT 3 Motion Collision Avoidance
PTP with Collision Avoidance
![]()  | PTP with Collision Avoidance is only applicable when TF5410 is used.  | 
VAR_GLOBAL CONSTANT
    cAxesCount            : UDINT:=10;
END_VAR 
VAR
    stGroupRef            : AXES_GROUP_REF; // link to CA Group
    stAxis                : ARRAY[1..cAxesCount] OF AXIS_REF;
    fbAddAxis             : ARRAY[1..cAxesCount] OF MC_AddAxisToGroup;
    i                     : UDINT;
END_VARFOR i:=1 TO cAxesCount DO
    fbAddAxis[i](
        AxesGroup:=stGroupRef, 
        Axis := stAxis[i], 
        IdentInGroup := UDINT_TO_IDENTINGROUP(i),
        Execute := TRUE);
END_FORRequirements
Development environment  | Target platform  | PLC libraries   | 
|---|---|---|
TwinCAT V3.1.4018.26 TF5400 Advanced Motion Pack V3.1.1.17  | PC or CX (x64)  | Tc3_McCoordinatedMotion, Tc2_MC2  | 


