[Solved by PR 1053] Error with angles in formulas
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
[Solved by PR 1053] Error with angles in formulas
There are problems using angles in formulas.
The value of the angle used in the formula is in radians but considered as degrees.
My example 2 cube.
I set the angle of the firs cube to 45° and shown in picture1.
Then I set the angle of the second cube with a formua as being equals to the angle of the first cube as shown in pcture2.
The value takent by this angle is 0.79 as shown in picture3.
0.79 is the value in radians of à 45°angle, but it is considered as being in degrees what is wrong, what shows the position of the 2 cubes on the view.
Here are the logs seen in Python console.
>>> FreeCAD.getDocument("Sans_nom").getObject("Box").Placement = App.Placement(App.Vector(0,0,0),App.Rotation(App.Vector(0,0,1),45))
>>> FreeCAD.getDocument("Sans_nom").getObject("Box001").Placement = App.Placement(App.Vector(12.8799,10.1293,6.24988),App.Rotation(App.Vector(0,0,1),0.79))
>>> App.getDocument('Sans_nom').Box001.setExpression('Placement.Rotation.Angle', u'Cube.Placement.Rotation.Angle')
>>> FreeCAD.getDocument("Sans_nom").getObject("Box001").Placement = App.Placement(App.Vector(12.8799,10.1293,6.24988),App.Rotation(App.Vector(0,0,1),0.79))
>>>
Also shown in picture4.
I understand that is or may become a problem, as the value that should be used in trigonometric finctions should be radians and the representation is in degrees. Here there is a confusion of the internal representation and the presentation in the GUI.
For me it is a bug.
Regards
The value of the angle used in the formula is in radians but considered as degrees.
My example 2 cube.
I set the angle of the firs cube to 45° and shown in picture1.
Then I set the angle of the second cube with a formua as being equals to the angle of the first cube as shown in pcture2.
The value takent by this angle is 0.79 as shown in picture3.
0.79 is the value in radians of à 45°angle, but it is considered as being in degrees what is wrong, what shows the position of the 2 cubes on the view.
Here are the logs seen in Python console.
>>> FreeCAD.getDocument("Sans_nom").getObject("Box").Placement = App.Placement(App.Vector(0,0,0),App.Rotation(App.Vector(0,0,1),45))
>>> FreeCAD.getDocument("Sans_nom").getObject("Box001").Placement = App.Placement(App.Vector(12.8799,10.1293,6.24988),App.Rotation(App.Vector(0,0,1),0.79))
>>> App.getDocument('Sans_nom').Box001.setExpression('Placement.Rotation.Angle', u'Cube.Placement.Rotation.Angle')
>>> FreeCAD.getDocument("Sans_nom").getObject("Box001").Placement = App.Placement(App.Vector(12.8799,10.1293,6.24988),App.Rotation(App.Vector(0,0,1),0.79))
>>>
Also shown in picture4.
I understand that is or may become a problem, as the value that should be used in trigonometric finctions should be radians and the representation is in degrees. Here there is a confusion of the internal representation and the presentation in the GUI.
For me it is a bug.
Regards
- Attachments
-
- picture4.png (24.79 KiB) Viewed 2146 times
-
- picture3.png (20.54 KiB) Viewed 2146 times
-
- picture2.png (21.92 KiB) Viewed 2146 times
-
- picture1.png (19.41 KiB) Viewed 2146 times
Last edited by plgarcia on Thu Dec 07, 2017 12:24 pm, edited 1 time in total.
Re: Errors in formulas (Angles, references, ...)
I found a other bug.
If in a formula an object is referenced with its Label, and the label of the object is changed, then these formulas become invalid.
If an object Label is changed formulas using this label should be changed.
An other way could be to only store internal references and replace them when the formula is displayed or edited.
If in a formula an object is referenced with its Label, and the label of the object is changed, then these formulas become invalid.
If an object Label is changed formulas using this label should be changed.
An other way could be to only store internal references and replace them when the formula is displayed or edited.
Re: Error with angles in formulas
Care to weigh in @eivindkvedalen ?eivindkvedalen wrote:ping
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Error with angles in formulas
plgarcia,
In the "Help on using FreeCAD" forum, there is a "Bug submission guidelines" topic at the top of the page.
It states
One other thing in point no. 4:
In the "Help on using FreeCAD" forum, there is a "Bug submission guidelines" topic at the top of the page.
It states
This is a development forum that is dedicated to discussion about actual development and coding, not bug reporting. Unfortunately, the moderators do not care about having topics posted all over the place.2. If you are unsure, discuss the problem on the forum first. Open a new topic here on the forum, in the help section
One other thing in point no. 4:
A bug report without mention of the FreeCAD info severely reduces its worthiness. And always test with FC compiled from current master or from the very latest development build available.4. Always include your FreeCAD version information.
Re: Error with angles in formulas
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.12284 (Git)
Build type: Release
Branch: master
Hash: 2244292552c004e6b506af9e1e98d3423e524ee7
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: French/France (fr_FR)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.12284 (Git)
Build type: Release
Branch: master
Hash: 2244292552c004e6b506af9e1e98d3423e524ee7
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: French/France (fr_FR)
Re: Error with angles in formulas
It is a bug, there is no doubt to my mind, and I have not found any bug of that kind already reported.
When reporting a bug, I have been asked to open a discussion in the forum, that is what I did. But next time I will open it in "open discussion" forum.
Here is the bug report.
https://www.freecadweb.org/tracker/view.php?id=3200
I test on the latest build available here :
https://github.com/FreeCAD/FreeCAD/releases
When reporting a bug, I have been asked to open a discussion in the forum, that is what I did. But next time I will open it in "open discussion" forum.
Here is the bug report.
https://www.freecadweb.org/tracker/view.php?id=3200
I test on the latest build available here :
https://github.com/FreeCAD/FreeCAD/releases
-
- Posts: 602
- Joined: Tue Jan 29, 2013 10:35 pm
Re: Error with angles in formulas
Please test https://github.com/eivindkv/FreeCAD/tree/Fix_issue_3200 , to see if it resolve your problem. If it does, I'll make a pull request.plgarcia wrote: ↑Mon Oct 02, 2017 12:33 pm It is a bug, there is no doubt to my mind, and I have not found any bug of that kind already reported.
When reporting a bug, I have been asked to open a discussion in the forum, that is what I did. But next time I will open it in "open discussion" forum.
Here is the bug report.
https://www.freecadweb.org/tracker/view.php?id=3200
I test on the latest build available here :
https://github.com/FreeCAD/FreeCAD/releases
Eivind
Re: Error with angles in formulas
Sorry, that was the first time I compiled FreeCad and it took some time to set the environment right and have it working.
Your change works!
45° is 45° and sin(45°) is 0,71!
I tested it on Linux Ubuntu 17.04
Thank you
Regards
Pascal Garcia
Your change works!
45° is 45° and sin(45°) is 0,71!
I tested it on Linux Ubuntu 17.04
Thank you
Regards
Pascal Garcia
Re: Error with angles in formulas
What about this new bug I found arround formulas.
2 cubes, Cube and Cube001.
I set cube001 Angle as bin equal to Cube.Placement.Rotation.Angle.
OK it works at this stage, and the correction you made is fine.
Now I rename Cube in Cube2. (change the label).
Then the gui does not display any longer the properties of the objects.
And i get these messages in linux console :
FreeCAD 0.17, Libs: 0.17RUnknown
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2017
##### #### ### ####
# # # # # #
# ## #### #### # # # # #
#### # # # # # # # ##### # #
# # #### #### # # # # #
# # # # # # # # # ## ## ##
# # #### #### ### # # #### ## ## ##
QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: Aucun fichier ou dossier de ce type
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Property not found: Cube
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Property not found: Cube
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Property not found: Cube
Unhandled ...
Eventually somtimes but not always FreeCad crashes!
Saving the object works but after loading the faulty file, the problem appears again as soon as the properties of Cube001 are selected.
In fact there is no simple way to solve the problem, but decompressing de saved file, correct by hand the error (if able to identify it) and recompress it.
There are 3 problems.
1 - Changing the label should change all formulas that refer to this label. This problem may occur while deleting an object, pasting an object as the referenced object does no longer exist etc.
2 - When for whatever reason we end in such a situation where an error occurs, the exception should be trapped, the formula should be invalidated (in order no to be evaluated and to avoid multiple cascade errors), and an error should be reported on the gui (black objet for example, or a red tick on the property, ...) with a clear reason displayed to allow the user to identify the problem and solve it.
3 - The gui should not be frozen.
Do you want me to report a bug on this topic?
Regards
2 cubes, Cube and Cube001.
I set cube001 Angle as bin equal to Cube.Placement.Rotation.Angle.
OK it works at this stage, and the correction you made is fine.
Now I rename Cube in Cube2. (change the label).
Then the gui does not display any longer the properties of the objects.
And i get these messages in linux console :
FreeCAD 0.17, Libs: 0.17RUnknown
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2017
##### #### ### ####
# # # # # #
# ## #### #### # # # # #
#### # # # # # # # ##### # #
# # #### #### # # # # #
# # # # # # # # # ## ## ##
# # #### #### ### # # #### ## ## ##
QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: Aucun fichier ou dossier de ce type
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Property not found: Cube
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Property not found: Cube
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Property not found: Cube
Unhandled ...
Eventually somtimes but not always FreeCad crashes!
Saving the object works but after loading the faulty file, the problem appears again as soon as the properties of Cube001 are selected.
In fact there is no simple way to solve the problem, but decompressing de saved file, correct by hand the error (if able to identify it) and recompress it.
There are 3 problems.
1 - Changing the label should change all formulas that refer to this label. This problem may occur while deleting an object, pasting an object as the referenced object does no longer exist etc.
2 - When for whatever reason we end in such a situation where an error occurs, the exception should be trapped, the formula should be invalidated (in order no to be evaluated and to avoid multiple cascade errors), and an error should be reported on the gui (black objet for example, or a red tick on the property, ...) with a clear reason displayed to allow the user to identify the problem and solve it.
3 - The gui should not be frozen.
Do you want me to report a bug on this topic?
Regards
-
- Posts: 602
- Joined: Tue Jan 29, 2013 10:35 pm
Re: Error with angles in formulas
This is already reported, see https://freecadweb.org/tracker/view.php?id=3151 and https://freecadweb.org/tracker/view.php?id=2766 , but I haven't had time to fix them.plgarcia wrote: ↑Wed Oct 04, 2017 11:43 am
There are 3 problems.
1 - Changing the label should change all formulas that refer to this label. This problem may occur while deleting an object, pasting an object as the referenced object does no longer exist etc.
2 - When for whatever reason we end in such a situation where an error occurs, the exception should be trapped, the formula should be invalidated (in order no to be evaluated and to avoid multiple cascade errors), and an error should be reported on the gui (black objet for example, or a red tick on the property, ...) with a clear reason displayed to allow the user to identify the problem and solve it.
3 - The gui should not be frozen.
Do you want me to report a bug on this topic?
Regards
Eivind