Arch: Fixed bug introduced by a932f7a

This commit is contained in:
Yorik van Havre 2016-09-10 18:54:40 -03:00
parent ee314edeeb
commit 1ee839b762
2 changed files with 8 additions and 13 deletions

View File

@ -88,7 +88,6 @@ def addComponents(objectsList,host):
c = host.Group c = host.Group
for o in objectsList: for o in objectsList:
if not o in c: if not o in c:
setAsSubcomponent(o)
c.append(o) c.append(o)
host.Group = c host.Group = c
elif hostType in ["Wall","Structure","Window","Roof","Stairs","StructuralSystem","Panel"]: elif hostType in ["Wall","Structure","Window","Roof","Stairs","StructuralSystem","Panel"]:
@ -101,15 +100,12 @@ def addComponents(objectsList,host):
if DraftGeomUtils.isValidPath(o.Shape) and (hostType == "Structure"): if DraftGeomUtils.isValidPath(o.Shape) and (hostType == "Structure"):
if o.Support == host: if o.Support == host:
o.Support = None o.Support = None
setAsSubcomponent(o)
host.Tool = o host.Tool = o
elif Draft.getType(o) == "Axis": elif Draft.getType(o) == "Axis":
if not o in x: if not o in x:
setAsSubcomponent(o)
x.append(o) x.append(o)
elif not o in a: elif not o in a:
if hasattr(o,"Shape"): if hasattr(o,"Shape"):
setAsSubcomponent(o)
a.append(o) a.append(o)
host.Additions = a host.Additions = a
if hasattr(host,"Axes"): if hasattr(host,"Axes"):
@ -118,14 +114,12 @@ def addComponents(objectsList,host):
a = host.Objects a = host.Objects
for o in objectsList: for o in objectsList:
if not o in a: if not o in a:
setAsSubcomponent(o)
a.append(o) a.append(o)
host.Objects = a host.Objects = a
elif host.isDerivedFrom("App::DocumentObjectGroup"): elif host.isDerivedFrom("App::DocumentObjectGroup"):
c = host.Group c = host.Group
for o in objectsList: for o in objectsList:
if not o in c: if not o in c:
setAsSubcomponent(o)
c.append(o) c.append(o)
host.Group = c host.Group = c
@ -150,12 +144,11 @@ def removeComponents(objectsList,host=None):
s = host.Subtractions s = host.Subtractions
for o in objectsList: for o in objectsList:
if not o in s: if not o in s:
setAsSubcomponent(o)
s.append(o) s.append(o)
fixDAG(o) fixDAG(o)
if FreeCAD.GuiUp: if FreeCAD.GuiUp:
if not Draft.getType(o) in ["Window","Roof"]: if not Draft.getType(o) in ["Window","Roof"]:
o.ViewObject.hide() setAsSubcomponent(o)
host.Subtractions = s host.Subtractions = s
else: else:
for o in objectsList: for o in objectsList:
@ -218,9 +211,13 @@ def setAsSubcomponent(obj):
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetBool("applyConstructionStyle",True): if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetBool("applyConstructionStyle",True):
if FreeCAD.GuiUp: if FreeCAD.GuiUp:
color = getDefaultColor("Construction") color = getDefaultColor("Construction")
obj.ViewObject.LineColor = color if hasattr(obj.ViewObject,"LineColor"):
obj.ViewObject.ShapeColor = color obj.ViewObject.LineColor = color
obj.ViewObject.Transparency = int(color[3]*100) if hasattr(obj.ViewObject,"ShapeColor"):
obj.ViewObject.ShapeColor = color
if hasattr(obj.ViewObject,"Transparency"):
obj.ViewObject.Transparency = int(color[3]*100)
obj.ViewObject.hide()
def fixDAG(obj): def fixDAG(obj):
'''fixDAG(object): Fixes non-DAG problems in windows and rebars '''fixDAG(object): Fixes non-DAG problems in windows and rebars

View File

@ -77,7 +77,6 @@ def addToComponent(compobject,addobject,mod=None):
l.append(addobject) l.append(addobject)
setattr(compobject,mod,l) setattr(compobject,mod,l)
if mod != "Objects": if mod != "Objects":
ArchCommands.setAsSubcomponent(addobject)
addobject.ViewObject.hide() addobject.ViewObject.hide()
else: else:
for a in attribs[:3]: for a in attribs[:3]:
@ -118,7 +117,6 @@ def removeFromComponent(compobject,subobject):
compobject.Subtractions = l compobject.Subtractions = l
if (Draft.getType(subobject) != "Window") and (not Draft.isClone(subobject,"Window",True)): if (Draft.getType(subobject) != "Window") and (not Draft.isClone(subobject,"Window",True)):
ArchCommands.setAsSubcomponent(subobject) ArchCommands.setAsSubcomponent(subobject)
subobject.ViewObject.hide()
class SelectionTaskPanel: class SelectionTaskPanel: