Development

Tips & code for programming Visio & using the ShapeSheet

Maps & Geography

Maps & geography shapes & templates galore!

Network

Shapes & tools for Visio network diagrams.

News

Find out what’s new in the Visio world!

Shapes

Download useful & attractive Visio shapes. For free!

where can i buy windows 7 cheapest buy windows 7 upgrade from xp windows vista purchase price buy inventor 2010 pctools spyware doctor 5.5 buy windows 7 best price norton ghost 12 product key windows 7 price future shop windows xp price singapore windows 2008 web server download omnipage coupon buy windows 7 starter download adobe indesign cs3 for mac buy vista to windows 7 microsoft project 2003 download buy windows xp operating system windows 7 home premium cheap mathcad pricing photoshop buy mac discount autocad 2009 purchase microsoft money 2007 deluxe download photoshop mac autodesk maya 2009 price windows vista business download windows 7 price 64 bit purchase windows 7 ultimate full version buy windows 7 home premium key lightroom for apple purchase windows xp india adobe cs4 photoshop buy where to buy encarta 2009 purchase vista oem buy windows 7 tesco cheap adobe fireworks windows 7 price online best price corel draw 11 mac discount powerpoint buy microsoft office for mac canada buy microsoft project 2002 adobe production premium mac turbotax 2009 deluxe best price windows 7 ultimate 64 bit best price buy windows 7 amazon adobe flash pricing adobe dreamweaver sale purchase windows 7 ultimate buy quickbooks pro 2007 roxio copy & convert 3 buy download photoshop elements 6 steinberg nuendo price uniblue registrybooster 2009 download cheap photoshop programs adobe photoshop elements cheapest buy windows 7 future shop adobe presenter 7 download microsoft office 2003 sale buy quarkxpress 8 for mac purchase adobe cs3 design premium purchase after effects cs3 paperport professional 12 prices cakewalk download parallels desktop price buy microsoft windows 7 home premium cheap adobe after effects for mac how to purchase windows 7 online download microsoft streets and trips 2008 microsoft office 2003 cheapest buy windows 7 online singapore purchase autodesk 3ds max 2009 buy windows xp pro best price adobe flash cs3 buy uniblue registrybooster 2009 cheap windows 7 ultimate retail buy autodesk autocad buy microsoft office document imaging purchase microsoft office 2003 buy windows xp media centre edition discount microsoft windows 7 ultimate windows 7 price upgrade cheap adobe photoshop software burnaware professional price buy acronis true image 2010 windows 7 price change buy acrobat 7 where to buy adobe flash cs3 quicken 2010 price buy windows xp corporate buy office 2007 student product key windows 7 price hong kong buy windows 7 64 buy acrobat professional 9 symantec winfax pro 10.4 buy cheap windows 7 keys adobe photoshop cs4 buy buy microsoft visio 2007 turbotax deluxe 2009 download windows xp price in rupees buy lightroom software buy windows 7 buy windows 7 serial key steinberg nuendo 3 download download autodesk 3ds max 9 buy ms project online windows 7 price egypt windows 2008 enterprise download parallels mac download adobe lightroom sale cheap cubase 5 where to buy windows xp service pack 2 purchase windows vista download cheap windows 7 in singapore lowest price microsoft office purchase windows 7 license key where can i buy windows 7 starter edition buy i.r.i.s. readiris pro 11 cheap windows xp operating system buy office 2003 key where to buy windows xp cheap autocad mechanical 2009 download buy matlab software buy 3ds max 2010 student download dragon naturally speaking autocad inventor download get autocad 2010 buy adobe illustrator cs2 buy windows 7 mac windows xp price canada steinberg cubase sx3 download cheap windows 2003 enterprise download adobe illustrator cs3 can i buy windows xp online windows xp price in malaysia buy adobe cs4 suite best price adobe illustrator cs3 download font folio 11 acdsee pro license key cs3 production premium mac ms streets and trips 2008 download download adobe illustrator mac windows 7 price in india where can i buy cubase sx3 windows vista download iso roxio creator 2010 coupon code microsoft office price student windows 7 home premium 64 bit oem buy microsoft frontpage software buy windows xp 64 pro cheap windows 7 home premium full version buy burnaware professional cheap microsoft works 9 microsoft visio download adobe cs4 web premium oem download disk director cheap adobe creative suite cs4 microsoft money home and business download buy parallels desktop 5 for mac cheapest norton 360 3.0 lightroom price buy windows vista pro microsoft money buy online buy microsoft expression blend 3 buy windows 7 full version for students purchase lightroom 2 buy microsoft office ultimate pdf converter professional 6 promotional code buy adobe cs3 design premium buy indesign cs3 software buy windows vista ultimate upgrade acdsee photo editor download microsoft office 2003 professional cheap windows 7 for college students illustrator cs3 download download adobe indesign cs4 cyberlink powerdirector prices buy windows vista ultimate license buy access 2003 online windows 7 price guide mathcad price buy after effects cs4 mac cheap fl studio 8 xxl cheap photoshop elements 8 buy windows vista home premium oem buy wordperfect x3 buy windows 7 home premium 64 bit buy windows 7 brisbane buy windows 7 bangkok autodesk mudbox price purchase vista license cheap adobe premiere elements 8 download adobe creative suite 4 design premium best price microsoft excel 2003 buy microsoft project 2000 microsoft expression price discount photoshop elements 8 cheap maya software 3ds max sale buy windows 7 ebay windows 7 price 2010 deskshare videoeditmagic 4.3 price buy windows xp 2010 norton 360 price comparison buy windows xp used adobe contribute mac purchase windows 7 for mac buy windows vista home premium product key buy windows 2003 datacenter buy windows 7 professional cheap microsoft windows 7 ultimate buy sony vegas pro 8 purchase access 2007 final cut express 4 cost download microsoft visio 2007 buy onenote 2003 photoshop lightroom for mac symantec pcanywhere download windows 7 price pakistan buy premiere pro cs3 cheap windows 7 for students in australia web page maker 3 download buy windows xp home sp3 adobe photoshop best buy cheap windows 2008 enterprise buy windows 7 direct download download microsoft mappoint 2009 buy windows xp home download microsoft autoroute 2007 europe ashampoo burning studio download buy windows xp calgary archicad 13 download adobe cs4 design premium trial price photoshop elements 8 windows 7 home premium cheapest autodesk lustre pricing purchase archicad 13 acdsee pro 2 download windows 7 discount canada vmware workstation 7 download discount autodesk 3ds max 2009 buy autodesk inventor professional buy windows xp home full version buy windows 7 language pack buy microsoft office 07 buy microsoft excel 2007 download propellerhead reason 4 mappoint 2009 european buy access 2007 only buy frontpage 2003 purchase windows 7 ultimate online purchase microsoft windows vista buy dragon naturally speaking 10 oil price vista gadget pinnacle studio 14 best price cheap corel video studio pro x2 buy photoshop 7 for mac buy adobe cs3 design premium mac download ashampoo burning studio 9 cheap microsoft project 2007 dvd ripper platinum 5 buy adobe premiere pro cs4 download best price microsoft windows vista windows 7 discount for high school students purchase windows 7 professional (64 bit) compare price photoshop buy windows 7 philippines buy microsoft office powerpoint 2007 purchase windows xp sp3 buy photoshop elements 8 mcafee total protection 2009 download best buy autocad 2009 buy windows vista singapore purchase windows 7 now buy windows xp mumbai buy windows 7 ultimate 64 bit oem windows 7 price kenya ms works download adobe acrobat 9 oem buy windows 7 downloadable adobe cs4 web premium trial cheap windows 7 professional best price windows 7 home premium oem download adobe photoshop elements 6 navisworks manage price windows 7 price comparison buy guitar pro 5.2 download acronis true image 11 buy nero 8 ultra edition acdsee price download adobe robohelp 8 buy powerdirector 7 ultra imsi turbofloorplan home and landscape pro 12 buy buy microsoft expression studio 2 windows 7 discount for military buy windows 7 30 download pinnacle studio 12 ultimate adobe acrobat price comparison mappoint 2009 europe buy cheap avanquest mylogomaker professional 2 buy windows xp cheap microsoft office discount code buy windows 7 switzerland buy windows xp volume license buy norton 360 download cheap adobe photoshop cs3 download microsoft expression studio 3 buy office 2010 professional fl studio 8 xxl download buy microsoft office 2007 home and student cheap adobe cs4 design premium abbyy finereader 9.0 express edition where to buy streets and trips 2010 office 2007 price student buy roxio creator 2010 cheap adobe cs4 master collection mac buy windows xp ebay cheap indesign software buy corel photoimpact x3 download avanquest mylogomaker professional 2 cheap ashampoo burning studio 8 adobe captivate pricing autocad architecture oem buy microsoft office pro 2007 where can i buy powerpoint 2003 turbo tax cost buy windows 7 india online purchase windows 7 license online buy adobe flash cs4 buy windows vista ultimate product key buy cs4 mac buy adobe indesign cs4 best buy microsoft windows 7 ultimate cheap adobe dreamweaver cs4 mac cheap windows 7 canada roxio creator 2009 special edition microsoft office 2010 price in india windows 7 price canadian buy windows xp embedded download corel draw 12 adobe creative suite 4 production premium download buy adobe photoshop cs3 extended buy windows vista business 64 bit buy ms office 2003 pro best buy quicken 2010 buy microsoft office for mac cheap buy adobe after effects cs4 cheap norton 360 3.0 best price adobe cs4 master collection windows 7 price for teachers buy windows xp student purchase adobe acrobat 8 professional buy sql server guitar pro 5 mac download
Home » Illustration, Seasonal, ShapeSheet

SmartShape Tutorial: Fading Trees

Submitted by Visio Guy on December 3, 2007 – 8:51 pm | | 9475 views 7 Comments

Read Full Article

Today’s post, like the Visio Guy web-site, is all about creating smart graphics.

We’re going to create an evergreen tree shape that fades as its size decreases. With this one single SmartShape you’ll be able to illustrate an entire forest-scene that fades into the mist. And you won’t have to format each tree individually.

You will learn how to cut Visio shapes into pieces and union the bits together to form new shapes. You’ll learn how to add parameters to shapes, and fill them with Excel-like ShapeSheet formulas create sophisticated graphical behavior. And you’ll create a context menu that resets the shape with a click of the mouse.

The Added-value is Learning

Now I know what you’re thinking: I need to create Business Graphics! I need to improve my processes, achieve Six Sigma, ensure TQM, improve my score-card, analyze my KPIs, and focus on many things! Trees are for the Art Department, Adobe Illustrator and Mac Users!

Well, um…well, yes.

But smart BPM shapes are rather boring to look at, no matter how smart they are. Plus, everything you’ll learn in this article will help you to create smart, parameterized Visio shapes for any application.

So turn your monitor away from the corridor, go get a Venti Mocha Frappucino and hunker down with me for twenty minutes or so.

The Graphical Todo:

As winter descends upon the northern hemisphere, some of you may be tempted to use the office color printer to create holiday greeting cards for co-workers, acquaintances, friends and loved-ones.

Well, no Seasons Greetings card would be complete without a forest of evergreen trees, fading into a misty, snowy background!

So let’s translate the flowery phrase: forest of evergreen trees, fading into a misty, snowy background into the terse, bullet-point-filled language of the Smart Graphics Engineer:

  • Tree further away look smaller
  • Tree further away look whiter

That means, we want to create this:

Fading Trees

But we don’t want to select lighter colors for each individual tree (because we would go stark-raving mad if we had to…)

Make Like a Tree

Before we get busy creating smart graphics, we need to have some dumb graphics to work with. So let’s create our evergreen tree.

The tree consists of four parts:

  • Bushy Part
  • Trunk
  • Trunk Shadow
  • Ground Shadow

Build the Bushy Part and Trunk

We can reduce the Bushy Part set of three elemental triangles that we will Union together. So let’s first create a single triangle. We do this by using the rectangle tool and the line tool or pencil tool. These can be found on Visio’s Drawing toolbar:

Make Triangle

  1. Select the rectangle tool
  2. Draw a square (1)
  3. Select the pencil or line tool
  4. Select the top-left vertex of the square
  5. Slide the vertex to the middle of the shape (2)
  6. Select the top-right vertex of the square
  7. Delete this vertex by hitting the Delete key (3)

You should have a triangle! Now let’s finish off the Bushy Part:

Make Tree

  1. Ctrl+Drag two more copies of the triangle
  2. Increase the size of each new triangle
  3. Position them directly underneath the first triangle, as shown in (1)
  4. Select all three triangles
  5. Choose Shape > Operations > Union from the menu to create a single Bushy Part shape (2)
  6. Draw a rectangle underneath the Bushy Part to form the Trunk
  7. Format the shapes using the menus: Format > Fill…, Format > Line… or the buttons on the Formatting toolbar

The use of the boolean operation Union (used in step 5) demonstrates a powerful way to build complex shapes from simple primitives. Also note that when we format the trunk, we use Fill Patten 26 to give the trunk a graduated fill that makes it look round. Just select brown for the Color, and a lighter brown color for the Pattern Color.

Build the Trunk Shadow

The Trunk Shadow is the little bit just under the Bushy Part that adds depth and realism (stop laughing) to our shape.

Tree Shadow Close-up

We create this piece using a process similar to that of the triangle:

Make Tree Shadow

  1. Select the rectangle tool
  2. Draw a square (1)
  3. Select the pencil or line tool
  4. Select the bottom-right vertex of the square
  5. Delete the vertex (2)
  6. Select the pencil tool
  7. Drag the bow-handle down and to the right (3)
  8. Using Format > Fill, give the shape a black color, with 50% transparency (4)
  9. Align the shape on top of the Trunk, just under the Bushy Part

By giving the shadow a black, transparent fill, we automatically darken the colors of the underlying Trunk shape. We don’t have to worry about selecting two more shades of brown. No matter how the trunk is formatted, the transparent black will simply create a darker version.

Build the Ground Shadow

The ground shadow is pretty straightforward, just follow these steps:

  1. Select the Ellipse Tool from the Drawing toolbar
  2. Draw a long, short ellipse
  3. Format the ellipse with a dark blue color and 60% transparency
  4. Send the ellipse to back using Ctrl+B or Shape > Order > Send to Back
  5. Position the ellipse under the trunk

We’ve completed the basic tree. Now on to the more sophisticated parts of the solution…

Build the Overlay

To make the tree fade as we reduce its size, we’ll create an overlay shape that covers all the tree, trunk and shadow shapes that we’ve just created. Then we’ll set the overlay’s transparency, depending on the size of the whole assembly.

This is how we create the overlay:

Make Tree Overlay

  1. Select all of the shapes
  2. Ctrl+Drag a copy of them all, or hit Ctrl+D to duplicate them all
  3. Select Shape > Operations > Union to create a single shape
  4. Format the shape so that it is white, with no gradient fills using Format > Fill…
  5. Align the overlay with the original shapes using Shape > Align Shapes…
  6. Give the overlay a transparent fill, say 50% to see how we’re doing
  7. Remove the outline from the shapes by:
    1. Selecting all shapes
    2. Using Format > Line…, give them a line pattern of None, or select No Line under the Line Weight or Line Pattern toolbar buttons (Formatting toolbar)

The easiest way to align the shapes (in step 5) is to select the Bushy Part, hold down the shift key, then click the Overlay. When you choose Align Shapes…, all shapes in the selection will be aligned to the primary selection–i.e.: the first shape that was selected.

Group the Shape

The last thing we have to do is group the shapes together. To do this, simply:

  1. Select all five shapes
  2. Hit Shift+Ctrl+G or Shape > Grouping > Group

You now have a single Tree Shape, with a transparent overlay that is ready for smartening!

Fade to Smart Shape

Now we need to figure out a way to get the overlay shape become whiter as the tree becomes smaller. When the tree is close to us, it appears to be larger, and less faded. When it is far away from us, it is smaller, and there is more mist between us and the tree, which makes it look whiter.

We are looking for something like this:

Tree Gradation

Another way to think of whiter is as less transparent. So 100% transparent is 0% white, and 0% transparent is 100% white!

User Cells

This calculating-the-transparency business will clearly require some math. Luckily, every Visio shape has a an Excel-like ShapeSheet behind it. This ShapeSheet is full of cells and values and formulas, just waiting to be put to good use by a shape developer like yourself! To find the ShapeSheet, just select a shape, then choose Window > Show ShapeSheet.

The ShapeSheet is what makes Visio different from so many other graphics applications. It allows shapes to store data and react to graphically to changes in the data, as well as to changes in the size and position of the shape itself. There’s some good ShapeSheet introduction information in an article by John Goldsmith: Just for starters. But for now, you can just follow the tutorial steps, and it will start to make some sense.

Add Custom Cells

In order to do our transparency math, we’ll need to add some custom fields to our shape’s ShapeSheet. So let’s go ahead and do that now by adding sections to the ShapeSheet that can hold our data and calculations:

SmartTree Insert Section

  1. Select your grouped Tree shape
  2. Open it’s ShapeSheet window using Window > Show ShapeSheet
  3. Select Insert > Section… from the menu
  4. Click User-defined cells and Actions in the dialog.
  5. Place the cursor in one of the User-defined cells
  6. Right-click and select Insert Row

You should now have two User-defined cell rows and one Action row:

SmartTree User and Action Sections

Rename Rows

The row names for our User-defined cells and Action rows aren’t very attractive or useful, so let’s give them some new names.

  1. Click on the left-most cell in the first row of the User-defined Cells section. This is the cell with the red text: User.Row_1
  2. Rename this row to: startingHeight
  3. Similarly, rename User.Row_2 to: transparency
    Notice that you don’t have to type in the User. portion of the name.
  4. Rename Actions.Row_1 to setStartingHeight

Set Smart formulas

Now that we’ve got some pretty cell-names, lets enter some formulas:

  1. User.startingHeight = 1.0 in (…or whatever the current height of your shape is)
  2. User.transparency = MAX( 10%, MIN( 100% , Height / User.startingHeight ))
  3. Actions.setStartingHeight.Action = SETF( GetRef( User.startingHeight ), Height )
  4. Actions.setStartingHeight.Menu = “Set Current Size as Starting Height”
  5. Actions.setStartingHeight.Disabled = ( User.startingHeight = Height )

You should have a ShapeSheet that looks something like this:

SmartTree Rows and Formulas

User-cells explained

The user-cells allow us to relate the current height of the shape to the original height of the shape. And this allows us to create an expression that decreases the transparency of the overlay as the height of the tree decreases.

User.startingHeight holds the starting size of the shape. This is the height at which the transparency of the overlay will be 100%. We are essentially defining the size of the foremost tree in the scene – the tree that has Zero Fading.

User.transparency then calculates a ratio between this starting height and the current height of the shape. You can see the height of the shape in the Height cell of the Shape Transform section, located at the top of the ShapeSheet window. The Max and Min bits limit the transparency so that a shape doesn’t become 100% white.

Action row explained

The Action row creates a right-mouse menu on the shape, with the text Set Current Size as Starting Height. Try right-clicking your shape and see for yourself!

This action will allow us to re-define the starting size for our tree. If we decide in the future that a 3in tall tree should be the foremost tree in the scene, we can resize our tree to 3 in, then right-click this action menu item to redefine User.startingHeight. The SETF function in the Actions.Action cell overwrites the value in User.startingHeight with the current Height of the shape.

Keeping the ShapeSheet window open, try resizing your shape, then right-clicking this set starting height menu item. You can actually see the value change in the ShapeSheet!

Notice also, that the menu item becomes disabled after the first time you click it. That’s because the starting height and actual height of the shape are the same. When the two values are equal, the formula in Actions.Disabled evaluates to TRUE, thus disabling the menu item.

Hook-up the Transparency

We’ve got this nifty context-menu item, but it doesn’t do anything yet. That’s because we haven’t linked the FillForegndTrans cell of the overlay sub-shape to the User.transparency cell in the group.

To do this, we’ll need to learn about shape ids, cross-sheet references in formulas, and how to sub-select shapes inside of a group.

Sheet ID

In order for a sub-shape to refer to a cell in another shape’s ShapeSheet, you need to know the id of the other shape. So let’s get the id of the group shape first. Simply select your tree-group-shape, then choose Format > Special from the menu. You should see a dialog that looks like this:

SmartTree Format Special

The id of the group is 1 in this example. From other shapes, you can reference cells using the prefix: Sheet.1!.

Sub-select a Shape

To get to the ShapeSheet of the overlay shape, you need to sub-select it. You do this by first clicking the group, then clicking again where the overlay shape is. If you look closely, you’ll see light-green selection handles that have a little x inside. This indicates that you’ve selected a sub-shape:

SmartTree Sub-Selection Handles

Set the Transparency ShapeSheet Formula

Now that we’ve sub-selected the overlay shape, we can view its ShapeSheet and scroll down to find the FillForegndTrans cell:

SmartTree Fill Format Section

Once you’ve found it, set its formula to: GUARD(Sheet.1!User.transparency)

Remember that your shape’s id might be different than 1, so you should change the Sheet.1 portion of the formula appropriately.

You’re Done!

Your smart fading tree shape is now complete! It should turn whiter as you reduce it’s size, and you should be able to reset the starting size by right-clicking the shape:

SmartTree Context Menu

We hope you’ve learned a bit about creating smart graphics in Visio, and that your head is full of ideas on how you can apply this technology and these techniques to your own projects!

Happy Holidays!

Download Smart Fading Tree.zip (37 KB)

Related Posts

  1. Visio Tutorial: Advanced Fill Effects
  2. Visio Film Strip Shapes: Hurray for Hollywood!
  3. The Hidden World of Visio Shapes
  4. Center-sizing Smart Shapes
  5. Understanding Arc-Resize Problems in Visio

7 Comments »

  • al says:

    Very nice intro tutorial, as a newcomer to the backend of visio it helped in adding some context to the initial Shapesheet gibberish, very much appreciated.

  • Visio Guy says:

    Hi Al,

    Glad to hear this was helpful to you!

    - Chris

  • Justin says:

    I’m using ShapeStudio but cannot find “Format > Special” in Visio 2007. How do I figure out my Shape IDs?

  • Justin says:

    Found the solution. Apparently you must explicitly set Developer Mode (I erroneously assumed if I was running ShapeStudio, that meant I was already in Dev Mode.)
    Tools > Options > Advanced > Run in Developer Mode
    After that, “Format > Special” appears.

  • Visio Guy says:

    Hi Justin!

    Funny, I just gave a talk at the Visio Conference about developer Pain Points. One of these is the fact that running in Developer Mode (Tools > Options > Advanced Tab) adds some menu items to the Format menu. One of these is Format > Special, which is the easiest and best place to find shape IDs and shape names.

    You can find a shape’s name in:

    - The caption of the ShapeSheet window,
    - Document Explorer window (View > Show Document Explorer)
    - Format > Special dialog

    Cheers,

    - Chris

  • Suzanne Wong says:

    Just amazing how much we can learn nowadays through “distance learning”
    I particularly like the Build the Trunk Shadow part;-)
    “The Trunk Shadow is the little bit just under the Bushy Part that adds depth and realism (stop laughing) to our shape.”

    Cheers!
    Suzanne

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.