ready2goriding Posted May 5, 2010 Author Posted May 5, 2010 That helps a lot, Lee! Thanks! The move section is part of a much larger lisp that I am trying to construct as a learning exercise. For some reason I keep trying to plug in number or calculations to avoid so much user input. That doesn't work for me. The routine will eventually split a box into three sections, move one end to the new measurement, and move the center section half of that distance- I hope... Thanks again, very helpful! doug Quote
alanjt Posted May 5, 2010 Posted May 5, 2010 Its Alan's way of making testing for null user input - it works as the AND statement will stop evaluating expressions as soon as it reaches an expression that returns nil. But I don't like that construct in a whole program IMO. A very simple code using Move - obviously this code is redundant, with no advantage over the move command, but it serves as an example. (defun c:test ( / ss p1 p2 ) (if (and (setq ss (ssget "_:L")) (setq p1 (getpoint "\nSpecify Base Point: ")) (setq p2 (getpoint "\nSpecify Next Point: " p1))) (command "_.move" ss "" p1 p2)) (princ)) Just for posterity, what would be the advantage/reasoning of this over just a simple and statement? Quote
Lee Mac Posted May 5, 2010 Posted May 5, 2010 In my humble opinion I feel that the use of the IF statement is better programming practice - I would think it would be more consistent with other languages. Quote
alanjt Posted May 5, 2010 Posted May 5, 2010 In my humble opinion I feel that the use of the IF statement is better programming practice - I would think it would be more consistent with other languages. For the given situation, it just seemed superfluous. Either works with exact same results and many use both methods, I know I have/do. It boils down to a matter of opinion. Quote
ready2goriding Posted May 5, 2010 Author Posted May 5, 2010 I just wish that I knew enough to have an opinion! 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.