Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get the difference of length between two lines.

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Patchy
249 Views, 3 Replies

Get the difference of length between two lines.

I know Autocad doesn't have a command to get the total length of lines out of the box, but does it have a command to show the difference of 2 lines (or polylines) so you don't have to list the lengths and use the calculator?

3 REPLIES 3
Message 2 of 4
Kent1Cooper
in reply to: Patchy

Nothing built-in that I know of, but programmable easily enough [lightly tested]:

(defun C:LENGTHDIFF (/ len ss)
  (defun len (x)
    (vlax-curve-getDistAtParam x (vlax-curve-getEndParam x))
  ); defun
  (prompt "\nTo get the difference in length between two objects,")
  (if
    (and
      (setq ss (ssget '((0 . "*LINE,ARC,CIRCLE,ELLIPSE") (-4 . "<NOT") (0 . "@LINE") (-4 . "NOT>"))))
      (= (sslength ss) 2)
    ); and
    (prompt ; then
      (strcat
        "\nThe difference in length is "
        (rtos (abs (- (len (ssname ss 0)) (len (ssname ss 1)))))
        "."
      ); strcat
    ); prompt
    (prompt "\nMust select exactly 2 objects of finite length."); else
  ); if
  (prin1)
)

That reports the length difference using whatever your current linear-measure mode and precision are, but it could be made to always use specific settings for those.

Kent Cooper, AIA
Message 4 of 4
Patchy
in reply to: Kent1Cooper

Thank you Kent.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta