Unfortunately, no one can be told what the ShapeSheet is. You have to see it for yourself.
Visio SmartShapes can be so much more than just clip-art. This is because the ShapeSheet allows shapes to behave in intelligent ways, carry data and react to that data.
One under-used, little-known function is RAND(), which allows you to add randomness to your drawings. Randomness can not only be “neat-o”, but also useful. Come in and see why!
Determinism is so 1700s!
Two thoughts crossed in my mind today:
- I was thinking about what kind of cool Visio background-page shapes I could make
- I had been switching between a bunch of different character sets that I have installed on my system: English, German, Danish and Serbian (don’t ask why)
At some moment, the image of those green characters falling against a background popped into my mind. You know, the ones from The Matrix? I knew in a flash that the RAND() ShapeSheet function needed to be called into action!
The Random ShapeSheet Function and Screen Savers
The ShapeSheet has a nice function for creating random decimal numbers between 0 and 1: RAND().
The trouble with RAND() is that it “goes off” all of the time. To see what I mean, try this:
- Draw a shape on a blank page
- Open the ShapeSheet for it, and set these two formulas:
PinX = 8.5 * RAND()
PinY = 11 * RAND()
Since RAND returns a decimal value between 0 and 1, we scale the random number by multiplying by the width and height of a standard U.S. letter-format page: 8.5 x 11 inches. A4 paper in metric isn’t much different, so these formulas will work fairly well outside the U.S. too.
Now that your random shape is set up, grab your coffee, sit back and wait.
In one minute, your shape will jump to a new location on the page. A minute later, it will up and move again! We could make a Visio screen saver with this! (and it works in Full Screen Mode too, just hit F5 and watch!)
Furthermore, if you start doing something on the page, the random function will update more often. Just draw another shape on the page and start moving it. Your original shape will dart and dash around every time you move or resize the new shape.
Promising, almost-there, nice-to-have, but clearly not-ready-for-prime-time!
If you use RAND() in this way, you WILL GO MAD!
Make RAND Less…Random
There are lots of uses for randomly generated numbers, but when it comes to shapes, diagrams and drawings, we don’t want shapes changing all the time. Rather, we want random numbers at certain times, such as when we drop a shape, or when we double-click one.
I think “on-drop” is a good time to get some random data. Your shape will “come into the world” with some randomness, but thereafter will remain the same.
The ShapeSheet has the EventDrop cell in the Events section that fires when a master is dropped or a shape is copied. And the SETF function is ideal for pushing values and formulas into other cells when events fire.
So we can push a random value to a cell using the SET function, and we get this to happen when a shape is dropped or copied. Let’s “de-screen-saver” our first example by writing this formula into the EventDrop cell:
EventDrop = SETF( GetRef( PinX ), 8.5in * RAND() )
What this does is:
- Calculates the value of 8.5in * RAND() when the shape is dropped
- Pushes that value into the PinX cell. It doesn’t write the formula, just the value.
Your shape will now jump to a random x-location when you drop it or Ctrl+drag a copy of it. And it will remain there! You have now tamed the RAND function!
Extending the Example
Having shapes jump around on-drop just for the sake of it isn’t terribly useful. But if you start thinking about the possibilities, it starts to make some more sense. Imagine if you needed to:
- Place sprinkles on a page for artistic effect
- Place a bunch of trees and bushes on an architectural drawing
- Place cars or people in an architectural rendering
- Make drawings look less-perfect or sketchy
Variations in size, location, rotation, and color start to sound a bit more appealing.
You can randomize more than one feature of a shape at once by stacking SETF expressions together. You simply add them together using the + operator.
Here’s an example that randomizes the x- and y-position of a shape on-drop:
EventDrop = SETF( GetRef( PinX ), 8.5in * RAND() ) + SETF( GetRef( PinY ), 11in * RAND() )
EventMultiDrop = SETF( GetRef( PinX ), 8.5in * RAND() ) + SETF( GetRef( PinY ), 11in * RAND() )
The EventMultiDrop cell is new as of Visio 2007. It fires if you select multiple shapes and copy them, or if you drop multiple masters from a stencil. EventDrop by itself will get ignored in cases where more than one shape is selected, and the shape-in-question is not the primary selection (first-selected shape.)
With EventMultiDrop, you can quickly create a lot of random objects! Just drag out a few of your random-shapes. Then select them all and drag a few copies of the set. Now select all again and copy them a few times. 1, 2, 3…6, 9, 12…24, 36, 48…96, 144, 192…BOOM! A page full of shapes!
What Can You Do With Random Shapes?
I’ve already hinted at the utility of random-enabled shapes. Let’s investigate further:
1. Hand-drawn look
Desktop graphics are getting so good that people’s eyes are starting to gloss over at even the most impressive drawings. Sometimes a sketchy look can grab attention.
The hand-drawn look can also indicate that something is in “draft form” or “pre-design”–it doesn’t exist yet, so don’t expect it by tomorrow! The shapes in the article: ‘Indexed’ Shapes – for that Hand-drawn Look use random ShapeSheet techniques discussed above.
If you are an architect or landscape architect you might find yourself needing to draw a bunch of bushes. Unless you are planning an orchard, you don’t want a grid of plant symbols.
Individually dropping and placing a lot of bushes, trees or plants in a realistic-looking pattern can be tiring. And people are notoriously bad at doing things randomly. Further, you run the risk of creating Moiré patterns.
A bit of randomness in the placement, size, rotation and even color of plant symbols can make a drawing look more realistic. Automating can make your job easier and more enjoyable!
3. Automated Sprinkles
Yes, I said sprinkles, and no, I’m not talking about your yard’s watering system. If you are doing something artsy, you might have some sprinkles or dots or squiggles, or maybe all of them. You don’t want them to all have the same size, same color, or be rotated to the same angle!
If you have a personal bias against sprinkles, try imagining raindrops instead. Imagine how boring an illustration would be if every drop were the same!
The drawing below was created in Visio 1.0. It used the random technique to control the color, angle and size of the dots and squiggles. In this way, the SmartShapes’ smart behavior really saved a lot of time. An Adobe Illustrator user would have rotated, resized and colored each element individually. An arduous process indeed, and subject to the “not looking very random.”
I just dragged and dropped!
click to view larger image
Maybe you’re programming your own layout or arrangement algorithms, or you want to see how connectors behave with various settings and lots of shapes. With this random technique, you can save yourself a lot of time generating test cases, and perhaps give yourself more random scenarios, since people are bad at being random!
5. The Matrix
Ok. The Matrix isn’t really a good reason for randomization, but the visual from that movie got this article going in the first place.
To create a bunch of cascading characters on a black background, like the one you see below, I created a single-character Matrix Shape that employs random techniques.
The matrix shape has three user-cells, ingeniously named: User.rnd1, User.rnd2 and User.rnd3.
These in turn control character, font-size and font transparency. In the ShapeSheet, the EventDrop and EventMultiDrop cells look something like this:
EventDrop = SETF( GetRef( User.rnd1 ), RAND() ) +
SETF( GetRef( User.rnd2 ), RAND() ) +
SETF( GetRef( User.rnd3 ), RAND() )
When we copy one matrix shape a few times, EventDrop does its magic, as we see here:
I also copied the formula into the EventDblClick cell, as a developer back-door hack. That way, if I don’t like the way a duplicate turns out, I can keep double-clicking until I get something I like!
Of course every random situation won’t call for building randomness into your shapes. In some circumstances, it makes more sense to write some code that will randomize shapes on a page, or selected shapes in a window. In this way, your shapes stay clean and pure. But for quickly creating graphical-illustration tools, this ShapeSheet technique is quick and effective!
So how could you use randomization in your diagrams?
What drawing needs do you have that be easier with randomness?
Let us know in the comments below!
Download “Random Matrix Visio Shape”s!Aj0wJuswNyXlhgl39OmXlaByL4ZG – Downloaded 519 times – 103 B