要知道FOR语句怎么实现搬运程序位置计算的,那我们先来看看FOR语句的格式以及执行过程。

接下来,我们再来看稍微复杂一点的FOR语句,FOR语句的嵌套:

***后我们来看要求,假定有物料源源不断从传送带过来,机器人在固定位置进行搬运。(物料的长宽高为100mm),机器人物料分别放在“1,2,3,4,5,6”的位置
我们来看一下***终的程序:

(a - 1) * 100:是X轴方向偏移的点
(b - 1) * 100:是Y轴方向偏移的点
(c - 1) * 100):是Z轴方向偏移的点
其中P10点是“1”的中心点(示教的基准点)
P60为***终计算出来的位置点
注意:整个程序你有没有看懂呢?它的循环过程是怎么样的呢?