I am trying to automate Maxsurf using Python. My code in Python is as follows-
import win32com.client as win32 msApp = win32.Dispatch("BentleyModeler.Application") FileName = "MonoHull.msd" msApp.Design.Open FileName,False,False
While executing, I get the following error. What is the remedy here? And why do I get the list of objects (as en excel vba) in python?
C:\Users\USER\PycharmProjects\VBA\venv\Scripts\python.exe C:/Users/USER/PycharmProjects/VBA/main.py File "C:\Users\USER\PycharmProjects\VBA\main.py", line 4 msApp.Design.Open FileName,False,False ^^^^^^^^SyntaxError: invalid syntax
Hi Rounak,
I don't support python unfortunately. Only VBA. So any advice I can give you, you'll need to translate to python.
I suspect that your filename here needs to include the filepath ("C:\ . . . " etc.). It would in VBA.
The best trick for something like this is to prove that you have connection to MAXSURF. Getting the version number doesn't need a design open or anything like that. So its a really good test to check that we can talk to MAXSURF.
Use a line like:
a = msApp.version
Regards,
James
Yes, I get response from Maxsirf with this line of code.