ansys / pymechanical

Pythonic interface to Ansys Mechanical ™
https://mechanical.docs.pyansys.com/
MIT License
34 stars 18 forks source link

Add future APIs #331

Open koubaa opened 1 year ago

koubaa commented 1 year ago

Add the option to use scripting APIs developed in version N in pymechanical version <N.

This can be done by implementing the APIs directly in C# in some Ansys.Mechanical.Future namespace. The APIs can be implemented as extension methods and "installed" like this:

import clr
import sys

sys.path.append(r"path\to\future\dll")
clr.AddReference("Ansys.Mechanical.Future")
import Ansys
clr.ImportExtensions(Ansys.Mechanical.Future)
Model.SomeFutureAPI()

ImportExtensions is still not implemented in pythonnet, see https://github.com/pythonnet/pythonnet/issues/55, but for the remote sessions this can use IronPython- assuming that the assembly is copied to the machine where the remote instance is running. Fixing that issue in pythonnet or our fork would allow us to make use of this for embedded instances.

I have a reference implementation of the C# code built against ansys version 241 in this branch. This issue tracks adding that DLL to pymechanical, figuring out how to build it as part of the CI/CD, and the client side work to include that in embedding and remote sessions.

koubaa commented 1 year ago

Let's include the fix for https://github.com/ansys/pymechanical/issues/318 in the first version of the future library