Home » Electrical & Electronic, Power User, Shapes, ShapeSheet

Truly “No-Glue-To” Shapes

no-glue-to-thumbSometimes you really need shapes that can’t be connected to. While Visio has settings in the UI for doing this, they don’t fully work. This article will show you the workaround!

While every shape in a diagram should be noticed, cherished and nurtured, some elements of a diagram should be completely ignored by Visio’s dynamic connectors.

This article discusses how to make shapes “unglue-able”. Visio’s user-interface has settings to “mostly” do this, but there is one nagging issue that is arguably a bug. When a connector is duplicated via Ctrl + Dragging, it will still glue to a shape, despite setting the various “don’t glue to” settings (steps 1 and 2 below). To workaround this bug, step 3 below must be done in the ShapeSheet.

So for the impatient-and-experienced amongst you, here is the quick recipe to make a shape “truly no-glue-to”:

  1. Set Developer > Behavior > Layout tab > Placement Behavior to “Do not lay out or route around”
    (ShapeSheet: Miscellaneous.ObjType=4)
  2. Turn off “Snap to member shapes” )if the shape is a group)
    (ShapeSheet: Group Properties.IsSnapTarget=FALSE)
  3. Set GlueInfo.GlueType = 8
    This works-around the issue where Ctrl + Drag duplicates of connectors from glue to shapes despite the proper settings.

For the rest of you, the full story follows below!

Connected Diagrams with Title Blocks & Frames

The classic example that I run into a lot when doing work for customers is the title block and frame situation.

Customers need special, company-specific frames and title blocks, which I create for them. Many have fancy behaviors, such as snapping to the bounds of the page, showing the drawing scale automatically, in a standard format, elements that stay the correct size no matter what page the scale is at–the list goes on. At any rate, they’ve got frames around the page, and title blocks with lots of elements on one or two sides of the drawing.

Below is a mock-up of a typical case. I’ve shown the drawing frame and title block with blue lines and fills. The meat of the drawing is the schematic I/O blocks. You can see that some of the individual ports have been “wired” together. This is done by gluing dynamic-connector-ends to the connection points on the outside of each port (you can’t see the connection points until you hover near them with the Connector tool.)

no-glue-to-frame-and-title-block

If the customer is creating any kind of connected diagram, such as the one above, and these shapes are going to be inside a frame or near the title block, then I have to take special care to set up these shapes so that connectors can’t glue to them.

The Default Problem

If you just draw a frame and title block, and perhaps group them together into a single shape, things will go wrong quickly. A default shape–drawn with the drawing tools on the Home tab–will accept an incoming connector. So now you’ve got this frame shape that encompasses nearly the entire drawing page. No matter where the connector goes, it will try to snap and glue to the frame.

Note: the frame in this example has No Fill, but nonetheless, Visio sees it as a target for gluing connectors.

Now, if you’re accurate enough with the mouse to find connection points on the I/O ports, then you will be OK. But if you need a free-standing connector–say it is a work-in-progress and doesn’t have a target port yet–then you’re out of luck.

Also, the frame will flash green (or red in older versions of Visio) as you move the Connector tool around the page. This will likely drive you insane.

This animation illustrates what happens:

no-glue-to-demo

 

One simple solution is to place a title blocks and frames on background pages. In many cases this solves the problem. However, situations where it doesn’t work include:

  • Document has pages with different sizes and orientations, so separate background pages are needed for each size-orientation pair.
  • Title block information is page-specific, so blocks need to be on the target pages.
  • Different page types might use different standard title blocks and borders.
  • Foreground page information doesn’t always show through from background pages. You can insert smart text fields on background pages, for example page number. The number will update independently for each foreground page that uses the background page. But for more complicated fields that involve ShapeSheet calculations–such as drawing scale–the foreground page updating fails.

Visio’s Built-in “Almost” Solution

Fortunately, Visio has a setting in the user-interface that remedies the situation…almost. To get connectors to ignore your frame and title block, try this:

  1. Select your frame or title block or both.
  2. Make sure the Developer tab is showing.
  3. Go to: Developer > Behavior > Placement tab
  4. In the Placement behavior drop-down, select Do not lay out and route around
  5. Hit OK

no-glue-to-placement-tab

Your shapes will now, for the most part, be ignored by connectors.

The first problem involves gluing to subshapes.

If your to-be-ignored shape or shapes have subshapes, then the Connector tool will find them and try to glue to them. You’ll notice the green highlighting as you move the mouse about.

You can fix this, using the same dialog as before. Go to the first tab, Behavior, then uncheck Group behavior > Snap to member shapes in the lower-left corner:

no-glue-to-placement-snap-to-members-2

Voila! Your shapes will no longer be targeted by the Connector tool. And connecting your other shapes will be much easier, and a lot less distracting.

We’re Not Out of the Woods Yet!

Ok, walk back on the stage, and pick the microphone back up!

You can draw an unattached connector. You can leave one and free, and glue the other to a port’s connection point. You don’t have all that annoying highlighting/flashing as you move the Connector tool cursor over title block elements and over the frame. Life is good. What could go wrong?

Try this:

  1. Draw a free-standing connector
  2. Duplicated by holding down the Ctrl key as you left-click-drag that shape.

POOF! The resulting duplicate connector glues to the frame! Ooops! Same old, weird highlighting and gluing behavior:

no-glue-to-ctrl-drag

This only occurs when you specifically Ctrl + Drag a copy of a connector. While that doesn’t sound so bad, it can be really, really strange if you are zoomed in. The connector that you allegedly just drag-duplicated will disappear before your eyes! You’ll have to zoom out to find it, and even then, it might just be a single point, if both ends happen to glue to the center of the frame!

The Last Mile

I have found that one more setting will fix this last problem. You have to go into the ShapeSheet to do it, but it’s not hard.

Since you’ve already activated the Developer tab, you can now right-click your shape, and choose Show ShapeSheet.

As you scroll down through the ShapeSheet, notice that in the Miscellaneous section, the cell ObjType has been set to 4. This was done when you set the “Do not lay out or route around” setting earlier.

no-glue-to-objtype

Just below the Miscellaneous section, you’ll find Group Properties (if your shape is, in fact, a group!) Notice that IsSnapTarget is set to FALSE. You did this via the UI when you unchecked “Snap to member shapes” on the Behavior tab of the Behavior dialog:

no-glue-to-issnaptarget

The last, missing setting is only available via the ShapeSheet, and has yet to be set. Approximately 9 sections below Group Properties, you’ll find Glue Info. In this section, we need to set GlueType to 8, or visGlueTypeNoWalkingTo.

no-glue-to-gluetype

Once you’ve done this, your title block and frame group will be fully, 100% connector-proof!

Note: if you don’t find the ShapeSheet sections illustrated above, try this:

  1. Right-click inside the ShapeSheet window
  2. Choose View Sections…
  3. Ensure that Miscellaneous, Group Properties and Glue Info are all checked.

Make a Tool

The main reason I wrote this post is because I keep forgetting what that final setting is (I think I’ve written it down in OneNote, but I still have a hard time finding it via search…) So I figured I would create an article, then I’d know where to look!

I’ve also rolled it into one of the utility add-ins that I use for my own development. If you’re a coder, here’s a snippet that will make a selection of shapes “truly-no-glue to”. It’s a bit disheartening to look at after all the explanation in this article. It boils down to three settings, which you can set via the ShapeSheet, which can be automated in precious little code!

This sample is in c#, hopefully the VBers out there can mold it to do their bidding as well:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 // Get the Visio.Selection object - the set of shapes
 // selected in the active window:
 Vis.Selection sel = visApp.ActiveWindow.Selection();
 
 // Loop through each shape:
 foreach(Vis.Shape shp in sel)
 {
   // The secret missing setting that prevents
   // Ctrl + Drag gluing of connectors:
   shp.CellsU["GlueType"].ResultIUForce = 8; //...visGlueTypeNoWalkingTo
 
   // "Do not lay out or route around":
   shp.CellsU["ObjType"].ResultIUForce = 4; //...visLOFlagsDont
 
   // Uncheck: "Snap to member shapes"
   // Only needed for groups:
   if (shp.Type == (short)Vis.VisShapeTypes.visTypeGroup)
   {
     shp.CellsU["IsSnapTarget"].ResultIUForce = 0; //...false
   }
 }
 // Get the Visio.Selection object - the set of shapes
 // selected in the active window:
 Vis.Selection sel = visApp.ActiveWindow.Selection();

 // Loop through each shape:
 foreach(Vis.Shape shp in sel)
 {
   // The secret missing setting that prevents
   // Ctrl + Drag gluing of connectors:
   shp.CellsU["GlueType"].ResultIUForce = 8; //...visGlueTypeNoWalkingTo

   // "Do not lay out or route around":
   shp.CellsU["ObjType"].ResultIUForce = 4; //...visLOFlagsDont

   // Uncheck: "Snap to member shapes"
   // Only needed for groups:
   if (shp.Type == (short)Vis.VisShapeTypes.visTypeGroup)
   {
     shp.CellsU["IsSnapTarget"].ResultIUForce = 0; //...false
   }
 }

 

Now to remember where I put the tool…

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 lang=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" extra="">

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

*