Visio Insights
The official blog of the Microsoft Visio product team

Gluing It All Together

Gluing It All Together

  • Comments 11

This is the third topic in a series discussing the essential features that make up the Visio application.

 

Essential Feature:  Connectors

The fundamental drawing type in Visio is the flowchart - a collection of boxes connected together by lines.  When Visio was first introduced, drawing programs mostly worked with geometric primitives.  Boxes and connectors were just sets of lines, with no intelligent behavior.  If you wanted to move a box to a new location, you also had to redraw the connecting line to make it reach the box again.

 

To avoid the tediousness of fixing up drawings, Visio introduced a pair of diagramming innovations: connectors and glue.  A connector is a one-dimensional shape consisting of line segments.  Each endpoint is attached to a two-dimensional shape (the box) using glue.  When the box is moved to a new location, the connector stays attached and stretches as needed to maintain the connectivity between boxes.  Visio chooses the route the connector will take between its endpoints.

 

 

Connectors have intelligent routing behavior.  They will avoid other shapes on the page where possible.  They will even show line jumps (or line breaks) where they cross over each other.  When you do choose to override Visio, you can easily control the connector path using green handles found on the shape.

 

The default connector in Visio is the Dynamic Connector, which is the shape created by the Connector Tool.  However, any 1-D shape can be used as a connector.  You can turn an ordinary line into a connector by changing the ObjType cell in the Shapesheet from 0 to 2.  You can also make your own connector master shape.  If you name your master "Dynamic Connector", Visio will use it when you draw with the Connector Tool.

 

There are some other interesting behaviors when using the Connector Tool in conjunction with masters in the Shapes window.  Try this:  Select an existing shape on the page.  Then switch to the Connector Tool and drag a master shape out onto the page.  Not only is the shape added, a connector is created and glued between the existing shape and the new shape.  You can also make Visio use a different connector shape with the Connector Tool.  Switch to the Connector Tool, then select a 1-D master in the Shapes window.  Now draw a connector on the page.  Visio uses the selected master instead of the Dynamic Connector.

 

The Dynamic Connector is itself a master.  It's built into Visio.  The first time you draw with the Connector Tool, Visio looks for a master named "Dynamic Connector" in the Document Stencil.  If no master is found, Visio puts a copy of its built-in Dynamic Connector master in the Document Stencil (File > Shapes > Show Document Stencil).  You can edit this master to change the appearance of all connectors in the diagram.

 

There's a lot more that can be said about connectors and also glue, but those are the basics.  Connectors streamline the diagramming process by maintaining their connections with shapes and managing their routing automatically.

Leave a Comment
  • Please add 8 and 8 and type the answer here:
  • Post
  • "When Visio was first introduced, drawing programs mostly worked with geometric primitives.  Boxes and connectors were just sets of lines, with no intelligent behavior.  If you wanted to move a box to a new location, you also had to redraw the connecting line to make it reach the box again."

    I don't think so.  I hate to be picky, but "smart" connectors were available from a number of programs before Visio -- they date back all the way to Ivan Sutherland's original Sketchpad work in the early '60s.  If you wanted to claim that Visio brought this concept to the mainstream (non-CAD), perhaps I'd agree -- it's a tough call and I can't remember when Powerpoint added connectors.

    There is a rich tradition of using constraints of various sorts to maintain graphical connections and relationships between objects -- you may want to look for papers on ThingLab (Borning), Garnet/Amulet (Myers), subArctic (Hudson), ArgoUML, HotDraw, Juno, and others. Not to mention CAD programs like Ashlar's Vellum.

    Visio is a great product, but it serves no one to make blanket statements that simply aren't true.


  • Our TaskMap application includes a customized dynamic connector in the stencil. I would love to have our connector become the dynamic connector for the connector tool but can't rename it to "Dynamic Connector" because our COM add-in takes various actions based on the current name of the master.

    Is there an alternative way to tell Visio that our connector is the one, true Dynamic Connector?
  • Ken:  
    Thanks for the info. Yes, there were many other drawing programs out there, especially in the CAD space that offered similar functionality.  Usually I talk about Visio in terms of the Windows-based drawing application market but did not qualify the statements here.

    Scott:
    There is a registry key pair to specify your own dynamic connector, but I have not experimented with this personally.  The keys are HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Visio\Application\DefaultConnectorFile and HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Visio\Application\DefaultConnectorName.

    - Mark Nelson -
  • Thanks Mark. I realize you probably live full-time in Vis2007 land these days, and the registry keys you mentioned are for Vis2007. I was hoping for something that would work with Vis2003 so I tried what you suggested but changed the version to 11.0. The two keys you mention were not present but I created them, however, Vis2003 appears to ignore them (assuming I created them correctly).

    Can you confirm whether these keys should work with Vis2003?
  • Good catch, Scott.  Yes Office 2007 is version 12.0, so you need to use 11.0 for Office 2003 (or Visio 2003).

    If you don't see the registry keys by default, you can go into Visio and choose Tools > Advanced > Put all settings in Registry.  But even if you don't do this, you can create the keys yourself.  One caveat when modifying the Registry is that the Visio application must NOT be running.  Otherwise, Visio will overwrite your edits when it quits.

    Here are the steps I did on Visio 2003:
    1) Launch Visio and start a new blank drawing
    2) Draw a connector on the page using the Connector Tool
    3) Go to File > Shapes > Show Document Stencil
    4) Click on the Dynamic Connector master to rename it to "MyConnector"
    5) Double-click on the master to customize its formatting or add special properties
    6) Close the editor and save the drawing as "MyConnector.vsd"
    7) Shut down Visio and open the Registry
    8) Go to HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Visio\Application and create a new string value called DefaultConnectorFile - or use the existing key if it is there.  Enter the full path filename for MyConnector.vsd as the value.
    9) Create a new string value called DefaultConnectorName - or use the existing key if it is there.  Enter MyConnector as the value.
    10) Restart Visio and begin a new drawing
    11) Use the Connector Tool to draw using your custom connector.

    For those using the Visio 2007 Beta, some of the formatting customizations do not work.  We are working on a fix for this issue.

    - Mark Nelson -
  • Excellent, Mark! Thanks for confirming that this would work with Visio 2003. I adapted your procedure so that I could incorporate my existing, previously customized dynamic connector, and the result is what I was hoping for.

    You do realize, of course, that having this new capability available inevitably leads to more questions...

    1) Is there a way to assign priority to the connection points on a shape so that autoconnect will attach to the highest priority connection point first?

    2) Is there a way to limit the scope of the dynamic connector registry change? Ideally, I would like it to work only in drawings based on my template so users don't have my dynamic connector appearing in drawings that have nothing to do with our application. I suspect the answer is no, short of having our code change the registry entries on start up and shut down, but thought I'd ask.

    Thanks --
    Scott
  • I make a diagram with some shapes. If I choose to draw the connectors myself, they are never straight. If I use the "dynamic" connector the lines are straight, BUT if I need to rotate the image (The WHOLE image) all the connectors reroute themselves and the drawing looks like crap. I have tried locking everything except rotation and rotating it, nope.
  • Unfortunately connectors are designed to route horizontally and vertically with the page, which can create problems with rotated shapes.  You might be able to remedy this problem by right-clicking on the connector and choosing "Straight Connector".

    Mark
  • PingBack from http://www.keyongtech.com/2382838-how-to-control-the-ruoting

  • Is my understanding correct?  Using Visio 2007, you cannot create a connector and manually move and rotate it.

  • How do I turn auto connector routing off? When I group then rotate all the connectors move!

Page 1 of 1 (11 items)