Perifanos Posted March 7, 2013 Share Posted March 7, 2013 Can someone help me on why this code is throwing nil? (command "_area") (while (> (getvar "cmdactive") 0) (command pause)) (setq e (getvar "_area")) e has nil value... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 7, 2013 Share Posted March 7, 2013 Try: (command "_.area") (while (> (getvar "cmdactive") 0) (command pause)) (setq e (getvar "area")) Quote Link to comment Share on other sites More sharing options...
David Bethel Posted March 7, 2013 Share Posted March 7, 2013 I don't believe that getvar honors the "_" Try : (getvar "AREA") -David Quote Link to comment Share on other sites More sharing options...
Perifanos Posted March 7, 2013 Author Share Posted March 7, 2013 (Nop Nop) Neither has worked ! Quote Link to comment Share on other sites More sharing options...
Perifanos Posted March 7, 2013 Author Share Posted March 7, 2013 (getvar "AREA") has worked. Since when area should be written in capitals ???? Quote Link to comment Share on other sites More sharing options...
Perifanos Posted March 7, 2013 Author Share Posted March 7, 2013 ok, now why this is giving a "bad function"? (if (= fuel "a") ((setq kw (getreal)) (setq p (* 6 kw)) (setq a (* 0.25 k))) ((setq p (* 0.5 e)) (setq a (* 0.25 k))) ) Quote Link to comment Share on other sites More sharing options...
GP_ Posted March 7, 2013 Share Posted March 7, 2013 Neither has worked ! You have certainly done something wrong. ok, now why this is giving a "bad function"? (if (= fuel "a") (progn (setq kw (getreal)) (setq p (* 6 kw)) (setq a (* 0.25 k)) ) (progn (setq p (* 0.5 e)) (setq a (* 0.25 k)) ) ) Quote Link to comment Share on other sites More sharing options...
hmsilva Posted March 7, 2013 Share Posted March 7, 2013 (if (= fuel "a") (setq kw (getreal "\nHow many Km?") p (* 6 kw) a (* 0.25 k) );; setq (setq kw (getreal "\nHow many Km?") p (* 0.5 e) a (* 0.25 k) );; setq );; if ;;or (if (= fuel "a") (progn (setq kw (getreal "\nHow many Km?")) (setq p (* 6 kw)) (setq a (* 0.25 k)) );; progn (progn (setq kw (getreal "\nHow many Km?")) (setq p (* 0.5 e)) (setq a (* 0.25 k)) );; progn );; if Quote Link to comment Share on other sites More sharing options...
neophoible Posted March 7, 2013 Share Posted March 7, 2013 ok, now why this is giving a "bad function"? (if (= fuel "a") ((setq kw (getreal)) (setq p (* 6 kw)) (setq a (* 0.25 k))) ((setq p (* 0.5 e)) (setq a (* 0.25 k))) ) Use progn (if (= fuel "a") (progn (setq kw (getreal)) (setq p (* 6 kw)) (setq a (* 0.25 k)) ) (progn (setq p (* 0.5 e)) (setq a (* 0.25 k)) ) ) Or combine the grouped setqs (if (= fuel "a") (setq kw (getreal) p (* 6 kw) a (* 0.25 k) ) (setq p (* 0.5 e) a (* 0.25 k) ) ) 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.