Custom FormatOptions in Revit 2020 (and older)

Hi all,

I’m working on a command which gets the parameter value as a value string, but without the unit symbol.
In general it works in latest Revit versions (tested in 2023), but I don’t have older versions (<2021), so had to guess it.

Can anyone comment on the code or if anyone has an older Revit version and could check if it works? :sweat_smile:

I made it possible to work in pyRevit / RPS / Dynamo (at least I think so, haha!)

Thanks in advance!

The AsValueString API has been there as far as I can remember. So I’d assume older Revit versions would behave the same

Hi @eirannejad!

Thanks for the reply :slightly_smiling_face:!

The trick is in the FormatOptions() which I need to put inside the AsValueString() in order to get the value in the same way as it is shown in UI, but without the unit symbol:

And FormatOptions as well as UnitUtils have changed since they added ForgeTypeId to API.

Probably later I’ll find some time to install an older Revit and try it myself. Will feedback then!

Thanks!

1 Like