Capturing Area of Object to Variable with LISP??

Discussion in 'AutoCAD' started by todbarrett, Mar 3, 2004.

  1. todbarrett

    todbarrett Guest

    Hi all,

    Can someone please offer help in showing me how to capture the AREA of a closed polyline or polygon to a variable using LISP?

    I can display the result of the last object created, on the command line with the AREA command (command "area" "o" "last") but can't save the result to a variable.

    Thanks in advance.
    TodB
     
    todbarrett, Mar 3, 2004
    #1
  2. todbarrett

    ECCAD Guest

    TodB,
    Try:
    (command "area" "o" "last")
    (setq area_last (getvar "area"))

    Bob
     
    ECCAD, Mar 3, 2004
    #2
  3. todbarrett

    todbarrett Guest

    Thanks alot Bob!
    I didn't realize that AREA was a system variable as well as a command!
    Feeling Stupid :(

    Tod
     
    todbarrett, Mar 3, 2004
    #3
  4. todbarrett

    ECCAD Guest

    Tod,
    Neither did I realize that Area is a sysvar, till I found it here awhile ago. No prob.
    Bob
     
    ECCAD, Mar 3, 2004
    #4
  5. todbarrett

    Dean Kurth Guest

    I just subscribed to this newsgroup for the same question....Thanks for
    beating me to it.

    Dean
     
    Dean Kurth, Mar 3, 2004
    #5
  6. Another option would be to use ActiveX.

    (setq area (vla-get-area (vlax-ename->vla-object (car (entsel)))))

    --

    Autodesk Discussion Group Facilitator


    or polygon to a variable using LISP?
    command (command "area" "o" "last") but can't save the result to a variable.
     
    Jason Piercey, Mar 3, 2004
    #6
  7. todbarrett

    ECCAD Guest

    Jason,
    Do you 'really' want to use "(setq area..", or (setq some_area.."

    Bob
     
    ECCAD, Mar 3, 2004
    #7
  8. Hi Bob,

    Why do you ask?


    AutoCAD menu utilities loaded.
    Command: !area
    nil
     
    Jason Piercey, Mar 4, 2004
    #8
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.