jason tay Posted April 20, 2011 Share Posted April 20, 2011 i know there is a lisp for total up the figure , is that any one could help on lisp that can do example attach. which shown the (Invert level minus invert level) divide by Length and the result getting is 1:______ Because when i had a lot of manhole , it take me lots of time to calculate one by one. thanks in advance MH Gradient.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 20, 2011 Share Posted April 20, 2011 just write a lisp the answers is say pick line = 2D length pick Il1 pick il22 pull Il's out grade = l/(il1-il2) strcat "1:" to grade and you have answer. Heres a start it will work but you need a bit more it will not recognise the "= 26.2" but will work with 26.2 Lee mac did a pull the number from a text string so do a bit of searching here I can not at the moment. (setq en1 (car (entsel "\nSelect text number1:" ))) (setq el1 (entget en1)) (setq v1 (atof (cdr (assoc 1 el1)))) (setq en2 (car (entsel "\nSelect text number2:" ))) (setq el2 (entget en2)) (setq v2 (atof (cdr (assoc 1 el2)))) (setq diff (- v1 v2)) (setq en3 (car (entsel "\nSelect line:" ))) (setq el3 (entget en3)) (setq Pt1 (cdr (assoc 10 el3))) (setq Pt2 (cdr (assoc 11 el3))) (setq dist (distance Pt1 Pt2)) (setq grade (/ dist diff)) (setq ansgrd (strcat "1:" (rtos grade 2 3))) (princ ansgrd) Quote Link to comment Share on other sites More sharing options...
jason tay Posted April 20, 2011 Author Share Posted April 20, 2011 BIGAL thanks , it's ok even it did not pull the number from the string, but how to output the result into the position we want ? thanks again Quote Link to comment Share on other sites More sharing options...
jason tay Posted April 20, 2011 Author Share Posted April 20, 2011 i try to input (princ "\n \nansgrd = ")(princ ansgrd) (setq pt(getpoint "\nInsertion Point: ")) but because i really not good in lisp then dont know how Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 20, 2011 Share Posted April 20, 2011 but how to output the result into the position we want ? Put the following at the end of the supported codes . (entmake (list (cons 0 "TEXT")(cons 10 (getpoint "\n Text Location:"))(cons 40 (getvar 'textsize))(cons 1 ansgrd))) Quote Link to comment Share on other sites More sharing options...
jason tay Posted April 20, 2011 Author Share Posted April 20, 2011 Thanks to Bigal and Tharwat, this really help me alot Quote Link to comment Share on other sites More sharing options...
jason tay Posted April 20, 2011 Author Share Posted April 20, 2011 A litter bit more , how to make the command repeat / continuous ? which i no need to reload every time:unsure: Thanks Quote Link to comment Share on other sites More sharing options...
Organic Posted April 20, 2011 Share Posted April 20, 2011 Your pipe length you have drawn there is 24.17 m, not 25 m also. I personally would just manually calculate the pipe grades as it doesn't take that long, as as you are manually doing it I assume you did not design the system (if you did, look into civil design packages as they will do this for you) and I personally wouldn't trust any drawing I got to be accurate (unless I had done it myself) enough to pull the values out using lisp. Out of interest what does the "T = E - 5" represent, I have not seen that notation before/can't work it out. Quote Link to comment Share on other sites More sharing options...
jason tay Posted April 20, 2011 Author Share Posted April 20, 2011 Dink87522, im doing as built survey, so the pipe length is based on site , by manually will be some time human error on calculating when its a lot of manhole . by the way the "T = E - 5" actually mean Type - E-5 (this is the label(indication) i follow the design drawing) Quote Link to comment Share on other sites More sharing options...
Organic Posted April 20, 2011 Share Posted April 20, 2011 Yes, but if it is an as built survey, the pipe length used in the slope calc. (assuming you are adding the as built slope, not the design slope that it should have been built at) should be the actual length (24.17) not 25 as you showed in the calculation though. Quote Link to comment Share on other sites More sharing options...
jason tay Posted April 20, 2011 Author Share Posted April 20, 2011 I wonder how to start the lisp with a command and can make it repeat? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 20, 2011 Share Posted April 20, 2011 (edited) This one would help you but it is not perfect (defun c:TesT (/ *error* acdoc ss1 ss2 l n str e) ; TharwaT 20. 04. 2011 (vl-load-com) (defun *error* (msg) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **")) ) (princ) ) (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-StartUndoMark acdoc) (if (and (setq ss1 (entsel "\n First numerical Text :")) (setq ss2 (entsel "\n Second numerical Text :")) (setq l (entsel "\n Select Line :")) ) (progn (setq n (- (atof (cdr (assoc 1 (entget (car ss1))))) (atof (cdr (assoc 1 (entget (car ss2))))) ) ) (setq str (/ (distance (cdr (assoc 10 (setq e (entget (car l))))) (cdr (assoc 11 e)) ) n ) ) (entmakex (list (cons 0 "TEXT") (cons 10 (getpoint "\n Text Location:")) (cons 40 (getvar 'textsize)) (cons 1 (strcat "1:" (rtos str 2 3))) ) ) ) (princ) ) (vla-EndUndoMark acdoc) (c:TesT) (princ) ) TharwaT Edited April 21, 2011 by Tharwat Extra name of variables Quote Link to comment Share on other sites More sharing options...
jason tay Posted April 21, 2011 Author Share Posted April 21, 2011 Dear Tharwat , thank you very much your are so is already good enough for me. Million Thanks to you ~ Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 21, 2011 Share Posted April 21, 2011 This is what I use to label as-built surveys: Command: sl Initializing... Pipe size & type: 8" PVC Specify 1st point: Specify 1st elevation: 25.25 Specify 2nd point: Specify 2nd elevation: 26 177 LF 8" PVC @ 0.42% and at the midpoint of my two picked points, it places a piece of MText, as follows: From there, I can strike a line through the proposed pipe data (another handy routine I put together) and place my as-built data above it. Quote Link to comment Share on other sites More sharing options...
jason tay Posted April 21, 2011 Author Share Posted April 21, 2011 alanjt how the code running? but the concept if combine with Tharwat lisp will be great:shock: your one is come out with percent % but in malaysia the engineer want us to shown 1:_____ Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 21, 2011 Share Posted April 21, 2011 Dear Tharwat , thank you very much your are so is already good enough for me. Million Thanks to you ~ You're welcome . Enjoy it . TharwaT Quote Link to comment Share on other sites More sharing options...
selin raj Posted October 19, 2013 Share Posted October 19, 2013 how to use this code please tell about it .......... Quote Link to comment Share on other sites More sharing options...
Organic Posted October 19, 2013 Share Posted October 19, 2013 how to use this code please tell about it .......... 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.