Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wish: Switch/Case node #290

Closed
andydandy74 opened this issue Jul 15, 2013 · 3 comments
Closed

Wish: Switch/Case node #290

andydandy74 opened this issue Jul 15, 2013 · 3 comments

Comments

@andydandy74
Copy link
Contributor

Instead of nesting several IF nodes, it would be great to have an expandable switch/case node that could accomodate a arbitrary number of cases. The interface might work like the List node where we can add and remove items by clicking on +/-.

@ghost ghost assigned Steell Jul 16, 2013
@Steell
Copy link
Contributor

Steell commented Jul 18, 2013

We will need to put some thought into how the UX for a switch/case node would work. Ideally, it would work something like Scheme's cond expression documented here. To add more cases to the cond, we would use the +/- buttons as seen in other expandable nodes, but it would have to add/remove two inputs at a time, since we need a test and a result for each case.

@andydandy74
Copy link
Contributor Author

Maybe this could actually be done by using two nodes: a switch node (with an expandable number of case inputs and a result output) and a case node (with a test and result input and a case output)? Plus, I think there would have to be a default result or else input in the switch node that catches everything that's not defined in the individual cases.

@andydandy74
Copy link
Contributor Author

In the meantime, I have built a custom node which I've just uploaded to the package manager. I still think this would make sense as a built-in node (and would probably be faster, too), so I'd like to keep this issue open. For the custom node I'm just passing two separate lists for the cases and their respective values:
switchcase

yeexinc pushed a commit to yeexinc/Dynamo that referenced this issue Feb 9, 2017
Updated LibraryUtilities.ts and LayoutSpecs.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants