question

xiaocheng xie avatar image
1 Like"
xiaocheng xie asked xiaocheng xie commented

How to add trigger codes in ProcessFlow User Library?

hello all

My question is similar to this post,but my focus is on the processflow userlibrary. When I drag my pf module to pf model,I want to do some user defined functions. I have read the manual:Reference / Developer and Advanced User Reference / Custom Libraries / Model Libraries Node. and i think the dropscript is key to my question. but when i tried this method for several times,I found the dropscript does't trigger in the pf library not like normal uselibrary. Hope my question is clear.

FlexSim 18.2.3
processflowuserlibrarydropscript
· 2
5 |100000

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

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

Please post an example so we can replicate your issue to explain what is happening and how to fix it.

0 Likes 0 ·
xiaocheng xie avatar image xiaocheng xie Phil BoBo ♦♦ commented ·

Hi bobo

Thanks for your reply. My PF userlibrary is like the attached .fsl.and When I drag the "process" modeul to a general ProcessFlow, I want to get a trigger like dropscript where i can get param like " onto object" . and then i can do some user defined functions like define the "process" rotation, height or something like this. Hope my issue is clear this time.

dropscriptissue.fsl

0 Likes 0 ·

1 Answer

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered xiaocheng xie commented

Because the CustomFlow1 object has the userLibrary node with a value of ProcessFlow it is skipping the dropscript function. If you delete that userLibrary node it will start calling the dropscript function.

Then, to get it to actually add the process flow activities to the view you need to put this code in the dropscript function:

treenode droppedObj = dropnodefrom();
treenode view = param(5);

function_s(view, "dropUserLibraryObject", droppedObj);
· 3
5 |100000

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

xiaocheng xie avatar image xiaocheng xie commented ·

Hi Matthew

Thanks for your reply. i try to remove the userlibrary object inside the CustomFlow1,but after this action, when i drag the CuostomeFlow1 to processflow,nothing is in the processflow,and the dropscript didn't trigger as before,and when i add the codes you gave to the dropscript , nothing changed again. Can you give me a .fsl? and my flexsim version is 2018.2.2.

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ xiaocheng xie commented ·

It looks like my solution only works for version 19.0 and later. Unfortunately, I don't see any way to get the behavior you want in 18.2. The code for dropping objects in the Process Flow view in 18.2 doesn't have any points where it lets you execute any other code. In 19.0, however, the code was updated to look for a dropscript node on the dropped object.

1 Like 1 ·
xiaocheng xie avatar image xiaocheng xie Matthew Gillespie ♦♦ commented ·

Hi Matthew

Thank you!

0 Likes 0 ·