1

I am currently working on a Projekt to get data from FreeCAD to use in an external script.

My FreeCAD installation:

OS: Windows 10 Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.18.4 (GitTag) Build type: Release Branch: releases/FreeCAD-0-18 Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8 Python version: 3.6.6 Qt version: 5.6.2 Coin version: 4.0.0a OCC version: 7.3.0 Locale: German/Germany (de_DE)

And have problems to import this to a python script.

I am using Python 3.7.4

My Source code:

import sys

# Path to FreeCAD
FREECADPATH = 'C:\FreeCAD 0.18\bin'

def import_freecad(path_freecad):
    """Try to import FreeCAD on path_freecad"""
    sys.path.append(path_freecad)
    try:
        import FreeCAD
    except:
        print("Could not import FreeCAD")

import_freecad(FREECADPATH)

This code always raises the expection. I followed a tutorial pdf you easily can find when google for it.

Anyone has an idea on how to solve this? Or solved the problem themself?

pcmkr929
  • 63
  • 6

1 Answers1

0

Have you tried the "anaconda way"? Seems easier. You can create your own virtual env.(https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands)

And then just type in terminal:

conda install -c conda-forge/label/cf201901 freecad
c4da
  • 73
  • 9