save and restore path control mode

More
19 Mar 2016 15:11 #71897 by fupeama
Hi,
I call subroutine where I need save some variables (g20/g21, metric/imperial etc) and restore it at the end.
It is not problem with predefined named parameters like
#<_metric> , #<_imperial> , #<_absolute> ,#<_incremental>
but I cannot find variables for path control mode (G61, G64, G64 Px)
exist way how to do ?

Thanks Martin
The following user(s) said Thank You: JetForMe

Please Log in or Create an account to join the conversation.

More
20 Mar 2016 05:57 #71934 by Rick G
You might try saving the parameters and then using them when needed.
linuxcnc.org/docs/html/gcode/overview.html#_parameters

#<_global named parameter> is a global named parameter. They are accessible from within called subroutines and may set values within subroutines that are accessible to the caller. As far as scope is concerned, they act just like regular numeric parameters. They are not stored in files.


linuxcnc.org/docs/html/gcode/overview.ht...:numbered-parameters

Numbered Parameters Persistence

The values of parameters in the persistent range are retained over time, even if the machining center is powered down. LinuxCNC uses a parameter file to ensure persistence. It is managed by the Interpreter. The Interpreter reads the file when it starts up, and writes the file when it exits.

The format of a parameter file is shown in Table Parameter File Format.

The Interpreter expects the file to have two columns. It skips any lines which do not contain exactly two numeric values. The first column is expected to contain an integer value (the parameter’s number). The second column contains a floating point number (this parameter’s last value). The value is represented as a double-precision floating point number inside the Interpreter, but a decimal point is not required in the file.

Parameters in the user-defined range (31-5000) may be added to this file. Such parameters will be read by the Interpreter and written to the file as it exits.


Rick G

Please Log in or Create an account to join the conversation.

More
20 Mar 2016 11:52 #71941 by fupeama
Yes, but how? I dont know.

G64/G61 Path Control Mode is set in the beginning of g-code or in INI file. I use remap for M6 and I need change path control mode. After tool is changed I need restore previous value.
Martin

Please Log in or Create an account to join the conversation.

More
20 Mar 2016 15:27 - 20 Mar 2016 15:43 #71948 by Rick G
O.K. as an example start with In_std.ngc
(not_a_subfile)

g17 (xy plane)
g20 (inches)
g40 (cancel cutter radius compensation)
g49 (cancel tool lengthoffset)
g90 (absolute distance mode)
g94 (units/min feedrate)
;g54 (Coordinate system 1 default)

#<tol>  = 0.001
g64 p#<tol> (path control stop)

Perhaps change #<tol> , a named parameter to a numbered parameter. (a regular named parameter is not global, however a global named parameter or a numbered parameter is).
So to save the parameter value to numbered parameter when you start add something like this to your start up code...
#<3001> =0.001

Later when you want to restore that value use
G64 P#<3001>

Rick G
Last edit: 20 Mar 2016 15:43 by Rick G.

Please Log in or Create an account to join the conversation.

More
24 Mar 2016 16:25 #72101 by fupeama
But In this example I have to change g-CODE.
I need find different solution. Same as for <metric>. or <rpm> in python program. This named parameter for path control propably doesnt exist.....
M

Please Log in or Create an account to join the conversation.

More
25 Mar 2016 15:28 #72135 by Rick G
You may also want to look at M70 Save modal state...
linuxcnc.org/docs/html/gcode/m-code.html#mcode:m70
and M72, M73

Rick G

Please Log in or Create an account to join the conversation.

More
30 Mar 2016 10:56 #72378 by fupeama
Hi,
thanks for your help.
I studied everythink about M70 . But it looks lile this command save only MOTION_CONTROL_MODE G61 vs G64 not MOTION_CONTROL_TOLERANCE. P parametr on G64
I tried this ngc
; using M70/M71/M72 at the top level


F2000.
S1200
G90 (absolute mode)
g64 p0.001   (-------------------------------------P 0.001----------------------------------)
g0 x0 y0
g1 x100 y0
g1 y100
g1 x0
g1 y0
(DEBUG, before save M70)
(DEBUG,feedrate  #<_feed>)
(DEBUG,absolute #<_absolute>)
M70 (save state)

f50
s120
g91 (relative motion)
g1 x5 y5
g64 p20   (---------------------------------------------------P20-----------------------------------)
(DEBUG, set feed 50 and relative)
(DEBUG,feedrate  #<_feed>)
(DEBUG,absolute #<_absolute>)

M72 (restore without invalidating - multiple use possible)
(DEBUG, after restore )
(DEBUG,feedrate  #<_feed>)
(DEBUG,absolute #<_absolute>)
g0 x0 y0
g1 x100 y0
g1 y100
g1 x0
g1 y0

M71 (restore and invalidate)
(DEBUG, another M71 or M72 here should fail with an error message)

; M71

M2

first rectangle has sharp corners p 0.001, but second has arc in corners because M72 dont restore cam tolerance parametr and P20 is used instead of




I looked at source code and find this. :unsure:
interp_namedparams.cc

// 1 if G98 set
init_readonly_param("_retract_r_plane", NP_RETRACT_R_PLANE, PA_USE_LOOKUP);

// 1 if G99 set
init_readonly_param("_retract_old_z", NP_RETRACT_OLD_Z, PA_USE_LOOKUP);

// really esoteric
// init_readonly_param("_control_mode", 110, PA_USE_LOOKUP);


// 1 if G97 is on
init_readonly_param("_spindle_rpm_mode", NP_SPINDLE_RPM_MODE, PA_USE_LOOKUP);

init_readonly_param("_spindle_css_mode", NP_SPINDLE_CSS_MODE, PA_USE_LOOKUP);


Martin
Attachments:

Please Log in or Create an account to join the conversation.

More
30 Mar 2016 20:57 #72417 by Rick G
Well, I was not sure that would work. Which is why I recommended the first solution.

Rick G

Please Log in or Create an account to join the conversation.

Time to create page: 0.095 seconds
Powered by Kunena Forum