Jump to content

Various Line Length Total!!!


Cadet 84

Recommended Posts

Hi everybody,

 

I use Auto CAD 2008. I have a heap of cracks on a concrete slab. There are over 300 lines..i need to know what the total length of the cracks are..is there a way of finding this out without actually adding up each indivitual line:?

Link to comment
Share on other sites

Guest Alan Cullen

G'day Tyarna,

 

Try the following lisp routine. But make sure you have exploded all the lines ( in case any of them are polylines).

 

;; QTY_LINE.LSP                      GET TOTAL LENGTH OFF ALL SELECTED LINES
;;
;; WRITTEN BY:   Alan Cullen          October 2000
;;               McPherson Maclean Wargon Chapman
;;               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)
)

 

If you know nothing of lisp routines, get back to me. :D

Link to comment
Share on other sites

Guest Alan Cullen

Okay, copy that code to notepad, then save it as QTY_LINE.LSP to a folder in your acad search path (probably acad\support).

 

Then to load it type (load "QTY_LINE") at the command line. then type QTYL at the command line to fire it up. Then just pick all the lines you want the total length of. :D

 

Get back to me if you are still having trouble.

Link to comment
Share on other sites

:unsure: Ok, so i have down loaded what you sent to me Allan, and i have also downloaded tlen.lsp. I have no idea how to apply them to autocad though to get either one of the programs working....

 

by the way - hi Allan!:twisted:

Link to comment
Share on other sites

Alan,

The msg above was directed to you. I didn't see CAD64 till after i had already applied your suggestion. It worked a treat. Thank you very much for your time and efforts.

 

thank you too CAD 64, i read the link you sent it it has given me a much clearer understanding!

Link to comment
Share on other sites

  • 1 year later...
G'day Tyarna,

 

Try the following lisp routine. But make sure you have exploded all the lines ( in case any of them are polylines).

 

;; QTY_LINE.LSP                      GET TOTAL LENGTH OFF ALL SELECTED LINES
;;
;; WRITTEN BY:   Alan Cullen          October 2000
;;               McPherson Maclean Wargon Chapman
;;               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)
)

I cant understand which part of this code has to be copy and save....is it all text here...
Link to comment
Share on other sites

dear allen...

pl explain step by step lisp routing and QTYL command.....I don' know any thing on this command i m using 2007 and also need to know about data extraction wizard

Link to comment
Share on other sites

You need to save the whole code. To get it to work, check out the link that Cad64 gave earlier in this thread, that explains how to load and run a Lisp-routine.

 

For your questions about the data extraction wizard, please start a new thread and be more specific about what you want to know.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...