Obtaining the area of an (closed)polyline

Discussion in 'AutoCAD' started by Marcel Janmaat, Apr 14, 2004.

  1. Hello again,

    I want to write a routine to give points in rooms or closed areas (with the
    boundary command), then determine the area and place texts with roomnumbers
    and area's in it.

    This shouldn't be to difficult, but before I start inventing the wheel
    here, does any already know of the existense of something like this????
    Or otherwise have a suggestion on how te obtain the area of a close polyline
    wich is created by the boundary command for me?

    Thanx!
    MJ
     
    Marcel Janmaat, Apr 14, 2004
    #1
  2. Marcel Janmaat

    Javier Tapia Guest

    Hi
    Once you create the bpoly, you can (immediately) run a
    (command "area" "object" "last")
    this command retrieves the area for the last entity created (the bpoly).
    The *system variable* AREA stores the results of the last *command* AREA
    used.
    You can use it to store the area into a variable:
    (setq last_bpoly_area (getvar "area"))

    I hope this help you. Greetings
    (Sorry, my english is very poor...)
     
    Javier Tapia, Apr 14, 2004
    #2
  3. Thanx Javier! Exactly what i was looking for.
    P.S. Nothing wrong with you English. No accent either! Hihi!
     
    Marcel Janmaat, Apr 14, 2004
    #3
  4. Marcel Janmaat

    jonesr Guest

    jonesr, Apr 14, 2004
    #4
  5. Marcel Janmaat

    OLD-CADaver Guest

    Heres an old one, dunno if it still works, but looks like it should.

    (defun c:tagarea ()
    (setvar "osmode" 512)
    (setq atx (getpoint "\nPick any point on boundary... "))
    (command "area" "e" atx)
    (setq str3 (strcat (rtos (/(getvar "area")(* 144 43560.0)) 2 3) " Ac.\\P" (rtos (/ (getvar "area") 144.0) 2 2) " SQ.FT."))
    (setq at2 (getpoint "\nLocation for text... "))
    (command "Mtext" at2 "R" "0" "J" "MC" "W" "0" str3 "")
    (setvar "osmode" 0)
    (command "cmdecho" 1)
    (princ))
     
    OLD-CADaver, Apr 14, 2004
    #5
  6. Marcel Janmaat

    Huw Guest

    Huw, Apr 15, 2004
    #6
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.