Welcome to MSDN Blogs Sign in | Join | Help

Visio: Topology Drawing Automation with Microsoft Automatic Graph Layout

GLEE -> MSAGL

Microsoft Automatic Graph Layout (MSAGL) is the successor to GLEE and now have received permission to use the MSAGL binaries in the sample code for VisioAutoExt, I've dropped GLEE support and moved completely over to MSAGL. The move to MSAGL was straightforward, but I also managed to improve the overall results of the topology being drawn (for example: now the connectors are one long Bezier curve in visio instead of multiple segments consisting of Bezier curves and line segments).

The new source is available on codeplex here: http://codeplex.com/visioautoext/

NOTE: You do *NOT* have to purchase a license to MSAGL to use this sample code in the project (which includes the MSAGL binaries).

A few words about Microsoft Automatic Graph Layout

  • This is a tremendous piece of work by Lev Nachmanson in Microsoft Research. The results it produces are stellar and because its written as a .NET Framework library incorporating into my code has been very simple.
  • If you are considering doing any graph layout, please check out MSAGL before you try to implement one yourself. You'll save yourself a lot of work and produce far better looking results by letting geniuses like Lev do the heavy lifting for you. So if you plan on doing any graph layout for your own projects or products, I recommend  going to Windows Marketplace and purchase a license.

Sample output

image

 

The code that produced that Sample output

 

You can find this in the VisioAutoExt project called DemoMSAGLToVisio

 

//------------------------

this.m_graph = new Microsoft.Msagl.GeometryGraph();


MG.Node DC = this.AddNode("Domain Controller", 30, 40, TopologyMasters.DirectoryServer );
MG.Node Server1 = this.AddNode("My Custom\nServer1", 30, 40, TopologyMasters.Server);
MG.Node WebServer1 = this.AddNode("WebServer1", 30, 40, TopologyMasters.WebServer);
MG.Node Unknown1 = this.AddNode("Unknown", 30, 40, TopologyMasters.None);
MG.Node MediaFiles = this.AddNode("MediaFiles", 30, 40, TopologyMasters.FileServer);
MG.Node PurchaseOrdersApp = this.AddNode("Purchase Orders App", 30, 40, TopologyMasters.ApplicationServer);


this.Connect(DC, Server1, false);
this.Connect(Server1, Unknown1, false);
this.Connect(Unknown1, DC, false);
this.Connect(Unknown1, MediaFiles, false);
this.Connect(MediaFiles, DC, false);
this.Connect(WebServer1, DC, false);
this.Connect(PurchaseOrdersApp, WebServer1, true);
this.Connect(MediaFiles, WebServer1, false);

MG.Node DesignWks= this.AddNode("Product Designer\nWorkstation", 30, 40, TopologyMasters.Laptop);
this.Connect(MediaFiles, DesignWks, true);

//------------------------

Some improvements I'd like to make

  • More shapes
  • Fitting the boxes better to the shapes or even removing the boxes
  • Adding edge labels
Published Thursday, January 24, 2008 8:15 PM by saveenr

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# MSDN Blog Postings » Visio: Topology Drawing Automation with Microsoft Automatic Graph Layout

# Visio: Using MSAGL to Create Visio Flowcharts Programmatically

Inspired by Chris Roth’s post on creating flowcharts programmatically and my original post on MSAGL with

Wednesday, June 04, 2008 6:50 PM by Saveen Reddy's blog

# MSAGL DLLs

I couldn't find the MSAGL dlls in the source code.

Thursday, June 26, 2008 3:19 AM by Eren

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker