Jump to content

Recommended Posts

Posted

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

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • ready2goriding

    14

  • Lee Mac

    6

  • alanjt

    5

  • fixo

    1

Top Posters In This Topic

Posted Images

Posted
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?

Posted

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.

Posted
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.

Posted

I just wish that I knew enough to have an opinion! :(

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...