From 5536bd1d69866c92809382289322d86ddd5d3d84 Mon Sep 17 00:00:00 2001 From: Jeremy Wright Date: Thu, 18 Dec 2014 14:03:57 -0500 Subject: [PATCH] Fixed an error when a script is closed with no open 3D views. --- CadQuery/Gui/Command.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CadQuery/Gui/Command.py b/CadQuery/Gui/Command.py index f8cf3b1..69dcfa0 100644 --- a/CadQuery/Gui/Command.py +++ b/CadQuery/Gui/Command.py @@ -70,7 +70,12 @@ class CadQueryCloseScript: #Close the matching 3D view if it's open if cqCodePane.file.path is not None: docname = os.path.splitext(os.path.basename(cqCodePane.file.path))[0] - FreeCAD.closeDocument(docname) + + try: + FreeCAD.closeDocument(docname) + except: + #Assume that the document has already been closed + pass #Clear our script and whatever was rendered by it out cqCodePane.file.close()