MikeP Posted September 5, 2008 Share 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 Link to comment Share on other sites More sharing options...
neekcotrack Posted September 5, 2008 Share 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 Link to comment Share on other sites More sharing options...
jammie Posted September 6, 2008 Share 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 Link to comment Share on other sites More sharing options...
Lee Mac Posted September 7, 2008 Share 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 Link to comment Share on other sites More sharing options...
David Bethel Posted September 7, 2008 Share 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 Link to comment Share on other sites More sharing options...
MikeP Posted September 9, 2008 Author Share 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 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.