I am just starting w/ lisp and trying to make a routine to draw a line between blocks based on three points. I select the first two points, in this case, midpoints of sqaures, or quadrants of circles. The problem is, the third point I am getting by recombining the x coordinate from one of my picked points, and the y coordinate from the other picked point, and it is quoting that exact point. I need the third point to be recalculated every time I use the command relative to the two points I pick, but don't know the command(s) that will allow this.
Here is what I have so far. This was done using Lisp generator also, which might change the rules a bit:
Code:; Define the function (the program). (defun c:WIRE ( / PNT1 PNT3 PNT2 OLDCE OLDERR OLDTE) ; Save the current value of cmdecho then redefine it. (setq OLDCE (getvar "cmdecho")) (setvar "cmdecho" 1) ; Save the current value of texteval then set it to 1 (setq OLDTE (getvar "texteval")) (setvar "texteval" 1) ; Save the current value of the error handling subroutine then redefine it. (setq OLDERR *error*) (defun *error* (errmes) (princ (strcat "\nExecution of WIRE4 halted by the following error: " ERRMES)) (setvar "cmdecho" OLDCE) (setq *error* OLDERR) (prin1) ) ;(setq *error* nil) ; NOTE: to turn error handling off, erase the semicolon in the line above. ; GET a POINT from the user and store it in PNT1. (setq PNT1 (getpoint "\nSelect the starting point. ")) ; GET a POINT from the user and store it in PNT3. (setq PNT3 (getpoint "\nSelect the ending point. ")) ; OPERATION - store the result in PNT2. (setq PNT2 (LIST (CAR (QUOTE (6756.58 2948.74 0.0))) (CADR (QUOTE (7003.39 3010.24 0.0))) (CADDR (QUOTE (7003.39 3010.24 0.0))))) ; Input to AutoCAD's command line. (command "line" PNT1 PNT2 PNT3 "" ) ; Reset "cmdecho" to previous value. (setvar "cmdecho" OLDCE) ; Reset "texteval" to previous value. (setvar "texteval" OLDTE) ; Reset *error* to previous definition. (setq *error* OLDERR) ; Exit quietly (no return value.) (prin1) )
Also, I would need this to do a condition, or if then, because based on the location of the two blocks I am selecting, the x coordinate and y coodinate would need to be swapped to make the line draw correct, but I will take this one step at a time right now. Here are some screen shots.
Any help would be appreciated. I'm sure this is an easy question.