tamohr Posted July 22, 2009 Share Posted July 22, 2009 Hello, I need a LISP routine that will allow me to draw a line with a “Z” coordinate. I would like to click on a spot in current x,y plain and then be prompted to enter a “Z” or ELEVATION for the start of the line and then click on the end of the line and be prompted again to enter the “Z” coordinate. The end of this line will be the beginning of the next line and then continue picking and entering “Z” coordinates to form a series of 3D lines each having the same “Z” coordinate at their intersections. Any help would be greatly appreciated, thank you! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 22, 2009 Share Posted July 22, 2009 Just a quick one: (defun c:lz (/ pt1 z1 pt2 z2) (while (and (setq pt1 (getpoint "\nSpecify First Point: ")) (or (setq z1 (getdist "\nSpecify Z <0.0>: ")) (setq z1 0.0)) (setq pt2 (getpoint pt1 "\nSpecify Next Point: ")) (or (setq z2 (getdist "\nSpecify Z <0.0>: ")) (setq z2 0.0))) (command "_.line" "_non" (list (car pt1) (cadr pt1) z1) "_non" (list (car pt2) (cadr pt2) z2) "")) (princ)) Quote Link to comment Share on other sites More sharing options...
David Bethel Posted July 23, 2009 Share Posted July 23, 2009 Why not just use the point filter .xy ? -David Quote Link to comment Share on other sites More sharing options...
tamohr Posted July 27, 2009 Author Share Posted July 27, 2009 Thank you David and Lee, both of these methods are much better than what I was doing. Lee, can the .lsp be modified to continue the line, making a 3d multi line using the endpoint coordinates of the previous line to start the next line? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 27, 2009 Share Posted July 27, 2009 Perhaps: (defun c:lz (/ pt1 z1 pt2 z2 pt3 z3) (if (and (setq pt1 (getpoint "\nSpecify First Point: ")) (or (setq z1 (getdist "\nSpecify Z <0.0>: ")) (setq z1 0.0)) (setq pt2 (getpoint (if pt2 pt2 pt1) "\nSpecify Next Point: ")) (or (setq z2 (getdist "\nSpecify Z <0.0>: ")) (setq z2 0.0))) (progn (command "_.line" "_non" (list (car pt1) (cadr pt1) z1) "_non" (list (car pt2) (cadr pt2) z2) "") (while (and (setq pt3 (getpoint pt2 "\nSpecify Next Point: ")) (or (setq z3 (getdist "\nSpecify Z <0.0>: ")) (setq z3 0.0))) (command "_.line" "_non" (list (car pt2) (cadr pt2) z2) (list (car pt3) (cadr pt3) z3) "") (setq z2 z3 pt2 pt3)))) (princ)) Quote Link to comment Share on other sites More sharing options...
tamohr Posted August 3, 2009 Author Share Posted August 3, 2009 Lee, Thank you! I just loaded the file and it works perfectly. If there is something I can do for you let me know. Tod Mohr Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 3, 2009 Share Posted August 3, 2009 Happy to help 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.