I defined the Fun1 function.If I want to use Fun1 in Fun2, how do I do it?
I defined the Fun1 function.If I want to use Fun1 in Fun2, how do I do it?
Don't call FLEXSIMINTERFACE functions from another C++ function.
Add a different function with its own signature and call it from both of those functions.
double Fun1_cpp(double a, double b) { return a+b; } visible double Fun1(FLEXSIMINTERFACE) { double a = param(1); double b = param(2); return Fun1_cpp(a, b); } visible double Fun2(FLEXSIMINTERFACE) { double a = param(1); double b = param(2); double c = Fun1_cpp(a, b); return c; }
or
double Fun1(double a, double b) { return a+b; } visible double Fun1_FS(FLEXSIMINTERFACE) { double a = param(1); double b = param(2); return Fun1(a, b); } visible double Fun2_FS(FLEXSIMINTERFACE) { double a = param(1); double b = param(2); double c = Fun1(a, b); return c; }
Thanks for your reply. But my picture is just a simple example. In fact, Fun1 and Fun2 are custom user commands that use flexsim functions and syntax. I find it very convenient to call Fun2 in Flexsim, but I don't know how to do it in DLLMaker, that's what I'm confused about.
If you're saying that you want to call a FlexSim user command from the DLL maker then your example isn't showing what you wanted to do - hence Phil's reply. In that case you should be able to use nodefunction() on the user command flexScript node or node.evaluate() which should run the command and return the result.
Both Fun1 and Fun2 functions are defined and implemented in DLLMaker. Then back in Flexsim, Fun1 and Fun2 are used as user commands .
The picture below shows a simple example. In fact. The Fun1 function can be more complicated. I want to call Fun1 from Fun2 .
15 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved