Skip to content

Commit e073d71

Browse files
authored
Merge pull request #767 from Paciente8159/named-parameters
RS274NGC named parameters
2 parents 0040f4e + 4518027 commit e073d71

File tree

21 files changed

+2113
-3179
lines changed

21 files changed

+2113
-3179
lines changed

makefiles/virtual/expressions.nc

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
n0010 g21 g1 x0 f20000
2+
(msg,comment expression test)
3+
(msg, x:#5420, y:#5421, z:#5422)
4+
g0 x1(msg, can be printed via parameter 5420)
5+
$#5420(msg, can be printed via parameter <_x>)
6+
$#<_x>
7+
g0 x0
8+
n0020 x [1 + 2](msg,x should be 3)
9+
$#<_x>
10+
n0030 x [1 - 2](msg,x should be -1)
11+
$#<_x>
12+
n0040 x [1 --3](msg,x should be 4)
13+
$#<_x>
14+
n0050 x [2/5](msg,x should be 0.40)
15+
$#<_x>
16+
n0060 x [3.0 * 5](msg,x should be 15)
17+
$#<_x>
18+
n0070 x [0 OR 0](msg,x should be 0)
19+
$#<_x>
20+
n0080 x [0 OR 1](msg,x should be 1)
21+
$#<_x>
22+
n0090 x [2 or 2](msg,x should be 2)
23+
$#<_x>
24+
n0100 x [0 AND 0](msg,x should be 0)
25+
$#<_x>
26+
n0110 x [0 AND 1](msg,x should be 0)
27+
$#<_x>
28+
n0120 x [2 and 2](msg,x should be 1)
29+
$#<_x>
30+
n0130 x [0 XOR 0](msg,x should be 0)
31+
$#<_x>
32+
n0140 x [0 XOR 1](msg,x should be 1)
33+
$#<_x>
34+
n0150 x [2 xor 2](msg,x should be 0)
35+
$#<_x>
36+
n0160 x [15 MOD 4.0](msg,x should be 3)
37+
$#<_x>
38+
n0170 x [1 + 2 * 3 - 4 / 5](msg,x should be 6.2)
39+
$#<_x>
40+
n0180 x sin[30](msg,x should be 0.5)
41+
$#<_x>
42+
n0190 x cos[0.0](msg,x should be 1.0)
43+
$#<_x>
44+
n0200 x tan[60.0](msg,x should be 1.7321)
45+
$#<_x>
46+
n0210 x sqrt[3](msg,x should be 1.7321)
47+
$#<_x>
48+
n0220 x atan[1.7321]/[1.0](msg,x should be 60.0)
49+
$#<_x>
50+
n0230 x asin[1.0](msg,x should be 90.0)
51+
$#<_x>
52+
n0240 x acos[0.707107](msg,x should be 45.0000)
53+
$#<_x>
54+
n0250 x abs[20.0](msg,x should be 20)
55+
$#<_x>
56+
n0260 x abs[-1.23](msg,x should be 1.23)
57+
$#<_x>
58+
n0270 x round[-0.499](msg,x should be 0)
59+
$#<_x>
60+
n0280 x round[-0.5001](msg,x should be -1.0)
61+
$#<_x>
62+
n0290 x round[2.444](msg,x should be 2)
63+
$#<_x>
64+
n0300 x round[9.975](msg,x should be 10)
65+
$#<_x>
66+
n0310 x fix[-0.499](msg,x should be -1.0)
67+
$#<_x>
68+
n0320 x fix[-0.5001](msg,x should be -1.0)
69+
$#<_x>
70+
n0330 x fix[2.444](msg,x should be 2)
71+
$#<_x>
72+
n0340 x fix[9.975](msg,x should be 9)
73+
$#<_x>
74+
n0350 x fup[-0.499](msg,x should be 0.0)
75+
$#<_x>
76+
n0360 x fup[-0.5001](msg,x should be 0.0)
77+
$#<_x>
78+
n0370 x fup[2.444](msg,x should be 3)
79+
$#<_x>
80+
n0380 x fup[9.975](msg,x should be 10)
81+
$#<_x>
82+
n0390 x exp[2.3026](msg,x should be 10)
83+
$#<_x>
84+
n0400 x ln[10.0](msg,x should be 2.3026)
85+
$#<_x>
86+
$#1
87+
n0410 x [2 ** 3.0] #1=2.(msg,x should be 8.0 and param 1 2.0)
88+
$#<_x>
89+
$#1
90+
$#2
91+
n0420 ##1 = 0.375(msg,#1 is 2, so parameter 2 is set to 0.375)
92+
$#<_x>
93+
$#1
94+
$#2
95+
n0430 x #2
96+
$#<_x>
97+
$#3
98+
#3=7.0(msg,x should be 0.375)
99+
$#<_x>
100+
$#3
101+
n0440 #3=5.0 x #3(msg,parameters set in parallel, so x should be 7, not 5)
102+
$#<_x>
103+
$#3
104+
n0450 x #3 #3=1.1(msg,parameters set in parallel, so x should be 5, not 1.1)
105+
$#<_x>
106+
$#3
107+
n0460 x [2 + asin[1/2.1+-0.345] / [atan[fix[4.4] * 2.1 * sqrt[16.8]] /[-18]]**2](msg, x should be aprox 2.0005)
108+
$#<_x>
109+
n0470 x sqrt[3**2 + 4**2](msg,x should be 5.0)
110+
$#<_x>
111+
n0480 m2

makefiles/virtual/namedparams.nc

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
$#<_vmajor>
2+
$#<_vminor>
3+
$#<_line>
4+
g0x1y2z3
5+
g92x10y20z30
6+
G18G59.1G91G21
7+
F1000S500M3
8+
$G
9+
$#<_motion_mode>
10+
$#<_plane>
11+
$#<_ccomp>
12+
$#<_metric>
13+
$#<_imperial>
14+
$#<_absolute>
15+
$#<_incremental>
16+
$#<_inverse_time>
17+
$#<_units_per_minute>
18+
$#<_units_per_rev>
19+
$#<_coord_system>
20+
$#<_tool_offset>
21+
$#<_retract_r_plane>
22+
$#<_retract_old_z>
23+
$#<_spindle_rpm_mode>
24+
$#<_spindle_css_mode>
25+
$#<_ijk_absolute_mode>
26+
$#<_lathe_diameter_mode>
27+
$#<_lathe_radius_mode>
28+
$#<_spindle_on>
29+
$#<_spindle_cw>
30+
$#<_mist>
31+
$#<_flood>
32+
$#<_speed_override>
33+
$#<_feed_override>
34+
$#<_adaptive_feed>
35+
$#<_feed_hold>
36+
$#<_feed>
37+
$#<_rpm>
38+
$#<_x>
39+
$#<_y>
40+
$#<_z>
41+
$#<_a>
42+
$#<_b>
43+
$#<_c>
44+
$#<_u>
45+
$#<_v>
46+
$#<_w>
47+
$#<_abs_x>
48+
$#<_abs_y>
49+
$#<_abs_z>
50+
$#<_abs_a>
51+
$#<_abs_b>
52+
$#<_abs_c>
53+
$#<_current_tool>
54+
$#<_current_pocket>
55+
$#<_selected_tool>
56+
$#<_selected_pocket>
57+
$#<_value>
58+
$#<_value_returned>
59+
$#<_task>
60+
$#<_call_level>
61+
$#<_remap_level>

makefiles/virtual/uCNC-emulator.dev

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ IncludeVersionInfo=0
2929
SupportXPThemes=0
3030
CompilerSet=1
3131
CompilerSettings=000000e0g0000000001000000
32-
UnitCount=93
32+
UnitCount=94
3333

3434
[VersionInfo]
3535
Major=1
@@ -1031,7 +1031,7 @@ OverrideBuildCmd=0
10311031
BuildCmd=
10321032

10331033
[Unit94]
1034-
FileName=..\..\uCNC\src\modules\o_codes\o_codes.c
1034+
FileName=..\..\uCNC\src\core\parser_expr.c
10351035
CompileCpp=1
10361036
Folder=
10371037
Compile=1

0 commit comments

Comments
 (0)