I'm working with a complex diagram with a few layers of information. I'd like to hide/show a specific relationship line type, print the diagram into the word document and then repeat with another line type. I can't seem to find any way of calling the show/hide function from within VBA and I was wondering if anyone has tried to do something similar.
Eventually I'd like to be able to do the same thing with Analytics: run a series, dump the diagram to word, repeat.
Any thoughts on either or another approach to get the different views? Is there somewhere I can access more info for the built-in VBA macros, like this?
Pinned topic Programmatically Show/Hide Relationships
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-03-01T13:28:36Z at 2013-03-01T13:28:36Z by SystemAdmin
Re: Programmatically Show/Hide Relationships2013-02-21T16:10:49ZThis is the accepted answer. This is the accepted answer.The function you are looking for is certainly a good idea, and probably should be submitted as a Request For Enhancement (RFE)to the IBM developers. I'v had this on my own list of things to do. This function can make a very complex/busy diagram very simple to read depending on the audience.
The Visio folks figured this out, why not IBM? ;)
I would think VBA could do what you are asking by looping through all the symbols of a certain type and toggling their show/hide/visible = true/false properties. Also followed by a .save/.refresh of the workspace. If I figure out what this loop routine is, I'll post it back up.
Re: Programmatically Show/Hide Relationships2013-02-27T04:10:26ZThis is the accepted answer. This is the accepted answer.Well, without this functionality I programmatically paint unnesessary line in to white :) Before close diagram - programmatically paint back all lines into black. Simple, but not exactly what you need.
Ch3 270003PHTY26 Posts
Re: Programmatically Show/Hide Relationships2013-02-28T16:45:19ZThis is the accepted answer. This is the accepted answer.Solved.
Thanks everyone for your suggestions, in order to complete this without user input I had to go through each line on the diagram. On the plus side the diagrams are able to be opened as read-only so we shouldn't have to worry about other users locking the diagram (** hasnt been tested).
- Show Diagram that you want to adjust (must be on screen)
- use diagram.getFilteredSymbols as needed to call out each type of relationship to show/hide. (you'll need to use multiple times)
For each Symbol in the collection, use: symbol.SetField(SYMFLD_BHIDDEN, x) where x = "-1" for hide, "0" for show.
- Note: this field is undocumented in the online help and I discovered it through the VBA reference and through trial and error.
Draw the Diagram. I had to do some adjustments here to make sure that it would work. Couple of key points:
- BMP generation works fine, a new file is created each time it's generated. (at least in my code)
- WMF file MUST be regenerated before using it. Which means that the diagram must remain open to generate this file. **
- Hide the Diagram
I'm really enthusiastic about this development. It effectively allows our organization to create a really complicated network diagram with multiple views (e.g. comms, monitoring, sec, etc) on a single diagram and reprofile it based on what view we'd like to generate. Saves us from creating the same diagram multiple times, for each view, and having to sync them.
/**note: seem to be having a weird issue on one of my diagrams ever since I generated a WMF in the temp folder. It always registers a change when opened and requires a save to close. Couldn't repeat effect on other diagrams so it could be/ should be unrelated.