10
$\begingroup$

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:

enter image description here

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

Thanks

$\endgroup$
11
  • $\begingroup$ "I'm happy to explore solutions which incorprate Sverchok, Tissue, etc." This, in principle, is a Blender community. $\endgroup$ Commented Jan 13, 2020 at 12:48
  • $\begingroup$ @Lukasz-40sth Are Add-ons not allowed then?; I rather thought that was the point of Blender $\endgroup$
    – Strawberry
    Commented Jan 13, 2020 at 13:01
  • $\begingroup$ 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? $\endgroup$ Commented Jan 13, 2020 at 14:10
  • $\begingroup$ No. I'm just happy to explore a variety of solutions (and would be content with one) $\endgroup$
    – Strawberry
    Commented Jan 13, 2020 at 14:39
  • 2
    $\begingroup$ 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? $\endgroup$
    – Carlo
    Commented Jan 13, 2020 at 19:47

2 Answers 2

9
+100
$\begingroup$

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:

enter image description here

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

enter image description here

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

enter image description here

..with this result, so far:

enter image description here

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

$\endgroup$
4
  • $\begingroup$ Hi, this looks very promising indeed. $\endgroup$
    – Strawberry
    Commented Jan 14, 2020 at 8:33
  • 2
    $\begingroup$ 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... $\endgroup$
    – Strawberry
    Commented Jan 14, 2020 at 17:41
  • 2
    $\begingroup$ @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. $\endgroup$
    – Robin Betts
    Commented Jan 14, 2020 at 18:44
  • 2
    $\begingroup$ The main manual section to read up is Drivers $\endgroup$
    – Robin Betts
    Commented Jan 14, 2020 at 18:48
5
$\begingroup$

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.

enter image description here

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.

enter image description here

Driving the array count.

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

enter image description here

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..

enter image description here

(self["length"] / (self["length"] // 2)) / 2
$\endgroup$
2
  • 1
    $\begingroup$ Nice explanation. It's considerably reduced my self-loathing..... $\endgroup$
    – Robin Betts
    Commented Jan 17, 2020 at 9:19
  • $\begingroup$ so easy, so useful, so great combination and great explanation. $\endgroup$
    – Chris
    Commented May 27, 2021 at 4:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .