Digital Dream Technology support

Title: Getting the current axes coordinates [Print This Page]

Author: Nikolay81    Time: 2018-10-17 18:48
Title: Getting the current axes coordinates
Last edited by Nikolay81 In 2018-10-17 18:50 Editor

Please tell me how you can get the current coordinates of the axes in G54
This is needed to create more convenient postprocessors.

For example, I write:
G90
G1X0.1F1000
M110(move axies and press START)
(Manually move the axis to a saved position.)
G4P0
#21=#451 (getting x coordinates)
#22=#452 (getting y coordinates)
#23=#453 (getting z coordinates)
G4P0
G0 X50 Y50 Z10
G1 X#21 Y#22 Z#23 F1000 (Now, the axes should return to the saved position.)
M110(Right?)
G0X0Y0Z0
#21=0
#22=0
#23=0

I tried the variables # 451- # 453; # 572- # 574; # 804- # 806; # 864- # 866. They do not work.
Please tell me in which variables the information about the current position of the axes is stored.
And in which variables, it is better to save it (# 21- # 23 are used in slib.nc).
Author: jjae6    Time: 2018-10-19 13:59
UP. That sounds interesting
Author: ytliu    Time: 2018-10-19 21:02
Sorry, I am on a business trip these days. I will reply to you when I go back.
Author: Nikolay81    Time: 2018-10-19 21:28
Last edited by Nikolay81 In 2018-10-19 21:34 Editor

Many thanks for your help. Have a good trip.
Author: Will_D    Time: 2018-10-20 17:36
What I have found out:

Current tool position in current Workspace (eg G54) at start of processing g-code file!:
But not fully understood!                                    ======================

X = #451
Y = #452
Z = #453

These are where the tool is at the start of a gcode file.


For G54 current position:
#840 X machine tool position of coordinate system
#841 Y machine tool position of coordinate system
#842 Z machine tool position of coordinate system

In order to "read out" the value of a parameter I just use it to set the spindle speed in a simple gcode test file (sometimes multiply it by 10 or 100).
Author: ytliu    Time: 2018-10-28 07:25
Last edited by ytliu In 2018-10-28 07:31 Editor

The DDCSV system supports user-defined G code (G100-G199). The user can add the corresponding subroutine in slib.nc to customize the G code. The subroutine O9100-O9199 corresponds to G100-G199.

The following macro variables provide support for user-defined G code:

#451-#454 is the position of the workpiece coordinate system at the end of the current Gcode line

#448 is used to identify G20/G21 mode, #448=25.4 in G20 mode, #448=1 in G21 mode
#449 is used to identify G98/G99 mode, #449=1 in G99 mode, #449=-1 in G98 mode
#450 is used to identify G90/G91 mode, #450=1 in G90 (G90.1) mode, #450=-1 in G91 (G91.1) mode

#420 is used to identify whether there is X size word in the current Gcode line. If it exists, #420=1, otherwise #420=0
#421 is used to identify whether there is Y size word in the current Gcode line. If it exists, #421=1, otherwise #421=0
#422 is used to identify whether there is Z size word in the current Gcode line. If it exists, #422=1, otherwise #422=0
#423 is used to identify whether there is A size word in the current Gcode line. If it exists, #423=1, otherwise #423=0
#424 is used to identify whether there is B size word in the current Gcode line. If it exists, #424=1, otherwise #424=0
#425 is used to identify whether there is C size word in the current Gcode line. If it exists, #425=1, otherwise #425=0
#426 is used to identify whether there is I size word in the current Gcode line. If it exists, #426=1, otherwise #426=0
#427 is used to identify whether there is J size word in the current Gcode line. If it exists, #427=1, otherwise #427=0
#428 is used to identify whether there is K size word in the current Gcode line. If it exists, #428=1, otherwise #428=0
#429 is used to identify whether there is R size word in the current Gcode line. If it exists, #429=1, otherwise #429=0
#430 is used to identify whether there is L size word in the current Gcode line. If it exists, #430=1, otherwise #430=0
#431 is used to identify whether there is H size word in the current Gcode line. If it exists, #431=1, otherwise #431=0
#432 is used to identify whether there is P size word in the current Gcode line. If it exists, #432=1, otherwise #432=0
#433 is used to identify whether there is Q size word in the current Gcode line. If it exists, #433=1, otherwise #433=0

#484 is used to record the current Gcode line P size word
#485 is used to record the current Gcode line Q size word
#486 is used to record the current Gcode line F size word
#487 is used to record the current Gcode line S size word
#488 is used to record the current Gcode line X size word, if it is in G90 (G90.1) mode, #488=#451, otherwise #488 is the X input value
#489 is used to record the current Gcode line Y size word, if it is in G90 (G90.1) mode, #489=#452, otherwise #489 is Y input value
#490 is used to record the current Gcode line Z size word, if it is in G90 (G90.1) mode, #490=#453, otherwise #490 is Z input value
#491 is used to record the current Gcode line A size word, if it is in G90 (G90.1) mode, #491=#454, otherwise #491 is the A input value.
#492 is used to record the current Gcode line B size word
#493 is used to record the current Gcode line C size word
#494 is used to record the current Gcode line I size word
#495 is used to record the current Gcode line J size word
#496 is used to record the current Gcode line K size word
#497 is used to record the current Gcode line R size word
#498 is used to record the current Gcode line L size word
#499 is used to record the current Gcode line H size word


Author: ytliu    Time: 2018-10-28 07:51
Last edited by ytliu In 2018-10-28 08:12 Editor

DDCSV will pre-read GCode for parsing, so the parsing process is out of sync with the machining process. #451-#454 is not machine tool position of coordinate system, but the expected position of the currently parsed Gcode line.
Author: ytliu    Time: 2018-10-28 08:27
As Will_D said, you can get machine tool position of G54 coordinate system with #840-#842.

G90
G1X0.1F1000
M110(move axies and press START)
(Manually move the axis to a saved position.)
G4P0
#21=#840 (getting x coordinates)
#22=#841 (getting y coordinates)
#23=#842 (getting z coordinates)
G4P0
G0 X50 Y50 Z10
G1 X#21 Y#22 Z#23 F1000 (Now, the axes should return to the saved position.)
M110(Right?)
G0X0Y0Z0
#21=0
#22=0
#23=0
Author: ytliu    Time: 2018-10-28 08:29
Last edited by ytliu In 2018-10-28 08:34 Editor

DDCSV Coordinate System Description:

The coordinate systems in DDCSV system include machine coordinate system, G53 coordinate system and G54-G59 coordinate system.

The machine coordinate system is established by home operation or zero under MACH. Read # 864- # 867 (X, Y, Z, A) to find the position of the tool in the machine coordinate system.

G53 is based on the machine coordinate system. # 800- # 803 (X, Y, Z, A) describes the distance from the origin of the G53 coordinate system to the origin of the machine coordinate system. Adjusting these parameters can reconstruct the G53 coordinate system. Read # 868- # 871 (X, Y, Z, A) to find the position of the tool in the G53 coordinate system.

The G54-G59 coordinate system is based on the G53 coordinate system. # 804- # 807 (G54 X, Y, Z, A), # 808- # 811 (G55 X, Y, Z, A), # 812- # 815 (G56 X, Y, Z, A), # 816- # 819 (G57 X, Y, Z, A), # 820- # 823 (G58 X, Y, Z, A) , # 824- # 827 (G59 X, Y, Z, A) respectively describe the distance from the origin of G54-G59 coordinate system to the origin of G53 coordinate system, and adjust these parameters to reconstruct the G54-G59 coordinate system; Read #840-#843(G54 X、Y、Z、A)、#844-#847(G55 X、Y、Z、A)、#848-#851(G56 X、Y、Z、A)、#852-#855(G57 X、Y、Z、A)、#856-#859(G58 X、Y、Z、A)、#860-#863(G59 X、Y、Z、A)to find the position of the tool in the G54-G59 coordinate system.

#516 describes the system currently working coordinate system, 0 corresponds to the G53 coordinate system, 1-6 corresponds to the G54-G59 coordinate system, 7 corresponds to the machine coordinate system.
Author: Nikolay81    Time: 2018-10-29 22:30
Last edited by Nikolay81 In 2018-10-29 22:53 Editor

Many thanks Ytliu.
How can the settings values be used in G-code, for example:
G1 X100 F # 80 (should work similarly to G0)
What variables are not busy (that is, available to the user) except # 21 - # 24?

Author: ytliu    Time: 2018-10-30 06:42
#0-#49 is a subroutine local variable that you can use at will. If you need to use system parameters in GCode, you can use #2400-#2500, you can modify them in the configuration page to change the behavior of GCode, of course you need to add relevant parameter configuration in eng (rus, chs) file .
Author: Nikolay81    Time: 2018-10-30 17:43
ytliu Posted at 2018-10-30 06:42
#0-#49 is a subroutine local variable that you can use at will. If you need to use system parameters ...

Thanks Ytliu.
And the value of the system parameters can be read from the G-code, or not?
For example, I need to read the value of the parameter #80 to use it for F.
Option G1 X10 F # 80 does not work.
If I write the line #2401=#80 at the end of the "eng" file, and then execute the code G1 X10 F#2401 - this does not work either.
Is there a way to find out the value of #80 from G-code?
Perhaps through slib.nc is this possible?
Author: ytliu    Time: 2018-10-30 18:34
Nikolay81 Posted at 2018-10-30 17:43
Thanks Ytliu.
And the value of the system parameters can be read from the G-code, or not?
For exam ...

Correspondence between parameter number and macro variable:
The 0-499 parameter corresponds to the #500-#999 macro variable;
The 2000-2499 parameter corresponds to the #2000-#2499 macro variable;
Author: Nikolay81    Time: 2018-10-30 19:29
Many thanks to Ytliu. Now everything is clear.




Welcome Digital Dream Technology support (http://bbs.ddcnc.com/) Powered by Discuz! X3