Post processor edit
- neil52
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 2
12 Mar 2018 21:43 #107263
by neil52
Post processor edit was created by neil52
Have plasma cutter running linux cnc; using fusion 360 mach3 plasma post processor[it generates usable G code with one exception uses g70 g71 for inch and metric] here is the code in the processor,I am not able to understand how to change it:
}
// absolute coordinates and feed per min
writeBlock(gAbsIncModal.format(90));
switch (unit) {
case IN:
writeBlock(gUnitModal.format(70)); // or use M20
break;
case MM:
writeBlock(gUnitModal.format(71)); // or use M21
break;
}
I would appreciate an education .Thanks. Neil
}
// absolute coordinates and feed per min
writeBlock(gAbsIncModal.format(90));
switch (unit) {
case IN:
writeBlock(gUnitModal.format(70)); // or use M20
break;
case MM:
writeBlock(gUnitModal.format(71)); // or use M21
break;
}
I would appreciate an education .Thanks. Neil
Please Log in or Create an account to join the conversation.
- rodw
- Offline
- Platinum Member
Less
More
- Posts: 10843
- Thank you received: 3580
13 Mar 2018 01:49 - 13 Mar 2018 01:54 #107268
by rodw
Replied by rodw on topic Post processor edit
It looks very C like
At a guess, you just change 70 to 20 and 71 to 21 to use G20 and G21
switch(unit) is the beginning of a C case statement based on the value of the variables unit
Elsewhere the code has set some equates so that MM and IN have different numeric values to make the code more readable
Within the switch, there are any number of case statements based on the value of unit
when a case statement evaluates true, code is executed from that point until a break; is encountered when control transfers to the outer } of the switch statement.
Normally you would insert a break before the next case statement as shown in this example but that is optional depending on if you want to repeat a block of code:
eg.So basically the code is saying in a much more efficient and readable way
if unit = inches then use G70
else
if unit = millimetres then use G71
At a guess, you just change 70 to 20 and 71 to 21 to use G20 and G21
switch(unit) is the beginning of a C case statement based on the value of the variables unit
Elsewhere the code has set some equates so that MM and IN have different numeric values to make the code more readable
Within the switch, there are any number of case statements based on the value of unit
when a case statement evaluates true, code is executed from that point until a break; is encountered when control transfers to the outer } of the switch statement.
Normally you would insert a break before the next case statement as shown in this example but that is optional depending on if you want to repeat a block of code:
eg.
switch(friend){
case george:
case fred:
say("hello friend");
break;
default:
say("I don't know you");
}
if unit = inches then use G70
else
if unit = millimetres then use G71
Last edit: 13 Mar 2018 01:54 by rodw.
The following user(s) said Thank You: neil52
Please Log in or Create an account to join the conversation.
- neil52
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 2
13 Mar 2018 14:36 #107277
by neil52
Replied by neil52 on topic Post processor edit
Switching 70 too 20 and 71 too 21 worked thanks much!
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
Time to create page: 0.050 seconds