Hi there,
Can someone help me? I put texts in the listValues inbetween two quotation marks, however the script does not work when I use space or put only number.
Works:
listValues = “Solid”, “5mm” , “10mm”, “100mm”
It doesn’t work with space as “Solid geometry”
listValues = “Solid geometry”, “5mm” , “10mm”, “100mm”
It doesn’t work with number as “100” instead of “100mm”
listValues = “Solid geometry”, “5mm” , “10mm”, “100”
import Rhino
import rhinoscriptsyntax as rs
def options():
gs = Rhino.Input.Custom.GetString()
prompt = gs.SetCommandPrompt("Specify profile? [Press ENTER]")
listValues = "Solid geometry", "5mm" , "10mm", "100mm"
listIndex = 0
thickness = listValues[listIndex]
opList = gs.AddOptionList("List", listValues, listIndex)
while True:
get_rc = gs.Get()
if get_rc==Rhino.Input.GetResult.Point: # Alapertekkel (Default)
print "Command line option values are"
print " List =", listValues[listIndex]
elif get_rc == Rhino.Input.GetResult.Option: # Ha belepunk a listaba
if gs.OptionIndex()==opList:
listIndex = gs.Option().CurrentListOptionIndex
thickness = listValues[listIndex]
continue
elif gs.StringResult():
thickness = gs.StringResult()
break
if __name__ == "__main__":
options()
2 posts - 2 participants
Read full topic