コード例 #1
0
ファイル: CamApp.py プロジェクト: danheeks/PyCAM
 def OnLeftClick(self, event):
     if not event.controlDown:
         # check for nc code block clicked
         if self.select_mode.filter.IsTypeInFilter(cam.GetNcCodeBlockType()):
             mask = cad.Filter()
             mask.AddType(cam.GetNcCodeBlockType())
             objects = cad.ObjectsUnderWindow(cad.IRect(self.select_mode.button_down_point.x, self.select_mode.button_down_point.y), False, True, mask, False)
             if len(objects):
                 block = objects[0]
                 cad.ClearSelection()
                 cad.Select(block)
                 block.__class__ = cam.NcCodeBlock
                 self.output_window.viewport.SelectLine(block.line_number, True)
                 wx.GetApp().frame.graphics_canvas.Refresh()
                 self.output_window.Refresh()
                 return            
             
             program = wx.GetApp().program
             if program != None:
                 nccode = program.nccode
                 if nccode != None:
                     nccode.nc_code.SetHighlightedBlock(None)
     
     # do the default click behaviour
     SolidApp.OnLeftClick(self, event)
コード例 #2
0
 def OnLeftClick(self, event):
     # select one object
     objects = cad.ObjectsUnderWindow(cad.IRect(self.select_mode.button_down_point.x, self.select_mode.button_down_point.y), False, True, self.select_mode.filter, True)
     if len(objects) > 0:
         object = objects[0]
         
         if event.controlDown:
             if cad.ObjectMarked(object):
                 cad.Unselect(object, True)
             else:
                 cad.Select(object)
         else:
             cad.ClearSelection(True)
             cad.Select(object)
     else:
         cad.ClearSelection(True)
コード例 #3
0
 def GetTools(self, x, y, control_pressed):
     self.frame.graphics_canvas.SetCurrent(self.frame.graphics_canvas.context)# should be somewhere else, but for now fixes a problem
     
     # get object tools
     objects = cad.ObjectsUnderWindow(cad.IRect(x, y), False, True, self.select_mode.filter, False)
     global tools
     tools = []
     make_container = len(objects)>1
     for object in objects:
         object_tools = self.GetObjectTools(object, control_pressed)
         if make_container:
             tool_list = ContextTool.ObjectToolList(object)
             tool_list.tools += object_tools
             tools.append(tool_list)
         else:
             tools.append(ContextTool.ObjectTitleTool(object))# object name with icon
             tools += object_tools
         
     return tools
コード例 #4
0
ファイル: DigitizeMode.py プロジェクト: danheeks/PyCAD
 def __init__(self, wd):
     if wd: self.window = WindowDragging()
     else: self.window = None
     self.box_chosen = cad.IRect()
     self.reset()
     self.visible = False
コード例 #5
0
ファイル: DigitizeMode.py プロジェクト: danheeks/PyCAD
 def reset(self):
     self.window_box = cad.IRect()
     self.box_found = False
     self.finish_dragging = False