[python-win32] Run solidworks macro from python.

Tim Roberts timr at probo.com
Tue Feb 15 12:31:26 EST 2022


Sanaa Mouzahir wrote:
>
> Apologies for the late reply, I had to go through a lot of 
> documentation regarding SolidWorks itself. Unfortunately, the 
> available documentation that I find is regarding creating a SW COM 
> object, however, nothing about running a macro already written in 
> SolidWorks VB. More specifically, when I look up 'swbindings.py' I do 
> not get any output, and if I try to import it, I get the error message 
> 'no module named swbindings'.

Anything you can do from VBA can be done from Python, and it's usually a 
one-for-one translation.  Somewhere in the SolidWorks object model 
documentation, there has to be a command to run a named VBA script.  
That's what you need to find.  The key is that this is not Python 
related.  You're just controlling their COM server, so you need to find 
the right method in the right interface in their object model.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3389 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://mail.python.org/pipermail/python-win32/attachments/20220215/15c6f13f/attachment.bin>


More information about the python-win32 mailing list