From 0fcb378f02e32c7cbffe2e96554ed2603b46a928 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 11 Jun 2018 21:44:23 -0300 Subject: [PATCH] Arch/Draft: Fixed bugs in non-GUI mode --- src/Mod/Arch/ArchComponent.py | 27 +++++++++++++++------------ src/Mod/Draft/Draft.py | 4 ++-- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 243239b85c..f14bca92b8 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -629,23 +629,26 @@ class Component: def hideSubobjects(self,obj,prop): "Hides subobjects when a subobject lists change" - if prop in ["Additions","Subtractions"]: - if hasattr(obj,prop): - for o in getattr(obj,prop): - if (Draft.getType(o) != "Window") and (not Draft.isClone(o,"Window",True)): - if (Draft.getType(obj) == "Wall"): - if (Draft.getType(o) == "Roof"): - continue + + if FreeCAD.GuiUp: + if prop in ["Additions","Subtractions"]: + if hasattr(obj,prop): + for o in getattr(obj,prop): + if (Draft.getType(o) != "Window") and (not Draft.isClone(o,"Window",True)): + if (Draft.getType(obj) == "Wall"): + if (Draft.getType(o) == "Roof"): + continue + o.ViewObject.hide() + elif prop in ["Mesh"]: + if hasattr(obj,prop): + o = getattr(obj,prop) + if o: o.ViewObject.hide() - elif prop in ["Mesh"]: - if hasattr(obj,prop): - o = getattr(obj,prop) - if o: - o.ViewObject.hide() def processSubShapes(self,obj,base,placement=None): "Adds additions and subtractions to a base shape" + import Draft,Part #print("Processing subshapes of ",obj.Label, " : ",obj.Additions) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 57a6ca6273..4d94792a2c 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -47,11 +47,11 @@ __url__ = "http://www.freecadweb.org" '''The Draft module offers a range of tools to create and manipulate basic 2D objects''' -import FreeCAD, math, sys, os, DraftVecUtils, Draft_rc, WorkingPlane +import FreeCAD, math, sys, os, DraftVecUtils, WorkingPlane from FreeCAD import Vector if FreeCAD.GuiUp: - import FreeCADGui + import FreeCADGui, Draft_rc from PySide import QtCore from PySide.QtCore import QT_TRANSLATE_NOOP gui = True