Visio Guy

Visio Discussions => General Visio => Topic started by: wapperdude on April 28, 2010, 08:18:39 PM

Title: Visio Challenge: Connector with ZigZag
Post by: wapperdude on April 28, 2010, 08:18:39 PM
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
Title: Re: Visio Challenge: Connector with ZigZag
Post by: vojo on April 28, 2010, 09:29:43 PM
June did this years ago....he is the defacto winner of this contest....sorry
Title: Re: Visio Challenge: Connector with ZigZag
Post by: wapperdude on April 28, 2010, 10:06:35 PM
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
Title: Re: Visio Challenge: Connector with ZigZag
Post by: Will on April 29, 2010, 02:43:47 AM
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
Title: Re: Visio Challenge: Connector with ZigZag
Post by: wapperdude on April 29, 2010, 04:54:28 AM
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

Title: Re: Visio Challenge: Connector with ZigZag
Post by: wapperdude on April 30, 2010, 04:15:24 AM
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
Title: Re: Visio Challenge: Connector with ZigZag
Post by: Will on April 30, 2010, 07:44:11 PM
Thanks wapper!
That's definitely going in my vault for future use.

Take care,
-Will
Title: Re: Visio Challenge: Connector with ZigZag
Post by: Visio Guy on April 30, 2010, 07:54:52 PM
As Maxwell Smart would say: "Aha! The old Geometry1.NoShow = True trick!"

Very cool way to keep it Dynamic-connector-ish!
Title: Re: Visio Challenge: Connector with ZigZag
Post by: wapperdude on April 30, 2010, 08:10:39 PM
Hey!  It's the 1000 post milestone for VisioGuy!   8) Congrats!

Those are busy little fingers!!!   :o
Title: Re: Visio Challenge: Connector with ZigZag
Post by: Yacine on April 30, 2010, 09:52:25 PM
Thank you for giving us the opportunity to dive deeper into Visio.
Title: Re: Visio Challenge: Connector with ZigZag
Post by: wapperdude on May 01, 2010, 03:50:16 AM
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
Title: Re: Visio Challenge: Connector with ZigZag
Post by: wapperdude on May 01, 2010, 05:50:55 AM
Added a little more functionality to the right click context menu, allows the text box to be shifted above / below the line.

Wapperdude
Title: Re: Visio Challenge: Connector with ZigZag
Post by: Yacine on May 01, 2010, 06:18:27 AM
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. ;)
Title: Re: Visio Challenge: Connector with ZigZag
Post by: wapperdude on May 01, 2010, 02:29:52 PM
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)
Title: Re: Visio Challenge: Connector with ZigZag
Post by: wapperdude on May 04, 2010, 05:16:39 AM
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
Title: Re: Visio Challenge: Connector with ZigZag
Post by: Yacine on May 04, 2010, 09:33:51 AM
Bravo!
Title: Re: Visio Challenge: Connector with ZigZag
Post by: wapperdude on May 04, 2010, 02:51:29 PM
Ooops!  Found a case where text angle failed.  Here's corrected, updated version.

Wapperdude
Title: Re: Visio Challenge: Connector with ZigZag
Post by: wapperdude on May 05, 2010, 01:39:40 AM
Did you think that was the last post???   :o

Never say never!!!   :P

So, perhaps you don't always want two elbows, perhaps just one?  No, I'm not doing none, that's a standard connector.  Well, now you have the option of either 1 or 2 elbows.  Splendid!   ;)

Wapperdude