Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp to calculate multiple pline areas

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
7300 Views, 4 Replies

Lisp to calculate multiple pline areas

I am not a lisp programmer, so here is my question:

I have a drawing which contains about 100 "areas". These areas are closed
polylines. I would like to get a total area of all these polylines.

I have tried using AutoCAD 2002's AREA command, but I am only able to select
one item at a time, (AREA, Add, Object). This is fine for calculating a few
areas. It gives me a running total of each item that I select.

Using the LIST command works OK for a few items, but you still have to wade
through all the other information to get the area info for each item.

Is there a way to select crossing ALL the areas that I have, and have it
return a total? This would save a lot of time.


Thanks,
Dave
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

Give this a try:


;;;Ken Alexander
;;;Total area of lwpolylines
(defun C:tot_area (/ ss vlaobj cnt arealst tarea)
(vl-load-com)
(setq ss (ssget '((0 . "lwpolyline")))
cnt 0)
(if ss
(progn
(repeat (sslength ss)
(setq vlaobj
(vlax-ename->vla-object
(ssname ss cnt))
arealst (cons (vla-get-area vlaobj) arealst)
cnt (1+ cnt))
)
(setq tarea (apply '+ arealst))
)
(setq tarea 0)
)
(alert (strcat "\nTotal area is: " (rtos tarea 2 3)))
(princ)
)

--
"We can't solve problems by using the same kind
of thinking we used when we created them."
--Albert Einstein

Ken Alexander
Acad 2000
Windows XP Pro
"Dave Stelljes" wrote in message
news:E092C7AABA1DC31028A141764934C18F@in.WebX.maYIadrTaRb...
> I am not a lisp programmer, so here is my question:
>
> I have a drawing which contains about 100 "areas". These areas are closed
> polylines. I would like to get a total area of all these polylines.
>
> I have tried using AutoCAD 2002's AREA command, but I am only able to select
> one item at a time, (AREA, Add, Object). This is fine for calculating a few
> areas. It gives me a running total of each item that I select.
>
> Using the LIST command works OK for a few items, but you still have to wade
> through all the other information to get the area info for each item.
>
> Is there a way to select crossing ALL the areas that I have, and have it
> return a total? This would save a lot of time.
>
>
> Thanks,
> Dave
>
>
Message 3 of 5
Anonymous
in reply to: Anonymous

There are several of them out there...
Paul Turvill wrote one a while ago for R14 that works with A2k

http://www.turvill.com/t2/
under free stuff
called:
polyarea.lsp

Dave Stelljes wrote:
> I am not a lisp programmer, so here is my question:
>
> I have a drawing which contains about 100 "areas". These areas are closed
> polylines. I would like to get a total area of all these polylines.
>
> I have tried using AutoCAD 2002's AREA command, but I am only able to select
> one item at a time, (AREA, Add, Object). This is fine for calculating a few
> areas. It gives me a running total of each item that I select.
>
> Using the LIST command works OK for a few items, but you still have to wade
> through all the other information to get the area info for each item.
>
> Is there a way to select crossing ALL the areas that I have, and have it
> return a total? This would save a lot of time.
>
>
> Thanks,
> Dave
>
>
Message 4 of 5
Anonymous
in reply to: Anonymous

Hi Dave

 

Can you do a little modification.

I want each object area seperate inside of every object.

 

Regards

Ismail

Message 5 of 5
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

.....

I want each object area seperate inside of every object.

....


A Search will turn up several ways to do that, for instance, here.

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report