예제 #1
0
 def Activated(self):
     self.view = FreeCADGui.ActiveDocument.ActiveView
     self.x = False
     self.y = False
     self.createcallback = self.view.addEventCallbackPivy(
         SoMouseButtonEvent.getClassTypeId(), self._makepoint)
     FreeCAD.ActiveDocument.recompute()
예제 #2
0
 def _makepoint(self,event_cb):
     event = event_cb.getEvent()
     if event.getState() == SoMouseButtonEvent.DOWN:
         pos = event.getPosition()
         point = self.view.getPoint(pos[0],pos[1])
         self.x=point[0]
         self.y=point[1]
         if self.x != False and self.y!=False:
             self.a=FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Point")
             moveablePoint(self.a, self.x, self.y)
             ViewProvidermoveablePoint(self.a.ViewObject)
             self.view.removeEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self.createcallback)    
예제 #3
0
 def _makepoint(self, event_cb):
     event = event_cb.getEvent()
     if event.getState() == SoMouseButtonEvent.DOWN:
         pos = event.getPosition()
         point = self.view.getPoint(pos[0], pos[1])
         self.x = point[0]
         self.y = point[1]
         if self.x and self.y:
             self.a = FreeCAD.ActiveDocument.addObject(
                 "App::FeaturePython", "Point")
             moveablePoint(self.a, self.x, self.y)
             ViewProvidermoveablePoint(self.a.ViewObject)
             self.view.removeEventCallbackPivy(
                 SoMouseButtonEvent.getClassTypeId(), self.createcallback)
예제 #4
0
 def Activated(self):
     self.view = FreeCADGui.ActiveDocument.ActiveView
     self.b=FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Line")
     self.ml = moveableSpline(self.b, [])
     ViewProvidermoveableSpline(self.b.ViewObject)
     self.a1 = FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Point")
     moveablePoint(self.a1, 1., 1.)
     ViewProvidermoveablePoint(self.a1.ViewObject, self.ml)
     self.a2=FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Point")
     moveablePoint(self.a2, 2., 2.)
     ViewProvidermoveablePoint(self.a2.ViewObject, self.ml)
     self.a3=FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Point")
     moveablePoint(self.a3, 2., 0.)
     ViewProvidermoveablePoint(self.a3.ViewObject, self.ml)
     self.b.Proxy.addObject(self.a1)
     self.b.Proxy.addObject(self.a2)
     self.b.Proxy.addObject(self.a3)
     self.createcallback = self.view.addEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self._makepoint)
예제 #5
0
	def event(self,eventCB):
		"Checks event type, passes on to appropriate function"
		event = eventCB.getEvent()
		type = event.getTypeId()
		leftButton = 1
		rollerButton = 3
		down = 1
		up = 0
		if type == SoLocation2Event.getClassTypeId():
			self.mouseMove(event)
		elif type == SoMouseButtonEvent.getClassTypeId() and event.getButton() == leftButton:	
			if event.getState() == down:
				self.mouseButtonDown()	
			elif event.getState() == up:
				self.mouseButtonUp()	
		elif type == SoKeyboardEvent.getClassTypeId():
			self.keyboard(event)			
		else:
			FreeCAD.Console.PrintMessage("Some other event just happened\n")
예제 #6
0
 def Activated(self):
     self.view = FreeCADGui.ActiveDocument.ActiveView
     self.b = FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Line")
     self.ml = moveableSpline(self.b, [])
     ViewProvidermoveableSpline(self.b.ViewObject)
     self.a1 = FreeCAD.ActiveDocument.addObject("App::FeaturePython",
                                                "Point")
     p1 = moveablePoint(self.a1, 1., 1.)
     ViewProvidermoveablePoint(self.a1.ViewObject, self.ml)
     self.a2 = FreeCAD.ActiveDocument.addObject("App::FeaturePython",
                                                "Point")
     p2 = moveablePoint(self.a2, 2., 2.)
     ViewProvidermoveablePoint(self.a2.ViewObject, self.ml)
     self.a3 = FreeCAD.ActiveDocument.addObject("App::FeaturePython",
                                                "Point")
     p3 = moveablePoint(self.a3, 2., 0.)
     ViewProvidermoveablePoint(self.a3.ViewObject, self.ml)
     self.b.Proxy.addObject(self.a1)
     self.b.Proxy.addObject(self.a2)
     self.b.Proxy.addObject(self.a3)
     self.createcallback = self.view.addEventCallbackPivy(
         SoMouseButtonEvent.getClassTypeId(), self._makepoint)
예제 #7
0
 def Activated(self):
     self.view = FreeCADGui.ActiveDocument.ActiveView
     self.x=False
     self.y=False
     self.createcallback = self.view.addEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self._makepoint)  
     FreeCAD.ActiveDocument.recompute()