I encountered a strange error in FreeCAD 0.20.

Assume that you have four points (Draft.Point objects), labelled as P1, P2, P3 and P4, with units in mm. I have an expression in the form of a Python string to evaluate, let us call it

*expression*. To evaluate this expression, we can use

Code: Select all

```
P1.evalExpression(expression)
```

Code: Select all

```
ArithmeticError: Quantity::operator +(): Unit mismatch in plus operation
```

Do you have any ideas why this happens and how I could further narrow down the cause of the error?

The error can be reproduced with the code below.

Code: Select all

```
import FreeCAD as App
import Draft
P1 = Draft.make_point(App.Vector(-74.924, 2.875, 160.36))
P1.Label = 'P1'
P2 = Draft.make_point(App.Vector(-10.965, 11.594, 160.36))
P2.Label = 'P2'
P3 = Draft.make_point(App.Vector(-7.391, -50.421, 160.36))
P3.Label = 'P3'
P4 = Draft.make_point(App.Vector(54.302, 5.066, 160.36))
P4.Label = 'P4'
App.ActiveDocument.recompute()
expression = 'P3.X + (-10)*-(((P3.Y + 1.5*(sqrt(((P1.X) - (P3.X))^2 + ((P1.Y) - (P3.Y))^2 + ((P1.Z) - (P3.Z))^2))*((P1.Y) - (P3.Y)) / sqrt(((P1.X) - (P3.X))^2 + ((P1.Y) - (P3.Y))^2 + ((P1.Z) - (P3.Z))^2)) - (P3.Y)) / sqrt(((P3.X + 1.5*(sqrt(((P1.X) - (P3.X))^2 + ((P1.Y) - (P3.Y))^2 + ((P1.Z) - (P3.Z))^2))*((P1.X) - (P3.X)) / sqrt(((P1.X) - (P3.X))^2 + ((P1.Y) - (P3.Y))^2 + ((P1.Z) - (P3.Z))^2)) - (P3.X))^2 + ((P3.Y + 1.5*(sqrt(((P1.X) - (P3.X))^2 + ((P1.Y) - (P3.Y))^2 + ((P1.Z) - (P3.Z))^2))*((P1.Y) - (P3.Y)) / sqrt(((P1.X) - (P3.X))^2 + ((P1.Y) - (P3.Y))^2 + ((P1.Z) - (P3.Z))^2)) - (P3.Y))^2 + ((P3.Z + 1.5*(sqrt(((P1.X) - (P3.X))^2 + ((P1.Y) - (P3.Y))^2 + ((P1.Z) - (P3.Z))^2))*((P1.Z) - (P3.Z)) / sqrt(((P1.X) - (P3.X))^2 + ((P1.Y) - (P3.Y))^2 + ((P1.Z) - (P3.Z))^2)) - (P3.Z))^2))'
P1.evalExpression(expression)
```