Forgot password?

Create an account!

Forum

« back

RhinoScript – Script won't pause for user input

Messages

Please log in to write a message.

  • 9. rhymone (May 05, 2012 16.27):

    Maybe google translate is not my friend:
    dan sle script : in the script

  • 8. rhymone (May 05, 2012 16.26):

    A simple example:
    I ask a question A or B.
    if A then the user can modify objects always dan sle script, a command is being accepted?
    if we accept his return to B if it returns to A. ..

    Is that clear?

  • 7. rhymone (May 05, 2012 16.15):

    Johanes,
    Thank you very much for your help, it works correctly.
    By cons is it possible to have a function that allows the hand to the user to modify objects. then resume with the script?

  • 6. Johannes (May 05, 2012 15.49):

    Hello rhymone! your code is looking good. you have a valid boolean question and answer. now you need to think about the answere and how your program should interpret it.

    here is an example:

            Dim arrItems, arrDefaults, arrResults, blnVal

            arrItems = Array("Points", "Off", "On", _
                    "Courbes", "Off", "On")

            arrDefaults = array(False, False)
            arrResults = Rhino.GetBoolean("Accepter les geometries", arrItems, arrDefaults)
           
            If Not IsNull(arrResults) Then

                    If arrResults(0) Then
                            Call Rhino.PrintEx ("Hey! the point value = true")
                    Else
                            Call Rhino.PrintEx ("Hey! the point value = false")
                    End If
            End If

    johannes

  • 5. rhymone (May 05, 2012 14.10):

    Hello forum,
    I came across this interesting post, I would launch a dependent function of the response.
    How do I proceed:
    Dim arrItems, arrDefaults, arrResults, blnVal

    arrItems = Array("Points", "Off", "On", _
    "Courbes", "Off", "On")

    arrDefaults = array(False, False)
    arrResults = Rhino.GetBoolean("Accepter les geometries", arrItems, arrDefaults)

    Thansk for your help...

  • 4. Hanno (Sep 01, 2011 16.54):

    Hi,

    GetBoolean works like this:

    Call rhino.getboolean("Is this the text you want to view?", array("Answer", "No", "Yes"), Array(False))

    But this means the user at least has to type an "A" (or whatever you put in as a name for your yes/no option) or click on the option. That does not seem more logical for the user to me :-)

    Hanno

  • 3. ledisnomad (Sep 01, 2011 15.43):

    Hi, Hanno.

    Thanks, that helps a lot! I'll use that trick for now although I wish the Boolean would work because it seems much more logical for the user.

  • 2. Hanno (Sep 01, 2011 15.10):

    Hi,

    GetBoolean is a bit tricky, as it allows for the setting of multiple flags.
    For simple yes/no questions I often use GetString with a prompt like "Hit ENTER for yes, ESC for no". For the program then NULL means "no" and anything else means "yes", and the user must only press one key.

    Hope that helps!

    Hanno

  • 1. ledisnomad (Sep 01, 2011 15.02):

    I was writing a really quick script for somebody that cycles through the text in the model, zooms in to each text object, then asks if that's the one they want to look at... only problem is, I can't get it to pause for user input. It works if I use a string input, but not the boolean like below. Any thoughts?

    Call ZoomToText()
    Sub ZoomToText()

            Call Rhino.Command("_SelAll")
            Dim arrObj : arrObj = Rhino.SelectedObjects()
            If IsNull(arrObj) Then Exit Sub
           
            Call Rhino.Command("_SelNone")
           
            Dim strObj, done
            For Each strObj In arrObj
                   
                    If IsText(strObj) Then
                            Call Rhino.SelectObject(strObj)
                            Call Rhino.ZoomSelected()
                    End If
                   
                    done = Rhino.GetBoolean("Is this the text at which you want to look?",Array("Yes", "No"),Array(True, False))
                    If (done) Then Exit Sub
                   
            Next
           
    End Sub
Recommend

Why are these buttons gray?