技术论坛

 回复:808D 自定义画面脚本中如何简单读写G54零点偏移量值?

返回主题列表
作者 主题
坏坏龙
游民

经验值:103
发帖数:3
精华帖:1
楼主    2018-07-15 15:08:59
主题:808D 自定义画面脚本中如何简单读写G54零点偏移量值?

 在808D 自定义画面脚本中 ,如何简单编写脚本读写工件坐标系G54....G59零点偏移量值?在西门子技术文档中给出的“NCK/Channel/UserFrame/linshift[n]",n为总轴数加1,该地址在自定义画面中不能直接用于读取G54的偏移量?

坏坏龙
游民

经验值:103
发帖数:3
精华帖:1
4楼    2018-07-22 09:30:38
精华帖  主题:回复:808D 自定义画面脚本中如何简单读写G54零点偏移量值?

 


<let name="ax_name"type="string"/>
<let name="num_mach_axis"/>
<let name="axis_index_in_channel" />
<let name="frame_type"/>
<let name="zero_offset"/>

<form name="Main">

 <caption>User Mask</caption>

  <init>
 
 <op>axis_index_in_channel = 0</op>
 
  <!--frame_type
    0 = G500
    1 = G54
    2 = G55
    3 = G56
    4 = G57
    5 = G505
    6 = G506
    ...
    nn = G5nn
    ...
    99 = G599
 -->
 <op>frame_type = 2</op>
 
 <!-- reading total number of axes -->
    <op>num_mach_axis = "nck/Channel/Configuration/numMachAxes"</op>
 
    <op>zero_offset = frame_type * num_mach_axis + axis_index_in_channel</op>
 
    <op>ax_name = "nck/Channel/GeometricAxis/name[$axis_index_in_channel]" </op>
 <control name="InputField1" xpos="90" ypos="57" height="16" width="80" hotlink="true" format="%8.3f" font="1" type = "double"/>
 
 </init>
 
  <paint>
  <text xpos = "90" ypos = "40">$$$ax_name</text>
  </paint>
 
  <timer >
  <op>InputField1 = "nck/Channel/UserFrame/linShift[U1,$zero_offset]" </op>
    <update_controls type="true" />
  </timer>
 
  <focus_in />
 
  <edit_changed >
  <op>"nck/Channel/UserFrame/linShift[U1,$zero_offset]" = InputField1</op>
 <function name="ncfunc.pi_service" return="error"> _T"_N_SETUFR" </function>
    <if>
      <condition>error == 0</condition>
      <then>
        <MsgBox text="Offset value could not be written!" caption="confirm error" retvalue="error" type="BTN_OK" />
      </then>
    </if>

   
    <function name="ncfunc.pi_service" return="error"> _T"_N_SETUDT", _T"003", _T"00000", _T"00000"</function>
    <if>
      <condition>error == 0</condition>
      <then>
        <MsgBox text="Offset value could not be activated!" caption="confirm error" retvalue="error" type="BTN_OK" />
      </then>
    </if>
  </edit_changed >
 
  <index_changed />
  <close />
  <key_evennt />
  <message />
</form>

400回复的一份自定义画面读写G54坐标偏置的脚本!可以直接在自定义画面中,直接读写零偏。

谢谢各位大神的回复!!!

您收到0封站内信:
×
×
信息提示
很抱歉!您所访问的页面不存在,或网址发生了变化,请稍后再试。