×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Measuring Distance
2

Measuring Distance

Measuring Distance

(OP)
I am running CAD 2005 and have a need to measure distance / length of portions of a line segment.  I can use Tools Inquiry Distance but can't measure more than between two points.  Is there another technique to measure along more points?

RE: Measuring Distance

If it's a polyline, the LIST command will print everything you might want to know about it.

Mike Halloran
Pembroke Pines, FL, USA

RE: Measuring Distance

Try this routine- it will cumulatate distances

CODE

(defun c:cd ()
 (setvar "cmdecho" 0)
 (graphscr)
 (setq
  p1 (getpoint "\nPick start point ")
  p2 (getpoint p1 "\nPick next point ")
  d1 (distance p1 p2)
  prdist (strcat "\nDistance: " (rtos d1))
 )
 (princ prdist)
 (setq p3 (getpoint p2 "\nPick next point or RETURN if done "))
 (while p3
  (setq
   d0 (distance p2 p3)
   d1 (+ (distance p2 p3) d1)
   p2 p3
   prdist (strcat "\nDistance: " (rtos d0) ", Cumulative distance: " (rtos d1))
  )
  (princ prdist)
  (setq p3 (getpoint p2 "\nPick Next Point "))
 )
 (setq cumd (strcat "Cumulative distance --> " (rtos d1)))
 (prompt cumd)
 (princ)
)

Thanks to an unknown author

____________________
Acad2005, Terramodel

RE: Measuring Distance

If it is a line segment, just click on it with the Properties display opened.  It will give the length, but you can't copy it.  As MikeHalloran said about the pline, LIST will also give a copy-able .txt display with length, like this:
Command: list 1 found

                  LINE      Layer: "0"
                            Space: Model space
                   Handle = 8b
              from point, X=  35.5496  Y=  17.8966  Z=   0.0000
                to point, X=  15.9339  Y=  19.0093  Z=   0.0000
          Length =  19.6472,  Angle in XY Plane =    177
                  Delta X = -19.6157, Delta Y =    1.1127, Delta Z =   0.0000

Remember, amateurs designed and built the ark...professionals designed and built the Titanic. - Steve

RE: Measuring Distance

lpseifert,

nice tool...thumbsup2

Lothar

ADT 2004
ACAD 2002

RE: Measuring Distance

Here's one that totals multiple line lengths all selected at once.  The author is unknown but is not me.  I have used this and modified it many times to solve various problems over the years.

(DEFUN c:GEL ( / attr elength ss dst cnt) ; Adds the lengths of selected lines, arcs, circles, polylines, or splines
  (setq dst 0 cnt 0)(setvar "cmdecho" 0)
  (princ "= Get length...  Adds the lengths of selected lines, arcs, circles, polylines, or splines ")
  ;
(DEFUN attr (ent indx)(cdr (assoc indx ent)))
  ;
(DEFUN elength (ent / sa ea)
    (cond
      ((= (attr ent 0) "LINE")(distance (attr ent 10)(attr ent 11)))
      ((= (attr ent 0) "ARC")(setq sa (attr ent 50) ea (attr ent 51))
        (* (if (> ea sa)(- ea sa)(+ (- ea sa)(* 2 pi)))(attr ent 40)))
      ((= (attr ent 0) "CIRCLE")(* 2 pi (attr ent 40)))
      ((= (attr ent 0) "POLYLINE")(command "area" "e" (attr ent
-1))(getvar "perimeter"))
      ((= (attr ent 0) "SPLINE")(command "area" "e" (attr ent
-1))(getvar "perimeter"))
    )
  )
  (if (setq ss (ssget '((-4 . "<or")(0 . "LINE")(0 . "ARC")(0 .
"CIRCLE")
                                    (0 . "POLYLINE")(0 . "SPLINE")(-4 .
"or>"))))
    (progn
      (repeat (sslength ss)
        (setq dst (+ dst (elength (entget (ssname ss cnt)))) cnt (+ cnt
1))
      )
      (princ (strcat "\n The length of the entity or entities selected
is "(rtos dst 2 8)"  "))
    )
    (princ "\n Input error... ")
  )
  (princ)
)

RE: Measuring Distance

(OP)
I am new to LISP routines.  I was able to get the post by lpseifert to work but not the one by IFRs?  Any ideas why that could be?

RE: Measuring Distance

Perhaps you could describe the fashion in which IFR's code fails to function for you.

Does it produce incorrect results?
Does it fail to run at all with no feedback?
Does it give an error of some sort?
How are you executing it?

You get the idea...

--------------------
How much do YOU owe?
http://www.brillig.com/debt_clock/
--------------------

RE: Measuring Distance

I dont know why the fuss about LISP because ACAD can do the job quicker.  Turn all line segments into a polyline  by doing a PEDIT and then do a LI command and check out the results in the history box.

RE: Measuring Distance

I agree with Chicopee, but why bother converting to Plines?  List works on any object, including Lines.

Women and cats will do as they please; men and dogs should just learn to live with that - Steve

RE: Measuring Distance

Actually, it looks like my post was off subject.  corvette63 needed to find the lengths of line segments that make up a line.  If this is a polyline then all he will get is the total length.  My apologies.  My routine totals the lengths of lines, arcs, circles, polylines and splines.

RE: Measuring Distance

(OP)
Thank you for all of the input.  Corvette63.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Engineering Report - Top 10 Defect Types in Production
This 22-page report from Instrumental identifies the most common production defect types discovered in 2020, showcases trends from 2019 to 2020, and provides insights on how to prevent potential downtime in 2021. Unlike other methods, Instrumental drives correlations between a variety of data sources to help engineers find and fix root causes. Download Now
White Paper - Addressing Tooling and Casting Requirements at the Design Stage
Several of the tooling and casting requirements of a part can be addressed at the design stage. If these requirements are not addressed at the design stage, lot of time is spent in design iteration when the design reaches the die caster. These design issues lead to increase in time and cost of production leading to delay in time to market and reduced profits for the organization. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close