Using the Arch window tool when a window is selected now produces

a clone
This commit is contained in:
Yorik van Havre 2012-03-24 11:41:45 -03:00
parent 9b6492f9d7
commit e102ab5eca
2 changed files with 11 additions and 1 deletions

View File

@ -33,6 +33,10 @@ __url__ = "http://free-cad.sourceforge.net"
def makeWindow(baseobj=None,name="Window"): def makeWindow(baseobj=None,name="Window"):
'''makeWindow(obj,[name]): creates a window based on the '''makeWindow(obj,[name]): creates a window based on the
given object''' given object'''
if baseobj:
if Draft.getType(baseobj) == "Window":
obj = Draft.clone(baseobj)
return obj
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
_Window(obj) _Window(obj)
_ViewProviderWindow(obj.ViewObject) _ViewProviderWindow(obj.ViewObject)

View File

@ -1581,8 +1581,11 @@ def clone(obj,delta=None):
if not isinstance(obj,list): if not isinstance(obj,list):
obj = [obj] obj = [obj]
cl = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Clone") cl = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Clone")
cl.Label = "Clone of " + obj[0].Label
_Clone(cl) _Clone(cl)
_ViewProviderDraftPart(cl.ViewObject) if gui:
_ViewProviderDraftPart(cl.ViewObject)
formatObject(cl,obj[0])
cl.Objects = obj cl.Objects = obj
if delta: if delta:
cl.Placement.move(delta) cl.Placement.move(delta)
@ -2813,3 +2816,6 @@ class _ViewProviderDraftPart(_ViewProviderDraft):
def getIcon(self): def getIcon(self):
return ":/icons/Tree_Part.svg" return ":/icons/Tree_Part.svg"
def claimChildren(self):
return []