Jump to content

Trouble getting user input within a command


Archiman86

Recommended Posts

What would be a better way of doing this. This does not seem to work. I am trying to pause in order to have the user input the scale for the hatching, because it will be different dpending on the scale of the drawing. Obviously "cloud" is a variable assigned to a previously created object. Any help is appreciated.

 

Thanks in advance.

 

(command "-bhatch" "a" "a" "y" "" "p" "ansi31" (princ "\nWhat scale: ") pause "0" "s" cloud "" "")

 

:Edit - It works fine without the princ command (just the pause), but then other users wont know what to input. I am trying to find a way to easily prompt the user for the scale.

Link to comment
Share on other sites

Here's two options:

 

(princ "\nWhat scale: ")
(command "-bhatch" "a" "a" "y" "" "p" "ansi31" pause "0" "s" cloud "" "")

OR

(if (setq scale (getreal "\nWhat scale: "))
 (command "-bhatch" "a" "a" "y" "" "p" "ansi31" scale "0" "s" cloud "" ""))

Link to comment
Share on other sites

Your problem, I think, is that the (princ) function is returning a value, whatever the value happens to be. That value is fed to the command line as input, which isn't recognized as valid.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...