Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unit Formatting of Double

1 REPLY 1
Reply
Message 1 of 2
leslief
517 Views, 1 Reply

Unit Formatting of Double

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.

1 REPLY 1
Message 2 of 2
gopinath.taget
in reply to: leslief

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community