Problems in creating conveyor belts using code

Problems in creating conveyor belts using code

lancewu
Not applicable
198 Views
3 Replies
Message 1 of 4

Problems in creating conveyor belts using code

lancewu
Not applicable

[ FlexSim 22.1.4 ]

When I am using dllmaker VS2013, I use createinstance (node ("Main:/project/library/concert/StraightConvenor"), model());

Create a conveyor belt and set its size, it will display the following situation.

屏幕截图-2024-03-04-160206.png

Although its size is the same as what I set, the item will get stuck here. When I try to click on this conveyor, its ExitTransfer1 will go somewhere else, perhaps this is the reason for its blockage.

屏幕截图-2024-03-04-160213.png

屏幕截图-2024-03-04-160221.png

I can manually drag and drop this conveyor belt, and ExitTransfer1 will return to where it should be. Is there a code way to achieve this effect?

I tried "restmodel()" but it didn't work.


0 Likes
Accepted solutions (1)
199 Views
3 Replies
Replies (3)
Message 2 of 4

kavika_faleumu
Autodesk
Autodesk
Accepted solution

Hey @lancewu, it seems that the conveyor exit transfer isn't updating it's location correctly when you programmatically set the conveyor size and do contextdragconnection() to make an exit transfer. A solution could be to call this function after setting conveyor size and making an exit transfer:

Conveyor conv = createinstance(node("MAIN:/project/library/conveyor/StraightConveyor"), model());
Object exitTransfer = function_s(conv, "addExitTransfer");
...  // set conveyor properties, do contextdragconnection()
int convLength = conv.getProperty("HorizontalLength");
function_s(exitTransfer, "setDistAlongConveyor", convLength);

This will move the exitTransfer to the end of the conveyor. Visually, it may look like it's in the wrong place (until you click on it or the conveyor it's on), but with regards to functionality, it works properly.

create-conveyor_1.fsm

Message 3 of 4

jason_lightfoot_adsk
Autodesk
Autodesk

Hi @lancewu, was Kavika F's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes
Message 4 of 4

lancewu
Not applicable
thank u!it work!!
0 Likes