Sketcher Arc Of Hyperbola Broken?
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
Sketcher Arc Of Hyperbola Broken?
Trying to use this nice function, but no luck
Always get these NaNs
App.getDocument('Unnamed').getObject('Sketch').addGeometry(Part.ArcOfHyperbola(Part.Hyperbola(App.Vector(nan,nan,0),App.Vector(163.858917,117.976585,0),App.Vector(185.834732,69.798813,0)),nan,nan),False)
Traceback (most recent call last):
File "<string>", line 1, in <module>
<class 'NameError'>: name 'nan' is not defined
name 'nan' is not defined
version:
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18528 (Git)
Build type: Release
Branch: master
Hash: 891f8953fe858d41600b41a62ebde48f91b0526a
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
Re: Sketcher Arc Of Hyperbola Broken?
Confirmed on the version below (I guess it's been broken for a while).
OS: Ubuntu 16.04.6 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.1. dated 2019-04-30
Build type: Release
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
OS: Ubuntu 16.04.6 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.1. dated 2019-04-30
Build type: Release
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Re: Sketcher Arc Of Hyperbola Broken?
… here it works also (after some faulty trials!)
- Attachments
-
- Hyperbola.FCStd
- (7.28 KiB) Downloaded 27 times
- pl7i92LCNC
- Posts: 208
- Joined: Tue Mar 12, 2019 3:03 pm
- Location: RLP DE
Re: Sketcher Arc Of Hyperbola Broken?
the appimage is ok wores fine
FreeCAD_0.19-18353-Linux-Conda_Py3Qt5_glibc2.12-x86_64.AppImage
FreeCAD_0.19-18353-Linux-Conda_Py3Qt5_glibc2.12-x86_64.AppImage
Re: Sketcher Arc Of Hyperbola Broken?
For me it works when you select carefully the points of the hyperbola. However I can also make it fail if I select the second helper line to be orthogonal to the first line. In this case the formula in DrawSketchHandlerArcOfHyperbola::releaseButton fails:
The argument of acosh() seems to become negative and thus the result gives a NaN (not-a-number). When building the Python string with the broken number then it adds nan to the expression and thus leads to an error because nan is not a defined identifier.
Here the exception handling should be improved by checking the values beforehand and in case of NaN an error should be reported:
git commit eb6a405c1
Code: Select all
double angleatstartingpoint = acosh(((startingPoint.x-centerPoint.x)*cos(phi)+(startingPoint.y-centerPoint.y)*sin(phi))/a);
Here the exception handling should be improved by checking the values beforehand and in case of NaN an error should be reported:
git commit eb6a405c1
Re: Sketcher Arc Of Hyperbola Broken?
Code: Select all
double endAngle = atanh( (((endPoint.y-centerPoint.y)*cos(phi)-(endPoint.x-centerPoint.x)*sin(phi))*a) /
(((endPoint.x-centerPoint.x)*cos(phi)+(endPoint.y-centerPoint.y)*sin(phi))*b) );
if b becomes zero, expression becomes inf
Should be caught too
Code: Select all
if (boost::math::isnan(startAngle) || boost::math::isnan(endAngle)) {
sketchgui->purgeHandler();
Base::Console().Error("Cannot create arc of hyperbola from invalid angles, try again!\n");
return false;
}
Re: Sketcher Arc Of Hyperbola Broken?
If b becomes zero endAngle becomes NaN. So, this is already handled.if b becomes zero, expression becomes inf