Embedding FreeCAD in python script
Asked Answered
L

0

2

I am trying to run FreeCAD modules from a python script. Here is the code I have written to import the FreeCAD modules according with this tutorial" (eventhoug I don't have any FreeCAD.dll installed on my HD):

FREECADPATH = "C:\\Program Files (x86)\\FreeCAD 0.16\\bin"
import sys
sys.path.append(FREECADPATH)

import FreeCAD
import Part
import Mesh
...then the FreeCAD commands

But i got the following error:

" import Part ImportError: No module named Part"

I also tried with a 64bit version of the FreeCAD

C:\Program Files\FreeCAD 0.16\bin

Any suggestion?

Lorin answered 15/9, 2016 at 9:28 Comment(3)
can you list the contents of C:\\Program Files\\Program Files (x86)\\bin in the question ? it is possible that you need a 64-bit version of python to load a 64 bit DLL.Fuddle
@Jean-FrançoisFabre sorry there was a typo in the question (wrong folder). Do you mean all the file contained in the folders?Lorin
So import FreeCAD was fine and only Part gave an error?Haematinic

© 2022 - 2024 — McMap. All rights reserved.