I know some workarounds but the help of getValueAs() states “returns a floating point value as the provided unit” and the returned quantity may even be another physical quantity if the unit used in getValueAs() is not the same as the original variable.
I think breaking changes before a 1.0 version should not be an issue. Moreover, for all official workbenches and all workbenches from https://github.com/FreeCAD/FreeCAD-addons the use of “.Value” is very easy to detect and fix. On top of that, (“Quantity.getValueAs().Value” can be replaced with “float(Quantity.getValueAs())” already now, to be compatible with the old and new “Quantity.getValueAs()”.
Rather than break things unnecessarily, it could be better to add a new function that provides the desired result and fix the documentation for the old function, if that is needed. Maybe name it getFloatValueAs() → float.
Simply correct documentation, and leave interface the same.
When there is risk of breaking old code, it is better IMHO to make a new method/function (there are slightly different terminology between languages) and keep the old code work, with the “buggy” or “imprecise” method.
Probably when 1.0 will be out, code could issue some “deprecation warning” that says that in long term (al least 1.2) some functions/methods will be dropped to give the time to developer to port the code to the new API or place some code to make workaround based on FreeCAD version.
Is this feature in the program related to my problem, which I voiced in this topic?
I can’t get data in the required format for list(a, b, c, d) from dimensional constraints.
I see the values I need, but there are not enough decimal places. Have to use a spreadsheet converter (workaround)
Thank you