Acres in properties window?

Discussion in 'AutoCAD' started by Andy Rollins, Apr 28, 2004.

  1. Andy Rollins

    Andy Rollins Guest

    Any way I can alter the properties window to show acres as well as square
    feet? TIA.
     
    Andy Rollins, Apr 28, 2004
    #1
  2. Andy Rollins

    ECCAD Guest

    Andy,
    Don't know (if) you can change the properties window..programatically. But, you can load the following and try that.

    (defun C:GA () ; Get Area in Acres
    (prompt "\nPick Object to calculate Area in Acres:")
    (setq obj (ssget))
    (if obj
    (progn
    (setq sq_inches (getvar "area"))
    (setq sq_feet (/ sq_inches 144.0))
    (setq acres (/ sq_feet 43560.0))
    (prompt (strcat "\n" "Square inches = " (rtos sq_inches) ""))
    (prompt (strcat "\n" "Square feet = " (rtos sq_feet) ""))
    (prompt (strcat "\n" "Acres = " (rtos acres) ""))
    )
    )
    (princ)
    ); end function

    Bob Shaw
     
    ECCAD, Apr 28, 2004
    #2
  3. Andy Rollins

    Andy Rollins Guest

    Hey thanks Bob! I appreciate that!
     
    Andy Rollins, Apr 28, 2004
    #3
  4. Andy Rollins

    Andy Rollins Guest

    Mmm slight glitch.. I get 0.00 for all units (inches.. feet.. acres) Any
    ideas? Running 2004 soon to be 2005..
     
    Andy Rollins, Apr 28, 2004
    #4
  5. Andy Rollins

    Jeff Mishler Guest

    Andy, here's a slight mod to Bob's code.
    First, it actually gets the area of the selected object ;-)
    Second, it accounts for the type of units in use (arch. or engineering is
    inches, else assumes feet since acreage is being calc'ed)

    Jeff

    (defun C:GA (/ obj sq_inches sq_feet acres) ; Get Area in Acres
    (prompt "\nPick Object to calculate Area in Acres:")
    (setq obj (ssget ":S"))
    (if obj
    (progn
    (command "area" "o" obj)
    (if (or (= (getvar "lunits") 3)
    (= (getvar "lunits") 4)
    )
    (progn
    (setq sq_inches (getvar "area"))
    (prompt (strcat "\n" "Square inches = " (rtos sq_inches) ""))
    (setq sq_feet (/ sq_inches 144.0))
    )
    (setq sq_feet (getvar "area"))
    )
    (setq acres (/ sq_feet 43560.0))

    (prompt (strcat "\n" "Square feet = " (rtos sq_feet) ""))
    (prompt (strcat "\n" "Acres = " (rtos acres) ""))
    )
    )
    (princ)
    ); end function
     
    Jeff Mishler, Apr 28, 2004
    #5
  6. Andy Rollins

    Andy Rollins Guest

    Thanks Jeff.. I really need to buy you a beer sometime!

    -and thanks again Bob
     
    Andy Rollins, Apr 28, 2004
    #6
  7. Andy Rollins

    ECCAD Guest

    Jeff,
    Was working if you actually picked an object..and units set to decimal , inches. Didn't know if units setting would affect..guess it does. I learn. Thanks.

    Bob
     
    ECCAD, Apr 28, 2004
    #7
  8. Andy Rollins

    Jeff Mishler Guest

    Bob, not trying to nit pick or anything, but ............. are sure it was
    working?

    I mean, is it possible your "area" sysvar already had a value in it so it
    'looked' like it was working?

    This is why I ask:

    (prompt "\nPick Object to calculate Area in Acres:")
    (setq obj (ssget))
    (if obj
    (progn
    (setq sq_inches (getvar "area"))

    Nowhere in this code is the area command run to place the area of the
    selected object into the "area" sysvar. So I'm not sure how it could get
    there.....

    Jeff
    inches. Didn't know if units setting would affect..guess it does. I learn.
    Thanks.
     
    Jeff Mishler, Apr 28, 2004
    #8
  9. Andy Rollins

    ECCAD Guest

    Jeff,
    As always, you are correct. I was poking objects, and looking at the 'properties' window..this probably set the 'area' var at some time..then I wrote and tried the program. Worked for me. (sigh). I should have added the (command "area" "o" obj) to be sure to tuck it away..

    Thanks for the insight..

    Bob
     
    ECCAD, Apr 28, 2004
    #9
  10. Andy Rollins

    Owen Wengerd Guest

    Andy:
    In addition to the other alternative already provided, you may also want
    to check out my shareware Periscope utility
    (http://www.manusoft.com/Software/Periscope/Index.stm). Periscope displays
    areas in acres if the area is large enough. :)
     
    Owen Wengerd, Apr 28, 2004
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.