Here I have many curves stacked in z-direction with equal distance (0.1 mm).
I need to handle these curves one by one. Surely I can select one curve, then hide others, handle it; then show all curves, select next curve, …
I wonder if I can use python script to realize hide/show objects automatically.
That means, I set a z-locations (say 0.2), then the scrpit will select the curve in 0.2, and hide all other curves and I can handle the curve. Then I set next z-location (0.3), the script can show all curves and select curve in 0.3, and hide all other curves…
Attached are the curves.
I tried luchbox’s ‘send command toggle’ to send Rhino commands in Rhion from grasshopper.
It seems to work, but after it runs, the grasshopper is not the active window, and rhion will be the active window.
The curves are sorted along Z, you select the index of the curve using the slider. This curve is moved in a layer called “Visible” which I’ve set in Rhino to be visible. All other curves are send to a layer “Invisible” which… you got it.
Hi @magicteddy, first, Happy Thanksgiving!
While I am using your fantastic code, I have one more need: create new curves in new layers.
For example, I have four layers at z=0, 1, 2, 3 and each layer has a curve. With your code, the show/hide function works well for the four curves.
Then I move the working plane to z=4 (new layer), and want to create a new curve, then your code will show the first layer curve, because the input index 4 is beyond the original list length.
Could you please help me resovle the issue?
Your efforts are so appreciated!
And @magicteddy, I found if there are two or more curves in one layer, the code with show the curves alternatively. I think it’s also because the index issue.
Thank you!
I’m not sure what you mean by “layer”, did you add extra Layers in Rhino ? Or do you mean layer as a floor level ?
If you draw new curves in either the “Visible” or “Invisible” (well, you can’t draw in Invisible withotu turning it wisible, so go for the first option !), they should be added automatically to the GH file. Setting the slider to 4 in your case should show the new curve.
I’ve changed the GH to show each curve that has a specific Z coordinate, however it will only work for now with integer coordinates. Let me know if you need decimal coordinates and I’ll figure something out.
Thank you so much, @magicteddy!!
Your code is doing an amazing work! I love it.
For me integer coordinates are enough for the time being.
Thank you again for your prompt help even in holiday! (I exptect to have the solution next week :))
Have a nice weekend!