User Tools

Site Tools


tng:settings:settings-program_options_events

Program Options - Events


OnStart script example
This script will print time when program started and other available arguments.
If program is not started from beginning it will move to start position at safe height and display dialog.

#<dt> = DateTime[]
#<hh> = Hour[#<dt>]
#<mm> = Minute[#<dt>]
#<ss> = Second[#<dt>]
(print,OnStart script @ #<hh,0>:#<mm,0>:#<ss,0>)
(print,  Line: #<line,0>)
(print,  PosState: X#<posstate_x,3> Y#<posstate_y,3> Z#<posstate_z,3>)
(print,  Units: #<_units,0>)
(print,  Plane: #<_plane,0>)
(print,  DistanceMode: #<_distancemode,0>)
(print,  DistanceModeIJK: #<_distancemode_ijk,1>)
 
O<chk> if [#<line>]
  (print,  MistState: #<miststate,0>)
  (print,  FloodState: #<floodstate,0>)
  (print,  SpindleState: #<spindlestate,0>)
  (print,  MotorsState: #<motorsstate,0>)
  (print,  LimitsState: #<limitsstate,0>)
 
  #<dstmd> = #<_distancemode>
  G90
 
  G53 G00 Z#<_tooloff_safeheight>
  G53 G00 X#<posstate_x> Y#<posstate_y> 
 
  G09
  (dlgname,Start From Line, opt=1)
  (dlg,Click OK to continue from line #<line,0>, typ=label, x=20, w=250, color=0xffa500)
  (dlgshow)
 
  G53 G00 Z#<posstate_z>
 
  #<_distancemode> = #<dstmd>
 
O<chk> endif

OnEnd script example
This script will print time when program ended and other available arguments.
It will also calculate 'Run Time Correction' factor.

#<dt> = DateTime[]
#<hh> = Hour[#<dt>]
#<mm> = Minute[#<dt>]
#<ss> = Second[#<dt>]
(print,OnEnd script @ #<hh,0>:#<mm,0>:#<ss,0>)
(print,  Line: #<line,0>)
(print,  Runtime: #<runtime,1>)
 
#<cor> = [1 - [#<runtime> - #<_prog_totaltimebest>] / [#<_prog_totaltimeworst> - #<_prog_totaltimebest>]]
(print,  Run Time Correction: #<cor,2>)

OnStop script example
This script will turn spindle and coolant off if program is stopped.

(print,OnStop script)
(print,  Line: #<line,0>)
 
M5
M9
tng/settings/settings-program_options_events.txt · Last modified: 2023/04/19 13:59 by andrej

Page Tools