PlantSimulation遍历对象并对对象进行操作

PlantSimulation遍历对象并对对象进行操作

var StationID:Integer:=0
FOR var I := 1 to Current.numnodes //遍历当前Frame 全部对象
 switch Current.Node(i).InternalClassName //识别当前对象InternalClassName 名称
 case "Place" //如果是工作站执行下面操作 
  var Sertab:table
  StationID+=1
  Current.Node(i).Name:=to_str("ST_",StationID) //给对象重命名
  Current.Node(i).imp.active:=true //激活Brock服务
  Current.Node(i).imp.GetServices(sertab) //读取服务内容
  sertab.delete //清空默认服务内容
  IF StationID<5
   Sertab.appendRow("W1",1)//设置服务类型
  ELSE
   Sertab.appendRow("W2",1)//设置服务类型
  end
  Current.Node(i).imp.SetServices(sertab)//将设置应用到对象
 case "NW_Store"
  debug
 end
next

欢迎加入PlantSimulation技术进阶群:964485532

你可能感兴趣的:(PlantSimulation遍历对象并对对象进行操作)