MUTHUKUMAR1983 Posted May 17, 2023 Posted May 17, 2023 Point Problem did not mark the point for xy variable (DEFUN C:SD() (SETQ P1(GETPOINT "\n Pick Start Point :") P2(GETPOINT P1 "\n Pick End Point :") EV(GETREAL "\n Enter Distance :") XV(+(CAR P1)EV) YV(CADR P1) ZV(CADDR P1)XY(LIST XV YV ZV) ) (COMMAND "POINT" P1) ; POINT P1 (COMMAND "POINT" P2) ; POINT P2 (COMMAND "POINT" XY) ; NEW POINT FROM P1 X - AXIS VALUE FOR EV DISTANCE (PRINT XY) ) Quote
Steven P Posted May 17, 2023 Posted May 17, 2023 (edited) Do a quick test and see what the LISP is doing use this at the end: (princ "\n") ; newline (princ P1) (princ "\n") (princ P2) (princ "\n") (princ XY) Might give you a hint what isn't quite right. Noting that in the command line something like ( x y z) could be a point, something like 575 is a number, probably not a point Though on my test it did make a point Edited May 17, 2023 by Steven P Quote
Tharwat Posted May 17, 2023 Posted May 17, 2023 Commands in general expect strings specifically when referring to coordinates, so here is one way doing it. (setq XY (strcat (rtos XV) "," (rtos YV) "," (rtos ZV))) (command "POINT" xy) 1 Quote
Isaac26a Posted May 17, 2023 Posted May 17, 2023 This is working on my end, I don't know if the missing spaces when setting the variables might affect, so here is what I used and works. (defun c:sd(/ ev p1 p2 xv xy yv zv) (setq p1 (getpoint "\n Pick the start point :") p2 (getpoint p1 "\n Pick the end point :") ev (getreal "\n Enter the distance :") xv (+(car p1) ev) yv (cadr p1) zv (caddr p1) xy (list xv yv zv) ) (command "point" p1) ; point p1 (command "point" p2) ; point p2 (command "point" xy) ; new point from p1 x - axis value for ev distance (print xy) (princ) ) Quote
Steven P Posted May 17, 2023 Posted May 17, 2023 (edited) and another way: (DEFUN C:SD ( / ) (setq P1 (GETPOINT "\n Pick Start Point :") ) (setq P2 (GETPOINT P1 "\n Pick End Point :") ) (setq EV (GETREAL "\n Enter Distance :") ) (setq XY (mapcar '+ (list EV 0 0) P1)) (COMMAND "POINT" P1) ; POINT P1 (COMMAND "POINT" P2) ; POINT P2 (COMMAND "POINT" XY) ; NEW POINT FROM P1 X - AXIS VALUE FOR EV DISTANCE (PRINT XY) ) EDITED CODE SLIGHTLY Edited May 18, 2023 by Steven P 2 Quote
MUTHUKUMAR1983 Posted May 18, 2023 Author Posted May 18, 2023 6 hours ago, Steven P said: and another way: (DEFUN C:SD() (SETQ P1(GETPOINT "\n Pick Start Point :") P2(GETPOINT P1 "\n Pick End Point :") EV(GETREAL "\n Enter Distance :") (SETQ XY (mapcar '+ (list EV 0 0) P1))) ) (COMMAND "POINT" P1) ; POINT P1 (COMMAND "POINT" P2) ; POINT P2 (COMMAND "POINT" XY) ; NEW POINT FROM P1 X - AXIS VALUE FOR EV DISTANCE (PRINT XY) ) error: too few arguments in SETQ: (SETQ P1 (GETPOINT "\n Pick Start Point :") P2 (GETPOINT P1 "\n Pick End Point :") EV (GETREAL "\n Enter Distance :") (SETQ XY (MAPCAR (QUOTE +) (LIST EV 0 0) P1))) Quote
MUTHUKUMAR1983 Posted May 18, 2023 Author Posted May 18, 2023 8 hours ago, Steven P said: Do a quick test and see what the LISP is doing use this at the end: (princ "\n") ; newline (princ P1) (princ "\n") (princ P2) (princ "\n") (princ XY) Might give you a hint what isn't quite right. Noting that in the command line something like ( x y z) could be a point, something like 575 is a number, probably not a point Though on my test it did make a point (4396.89 2058.79 0.0) (4496.89 2058.79 0.0) 4421.8855,2058.7864"4421.8855,2058.7864" Quote
Steven P Posted May 18, 2023 Posted May 18, 2023 4 hours ago, MUTHUKUMAR1983 said: error: too few arguments in SETQ: (SETQ P1 (GETPOINT "\n Pick Start Point :") P2 (GETPOINT P1 "\n Pick End Point :") EV (GETREAL "\n Enter Distance :") (SETQ XY (MAPCAR (QUOTE +) (LIST EV 0 0) P1))) I've edited the code above, should be fine now Quote
Steven P Posted May 18, 2023 Posted May 18, 2023 4 hours ago, MUTHUKUMAR1983 said: (4396.89 2058.79 0.0) (4496.89 2058.79 0.0) 4421.8855,2058.7864"4421.8855,2058.7864" So the point XY looks very different to the other points.... now you can see where the error is you can work out how to fix it, to make a list and not a string (4421.8855,2058.7864 ) ? 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.