|
在Flexsim的触发器等编程中,常见的几个函数(一般在头部)如下:
fsnode* item = parnode(1);
fsnode* current = ownerobject(c);
unsigned int port = parval(2);
关于这几个函数,我这样理解对不对:
(1)parnode(num index)
Description:
For developer use. This command is used inside a function that is called by the nodefunction() command. It returns the parameter passed to nodefunction specified by index as a node (or fsnode*). The first additional parameter passed to nodefunction() is parameter 1, the second is parameter 2, etc. Parameters can also be retrieved using parval() and parstr() for casting them as numbers and strings respectively.
Example:
fsnode* item = parnode(1);
This command sets item so that it references the node that was passed to nodefunction() as parameter 1.
设置实体为相应的树结点指针所指向,且作为以后的该结点函数的第一个参数;
(2)fsnode* current = ownerobject(c);
ownerobject(node thenode)
Description:
For developer use. This command returns the node with object data attached to it that is the start of the sub-tree that thenode is in. In other words, it returns the object node that contains thenode.
Example:
string objname = getname(ownerobject(c));
This sets objname to the name of the object that contains the node referenced by c. The c usually refers to the node where the code is being written.
设置当前实体对象结点的容器结点(父结点);
(3)unsigned int port = parval(2);
parval(num index)
Description:
For developer use. This command is used inside a function that is called by the nodefunction() command. It returns the parameter passed to nodefunction specified by index as a number. The first additional parameter passed to nodefunction() is parameter 1, the second is parameter 2, etc. Parameters can also be retrieved using parnode() and parstr() for casting them as a fsnode pointer and string respectively.
Example:
float passedval = parval(3);
This sets passedval equal to the number that was passed to nodefunction() as parameter 3.
设置port为结点触发器函数的第2个参数。
是否有问题,请指教 |
|