PDA

View Full Version : Calculating the sum of various lengths in Autodesk?

sophie
4th Feb 2008, 12:45 am
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

PS_Port
4th Feb 2008, 12:52 am
:)

Alan Cullen
4th Feb 2008, 12:56 am
Try this lisp:

;; 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)
)

PS_Port
4th Feb 2008, 01:09 am
Hey alan what happen to

McPh*** Mac*** War*** Chap***

sophie
4th Feb 2008, 01:35 am
Thanks - will take a look

Alan Cullen
4th Feb 2008, 01:42 am
G'day, Paul. I decided to delete that bit to do with the company out of any code I post. :lol:

Hugh_Compton
4th Feb 2008, 11:13 am
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.

---------------------------------------