Utilizing connection points

Started by ThirdDimension, November 24, 2015, 01:24:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ThirdDimension

I would like to understand connection points a little better. How does VISIO know if a connection is made to a connection point? 

3rd D

wapperdude

There are little minions running about who's sole responsibility is to test connection points and report these findings.  At least, that's what seems to happen, otherwise known as connection added and connection deleted events.  Try googling for either of those.  Don't recall seeing that on the forum.

Sorry for the humor, couldn't resist.   ::)

Wapperdude
Visio 2019 Pro

Yacine

#2
Hi 3rdD,
Every time Visio makes a connection it adds a connect object to the connects collection of the page.
There are several ways a connection can be made: https://msdn.microsoft.com/en-us/library/office/ff765922.aspx
If the connection is made to a connection point the property ToPart of the connect object is 100 +  the row index of the connection point.

Here's a code snippet, that can help you play with the properties of connections you make on your drawing.

Public Sub test()
Dim conn As Connect

For Each conn In ActivePage.Connects
    With conn
        Debug.Print .Index; " fromCell: ";  .FromCell; " FromPart: "; .FromPart; " FromSheet: "; .FromSheet
        Debug.Print "    ToCell: "; .ToCell; " ToPart: "; .ToPart; " ToSheet: "; .ToSheet
    End With
Next conn
End Sub


... and stay away from the Minions.
Cheers,
Y.
Yacine

ThirdDimension

Hi everyone,

I am finally getting around to working out a solution for this.  What I would like to do is control the line pattern depending on what the "wire" is connected to.

Right now, my wire shape is a custom shape that is configurable between singe and quad conduction with a right click option.  referring to the PNG file, shape "G001A22" can become the other three wire shapes below with a right click option.

I would like to be able to make this configuration happen automatically depending on the connections.  When I use 1 of the 3 multi-conductor wire setting, I will always glue this wire to a corresponding termination shape that indicates the termination of the wire.

For example, wire pattern G201A22 will always go to the custom termination shape that is currently glued to pins 1 and 2 on the connector (see attached PNG) and wire pattern G301A22 will always go to the custom termination shape that is plugged into pins 4, 5, and 6 on the connector.

So what I am looking to do is have the wire pattern automatically adjust when it is plugged in to the termination shape.   

Can anyone point me in the right direction?

thanks!!

3rd D

ThirdDimension

I would like to get into writing some VBA codes.  Can anyone recommend a good starting point?

Thanks


3rd D