I am trying to write my own workbench for the FreeCAD and i need to measure distance between shapes. So when i trying to do that in the python console in the FreeCAD all is great, but when i trying to run exactly the same code in workbench command it fails with exceptions: distToShape: Shape parameter is invalid or BRepExtrema_DistShapeShape failed. Why the same code works in console but does not in workbench command? How can i measure distance between shapes inside the workbench?
i tried to measure distance between a sphere and a cubes faces with distToShape method. So in the console i got result i wanted, but same code in a workbench throws exceptions.
I just changed sphere definition from s = FreeCAD.ActiveDocument.addObject("Part::Sphere", "sphere") to s = Part:makeShere(5.0) and now it works well.