question

lancewu avatar image
0 Likes"
lancewu asked lancewu commented

Problems in creating conveyor belts using code

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.


FlexSim 22.1.4
codec++dll maker
· 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.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

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 0 ·

1 Answer

Kavika F avatar image
1 Like"
Kavika F answered lancewu commented

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


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

lancewu avatar image lancewu commented ·
thank u!it work!!
0 Likes 0 ·