Calculating areas

Discussion in 'AutoCAD' started by jalwgis, May 25, 2005.

  1. jalwgis

    jalwgis Guest

    I have a lisp program that will calculate the sum of areas.
    The units is in sq in. Is there a way to modify the program
    to make the units sq ft besides dividing by 144 on a calculator?
    Any help is appreciated.

    (DEFUN C:AREASADD ()
    (PROMPT "\nSELECT AREAS TO ADD TOGETHER: ")
    (SETQ P_AREA 0.0)
    (SETQ SS (SSGET))
    (WHILE (> (SSLENGTH SS) 0)
    (SETQ EN (SSNAME SS 0))
    (SETQ ED (ENTGET EN))
    (SETQ AS (CDR (ASSOC '0 ED)))
    (IF (or (= AS "LWPOLYLINE") (= as "POLYLINE"))
    (PROGN
    (COMMAND "_AREA" "_E" EN)
    (SETQ P_AREA (+ P_AREA (GETVAR "AREA")))
    (SSDEL EN SS)
    )
    (SSDEL EN SS)
    )
    )
    (PROMPT (STRCAT "\nTOTAL AREA IS : " (RTOS P_AREA 2 2)))
    (princ)
    )
     
    jalwgis, May 25, 2005
    #1
  2. jalwgis

    per.corell Guest

    Hi
    You just place ; (setq p_area (/ p_area 144)) the right place in the
    app.
    P.C.
     
    per.corell, May 25, 2005
    #2
  3. try this instead:

    (DEFUN C:AREASADD ()
    (PROMPT "\nSELECT AREAS TO ADD TOGETHER: ")
    (SETQ P_AREA 0.0)
    (SETQ SS (SSGET))
    (WHILE (> (SSLENGTH SS) 0)
    (SETQ EN (SSNAME SS 0))
    (SETQ ED (ENTGET EN))
    (SETQ AS (CDR (ASSOC '0 ED)))
    (IF (or (= AS "LWPOLYLINE") (= as "POLYLINE"))
    (PROGN
    (COMMAND "_AREA" "_E" EN)
    (SETQ P_AREA (+ P_AREA (GETVAR "AREA")))
    (SSDEL EN SS)
    )
    (SSDEL EN SS)
    )
    )
    (setq P_AREA (/ P_AREA 144))
    (PROMPT (STRCAT "\nTOTAL AREA IS : " (RTOS P_AREA 2 2) " SQ.FT."))
    (princ))
     
    Michael Bulatovich, May 25, 2005
    #3
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.