09-25-2019, 11:02 PM
Hi John,
With APT files you can use the commandsCALLto provoke a program call andCODEto output any code. The main difference is that when you use CALL, the post processor takes care of generating the code syntax, when you use CODE, you need to provide the full syntax the robot controlller needs.
For example, on a Motoman robot:
CALL Program1will outputCALL JOB:Program1
whereas:
CODE Program1will outputProgram1
Other than the GOTO commands you can use the commands provided in this example:
$$ This line is a comment
$$ Fast move to X,Y,Z (uses RoboDK rapid speed, 1000 mm/s by default, you can change it in Program Events)
RAPID
GOTO 0 0 100
$$ Define the cutter:
$$ CUTTER/ Diameter (D), Radius (Rc), (ignored), (ignored), (ignored), (ignored), Length
$$ RoboDK will automatically create a cutter if you activate:
$$ Tools-Options-CAM-Automatically create cutters
CUTTER/ 4, 1, 3, 2, 0, 0, 20
$$ Provoke a tool change event such as SetTool(2) (default event settings)
$$ RoboDK will automatically split to one program per tool if you activate:
$$ Tools-Options-CAM-Automatically set one project per tool
LOADTL/2,1
$$ set the TCP speed:
FEDRAT/ 500.0,MMPM
$$ move to X,Y,Z,i,k,k
GOTO / 0 0 0 0 0 1
$$ move to X,Y,Z,i,k,k
GOTO / 100 0 0 0 0 1
$$ Next line is a program call
CALL ProgramCall
$$ Next line is a program passing parameters, for example, XYZ values
$$ The macro shows an example to simulate the movement: C:/RoboDK/Library/Macros/CallNC.py
$ $这个文件需要被添加到RoboDK station
CALL CallNC(100,0,-25)
$$ move to X,Y,Z,i,k,k
GOTO / 100 0 0 0 0 1
$$ move to X,Y,Z,i,k,k
GOTO / 0 0 0 0 0 1
$$ Next line is a raw input line (supported with a new release next week)
CODE RawLine;
PPRINT Turning Digital Output 12 to ON
SET 12 ON
PPRINT Pause 5 seconds
DWELL 5
PPRINT Turning Digital Output 12 to OFF
SET 12 OFF
PPRINT Wait Digital Input 12 to turn OFF
WAIT 12 OFF
$$ Inputs and outputs are simulated using station variables
$$ for example, using the API you can call:
$$ RDK.setParam('IO_12',1)
$$ You can also have a timed out wait:
$$WAIT 10 ON TIMEOUT 5
With APT files you can use the commandsCALLto provoke a program call andCODEto output any code. The main difference is that when you use CALL, the post processor takes care of generating the code syntax, when you use CODE, you need to provide the full syntax the robot controlller needs.
For example, on a Motoman robot:
CALL Program1will outputCALL JOB:Program1
whereas:
CODE Program1will outputProgram1
Other than the GOTO commands you can use the commands provided in this example:
$$ This line is a comment
$$ Fast move to X,Y,Z (uses RoboDK rapid speed, 1000 mm/s by default, you can change it in Program Events)
RAPID
GOTO 0 0 100
$$ Define the cutter:
$$ CUTTER/ Diameter (D), Radius (Rc), (ignored), (ignored), (ignored), (ignored), Length
$$ RoboDK will automatically create a cutter if you activate:
$$ Tools-Options-CAM-Automatically create cutters
CUTTER/ 4, 1, 3, 2, 0, 0, 20
$$ Provoke a tool change event such as SetTool(2) (default event settings)
$$ RoboDK will automatically split to one program per tool if you activate:
$$ Tools-Options-CAM-Automatically set one project per tool
LOADTL/2,1
$$ set the TCP speed:
FEDRAT/ 500.0,MMPM
$$ move to X,Y,Z,i,k,k
GOTO / 0 0 0 0 0 1
$$ move to X,Y,Z,i,k,k
GOTO / 100 0 0 0 0 1
$$ Next line is a program call
CALL ProgramCall
$$ Next line is a program passing parameters, for example, XYZ values
$$ The macro shows an example to simulate the movement: C:/RoboDK/Library/Macros/CallNC.py
$ $这个文件需要被添加到RoboDK station
CALL CallNC(100,0,-25)
$$ move to X,Y,Z,i,k,k
GOTO / 100 0 0 0 0 1
$$ move to X,Y,Z,i,k,k
GOTO / 0 0 0 0 0 1
$$ Next line is a raw input line (supported with a new release next week)
CODE RawLine;
PPRINT Turning Digital Output 12 to ON
SET 12 ON
PPRINT Pause 5 seconds
DWELL 5
PPRINT Turning Digital Output 12 to OFF
SET 12 OFF
PPRINT Wait Digital Input 12 to turn OFF
WAIT 12 OFF
$$ Inputs and outputs are simulated using station variables
$$ for example, using the API you can call:
$$ RDK.setParam('IO_12',1)
$$ You can also have a timed out wait:
$$WAIT 10 ON TIMEOUT 5