Sanaa Mouzahir wrote:
Hello. I have started a project in which I have to link both
solidworks and python. I want to use Pywin32 to run a macro from
python. here is my code:
app=win32com.client.Dispatch("SldWorks.Application")
app.OpenDoc("C:/Users/sm5126/Downloads/Python/Python/Part1.SLDPRT",
Hello Sanaa,
I used makepy.py to generate swcommands.py, swbindings.py, swconst.py
and cosworks.py and placed them in the same directory as the python file
I ran (at least I think it worked that way).
Then,
import swbindings, swcommands, swconst, cosworks
import win32com.client
import pythoncom
On Feb 10, 2022, at 9:39 AM, Sanaa Mouzahir wrote:
>
> Or maybe After importing the packages I can just use the same command as the
> VBA? I know that for excel the function Application.run(macroname) works, but
> not for solidworks..
Right, because every application defines their own object