g-code


Terminating G code if condition is not met?


I'm looking at modifying a G Code file that has a condition if the measured angle is not within tolerance it will terminate the programme early.
What I don't understand is what does this code actually mean?
At what point is the if statement?
What in particular is happening at the M2 command M[2 + 3 * #210]?
Below is my code:
(calculate hypotenuse of heading triangle, "phi" angle)
#100 = SQRT[[[#2336 - #2335]**2] + [[#2306 - #2305]**2]]
#101 = [[#2335 - #2336] / #100] (calculate SIN of heading angle)
#102 = [[#2306 - #2305] / #100] (calculate COS of heading angle)
(calculate hypotenuse of roll triangle, "psi" angle)
#100 = SQRT[[[#2313 - #2311]**2] + [[#2344 - #2343]**2]]
#103 = [[#2344 - #2343] / [#2313 - #2311]] (calculate TAN of roll angle)
#104 = [[#2344 - #2343] / #100] (calculate SIN of roll angle, beta in equations)
#105 = [[#2313 - #2311] / #100] (calculate COS of roll angle, beta in equations)
#106 = ASIN[#104] (calculate DEG of roll angle)
(calculate hypotenuse of pitch triangle, "teta" angle)
#100 = SQRT[[[#2306 - #2305]**2] + [[#2342 - #2341]**2]]
#107 = [[#2342 - #2341] / #100] (calculate SIN of pitch angle)
#108 = [[#2306 - #2305] / #100] (calculate COS of pitch angle)
(###############################################################################)
(# This part of code determines whether angles are within #)
(# given limits [set in variables #2214, #2215, #2216] and #)
(# can be cut or the angles are too high and should be returned #)
(# without cutting #)
(###############################################################################)
(eg for the following angles: only 3 middle numbers are good)
#219 = ASIN[#101] (..., -2.76, -1.76, -1.75, 0.00, 1.75, 1.76, 2.76, ...)
#211 = [ABS[#219] + [FUP[#2214] - #2214 - 0.01]] (..., 3.00, 2.00, 1.99, 0.24, 1.99, 2.00, 3.00, ...)
#211 = FIX[#211] (..., 3.00, 2.00, 1.00, 0.00, 1.00, 2.00, 3.00, ...)
#211 = [#211 - 0.1] (..., 2.90, 1.90, 0.90, -0.10, 0.90, 1.90, 2.90, ...)
#211 = FIX[ABS[#211]] (..., 2.00, 1.00, 0.00, 0.00, 0.00, 1.00, 2.00, ...)
#211 = FUP[SIN[#211]] (..., 1.00, 1.00, 0.00, 0.00, 0.00, 1.00, 1.00, ...)
#211 = [1 - #211] (..., 0.00, 0.00, 1.00, 1.00, 1.00, 0.00, 0.00, ...)
#212 = 1 (roll angle for a flat doesn't matter)
#213 = 1 (pitch angle for a flat doesn't matter)
#210 = [#211 * #212 * #213] (all 3 angles should be within limits if to be cut)
(###############################################################################)
(# if #210 == 1 proceed with cutting; #)
(# if #210 == 0 terminate program; #)
(###############################################################################)
(###############################################################################)
(# this version analyzes the value of #210 to determine the next step #)
(###############################################################################)
(*******************************************************************************)
( Execute return or no motion )
(*******************************************************************************)
M5
#1001 = [#2114 - #2111 - #2123 - [#2205 / 2] + #2221]
#1002 = [#2115 + #2330 + #2124 - #2006]
#1003 = [#2116 + #2113 + #2125 + [#216 / 2] + #2224]
F1.25
#112 = [#1002 * [1 - #210] + [#12 * #210]]
G01 Y#112
#111 = [[#1001 - #2128] * [1 - #210] + [#11 * #210]]
#113 = [#1003 * [1 - #210] + [#13 * #210]]
G01 X#111 Z#113
M[07 - [#210 * 2]]
G04 P[1.25 * [1 - #210]]
#112 = [[#1002 + #2129] * [1 - #210] + [#12 * #210]]
G01 Y#112
F1
#111 = [[#1001 + #2123 + #2127 + [#2205 / 2]] * [1 - #210] + [#11 * #210]]
G01 X#111
M[27 - [#210 * 22]]
G04 P[3 * [1 - #210]]
#113 = [[#1003 + 0.25] * [1 - #210] + [#13 * #210]]
G01 Z#113
F1.25
#111 = [0 * [1 - #210] + [#11 * #210]]
#112 = [[#1002 + #2129 - 1] * [1 - #210] + [#12 * #210]]
G01 X#111 Y#112
#112 = [0 * [1 - #210] + [#12 * #210]]
#113 = [#350 * [1 - #210] + [#13 * #210]]
(###############################################################################)
G01 Y#112
M[09 - [#210 * 4]]
G04 P[1.25 * [1 - #210]]
G01 Z#113
(###############################################################################)
M[2 + 3 * #210] (End of program or NOP /stop cutting wheel/ and continue)

Related Links

Looking for G Code syntax specification, trying to make simple G Code parser
Terminating G code if condition is not met?
GRBL cycle start needed every spindle on/off
Clearing offset numbers
Gcode to tell a RepRap 3D printer he is in the middle of the heat bed?

Categories

HOME
twitter
yii2
winforms
testng
coq
openmp
iterator
relayjs
syntax
yahoo-oauth
amazon-ecs
jsrender
survey
angular-ui-bootstrap
enterprise-library-5
cross-validation
spring-xd
quicklook
n-gram
dtrace
zebra-printers
decimal
lombok
propel
oracle-coherence
functional-testing
crosstab
p-value
apache-commons-io
selectedindexchanged
fifo
spring-mybatis
libuv
microsoft-chart-controls
xquery-3.0
kendo-ui-grid
android-nestedscrollview
rotational-matrices
dartium
ssjs
mapzen
fedex
arena-simulation
businessworks
qcombobox
scorm
python-c-api
rdfs
jxcore
forever
sqlclient
np-complete
windows-mobile-6.5
sqldf
bind9
httplistener
rotativa
thrust
nsfilemanager
contact-list
disque
persist
oauth2client
two-factor-authentication
photobucket
marching-cubes
collapse
ruby-2.2
content-length
ibaction
microbenchmark
apache-commons-fileupload
createprocessasuser
remobjects
unity5.2.3
graph-api-explorer
e10s
nsmutabledictionary
fscommand
oxwall
xc16
nstableviewcell
codeigniter-url
winddk
php-5.4
mesa
funcunit
hyprlinkr
balanced-payments
oam
farseer
gridfs
django-nonrel
hungarian-algorithm
comaddin
sharp-repository
sabredav
sublist
quickdialog
datawindow
hosts-file
ocx
qtkit
window-management
stage
appendto
fluent-interface
suppress
virtual-functions
uimenucontroller
genealogy

Resources

Encrypt Message