+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Forum Newbie
    Using
    AutoCAD 2004
    Join Date
    Jan 2008
    Posts
    4

    Default 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?

    Thanks for any advice offered.

    Sophie

  2. #2
    Super Member
    Using
    AutoCAD not applicable
    Join Date
    Jul 2007
    Posts
    639
    If at first you don't succeed, then maybe failure is more your style.

  3. #3
    Banned Alan Cullen's Avatar
    Using
    Map 3D 2009
    Join Date
    Jun 2006
    Location
    Cairns, Queensland, Australia
    Posts
    4,181

    Default

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

  4. #4
    Super Member
    Using
    AutoCAD not applicable
    Join Date
    Jul 2007
    Posts
    639

    Default

    Hey alan what happen to
    Code:
     
    McPh*** Mac*** War*** Chap***
    Last edited by PS_Port; 4th Feb 2008 at 01:11 am. Reason: Privacy - sorry mate
    If at first you don't succeed, then maybe failure is more your style.

  5. #5
    Forum Newbie
    Using
    AutoCAD 2004
    Join Date
    Jan 2008
    Posts
    4

    Default

    Thanks - will take a look

  6. #6
    Banned Alan Cullen's Avatar
    Using
    Map 3D 2009
    Join Date
    Jun 2006
    Location
    Cairns, Queensland, Australia
    Posts
    4,181

    Default

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

  7. #7
    Senior Member
    Using
    Architecture 2011
    Join Date
    Jan 2008
    Posts
    100

    Default 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.
    ---------------------------------------
    Pipework & Structural Steel http://www.3DCADMax.com

  8. #8
    Super Member chrisdarmanin's Avatar
    Using
    AutoCAD 2016
    Join Date
    Feb 2006
    Location
    Malta
    Posts
    552

    Default

    Registered forum members do not see this ad.

    there was once the tlen lisp. i use it often

Similar Threads

  1. Calculating a certain lenght on an arc
    By bledking in forum AutoCAD Beginners' Area
    Replies: 5
    Last Post: 18th Dec 2007, 11:37 pm
  2. Calculating volume
    By zars in forum AutoCAD General
    Replies: 16
    Last Post: 14th Dec 2007, 10:04 am
  3. Calculating areas
    By jgmdpk in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 19th Jun 2007, 12:14 am
  4. 'DISTANCE' not calculating
    By madronamodern in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 4th Mar 2007, 08:56 am
  5. calculating an envelope
    By aaron in forum AutoCAD Beginners' Area
    Replies: 0
    Last Post: 15th Jul 2005, 08:20 pm

Bookmarks

Posting Permissions

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