Has anyone had success with the Visio export?

Post Reply
EAJoe
Posts: 14
Joined: 04 Jan 2011, 14:28

I gave it a try, the python script runs w/o complaint and produces a VBScript, it does not produce any image files. I cut & pasted into visio, and again it runs w/o complaint, but a visio diagram is not produced.

I'm thinking that if no images are produced, that something had likely already gone wrong at that point?
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Hi, I haven't had a chance to try this out in anger yet.
I'm assuming that you've already been through these, but I thought it might be useful to have the README from the Visio Export module pasted in here.
Export to Visio: Generate a VBA script to recreate within Visio

How to use:
1. Run this file within the Protege script console using: execfile("<path to this file>\\visio_export.py"

2. What will appear is a list of the commands that can be used.

3. Run a command (e.g. allApp() ) by typing: allApp()

4. You will be prompted for a directory to output the script and associated files. Select a directory.

5. The processing will be finished when 'Finished writing Visio VBA code' appears. There may a message saying 'Warnings have been logged, type printWarnings()', ignore this at the moment.

6. There will now be a text file, and may be a number of images, in the directory selected in step 4.

7. Open the file 'Visio VBA.txt', select all and copy the contents.

8. Create a new Visio document, open it, select 'Basic diagram'.

9. Open up the VBA editor (type Alt-F11) If there are issues in opening the editor do a Google search on Visio developer mode.

10. Double click on the 'ThisDocument' file in the Project area in the upper left hand corner.

11. Paste the VBA code copied in Step 7.

12. Run the VBA code either with the Run button or with (F5). If prompted, choose the 'run' method to execute.

13. Switch back to the main Visio window, you will need to zoom out as there the diagrams will now be displayed.



Other commands:

In Step 3, there are other commands that can be ran which are either generic or prepackaged.

The generic commands are (with parameter description below):

startFromInstance(<classname>, <instance name>, [<depth>],
  • , [showInsOfIgnoredThatHaveConnected] ) : Start export from a named instance of a class.

    startFromASpecificClass(<classname>, [<depth>],
    • , [showInsOfIgnoredThatHaveConnected]) : Start export from all instances of the class.

      startFromAParentClass(<classname>, [<depth>],
      • , [showInsOfIgnoredThatHaveConnected]) : Start export from all instances of a class and its subclasses.

        Description of Parameters:
        classname: name of the to start with. If no specific instance name is given, this
        instance name: The name of a specific instance to start at.
        depth: (Optional) the maximum distance from the starting instance.
        list of clses to ignore: (Optional) A python list of class names to ignore.
        showInsOfIgnoredThatHaveConnected: (Optional, default False) True/False, show context of exported components by also including ignored instances that are directly connected to those exported.


        Prepackaged exports:

        showGroupLayout() -- show layout positions of groups
        allConceptual() - All of conceptual
        allLogical() - All of logical
        allPhysical() - All of physical
        allBus() - All business (conceptual/logical/physical)
        allApp() - All applications (conceptual/logical/physical)
        allInfo() - All information (conceptual/logical/physical)
        allTech() - All technical (conceptual/logical/physical)
        help() - this message



        Visio Notes:
        - Each instance is associated with a layer within Visio. The layers are named after the classes.
        - You can include a default directory for the output by assigning a directory to: defaultOutputDirectory on the script console.


        Warnings:
        - If the message 'Warnings have been logged, type printWarnings()', run the printWarnings() command.
        - This is to inform you of warnings to be cleaned up within Visio.



        Defects:
        - The arrow directions may not be correct.
        - There is an inconsistency in the background rectangle where it contains images.
Essential Project Team
Post Reply