See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: UI unit handling

  1. #1
    Active Member
    Join Date
    2003-08
    Location
    England
    Posts
    87
    Login to Give a bone
    0

    Default UI unit handling

    Can anyone please advise on the best method of producing an addin which supports any unit input via the UI, e.g. A user could enter 2000mm or 2m or 12" or 1', such that the code can interpret the input and convert to a value in internal units for use by the addin outside the context of the parameter.

    So far I've thought about letting users specify ValueStrings in a text box, but things like the api's convert to double only appear to work on parameters, not strings. I don't have a suitable 'spare' parameter to use for the conversion, I'd need to create a temp shared parameters file, create a parameter of the appropriate type, bind it to something, use it for the conversion and then dispose of it. This seems way over the top and makes me feel like in missing something obvious. I've also explored things like unitutils but I think I still need a parameter to feed the valuestring into in order to get the value and unittype.

    Any suggestions?

  2. #2
    Active Member
    Join Date
    2011-11
    Location
    Saint-Omer, Pas-de-Calais, France
    Posts
    58
    Login to Give a bone
    1

    Default Re: UI unit handling

    In Revit >= 2014, you can use UnitFormatUtils.TryParse for this.

  3. #3
    Active Member
    Join Date
    2003-08
    Location
    England
    Posts
    87
    Login to Give a bone
    0

    Default Re: UI unit handling

    Maxence,

    That's perfect, thank you!

Similar Threads

  1. 2013: Correct Classification for Duct Connectors for an HRU Air Handling Unit
    By mrgrotey in forum Revit MEP - Families
    Replies: 4
    Last Post: 2015-08-20, 04:57 PM
  2. 2015: air handling unit - plugin
    By MEP2 in forum Revit MEP - Families
    Replies: 0
    Last Post: 2015-07-24, 06:02 PM
  3. Multiple Zone Air Handling Unit (AHU)
    By bgoldman in forum Revit MEP - General
    Replies: 0
    Last Post: 2010-01-18, 09:17 PM
  4. After install imperial unit template, library and want to add metric unit
    By 01chang in forum Revit Architecture - General
    Replies: 0
    Last Post: 2009-12-03, 09:14 PM
  5. How do you make your own air-handling unit?
    By oshalygin in forum Revit MEP - General
    Replies: 6
    Last Post: 2008-11-11, 05:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •