Open KeithSloan opened 3 years ago
changing initial block of code to add path to shiboken2 does not seem to fix i.e. `import sys, os
JUPYTER_REPO_PATH = "/Users/keithsloan/Jupyter_FreeCAD"
sys.path.append("/Applications/FreeCAD_0.19-E.app/Contents/Resources/lib") sys.path.append("/Applications/FreeCAD_0.19-E.app/Contents/Resources/lib/python3.8/site-packages") sys.path.append("/Applications/FreeCAD_0.19-E.app/Contents/Resources/lib/python3.8/site-packages/shiboken2") sys.path.append(JUPYTER_REPO_PATH + "IPythonFreeCADViewer")
import FreeCAD, FreeCADGui from pivy import coin from freecadviewer import render_document, get_document_renderer
FreeCADGui.setupWithoutGUI()`
ln[1] : `import sys, os
JUPYTER_REPO_PATH = "/opt/jupyter_freecad/"
JUPYTER_REPO_PATH = "/Users/keithsloan/Jupyter_FreeCAD"
sys.path.append("/opt/freecad/freecad_build/lib")
sys.path.append("/Applications/FreeCAD_0.19-E.app/Contents/Resources/lib/python3.8/site-packages") sys.path.append(JUPYTER_REPO_PATH + "IPythonFreeCADViewer")
import FreeCAD, FreeCADGui from pivy import coin from freecadviewer import render_document, get_document_renderer
FreeCADGui.setupWithoutGUI() `
ln[2] : `scadstr=''' module example_intersection() { intersection() { difference() { union() { cube([30, 30, 30], center = true); translate([0, 0, -25]) cube([15, 15, 50], center = true); } union() { cube([50, 10, 10], center = true); cube([10, 50, 10], center = true); cube([10, 10, 50], center = true); } } translate([0, 0, 5]) cylinder(h = 50, r1 = 20, r2 = 5, center = true); } }
example_intersection(); ''' import OpenSCADUtils, importCSG doc=FreeCAD.activeDocument() or FreeCAD.newDocument() obj = doc.getObject('OpenSCADPart') if obj: for o in App.getDependentObjects(obj.Group, 1): doc.removeObject(o.Name) doc.removeObject(obj.Name)
covert the above OpenSCAD script into CSG script
tmpfilename=OpenSCADUtils.callopenscadstring(scadstr,'csg') try:
remember the existing objects
finally: os.unlink(tmpfilename)`
Gives error `ModuleNotFoundError Traceback (most recent call last)