# Thread: Calculating the sum of various lengths in Autodesk?

1. ## Calculating the sum of various lengths in Autodesk?

Registered forum members do not see this ad.

Hi All,

I use Autodesk 2004 for drawing pipe layouts onto housing block plans and often need to calculate the sum of the length of the pipes, so I work out the cost of the pipes. (The pipes are represented by line segments on plan often at various angles)
I know there is an inquiry tool for distance to measure each length individually and then tally them, but is there a way of calculating the sum of all these lengths automatically?

Sophie

2. Try this lisp:

Code:
```;; QTY_LINE.LSP                      GET TOTAL LENGTH OFF ALL SELECTED LINES
;;
;; WRITTEN BY:   Alan Cullen          October 2000
;;               CAIRNS
;;
;; START COMMAND:   QTYL
;;
;;
;;-----------------------------MAIN PROGRAM------------------------------
(defun c:QTYL () ;;;(/ olderr a n index poly p1 p2)
(princ "\n GET TOTAL LENGTH OFF ALL SELECTED LINES     -     October 2000 - Alan CULLEN")
(setvar "CMDECHO" 0)
(setq ssline (ssget '((0 . "LINE"))))
(setq number (sslength ssline))
(setq total 0)
(setq counter 0)
(repeat number
(setq name (ssname ssline counter))
(setq data (entget name))
(setq code10 (assoc 10 data))
(setq code11 (assoc 11 data))
(setq coord10 (cdr code10))
(setq coord11 (cdr code11))
(setq dist (distance coord10 coord11))
(setq total (+ total dist))
(setq counter (+ 1 counter))
)
(prompt (strcat "\n Total length of lines = "(rtos total) "........ No. of Lines = "(rtos number 2 0)))
(princ)
)```

3. Hey alan what happen to
Code:
```
McPh*** Mac*** War*** Chap***```

4. Thanks - will take a look

5. G'day, Paul. I decided to delete that bit to do with the company out of any code I post.

6. ## 3D Pipe Fittings

Really you need to consider moving over to 3D. This way you can create a table of pipes and pipe length totals without needing to select anything at all.
---------------------------------------

7. Registered forum members do not see this ad.

there was once the tlen lisp. i use it often

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts