bharthts01 Posted August 17, 2012 Posted August 17, 2012 Hi Guys, I'm fairly new to this 'lisp' program. I'm a trainee setting out engineer and have a question. How do I display both eastings and northings coordinates on one line? My senior engineer has it on his Auto CAD but got it done from somebody else and he doesn't know how to do it. See Image - Shows coordinates X and Y This is how it should be - Please note I typed them coordinates in myself Any help would be greatly appreciated Taj. Quote
MSasu Posted August 17, 2012 Posted August 17, 2012 I believe you should provide more details on your issue. Are you looking to modify an existing routine? Then you should post at least an excerpt from it – the part that manages those coordinates insertion. Basically, those coordinates should be strings, so the function you were looking for is STRCAT. Quote
bharthts01 Posted August 17, 2012 Author Posted August 17, 2012 I believe you should provide more details on your issue. Are you looking to modify an existing routine? Then you should post at least an excerpt from it – the part that manages those coordinates insertion.Basically, those coordinates should be strings, so the function you were looking for is STRCAT. This is how I get coordinates, dimensions > ordinates. This displays the eastings and northings of the point. This looks very messy to me, all I want to know is how do I make it so instead of it displaying it like above, which looks very messy and can get quite confusing. Does that make sense? Sorry, not very good on CAD Quote
Tiger Posted August 17, 2012 Posted August 17, 2012 To display coordinates like that you are most likely using a Lisp of some sort, a Lisp is a custom-made command that someone have created for you sometime in the past. If the peeps here don't get to look at the routine behind the command, there is not much they can help you with - besides writing a brand new routine which is unneccesary since you have one that works almost as you want. Quote
bharthts01 Posted August 17, 2012 Author Posted August 17, 2012 To display coordinates like that you are most likely using a Lisp of some sort, a Lisp is a custom-made command that someone have created for you sometime in the past. If the peeps here don't get to look at the routine behind the command, there is not much they can help you with - besides writing a brand new routine which is unneccesary since you have one that works almost as you want. I think I should reword the thread, I know in order for me to view coordinates in the second image I have to use a lisp program. The question is, how do I do this? I see where I'm creating confusion though. Quote
Tiger Posted August 17, 2012 Posted August 17, 2012 Somewhere in the Lisp-routine there is code that determines how the text is displayed - if you can post the actual lisp routine then it is very likely that you can get help in changing the code. Quote
bharthts01 Posted August 17, 2012 Author Posted August 17, 2012 (defun c:ne ()(setvar "osmode" 1) (setq ne1 (getpoint"\nPick point...")) (setvar "osmode" 0) (if (/= ne1 nil)(go_ne)(princ"\nInvalid Location !")) (princ) ) (setq tx-ht 0.5) (defun go_ne ()(setvar "luprec" 2) (setq prmt (strcat "Enter TEXT HEIGHT<"(rtos tx-ht)">: ")) (princ prmt) (setq x-ht (getreal))(if (= x-ht nil)(setq x-ht tx-ht)) (setq tx-ht x-ht) (setq e-x (car ne1))(setq xx (rtos e-x)) (setq n-y (cadr ne1))(setq yy (rtos n-y)) (tx-f) ) (defun tx-f () (setq vx (strcat " E " xx)) (setq vy (strcat " N " yy)) (command "text" "j" "ml" ne1 x-ht "0" vy) (command "text" "j" "ml" ne1 x-ht "90" vx) ) This is what I've been told would work. Quote
bharthts01 Posted August 17, 2012 Author Posted August 17, 2012 Also how do I implement this? Make it actually work? I've saved the program but when it comes to opening the program it never works. I type in (load "myprog") and it comes up with "error load failed". Quote
Tiger Posted August 17, 2012 Posted August 17, 2012 I can't help you with the re-write of the program, but I can give you a handy link on How To Use A Lisp-Routine. Quote
MSasu Posted August 17, 2012 Posted August 17, 2012 This is because AutoCAD isn't able to locate that file - you should either add container folder in Options --> Files --> Support Files Search Path list or input the loading path (please note the double back-slashes): (load "[color=red]C:\\MyLispTool\\[/color]myprog") Quote
stevesfr Posted August 17, 2012 Posted August 17, 2012 @bharthts01 possibly this lisp will do the job for you ;LBLCOORD - plain label point w/coords (defun c:LBLCOORD () (setvar "CMDECHO" 0) (setq pt 1) (while (/= pt nil) (setq pt (getpoint "\n PICK POINT TO LABEL ")) (if (/= pt nil) (progn (setq n (strcat "N " (rtos (cadr pt)))) (setq e (strcat "E " (rtos (car pt)))) (setq tp (getpoint "\n PICK POINT FOR COORDINATES ")) (command "TEXT" tp "0" n) (command "TEXT" "" e) ) ) ) ) (princ) Cheers and good luck, be sure to read post #9 Quote
MSasu Posted August 17, 2012 Posted August 17, 2012 @bharthts01: I did some changes to your code to print both labels on the same line (the order is the one you stated in the first post). (defun c:ne ()(setvar "osmode" 1) (setq ne1 (getpoint"\nPick point...")) (setvar "osmode" 0) (if (/= ne1 nil)(go_ne)(princ"\nInvalid Location !")) (princ) ) (setq tx-ht 0.5) (defun go_ne ()(setvar "luprec" 2) (setq prmt (strcat "Enter TEXT HEIGHT<"(rtos tx-ht)">: ")) (princ prmt) (setq x-ht (getreal))(if (= x-ht nil)(setq x-ht tx-ht)) (setq tx-ht x-ht) (setq e-x (car ne1))(setq xx (rtos e-x)) (setq n-y (cadr ne1))(setq yy (rtos n-y)) (tx-f) ) (defun tx-f () (setq vx (strcat " E " xx)) (setq vy (strcat " N " yy)) [color=red](command "_.TEXT" "_J" "_ML" "_non" ne1 x-ht 0.0 (strcat vx " / " vy))[/color] ) Quote
bharthts01 Posted August 17, 2012 Author Posted August 17, 2012 Thanks guy, one last question... I've loaded the lisp into cad, how do I use it now? Quote
MSasu Posted August 17, 2012 Posted August 17, 2012 Your code define a new command named NE that you may call at prompter like built-in commands. Quote
bharthts01 Posted August 17, 2012 Author Posted August 17, 2012 It works fine now, just a few minor adjustments I need to it now. First one, I need an arrow showing where it points to. Second one, I want it where it shows 9 digits e.g. (in the picture above) 430315507 & 434191791 Edit - is it normal for your object snap to turn on and off when using this lisp? Quote
MSasu Posted August 17, 2012 Posted August 17, 2012 For OSNAP, try this version of the code: (defun c:ne( / oldOsmode e-x n-y ne1 prmt tx-ht vx vy x-ht xx yy ) (defun go_ne() (setvar "luprec" 2) (setq prmt (strcat "Enter TEXT HEIGHT<" (rtos tx-ht) ">: ")) (princ prmt) (setq x-ht (getreal)) (if (= x-ht nil) (setq x-ht tx-ht) ) (setq tx-ht x-ht) (setq e-x (car ne1)) (setq xx (rtos e-x)) (setq n-y (cadr ne1)) (setq yy (rtos n-y)) (tx-f) ) (defun tx-f() (setq vx (strcat " E " xx)) (setq vy (strcat " N " yy)) (command "_.TEXT" "_J" "_ML" ne1 x-ht 0.0 (strcat vx " / " vy)) ) (setq tx-ht 0.5) (setq oldOsmode (getvar "OSMODE")) (setvar "osmode" 1) (setq ne1 (getpoint "\nPick point...")) (setvar "osmode" 0) (if (/= ne1 nil) (go_ne) (princ "\nInvalid Location !") ) (setvar "OSMODE" oldOsmode) (princ) ) For sure, your code require more adjustements. Quote
bharthts01 Posted August 17, 2012 Author Posted August 17, 2012 Possible to get code with these settings in object snap mode? Thanks Also, would be great if I could have the 'arrow' pointing at the point which the coordinate is set to. Quote
MSasu Posted August 17, 2012 Posted August 17, 2012 Change this line (setvar "osmode" 1) to (setvar "osmode" [color=red]427[/color]) Quote
bharthts01 Posted August 17, 2012 Author Posted August 17, 2012 Nearly there, Also keep it at 9 digits if possible, (get rid of the last 2 after the decimal places) Quote
MSasu Posted August 17, 2012 Posted August 17, 2012 To get the numbers without decimals adjust those lines: [color=red];[/color](setvar "luprec" 2) ... (setq xx (rtos e-x [color=red]2 0[/color])) ... (setq yy (rtos n-y [color=red]2 0[/color])) Quote
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.