Creating UML \ Organisation Shapes from C#\VB .NET

M

Michael Hall

Hi,

Ok if this is a stupid\dumb\easy question please feel free to call me a "noob"

I have been searching for a way to creat UML and Organisation structure
shapes from code.

Currently I am running Visio invisibly in my C# utility. This utility takes
a text file (which describes the layout of a uml diagram) and should create
the diagram in visio and save it as a visio diagram.

The program does some of this, but currrently I am using the DrawRectangle()
and DrawXXX() methods to create the shapes. What I would like to know is how
do I draw UML objects? There are no DrawUMLClass() methods or anything :-(

Please please help!, Cookies go to the person who helps!

Michael Hall,
IQ-Systems
 
C

Chris Roth [ Visio MVP ]

You use master shapes that either you create yourself, or you get from the
Visio UML solution files.

A stencil is the green thing, and is saved with a .vss extension. It's just
another Visio document, from an automation standpoint.

You "instance" masters on a page using the Drop method. That creates shapes
on the page.

Code fragments (VBA for quick and easy testing):

Dim visStn as Visio.Document
Set visStn = Visio.Application.Documents.Open("My Uml Shapes.vss")

Dim mst as Visio.Master
Set mst = visStn.Masters.ItemU("Bob the wonder-UML shape")

Dim doc as Visio.Document
Set doc = Visio.Documents.Add( "MyUMLTemplate.vst" )

Dim shp as Visio.Shape
Set shp = doc.Pages(1).Drop( mst, 4, 5 )

--

Hope this helps,

Chris Roth
Visio MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top