See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: Total polyline length

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member
    Join Date
    2003-08
    Posts
    31
    Login to Give a bone
    0

    Default Total polyline length

    I need to add up the total length of all of the contours in an area. The contours are LDD contour objects. Does anyone know of a routine that will add the lengths of selected contours or polylines?

  2. #2
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Total polyline length

    Hi

    Below routine is from an old LISP Guild post by Stig Madsen -

    Code:
    (defun C:PLINELEN (/ ent sset obj len sum layer a)
      (setvar "ERRNO" 0)
      (while
    	(and (not (setq ent (car (entsel "Select object on layer: "))))
      (/= (getvar "ERRNO") 52)
    	)
      )
      (cond ((and ent
    	   (setq sset
    	   (ssget
    		 "X"
    		 (list '(0 . "LWPOLYLINE")
    		(cons 8 (setq layer (cdr (assoc 8 (entget ent)))))
    		 )
    	   )
    	   )
      )
      (setq a 0
    		sum 0
      )
      (repeat (sslength sset)
    	(setq obj (vlax-ename->vla-object (ssname sset a))
       len (vlax-curve-getDistAtParam
    		 obj
    		 (- (vlax-curve-getEndParam obj)
    	 (vlax-curve-getStartParam obj)
    		 )
    	   )
       sum (+ sum len)
    	)
    	(setq a (1+ a))
      )
      (princ (strcat "\nTotal length of "
       (itoa a)
       (if (= a 1)
    	 " pline on layer "
    	 " plines on layer "
       )
       layer
       ": "
       (rtos sum)
      )
      )
     )
     (T (princ "\nNo plines found"))
      )
      (princ)
    )

    OR

    Check out something like the following -

    [size=2]]CADalyst Get the Code August 1999 - Pline Lengths

    Have a good one, Mike
    Last edited by Mike.Perry; 2004-11-04 at 11:45 AM. Reason: Correct formatting.

  3. #3
    AUGI Addict
    Join Date
    2015-12
    Location
    Arizona
    Posts
    2,399
    Login to Give a bone
    0

    Default Re: Total polyline length

    You say LDD contour obects, if I take this to suggest
    that you have Land, and MAP at your disposal
    just use a MAP query of those objects, and set it to
    write a report of all the objects lengths in a comma delimited file
    and add them in Excel.
    Last edited by mjfarrell; 2004-09-17 at 06:02 PM.

  4. #4
    Member
    Join Date
    2002-05
    Posts
    39
    Login to Give a bone
    0

    Default Re: Total polyline length

    I copied the text to a text file, saved with a .lsp extension and used APPLOAD to load the application, however, I keep getting "Unknown command" ? when I type the new command name on the command line?.

    Using AutoCAD 2004
    Any ideas?

  5. #5
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Total polyline length

    Hi

    Worked for me (just tested a few moments ago).

    * Copy & Paste Code into an ASCII text file (eg NotePad)

    * SaveAs PlineLen.lsp

    * Load into AutoCAD

    * At AutoCAD Command Line type PlineLen

    Have a good one, Mike

  6. #6
    AUGI Addict sinc's Avatar
    Join Date
    2004-02
    Location
    Colorado
    Posts
    1,986
    Login to Give a bone
    0

    Default Re: Total polyline length

    Quote Originally Posted by jbenway
    I need to add up the total length of all of the contours in an area. The contours are LDD contour objects. Does anyone know of a routine that will add the lengths of selected contours or polylines?
    Just out of curiosity, why do you want to do that?

  7. #7
    Woo! Hoo! my 1st post
    Join Date
    2004-07
    Posts
    1
    Login to Give a bone
    1

    Wink Re: Total polyline length

    It's grt...... I was about to create a lisp on my own... but i got a flash to check any post available related to my need....and I found this exactly meets my requirement... It saved me lot of time and effort..... Thanks for the creator......

Similar Threads

  1. Replies: 9
    Last Post: 2015-05-03, 07:12 PM
  2. Total Length of Polylines
    By vijaybaskergundla in forum AutoLISP
    Replies: 7
    Last Post: 2015-04-30, 04:29 PM
  3. DIM Pline by total length?
    By cadtag in forum AutoLISP
    Replies: 1
    Last Post: 2014-08-04, 04:25 PM
  4. Polylines and Total Length
    By revit.wishlist1942 in forum Revit Architecture - Wish List
    Replies: 3
    Last Post: 2012-06-13, 08:10 PM
  5. Total Wall Length
    By jpolding in forum Revit Architecture - General
    Replies: 2
    Last Post: 2005-08-18, 03:17 PM

Posting Permissions

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