lisp routine prompts

lisp routine prompts

Anonymous
Not applicable
652 Views
25 Replies
Message 1 of 26

lisp routine prompts

Anonymous
Not applicable
i have a lisp routine for the wipe out command, it reads like this: (defun c:WI () (command "-layer" "new" "wipeout" "color" "255" "wipeout" "set" "wipeout" "")(command "rectangle" pause pause)(command "WIPEOUT" "polyline" "last" "yes")(command "draworder" "crossing" pause pause "" "f"))

what i need is to put some prompts in here, after it creates the layer, and begins the rectangle command i want it to say "specify fist corner of wipeout" then "specify second corner of wipeout", then when it starts the draw order command i want it to say "select objects to move to front"

i've never had to put in prompts before but I'd like to start, i just need one example to go off of, or at least some direction

thanks in advance for all you help/comments
kenny
0 Likes
653 Views
25 Replies
Replies (25)
Message 2 of 26

Anonymous
Not applicable
You can try
(prompt "\nSpecify first corner...")
or
(princ "\nnSpecify second corner...")
or
(print "select object to move...")
...
0 Likes
Message 3 of 26

Anonymous
Not applicable
You can try
(prompt "\nSpecify first corner...")
or
(princ "\nSpecify second corner...")
or
(print "select object to move...")
...
0 Likes
Message 4 of 26

Anonymous
Not applicable
not sure what this is supposed to do but try this i didnt test it though

(defun c:WI ()
(command "-layer" "new" "wipeout" "color" "255" "wipeout" "set" "wipeout" "")
(Setq Pt1 (Getpoint "\nPick first point"))
(Setq Pt2 (Getpoint "\nPick second point"))
(command "rectangle" PT1 PT2 PAUSE "EXIT")
(command "WIPEOUT" "polyline" "last" "yes")
(command "draworder" "crossing" pause pause "" "f")

)
0 Likes
Message 5 of 26

Anonymous
Not applicable
Your best bet would be to use the built in AutoLisp functions.
Instead of (command "rectangle" pause pause), get your points first.

(setq p1 (getpoint "\nPick first corner of rectangle: < pick > "))
(setq p2 (getcorner p1 "\nPick next corner: < pick > "))
Then:
(command "rectangle" p1 p2)

HTH

Bill
0 Likes
Message 6 of 26

Anonymous
Not applicable
the first one almost worked, displayed the text but then did not change the cursor to select the point and when i clicked a point it error out of the command
0 Likes
Message 7 of 26

Anonymous
Not applicable
this worked well except i could not see the rectangle as i was selecting points. which would be fine for me but many people will be using this so it needs to be "dummy" proof.
0 Likes
Message 8 of 26

Anonymous
Not applicable
this worked well except i could not see the rectangle as i was selecting points. which would be fine for me but many people will be using this so it needs to be "dummy" proof.
0 Likes
Message 9 of 26

Anonymous
Not applicable
Change the second getpoint to getcorner

wrote in message news:5079580@discussion.autodesk.com...
this worked well except i could not see the rectangle as i was selecting
points. which would be fine for me but many people will be using this so it
needs to be "dummy" proof.
0 Likes
Message 10 of 26

Anonymous
Not applicable
this is exactly what is written in my lisp

(defun c:WI ()
(command "-layer" "new" "wipeout" "color" "255" "wipeout" "set" "wipeout" "")
(Setq Pt1 (Getpoint "\nPick first point"))
(Setq Pt2 (getcorner "\nPick second point"))
(command "rectangle" PT1 PT2 PAUSE "EXIT")
(command "WIPEOUT" "polyline" "last" "yes")
(command "draworder" "crossing" pause pause "" "f")


when i enter wi on the command line this is what i get:

Command: wi
Layer "wipeout" already exists.
The polyline must be closed and made up of only line segments.
Unknown command "YES". Press F1 for help.

sorry for all the bother but i've never been taught lisp programming and are pretty much self taught, and this is beyond me, but i would definitely like to learn. thanks again for all your help jeff. if you could figure this out i'd owe you a big one. if you need to know what it is suppose to do let me know and i'll let you know.
0 Likes
Message 11 of 26

Anonymous
Not applicable
Try this:
(defun c:WI (/ pt1 pt2)
(command "-layer" "new" "wipeout" "color" "255" "wipeout" "set" "wipeout"
"")
(Setq Pt1 (Getpoint "\nPick first point"))
(Setq Pt2 (getcorner pt1 "\nPick second point"))
(command "rectangle" PT1 PT2)
(command "WIPEOUT" "n" "last" "yes")
(setvar "cmdecho" 1)
(command "draworder" "crossing" pause pause "" "f")
(princ)
)
You're welcome!

wrote in message news:5079613@discussion.autodesk.com...
this is exactly what is written in my lisp
0 Likes
Message 12 of 26

Anonymous
Not applicable
(defun c:WI ()
(command "-layer" "M" "wipeout" "color" "255" "wipeout" ""); Make / Set Layer
(Setq Pt1 (Getpoint "\nPick first point"))
(Setq Pt2 (getcorner Pt1 "\nPick second point"))
(setq Pt3 (list (car Pt2)(cadr Pt1) 0.0))
(setq Pt4 (list (car Pt1)(cadr Pt2) 0.0))
(command "_Pline" Pt1 Pt3 Pt2 Pt4 "_C")
(command "WIPEOUT" "n" "last" "yes")
(command "draworder" "crossing" pause pause "" "f")
); function

Bob
0 Likes
Message 13 of 26

Anonymous
Not applicable
still getting this:

The polyline must be closed and made up of only line segments.
Unknown command "YES". Press F1 for help.

i'm not a problem in your routine
0 Likes
Message 14 of 26

Anonymous
Not applicable
sorry i mistyped i'm not SEEING a problem in your routine
0 Likes
Message 15 of 26

Anonymous
Not applicable
i get this:

The polyline must be closed and made up of only line segments.
Unknown command "YES". Press F1 for help.

i can't see a problem in the routine
0 Likes
Message 16 of 26

Anonymous
Not applicable
I'm not familiar with the command options in Wipeout.
However, the "last" is definetly a Polyline, and Closed.
Try removing the "yes" or replace it with "".

Bob
0 Likes
Message 17 of 26

Anonymous
Not applicable
the "yes" tells it to erase the polyline the default is "no", kind of like the mirror command, if i just put enter it will not erase the polyline. it appears to me that for some reason it's not drawing the rectangle.
0 Likes
Message 18 of 26

Anonymous
Not applicable
What version of ACAD are you using? This works fine in r2002.

wrote in message news:5079622@discussion.autodesk.com...
still getting this:

The polyline must be closed and made up of only line segments.
Unknown command "YES". Press F1 for help.

i'm not a problem in your routine
0 Likes
Message 19 of 26

Anonymous
Not applicable
is using osnaps out of the question when specifing your points?
0 Likes
Message 20 of 26

Anonymous
Not applicable
acad 2004

it seems like it's not drawing the rectangle
0 Likes