Create buttons from list

I’m trying to use a list to create a group of buttons, but I’m not very knowledgeable about how they work. The intent is to use one list to define the button name, and run the same list through a python script to create a rhino command. The buttons appear correctly, but both of them insert 2.3dm for some reason. Any ideas?

hui list to buttons.gh (9.3 KB)

1 Like

This appears to be a bug - what you’ve done above should work. Let me investigate!

I think I fixed it - try this:
HUI_Install.zip (1.0 MB)

That seems to work, thanks!

So I made a change to how the list is being generated and I think it may have brought up a related bug. Or there’s something wrong with my cobbled together python. I’m sure it could be done as a single py node but I don’t know how, or if it would make any real difference for HumanUI or otherwise.

The intent is to generate the list by watching a folder for .3dm files and use their filenames for the button names.

import os
for root, dirs, files in os.walk(y):
    for file in files:
        if file.endswith(".3dm"):
             print(os.path.splitext(file)[0])

    z= ' {}\{}.3dm ' .format(y, x)
    a= "!-Insert {} group enter pause enter enter" .format(z)

    print a

hui list to buttons2.gh (20.7 KB)

can you elaborate on what the bug is? I can’t reproduce this since I don’t have the same set of files + folders you do. One thing to note is you should wrap any paths in the command macro with quotes - otherwise it will likely not interpret the command correctly.

Well shoot it looks like the missing quotes was the whole problem. I guess I just needed a second person to point out the obvious for me :grinning: