Visio Challenge: Connector with ZigZag

Started by wapperdude, April 28, 2010, 08:18:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wapperdude

A recent post here prompted me to issue this challenge to Forum members.

The goal, make a connector with a zig-zag characteristic.  Each corner has a control point to move the corner freely about.  The overall gluing behavior must maintain the existing connector properties.  That is, move the shape, it stays glued.

So, how many different or identical solutions can we come up with?

Picture below shows what I'm talking about.   ???  Yes, I do have a solution.   ;D  No, you don't get to see it yet.   :o  >:(

Hope this is a fun exercise!   ;)

Wapperdude
Visio 2019 Pro

vojo

June did this years ago....he is the defacto winner of this contest....sorry

wapperdude

#2
Well, that takes the sport out of it.  

Winner.   ???  There's no prize.   :o  Just the satisfaction of doing it.   ::)

Can I rule June the 2nd ineligible?   ;)  (Besides, I forgot he had a solution.  Doh!)

...anyway, for those with extra time, needing to express their creative longings...

... or this will just die and go away.  :'(  :'(  :'(

Wapperdude
Visio 2019 Pro

Will

Looks very interesting.
I wish I had time to goof with it. :(

If this does pander out, will you still post your solution?
I can think of a few good applications for such a connector.

Thanks,
-Will

wapperdude

Of course!   ;D  I'll give it a couple of days, and then post.  Will add at least one feature to somewhat mimic the text along a connector path smart shape feature -- for V2003/2007.   :o

Wapperdude

Visio 2019 Pro

wapperdude

#5
OK.  As promised, here's my approach...

It is based upon the standard Visio connector, which does create an interesting problem.  Since the control points reference to the shape's width and height, as you move either end point, the sign ( "+" or "-" ) can change along with the scaling factor.  The standard connector overrides attempts to lock the width/height calculation.  Consequently, the controls can move off page, way off page.  By using the bound function, they are constrained to the boundaries of the page.  The nice thing about being connector based, all of the functionality of gluing and connectivity info is retained.  Obviously, the right angle, straight, and curved features are defeated.

The text will align with the segment that it is centered on.  Standard text editting applies, double click short cut works.  Right click the shape to bring up a menu to move the text to any one of  the three segments.  I opted to center the text on the selected segment and do not allow the option to freely position the text.  But, some shapesheet editting could change that.

Oh, no grouping was used.  

Feel free to use if it proves to be useful.  It was a fun project and forced me to explore some shapesheet functions that I usually avoid.

Wapperdude
Visio 2019 Pro

Will

Thanks wapper!
That's definitely going in my vault for future use.

Take care,
-Will

Visio Guy

As Maxwell Smart would say: "Aha! The old Geometry1.NoShow = True trick!"

Very cool way to keep it Dynamic-connector-ish!
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

wapperdude

Hey!  It's the 1000 post milestone for VisioGuy!   8) Congrats!

Those are busy little fingers!!!   :o
Visio 2019 Pro

Yacine

#9
Thank you for giving us the opportunity to dive deeper into Visio.
Yacine

wapperdude

Here is the "Mark2" version of the zigzag connector.  This version introduces a text control point that will allow you to move the text anywhere along the designated line segment.  To avoid the inevitable disaster when two control points are aligned on top of each other, the text control is not allowed to go to the segment end points.

Enjoy.
Wapperdude
Visio 2019 Pro

wapperdude

Added a little more functionality to the right click context menu, allows the text box to be shifted above / below the line.

Wapperdude
Visio 2019 Pro

Yacine

#12
with the right line pattern, it can even look nice.

But, come on Wapperdude, you can do better than that. We want the text to follow the path without the need of right-clicking. ;)
Yacine

wapperdude

#13
Is that a call to re-open the "challenge"?   :o  ;)

As Vojo, said, "It's already been done.."  ... in Visio 2010.

The main issues would be
 1.)  control point collisions at the corners.
 2.)  a zig-zag line is non-monotonic.  That is, a given x-position could have as many as 3 possible y-positions.  

Issue 1 may not be a problem, just depends which control point Visio decides is on top.   ???

Issue 2 is nasty.   :'(  That's why I went with the right click solution, made life simple.  A continuous solution will require many more conditional tests with the possibility of circular references.   :P   >:(

For a monotonic, multiple slope version, solution is relatively simple. 

Wapperdude   8)
Visio 2019 Pro

wapperdude

#14
How's that go???  In for a penny, in for a pound...

So, Yacine, I took your challenge, was successful in avoiding the right click menu to place the text in 2 out of 3 possible combinations.

I reworked the zigzag connector which will allow the text to be placed along the line without using the right click menu, except for when the line is neither monotonic in the horizontal and vertical directions.  That is, when both the x- and y- directions can have double-valued solutions, the shape resorts to using the right click menu.  Also, I added a feature that allows text to match the line color, so you don't have to select both.  This can be overridden by either changing the text color or unclicking the menu.  Also, since the text box is constrained to the control point, it is possible to offset the box above or below the line via the right click menu.

The user section of the shapesheet is a little messy because this was a work that evolved.  Sorry about that.  There were a lot of test conditions.  And no, I didn't try to minimize the logic.  Oh, if the connector has a monotonic solution, you are not allowed to use the segmented selections.  Also, I did not restrict the monotonic solutions so it is possible to place the text control point on any of the other controls plus end points.  And, no, I will not accept that challenge...go buy Visio 2010.

Enjoy.
Wapperdude
Visio 2019 Pro