全球FlexSim系统仿真中文论坛

搜索
查看: 6312|回复: 1
打印 上一主题 下一主题

FlexSim涉及对象的编程指令介绍

[复制链接]
跳转到指定楼层
1#
Clay666 发表于 2019-7-22 09:23:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Current and Item在整个FlexScript中经常使用以下表达式:
5 }8 L* F5 i  \* A( O0 t•current  - 当前变量是对当前资源对象的引用。 它通常是选择列表中的访问变量。, D/ I) H$ R0 d  s# z' c
•item  - 该项变量是对触发器或函数的相关项的引用。 它通常是选择列表中的访问变量。& j$ C2 k  c* D' r: f2 {9 w
  a: |1 c! s: |' [7 {8 l
Referencing Objects
+ E6 [/ b( b! K8 ]
  
Command
  
Explanation
Example
node.first
This returns a reference to the first ranked object/node inside of node
  
对当前节点第一个子节点的引用
current.first
node.last
This returns a reference to last ranked object/node inside of node
  
对当前节点最后一个子节点的引用
current.last
node.subnodes[ranknum]
This returns a reference to the object at a given rank inside of node
  
对当前节点的子节点按照排列级别引用
current.subnodes[3]
object.inObjects[portnum]
This returns a reference to the object connected to the input port  number of object
  
当前对象输入节点的引用
current.inObjects[1]
>object.outObjects[portnum]
This returns a reference to the object connected to the output port  number of object
  
当前对象输出节点的引用
current.outObjects
object.centerObjects[portnum]
This returns a reference to the object connected to the center port  number of object
  
当前对象中间节点的引用
current.centerObjects[1]
node.next
This returns a reference to the next ranked object of node
  
返回当前节点的下一个临近节点(基于节点树)
item.next
node.prev
This returns a reference to the previous ranked object of node
  
返回当前节点的上一个临近节点(基于节点树)
item.prev
node.find(path)
This returns the object found at path in the tree beginning from node
  
返回基于路径寻找到的对象
current.find("Box1")
) J2 j" D  W/ i6 J# Y. N
5 t" `( Q2 c; t3 E
Object Attributes8 G3 X8 B. S) q4 J3 w
  
Command
  
Explanation
object.name
This returns the name of the object
  
返回当前对象的名称
object.name = newName;
This sets the name of the object to newName
  
设定当前堆场的名称为newName
object.color = Color.color
This sets the color of the object (where color is red, green, blue,  random(), etc.)
  
设定当前对象的颜色
object.color = Color(red, green, blue)
This sets the color of the object to an rgb color
  
设定当前对象的颜色(基于RGB编码)
setobjectshapeindex(object, indexnum)
This sets the 3D shape of the object
  
设定当前对象的三维形状
setobjecttextureindex(object, indexnum)
This sets the 3D texture of the object
  
设定当前对象的三维特征
Object Spatial Attributes
5 g, ^- L3 d* @: q8 m9 D
  
Command
  
Explanation
object.location.x4 Y8 L3 @# m1 F9 G
  object.location.y
6 M0 W" R7 h4 z7 I  object.location.z
Gets the x, y, and z locations of the object respectively
  
分别获取对象的xyz位置
object.setLocation(xnum, ynum, znum)
This sets the x, y, and z location of the object
  
设定对象的xyz位置
object.size.x- K  j" W/ B+ F, V5 x
  object.size.y
  z% E8 ~  e$ o3 m: B2 ?$ L  object.size.z
Gets the x, y, and z size of the object respectively
  
分别获取对象的xyz尺寸
object.setSize(xnum, ynum, znum)
This sets the x, y, and z size of the object
  
设定对象的xyz尺寸
object.rotation.x
/ U4 w- {1 g" ]% z6 c3 a, K  object.rotation.y: s* A) A  N5 J$ O
  object.rotation.z
Gets the x, y, and z rotation of the object respectively
  
分别获取对象的xyz旋转角度
object.setRotation(xdeg, ydeg, zdeg)
This sets the x, y, and z rotation of the object
  
设定对象的xyz旋转角度

0 v& F) Z4 ?; H
) ~( o. Q' [9 R5 p. x2 oObject Statistics  H1 R) t+ Q/ A* ~5 J2 J5 v( A
  
Command(parameter list)
  
Explanation
object.subnodes.length
This returns the current content of the object
  
返回对象子节点长度
object.stats.input
This returns the input statistic of the object
  
返回对象的输入状态
object.stats.output
This returns the output statistic of the object
  
返回对象的输出状态
obj.stats.state().value = statenum
This sets the current state of the object
  
设定对象的当前状态
obj.stats.state().value
This returns the current state value of the object
  
返回对象的当前状态
obj.stats.state().valueString
This returns the current state of the object as a string
  
以字符串的形式返回当前对象的状态
object.rank
This returns the rank of the object
  
返回对象在节点树中的层级序列
object.rank = ranknum
This sets the rank of the object
  
设定对象在节点树中的层级序列
getentrytime(item)
This returns the time the flow item entered the object it is currently  in
  
返回临时实体进入当前对象的时间
getcreationtime(item)
This returns the time the flow item was created
  
返回临时实体被创建的时间

- I5 e5 x; A/ A/ @/ x' ^" [0 q# C
Object Labels; S$ \  A, T- g$ [, ]# s
  
Command(parameter list)
  
Explanation
object.labelName
! G: n0 U' W% [2 x  object.labels[labelRank].value
This returns the value of the object's label.
  
返回对象的标签值
object.labelName = value6 X, ?* C) k5 C7 U# ^' a9 `. R
  object.labels[labelRank].value = value
This sets the value of the object's label.
  
设定对象的标签值
object.labels["labelname"]9 E0 k# \( H9 O" B, R  v
  object.labels[labelRank]
This returns a reference to the label as a node. Often used if you have  a label that is used as a table.
  
返回一个对标签的节点引用。经常用于将标签最为报表使用时。

4 w1 y' ]- c& `: V! V7 ?7 c' K) K% {
Object Variables
2 j( {1 d, x- b7 ?
  
command(parameter list)
  
Explanation
getvarnum(object, "variablename")
This returns the number value of the variable with the given name
  
返回给定变量的数值
setvarnum(object, "variablename", value)
This sets the number value of the variable with the given name
  
设定给定变量的数值
getvarstr(object, "variablename")
This returns the string value of the variable with the given name
  
返回给定变量的字符值
setvarstr(object, "variablename", string)
This sets the string value of the variable with the given name
  
设定给定变量的字符值
getvarnode(object, "variablename")
This returns a reference to the variable with the given name as a node
  
将返回的对象变量作为一个节点引用
6 s4 A0 I/ Y6 I  M* l1 j! m0 ?; M) @

7 f4 I/ R! ]/ A" b8 d1 k0 O; c& N2 x, W3 |: F7 @) D- _6 d
. f# z( N* C2 `+ S9 u

评分

参与人数 1威望 +15 收起 理由
沈瑞祥 + 15 很给力!

查看全部评分

2#
沈瑞祥 发表于 2019-7-22 22:45:15 | 只看该作者
这个非常常用啊!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|全球FlexSim系统仿真中文论坛 ( 京ICP备14043114号-2 )

GMT+8, 2025-6-28 01:31 , Processed in 0.077903 second(s), 15 queries .

Powered by Discuz! X3.3© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表