# How to construct a stretchable array?

I'm new to Blender, and coming from an Acad background; so apologies if my terminology is a little off...

I'm trying to construct a 'stretchable array' comprising a module that can stretch and deform within defined limits and repeat itself such that it exactly fits a given length.

I'm attaching an image which hopefully illustrates what I'm talking about:

I'm happy to explore solutions which incorprate Sverchok, Tissue, etc.

Thanks

• "I'm happy to explore solutions which incorprate Sverchok, Tissue, etc." This, in principle, is a Blender community. Jan 13 '20 at 12:48
• @Lukasz-40sth Are Add-ons not allowed then?; I rather thought that was the point of Blender Jan 13 '20 at 13:01
• They aren't but people here mainly use Blender and it may be hard to make you happy. And what do you mean? Do you want to do it with addons? Jan 13 '20 at 14:10
• No. I'm just happy to explore a variety of solutions (and would be content with one) Jan 13 '20 at 14:39
• Nice question. It's not clear in my mind what you are actually building: from a given a radius, how many elements do you expect to generate? a custom amount? or something correlated with the radius? Could you give us some examples of implementation? Jan 13 '20 at 19:47

Here's a first shot using drivers, with a set-up to keep the expressions as simple as possible to begin with.

The X location of an Empty('End'), marks the length of the array. Moving 'End' in X changes a collection of driven values, and stretches the array. Everything is parented to another Empty at the origin, ('Start') so the rig works in Start's space, and can be moved about.

The arrayed object is a rectangle with 2 shape keys. The Basis key is set to width 0. The 'Width' key is set to width 1 at relative value 1, so the Value directly encodes the width.

The Count of the array is driven as follows:

The shape key of the rectangle is driven by the 'End' Empty, too:

... and the rectangle is rounded top and bottom by a driven Bevel modifier:

..with this result, so far:

I don't know whether this satisfies your requirements directly, but I'm sure it could be adjusted?

• Hi, this looks very promising indeed. Jan 14 '20 at 8:33
• i have to confess, not only can I not figure out how this works, I can't even figure out what object/parameter you're manipulating in the gif - I think I need a book... Ah, you're dragging the 'end' object; well, that's a start... Jan 14 '20 at 17:41
• @Strawberry Hmmm .. how can I help? You could mute the modifiers, so you can see what they're doing... , or .. right-click the purple driven fields, and ' Open Driver Editor', adjust the expressions to see the effect? Get stuck, ask for a clarification, and I'll do my best. PS, you can delete the guide line, it's irrelevant, I was just using it to measure up. Jan 14 '20 at 18:44
• The main manual section to read up is Drivers Jan 14 '20 at 18:48

Use self with drivers

Good example to show usage of use self with drivers. This way can put a property on an object (aka self) and drive other properties of that object with the property.

For example sake I'm using the width 2 as my basis width.

On the to be arrayed object added a custom property "length". Note: The minimum is set to the size of the minimum units length in this case 2 to avoid zero division errors in driver expression. this could be handled for the single unit case

The origin of the object has been moved x-wards to zero such that object scales left to right.

Now it becomes a matter of driving the array count and x scale to fit our length following the rules outlined

The property we created, the array modifier count and scale all belong to the arrayed object so can take advantage of "use self" in drivers. This isn't default, so have to check the use self checkbox in driver editor to use

The variable self is the driven object. For the case of the array modifier the modifier is the object being driven ie self is the array modifier object, BUT the ID object it belongs to is self.id_data. So in the expression this will be the arrayed object. Bit confusing at first. If say we wanted to bring the x offset of the modifier into our calculation it would be self.relative_offset_displace.x

Default array mod setup, with x relative offset 1.

Driving the array count.

How many 2 width base units fit our length. The integer div operator // gives us this.

self.id_data["length"]  // 2


Driving the scale

Knowing the length and count above, how much bigger must a unit be than 2 to fit the length. Notice how for scale use self["length"] // 2 as the scale property belongs to the object..

(self["length"] / (self["length"] // 2)) / 2

• Nice explanation. It's considerably reduced my self-loathing..... Jan 17 '20 at 9:19
• so easy, so useful, so great combination and great explanation. May 27 at 4:58