create switchable layer option from excel to whole group of linked shapes

Started by kiler40, November 20, 2013, 11:39:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kiler40

Hello All
From some time i`m trying to automatically create some sort of a network but have no success.
Let me explain it more easy
Here is the file.
https://dl.dropboxusercontent.com/u/10255673/BOARD-electric.vsd
It`s done by hand. and it was a big play with layers and shapedata for hiding them.

Now my idea is:
shape with the number (in the file "Kon.num) to have a connection line that can be moved and linked to  a NOD shape
And when is connected, the node shape gets the information in what layers the numbered shape is related.
Same works with the NOD shape - link with same type of connection line link to another NOD and sends the layers information.

But then again comes another issue.
While you build the network, there is no information for the layers. You need to add it after that. And with this - all need be updated automatically....
seems like a huge mess i know...

But really. From my understandings Visio is really powerful for creating network diagrams... and this for me is a big network.
And this VBA - it is like black sorcery to me :(

Any one... please help

Andrei





Yacine

Hi Andrei,
nice work. I wonder what it represents.

The automation you describes looks (at a first glimps) reasonably easy.
What I miss in your drawing are custom properties for the shapes to categorise them. Or should their format (eg colour) be enough for a categorisation? A VBA routine would need it to set the right layers.

I also wonder whether there is a special meaning to the placement of your shapes? Otherwise, an automatic layout coupled with a database, could generate the drawing more or less automatically.
Yacine

kiler40

Hi Yacine,
Thanks first. This is a cars electrical system :) at least a study of it. The numbered shapes are end points. And the position of every one is predefined.
This was created long before i know what Visio is all about. And i think the first time I've met shapedata was to create different visible (or invisible) layers. And at that point i had no idea how to link data to shapes...
I have the information in excel - which end point is basic (every time present), which one is optional and different groups (called SPS1-2-3 etc)
But i wanted to see how this end points are distributed across the system. And how they are linked to each other.
I've found a solution called "graph" but it shows direct links (pretty awesome when it is interactive by the way) - but i wanted it with the nods and this precise layout.
And here comes the idea of the layers. And what i have explained. End point links to nod and gives the information of its layers. But in the beginning no layers are assigned.

I've been thinking that, at one point if you start from both ends, at some moment there will be 2 nods that will have to give to each other layers. i`m not sure how this is gonna work. But after all in the middle you have a backbone that is in every single system.
It is little messy maybe... :)

Yacine

Hi Andrei,
May I suggest the following approach?
A)   Forget about all the layers. Set up only ONE and call it HIDDEN.
Hiding shapes and connectors will then only be a matter of setting the layer of any of them to "Hidden".
B)   Next you would put proper custom properties in your end points, nodes and connectors. For example category, optional, location and so on.
C)   Then come 2 different strategies:
1)    Replace your connectors, by connectors capable of recognizing by themselves, to what shape they are linked. The last set connection would define the values of the connector (for resolving conflicts = one connector linking two different types of shapes).
I can provide some code snippets, that I gathered in this forum, if wanted.
2)   Leave the connectors as they are and set them to whatever property the below described filter requires them to be. This requires of course that you loop through all the connectors at run time. This second option gives you more flexibility, when filtering the view. (eg combining location, with a category and a group).
D)   Set up a VBA dialog (preferably non modal, so it can stay visible whilst you work). In it you would define which properties are to be visible/invisible. A VBA routine would then loop through all the shapes of the drawing and set accordingly the layer to nothing or to "hidden".
Let me know what you think of it.
Cheers,
Yacine.
Yacine

kiler40

Hi Yacine,
The second approach is more likely to be what i want. This filter option is going through my head from some time, but have no idea how to accomplish it.
OK. I`ll create an end point with different shape data fields.
I`ll give them names and leave fields for assigning to groups. But still don`t know how to give the options I've assigned to the connection nods, so they understand that they are connected to this shape.
And after that, this filter thing .... it sounds amazing but how to do it ?

By the way, thanks for the support !
Andrei

Jumpy

Point D in Yacine's solution could be to simply use the ShapeData of the page. Instead of a modal dialog you than use the ShapeData window. Via the Dependson-Function in some user defined cells you could watch for changes in the ShapeData and start macros accordingly.

kiler40

i didn`t really understand this... i`m not really experienced used...

Yacine

Hi Andrei,
It took me a while to understand the routine you wanted, namely parsing the way of connectors linking to shapes of the same kind and setting its layer.
It is indeed more complicated (but still feasible).
Meanwhile, I played a little bit with your approach and worked out a solution that should come close to what you initially asked for: setting the layers based on the data of the shapes. My solution does not hide unused branches, hope you can live with it.

The idea is to calculate the layer depending on a certain custom property.
The settings are in the shapedata of the page.

Cheers,
Yacine
Yacine


kiler40

Pretty cool !
The part with the line going out from the shape is something i really needed.
Can this line be individually editable ? or it is linked with the format of the shape?
But i don`t think it quite links to what i need.
I could`t figure out what is the purpose of the location option, and the second location "_VisDM_Locations"
And hiding the unused branches is one of the main issues for me.

Yacine

QuoteCan this line be individually editable ? or it is linked with the format of the shape?
This line is just part of the group. It is formated as straight connector. If you select it separately you can format as you like. The only restriction I made is to bind its layer membership to its parent's.
QuoteBut i don`t think it quite links to what i need.
I didn't get this one. What do you mean?
QuoteI could`t figure out what is the purpose of the location option, and the second location "_VisDM_Locations"
"Location" was just meant as a random property (location of the element in the car. The "_VisDM_Locations" was set be visio itself, when I tried linking to a wrong spelled field (locations instead of location).
Quotehiding the unused branches is one of the main issues for me
Well, writing a full duty graph tracer will be a little bit trickier. I'll keep that in mind.
We may think about a "human" assisted algorithm. I mean, to let the user for example define a root point from which all the branches diverge. That would simplify the task considerably.
Yacine

kiler40

First of all, thank you for your help and your responses ! I really appreciate your help.
QuoteThe "_VisDM_Locations" was set be visio itself, when I tried linking to a wrong spelled field (locations instead of location).
This is something that is out of the topic, but have come through my head lots of times. Can I deny Visio for giving new Shape data field when linking to data that is not in the shape?


QuoteBut i don`t think it quite links to what i need.
Forgive me. I've messed up a little bit my message... I`m saying that my problem is with hiding the unused branches.

For the hiding part: Not all branches diverge from a single point and there are diverge points that are linked to other diverge points. This is the main part of the problem that bugs me most :(
For the human algorithm - It was in my head some time ago. something like tracing the road with the mouse and this selects everything that the mouse have gone through (something like the lasso select, but the lasso needs to round the selection )
And this is going little far from automation but still  is some sort of solution






Yacine

Working on your question I found this very nice work from Al Edlund, featured by Chris in this article
http://www.visguy.com/2009/04/08/path-analysis-in-visio/
This should be the way to go. Not sure if it can be used as it is, or if a more generalised set of functions needs to be derived from it in order to use it in any arbitrary solution.

Great Work Al!
Yacine

kiler40

it took me some time to look in it... and really cant figure it out how to deal with the file.
But as far as i understand it is something that i need.
Little more help please...  :-\