# Tubes on a curve without deformation... but different

I am looking for a solution to my problem: i want tubes to follow a curve/path but without deformation. Just like a fence but not exactly, i want the Z-position varied. So along the X-axis a straight line. Like this:

But on a curve/path. With an array. If possible.

Obviously it doesn't work with a curve modifier but i cannot figure out how to do this apart from manually. Preferably with an array on the tube, that would save me quite some time. It would be nice if it's possible to add tubes randomly so there could be open spaces between the tubes but it's not nessecary.

• The placing of the cylinders along the curve one after another works very well with an Array and a Curve modifier... set the Array to Fit Curve, select a curve and set a Relative Offset of Factor X = 1. Then select a curve in the Curve modifier. No deformation there. Only the varying Z positions will be a problem... this might work better in Geometry Nodes I guess - also randomly placed tubes (I mean with spaces inbetween) will be something to do with Geometry Nodes. Commented Mar 6, 2023 at 9:46

I would do this with Geometry Nodes, using a Resample Curve node set to a certain Length depending on the Radius of the cylinders. After the Instance on Points node (where I use a Random Value node set to Boolean to leave some gaps in the curve) I place a Set Position with a Random Value node plugged into the Offset input to vary the Z position of the cylinders. This would be the simple setup for this:

To get a little more fancy I would take into account that the resampling with a certain Length of a curve which might have some arbitrary length usually results in points not exactly placed at the desired distance apart, but a little shorter.

Since a curve can only have an integer number of points, but dividing a curve's length by a certain distance can result in a float value, Blender rounds up the result of the division, divides the curve length by this integer number minus 1 (because there's one point more than there are segments of the resulting length) and uses this as the exact distance between points.

So I made a little modification to my setup, now there is a Value node as input to choose the distance between points which is then used to specify the radius of a cylinder, so that all cylinders are placed directly next to each other - of course also depending on the resolution of the cylinders, the higher the resolution i.e. the smoother and rounder they are, the better/tighter they next fit to each other.

• Yes Gordon, this is exactly what i am looking for! Thank you so much for taking the time to create this! I have never worked with Geometry nodes so i have no idea what i am doing, i managed to create your node group and it works excellent. On the second one, i can't manage to create holes in the row but that's ok, this is something i can work with. Thanks again!!!
– Jaco
Commented Mar 6, 2023 at 11:20
• @Jaco Hmmm... the "holes in the row" are created by the Random Value node set to Boolean which is plugged into the Selection input of the Instance on Points node. It should work the same in both setups. But I can add my file to the answer as well. Commented Mar 6, 2023 at 11:53
• Thank you for adding the file, i will look into it. For now i am happy with what you provided and it seems to work pretty good! For some reason though, i can't seem to add a texture to the tube, is that something that also needs to be done through the Geometry nodes?
– Jaco
Commented Mar 6, 2023 at 12:29
• Since they are created in Geometry Nodes, yes. There is a Set Material node with which you can assign a material to the tubes. If you would create a tube object outside of Geometry Nodes and just reference it like I did with the curve, then you could assign the material directly to the tube and it would simply be instanced with the material. However, since I made the radius adjustable with the sample length I preferred to add a cylinder in the nodetree instead of an external object. I would really recommend watching tutorials on Geometry Nodes, you can do a lot with it. Commented Mar 6, 2023 at 12:36
• Found it, it's a relatively simple procedure: just add a Set Material node just before the Group Output node. Thanks again for your help! This shows that i really need to delve into the world of Geometry nodes.
– Jaco
Commented Mar 6, 2023 at 12:56