Jump to content

Total line length


prabhathjp

Recommended Posts

I m working in large housing project and i wanted to measure total portabal water pipeline length which is nearly 40 km long....I did it getting dimensions part by part.....nearly 750 lines were there(same layer) is there any easy method to get total line length at once.......if so pl. explain ste by step......

Link to comment
Share on other sites

if you are familier with lisps there are lots of threads deiscussing this in lisps forum. I have no knwoledge of lisps, so can not guide you in right direction

 

 

Alos look at the similr threads listed here at bottom of this this thread.

Link to comment
Share on other sites

I m working in large housing project and i wanted to measure total portabal water pipeline length which is nearly 40 km long....I did it getting dimensions part by part.....nearly 750 lines were there(same layer) is there any easy method to get total line length at once.......if so pl. explain ste by step......

 

Download TLEN.LSP from http://www.turvill.com/t2/free_stuff/index.htm.

If you don't know what to do with lisp files, see this.

Link to comment
Share on other sites

This wasn't created by me(I'm not very good with "vl") I obtained it at work. It extracts the distance of all polylines on all layers to an excel file.

 

(defun c:ple (/    elist     en      i       layer    layer_list
       leng     pline      row       ss        sumlen   total
       x     xlApp      xlBook   xlBooks  xlCells  xlSheet
       xlSheets
          )
 (vl-load-com)
 (setq    xlApp       (vlax-get-or-create-object "Excel.Application")
   xlBooks  (vlax-get-property xlApp "Workbooks")
   xlBook       (vlax-invoke-method xlBooks "Add")
   xlSheets (vlax-get-property xlBook "Sheets")
   xlSheet       (vlax-get-property xlSheets "Item" 1)
   xlCells       (vlax-get-property xlSheet "Cells")
 ) 
 (vla-put-visible xlApp :vlax-true)
 ;headers
 (vlax-put-property xlCells "Item" 1 1 "Layer")
 (vlax-put-property xlCells "Item" 1 2 "Length")
 
 (setq row 2
   total 0)

 (setq ss (ssget "_X" (list (cons 0 "*POLYLINE"))) i -1)
 (repeat (sslength ss)
   (setq en (ssname ss (setq i (1+ i)))
     elist (entget en)
     layer (cdr (assoc 8 elist)))
   (if (not (member layer layer_list))
     (setq layer_list (cons layer layer_list))))
 
 
 (repeat (length layer_list)
   (setq layer (car layer_list))
   (setq ss (ssget "_X" (list (cons 0 "*POLYLINE")(cons 8 layer))) i -1 sumlen 0)
   (repeat (sslength ss)
   (setq pline (vlax-ename->vla-object (ssname ss (setq i (1+ i)))))
   (setq leng  (vlax-curve-getdistatparam pline
         (vlax-curve-getendparam pline)))
   (setq sumlen (+ sumlen leng)))
   (vlax-put-property xlCells "Item" row 1 layer)
   (vlax-put-property xlCells "Item" row 2 (rtos sumlen 2 3))
   (setq total (+ total sumlen))
;;;    (vlax-put-property xlCells "Item" row 2 (rtos sumlen 2 3)); for metric units
   (setq layer_list (cdr layer_list))
   (setq row (+ row 1))
 ) 
 (setq row (+ row 1))
; footers:
(vlax-put-property xlCells "Item" row 1 "Total:")
(vlax-put-property xlCells "Item" row 2 (rtos total 2 3))
;;;(vlax-put-property xlCells "Item" row 2 (rtos total 2 3)); for metric units  

(mapcar (function (lambda(x)
           (vl-catch-all-apply
             (function (lambda()
                 (progn
                   (vlax-release-object x)
                   (setq x nil)))))))
(list xlCells xlSheet xlSheets xlBook xlBooks xlApp)
)
(alert "Close Excel file manually")
(gc)(gc)
(princ)
 )
(princ "\t\t***\t  Type PLE to write polines length to Excel\t***")
(princ)

Link to comment
Share on other sites

The attached asks you for a layer name and returns total length of all lines and arcs on that layer. I use it for roadway striping take-offs regularly.

No Polylines for this routine though.

Layadd.lsp

Link to comment
Share on other sites

Make sure if your using a lisp that it is searching for all objects on a layer as Arizona hinted if it only searches for plines. You need a program that searches for arcs lines polylines lwplines 3dplines and adds all of them up. I am sure someone here has one will check one I have in VBA.

 

One problem though with auto take offs you must be 100% confident that the drawing is correct we find the problem a lot where we have offset lines hence answer x 2.

Link to comment
Share on other sites

Dear BIGAL.....

Any how I could load ALEN'S routine well...now i know how to work with his routine....Now i want to know how to write these routines....can you help me please

Many thanks to all friends here helping me at all

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