Esempio n. 1
0
    def Activated(self):
        sel = FreeCADGui.Selection.getSelection()
        ok = False
        if (len(sel) == 1):
            if Draft.getType(sel[0]) in ["Cell","Building","Floor"]:
                FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Type conversion")))
                FreeCADGui.doCommand("import Arch")
                FreeCADGui.doCommand("obj = Arch.makeSite()")
                FreeCADGui.doCommand("Arch.copyProperties(FreeCAD.ActiveDocument."+sel[0].Name+",obj)")
                FreeCADGui.doCommand('FreeCAD.ActiveDocument.removeObject("'+sel[0].Name+'")')

                nobj = makeSite()
                ArchCommands.copyProperties(sel[0],nobj)
                FreeCAD.ActiveDocument.removeObject(sel[0].Name)
                FreeCAD.ActiveDocument.commitTransaction()
                ok = True
        if not ok:
            ss = "["
            for o in sel:
                if len(ss) > 1:
                    ss += ","
                ss += "FreeCAD.ActiveDocument."+o.Name
            ss += "]"
            FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Site")))
            FreeCADGui.doCommand("import Arch")
            FreeCADGui.doCommand("Arch.makeSite("+ss+")")
            FreeCAD.ActiveDocument.commitTransaction()
            FreeCAD.ActiveDocument.recompute()
Esempio n. 2
0
    def Activated(self):
        sel = FreeCADGui.Selection.getSelection()
        ok = False
        if (len(sel) == 1):
            if Draft.getType(sel[0]) in ["Cell", "Building", "Floor"]:
                FreeCAD.ActiveDocument.openTransaction(
                    translate("Arch", "Type conversion"))
                FreeCADGui.addModule("Arch")
                FreeCADGui.doCommand("obj = Arch.makeSite()")
                FreeCADGui.doCommand(
                    "Arch.copyProperties(FreeCAD.ActiveDocument." +
                    sel[0].Name + ",obj)")
                FreeCADGui.doCommand('FreeCAD.ActiveDocument.removeObject("' +
                                     sel[0].Name + '")')

                nobj = makeSite()
                ArchCommands.copyProperties(sel[0], nobj)
                FreeCAD.ActiveDocument.removeObject(sel[0].Name)
                FreeCAD.ActiveDocument.commitTransaction()
                ok = True
        if not ok:
            ss = "["
            for o in sel:
                if len(ss) > 1:
                    ss += ","
                ss += "FreeCAD.ActiveDocument." + o.Name
            ss += "]"
            FreeCAD.ActiveDocument.openTransaction(
                translate("Arch", "Create Site"))
            FreeCADGui.addModule("Arch")
            FreeCADGui.doCommand("Arch.makeSite(" + ss + ")")
            FreeCAD.ActiveDocument.commitTransaction()
            FreeCAD.ActiveDocument.recompute()
Esempio n. 3
0
 def Activated(self):
     sel = FreeCADGui.Selection.getSelection()
     ok = False
     if len(sel) == 1:
         if Draft.getType(sel[0]) in ["Cell", "Site", "Floor"]:
             FreeCAD.ActiveDocument.openTransaction("Type conversion")
             nobj = makeBuilding()
             ArchCommands.copyProperties(sel[0], nobj)
             FreeCAD.ActiveDocument.removeObject(sel[0].Name)
             FreeCAD.ActiveDocument.commitTransaction()
             ok = True
     if not ok:
         FreeCAD.ActiveDocument.openTransaction("Building")
         makeBuilding(sel)
         FreeCAD.ActiveDocument.commitTransaction()
         FreeCAD.ActiveDocument.recompute()
Esempio n. 4
0
 def Activated(self):
     sel = FreeCADGui.Selection.getSelection()
     ok = False
     if (len(sel) == 1):
         if Draft.getType(sel[0]) in ["Cell", "Building", "Floor"]:
             FreeCAD.ActiveDocument.openTransaction("Type conversion")
             nobj = makeSite()
             ArchCommands.copyProperties(sel[0], nobj)
             FreeCAD.ActiveDocument.removeObject(sel[0].Name)
             FreeCAD.ActiveDocument.commitTransaction()
             ok = True
     if not ok:
         FreeCAD.ActiveDocument.openTransaction("Site")
         makeSite(sel)
         FreeCAD.ActiveDocument.commitTransaction()
         FreeCAD.ActiveDocument.recompute()