How to set _walkglue, BegTrigger, EndTrigger, Shape Name from linked excel data

Started by mfilsht, August 27, 2017, 04:19:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mfilsht

Hi,
I am trying to get a bunch of shapes imported onto a page, and i want to import a connectors as well.  This way i can automate the process, because it involves hundreds of shapes that have different interconnections.   The visio wizard for flowchart could have worked but  it forces things into a flowchart diagram and i need to link data to a timeline diagram.  If i use a flowchart diagram then i have trouble dropping timeline elements onto a timeline.

In any event, i thought of preconfiguring data in excel/access to reference the correct shape names and then when imported into excel, use a connector master with  guard(_walkglue,begtrigger, endtrigger) and to configure the GlueInfo section to reference the correct shapes to connect.  I tried to manipulate the fields manually and it worked...  BUT
1. but how to configure the formulas to pull the correct references from shapedata into the GlueInfo   _xFTRIGGER(shape1!eventxfmod) and xftrigger(shape2eventxfmod)
2. how to automatically set the shape name from the imported shape data  so it could later be referenced in those formulas.

I hope i make sense.

thank you!

Yacine

Yacine

mfilsht

Quote from: Yacine on August 27, 2017, 08:06:13 PM
Can you send a picture of the desired diagram?

the goal is to import a lot of shapes that have different types of relationships between each other...

i need to be able to assign different types of relationship/connectors to different layers (I am trying to figure out a way to select multiple relationships with the same label, but so far can't figure it out)

I used the flowchart import tool, and i added 2 next step ids and 2 next step labels to create 2 relationships...   

this is just a sample, as the final one will have a few more per each shape...

Yacine

Interesting task ... with a looot of wishes.  ;)

1) automatically linking items.
The first idea to store the connection data (from / to) in the item itself is bad because the connection has extra properties and there can be several connections from one to other shapes.
The modeling would be too complex.
Better: separate the connections from the items by means of an extra table (ID, From, To, Label)

Now the system gets 2 masters for the diagram: the item and the connector.
The item master is simple and does just carry its basic data fields.

The connector master however triggers a macro that looks for all shapes with master = "item" and with a prop.ID = prop.fromID or prop.toID of the connector.
Making the connection itself is just a matter of copying the code generated by the macro recorder.

2) set automatically the layer, depending on the label of the connector.
Here you need a link between the label and a layer number.
This link is made by 2 semi-colon separated lists stored in the prop section of the page.
A formula in the connector shape looks for the position of its prop.label in the prop.labellist of the page, takes this number and looks for the nth element in the prop.layerList of the page.
This last number is then written in the layerMembership cell.

Done!

... and the macro:
Sub connect(connShp As Shape)
    Dim shp As Shape
    Dim fromID As Single, toID As Single
    Dim fromShp As Shape, toShp As Shape
    Dim t As String
   
    If connShp.CellExists("prop.from", False) Then
        t = connShp.Cells("prop.from").ResultStr("")
        If IsNumeric(Val(t)) And Val(t) > 0 Then
            fromID = t
        Else
            Exit Sub
        End If
    End If
   
    If connShp.CellExists("prop.to", False) Then
        t = connShp.Cells("prop.to").ResultStr("")
        If IsNumeric(Val(t)) And Val(t) > 0 Then
            toID = t
        Else
            Exit Sub
        End If
    End If
   
    For Each shp In ActivePage.Shapes
        If Not shp.Master Is Nothing Then
            If shp.Master.Name = "Item" Then
                If shp.Cells("prop.ID") = fromID Then
                    Set fromShp = shp
                End If
                If shp.Cells("prop.ID") = toID Then
                    Set toShp = shp
                End If
            End If
        End If
    Next shp
   
    If fromShp Is Nothing Or toShp Is Nothing Then
        Exit Sub
    End If
   
    Dim cell1 As Cell, cell2 As Cell

    Set cell1 = connShp.CellsU("BeginX")
    Set cell2 = fromShp.CellsSRC(1, 1, 0)
    cell1.GlueTo cell2

    Set cell1 = connShp.CellsU("EndX")
    Set cell2 = toShp.CellsSRC(1, 1, 0)
    cell1.GlueTo cell2
       
End Sub
Yacine


mfilsht

It took me a few minutes to realize that you actually set up the entire drawing for me.  You are an amazing human being.  Thank you!

mfilsht

Hi,

I've succeeded in adding shapes and connecting them.  THANK YOU!!!

2 quick follow ups.

1.  what are the correct steps to add more labels.  (obviously, i add them in the data source, what needs to be manually adjusted in the page/shape shapesheets? I don't want to break anything)
2.  i need to create multiple additional layers and be able to assign the items on the page based on additional shapedata that will be imported...

a bit of bigger picture:
there will be many hundreds+ of additional shapes on the final diagram (illustrating entanglement of multiple complex networks, spanning from micro-relational-identities to global socio economic networks and the human superorganism, and local and non-local competition and cooperation patterns from which it all arises, etc..), and i need to be able to add a field in the data source which will assign the [item]/[connector(s)] to a specific scenario(s) (layers), which i will then "turn on" or "turn off" to illustrate various "What if" scenarios...
Lets say:
standard model (lvl1) will include active human agents and their "competitive interaction" (click, everything is disable except these systems and their competitive connectors)  OR lvl2 "cooperative interaction" (click, .....)
OR
unified model will illustrate emergent(parent) systems that arise from subsystem interaction and their competitive/cooperative interaction with other emergent networks... (click, all non-emergent systems disappear and only the relevant stuff stays..)

Technically, I think that by adding a field to an ITEM/CONNECTOR that will indicate its membership in one or more LAYERS that are meant to illustrate "Scenarios", I'll be able to achieve this...

I hope I am being clear..am I?

Yacine

Hi mfilsht,
from what I read, you're on a project that is not yet completely defined. A LOOOOT of specifications will change very soon (or later). So you need a very flexible and robust concept.

From my perspective you should not try to manage visibilities with layers. Visio's layer model is very poor.

Instead of having a layer for every parameter that will occur, you should concentrate on the very basic functions of the layers, namely
- regular --> no handling at all
- invisible --> as the name says. Usefull for printing
- visible but locked --> the locked items are visible, but cannot be selected, nor do connectors snap on them. This is for editing the complex diagram

The membership to a layer should be done outside of Visio (Excel, Access) where you have more flexibility to modify the layer's visibility depending on the requirements of the moment.

Have the layer membership depend on a property field and update the original data and the field whenever you need.

----

The representation (formatting of the shapes and the connectors) would be next task to accomplish.
The lazy method would be to alter the individual properties of the shapes directly. LineWeight, FontName, etc. But what when you want to alter a property, you haven't thought of at the moment of the development?
The more generic approach would be to use styles. unfortunately the shapesheet doesn't support them, but VBA does. They are divided in text, line and filling and cover almost every aspect a shape's formatting.
Looking at your description, It think that it would be worth to investigate this option, so as to have a styles management system ...  and depending on your needs, you would adjust not one, but whole set of properties of shapes.

My 2 cents,
Y.


Yacine