Menu

#1562 "Undefined varialble from import" with FreeCAD

1.2.6
open
nobody
None
2
2013-04-21
2013-04-21
Bernard
No

Installed version: 2.7.3.2013031601
Using FreeCAD http://www.freecadweb.org/ on Windows XP
This is an easy to install program, and the test code is easy to reproduce.

This code works when running:

import FreeCAD # @UnusedImport
from FreeCAD import Base # @UnusedImport
from FreeCAD import Part #@UnresolvedImport

def clear():
if FreeCAD.ActiveDocument is not None:
for p in FreeCAD.ActiveDocument.findObjects():
FreeCAD.ActiveDocument.removeObject(p.Label)
pass
else:
FreeCAD.newDocument()
FreeCAD.setActiveDocument("Unnamed")
FreeCAD.ActiveDocument = FreeCAD.getDocument("Unnamed")
pass

clear()

but I get errors (please see attached screen print.

Most imports actually work which suggests that the FreeCAD directory is found.

I have searched all stackoverflow.com articles but suggested solutions did not work.

I think it would be great to solve this because it seens so fundamental to me.

1 Attachments

Discussion

  • Bernard

    Bernard - 2013-04-21

    PYTHONPATH setting

     
  • Bernard

    Bernard - 2013-04-21

    Another script file that has more severe errors. Still runs.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.