Grasshopper

algorithmic modeling for Rhino

Hi,

I have GH definitions using many parameters the user has to enter before generating Rhino objects.

In order not to forget some parameter, i add checkboxes that print messages to remind that all entries have been completed, or not:

Now, I am trying to give the user the possibility to reset the states of all those checklists. Is this possible to do this with some VB code or by others means ?

Thank in advance,

Jean-Louis

Views: 544

Attachments:

Replies to This Discussion

It's not exactly what you wanted, but may be it'll work for you. Reset button returns all states to unchecked. 

Attachments:

Thank you, it could be a solution indeed.

In practice, the GH definition may become a bit too heavy. It may take too much room in our definitions to place the two components each time (button+panel, the cluster could be placed outside)...

It's true. Here's a little bit different cluster that checks if data was entered, so you don't need to check anything and can hide it away.  

Attachments:

Yes, it works fine !

I'm wondering if it would be possible to access, via VB, directly to our GH checkboxes objects :

If I set their name to "check", I can get the GH object via this code :

    For Each obj As IGH_DocumentObject In owner.OnPingDocument().Objects
      If obj.Nickname = "check" Then
               ... add some code here to set the state ?
      End If
    Next

The next step is to know how to access specific methods/subs in order to set the state of checklist...

Got It!

   If reset Then


      Dim checkBox As Grasshopper.Kernel.Special.GH_ValueList = Nothing

      For Each obj As IGH_DocumentObject In owner.OnPingDocument().Objects
        If obj.Nickname = "Check" Then
          checkBox = TryCast(obj, Special.GH_ValueList)
          If     checkBox IsNot Nothing Then
            If checkBox.SelectedItems().Count = 1 Then
              checkBox.ToggleItem(0)
            End If
          End If
        End If
      Next

    End If

Here is the GH file.

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service