Results 1 to 6 of 6

Thread: Imperial length format from string

  1. #1
    Mastering Revit Author JamesVan's Avatar
    Join Date
    2003-04
    Location
    New York, NY
    Posts
    624

    Default Imperial length format from string

    Has anyone used the API to display Imperial units (feet and inches) in a form? I'm expanding on the LevelsProperty sample tool, but it's in Metric. Removed the multiplier to get the results to decimal feet, but can't figure out how to parse the string to feet-inch. Tried searching through the help in VisualStudio, but couldn't find anything.

    Thanks in advance.
    We are the music makers...we are the dreamers of dreams.
    All Things BIM
    Visit the Revit Community Home Page

  2. #2
    AUGI Addict
    Join Date
    2003-11
    Location
    New Zealand
    Posts
    1,116

    Default Re: Imperial length format from string

    James,

    It'd be easier if US converted to metric like the rest of the world Sorry couldn't resist...

    The default unit in Revit is imperial. So you don't have to do anything to the values. Go to command.cs. Remove the unit conversion:

    double temValue = systemLevel.Elevation * 304.8;

    Note you'll have to go through the other files to remove the conversion back to imperial where values are added.ie /304.8.

    HTH,

    Guy

  3. #3
    I could stop if I wanted to Danny Polkinhorn's Avatar
    Join Date
    2003-12
    Location
    Honolulu, HI
    Posts
    447

    Default Re: Imperial length format from string

    James,

    Here's a couple posts from vbcity on Feet and Inches conversions. Not too difficult.
    http://www.vbcity.com/forums/topic.asp?tid=84926
    http://www.vbcity.com/forums/topic.asp?tid=54518
    http://www.vbcity.com/forums/topic.asp?tid=48754

    Hope that helps,
    Danny Polkinhorn
    WATG

  4. #4
    Mastering Revit Author JamesVan's Avatar
    Join Date
    2003-04
    Location
    New York, NY
    Posts
    624

    Default Re: Imperial length format from string

    Thanks guys. I'll work on the feet-inch conversion shortly, but I'd like to include an IF statement for DisplayUnits...(If metric, multiply by 304.8 etc.). Do you have an example of that?
    We are the music makers...we are the dreamers of dreams.
    All Things BIM
    Visit the Revit Community Home Page

  5. #5
    AUGI Addict
    Join Date
    2003-11
    Location
    New Zealand
    Posts
    1,116

    Default Re: Imperial length format from string

    James,

    I take it you mean automatically adjust for metric or imperial projects? The easiest way to do that is probably to use the SetValueString and AsValueString methods of the parameter class. These automatically take into account the display unit of the parameter.

    HTH,

    Guy

  6. #6
    Member
    Join Date
    2009-01
    Location
    Lakewood, Colorado
    Posts
    38

    Default Re: Imperial length format from string

    Does anyone know if it is possible to use Metric and Imperial Units in the same tag? My company has a job where we need to show Metric, but we'd like to keep Imperial. Thanks.

Similar Threads

  1. Check string format
    By Pwned555402908 in forum VBA/COM Interop
    Replies: 3
    Last Post: 2011-11-25, 07:24 AM
  2. What is the real maximum string length?
    By tufofi in forum AutoLISP
    Replies: 19
    Last Post: 2011-10-07, 04:49 AM
  3. parse imperial length format from textbox form
    By Ning Zhou in forum Revit - API
    Replies: 0
    Last Post: 2010-06-02, 02:43 PM
  4. dot net string format
    By clintonc in forum Dot Net API
    Replies: 2
    Last Post: 2010-04-16, 06:04 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
  •