# Geometry Nodes: How to use switch nodes or if statements to add different geometry

I'm trying to work on a way to use geometry nodes to make different size spirals using arcs. I found that if you have multiple arcs with smaller and smaller sizes you create a form of spiral.

What I'd like to do is have a control easily from the "modifier tab" how many arcs i have. e.g. In this example i have 2 arcs (but i will want more).

I have it so that if it is "0" then i have 1 arc (the top arc) and i can control it's sweep angle.

Ideally, i'd like to have a value in the modifier tab that says how many arcs to add.If it was 2 arcs a) keep 1st arc at 180 b) add 2nd arc c) be able to control sweep angle of 2nd arc from modifier tab

then i'd like to say "3 arcs" a) keep 1st two arcs at 180 b) at 3rd arc c) control 3rd arc sweep angle from modifier tab

etc

Any ideas on how to do that simply. i can do it sort of easily manually by having lots of separate Group Input nodes but i really feel there should be some clever maths to do it.

Thanks Richard

• but you know that there is a spiral node, right? Dec 8, 2022 at 16:13
• Yep - i had a play with that but found it quite difficult to control. In the end i'm hoping to generate something like this. docs.blender.org/manual/en/latest/modeling/geometry_nodes/… With the spiral node, it was quite hard to control the start and end vertices from which i would extrude a line Dec 8, 2022 at 17:03
• Also, now that i've thought of this method, it's really bugging me how to get blender to do it! haha Dec 8, 2022 at 17:09
• Might be helpful: blender.stackexchange.com/questions/258567/… Also, I made a "spiral maker" which satisfies most of your criteria, but I'm feeling too lazy to write an answer describing it. If you wanna look around and dissect, here: blend-exchange.com/b/MmgExg3q In JPEG form: i.imgur.com/AO53Xl4.png Dec 8, 2022 at 20:38
• @Kuboå You my friend are a genius. 2 things i love - a) how you've set it out so nicely so it is easy to follow and b) how i completely underestimated how complex the node tree would have to turn out! Thanks so much for sharing it. Can i ask how long it took you to work it out? Was it lots of trial and error etc? Dec 10, 2022 at 7:52

Here's a setup that satisfies your criteria of sequentially growing arcs stitched together at their ends:

You want a flexible amount of copies of the arcs, so you can't really use the Switch node since that's a static either this or that node. Instead:

• create an arc,
• make a bunch of copies with Duplicate ElementsInstances,
• scale them up sequentially using an Accumulate Attribute,
• flip every other arc downwards by selecting them with Index > Math—Modulo: 2 and scaling them $$-1$$ on the Y axis.

I also delete the first duplicated instance and replace it with a copy of the original arc so I can use its Sweep Angle option without affecting all the copies.

Short summary of how Accumulate Field works: It takes a Value and continually adds multiples of that value to the chosen elements (domain) according to their index. For example, if you set the value to $$3$$, and the domain as Instance, first instance (with Index $$0$$) gets the value of $$3$$, second one gets $$6$$, third gets $$9$$, and so on... That's what the Leading socket gives you, if you use Trailing it starts accumulating with a $$0$$, so instead of $$(3,6,9...)$$, you get $$(0,3,6...)$$. Then what you do with that field (list of numbers) is up to you. Here we're using it to Scale arcs bigger and bigger. (Another way would be to simply multiply Index with the "growing factor", since Index goes $$0,1,2,3...$$ it's already a trailing accumulated field with value $$1$$)

That satisfies the letter of your intent, but not the soul. It roughly looks like one, but this is actually not really a proper spiral. The tangent at the points they meet is not smooth, and it grows very predictably in equal steps, so you wouldn't be able to replicate the example you say you want. To create a mathematically correct growth spiral, you might want to do it the way @Marty-Fouts shows here in this older answer instead.