Sketcher, tangent constraint bug

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
freecc
Posts: 158
Joined: Wed Feb 21, 2018 4:17 pm

Sketcher, tangent constraint bug

Postby freecc » Sat Aug 31, 2019 4:18 pm

Hello, I just wanted to make you aware of a bug in the sketcher with the tangent constraint. When I apply it often it removes end point constraints (or whatever it is called).

In the attached file make the tangent constraint to the semicircle to the right with the line which is on a 45 degree slope to see the bug.
Attachments
hal.FCStd
(11.37 KiB) Downloaded 20 times
TheMarkster
Posts: 1177
Joined: Thu Apr 05, 2018 1:53 am

Re: Sketcher, tangent constraint bug

Postby TheMarkster » Sat Aug 31, 2019 4:59 pm

If adding a tangency constraint causes a previously applied coincidence constraint to become redundant and if you have auto remove redundants checkbox checked this is what will happen -- the redundant coincidence constraint is removed. Uncheck auto remove redundants if you would prefer to manually remove redundant constraints.
My FreeCAD video series on youtube: https://www.youtube.com/playlist?list=P ... GEBlLshYGa
kisolre
Posts: 1604
Joined: Wed Nov 21, 2018 1:13 pm

Re: Sketcher, tangent constraint bug

Postby kisolre » Sat Aug 31, 2019 5:28 pm

I had previously observed similar behavior bit did not pay much attention. It looks like it fails with autoremoval and instead of just removing endpoints coincidence it also removes just applied end to end tangency. This looks as a bug to me. If Auto remove redundants is not checked everything works as expected.

OS: Windows 8.1 (6.3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17877 (Git)
Build type: Release
Branch: master
Hash: 1e19ef5be4735f4200eaf99ce9e487d2be6f4151
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Bulgarian/Bulgaria (bg_BG)
chrisb
Posts: 22367
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher, tangent constraint bug

Postby chrisb » Sat Aug 31, 2019 5:29 pm

That's the supposed behaviour. There are different types of tangency: line/line or line/point or point/point. Sketcher ConstrainTangent.
chrisb
Posts: 22367
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher, tangent constraint bug

Postby chrisb » Sat Aug 31, 2019 5:31 pm

Crosspost above. Will look at the example from OP.
chrisb
Posts: 22367
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher, tangent constraint bug

Postby chrisb » Sat Aug 31, 2019 6:04 pm

Had a look at the file. Couldn't see anything unexpected. The coincidence plus line/line tangency is unstable and automatically replaced by point/point tangency.

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17904 (Git)
Build type: Release
Branch: master
Hash: ffcac528d54195092a8ab2e9ab6f4ed39bcaebbc
Python version: 3.7.3
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Germany (en_DE)
freecc
Posts: 158
Joined: Wed Feb 21, 2018 4:17 pm

Re: Sketcher, tangent constraint bug

Postby freecc » Sat Aug 31, 2019 6:17 pm

kisolre wrote:
Sat Aug 31, 2019 5:28 pm
I had previously observed similar behavior bit did not pay much attention. It looks like it fails with autoremoval and instead of just removing endpoints coincidence it also removes just applied end to end tangency. This looks as a bug to me. If Auto remove redundants is not checked everything works as expected.

OS: Windows 8.1 (6.3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17877 (Git)
Build type: Release
Branch: master
Hash: 1e19ef5be4735f4200eaf99ce9e487d2be6f4151
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Bulgarian/Bulgaria (bg_BG)
I have this exact behaviour.


OS: Ubuntu 16.04.6 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.1.
Build type: Release
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Swedish/Sweden (sv_SE)
kisolre
Posts: 1604
Joined: Wed Nov 21, 2018 1:13 pm

Re: Sketcher, tangent constraint bug

Postby kisolre » Sat Aug 31, 2019 6:37 pm

chrisb wrote:
Sat Aug 31, 2019 6:04 pm
Couldn't see anything unexpected.
Did you had "Auto remove redundants" ticked? As I mentioned this happens with it On.
openBrain
Posts: 3386
Joined: Fri Nov 09, 2018 5:38 pm

Re: Sketcher, tangent constraint bug

Postby openBrain » Sat Aug 31, 2019 7:12 pm

IIRC, having coincidence + line/line tangency caused instability in the solver and thus there is an automated substitution to a point/point tangency.
2 things IMO could be improved :
* If you then delete the tangency (hence is a point/point one), it will also "remove" the coincidence between points.
* If you apply tangency in continuous mode, you get no warning. Below message box is displayed only in single mode
cons_sub.png
cons_sub.png (11.82 KiB) Viewed 261 times
chrisb
Posts: 22367
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher, tangent constraint bug

Postby chrisb » Sat Aug 31, 2019 7:17 pm

I have just tried with autoremove and can confirm the issue. I will prepare a simplified example. Usually I would wait for Abdullah to comment, but he seems rather busy with other stuff, so I will create a ticket.