question

Axel Kohonen avatar image
2 Likes"
Axel Kohonen asked Phil BoBo commented

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

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?

Thank you!

Kind regards,

Axel

FlexSim 16.0.1
conveyorconveyor properties
v2ni8.png (10.0 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

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

1 Like 1 ·

1 Answer

Matthew Gillespie avatar image
7 Likes"
Matthew Gillespie answered Phil BoBo commented

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).

· 9
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Axel Kohonen avatar image Axel Kohonen commented ·

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 0 ·
Joerg Vogel avatar image Joerg Vogel Axel Kohonen commented ·

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.

2 Likes 2 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Axel Kohonen commented ·

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.

1 Like 1 ·
Axel Kohonen avatar image Axel Kohonen Matthew Gillespie ♦♦ commented ·

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 0 ·
jing.c avatar image jing.c commented ·

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 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ jing.c commented ·

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
2 Likes 2 ·
London MT avatar image London MT Matthew Gillespie ♦♦ commented ·
@Matthew Gillespie

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

It doesn't show anything.

Thanks

Jarek

0 Likes 0 ·
flexsimforum.png (4.7 KiB)
Show more comments