! Smart Package Robot 's Script language

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > ! User-Macros >

! Smart Package Robot 's Script language

Point-Convert Library

Previous Top Next


Sample Code

 

Point-Convert-Lib.mrt

 

These Macro-Commands can be used to convert Point and RECT Variables into each other.

You'll find this file also in the file "Point_Convert-Lib.mrt" in the User-Library Folder.

To use this Library in your Script you can copy the file into your Project folder and add the following Line at the end of your Script-Code:

 

    #INC:Point_Convert-Lib.mrt

 

 

' Sample Call: 

VAP.$$MYP=10,20

%Point_to_Vars $$MYP|$$XPA|$$YPA

MBX.$$XPA+$$YPA

 

'Sample Call:

VAC.$$REC=10,20,30,40

%Rect_to_Point $$REC|$$REA|$$REB

MBX.$$REA+$$REB

 

'Sample Call:

VAC.$$REC=10,20,30,40

%Rect_to_Vars $$REC|$$XPA|$$YPA|$$XPB|$$YPB

DBP.$$XPA+$$YPA+$$XPB+$$YPB

 

 

'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

' Point-Convert Commands-Library

'-----------------------------------------------------------

' A Point-Variable contains a X and an Y-Value, delimited by a comma.

' Example: VAP.$$POI=210,450

' To split a Point-Varibale into its two numbers you can use this Macro.

'-----------------------------------------------------------

'

' Convert Point-Variable to 2 Variables

%Point_to_Vars 3

VAO.§§§02

VAO.§§§03

GSB.Lab_PTV|§§§01|§§§02|§§§03

END%

 

:Lab_PTV

SAV.Save|$$P01|$$P02|$$P03

VAP.$$P01=§§_01

GES.b|$$P01|,|$$P02

GES.d|$$P01|,|$$P03

VAI.§§_02=$$P02

VAI.§§_03=$$P03

SAV.Restore

RET.

 

'

'-----------------------------------------------------------

' Convert RECT into 2 Point-Variables

'

'-----------------------------------------------------------

 

'VAC.$$REC=10,20,30,40

'%Rect_to_Point $$REC|$$REA|$$REB

'MBX.$$REA+$$REB

: %Rect_to_Point 3

VAO.§§§02

VAO.§§§03

GSB.Lab_RTP|§§§01|§§§02|§§§03

END%

 

:Lab_RTP

SAV.Save|$$P01|$$P02|$$P03

VAC.$$P01=§§_01

SBM.$$P01|,|1|2|$$P02

SBM.$$P01|,|3|4|$$P03

VAR.$$P01=,$sp$

VBT.$$P02|$$P01

VBT.$$P03|$$P01

VAI.§§_02=$$P02

VAI.§§_03=$$P03

SAV.Restore

RET.

 

'-----------------------------------------------------------

' Convert RECT into 4 Numeric-Variables

' 10,20,30,40 -> $$VA1,$$VA2,$$VA3,$$VA4

'-----------------------------------------------------------

'

: %Rect_to_Vars 5

VAO.§§§02

VAO.§§§03

VAO.§§§04

VAO.§§§05

GSB.Lab_RTV|§§§01|§§§02|§§§03|§§§04|§§§05

END%

 

:Lab_RTV

SAV.Save|$$P01|$$P02|$$P03|$$P04|$$P05|$$P06|$$P07|$$P08|$$P09|$$NUA

VAC.$$P09=§§_01

VAO.$$P01=§§_02

VAO.$$P02=§§_03

VAO.$$P03=§§_04

VAO.$$P04=§§_05

VAR.$$P07=,$sp$

VAN.$$NUA=1

GSB.Lab_RTVA

VAI.$$P01=$$P05

VAI.$$P02=$$P06

VAN.$$NUA=3

GSB.Lab_RTVA

VAI.$$P03=$$P05

VAI.$$P04=$$P06

SAV.Restore

RET.

 

:Lab_RTVA

SBM.$$P09|,|$$NUA|($$NUA+1)|$$P08

VBT.$$P08|$$P07

%Point_to_Vars $$P08|$$P05|$$P06

RET.

 

'-----------------------------------------------------------