How can I set the start and end height of a conveyor in code?

How can I set the start and end height of a conveyor in code?

axel_kohonen
Not applicable
209 Views
11 Replies
Message 1 of 12

How can I set the start and end height of a conveyor in code?

axel_kohonen
Not applicable

[ FlexSim 16.0.1 ]

Hi,

I would like to set the conveyor start and end height (and other parameters) of a straight conveyor in code. The start and end heights are the values underlined with red in the image below. I could not find the parameters in the model tree. Where can I find them or do this?

404-v2ni8.png

Thank you!

Kind regards,

Axel

Accepted solutions (1)
210 Views
11 Replies
Replies (11)
Message 2 of 12

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

This is the code that the Quick Properties panel ends up using:

function_s(conveyor, "setZ", 1, 0);
function_s(conveyor, "clearNonLockedPoints");
function_s(conveyor, "notifyEdgePointsOnEdgeMoved");
function_s(conveyor, "finalizeSpatialChanges");

The 1st parameter of the setZ function is the new z location and the second parameter is which end of the conveyor (0 or 1).



Matthew Gillespie
FlexSim Software Developer

Message 3 of 12

axel_kohonen
Not applicable

Thank you Matthew! I concluded that you need to call rows 2-4 only once after setting both the start and end height. How did you know how the Quick properties panel did it? Did you use the right click on quick properties -> View -> Explore structure approach? I tried now, but could not find the needed code anyhow.

0 Likes
Message 4 of 12

joerg_vogel_HsH
Mentor
Mentor

The modules depend on hidden DLL-functions. The code

function_s(conveyor, "finalizeSpatialChanges");

has been introduced by Phil Bobo at some threads in the community forum for example in Move Decision Point along the Conveyor by code . The functions are in the library tree in conveyor>conveyor/behaviour/eventfunctions to find, sadly without any parameter to use or comments.

Message 5 of 12

Matthew_Gillespie
Autodesk
Autodesk

I'm pretty sure you'd only need to do it once after setting both. Yes, I looked at the structure and had to follow the function calls until I found this code on a top level panel where it was placed so that multiple fields could use it.



Matthew Gillespie
FlexSim Software Developer

Message 6 of 12

axel_kohonen
Not applicable

Thank you Matthew and Jörg! Seems that the functions are rather well hidden yes, but good that there are people on the forum that know where to find them if one cannot find them himself.

0 Likes
Message 7 of 12

jing_chen
Not applicable

Hi, Matt

I also want to know if there are some other commands just like "setZ" in function_s which can change other variables of Conveyor, and where can I find these codes?

0 Likes
Message 8 of 12

Matthew_Gillespie
Autodesk
Autodesk

All the functions that can be called with the function_s command can be found on this node for the conveyor class:

MAIN:/project/library/conveyor/Conveyor>behaviour/eventfunctions


Matthew Gillespie
FlexSim Software Developer

Message 9 of 12

Matthew_Gillespie
Autodesk
Autodesk

See this more comprehensive answer for Getting and setting conveyor end points



Matthew Gillespie
FlexSim Software Developer

Message 10 of 12

london_mt
Not applicable
@Matthew Gillespie

how do you do this exactly? Doesn't seem to work for me:

16560-flexsimforum.png

It doesn't show anything.

Thanks

Jarek

0 Likes
Message 11 of 12

Matthew_Gillespie
Autodesk
Autodesk

You're not looking at the right object. You're looking at a ConveyorSystem object, not a Conveyor. Look at the path I referenced above.



Matthew Gillespie
FlexSim Software Developer

0 Likes
Message 12 of 12

philboboADSK
Autodesk
Autodesk

To get to the library tree, you need to push the Main button in the Tree Navigation panel in Quick Properties:

16561-main-button.png



Phil BoBo
Sr. Manager, Software Development
0 Likes