Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: add and total lines/pline

  1. #1
    Member
    Join Date
    2012-01
    Posts
    2
    Login to Give a bone
    0

    Smile add and total lines/pline

    does anyone know the lisp that allows you to select several lines or polylines and adds the total linear length

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: add and total lines/pline

    Welcome to AUGI!

    Here's one I wrote a while ago:

    Code:
    (defun c:LENT () (c:LengthTotal))
    (defun c:LengthTotal ( / ss)
      (princ "\rLENGTH: TOTAL ")
      (vl-load-com)
      (if (setq ss (ssget "_:L" '((0 . "ARC,LINE,*POLYLINE"))))
        ((lambda (i / o)
    	 (vlax-for x (setq ss (vla-get-activeselectionset
    					    (vla-get-activedocument
    						 (vlax-get-acad-object))))
    	   (cond ((vl-position (setq o (vla-get-objectname x)) '("AcDbLine" "AcDbPolyLine"))
    			(setq i (+ i (vla-get-length x))))
    		    ((= "AcDbArc" o)
    			(setq i (+ i (vla-get-arclength x))))))
    	  (prompt (strcat "\nTotal Length  >>  " (rtos i 2 2)))
    	 (vla-delete ss))
    	 0)
        (prompt "\n** Nothing selected ** "))
      (princ))
    Edit - This will count the total length for Arcs, Lines, and *Polylines.

    HTH
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    Member
    Join Date
    2012-01
    Posts
    2
    Login to Give a bone
    0

    Smile Re: add and total lines/pline

    Thanks! I've been out of the design for a few years but now I'm back in it. New Year = New Goals...

    Thanks for the lisp, I'll try it out.

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: add and total lines/pline

    You're welcome.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: add and total lines/pline

    @RM:

    Code:
    (vlax-curve-getDistAtParam <ename> (vlax-curve-getEndParam <ename>))
    Also, there's no reason to filter out objects on locked layers.

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: add and total lines/pline

    Quote Originally Posted by alanjt View Post
    Code:
    (vlax-curve-getDistAtParam <ename> (vlax-curve-getEndParam <ename>))
    True. *Tips hat*

    Quote Originally Posted by alanjt View Post
    Also, there's no reason to filter out objects on locked layers.
    This was done for our workflow - we'd isolate certain layers, the select.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: add and total lines/pline

    Quote Originally Posted by RenderMan View Post
    True. *Tips hat*



    This was done for our workflow - we'd isolate certain layers, the select.
    Does that mean ssget will still select objects not on a set of isolated layers when lockfade is used or are you talking about something else?

    I don't use lockfade, so I've never tested.

  8. #8
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: add and total lines/pline

    Quote Originally Posted by alanjt View Post
    Does that mean ssget will still select objects not on a set of isolated layers when lockfade is used or are you talking about something else?

    I don't use lockfade, so I've never tested.
    Correct - I use LAYLOCKFADECTL = 50, and use :L to mitigate displayed (locked) layers, regardless of fade %.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  9. #9
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: add and total lines/pline

    Quote Originally Posted by RenderMan View Post
    Correct - I use LAYLOCKFADECTL = 50, and use :L to mitigate displayed (locked) layers, regardless of fade %.
    Wild. Never thought about that but I've never been a fan of the lockfade option.

  10. #10
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: add and total lines/pline

    Quote Originally Posted by alanjt View Post
    Wild. Never thought about that but I've never been a fan of the lockfade option.
    Mostly used as a design tool when laying out project features (i.e., roadway, ponds, medians, swales, etc.), as you can still snap to entities on displayed (locked) layers, without worry of mistakenly deleting, moving, modifying them, etc.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Page 1 of 2 12 LastLast

Similar Threads

  1. Total Pline Length Tracked in Dwg with Fields?
    By dwknutson in forum AutoLISP
    Replies: 5
    Last Post: 2017-10-10, 01:48 PM
  2. DIM Pline by total length?
    By cadtag in forum AutoLISP
    Replies: 1
    Last Post: 2014-08-04, 04:25 PM
  3. Spline to Pline or Lines
    By CADdancer in forum AutoLISP
    Replies: 6
    Last Post: 2013-07-26, 12:41 PM
  4. Multiple Pline selection area total
    By aaronlogan in forum AutoCAD General
    Replies: 6
    Last Post: 2006-07-13, 06:14 PM
  5. Replies: 2
    Last Post: 2005-01-03, 02:57 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
  •