You can
i set
values to measurements because JS will recognize you're assigning a string type value to a numeric variable -- it will internally do something like toString, except this is probably toFloat. The function is written to parse and recalculate the string into the current measurement units.
This is what probably fails here; your string "1p6" is parsed with a default toNumber method, and the '6' is all that's returned (although I'd guess it would be the '1' ...)
Without the measurement specifier, it should work okay, with two caveats. It works in your current measurement only, and if this is pica's/points you have to recalculate a pica-point value into fractional values, i.e., "1p6" is 1.5.
There might be some posts here on converting units, but if you're unsure about the current measurement units, it's pretty easy to force one:
lastUnits = ViewPreference.horizontalMeasurementUnits;
ViewPreference.horizontalMeasurementUnits = MeasurementUnits.PICAS;
.. your stuff here ..
ViewPreference.horizontalMeasurementUnits = lastUnits;