johnvisiomvp

Life with Visio and other Microsoft Toys!

Posts Tagged ‘Visio

Who Messed up my bed?

leave a comment »

One of the things I love about Visio is smart shapes. Unfortunately, there are a lot of Visio shapes that are not smart. Including a number of shape collections from Microsoft that are just basic shapes. This is not the Visio team’s fault because Microsoft is a large company and not everyone really understands what a real Visio shape is. It is very easy to create a Visio shape, it is just a matter of dragging an image to a Visio page and Visio will wrap a Visio shape around the image. At this point, this new Visio shape acts like any other Visio shape and can be embellished with connection points and shape data. For most purposes, this is enough.
Real Visio shapes have smarts.
Formulas … The cells within a Geometry Section can contain formulas that react to stretching the shape. The arrow head was an early example of this. No matter how the shape was stretched, the arrowhead point remained at 45 degrees.
NoShow … The Geometry section had a NoShow cell that controlled the visibility of that specific Geometry section. The flowchart shape was an early example. The shape contained a Geometry section for each of the flowchart shapes. Which flowchart shape was visible was dependant on the value in Shape Data Section (formerly Custom Properties). This made it easy to switch, but it meant that the drawing contained redundant information that was not visible and made the drawing larger.
Inter Shape references … One of the powers of grouped shapes is that a shape can refer to a different shape. When you group shapes, you can have the subshape reference a value in the top (group) shape. The downside is that if you ungroup, the references are destroyed.

So what does this have to do with beds? Well, one of my favourite examples of a smart Visio shape was the bed. Unfortunately, in 2013, it got messed up. It was “fixed” in 2016, but it lost some of its’ Visio smarts. Rather than one shape controlled by shape data it is now several shapes, King, Queen, Standard. The bed was a great example of a Visio shape. It was basically a rectangle with rounded corners and the only difference was the length and width. Which would be boring, but it used Visio smarts to have a blanket, turned down sheets and pillow(s).
Before I tried to figure out what was wrong with the shape I decided to find out if those were the only three sizes. I came up with forty sizes including, Bunk bed, California King, California Queen, Crib, Double/Full, Double/Full extra long, Eastern King, Euro King 200, Grand King, Half Queen/Split Queen, King, King Single, Long Single, Olympic/Expanded Queen, Queen, Queen RV, Single extra long, Small Double, Small Single, Split California King, Split Eastern King, Split Euro King 100, Split Euro King 90, Standard, Super King, Super Size Queen, Three Quarter, Twin/Single, Twin/Single extra long, Western King and Youth. Some of the sizes had multiple dimensions.
So, what was wrong with the shape? Other than being a bit more complex that it should, someone in attempting to modify the shape added an extra shape to the main group. I was able to delete this extra shape and the main shape returned to its’ original functioning.
So, how should the shape have been created? A basic Visio shape is limited to one colour, so there should have been a separate shape for the various areas that could have different colours, the pillows, blankets and sheets. In the original bed shape, it seems that it contains two grouped shapes, one for one pillow and one for two pillow. Each group seemed to consist of a pillow, blanket and sheet shape. I did not examine it closely, but that is how it appears. In which case, that would be over kill. I also prefer grouped shapes to use their User sections as an interface to other shapes in the group, so if the group is ungrouped, the formulas are not destroyed and the references in the User cells can be reestablished. I would also replace the use of theme colours with user chosen colours for blanket, sheet and pillows. Using a right click to select the size rather than Shape Data would also be a nice touch.

At some point, I will update the original shape to include right click behaviour and colour selection and post them in the Visio gallery.

So what other shapes are similar, but only differ in overall dimensions? Pool tables! As far as I can find out, there are only four or five sizes. The edges are a standard width and the holes are a standard size. So a pool table would be an ideal candidate for a Visio smart shape. Colour schemes are easy too, green cloth and black rails.

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Written by johnvisiomvp

March 22, 2017 at 8:54 pm

Posted in Shapes, Uncategorized

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 ,

Friendly Visio Stencil

with 2 comments

I am working with a stencil that contains almost 400 shapes and it is far from friendly. Normally a new stencil will show the icon for the shape and its’ name. With this project, the name is far from helpful. Undecypherable is more appropriate. If you right click the band at the top of the stencil window, you are given a choice for View of Icons and Names, Names Under ICons, Icons Only, Names Only and  Icons and Details. The last looks tempting, but there is no such cell as Details. What it is, is … Icons & Names over a prompt.
stencil2
Luckily there is something in the master called prompt. Now, of course, populating that field for almost 400 masters is not trivial, or is it? Back in the days of Visio 3.0, Visio was the first non Microsoft company to fully implement VBA, including the macro recorder. So, it should just be a matter of a few lines of VBA code. It does help if the shape does contain some text that can be used. In this case, I have a Shape Data field called Description that contains the necessary text.

Public Sub EditMaster()
Dim vsoMaster As Visio.Master
Dim vsoCell As Visio.Cell
Dim vsoShapes As Visio.Shapes
Dim vsoShape As Visio.Shape

For Each vsoMaster In ActiveDocument.Masters
If vsoMaster.Shapes(1).CellExists(“Prop.Description”, 0) Then
Set vsoCell = vsoMaster.Shapes(1).Cells(“Prop.Description”)
vsoMaster.Prompt=
Replace(Replace(vsoCell.ResultStr(Visio.visNone), “””, “IN”), “&”, “&”)
End If
Next vsoMaster
End Sub

A few things to note;
– The original text for the field came from XML, so there is a little playing to handle the abbreviation for inches and the ampersand. Luckily I did not have to deal with feet. 😉
– Only masters that have a shape data of Description are changed, all others are left alone.
– for those familiar to using VBA with masters, you do NOT need to wrap the code with an Open / Close that is required when modifying other fields in a master.
Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Written by johnvisiomvp

October 9, 2016 at 4:52 pm

Posted in Shapes, VBA, Visio

Tagged with , ,

Visio – Making a point

leave a comment »

Visio does have a tool for adding Connection points, but it does not have a tool for nudging that point if you missed the first time or decided at a later date you anted it elsewhere. Normally, Visio Connection points are simple, middle of the shape, one of the corners or the center of one of the sides. Once you get into creating Visio shapes, the Connection point can be anywhere.

In my current project, I am dealing with shapes that connect to tubing. On the surface, this seems like a simple task. The connection point should be centered on the tube. Unfortunately, to create the shape involves a lot of unioning joining and other operations. I could leave the shape as a collection of basic shapes so the tube connection stands out, but that would mean a complex shape with poor performance.

In the Connection sections, the Connection points are positioned at a percentage of the Width and a percentage of the Height. So, simply playing with the scaling factor is a hit and miss operation. The movement by tenth of an inch may have radically different scaling factors for different shapes. Basically, a lot of playing to get it right.

My solution is to create a new shape that when dropped on the shape that needs adjustment would expand to the height and Width of that shape and display a control handle with a bullseye. You can then use the control handle to position the bullseye to the location of the Connection point. At the same time as you are doing this, the shapesheet for the shape is open in a different Visio session at the Connection section. Next to the bullseye would be the scaling factors for that position. So, it would be a simple matter of copying the values to Connection points in the other spreadsheet.

I have created this Connection tool and will be publishing it next week to the Visio Gallery.
John Marshall… Visio MVP Visio.MVPs.org

Written by johnvisiomvp

August 3, 2016 at 8:51 am

Posted in Uncategorized, 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 ,