Who's your neighbor: connectors, gluing, spatialneighborhood

Started by wapperdude, September 09, 2014, 06:12:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wapperdude

Another post on the topic of connectors and gluing and finding closest connection point.  This also originated in another post.  The attached file demonstrates how a bunch of connectors, not glued to any shape may easily be re-glued.  I've also incorporated two additional macros to establish a list of connectivity from previous developments.

Since it is quite possible that neither connector end may be glued, that prevents the use of the connects collection as a means of search.  Additionally, the spatialneighbors methods cannot be restricted to just end points.  Thus, a connector that may route near an unrelated 2D shape would be "passing thru the neighborhood".  But, the method does minimize the potential candidates, which then allows a methodical evaluation of connection point locations to see which may be within the desired spacing of either end of the connector.

The two other macros use either the Shapes.connects or Page.connects collections to generate a report showing connectivity after running the gluing macro.  These were kept distinct to allow easier code investigation.

Enjoy.

Wapperdude
Visio 2019 Pro

wapperdude

Ooops...found minor error in the glue code.  In the "IF" statements for checking the location of connector end points vs 2D shape connection points, the equality should be <=, not the < as indicated.  This is only a problem for very small radius cases.

The two corrected code lines are:

If (Abs(xCon - xBeg) <= intTolerance) And (Abs(yCon - yBeg) <= intTolerance) Then                           


If (Abs(xCon - xEnd) <= intTolerance) And (Abs(yCon - yEnd) <= intTolerance) Then                           


In the attached file, error has been corrected.

Wapperdude
Visio 2019 Pro

vojo

FWIW...I have always had problems with the spatialneighbor function in VBA.   For some reason, for me, it was a crude approximation:
I could find the "city" the shape is in....but got real confused if looking for the "street" the shape is at.

wapperdude

Yep!  Seems like it's one of those functions that ought to have great usefulness, but then you try to use it, and it's almost totally useless.  I couldn't agree with you more Vojo!

Ranks right there with SETATREF. 

Wapperdude
Visio 2019 Pro

doudou

Quote from: wapperdude on September 10, 2014, 05:26:27 AM
Ooops...found minor error in the glue code.  In the "IF" statements for checking the location of connector end points vs 2D shape connection points, the equality should be <=, not the < as indicated.  This is only a problem for very small radius cases.

The two corrected code lines are:

If (Abs(xCon - xBeg) <= intTolerance) And (Abs(yCon - yBeg) <= intTolerance) Then                           


If (Abs(xCon - xEnd) <= intTolerance) And (Abs(yCon - yEnd) <= intTolerance) Then                           


In the attached file, error has been corrected.

Wapperdude

That is exactly what I did in my modification :). Great work on the other connectors stuff also. Cheers,

Jean

rezingg

Good start to a glue healing tool. I added the use of Shape.XYToPage() to make this also work for shapes that are rotated or mirrored.