Access Visio UML Properties through VBA 
Author Message
 Access Visio UML Properties through VBA

I would like to be able to do this as well.  MS does not support access to
the UML object model - that is the UML Navigator and all of the well parsed
class infomation it contains.

However, the Visio object model is still there and you can get at it.  All
depends on what you want to do.  I have found that some of the UML stencil
behavior modifies the usual Visio OLE behavior, and that can be frustrating.

In short, you can get all of the class shapes dropped onto the pages in your
Visio document.  The class shape is made up of several shapes, 9 I think.

For each of the pages in your document
   For each shape on the page where shape.Master.Name = "Class"
      ClassName = ClassShape.Shapes( "Name").Text

It is a little harder to get the attributes and operations.  You have to
parse the text from the appropriate shape:

      ClassShape.Shapes( "Attributes").Text, and
      ClassShape.Shapes( "Operations").Text

I had more trouble with the reverse direction, that is dropping shapes onto
my drawing programatically.  It seems that the class disappears from the
document, but it is added into the UML Navigator.  But this behavior does
not seem to be consistent - sometimes I did get a visible class.  When the
class was not visible, it was still there if I drilled back into the
automation object model - so it's just not visible (although the visible
property is True).  I was able to change the class shape text, and thus the
class name.  But changing the attributes and operations text did not work.

If you want more detailed code, let me know.

Vince Nibler


Quote:
> Hi there

> Does anyone have an Idea how I could access the UML
> Properties of a Static UML Diagram using VBA??

> Or any other Way of doing that?

> Many thanks



Sat, 26 Jun 2004 05:12:56 GMT  
 Access Visio UML Properties through VBA
Your instructions to navigate from a class to its attributes and operations
worked.

Do you know how to navigate from an object to its classifier in a sequence
diagram?

Lachlan


Quote:
> I would like to be able to do this as well.  MS does not support access to
> the UML object model - that is the UML Navigator and all of the well
parsed
> class infomation it contains.

> However, the Visio object model is still there and you can get at it.  All
> depends on what you want to do.  I have found that some of the UML stencil
> behavior modifies the usual Visio OLE behavior, and that can be
frustrating.

> In short, you can get all of the class shapes dropped onto the pages in
your
> Visio document.  The class shape is made up of several shapes, 9 I think.

> For each of the pages in your document
>    For each shape on the page where shape.Master.Name = "Class"
>       ClassName = ClassShape.Shapes( "Name").Text

> It is a little harder to get the attributes and operations.  You have to
> parse the text from the appropriate shape:

>       ClassShape.Shapes( "Attributes").Text, and
>       ClassShape.Shapes( "Operations").Text

> I had more trouble with the reverse direction, that is dropping shapes
onto
> my drawing programatically.  It seems that the class disappears from the
> document, but it is added into the UML Navigator.  But this behavior does
> not seem to be consistent - sometimes I did get a visible class.  When the
> class was not visible, it was still there if I drilled back into the
> automation object model - so it's just not visible (although the visible
> property is True).  I was able to change the class shape text, and thus
the
> class name.  But changing the attributes and operations text did not work.

> If you want more detailed code, let me know.

> Vince Nibler



> > Hi there

> > Does anyone have an Idea how I could access the UML
> > Properties of a Static UML Diagram using VBA??

> > Or any other Way of doing that?

> > Many thanks



Sun, 29 Aug 2004 20:19:33 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Access Visio UML Properties through VBA

2. Accessing UML properties through VBA

3. Accessing UML items in Visio 2000

4. Access to UML objects through VBA

5. VISIO UML Object Model

6. VB 6 Visio UML Add-In

7. Visio & UML

8. UML, visio and the Repository

9. visio diagram to XML / creating textfiles with VBA in Visio

10. How to get access to Visio predefined macro from VBA

11. Accessing Items in a Visio Group via VBA

12. How to access all records with VBA in Visio

 

 
Powered by phpBB® Forum Software