From dfba0f3d5e8cdef6edf75c3cc0577513b8eb9acd Mon Sep 17 00:00:00 2001 From: Jeremy Mack Wright Date: Thu, 27 Dec 2018 17:17:38 -0500 Subject: [PATCH] Added a work-around for running CQ scripts from the FreeCAD macro editor. --- Helpers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Helpers.py b/Helpers.py index d8b0204..68f6653 100644 --- a/Helpers.py +++ b/Helpers.py @@ -46,6 +46,10 @@ def show(cqObject, rgba=(204, 204, 204, 0.0)): ad = FreeCAD.activeDocument() + if ad == None: + FreeCAD.newDocument("untitled" + str(random())) + ad = FreeCAD.activeDocument() + # If we've got a blank shape name, we have to create a random ID if not cqObject.val().label: #Generate a random name for this shape in case we are doing multiple shapes