johnvisiomvp

Life with Visio and other Microsoft Toys!

Posts Tagged ‘Shapes

Updated Pool Table

leave a comment »

It looks like the original pool table shape had a problem with internationalization. I have updated the shape and the issue has been eliminated.

In the original designed I used lists to control the colour of the cloth. One list was used  to present colour options to the user by displaying names of colours. The second list was a list of the RGB values those colours represented. When the user was presented with the list of colours I would get an index of the colour in that list. I would then use that index to get the RGB value from the RGB list. I had another user cell that contained the RGB value that was retrieved from the RGB list.

The problem appears that though I can place a text string of an RGB value in the foreground colour cell and it worked, but in French, German and Russian* it would be set to black. In the original Visio there were 24 colours numbered from 0 to 23. Later, it was possible to enter any RGB value to get a wide palette of colours. So, when the formula failed it returned a value of zero, which in Visio means black. Testing also showed that entering unquoted RGB values in the Foreground cell in other languages worked. Was it a matter that Visio was applying internationalization rules to colours?

* It is great to have friends who have Visio installed in these languages on their machines.

The workaround I used was to replace the string of RGB values with a list of unquoted RGB values.

I was able to simplify the shape into a single shape with a User cell containing a text string of an RGB value and the Foreground cell pointing to it.

So, if you had this problem with my shape, try downloading an updated version.

Enjoy.

John Marshall… Visio MVP Visio.MVPs.org

Advertisements

Written by johnvisiomvp

August 4, 2017 at 6:50 pm

Posted in Shapes, Uncategorized, Visio

Tagged with ,

Pool anyone? … or how to create a smart Visio Shape

with 3 comments

One of the things I like about Visio are smart shapes. The trouble is that most of what is offered as Visio shapes is no more than clipart encapsulated in a Visio shape. For most purposes, that is fine, So time for some real Visio shapes.

A pool table is a good candidate for a smart Visio shape. There are several varieties o table, but they only differ by length and width. So how do create this shape?

Research

The place to start is to do a search on as much information as possible to work out all the dimensions, markings and colours. This will give you an idea of the type of variations that can be handled by a smart shape.

Design

The basic shape may be intimidating with all the finicky details around the pockets, but it is basically two rectangles and size pocket shapes. Okay, two pocket shapes. One for the dise and one for the corners, You basically need to look at it through an artist’s eyes. Paint the background and then paint the pockets on top. The background is basically a brown rectangle to represent the rails and a smaller green rectangle to place on top. No need for trying to fit the cloth around the pockets. The pockets are just painted on top. Think overlays. Rather than try to trim the cloth around the pockets, treat it like a basic rectangle and cover it with the pockets.

Visio shapes are limited in colour and line weights so to get a more varied shape, it will be necessary to group several shapes. Of course, there is over head, so limit the number of shapes and the number of levels of groups to one. The top level (or group shape) should contain all the UI to the user and the sub shapes should use their User sections as an interface to the top level. You could wire the sub shapes directly to the top shape, but is a mess if the shape is ungrouped.  By providing the user cells as an interface, it is easy to restitch if it is ungrouped.  (Of course, I do not always follow my own advice. )

So what makes this shape smart? It has two custom properties, (for now). One controls the table length and the other the colour of the cloth. All tables have a length Width ratio of two to one, so only one dimension is needed. The sizes listed are the ones I was able to find. The lines on the table are based on tables I found and it turns out that there is no formula for the location of the baulk or the D line or the actual radius of the D. The fourty or so cloth colours are based on sales brochures I found, so some of the colours may be pushing the taste of some customers. Of special note, black lines on a black cloth has visibility issues, so the colour of the markings changes to white. A later version may have a custom property to control the line colour. The line colour, width of the bumpers, line position and D radius are all User data cells that can be changed. A User cell is the stay at home cousin of Shape Data, AKA Custom properties. Hidden from the public and less versatile.

Do not forget the accessories. Though the primary reason is to create a shape to represent a pool table in a floor plan, that does not mean you can not use it for other things. With the right accessories, you can use the shape as a training tool setting up possible scenarios and ho to play them. Fodder for the next blog…

 

)for now)

A copy of the Visio drawing is in the Technet Gallery  Pool Table

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

John Marshall… Visio MVP Visio.MVPs.org

Written by johnvisiomvp

July 24, 2017 at 3:11 am

Posted in Shapes, Uncategorized, Visio

Tagged with ,

Colour My World

leave a comment »

When I was working on the Windows 7&8 phone apps I created a Visio template to help design phone apps. As usually, it was a Visio stencil that was a bit more than dragging and dropping clipart. One of the WP7 and WP8 features it replicated was accent colours that were set on the phone and were applied to the apps. If you changed the Accent colour any object that used the Accent colour would change.
The technique I used was based on a technique demonstrated by Mark Nelson. The original Visio was based on a palette of 24 colours that were enumerated 0 to 24. Mark’s technique used a Lookup formula in the colour cell that looked up the colour in a list. It basically used the list to find the index of the colour.
The instructions are to put this formula in the FillForegnd cell.
=Lookup(Prop.Status,”Black;White;Red;Green;Blue;Yellow”)
Lookup will match the value of the custom property (the old name for Shape Data) Status to the list shown above. The value returned by Lookup will be a number, starting with 0, which corresponds to the position of the matched value in the list. The list shows Visio’s numbering sequence for the first couple of colours. As I said, there were 24 originalcolours, So the list of colour string can be extended to add the missing colours.

If the Status property choices are “Warning”, “Caution” and “Clear”, in the Lookup formula, replace the words “Red”, “Yellow” and “Green” with “Warning”, “Caution” and “Clear”. You must leave the other colours in as place holders to get the correct colour position. Actually, you should keep the list of colours as a comment so that if you want add or change the colours or strings you have a template for their placement. The final formula would be:
=Lookup(Prop.Status,”Black;White;Warning;Clear;Blue;Caution”)

This is fine if the colours you want are in the original 24 colours of the Visio colour palette. Luckily Visio has been extended so in addition to the original colour names you can use a string in the colour cell as long as it evaluates to an RGB value. So now it is a matter of manipulating strings.
In Mark’s solution, everything was within one formula. The string manipulation will require a few more cells. So, what cells and where should they be placed? Most of the strings do not have to be available to the user, so User cells rather than Shape Data cells makes more sense. A Shape Data cell will be required to let the user choose the colour. In Visio there are three shapesheets that can be used. In addition to the shapes’s shapesheet there is a page and a document shapesheet. To reference the document stencil, precede the cell name with TheDoc! And use ThePage! As the prefix for the page. To actually access these shapesheets go to the Developer tab. There is a dropdown for each shapesheet on the ribbon. So why use them? If you have an item that is referenced several times on a page or many times in a document, placing it in the shapesheet with the appropriate scope makes sense. The value is in one location and maintenance is reduced. Do you really want to be hunting through a document to find out where a list is used to change a value? Use a reference and keep a single copy of the value.
So, to solve the limitation on colours, I create two user properties. Both were lists (Type 1 shape data). One list was the names and a the other was a matching list of the RGB values. I could have placed these values in the User Data section for the shape, but I placed them in the User data for the document. So any shape in the document could use these values. The difference between a User property and a shape data property is that the user property is hidden from the user.
I put the reference to an occurrence of the colour in the Page Shapesheet. So the control of the Accent colour is at the page level. So if I change the accent colour, all shapes on that page using an accent colour will change. I chose the page level because I may want to have different accent colours on different pages.
So, the Document shapesheet would have two user data cells:
User.WP7Colours =”Magenta;Purple;Teal;Lime;Brown;Pink;Mango;Blue;Red ;Green”

User.WP7ColoursRGB =”RGB(255,00,151);RGB(162, 00, 255);RGB(00, 171, 169);RGB(140,191, 38);RGB(153, 102,00); RGB(233,113,184);RGB(240, 150, 09);RGB(27, 161, 226);RGB(229, 20, 00);RGB(51, 153, 51)”

Or for the Windows phone 8 accent colours
User.WP8Colours =”Amber;Brown;Cobalt;Crimson;Cyan;Emerald;Green;Indigo;Lime;Magenta;Mauve;Olive; Orange;Pink;Red;Steel;Taupe;Teal;Violet;Yellow”

User.WP8ColoursRGB =”RGB(240,163,10);RGB(130,90,44);RGB(0,80,239);RGB(162,0,37);RGB(27,161,226); RGB(0,138,0);RGB(96,169,23);RGB(106,0,255);RGB(164,196,0);RGB(216,0,115);RGB(118,96,138);RGB(109,135,100); RGB(250,104,0);RGB(244,114,208);RGB(229,20,0);RGB(100,118,135);RGB(135,121,78);RGB(0,171,169);RGB(170,0,255); RGB(227,200,0)”

The Page shapesheet would have one user cell:
User.WP7AccentColour =INDEX(LOOKUP(Prop.WP7AccentColour,TheDoc!User.WP7Colours),TheDoc!User.WP7ColoursRGB)

Or for the Windows phone 8 accent colours
User.WP8AccentColour =INDEX(LOOKUP(Prop.WP8AccentColour,TheDoc!User.WP8Colours),TheDoc!User.WP8ColoursRGB)

And a Shape Data cell :
Prop.WP7AccentColour Type=1
Label = Accent Colour 7
Format =TheDoc!User.WP7Colours
Value =INDEX(5,Prop.WP7AccentColour.Format)
Or
Prop.WP8AccentColour Type=1
Label = Accent Colour 8
Format =TheDoc!User.WP8Colours
Value =INDEX(9,Prop.WP8AccentColour.Format)

In the actual shape shapesheet Fill Format section the FillForegnd cell would be ThePage!User.WP7AccentColour or ThePage!User.WP8AccentColour.

So if you need to add colour palettes to a shape or group of shapes you can create two lists, one for the name of the colour and the other the RGB values. Treating the colour as a string, create a shape data to hold the value and assign that string to the appropriate colour cell. Where you place the user cells or shape data cells is dependent on whether the colour palette is limited to a shape or to a page or a document.
I have added a sample Visio drawing in the Technet Gallery. https://gallery.technet.microsoft.com/Visio-Colour-picker-29158b2c

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Written by johnvisiomvp

July 8, 2017 at 6:15 pm

Posted in Shapes, Uncategorized, Visio

Tagged with ,

Visio 2016 Electrical Engineering Shapes

leave a comment »

While researching a new PowerPoint deck on Visio 2016, I came across a supposed update to the Electrical Engineering stencil.

ee

Unfortunately, the way I learned how to draw EE shapes, long before Visio existed when I was getting my EE degree, was what was in Visio 2013. The bold lines in 2016 are distracting and so is the misalignment of the “wires”. The stubs on the components is also distracting.

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Written by johnvisiomvp

March 13, 2017 at 1:24 am

Posted in Shapes, Visio

Tagged with ,

Open Shape Surgery for the Visio Developer

leave a comment »

One of the first gotchas for new Visio developers is the UnGroup command.

Visio shapes are simple, they can have one colour and one line type. To make a traffic light, you need to group a red circle, yellow circle and a green circle. When grouped, Visio will take a collection of shapes and create a new shape with a group section and a shape collection of the shapes selected. To  ungroup, the shapes are released from the collection and the group shape is deleted. The process is reversible, some times. Shape developers learned early on, that this new shape was like any other shape and could have other sections added to it. Shape Data, User Data, Connections, Control Handles etc. Unfortunately, when these shapes are ungrouped, these extra sections are not preserved. So knowing this why would you ever want to ungroup one of these these?  You can always subselect or use the Drawing Explorer to get access to one of the sub shapes. Welcome to one of the other gotchas, the bounding box. Sometimes you have to ungroup, and create a group with a more appropriate bounding box. You can go bigger by adding a temporary shape of the desired size, lock the group from recalculating the bounding box and delete the temporary shape, but you can not go smaller without Ungrouping. You would then create a shape of the correct size, group it and before adding the other shapes to the group, lock the group shape from recalculating. The final cleanup would be to add back the component shapes and delete the temporary shape.

Early on Graham Wideman showed me a way to remove VBA projects from a Visio solution. Deleting the VBA only got you part of the way, there was still a Project stub that made Visio think the file contained a VBA solution. His solution was to edit the XML version of the file and delete the stub.

 

 

 

 

Written by johnvisiomvp

April 17, 2016 at 4:22 pm

Posted in Shapes, VBA, Visio

Tagged with , ,

Taming Geometry Sections in Visio

leave a comment »

Ever create a pair of shapes in Visio, butted them together and do a Union operations and find that the joining line between the shapes does not disappear and find that the new shape has two geometry sections? So, before you start to copy rows from one section to the other, place a rectangle shape over the offending line and union that with the original shape. You will now have one Geometry section. The rectangle does not have to be a precise match, just cover part of the line. You can then easily edit the Geometry section and delete the offending rows. Far easier than copying rows between Geometry Sections.

Recently I was creating shapes that basically looked like a stack of trapezoids. Rather than create the trapezoids, I created a stack of rectangles. Each rectangle was the width of the various cross sections and the height was the distance between transitions.  Once Unioned, I edited the shapesheet and deleted the extra rows that the rectangles created.

Next time I will talk about open shape surgery, a lesson learned from an old master.

Enjoy.

John Marshall… Visio MVP       Visio.MVPs.org

Written by johnvisiomvp

November 22, 2015 at 2:29 am

Posted in Shapes, Uncategorized, Visio

Tagged with , ,

Dual Outlets

leave a comment »

The VBA code to stack shapes was used to create a series of shapes that represented inserts into the cap of a bottle that allowed hoses to be connected. For the single connections, the shapes making up the stack were horizontally symmetrical, so after stacking the shapes it was a simple matter of aligning all the shapes around their centers. The dual connections were only slightly more complex. All the shapes were aligned around the same center, but the shape through the cap was offset from the rest. So, it was just a matter of adding a horizontal guide to align to the edge of the bottom shape above the cap and then horizontally move the part within the cap to align to the guide. The next step was to use the Size & Position window to add the horizontal offset to that shape.

So, now I had a single outlet shape with the proper offset. The next step was to group the shape, duplicate the group and align the two grouped shapes horizontally and vertically. The result is a dual version of the shape. Cleanup involved deleting the duplicated section through the cap, ungrouping and doing a Join operation to simplify the shape. Since I had to do a number of shapes of various cap sizes, outlet sizes and offsets, I kept a master of the single outlet version (the one with the offset), so I could earebuild the shapes.

Enjoy.

John Marshall… Visio MVP       Visio.MVPs.org

Written by johnvisiomvp

August 21, 2015 at 7:49 am

Posted in Shapes, Visio

Tagged with ,