possible bug in angle constraint formula?

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
ilyxa
Posts: 7
Joined: Mon Mar 23, 2015 12:28 pm

possible bug in angle constraint formula?

Post by ilyxa »

OS: Linux
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6018 (Git)
Build type: Unknown
Branch: makepkg
Hash: c67b2bed45ac8b7bf6f7eda3c22541a26fce571a
Python version: 2.7.10
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 6.9.0

Wrong angle contstraint calculation in freecad (FreeCAD -> New -> Part Design -> Create Sketch -> two lines (connected or not - not important) -> Fix the the angle of a line ... ):
- Fixed constraint: 120 dg = OK
- Calculated contstraint: 360/3 = 6.875.49 dg after recaclulation

Screencast captured here: https://youtu.be/DcFnlolUokQ

Is it bug or my misunderstanding?

UPDATE: something wrong within convertaions of units: if i'll use radians notation in formula - all good - (2*pi) / 2 = 120 degrees IN sketch area (ignoring formula results in input form).

Sametime Distance and Lenght constraints with simple formulas seems working OK (very nice feature :) ).
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: possible bug in angle constraint formula?

Post by DeepSOIC »

Confirmed. When using expressions, I can't get it to correctly parse degrees units for angles in sketcher. Something strange is going on.

My version is rather old, though...
OS: Windows 8.1
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5702 (Git)
Build type: Release
Branch: FreeCAD-DeepSOIC4
Hash: df63cb8957ef4cc6f30f2aeb11c2cc5a16f799f1
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: possible bug in angle constraint formula?

Post by eivindkvedalen »

DeepSOIC wrote:Confirmed. When using expressions, I can't get it to correctly parse degrees units for angles in sketcher. Something strange is going on.
This happens because angle constraints are stored in radians, and not degrees internally. Not sure how I missed that during the expressions support implementation in Sketcher :( There's a special case for angles in the setDatum(...) function.

Fix for test at: https://github.com/eivindkv/free-cad-co ... ns_fixes_3

Eivind
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: possible bug in angle constraint formula?

Post by ickby »

Eivind,
while you are add it, I think the same happens for the angle in placement. It works correctly with adding "pi" s expressions, which is converted to 180°, but fails if one enters "180°".
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: possible bug in angle constraint formula?

Post by eivindkvedalen »

ickby wrote:Eivind,
while you are add it, I think the same happens for the angle in placement. It works correctly with adding "pi" s expressions, which is converted to 180°, but fails if one enters "180°".
Could you please test the branch mentioned above? I've pushed a change that should fix this for the Placement property now. I've also fixed a couple of precision related things.

Eivind
Post Reply