Can FreeCAD be 'easily' imported into Anaconda-Spyder?

135 Views Asked by At

I have FreeCAD 0.20 installed on a Windows 10 machine and I have Anaconda and Spyder 5.2.2 (Python 3.9.13). I try and run:

import sys
path = 'C:\\Program Files\\FreeCAD 0.20\\bin' #this is the location of FreeCAD.pyd
sys.path.append(path)
import FreeCAD

and I get:

ImportError: DLL load failed while importing FreeCAD: The specified procedure could not be found.

Looking around on the internet there seems to be a few different methods of solving this using conda forge or creating virtual environments and altering environment variables. I don't want to do this. Is there a simple way of fixing this issue without having to set anything else up? (different import command, point the path to a different place, single robust pip install that doesn't rely on installing a bunch of other stuff)

I don't want to have to do any involved installation or setup as we have very locked machines, we often chop-and-change machines so I'd just have to do it again in a couple of months and the likelihood is other members of my team will want to do this - and I've found in the past that the same method often doesn't work on different machines, versions of Python, Spyder, FreeCAD etc

The alternative is I just ask our CAD guys to manually carry out the stuff that I want to automate in python - this is a perfectly good solution if it turns out that FreeCAD is not straightforward to get working in Python and the setup for automating it actually takes longer than manually carrying out the tasks that I want.

Thanks,

0

There are 0 best solutions below