Visio Guy

Visio Discussions => Visio 2525 Feature Requests => Topic started by: wapperdude on May 16, 2014, 10:10:14 AM

Title: Smart Connection Points
Post by: wapperdude on May 16, 2014, 10:10:14 AM
If this has been addressed in V2010 or later, then, disregard, then let me know, and either I or some other moderator will remove this topic.

But, it would be a nice feature that allows a "name" or some sort of "ID" to be included with a connection point when added to a shape.
   1. This ID could be optionally displayed on the shape, think, port name.
   2. This ID could be automatically grabbed for connectivity, "hyperlinking", and report generation.

Title: Re: Smart Connection Points
Post by: Jumpy on May 19, 2014, 02:38:41 AM
I sometimes use the "D" cell of the CPs ShapeSheet entry for that.
Title: Re: Smart Connection Points
Post by: Yacine on May 19, 2014, 03:02:03 AM
I sometimes use the "D" cell of the CPs ShapeSheet entry for that.
Makes sense. Had to find out that you need to right click on the cell and change row type though.

The display option would also be useful, but a workaround with some VBA would do the job.
Title: Re: Smart Connection Points
Post by: wapperdude on May 19, 2014, 10:07:58 AM
Very interesting.  Had not discovered that.  The mechanism is kinda there, but, it's not obvious, it's not very expedient, it's very limited in usability. 
  1.  Add connection point
  2.  Open shapesheet
  3.  Go to Connections section, right click, change row type.  (While you're at it, might as well give the row a name, too.  This become important for connectivity reporting, hyperlinking.)
  4.  Go to the "D" cell and enter a formula, or text (inside double quotes)
  5.  Go to Insert > Fields > custom and enter something like "=connections.row_1.D"

That displays the text for that connection point.

Several problems:
   1.  NOT obvious to the inexperienced user. 
   2.  Way too many steps
   3.  Gets much worse with multiple connections.  That is the insert>field>custom formula becomes increasingly complex.
        a. connection points on multiple sides
        b. independently formatting (e.g. justification), moving,

Presently, to be robust solution, really need a separate shape for each connection point to really make a nice looking top level shape.  See attached for a simple, limited example, i.e., no text on top/bottom, row spacing reasonably close to connector points (but no real way to control this), and text spacing done on a "per row basis".   :o   :P   :P    >:( 

What would be nice:
  1. Add connection point
  2. Then, ability
      a.  to add a displayable identifier
      b.  ability to independently to format text (font, justification, etc)
      c.  ability to move / location position of font (sometimes it's inside the shape, sometimes outside)
      d.  automatically grab connection identifier when a connector is added or for use by hyperlink.

These are features that would benefit those drawing schematics, schematic symbols, networks, etc.

Title: Re: Smart Connection Points
Post by: Jumpy on May 19, 2014, 10:59:02 AM
I use it to "define" the type of connection point because in my drawings there are pipes for gas and water, and wires for electicity. For Visio it's all the same so without some VBA and that "classification" of a connection point (and a similar classification of the connectors) it would be possible to conect a electrical wire to a valve or sth.

For that it is good enough, althoug I agree witd wapperdude: It's not obvious and it's tedious.
Title: Re: Smart Connection Points
Post by: wapperdude on May 19, 2014, 11:26:05 AM
Yeah, connecting anything to a gas line would be a big problem!!!  :D

But, thanks for identifying the ability to make those definitions...tedious as it may be!   ::)

Title: Re: Smart Connection Points
Post by: wapperdude on May 19, 2014, 01:28:21 PM
Updated the drawing to show a little more "power" of the "smart" connection point approach.
Title: Re: Smart Connection Points
Post by: Yacine on May 19, 2014, 01:38:22 PM
Hi WD,
you can't be serious about this solution. My mother uses space chars to position text in her emails!  ;) ;D

I was actually motivated to write a macro to label connection points. You were faster.
Imho only subshapes with both local and global show/hide options (like connectors) should hold the labels of the connection points.
The issue being, that you may need the actual shape text to display something else.

My deepest apology for the intro.  ;)
Title: Re: Smart Connection Points
Post by: wapperdude on May 19, 2014, 02:43:34 PM

Well, I think you got the point, just not the intention.

The point was, that the present system doesn't allow for effective use of smart connection points.  Yeah.  It's a "you got to be kidding" situation. 

The intent was to show, that
  a.) connections points should provide connectivity info of the primary shape, not that of some drilled down subshape.  That loses originating shape info...well, without extra effort.
  b.) connection points should be part of the primary shape.  That's the visual, relationship.  It's that way on any schematic capture piece of software.
  c.) the connection points need a lot of formatting / config options.  None of which can be done easily in present Visio.  It takes the addition of subshapes and a lot of user work.

Plus, you and Jumpy are really arguing my case, and so is Paul Herber.  To get to a nice finished product requires groups, subshapes, and VBA/macros.  But, I contend, that with a "smart" connecting point, it doesn't have to be that way.  Thus, the example I offer.  To show both the inadequacy of the present system, but the potential that could be there.  By using a connector to hook to shapes together, then issue a report, you get originating shape and connection point detail and ending shape and connection point.  That gives you a way to verify the connectivity by examining a list.  So, the connector part is already there.  This could be done with work on MS Visio development team side.  But, presently, there's nothing viable other than the laborious, tedious work that Paul, Jumpy, et al, have had to go thru. 

As for your point of adding shape text, well, there could be two classes of text.  Those associated with connection points, not generally editable, and then "normal" shape text, which could be more readily editable.  The latter could be general purpose, but it could also contain stuff like reference designator in the case of schematic or whatever.  Plus, there's nothing to prevent the addition of other text boxes as desired.  It seems that connection points have certain unique properties which are inadequately leveraged.

It's time to take connectivity, shape development to the next level.  There's just too many hoops to jump thru...with the result of a conglomerate, stacked nest of subshapes. The resulting group is a less than an ideal shape.  It's not efficient, it actually costs some overhead.  It certainly isn't elegant.


Title: Re: Smart Connection Points
Post by: Visio Guy on May 20, 2014, 09:39:51 AM
Do you guys know about named connection points?

It's not ideal, since you can't have spaces, and the ShapeSheet can't really parse the text of a cellname, but better than nothing.

Another idea would be to have a convention of lookup, so you name a user row to match the name of a connection point row:


User.CP_USB1OUT.Value = "USB 3 Port 1, Out"

Title: Re: Smart Connection Points
Post by: wapperdude on May 20, 2014, 10:01:58 AM
Yes to the named connection point question.  My attached Visio file uses that...thanks to Jumpy.

What Visio doesn't do is allow for individual text, i.e., each connection point name (which is easily stored in the "D" cell), to be displayed, and all of the other complaints I listed...  It still takes a lot of additional work (read subshapes) to get a proper looking, behaving shape.

This is a future improvement for Visio.  Obviously, it's possible to make present Visio some degree...but not as easily as it could be.  How difficult can it be to create a connection point with it's own textbox that can be easily parsed?  Add to that every connection point is "directly owned" by the "master" shape and it becomes easy to grab the connectivity info...I would think.

After years of being in the electronics industry and working with various schematic capture programs, the ability to create a "symbol" in those programs with multiple text fields that can be easily manipulated, and then utilized for schematic verification, would seem that Visio is very close...but that capability has never been tapped yet.  So, I'm pushing to move Visio to the next level.

Title: Re: Smart Connection Points
Post by: wapperdude on May 20, 2014, 11:09:36 AM additional thing to illustrate that Visio is close.  I've updated my shapes to add connection point type property.  This is important in verification because you only want an output "port" driving an input port or multiple input ports.  Power pins typically are bidirectional.  Visio already does this!  So, this enhancement that I'm pushing for isn't that much of a "reach".
Title: Re: Smart Connection Points
Post by: Paul Herber on May 20, 2014, 12:33:06 PM
Pay attention at the back, Paul!
Interesting. I must admit I'd never noticed the option of a change of connection point type to enable field D.

Title: Re: Smart Connection Points
Post by: Jumpy on May 21, 2014, 02:01:01 AM
Seeing wapperdudes last screenshot I remembered a possible problem with the "D" cell solution:
By changing the row type of a connection point (so yopu can use the D cell) you eventually loose all prior formulas in A,B,C cells.
And I don't know, if A,B,C cell's have the same meaning they had before, although with the C cell I'm rater shure because I use that In<->Out Connection-Point type a lot.

Thinking a bit about wapperdudes "wishes list" I have an further suggestion. It would be cool to have a "Tooltip" when hoovering over a connection point, same way as it is afaik today with the yellow control points.
Title: Re: Smart Connection Points
Post by: wapperdude on May 23, 2014, 01:36:27 PM
There's been considerable updating to the Visio file.  This creates a smarter connected diagram.  There is underlying code, which I borrowed and modified from member Scott.  The code analyzes the connectors and determines connectivity information.  This information can be added to a report as shown on the Report page by running the Menu Bar>Data>Reports>Circuit Verification.  Besides checking connected shape info at begin/end of connector, it also applies simple rules to see if the connectivity is "OK".  This info is added to the report and also presented on the drawing to highlight possible problems.

The code does use the connector "D" cell information, but, that could be easily altered.  Thus, the code is not restricted (obviously) for future Visio enhancements.

The connector is a modified Visio connector with some shapesheet modifications.  Thus, a standard connector will NOT have all of the features presented here.  The solution would be to add more code, but, being lazy, this was easier/quicker.  Significant changes are ability to "command" the text to show/hide via right click context menu and line color change based upon connector "status".

Finally, to avoid diagram clutter, there is a show/hide toggle button.  Just double click to see some informative callouts.

Again, the point of this drawing is to show "what" could be done in a simple, ungrouped shape with some Visio enhancements.  It's purpose is not to suggest that this is how it ought to be done within the present Visio environment.

Title: Re: Smart Connection Points
Post by: wapperdude on May 23, 2014, 11:21:23 PM
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

Title: Re: Smart Connection Points
Post by: wapperdude on May 24, 2014, 01:01:14 PM
Final (???)  ::)  update...

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

Title: Re: Smart Connection Points
Post by: vickey on July 09, 2015, 05:14:34 AM
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 :)
Title: Re: Smart Connection Points
Post by: wapperdude on July 09, 2015, 10:51:17 AM
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.

Title: Re: Smart Connection Points
Post by: Hey Ken on July 10, 2015, 08:22:19 AM
   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!
Title: Re: Smart Connection Points
Post by: vickey on July 15, 2015, 06:57:58 AM
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.


Title: Re: Smart Connection Points
Post by: Hey Ken on July 16, 2015, 07:29:52 AM
   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
Title: Re: Smart Connection Points
Post by: vickey on July 28, 2015, 01:27:07 AM
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