question

Ryosuke S avatar image
0 Likes"
Ryosuke S asked Jing_69 commented

Using FlexSim with Python/C api

Hello! After having discussion with one of your colleague, I have found out that you can use python in FlexSim by Python/C API. However, to confess, I'm not fond in this field. Do you have any kind of manual or note to integrate Python/C to FlexSim? I'd really appreciate if you can also provide some kind of sample project, model,etc. Thank you in advance.

FlexSim 20.2.2
flexsim 20.2.2module sdkpython
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
0 Likes"
Phil BoBo answered Ryosuke S commented

Download the Module SDK from the Account section of the website. Follow its embedded documentation on how to use it to create a FlexSim Module and compile a module dll.

Once you can compile a module dll, follow the instructions at https://docs.python.org/3/extending/embedding.html for executing Python from C++ code.

When you install Python, it includes a bunch of header files (including Python.h), lib files (including python3.lib), and dlls (including python3.dll). You will use these in your Module DLL project to interact with Python.

You are unlikely to find someone who has already done this and can share a sample project/model because executing Python from C is rarely helpful. Most 3rd party code libraries are already written in C or C++, so you can connect directly to them. Usually those libraries have Python wrappers so that you can call them from Python. If you are already in C++, then you don't need to use Python wrapper libraries. You can call them directly from C++ instead of going from C++ to Python back to C.

Is there a particular library that you are trying to use, or is this simply an academic exercise to see what is possible?


1603121043564.png (43.3 KiB)
· 6
5 |100000

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

Jing_69 avatar image
0 Likes"
Jing_69 answered Jing_69 commented

@Ryosuke S Hello, we have the same question about how to integrate flexsim with Python, and we know that you've solved it. Could you please tell us the solutions or give some notes. Thank you so much!

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