How to make Rhino command line recognize spaces?


#1

So I understand a space between characters in script is equivalent to pressing Enter key in command line. But how do I get command line to recognize spaces in strings? For example,

f = "\0 White Reflective"
Call Rhino.Command("-visApplyMaterial " + f)

The ‘f’ string above is read as “\0” because of the space.


(Dale Fugier) #2

Strings with spaces should be surrounded by double-quote characters.


(Dale Fugier) #3

Functions can very useful. For example:

Function Quote(ByVal s)
  Quote = Null
  If (VarType(s) = vbString) Then
    Quote = Chr(34) & CStr(s) & Chr(34)
  End If
End Function
 
Dim s
s = Quote("Hello Rhino!")
Call Rhino.Print(s)

#4

Hi Dale, this is funny… a function to put a string in quotes but in order to send the string to the function you have to put it in quotes…
What is the stuff you guys are smoking? I want that too! :wink:

gr, Tobias


#5

I noticed that this doesn’t work for setting the view to a named view. The commands go as follow:

SetView
World
"View 1"

The last “View 1” command does not get recognized. To emulate, try creating a named view with a space, and it will fail.


(Dale Fugier) #6

Hi @Jed,

The SetView command does not restore named views. For this, use the NamedView command.

_-NamedView _Restore "View 1" _Enter

– Dale