myself Posted September 12, 2008 Share Posted September 12, 2008 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 Quote Link to comment Share on other sites More sharing options...
Nellie Posted September 12, 2008 Share Posted September 12, 2008 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. Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 12, 2008 Share Posted September 12, 2008 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). Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 12, 2008 Share Posted September 12, 2008 OK, here's another option. Well, actually several options in one. Read the entire piece and select the routine that best fits what you are trying to do. http://forums.cadalyst.com/showthread.php?t=5790 Quote Link to comment Share on other sites More sharing options...
chulse Posted September 12, 2008 Share Posted September 12, 2008 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... Quote Link to comment Share on other sites More sharing options...
myself Posted September 12, 2008 Author Share Posted September 12, 2008 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. Quote Link to comment Share on other sites More sharing options...
lpseifert Posted September 12, 2008 Share Posted September 12, 2008 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) ) Quote Link to comment Share on other sites More sharing options...
GE13579 Posted September 12, 2008 Share Posted September 12, 2008 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. Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 12, 2008 Share Posted September 12, 2008 I think the key words here are running total. I may be wrong. It's happened before. Quote Link to comment Share on other sites More sharing options...
GE13579 Posted September 12, 2008 Share Posted September 12, 2008 They were your words though ReMark... :wink: 2994 and counting... Quote Link to comment Share on other sites More sharing options...
GE13579 Posted September 12, 2008 Share Posted September 12, 2008 ...I may be wrong. It's happened before. More likely though that it's me that's wrong! EDIT- Ooops I missed this... ...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... Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 12, 2008 Share Posted September 12, 2008 May I recommend a fine Chianti' with that meal Mr. Wordsmith? Quote Link to comment Share on other sites More sharing options...
GE13579 Posted September 12, 2008 Share Posted September 12, 2008 Yep I think I need one... or even a few! Congratulations BTW for breaking the 3000 ReMark! Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 12, 2008 Share Posted September 12, 2008 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! Quote Link to comment Share on other sites More sharing options...
GE13579 Posted September 12, 2008 Share Posted September 12, 2008 3000 on the golf course 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... Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 12, 2008 Share Posted September 12, 2008 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 Quote Link to comment Share on other sites More sharing options...
GE13579 Posted September 12, 2008 Share Posted September 12, 2008 ...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 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! Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 12, 2008 Share Posted September 12, 2008 GE...you bring good things to life. Beer is one of them. Have a safe and happy one. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.