'nan' is not defined

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!
Post Reply
ccx004
Posts: 4
Joined: Tue Oct 19, 2021 1:11 am

'nan' is not defined

Post by ccx004 »

I am running 0.19.2 but apparently the developers do not accept bug reports on the current stable version. Anyway, I am trying to add an arc to the end of a line. I have done a few of these in the current sketch but now Freecad will not add an arc. When I try to draw it, various arcs appear all over the screen and I get errors in the report view. The errors are:

02:57:11 <Exception> CommandCreateGeo.cpp(120): Points are collinear
02:57:11 <Exception> CommandCreateGeo.cpp(120): Points are collinear
02:57:12 Traceback (most recent call last):
File "<string>", line 1, in <module>
<class 'NameError'>: name 'nan' is not defined
02:57:12 App.getDocument('MagicPart').getObject('Sketch001').addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(-nan(ind),-nan(ind),0),App.Vector(0,0,1),-nan(ind)),-nan(ind),-nan(ind)),False)
02:57:12 Failed to add arc: name 'nan' is not defined

I have no real idea what this means other than NaN is often used to mean "Not a Number" although that doesn't help. It also will not draw lines, circles or squares although it will draw a hexagon.

Any advice will be gratefully received

Best wishes...
Colin
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: 'nan' is not defined

Post by chrisb »

You have created somehow a line or an arc of zero length - probably by doing some indefinite clicking. You must fix this before continuing, because otherwise the solver gets out of whack.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: 'nan' is not defined

Post by TheMarkster »

Post your file and we can have a look. Something I sometimes run into with circles is it will automatically get a tangent constraint resulting in a 0 radius. In the left panel there is an element list. I usually just go there, delete the circle, and make a new one when that happens. Something similar might have happened with the arc.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: 'nan' is not defined

Post by wmayer »

I am running 0.19.2 but apparently the developers do not accept bug reports on the current stable version.
Bug reports for the stable version are still accepted for really critical issues like a crash. For minor bugs it depends on how much work it will cause to fix them.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: 'nan' is not defined

Post by wmayer »

After trying it a while I could figure out the procedure to create the NaN.
  • create an arc or circle where to define the point on the perimeter
  • click on an existing point of the sketch
  • move the mouse away and back to this point and click on it again
  • the third point can be again the same point or another point
Because we have two coincident points it's not possible to compute the radius because it will be infinite (hence the NaN). A string representation of a NaN is indeed "nan" that will be passed to the Python interpreter that doesn't know of such a variable and thus raises an error.

So, the function GetCircleCenter() must be fixed to determine the division by zero and raise an exception instead.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: 'nan' is not defined

Post by wmayer »

Post Reply