Ejemplo n.º 1
0
    def proceed(self):
        """Proceed with execution of the command after selection."""
        if self.call:
            self.view.removeEventCallback("SoEvent", self.call)

        self.selected_objects = Gui.Selection.getSelection()
        self.selected_objects = utils.getGroupContents(self.selected_objects)
        self.selected_subelements = Gui.Selection.getSelectionEx()
        self.refs = []
        self.ui.pointUi(self.name)
        self.ui.modUi()
        self.ui.xValue.setFocus()
        self.ui.xValue.selectAll()
        self.pickmode = False
        self.task = None
        self.call = self.view.addEventCallback("SoEvent", self.action)
        _msg(translate("draft", "Pick base point"))
Ejemplo n.º 2
0
 def execute(self, obj):
     result = ""
     if hasattr(obj, "Source"):
         if obj.Source:
             if hasattr(obj, "LineStyle"):
                 ls = obj.LineStyle
             else:
                 ls = None
             if hasattr(obj, "LineColor"):
                 lc = obj.LineColor
             else:
                 lc = None
             if hasattr(obj, "LineSpacing"):
                 lp = obj.LineSpacing
             else:
                 lp = None
             if obj.Source.isDerivedFrom("App::DocumentObjectGroup"):
                 svg = ""
                 shapes = []
                 others = []
                 objs = utils.getGroupContents([obj.Source])
                 for o in objs:
                     v = o.ViewObject.isVisible()
                     if hasattr(obj, "AlwaysOn"):
                         if obj.AlwaysOn:
                             v = True
                     if v:
                         svg += getSVG(o, obj.Scale, obj.LineWidth,
                                       obj.FontSize.Value, obj.FillStyle,
                                       obj.Direction, ls, lc, lp)
             else:
                 svg = getSVG(obj.Source, obj.Scale, obj.LineWidth,
                              obj.FontSize.Value, obj.FillStyle,
                              obj.Direction, ls, lc, lp)
             result += '<g id="' + obj.Name + '"'
             result += ' transform="'
             result += 'rotate(' + str(obj.Rotation) + ',' + str(
                 obj.X) + ',' + str(obj.Y) + ') '
             result += 'translate(' + str(obj.X) + ',' + str(obj.Y) + ') '
             result += 'scale(' + str(
                 obj.Scale) + ',' + str(-obj.Scale) + ')'
             result += '">'
             result += svg
             result += '</g>'
     obj.ViewResult = result
Ejemplo n.º 3
0
 def proceed(self):
     """Continue with the command after a selection has been made."""
     if self.call:
         self.view.removeEventCallback("SoEvent", self.call)
     self.selected_objects = Gui.Selection.getSelection()
     self.selected_objects = utils.getGroupContents(self.selected_objects,
                                                    addgroups=True,
                                                    spaces=True,
                                                    noarchchild=True)
     self.selected_subelements = Gui.Selection.getSelectionEx()
     self.step = 0
     self.center = None
     self.ui.rotateSetCenterUi()
     self.ui.modUi()
     self.ui.setTitle(translate("draft", "Rotate"))
     self.arctrack = trackers.arcTracker()
     self.call = self.view.addEventCallback("SoEvent", self.action)
     _msg(translate("draft", "Pick rotation center"))
Ejemplo n.º 4
0
 def proceed(self):
     """Continue with the command after a selection has been made."""
     if self.call:
         self.view.removeEventCallback("SoEvent", self.call)
     self.selected_objects = Gui.Selection.getSelection()
     self.selected_objects = utils.getGroupContents(self.selected_objects,
                                                    addgroups=True,
                                                    spaces=True,
                                                    noarchchild=True)
     self.selected_subelements = Gui.Selection.getSelectionEx()
     self.ui.lineUi(self.name)
     self.ui.modUi()
     if self.copymode:
         self.ui.isCopy.setChecked(True)
     self.ui.xValue.setFocus()
     self.ui.xValue.selectAll()
     self.call = self.view.addEventCallback("SoEvent", self.action)
     _msg(translate("draft", "Pick start point"))