utils: fix axis construction in getElementRotation()

Closes . Thanks to @Ultran1.
This commit is contained in:
Zheng, Lei 2018-07-10 08:25:37 +08:00
parent 8bce8889f6
commit 8f7a92634c

View File

@ -344,12 +344,12 @@ def getElementRotation(obj,reverse=False):
fit_plane_to_surface1(face.Surface) fit_plane_to_surface1(face.Surface)
error_normalized = error / face.BoundBox.DiagonalLength error_normalized = error / face.BoundBox.DiagonalLength
if error_normalized < 10**-6: #then good plane fit if error_normalized < 10**-6: #then good plane fit
axis = plane_norm axis = FreeCAD.Vector(plane_norm)
axis_fitted, _center, error = \ axis_fitted, _center, error = \
fit_rotation_axis_to_surface1(face.Surface) fit_rotation_axis_to_surface1(face.Surface)
error_normalized = error / face.BoundBox.DiagonalLength error_normalized = error / face.BoundBox.DiagonalLength
if error_normalized < 10**-6: #then good rotation_axis fix if error_normalized < 10**-6: #then good rotation_axis fix
axis = axis_fitted axis = FreeCAD.Vector(axis_fitted)
else: else:
edge = getElementShape(obj,Part.Edge) edge = getElementShape(obj,Part.Edge)
if edge: if edge: