Exemplo n.º 1
0
 def Activated(self):
     sel = FreeCADGui.Selection.getSelection()
     FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create material"))
     FreeCADGui.addModule("Arch")
     FreeCADGui.Control.closeDialog()
     FreeCADGui.doCommand("mat = Arch.makeMaterial()")
     for obj in sel:
         if hasattr(obj,"BaseMaterial"):
             FreeCADGui.doCommand("FreeCAD.ActiveDocument."+obj.Name+".BaseMaterial = mat")
     FreeCADGui.doCommandGui("mat.ViewObject.startEditing()")
     FreeCAD.ActiveDocument.commitTransaction()
Exemplo n.º 2
0
 def Activated(self):
     sel = FreeCADGui.Selection.getSelection()
     FreeCAD.ActiveDocument.openTransaction(
         translate("Arch", "Create material"))
     FreeCADGui.addModule("Arch")
     FreeCADGui.Control.closeDialog()
     FreeCADGui.doCommand("mat = Arch.makeMaterial()")
     for obj in sel:
         if hasattr(obj, "BaseMaterial"):
             FreeCADGui.doCommand("FreeCAD.ActiveDocument." + obj.Name +
                                  ".BaseMaterial = mat")
     FreeCADGui.doCommandGui("mat.ViewObject.startEditing()")
     FreeCAD.ActiveDocument.commitTransaction()
Exemplo n.º 3
0
    def Activated(self):

        sel = FreeCADGui.Selection.getSelection()
        FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create multi-material"))
        FreeCADGui.addModule("Arch")
        FreeCADGui.Control.closeDialog()
        FreeCADGui.doCommand("mat = Arch.makeMultiMaterial()")
        for obj in sel:
            if hasattr(obj,"Material"):
                if not obj.isDerivedFrom("App::MaterialObject"):
                    FreeCADGui.doCommand("FreeCAD.ActiveDocument."+obj.Name+".Material = mat")
        FreeCADGui.doCommandGui("mat.ViewObject.Document.setEdit(mat.ViewObject, 0)")
        FreeCAD.ActiveDocument.commitTransaction()
        FreeCAD.ActiveDocument.recompute()
Exemplo n.º 4
0
    def Activated(self):

        sel = FreeCADGui.Selection.getSelection()
        FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create multi-material"))
        FreeCADGui.addModule("Arch")
        FreeCADGui.Control.closeDialog()
        FreeCADGui.doCommand("mat = Arch.makeMultiMaterial()")
        for obj in sel:
            if hasattr(obj,"Material"):
                if not obj.isDerivedFrom("App::MaterialObject"):
                    FreeCADGui.doCommand("FreeCAD.ActiveDocument."+obj.Name+".Material = mat")
        FreeCADGui.doCommandGui("mat.ViewObject.Document.setEdit(mat.ViewObject, 0)")
        FreeCAD.ActiveDocument.commitTransaction()
        FreeCAD.ActiveDocument.recompute()
Exemplo n.º 5
0
 def onClickAlign(self):
     """Execute when pressing the align."""
     dir = self.view.getViewDirection().negative()
     camera = self.view.getCameraNode()
     rot = camera.getField("orientation").getValue()
     coin_up = coin.SbVec3f(0, 1, 0)
     upvec = FreeCAD.Vector(rot.multVec(coin_up).getValue())
     _cmd = self.ac
     _cmd += "("
     _cmd += self.tostr(self.getCenterPoint(dir.x, dir.y, dir.z)) + ", "
     _cmd += self.tostr((dir.x, dir.y, dir.z)) + ", "
     _cmd += str(self.getOffset()) + ", "
     _cmd += self.tostr(upvec)
     _cmd += ")"
     FreeCADGui.doCommandGui(_cmd)
     self.display(dir)
     self.finish()
Exemplo n.º 6
0
 def display(self, arg, icon=None):
     """Set the text and icon of the working plane button in the toolbar."""
     o = self.getOffset()
     if o:
         if o > 0:
             suffix = ' +O'
         else:
             suffix = ' -O'
     else:
         suffix = ''
     _vdir = FreeCAD.DraftWorkingPlane.axis
     vdir = '('
     vdir += str(_vdir.x)[:4] + ','
     vdir += str(_vdir.y)[:4] + ','
     vdir += str(_vdir.z)[:4]
     vdir += ')'
     vdir = " " + translate("draft", "Dir") + ": " + vdir
     if type(arg).__name__ == 'str':
         self.wpButton.setText(arg + suffix)
         if o != 0:
             o = " " + translate("draft", "Offset") + ": " + str(o)
         else:
             o = ""
         _tool = translate("draft", "Current working plane") + ": "
         _tool += self.wpButton.text() + o + vdir
         self.wpButton.setToolTip(_tool)
     elif type(arg).__name__ == 'Vector':
         plv = '('
         plv += str(arg.x)[:6] + ','
         plv += str(arg.y)[:6] + ','
         plv += str(arg.z)[:6]
         plv += ')'
         self.wpButton.setText(translate("draft", "Custom"))
         _tool = translate("draft", "Current working plane")
         _tool += ": " + plv + vdir
         self.wpButton.setToolTip(_tool)
     if icon:
         self.wpButton.setIcon(icon)
     else:
         self.wpButton.setIcon(QtGui.QIcon(":/icons/Draft_SelectPlane.svg"))
     p = FreeCAD.DraftWorkingPlane
     self.states.append([p.u, p.v, p.axis, p.position])
     FreeCADGui.doCommandGui("FreeCADGui.Snapper.setGrid()")
Exemplo n.º 7
0
 def onClickAuto(self):
     """Execute when pressing the auto button."""
     FreeCADGui.doCommandGui("FreeCAD.DraftWorkingPlane.reset()")
     self.display('Auto')
     self.finish()
Exemplo n.º 8
0
 def onClickAlign(self):
     """Execute when pressing the align."""
     FreeCADGui.doCommandGui("FreeCAD.DraftWorkingPlane.setup(force=True)")
     d = self.view.getViewDirection().negative()
     self.display(d)
     self.finish()
Exemplo n.º 9
0
 def Activated(self):
     Gui.doCommandGui("import freecad.gears.commands")
     Gui.doCommandGui("freecad.gears.commands.{}.create()".format(
         self.__class__.__name__))
     FreeCAD.ActiveDocument.recompute()
     Gui.SendMsgToActiveView("ViewFit")
Exemplo n.º 10
0
    def Activated(self):

        FreeCADGui.doCommandGui("FreeCAD.DraftWorkingPlane.setSide()")
Exemplo n.º 11
0
 def Activated(self):
     FreeCADGui.addModule("Arch")
     FreeCADGui.doCommandGui("Arch.survey()")
Exemplo n.º 12
0
 def Activated(self):
     FreeCADGui.addModule("Arch")
     FreeCADGui.doCommandGui("Arch.survey()")
Exemplo n.º 13
0
    def onClickAuto(self):

        FreeCADGui.doCommandGui("FreeCAD.DraftWorkingPlane.reset()")
        self.display('Auto')
        self.finish()
Exemplo n.º 14
0
    def Activated(self):

        import FreeCADGui
        FreeCADGui.doCommandGui("FreeCAD.DraftWorkingPlane.setFront()")
Exemplo n.º 15
0
 def Activated(self):
     Gui.doCommandGui("import freecad.gears.commands")
     Gui.doCommandGui("freecad.gears.commands.{}.create()".format(self.__class__.__name__))
     FreeCAD.ActiveDocument.recompute()
     Gui.SendMsgToActiveView("ViewFit")
Exemplo n.º 16
0
    def onClickSide(self):

        o = str(self.getOffset())
        FreeCADGui.doCommandGui(self.ac+"("+self.tostr(self.getCenterPoint(1,0,0))+","+self.tostr((1,0,0))+","+o+")")
        self.display('Side')
        self.finish()
Exemplo n.º 17
0
    def onClickFront(self):

        o = str(self.getOffset())
        FreeCADGui.doCommandGui(self.ac+"("+self.tostr(self.getCenterPoint(0,-1,0))+","+self.tostr((0,-1,0))+","+o+")")
        self.display('Front')
        self.finish()
Exemplo n.º 18
0
    def onClickTop(self):

        o = str(self.getOffset())
        FreeCADGui.doCommandGui(self.ac+"("+self.tostr(self.getCenterPoint(0,0,1))+","+self.tostr((0,0,1))+","+o+")")
        self.display('Top')
        self.finish()