Bugfixes in Draft Snap

This commit is contained in:
Yorik van Havre 2012-02-02 18:01:17 -02:00
parent 26602b2aa3
commit 1af6a3c2b1
3 changed files with 19 additions and 18 deletions

View File

@ -100,7 +100,7 @@ class _CommandWall:
self.tracker = DraftTrackers.boxTracker()
FreeCADGui.Snapper.getPoint(callback=self.getPoint)
def getPoint(self,point,obj):
def getPoint(self,point=None,obj=None):
"this function is called by the snapper when it has a 3D point"
if obj:
if Draft.getType(obj) == "Wall":

View File

@ -852,24 +852,24 @@ class DraftToolBar:
except ValueError:
pass
else:
if self.isRelative.isVisible() and self.isRelative.isChecked():
if self.sourceCmd.node:
if self.sourceCmd.featureName == "Rectangle":
last = self.sourceCmd.node[0]
else:
last = self.sourceCmd.node[-1]
numx = last.x + numx
numy = last.y + numy
numz = last.z + numz
if FreeCAD.DraftWorkingPlane:
v = FreeCAD.Vector(numx,numy,numz)
v = FreeCAD.DraftWorkingPlane.getGlobalCoords(v)
numx = v.x
numy = v.y
numz = v.z
if self.pointcallback:
self.pointcallback(FreeCAD.Vector(numx,numy,numz),self.isRelative.isChecked())
self.pointcallback(FreeCAD.Vector(numx,numy,numz),(self.isRelative.isVisible() and self.isRelative.isChecked()))
else:
if self.isRelative.isVisible() and self.isRelative.isChecked():
if self.sourceCmd.node:
if self.sourceCmd.featureName == "Rectangle":
last = self.sourceCmd.node[0]
else:
last = self.sourceCmd.node[-1]
numx = last.x + numx
numy = last.y + numy
numz = last.z + numz
if FreeCAD.DraftWorkingPlane:
v = FreeCAD.Vector(numx,numy,numz)
v = FreeCAD.DraftWorkingPlane.getGlobalCoords(v)
numx = v.x
numy = v.y
numz = v.z
self.sourceCmd.numericInput(numx,numy,numz)
def finish(self):

View File

@ -678,7 +678,8 @@ class Snapper:
def getcoords(point,relative=False):
self.pt = point
if relative and last:
self.pt = last.add(point)
v = FreeCAD.DraftWorkingPlane.getGlobalCoords(point)
self.pt = last.add(v)
accept()
def click(event_cb):