Could somebody explain me what de programming in Custom Code means?
Software Version 17.0.2
Could somebody explain me what de programming in Custom Code means?
Software Version 17.0.2
Hi @Judith S,
setnodenum(token.Item.find(">spatial/offsetsx"), 1);
Let's break apart what is going on. First of all, the setnodenum() function uses the following syntax to set a value to a treenode:
setnodenum(treenode thenode, num value)
So the 2nd parameter in the top code is easy: 1. We are setting the value of some treenode to 1.
And which treenode are we going to set a new value on? For the code you're asking about, the treenode is defined using the following:
token.Item.find(">spatial/offsetsx)
Several things are happening here:
So in the end, the meaning of those two lines of code is this:
The whole concept of offsets vs spatials is a good topic for a brand new question. If you need to explore that topic, go ahead and ask a new question. Or comment below with any follow-up questions regarding reading the code examples above.
The code is a combination with and without dot-syntax. The command setnodenum(obj node, num value) sets the value at the node. In your example the node is the spatial attribute in the object that belongs to the label Item of the token. "offsetsx" is the attribute of the size of the shape in x direction. "offsetx" is the location of the shape in x direction. You can edit those values, if you press the "Edit" button next to "Shape Factors" on the General Tab in the area "Appearance". It is the top most area on the left side.
That was the short description:
"token" the typical green chip in ProcessFlow
"Item" a label at the token, typically it contains a reference to an item in the 3D-Model
"find( )" a method a node or object by name or path string: here a path string ">spatial/offsetsx"
">" entering the objects attributes
"spatial" subnode of the features of the visual look: Object location, rotation, size of the yellow and red frame and the location, rotation and size of the shape of an object. Object is in this case an item, too.
"offsetsx" offset is the part of the node name to identify the shapes attributes. "..s.." identifies the size. "..x" identifies the direction.
If there isn't a character between offset and the coordinate direction then the attribute describes the location. The last chracter you can find is "r". It is the character for a rotation "offsetry".
Previous to these two code lines you find the header. The header contains the references of the activity which are passed into this function as parameters in short "param(..)". The value in the function is the number of the parameter. The parameters are casted into different variables of the classes: Object, treenode, Token and put into variables with the names: current, activity, token and processFlow.
The function ownerobject( ) returns a reference of the object which executes the current source code of the activity. It is the ProcessFlow where you find the activity in.
8 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved