Results 1 to 6 of 6

Thread: Converting values to feet and inches

  1. #1
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Default Converting values to feet and inches

    Hi All

    I have the following routine in my toolbox of functions I frequently use. I am trying to modify it so that it returns the values in feet and inches. Currently, when I enter (rtos 192 3 4) I get the following "16'" instead of "16'-0\"". How do I modify the following code to achieve this? Thanks.

    Manuel

    Code:
    (defun getval (val tag)
       (setq lunits (getvar "LUNITS")
             luprec (getvar "LUPREC")
             val
         (cond
            ((= (type val) 'STR) val)
            ((= (type val) 'REAL) (rtos val lunits luprec))
            ((= (type val) 'INT) (itoa val))
            (T "")
         )
       )
       val
    )

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Default Re: Converting values to feet and inches

    Check out the DIMZIN system variable and its effect on (rtos)
    R.K. McSwain | CAD Panacea |

  3. #3
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Converting values to feet and inches

    BTW
    Code:
    (rtos <Real> (getvar 'LUNITS) (getvar 'LUPREC))
    is the same as
    Code:
    (rtos <Real>)
    If the arguments are not filled, it uses the defaults.

  4. #4
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Default Re: Converting values to feet and inches

    Hi All
    I need to convert a value of "16'-0 3/4"" to 16'-0 3/4". I have tried several method and none is returning the value I need. Thank you in advance for your assistance.
    Manuel

  5. #5
    I could stop if I wanted to
    Join Date
    2002-08
    Posts
    231
    Login to Give a bone
    0

    Default Re: Converting values to feet and inches

    Hi,
    This?
    Code:
    (defun getval (val / odz) (setq odz (getvar 'DIMZIN)) (setvar 'DIMZIN 1) (princ (rtos val 4 2)) (setvar 'DIMZIN odz) (prin1))
    (getval 192.75) -> 16'-0 3/4"

  6. #6
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Default Re: Converting values to feet and inches

    Thank you. That worked perfectly.
    Manuel

Similar Threads

  1. inches instead of feet and inches
    By Wagurto in forum Revit Architecture - General
    Replies: 3
    Last Post: 2013-04-11, 06:02 AM
  2. Feet and Decimal Inches
    By cknox in forum Revit Architecture - General
    Replies: 2
    Last Post: 2011-07-12, 11:03 PM
  3. Dim Style from feet to inches
    By sherflor in forum AutoCAD General
    Replies: 3
    Last Post: 2006-02-08, 09:44 PM
  4. Feet vs Inches
    By CADMama in forum Revit Architecture - General
    Replies: 23
    Last Post: 2006-02-01, 04:30 PM
  5. Converting feet to inches
    By lillian.twining in forum AutoLISP
    Replies: 5
    Last Post: 2005-05-12, 06:33 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
  •