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)
'..........
Dear Joao,
I can see that you submitted a service request, which is great. We will pick it up as soon as possible.
Indeed, the question goes a bit beyond our PLAXIS support, but we can see if we can help you move one step further with this.
Hi Stefanos, I have the same query in terms of trying to run a python script (automatically generated from Excel Data) from Excel itself (easier for other users who do not feel comfortable using the Python editor from PLAXIS). Do I have to raise a Service Request separately ? Thanks in anticipation
Dear Sangeet,
I would first recommend you check online on how to read data from Excel using Python.
From the PLAXIS point of view, we just need to pass data to the command line. Reading it from Excel is a separate process that is the Python side and for that you do not need a service request.
If you have managed to successfully read data from Excel (choose any of the Python modules available out there) and you have problems figuring out what command to use or PLAXIS gives an error, feel free to submit a service request as for the PLAXIS part we can definitely assist.
Thanks Stefanos.
I managed to fix it somehow and it is working absolutely fine.
Thanks again