Jump to content

Measuring distances


Recommended Posts

Posted

Hello there,

Today a friend asked me if there is a chance of getting distances with autocad of many different lines at the same time, then i told him that i had already found a lisp here which make it possible to measure different lines and then give me the result of the total lines together. But he wants more, he wants a improvement of the command dist, instead of just pickin the two points and then end the command with the total length, he wants to keep the command on and add a third or fourth point and while he does that he wants to know the total distance until the last point.

i hope you got my doubt, thank you very much in advanced for your help.

P.S.-He wants this because is something he used to do on microstation and now he wanted something similar using autocad ;)

Posted

Might be worth putting a post in the LISP section.

 

A way he could do it is to use distance on all lines reguired then hit F2, it's a long way round but would give all the info needed.

 

I don't know much about lisps.

 

Good luck.

Posted

Does he really need a running total? I ask because I found a LISP routine over at CAD Tips (CADalyst Magazine) that returns the total length of a group of lines. The routine was written by Travis Knapp and can be found by tip number (1442) or by searching for the routine's name (ADDLINES.LSP).

Posted

I have seen several lisps that do this with various conditions. I use one regularly - I think it's called tlen.lsp (total length). I'm sure you could search for it. I don't remember where I got it...

Posted

thanks guys,

im gonna take a look to the lisps mentioned on your link "Remark" ;)

About the lisp you said "chulse", thats the one i've been using, although you can only know the final length, and not the while you are picking points.

Posted

This one will do a "running" cumulative distance... thanks to SOE

(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)
)

Posted
I have seen several lisps that do this with various conditions. I use one regularly - I think it's called tlen.lsp (total length). I'm sure you could search for it. I don't remember where I got it...

 

This is what I was thinking... just got to locate it...

 

Ok here it is...

 

;|

TLEN.LSP - Total LENgth of selected objects

© 1998 Tee Square Graphics

|;

(defun C:TLEN (/ ss tl n ent itm obj l)

(setq ss (ssget)

tl 0

n (1- (sslength ss)))

(while (>= n 0)

(setq ent (entget (setq itm (ssname ss n)))

obj (cdr (assoc 0 ent))

l (cond

((= obj "LINE")

(distance (cdr (assoc 10 ent))(cdr (assoc 11 ent))))

((= obj "ARC")

(* (cdr (assoc 40 ent))

(if (minusp (setq l (- (cdr (assoc 51 ent))

(cdr (assoc 50 ent)))))

(+ pi pi l) l)))

((or (= obj "CIRCLE")(= obj "SPLINE")(= obj "POLYLINE")

(= obj "LWPOLYLINE")(= obj "ELLIPSE"))

(command "_.area" "_o" itm)

(getvar "perimeter"))

(T 0))

tl (+ tl l)

n (1- n)))

(alert (strcat "Total length of selected objects is " (rtos tl)))

(princ)

)

 

Rather than picking start and end points, you simply pick lines, arcs etc and it will calculate the total length of the selected objects.

Posted

I think the key words here are running total.

 

I may be wrong. It's happened before.

Posted

They were your words though ReMark... :P :wink:

 

2994 and counting...

Posted
...I may be wrong. It's happened before.

 

More likely though that it's me that's wrong!

 

EDIT- Ooops I missed this... :oops:

 

...About the lisp you said "chulse", thats the one i've been using, although you can only know the final length, and not the while you are picking points.

 

Looks like I'll be eating my words for dinner...

Posted

May I recommend a fine Chianti' with that meal Mr. Wordsmith?:lol: :P

Posted

Yep I think I need one... or even a few! :unsure: :lol:

 

Congratulations BTW for breaking the 3000 ReMark!

Posted

Thanks.

 

I'll buy the first round...for both of us.

 

I once broke 3000 on the golf course too. Guess that's why they never invited me back. I thought the purpose was to get the highest score!

Posted

3000 on the golf course :shock: That's like 30+ rounds- must have taken some doing! :wink:

 

I'll get the next 10 rounds in I think...

 

Maybe I should start a "How wrong can I be on a Friday afternoon" thread in chat... sorry for the hijack "myself", will let you get back to the point now...

Posted

Drinking and golf don't mix. It explains my score.

 

No problem with the "hijack". It's the lighter moments that make the day.

 

In the scheme of things you're way ahead of the curve on right vs. wrong. You don't have much to worry about. IMHO

Posted
...In the scheme of things you're way ahead of the curve on right vs. wrong. You don't have much to worry about. IMHO

 

:oops: Thank you ReMark- that means a lot coming from someone like your good self!

 

I have just 15 mins to go... not sure if I dare touch work any more... you have a good weekend, I hope your hangover's not too bad- I'm sure mine will be! :sick: :wacko: :bloodshot:

Posted

GE...you bring good things to life. Beer is one of them. Have a safe and happy one.

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