MikeP Posted September 5, 2008 Posted September 5, 2008 I cannot get this portion of the code to work. it does not even pop up with an error, it acts like it ignores it, and yes i do have my variables listed (cond ((setq hide (getkword "\nHide Box? [Y/N] ? <Y>")) ) (if hide (command "-layer" "s" "Dim" "off" "Dim" "") ("") ) Quote
neekcotrack Posted September 5, 2008 Posted September 5, 2008 Try changing this: (command "-layer" "s" "Dim" "off" "Dim" "") To this: (command "_.layer" "s" "Dim" "off" "Dim" "Y") If that don't work, I would recommend submitting the reset of your lisp. Quote
jammie Posted September 6, 2008 Posted September 6, 2008 Just tweaking the code slighlty Add Initget when using getkword to establish keywords for use by the next user-input function call (initget "Y N") ;Set the key words (setq hide (getkword "\nHide Box? [Y/N] ? <Y>")) ;Get the input (if (= hide "Y") ;If the user has entered the required key "Y" (command "_.layer" "s" "Dim" "off" "Dim" "Y" "") ;Turn off the layer ) Regards, Jammie Quote
Lee Mac Posted September 7, 2008 Posted September 7, 2008 Not sure if this applies, but when using the initget function, I usually specify a bit reference after the initget function syntax. I havnt got much experience using the initget function, so please correct me if I am wrong. i.e. (initget 1 "Y N") ; 1 = no null input (setq hide (getkword "\nHide Box? [Y/N] ? <Y>")) ;Get the input (if (= hide "Y") ;If the user has entered the required key "Y" (command "_.layer" "s" "Dim" "off" "Dim" "Y" "") ;Turn off the layer ) Hope this helps Quote
David Bethel Posted September 7, 2008 Posted September 7, 2008 (initget "Yes No") (if (/= "No" (getkword "\nHide Box? [Yes/No] ? <Y>: ")) (command "_.LAYER" "s" "Dim" "_Off" "Dim" "_Y" "")) By forcing the input with the (initget) bit flag, you negate the default "Y". So a nil response does not equal "No", so the test is T and the _.LAYER call will process. I prefer the full word in an initget call. Even using the full Yes No, the nmenonics Y and N still work. A couple of gottchas here. - What if the layer DIM does not exist? - What if the layer DIM is Frozen? - If the sysvar EXPERT is set to 5, the prompt for turning off the current layer is bypassed. A robust LAYER command can be a fairly lenghty call. My $0.02 -David Quote
MikeP Posted September 9, 2008 Author Posted September 9, 2008 I get "invalid user keyword" Just tweaking the code slighlty Add Initget when using getkword to establish keywords for use by the next user-input function call (initget "Y N") ;Set the key words (setq hide (getkword "\nHide Box? [Y/N] ? <Y>")) ;Get the input (if (= hide "Y") ;If the user has entered the required key "Y" (command "_.layer" "s" "Dim" "off" "Dim" "Y" "") ;Turn off the layer ) Regards, Jammie 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.