print ('Hello Plaxis!')
I understand that my question falls slightly outside of Plaxis domain and enters more into pure Python and app interaction (in Windows environment) however, since no one in other computer science communities was able to help me with the 'how to get this working' I will have to turn to you as a last and final instance. In spite of not being 100% Plaxis related question I guess it may make the life of many of Python coders and Plaxis users easier once it is solved.
So, I have developed a Python script to automatize routine calculations in Plaxis. All the input is provided by the user in an Excel file which generates .csv files via a macro, that will later be read by Python. Later the information is finally set to Plaxis. The input has the Plaxis scripting password, input/output doors, builds the model (Soils, Structures, Flow, Mesh, Phases), runs the Plaxis analysis, saves it and closes Plaxis at the very end. So, all looks fantastic – your help in this forum has been priceless for the success of the task, THANK YOU.
Notwithstanding that all is running well there is one step that is preventing the coupled harmony between Excel and Plaxis. I have tried to open the .py file with the script via an Excel macro (see an extract of the code below) using the command prompt linking with the Python interpreter that comes with Plaxis. I have also tried to create a batch file to make things easier but, the result was the same. Whilst I am able to open any other very simple scripts via Excel macros, opening the script that interacts with Plaxis hasn’t been easy. What am I missing to make this work?
'........ a little bit of VBA :(.. - sorry
PythonExe = """C:\ProgramData\Bentley\Geotechnical\PLAXIS 2D CONNECT Edition V20\python\python.exe"""
PythoScript = """C:\Users\ukjfv001\Desktop\Fehmarnbelt\Models - Geotechnical\Python to Plaxis\013\Plaxis_Analysis.py"""
pth = PythonExe & PythoScript
Set wsh = VBA.CreateObject("WScript.Shell")
run_Plx = wsh.Run(pth, windowStyle, waitOnReturn)
'..........