# MCV_BlockSearchSetFileOffset

This block search defines a range in which real axis motions can be executed by specifying a continuation/end position (start/end flag) using file offset.

The continuation position is defined by the values at the “Start...” inputs of the function block. The end position is defined by the values at the “End...” inputs.

## Notice

File offset must be specified so that it describes the start of a line in a particular NC program (main program, global subroutine). A possible existing block number (N word) also belongs to the NC line.

Options also include assigning values for the "StartPassCounter" input and all "End…” inputs.

If the "End…" inputs assign no values, the NC program is executed with real axis motions up to NC program end M30 after the continuation position is found.

If the “End...” inputs were assigned values and the defined end position is reached, execution is aborted and the NC program ends immediately.

Block diagram

FB parameters

VAR_IN_OUT
Variable name | Data type | Description
AxesGroup | AXES_GROUP_REF | Axis group reference

VAR_INPUT
Variable name | Data type | Description
Execute | BOOL | The values of the inputs are transferred to the MC on the rising edge to define the search for the continuation position.
CoveredDistance | LREAL | If the continuation position searched for is not at the start of the NC program line defined by the value specified at the “BlockCount” input, this input specifies which portion of the distance programmed in the NC program line defines the continuation position.

Unit: 0.1%

DistProgStart | LREAL | This defines the continuation position search for by means of the distance covered since program start or since the last NC command #DISTANCE PROG START CLEAR. This can also define a continuation position located between the start and end of a motion block.

Unit: 0.1µm

AutoReturn | BOOL | This option defines whether the axes are enabled to move directly to the continuation position after the continuation position is found and after the signal that the MC is waiting for the enable to move to the contour ("WaitReturnToPath" output at the FB MCV_BlockSearchCtrl).

If this option is TRUE, the value at the “Deviation” input is not invoked to check the deviation between the continuation position and the actual position of the axes.

NoHoldAtRestart | BOOL | If this input is TRUE, the NC program continues its execution immediately after the enable signal to move to the contour without any further user input.
Deviation | UDINT | The value defines the maximum permissible deviation of the axis position from the continuation position after the continuation position is found. Unit: 0.1µm
BreakpointPosition | LREAL | Indicates an additional breakpoint position as distance from program start. The breakpoint must be located after the continuation position. Unit: 0.1µm
StartFileOffset | DINT | Defines the continuation position by specifying the file offset of an NC line in the NC program. Note: File offset must therefore always point to the start of a line in the NC program. It may also contain an existing block number.
StartFileName | MCV_FILENAME_STR | This is the file name of the file containing the NC program in which the continuation position is located.
StartPathType | UINT | Defines whether the file specified at the “StartFileName” input is located in the path of the NC main programs or NC subroutines: Possible values: 0 – main program path (default value) 1 – subroutine path
StartPassCounter | DINT | The counter indicating the number of times the program is to start before the value is checked by the StartFileOffset input is checked to determine the continuation position. Note: The value 0 (default value) for the counter means that only the StartFileOffset determines the continuation position. This means that the same behaviour is obtained for block search for the values 0 and 1.
EndFileOffset | DINT | Defines the end position by specifying the file offset of an NC line in the NC program. Note: File offset must therefore always point to the start of a line in the NC program. It may also contain an existing block number.
EndFileName | MCV_FILENAME_STR | This is the file name of the file containing the NC program in which the end position is located.
EndPathType | UINT | Defines whether the file specified at the “EndFileName” input is located in the path of the NC main programs or NC subroutines: Possible values: 0 – main program path (default value) 1 – subroutine path
EndPassCounter | DINT | The counter indicating the number of times the program is to start before the value is checked by the EndFileOffset input is checked to determine the breakpoint. Note: The value 0 (default value) for the counter means that only EndFileOffset determines the continuation position. This means that the same behaviour is obtained for block search for the values 0 and 1.

VAR_OUTPUT
Variable name | Data type | Description
Done | BOOL | TRUE indicates that the block search parameters were successfully written to the motion controller.
Busy | BOOL | TRUE indicates that the FB is executing a command
Error | BOOL | TRUE indicates that an error occurred
ErrorID | WORD | Error identifier