Results 1 to 6 of 6

Thread: Using decimal units in lisp while ACAD is set for Arch

  1. #1
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    385
    Login to Give a bone
    0

    Default Using decimal units in lisp while ACAD is set for Arch

    Hello all,
    I wrote the code below and it works pretty well, the problem I am running into is that I have to switch my units to decimal and then switch the decimal place to "0" so that the text appears correctly. (notn feet and inches)

    Is there a way within a lisp to tell ACAD to keep the units decimal and then once the command i sthrough go back to arch?
    Thank you all in advance,
    Andre
    Code:
    (defun c:cfm (/ currlay sqft inspt ocfmpersqft curros)
      (command "undo" "begin")
      (setvar "CMDECHO" 0)
      (setq curros (getvar "osmode"))
      (setvar "osmode" 64)
      (if (not cfmpersqft) (setq cfmpersqft (+ 0 0)))
      (setq ocfmpersqft cfmpersqft)
      (setq cfmpreview (rtos ocfmpersqft))
      (if
        (= (setq cfmpersqft (getreal (strcat "\enter CFM per sq ft number:  <" cfmpreview ">:"))) nil)
        (setq cfmpersqft ocfmpersqft)
        )
      (setq currlay (getvar "Clayer"))
      (setq sqft (getreal "\nenter room square foot: "))
      (setvar "clayer" "M-QUCO-CHCK")
      (command ".text" "j" "mc" pause "2.25" 0 (strcat (rtos (* sqft cfmpersqft))""))
      (setq roomcfm (* sqft cfmpersqft))
      (setvar "clayer" currlay)
      (setvar "osmode" curros)
      (command "undo" "end")
      (setvar "CMDECHO" 1)
      (princ (strcat roomcfm))
      (princ))
    Last edited by Opie; 2007-02-13 at 08:54 PM. Reason: [CODE] tags added

  2. #2
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Using decimal units in lisp while ACAD is set for Arch

    Look into 'rtos'. You call it plenty of times, but you don't give it all the arguments it can take.

  3. #3
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    385
    Login to Give a bone
    0

    Default Re: Using decimal units in lisp while ACAD is set for Arch

    Will look into it this evening, thanks for the help thus far

  4. #4
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Using decimal units in lisp while ACAD is set for Arch

    cvunit ?

    : ) Happy computing !


    kennet

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

    Default Re: Using decimal units in lisp while ACAD is set for Arch

    Code:
     (command ".text" "j" "mc" pause "2.25" 0 (strcat (rtos (* sqft cfmpersqft) 2 0)""))
    Regards,
    Abdul Huck

  6. #6
    I could stop if I wanted to kpblc2000's Avatar
    Join Date
    2006-09
    Posts
    212
    Login to Give a bone
    0

    Default Re: Using decimal units in lisp while ACAD is set for Arch

    I think the better way is to use construction like
    Code:
    (if (= 0 (tblsearch "style" (getvar "textstyle")))
      (command "_.text"
               "_j"
               "_mc"
               pause
               2.25
               0.
               (strcat (rtos (* sqft cfmpersqft) 2 0) "")
               ) ;_ end of command
      (command "_.text"
               "_j"
               "_mc"
               pause
               0
               (strcat (rtos (* sqft cfmpersqft) 2 0) "")
               ) ;_ end of command
      ) ;_ end of if
    It seems more universally.

Similar Threads

  1. Lisp Routine: Decimal to Surveyor Units
    By Firmso in forum AutoCAD Customization
    Replies: 8
    Last Post: 2009-02-20, 09:31 PM
  2. Replies: 4
    Last Post: 2007-12-10, 07:03 PM
  3. Replies: 12
    Last Post: 2006-12-14, 09:04 PM
  4. Convert Civil drawings using decimal units into Arch. units
    By tlarocco in forum AutoCAD Civil 3D - General
    Replies: 4
    Last Post: 2006-07-17, 05:52 PM
  5. Replies: 2
    Last Post: 2006-01-31, 08:12 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
  •