I am creating a parametric part that has a linear rail bolted to it. The rails come in 2mm increments. I have the length of the Rail Pocket ("RAIL POCKET@Sketch12") and I want to round down to the closest even number. For instance, if the pocket is 84.912mm, I want it to round down to 84mm. To do this, I am using the following equation:
RAIL LENGTH = (INT("RAIL POCKET@Sketch12"/2)*2
84.912mm/2 = 42.456mm
INT(42.456mm) = 42mm
42mm*2 = 84
Success!
The problem is that, when I change the document units from MMGS to IPS, the variable "RAIL POCKET@Sketch12" is now in inches and calculates incorrectly.
RAIL LENGTH = (INT("RAIL POCKET@Sketch12"/2)*2
3.343in/2 = 1.672in
INT(1.672in) = 1in
1in*2 = 2in
2in = 50.8mm - wrong answer
When I add numerical values to an equation that I need to be computed in a specific unit, I simply add the units after the number. I, however, can't figure out how to do this for variables such as "RAIL POCKET@Sketch12". I was hopeful that checking 'Override Units' in the "RAIL POCKET@Sketch12" dimension property manager and setting it to 'Millimeters' would do it but it is still calculating in inches when in IPS.
Is there anyway to force a dimension variable like "RAIL POCKET@Sketch12" to be used only in mm units for a calculation regardless of what the document units are set to?
