Open earlwilkins opened 1 year ago
UnitsManager.formatInternalValue not properly adjusting for General Precision as set in User Preference. It's a known issue.
Do you have a link to an Autodesk reference for this issue?
See the final entry from Brian Ekins who seems to be a super user and answers most community questions. It's not a case number, but is the best I have.
regards earl
On Mon, Apr 24, 2023 at 12:14 PM pettijohn @.***> wrote:
UnitsManager.formatInternalValue not properly adjusting for General Precision as set in User Preference. It's a known issue.
Do you have a link to an Autodesk reference for this issue?
— Reply to this email directly, view it on GitHub https://github.com/pettijohn/CSV-BOM-Plus/issues/3#issuecomment-1520464997, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFAYLSF3F5PSIMYPNI2UAZTXC2REVANCNFSM6AAAAAAXI7R4RA . You are receiving this because you authored the thread.Message ID: @.***>
UnitsManager.formatInternalValue not properly adjusting for General Precision as set in User Preference. It's a known issue. F360 stores data as CM and CVS-BOM converts it back to Inches if that's your working unit of measure, but the conversion is off just a little. For example, 20 inches is converted to 19.9999997 and output as the same instead of being rounded to based on your defined preference.
The solution is simple, but it might not be worth adding if they plan on fixing the function. If somebody needs it like I did, they can update their code with the following changes. I did not test this fix with any other units of measure like ft, cm, mm, inches with fractions.
Before getting to my code, I wanted to thank pettijohn for sharing his work and some nicely documented and structured code. It make researching this fix so much easier for someone who has never coded in python before.
Add the following lines after app is defined in CSV_BOM_Plus.py after ui is defined. It pulls the general precision value from preferences. You can do this using the edit command from the add-ins window.
genPrecision = app.preferences.unitAndValuePreferences.generalPrecision
Then update the lines "x": maxPointX - minPointX, "y": maxPointY - minPointY, "z": maxPointZ - minPointZ
to be as follows "x": round(maxPointX - minPointX, genPrecision),
"y": round(maxPointY - minPointY, genPrecision),
"z": round(maxPointZ - minPointZ, genPrecision)
This will round the height, width and length to reflect the General Precision setting you have defined in your preferences.