Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when evaluating constraints with plane #16

Closed
Ultran1 opened this issue Jul 9, 2018 · 1 comment
Closed

Bug when evaluating constraints with plane #16

Ultran1 opened this issue Jul 9, 2018 · 1 comment

Comments

@Ultran1
Copy link

Ultran1 commented Jul 9, 2018

In file utils.py in function getElementRotation(obj,reverse=False) return value, axis, is affected with an array instead of a FreeCAD.Vector.

the function fit_plane_to_surface1(face.Surface) return an array :

plane_norm, _plane_pos, error = \
                    fit_plane_to_surface1(face.Surface)

then plane_norm is affected to axis.

axis = plane_norm

At the end of function call to FreeCAD.Rotation fail because axis is not a FreeCAD.Vector.

return FreeCAD.Rotation(FreeCAD.Vector(0,0,-1 if reverse else 1),axis)

I fixed this by using following code

axis = FreeCAD.Vector(plane_norm)

I expect the same problem will occur with this code:

            axis_fitted, _center, error = \
                    fit_rotation_axis_to_surface1(face.Surface)
            error_normalized = error / face.BoundBox.DiagonalLength
            if error_normalized < 10**-6: #then good rotation_axis fix
                    axis = axis_fitted

I fixed this by using following code

axis = FreeCAD.Vector(axis_fitted)

Here is the full part of the code that fails

else: #numerically approximating surface
            plane_norm, _plane_pos, error = \
                    fit_plane_to_surface1(face.Surface)
            error_normalized = error / face.BoundBox.DiagonalLength
            if error_normalized < 10**-6: #then good plane fit
                axis = plane_norm
            axis_fitted, _center, error = \
                    fit_rotation_axis_to_surface1(face.Surface)
            error_normalized = error / face.BoundBox.DiagonalLength
            if error_normalized < 10**-6: #then good rotation_axis fix
                    axis = axis_fitted

I use latest build FreeCAD-asm3-20180630-7e5b3323-f5dd9d4.glibc2.17-x86_64.AppImage on Debian Stretch 64bit host.

Bug successfully debugged with winpdb.

This is my first ever github bug report sorry for any mistakes.

@realthunder
Copy link
Owner

That's a very comprehensive bug report. Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants