Sketcher 180°-constraints irritating visual feedback

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
ulrich1a
Posts: 1920
Joined: Sun Jul 07, 2013 12:08 pm

Sketcher 180°-constraints irritating visual feedback

Postby ulrich1a » Mon May 12, 2014 2:18 pm

I am using 180°-constraints in the sketcher for resilient design purposes. I am observing annoying issues with these constraints. I made a polyline and applied 3 times 180°-constraints as shown in the picture below.
constraint180_600x400.png
180°-Constraints at polyline
constraint180_600x400.png (10.66 KiB) Viewed 2435 times
At adding an additional equality constraint to two of the polylines, all 180°-constraints are not more located at the polyline. They are sitting at the origin in a way not showing any usable information. See picture below:
constraints180_origin_600x400.png
180°-constraints sitting at origin
constraints180_origin_600x400.png (5.79 KiB) Viewed 2435 times
If I am applying the equality constraints before making the 180°-constraints, the representation of the 180°-constraints is more confusing. At applying at a zig-zag-line, the original angle is displayed.
constraint180_equality_first_600x400.png
constraint180_equality_first_600x400.png (9.03 KiB) Viewed 2435 times
Do others have the same experience?

Ulrich

OS: Debian GNU/Linux 7.5 (wheezy)
Platform: 32-bit
Version: 0.14.3564 (Git)
Branch: master
Hash: 3f4cbc421766b841cebcdf57a3de9a2c8211070c
Python version: 2.7.3
Qt version: 4.8.2
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.7.0

edit: made Subject more serious
ulrich1a
Posts: 1920
Joined: Sun Jul 07, 2013 12:08 pm

Re: Sketcher 180°-constraints irritating visual feedback

Postby ulrich1a » Wed May 14, 2014 9:02 pm

Is it considered an allowed practice to make a 180°-constraint to two parallel lines with no common vertex? This will create sometimes a constraint symbol millions of km away from the sketch. So clicking on "Fit the whole content on screen" will produce a millions km viewport.

Ulrich
wmayer
Site Admin
Posts: 15724
Joined: Thu Feb 19, 2009 10:32 am

Re: Sketcher 180°-constraints irritating visual feedback

Postby wmayer » Wed May 14, 2014 11:07 pm

For me the angle constraint also have weird behaviour. But only if the angle is exactly 180 deg. If it's slightly different then everything works normally.
Is it considered an allowed practice to make a 180°-constraint to two parallel lines with no common vertex?
No.
This will create sometimes a constraint symbol millions of km away from the sketch. So clicking on "Fit the whole content on screen" will produce a millions km viewport.
Actually the algorithm should check if the two lines are parallel and give an error message.
ulrich1a
Posts: 1920
Joined: Sun Jul 07, 2013 12:08 pm

Re: Sketcher 180°-constraints irritating visual feedback

Postby ulrich1a » Thu May 15, 2014 8:00 am

wmayer wrote:Actually the algorithm should check if the two lines are parallel and give an error message.
I am thinking there is some logic that checks for parallel lines and put the 180°-angle-constraint at the origin in this case. But this logic is not working correct.

The 180°-angle-constraint between two lines with a parallel distance is a very useful feature, that allows to make a constraint set without multiple solutions. For example issue http://www.freecadweb.org/tracker/view.php?id=1519 can be solved easily with a 180°-angle-constraint with the horizontal sketch axis, instead of using a horizontal constraint.

Ulrich
wmayer
Site Admin
Posts: 15724
Joined: Thu Feb 19, 2009 10:32 am

Re: Sketcher 180°-constraints irritating visual feedback

Postby wmayer » Thu May 15, 2014 5:51 pm

I am thinking there is some logic that checks for parallel lines and put the 180°-angle-constraint at the origin in this case. But this logic is not working correct.
This could mean that there is some round-off errors so that the algorithm find an intersection point of the two lines which of course is far, far away. And next to this intersection point the angle symbol might be added. Just an idea...
wmayer
Site Admin
Posts: 15724
Joined: Thu Feb 19, 2009 10:32 am

Re: Sketcher 180°-constraints irritating visual feedback

Postby wmayer » Sat May 17, 2014 9:02 am

The 180°-angle-constraint between two lines with a parallel distance is a very useful feature, that allows to make a constraint set without multiple solutions. For example issue http://www.freecadweb.org/tracker/view.php?id=1519 can be solved easily with a 180°-angle-constraint with the horizontal sketch axis, instead of using a horizontal constraint.
Therefore you don't need a 180 deg angle-constraint. The same can be achieved by using a 90 deg angle-constraint with a horizontal line and the Y axis.
Is it considered an allowed practice to make a 180°-constraint to two parallel lines with no common vertex?
An angle is only defined between two intersecting lines. Parallel lines don't have an intersection point and thus it makes no sense to define an angle. This must be forbidden by the software.
I am thinking there is some logic that checks for parallel lines and put the 180°-angle-constraint at the origin in this case. But this logic is not working correct.
No, there is no logic. I stepped through the code and what happens is that due to some round-off errors you get two lines which are not 100% parallel. That's why you get an intersection point far outside (~20 km) of the sketch.
ulrich1a
Posts: 1920
Joined: Sun Jul 07, 2013 12:08 pm

Re: Sketcher 180°-constraints irritating visual feedback

Postby ulrich1a » Sat May 17, 2014 11:00 am

wmayer wrote:An angle is only defined between two intersecting lines. Parallel lines don't have an intersection point and thus it makes no sense to define an angle. This must be forbidden by the software.
I have filed a bug report. http://www.freecadweb.org/tracker/view.php?id=1550

Ulrich
wmayer
Site Admin
Posts: 15724
Joined: Thu Feb 19, 2009 10:32 am

Re: Sketcher 180°-constraints irritating visual feedback

Postby wmayer » Sat May 17, 2014 4:30 pm

The angle constraints issues should be fixed now.