在程序中添加需要跳转的标签和跳转到指令,程序运行到跳转到指令时会跳到标签位置执行其后的程序。
(1)用于跳过指定的位置,运行程序时.
(2)主要和条件语句一起使用.
程序运行从一个区域跨到另一个区域称为跳转。在DMIS里JUMPTO和标签同时使用就可以实现无条件跳转功能。无条件跳转指令和其他DMIS控制程序流程的语句稍微有些不同,因为即使程序没有条件语句跳转还是会执行。
JUMPTO语句
JUMPTO语句用来引导程序运行到新的一行,这一行用标签识别,格式如下:
JUMPTO/(标签)
标签:程序即将运行到的行
例子
(startline)
$$DMIS语句
$$DMIS语句
JUMPTO/(startline)
执行程序时,执行到此行,就会自动跳转到设定的标签处如下图。
RationalDMIS高级指令(JUMPTO跳转语句)
MODE/PROG,MAN
(L1)
F(CIR1)=FEAT/CIRCLE,INNER,CART,-0.0000,-0.0000,-10.8537,0.0000,0.0000,1.0000, 30.0000
$$ Measurement points are created through nominal points
MEAS/CIRCLE, F(CIR1), 5
PTMEAS/CART, 12.0288, 8.9614, -10.8537, -0.8019, -0.5974, 0.0000
GOTO/CART, 6.9367, 9.7920, -10.8537
GOTO/CART, 3.5713, 11.4563, -10.8537
GOTO/CART, -0.1437, 11.9991, -10.8537
PTMEAS/CART, -4.8057, 14.2093, -10.8537, 0.3204, -0.9473, 0.0000
GOTO/CART, -7.1692, 9.6231, -10.8537
GOTO/CART, -9.7920, 6.9367, -10.8537
GOTO/CART, -11.4563, 3.5713, -10.8537
PTMEAS/CART, -14.9989, -0.1796, -10.8537, 0.9999, 0.0120, 0.0000
GOTO/CART, -11.3675, -3.8446, -10.8537
GOTO/CART, -9.6231, -7.1692, -10.8537
GOTO/CART, -6.9367, -9.7920, -10.8537
PTMEAS/CART, -4.4641, -14.3203, -10.8537, 0.2976, 0.9547, 0.0000
GOTO/CART, 0.1437, -11.9991, -10.8537
GOTO/CART, 3.8446, -11.3675, -10.8537
GOTO/CART, 7.1692, -9.6231, -10.8537
PTMEAS/CART, 12.2399, -8.6709, -10.8537, -0.8160, 0.5781, 0.0000
ENDMES
JUMPTO/(L1)
$$ 一个测量程序里包括2个工件,如何选择运行哪个工件的测量部分呢?
$$
DECL/COMMON,INTGR,APart,BPart
xxx = Prompt/CHECK,'A Part',APart,CHECK,'B Part',BPart,title,'Select Part Programme'
IF/ APart
JUMPTO/(A)
else
IF/BPart
JUMPTO/(B)
else
JUMPTO/(END)
ENDIF
ENDIF
(A)
$$ A Part programe here , jumpto END after A measure finish
JUMPTO/(END)
(B)
$$ B Part programe here , jumpto END after B measure finish
JUMPTO/(END)
(END)
测量的过程中,经常会遇到需要对一批零件中的某几个选择性进行测量.
这时候通常是用一个主程序对几个零件的测量程序进行调用,但是我们可以用跳转JUMPTO的语句简单实现这一要求.
1.定义所需要的变量.
2.Prompt进行提示让用户选择.
3.做判断是测量还是跳转.
DECL/INTGR,ItemA,ItemB,ItemC,ItemD,ItemE
Tempchar = Prompt/CHECK,'工件A',ItemA,$
CHECK,'工件B',ItemB,$
CHECK,'工件C',ItemC,$
CHECK,'工件D',ItemD,$
CHECK,'工件E',ItemE
IF/(ItemA .EQ. 0)
Jumpto/(BBB)
ENDIF
$$$ 这段是测量A工件的程序
Write/DID(defaultscreen),'测量A工件完成'
(BBB)
IF/(ItemB .EQ. 0)
Jumpto/(CCC)
ENDIF
$$$ 这段是测量B工件的程序
Write/DID(defaultscreen),'测量B工件完成'
(CCC)
IF/(ItemC .EQ. 0)
Jumpto/(DDD)
ENDIF
$$$ 这段是测量C工件的程序
Write/DID(defaultscreen),'测量C工件完成'
(DDD)
IF/(ItemD .EQ. 0)
Jumpto/(EEE)
ENDIF
$$$ 这段是测量D工件的程序
Write/DID(defaultscreen),'测量D工件完成'
(EEE)
IF/(ItemE .EQ. 0)
Jumpto/(FFF)
ENDIF
$$$ 这段是测量E工件的程序
Write/DID(defaultscreen),'测量E工件完成'
(FFF)