News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Smart Connection Points

Started by wapperdude, May 16, 2014, 03:10:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wapperdude

OK.  The coding is complete...I think.  So, there is no need for special connector shape any more.  Long live the special connector!   ;D

Sorry, no new picture, just the Visio file.   :o

8)
Wapperdude
Visio 2019 Pro

wapperdude

Final (???::)  update...

You may use either the dynamic connector or simple lines to connect parts.  Report form will show both.

Wapperdude
Visio 2019 Pro

vickey

Hi Wrapperdude,
I new to visio and i need to make connector and shapes smart in a way that only similar dat type pins may get connected to each other, I have also downloaded the code provided by you.
Now to make my connector a smart one where do i need to call Sub GetConnections() and Sub InitFromTo(ByRef shape As Visio.shape) ?

I my diagrams i will be have only two type of pins boolean and continuous.
Need suggestions asap :)

wapperdude

#18
The code provided doesn't reside in a shape/shapesheet.  It is "belongs" to the document, i.e., the active Visio file.  You can execute the code from a shape by adding a call to, say, the double click event, found in the shapesheet.  But, there would be no point to do that with this code.

This code is merely an analyzing code.  It goes thru a page and checks all the connections and then reports their status.  It does not prevent a connector from attaching to any particular pin.  The connector only knows what it's connected to after connection.  I don't think that's what you want.

Also, I'm not aware of any means to prevent an "erroneous" connection, as there is no mechanism that I'm aware of that allows "pre-determination" of the candidate connection point type as that would required a background process always running.

Wapperdude
Visio 2019 Pro

Hey Ken

   You can change the row type on a connection point??  Never knew that!  Having learned that, of course I had to immediately open a shapesheet, add every possible section, then check to see which ones allow for a change of row type. 

   Other than Geometry, it appears the only sections that allow it are Connection Points and Controls, but neither makes any sense to me.  For Connection Points, why not always just display the D cell?  What value is there in being able to turn it on and off?  For Controls, all it does is enable the Tip cell so you can define hover text for the control point.  But setting the Tip cell to No Formula vs. ="Your Tip Text" does the same thing, and is much more intuitive.

   There's also the issue of functional consistency across the three sections that allow it.  Only Geometry actually changes the row type; the second adds a cell, and the third enables/disables a cell.  Go figure.

   I'd find it much more useful if they would simply add a scratch cell to each row in every section containing multiple rows, such as User-defined, Shape Data, Hyperlinks, Actions, Action Tags, Controls, and Layer Memberships.  There have been  times when I've had to functionally link a row in one section to a row in another section, but do the linkage programmatically.  A scratch cell would be a cleaner approach.

   For example, in Vickey's situation (if I understand it correctly) you could use the connection point's D cell to hold the name of the type of connection, either "boolean" or "continuous".  Then, when the Add Connection event fires, check to see if it's allowed or not.  If not, add a small delta to the X/Y endpoint of the line to push it aside.  That way every time you try to connect, say, an electric line to a gas line, it automatically tosses the line endpoint aside and breaks the connection.  No need for a background process continually running.

   - Ken


P.S.  It's been a few years since I last posted.  Been busy with managerial positions, but now I'm back in the Visio trenches where I belong.  Good to be back!
Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

vickey

Hi Hey Ken,

First of all welcome back!!!

Thanks a lot for your inputs, i will try to implement your suggestions in my code.
Could you also help me in forwarding an example to work with ConnectionsAdded()  in VBA .
This event was not firing on adding a connection to a shape.
Wapperdude thanks for your inputs too.

Regards,
Vickey


Hey Ken

   Thanks for the welcome, Vickey!  I can certainly commiserate with your difficulty in getting events to fire.  It was the most difficult part of learning Visio for me, and  I still get bitten by them every now and again.

   Can you post the shapes you want to join/not join together?  That'd make it easier to see exactly what needs to be done.

   - Ken
Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

vickey

Thanks a lot Ken for your support.
I am now able to achieve the requirement and restrict the connector from connecting pins of different data types

Regards,
Vickey

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 269 (show)
Files included: 40 - 1775KB. (show)
Memory used: 1337KB.
Tokens: post-login.
Cache hits: 13: 0.00252s for 26,755 bytes (show)
Cache misses: 3: (show)
Queries used: 17.

[Show Queries]