calculating perimeter
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
calculating perimeter

 
Post new topic   Reply to topic    CADForums.net Forum Index -> AutoCAD
Author Message
Chris
Guest





Posted: Fri Oct 14, 2005 12:10 am    Post subject: calculating perimeter Reply with quote

Since the last question I asked got taken care superbly I thought I would
ask another question. Here where I work we have to calculate cutting inches
of a part. What that means is say you have a drawing that contains a
rectangle with 50 holes and some slots. What we have to do is take the
perimeter/area of each hole, slot, and outside and add them all togehter.
It gets very cumbersome if you have a part with 100's of holes. Is there a
way to have autocad take the perimeter of every object in a drawing and
calculate the sum of the perimeters?

Back to top
Brian Salt
Guest





Posted: Fri Oct 14, 2005 12:10 am    Post subject: Re: calculating perimeter Reply with quote

In article <Xns96EEA9CB879CEChrisWaterjet@207.115.17.102>, support@aol.com
(Chris) wrote:

Quote:
*From:* Chris <support@aol.com
*Date:* Thu, 13 Oct 2005 21:33:17 GMT

Since the last question I asked got taken care superbly I thought I
would ask another question. Here where I work we have to calculate
cutting inches of a part. What that means is say you have a drawing
that contains a rectangle with 50 holes and some slots. What we have to
do is take the perimeter/area of each hole, slot, and outside and add
them all togehter. It gets very cumbersome if you have a part with
100's of holes. Is there a way to have autocad take the perimeter of
every object in a drawing and calculate the sum of the perimeters?


Try this lisp routine, with due acknowledgement to Tee Square Graphics.

Window over the objects you want included. Don't forget that a 'crossing'
window will include anything that you cut with the window.


;|

TLEN.LSP - Total LENgth of selected objects
(c) 1998 Tee Square Graphics

|;

(defun C:TLEN (/ ss tl n ent itm obj l)
(setq ss (ssget)
tl 0
n (1- (sslength ss)))
(while (>= n 0)
(setq ent (entget (setq itm (ssname ss n)))
obj (cdr (assoc 0 ent))
l (cond
((= obj "LINE")
(distance (cdr (assoc 10 ent))(cdr (assoc 11 ent))))
((= obj "ARC")
(* (cdr (assoc 40 ent))
(if (minusp (setq l (- (cdr (assoc 51 ent))
(cdr (assoc 50 ent)))))
(+ pi pi l) l)))
((or (= obj "CIRCLE")(= obj "SPLINE")(= obj "POLYLINE")
(= obj "LWPOLYLINE")(= obj "ELLIPSE"))
(command "_.area" "_o" itm)
(getvar "perimeter"))
(T 0))
tl (+ tl l)
n (1- n)))
(alert (strcat "Total length of selected objects is " (rtos tl)))
(princ)
)
Back to top
jeannette
Guest





Posted: Fri Oct 14, 2005 6:07 am    Post subject: Re: calculating perimeter Reply with quote

This is the routine I use. It's a free LSP from Tee Square graphics
that I modified so it will print the distance on the drawing
It will not include blocks.

I use it for exactly what you do. Laser & Waterjet cutting

Jeannette
www.eblw.com

;|

TLEN.LSP - Total LENgth of selected objects
(c) 1998 Tee Square Graphics

|;

(defun C:TLEN (/ ss tl n ent itm obj l)
(setq ss (ssget)
tl 0
n (1- (sslength ss)))
(while (>= n 0)
(setq ent (entget (setq itm (ssname ss n)))
obj (cdr (assoc 0 ent))
l (cond
((= obj "LINE")
(distance (cdr (assoc 10 ent))(cdr (assoc 11 ent))))
((= obj "ARC")
(* (cdr (assoc 40 ent))
(if (minusp (setq l (- (cdr (assoc 51 ent))
(cdr (assoc 50 ent)))))
(+ pi pi l) l)))
((or (= obj "CIRCLE")(= obj "SPLINE")(= obj "POLYLINE")
(= obj "LWPOLYLINE")(= obj "ELLIPSE"))
(command "_.area" "_o" itm)
(getvar "perimeter"))
(T 0))
tl (+ tl l)
n (1- n)))
;(alert (strcat "Total length of selected objects is " (rtos tl 2
2)))

(setq tlen (rtos tl 2 2))

(cond
((boundp 'tlen)
(setq cmd (getvar "cmdecho")
mno (getvar "menuecho")
)
(setvar "cmdecho" 0)
(setvar "menuecho" 1)
(graphscr)
(setq wcl (strcat "Total Cut Length = " tlen))
(setq p1 (getpoint "\nPick the arrowhead position : "))
(if (= p1 nil)(setq p2 nil)(setq p2 (getpoint p1 "\nPick the
text position : ")))
(if (/= p2 nil)(command "leader" p1 p2 "" wcl ""))
(setvar "cmdecho" cmd)
(setvar "menuecho" mno)
)
)
(princ)
)

Back to top
Brian Salt
Guest





Posted: Fri Oct 14, 2005 9:29 am    Post subject: Re: calculating perimeter Reply with quote

SNAP! (:-))


In article <nu0uk1ptboooas7jnio01uv39jtv434mv0@4ax.com>,
jeanne8_Remove_@eblw.com (jeannette) wrote:

Quote:
*From:* jeannette <jeanne8_Remove_@eblw.com
*Date:* Fri, 14 Oct 2005 01:07:44 GMT

This is the routine I use. It's a free LSP from Tee Square graphics
that I modified so it will print the distance on the drawing
It will not include blocks.

I use it for exactly what you do. Laser & Waterjet cutting

Jeannette
www.eblw.com

;|

TLEN.LSP - Total LENgth of selected objects
(c) 1998 Tee Square Graphics


<SNIP>
Back to top
Chris
Guest





Posted: Fri Oct 14, 2005 4:10 pm    Post subject: Re: calculating perimeter Reply with quote

jeannette <jeanne8_Remove_@eblw.com> wrote in
news:nu0uk1ptboooas7jnio01uv39jtv434mv0@4ax.com:

Quote:
This is the routine I use. It's a free LSP from Tee Square graphics
that I modified so it will print the distance on the drawing
It will not include blocks.

I use it for exactly what you do. Laser & Waterjet cutting

Jeannette
www.eblw.com

;|

TLEN.LSP - Total LENgth of selected objects
(c) 1998 Tee Square Graphics

|;
What I also found out yesterday that works good enough for us is if you

hatch your part, doesn't matter the style or anything just choose hatch
then select the entire part. once the object is hatched, take the area
clicking on the hatched area and it will give you total area and total
perimeter. I will use the lsp though, thanks alot

Chris
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> AutoCAD All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB