add area

Discussion in 'AutoCAD' started by boro, Jul 10, 2007.

  1. boro

    boro Guest

    is there a lsp or something to calculate area of regions and closed
    polylines by selecting more than one object at the same time?
    can region be converted to closed polyline?

    thx
     
    boro, Jul 10, 2007
    #1
  2. boro

    ddpcad Guest

    I use ToolPac from www.dotsoft.com to accomplish both of these tasks so
    both are possible. Here's an old lisp routine that may work for you for
    the area problem
    Dave
    DDP

    ; AREAS.LSP
    ; Michael Weaver Fri 08-06-1993 Compuserv #71461,1775

    ;This routine will write the area and perimeter of selected closed
    ; polylines to an ascii file. This file will have an area, a user
    ; input comment and a perimter on each line. The file is tab
    ; delimited.

    (defun c:areas(; write area and perimeter of selected
    ; plines out to a file
    /; no formal arguments
    )
    (if (and
    (setq fname (getfiled "Output filename" "" "txt" 1))
    (setq fileh (open fname "w"))
    )
    (progn
    (write-line "Area\tPerimeter" fileh)
    (setq cmdecho (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (while (setq ent (entsel "\nSelect a closed polyline. "))
    (redraw (car ent) 3)
    (setq elist (entget (car ent)))
    (cond
    ((= "POLYLINE" (cdr (assoc 0 elist)))
    (if (= 1 (logand (cdr (assoc 70 elist)) 1))
    (progn
    (command "area" "e" ent)
    (setq
    area (getvar "area")
    perimeter (getvar "perimeter")
    )
    (if (= 4 (getvar "lunits"))
    (setq
    area (/ area 144.0)
    perimeter (/ perimeter 12.0)
    )
    )
    (write-line
    (strcat
    (rtos area 2 4)
    "\t"
    (rtos perimeter 2 4)
    ); strcat
    fileh
    ); write-line
    ); progn
    (princ "\nSelected pline is not closed. ")
    ); end if
    ); end polyline
    (T (princ "\nSelected entity is not a pline. "))
    ); end cond
    ); end while
    (setq fileh (close fileh))
    (setvar "cmdecho" cmdecho)
    ); end progn if filename and handle aquired
    ); end if
    (princ)
    )

    (progn
    (princ "\nC:AREAS by Michael Weaver Compuserv #71461,1775")
    (princ)
    )
     
    ddpcad, Jul 10, 2007
    #2
  3. boro

    Paul Turvill Guest

    Paul Turvill, Jul 10, 2007
    #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.