Example #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()
Example #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()
Example #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()
Example #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()
Example #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()
Example #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()")
Example #7
0
 def onClickAuto(self):
     """Execute when pressing the auto button."""
     FreeCADGui.doCommandGui("FreeCAD.DraftWorkingPlane.reset()")
     self.display('Auto')
     self.finish()
Example #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()
Example #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")
Example #10
0
    def Activated(self):

        FreeCADGui.doCommandGui("FreeCAD.DraftWorkingPlane.setSide()")
 def Activated(self):
     FreeCADGui.addModule("Arch")
     FreeCADGui.doCommandGui("Arch.survey()")
Example #12
0
 def Activated(self):
     FreeCADGui.addModule("Arch")
     FreeCADGui.doCommandGui("Arch.survey()")
Example #13
0
    def onClickAuto(self):

        FreeCADGui.doCommandGui("FreeCAD.DraftWorkingPlane.reset()")
        self.display('Auto')
        self.finish()
Example #14
0
    def Activated(self):

        import FreeCADGui
        FreeCADGui.doCommandGui("FreeCAD.DraftWorkingPlane.setFront()")
Example #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")
Example #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()
Example #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()
Example #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()