Exemplo n.º 1
0
 def AddPoint(self, d):
     if d.type == cad.DigitizeType.DIGITIZE_NO_ITEM_TYPE:
         return 
     calculated = False
     cad.StartHistory()
     if self.is_an_add_level(self.draw_step):
         calculated = self.calculate_item(d)
         if calculated:
             self.before_add_item()
             self.prev_object = self.TempObject()
             self.AddObjectsMade()
             self.set_previous_direction()
             
     self.ClearObjectsMade()
     self.SetStartPosUndoable(d)
     #cad.UseDigitiedPointAsReference()
     
     next_step = self.draw_step + 1
     if next_step >= self.number_of_steps():
         next_step = self.step_to_go_to_after_last_step()
         
     self.SetDrawStepUndoable(next_step)
     cad.EndHistory()
     self.getting_position = False
     self.inhibit_coordinate_change = False
     cad.Repaint()
Exemplo n.º 2
0
 def AddObjectFromButton(self, new_object):
     cad.StartHistory()
     cad.AddUndoably(new_object, None, None)
     cad.ClearSelection(True)
     cad.Select(new_object)
     self.SetInputMode(self.select_mode)
     cad.EndHistory()
     cad.Repaint()
Exemplo n.º 3
0
 def BackPlot(self):
     from NcCode import NcCodeWriter
     machine_module = __import__('nc.' + self.machine.reader,
                                 fromlist=['dummy'])
     parser = machine_module.Parser(NcCode.NcCodeWriter(self.nccode))
     self.nccode.Clear()
     parser.Parse(self.GetOutputFileName())
     wx.GetApp().output_window.SetNcCodeObject(self.nccode.nc_code)
     cad.Repaint()
Exemplo n.º 4
0
 def OnMouse(self, event):
     if event.LeftDown():
         self.point_or_window.OnMouse(event)
         self.lbutton_point = cad.Digitize(cad.IPoint(event.x, event.y))
     elif event.LeftUp():
         if self.lbutton_point.type != cad.DigitizeType.DIGITIZE_NO_ITEM_TYPE:
             self.digitized_point = self.lbutton_point
             wx.GetApp().ExitMainLoop()
     elif event.Moving():
         self.digitized_point = cad.Digitize(cad.IPoint(event.x, event.y))
         self.point_or_window.OnMouse(event)
         wx.GetApp().frame.input_mode_canvas.Refresh()
         cad.Repaint()
Exemplo n.º 5
0
 def RecalculateAndRedraw(self, point):
     self.set_digitize_plane()
     
     end = cad.Digitize(point)
     if end.type == cad.DigitizeType.DIGITIZE_NO_ITEM_TYPE:
         return
     if self.is_a_draw_level(self.draw_step):
         if self.DragDoneWithXOR():
             wx.GetApp().EndDrawFront()
         self.calculate_item(end)
         if self.DragDoneWithXOR():wx.GetApp().DrawFront()
         else: cad.Repaint(True)
     return end
Exemplo n.º 6
0
 def OnImport(self, e):
     config = HeeksConfig()
     default_directory = config.Read('ImportDirectory', self.GetDefaultDir())
     
     dialog = wx.FileDialog(self.frame, 'Import File', default_directory, '', self.GetWildcardString(True))
     dialog.CenterOnParent()
     
     if dialog.ShowModal() == wx.ID_OK:
         filepath = dialog.GetPath()
         res = cad.Import(filepath)
         if res:
             self.DoFileOpenViewMag()
             if self.filepath == None:
                 dot = filepath.rfind('.')
                 if dot != -1:
                     self.filepath = filepath[:dot+1] + 'heeks'
             self.frame.SetFrameTitle()
             config.Write('ImportDirectory', dialog.GetDirectory())
             cad.Repaint()
Exemplo n.º 7
0
 def RepositionTag(self, object):
     pos = self.PickPosition('Pick New Tag Position')
     object.pos.x = pos.x
     object.pos.y = pos.y
     cad.Repaint()
Exemplo n.º 8
0
    def OnScreenText(self, event):
        wx.GetApp().graphics_text_mode = event.GetSelection()
        HeeksConfig().WriteInt("TextMode", event.GetSelection())

        cad.Repaint()