I have a little plugin that returns the length of a set of selected detail lines and copies the value to the clipboard so I can paste it into notes for egress distance, etc.. I can't figure out how to get the return value formatted as feet-inches UnitType in Revit. It's just a double, and at the moment I'm punting by using:
double feet = Math.Truncate(totalLength);
double inches = Math.Ceiling((totalLength - feet) * 12);
string lenTxt = feet + " ft " + inches + " in";
Any help would be appreciated.
Hello,
THe UnitFormatUtils API class will help. It will return a string in a certain format given a value and vice-versa. Please take a look at the SDK sample on how to use it:
RevitSDK\2014\Samples\Units\CS
Hope this helps.
Best Regards
Gopinath