Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: novski on August 30, 2014, 11:22:45 AM

Title: Dynamic Connectors smal blue handles
Post by: novski on August 30, 2014, 11:22:45 AM
Hi
I have an other Question regarding the Handles of a Dynamic connector.
My Connector has 7 Points i can grab it. But some times these go away after dropping it to narrow connections.
Is it possible to control that in any way?
Thanks
Novski
Title: Re: Dynamic Connectors smal blue handles
Post by: wapperdude on August 30, 2014, 08:23:49 PM
Do you have an example you'd be willing to upload?

Wapperdude
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 02, 2014, 04:38:40 PM
Hi Wapperdude
Yes i have. But i don't think it will help. If you hook it in between two connection points you can pull one of the blue handles on a line and it will generate 3 new points. The Points in edges are accessible through the command Geometry.X1,2,3,4 but the ones in between i can't access through code...

I wold like to know if its possible to get those points relative to x/y axis...

Thanks a lot!
Novski
Title: Re: Dynamic Connectors smal blue handles
Post by: wapperdude on September 02, 2014, 05:06:51 PM
I may be wrong, but, in general, the dynamic connector has a lot of code behind it, so what you see now, may or may not be there if you make any adjustments by moving a connected shape or dropping a shape that forces a re-route.

Those "control" points, Visio adds whenever it adds a new segment to the connector, typically, to change the direction.  Once that's happened, it ought to be possible to use code to go thru the geometry section and move that control point.  But, you'd need to determine which is the correct control point, and then move it.  The location does seem to be relative to the start location, i.e., BeginX, BeginY.

I think it would be difficult to do a reliable search of a specific control handle as both the number of handles and their position is dynamic and not really predictable. 

Perhaps someone else will weigh in with better insight.

Wapperdude.
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 02, 2014, 07:44:33 PM
Well, is it possible to count the total number of Geometry.X(1,2,3,4,n) that are in that Connector?
Actually the number the connector is changeing the direction...
best regards
Title: Re: Dynamic Connectors smal blue handles
Post by: vojo on September 02, 2014, 08:38:09 PM
I dont think dynamic connectors HAVE to have code behind them....June's stuff and the stuff I built off of June's has no VBA involved to handle the yellow (yes still on visio 2003) control points to move segments/legs and recalcuate bends of the overall connector.

Back when the earth was cooling and Visio 2003 was prevalent, there were issues about what showed up in a congested drawing.
Maybe this is another artifact of that.
Title: Re: Dynamic Connectors smal blue handles
Post by: JuneTheSecond on September 03, 2014, 01:07:48 AM
Did you call me?
First time I examined the control points on dynamic connector.
When I changed the data x,y in Geometry1, control points moved.

But dynamic connecor is myterious.
Nothing can I do more.
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 03, 2014, 02:50:41 PM
Im asking for a Funktion that counts the existing total amount of Geometry. Rows.
Title: Re: Dynamic Connectors smal blue handles
Post by: JuneTheSecond on September 03, 2014, 07:53:29 PM
I cannot remember it in shape sheet functions.
But in VBA visio has shape.rowcount property.
I am now on iphone, please check online document in msdn.
Title: Re: Dynamic Connectors smal blue handles
Post by: daihashi on September 03, 2014, 09:16:43 PM
Unfortunately I don't think there is a way to count in the shapesheet. I do what I call as reverse counting; where the rows report that they exist and update a user defined cell that I have created (specific to the section that I want to count) with the current value + 1.

If there is a built in function then I would definitely be curious to know what it is. However, if I recall correctly... I think that visio guy has an article that addresses a similar type of work around for counting in the shapesheet.
Title: Re: Dynamic Connectors smal blue handles
Post by: daihashi on September 04, 2014, 12:40:42 AM
Actually, it turns out the post I was thinking about was not for this purpose... however it also turns out that Visio Guy did indeed post a different Article that I did not know about for doing exactly what you are asking for in this post.

My method is quite a bit different, but to be honest... the method that he posts in this article is much more direct than what I've been doing. Check it out at the hyperlink below:

http://www.visguy.com/2006/10/04/counting-geometry-sections/
Title: Re: Dynamic Connectors smal blue handles
Post by: Jumpy on September 04, 2014, 06:48:47 AM
I would have thought that the formula in the link can't work with a dynamic connector because after you move the connector Visio deletes geometry rows or adds new one and the reference is broken. The Iserr function should capture that the first time, for example after row 6 is deleted. But when row 6 is added again, the connection is still broken and it will not be counted (my guess).
So even VisioGuys suggestion to use Dependson may not work. But maybe it would work to set the formula new every time:

User.SetFormula
=Dependson(...)+SETF(GetRef(User.RowCount),"=ABS(...)+ABS(...)+ABS(...)+...")
Title: Re: Dynamic Connectors smal blue handles
Post by: daihashi on September 04, 2014, 11:34:56 PM
it does, and I can't comment on VisioGuy's method.. but I can tell you a work around I've discovered for the issue that you described.

Originally I tried to use "GUARD" and a number of other functions in the geometry section of the connectors in my master shapes; only to discover that they were instantly removed by Visio. This was frustrating to say the least. However, I then tried setting the formula for the connector geometry section via VBA upon drop. I was very happily surprised to discover that doing it this way allowed me to use "GUARD" within the geometry section, and it would not be over ridden by Visio.

For me this works perfectly, because my templates are heavily automated. I do not even allow Visio to move, or lengthen the connectors... instead I have a number of my own formulas embedded within the shapesheet and pagesheet that defines that behavior. I have many reasons for doing this, which I won't go into here. However, the point is that I think you can "bypass" the natural behavior of the geometry section of the shapesheet by simply using VBA to apply the formula instead of trying to manually set it in the shapesheet yourself.

The only downside to this my method is that if you want to be able to manipulate the connector, then you will need to define some formulas that will allow for the X/Y coordinates to still be manipulated

Another way counting could be done without having to deal with the messy method I describe above is to use the scratch or user section to count the number of rows for you. I've included an excerpt from one of my documents to give an example. It's not exactly the same, but this could be modified to increase the count for each row that actually exists... instead of simply reporting a 1 or a 0 like I have set in my code.

If you want to know specifically why I did this, or why I need it in my document... then i'll be happy to elaborate, but I think that a person can see how a similar idea could be used for the purpose of counting. The only downside to this method is that it requires that you know how many rows, and their locations, that you want to validate if they exist/are in use or not.

Title: Re: Dynamic Connectors smal blue handles
Post by: daihashi on September 04, 2014, 11:39:04 PM
Quote from: Jumpy on September 04, 2014, 06:48:47 AM
But maybe it would work to set the formula new every time:
User.SetFormula
=Dependson(...)+SETF(GetRef(User.RowCount),"=ABS(...)+ABS(...)+ABS(...)+...")

I have no idea how I missed this part of your post.

I believe that would work just fine. I think the Geometry section just does not like to be directly edited by a user, but will take setting a formula via VBA... and probably would work also using SETF
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 11, 2014, 06:39:14 AM
Hi
I just found time to come back to this post. Thanks for your thaughts about counting the rows in geometry section.
I just can't realy follow what i have to fill in the "(...)" playces of Jumpys sugetion:
Quote from: Jumpy on September 04, 2014, 06:48:47 AM
User.SetFormula
=Dependson(...)+SETF(GetRef(User.RowCount),"=ABS(...)+ABS(...)+ABS(...)+...")

The ABS(...) cold be the start of Visio Guys/David Parkers post where they use this part:
ABS(NOT(ISERR(INT((INDEX(0,"Geometry1.x1″))))))

But i can't follow the Dependson(...) part...

best regards
novski
Title: Re: Dynamic Connectors smal blue handles
Post by: Jumpy on September 11, 2014, 06:51:56 AM
=DEPENDSON( TxtPinX, TxtPinY )

Is described in Visio Guys/David Parkers post. Rather down in the comments section.
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 17, 2014, 05:16:27 AM
Hi
I tryed this formula but it seams to be false in some way. Im not able to find the faulty part so maybe someone may look over it?

=DEPENDSON(TxtPinX,TxtPinY) + ABS(NOT(ISERR(INT((INDEX(0,"Geometry1.x1″)))))) + ABS(NOT(ISERR(INT((INDEX(0,"Geometry1.x2″)))))) + ABS(NOT(ISERR(INT((INDEX(0,"Geometry1.x3″)))))) + ABS(NOT(ISERR(INT((INDEX(0,"Geometry1.x4″)))))) + ABS(NOT(ISERR(INT((INDEX(0,"Geometry1.x5″))))))

I can't follow the double "(" in front of the INDEX function. But the failure appears without as well..

Does somebody see the failure?
Title: Re: Dynamic Connectors smal blue handles
Post by: wapperdude on September 17, 2014, 05:37:54 AM
Too many parenthesis, (and seems like quotes are optional)...

=DEPENDSON(TxtPinX,TxtPinY)+ABS(NOT(ISERR(INT(INDEX(0,Geometry1.X1)))))+ABS(NOT(ISERR(INT(INDEX(0,Geometry1.X2)))))+ABS(NOT(ISERR(INT(INDEX(0,Geometry1.X3)))))+ABS(NOT(ISERR(INT(INDEX(0,Geometry1.X4)))))+ABS(NOT(ISERR(INT(INDEX(0,Geometry1.X5)))))

but, if quotes necessary, this also is error free:
=DEPENDSON(TxtPinX,TxtPinY)+ABS(NOT(ISERR(INT(INDEX(0,"Geometry1.X1")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry1.X2")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry1.X3")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry1.X4")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry1.X5")))))

Does seem like both give the same results....to quote or not to quote.

Wapperdude
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 17, 2014, 11:50:15 AM
Thank you Wapperdude!
Now i was able to follow what Jumpy wrote :
QuoteSo even VisioGuys suggestion to use Dependson may not work. But maybe it would work to set the formula new every time:

User.SetFormula
=Dependson(...)+SETF(GetRef(User.RowCount),"=ABS(...)+ABS(...)+ABS(...)+...")
But it seams to me that that doesn't work ether because the "geometry.Xnr" always gets reset asoon as the line decrements sections. it gets set to REF() or if its alone in a user.xy cell it seams to take the value of PinX-PinY or something similar...
Is it possible to protect that cell from visio?
Title: Re: Dynamic Connectors smal blue handles
Post by: wapperdude on September 17, 2014, 04:31:39 PM
Directly protect the cell...No.  The behind the scenes code will always clobber it.  The best you can do is "after the fact" re-write the formula. 

If this is a real problem, then you may want to abandon using the dynamic connector and use instead an ordinary line.  It can still have the gluing, and it allows you to route as desired.  But, if you make changes, it will not automatically update, ... but the automatic updating is the problem in the first place.  But at least you could enter formulas that won't get clobbered.

Wapperdude
Title: Re: Dynamic Connectors smal blue handles
Post by: Jumpy on September 18, 2014, 09:55:54 PM
Had to try a bit at first, but got it to work somehow. See attachment.

Wasn't possible to fit it into one big formula, because it uses a trick with SETF: If SETF can't set the formula, the old formula doesn't get overridden. That wouldn't be possible with only on cell and one big formula because that formula would never be written new.

If you reduce legs of connector you got Ref-Error. That won't be overwritten (see above) but is savely captured with IsErr function. If you increase number of legs again, SEFT can reset the orignial formula for a geometry section and all is fine again.

Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 19, 2014, 11:20:48 AM
wow.

thats a real solution that works. WONDERFULL!!!
Thank you verry, verry much!

I just can not follow how it does the job...  ::)

Can you explane me what the cell Prompt does ant how the Ref() gets set back to the Geometry.x8 in User.Row7?
I have never worked with the Cell Prompt until now...
Best regards
Novski
Title: Re: Dynamic Connectors smal blue handles
Post by: Jumpy on September 19, 2014, 11:32:05 AM
Cell Prompt is just a cell in the user defined section, where you can for example strore comments about what your user definded cell does. But it is a cell like "every other cell" so I use it for my SETF+Dependson function to repair the formula in the user defined cell, if possible.
Instead of using the prompt cell I could have added another user defined cell wor each row to contain the SETF+Dependson-Function.

Possible above means: It can only repair the cell that counts leg number 6 if the connector has 6 or more legs. Otherwise it does nothing and the REF() formula remains until the connector gets more legs again.

And less I forget. You can expand the example for more then 8 legs, if you think it neccesary.
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 19, 2014, 01:54:44 PM
i did! i now use 12 legs.  8)
-realy cool to use a text section to prevent Visio changeing it.

may i ask a new question:
i made a User.SetLineEnd= =IF(User.LineCount=1,"Geometry1.X1",IF(User.LineCount=2,"Geometry1.X2",IF(User.LineCount=3,"Geometry1.X3",IF(User.LineCount=4,"Geometry1.X4",IF(User.LineCount=5,"Geometry1.X5",IF(User.LineCount=6,"Geometry1.X6",IF(User.LineCount=7,"Geometry1.X7",IF(User.LineCount=8,"Geometry1.X8",IF(User.LineCount=9,"Geometry1.X9",IF(User.LineCount=10,"Geometry1.X10",IF(User.LineCount=11,"Geometry1.X11",IF(User.LineCount=12,"Geometry1.X12",FALSE))))))))))))

so what i get out of that is a text: Geometry1.X8 -if i have 8 legs.
and i wold like to use the value out of that geometry section"Geometry1.X8".

How can i get hold of that value inside Geometry1.X8

I need it to set the Text direction on my line depending on that value...

Thanks a lot for that help...
Title: Re: Dynamic Connectors smal blue handles
Post by: Jumpy on September 19, 2014, 02:47:11 PM
Quote from: novski on September 19, 2014, 01:54:44 PM
I need it to set the Text direction on my line depending on that value...

First:
For that you need the 2! last entries in the geoemetry section!

Second:
User.SetLineEnd could simply be:
="Geometry1.X" & User.LineCount

Problem may be that User.LineCount is sth. like 8.000 so you'd need to round/floor or otherwise cut of the decimals.
Or use your long formula as it is.

As for your true question:
I don't have an idea. Would have to play arround a bit with that. Probaly needs an SETF approach, too.

--------

Beside that. An completly other way to accomplish your goal ist to place a connection point a thousands of a milimeter beside the End of your connector. Visio will automatically place that connection point near the end of the connector whenever you move it. So the connection point will always be on the last leg of the connector (if the leg doesn't get smaller than a thousands of a milimeter :) ). If you calculate X/Y position of the connection point into page coordinates (there are shapesheet functions for that) you can compare them to EndX/Y values of the connector to "guess" the orientation of the last leg.
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 20, 2014, 05:41:24 AM
Hi Jumpy
What preferences wold you give to that connection point? (IN,OUT,IN/OUT)
best regards, novski
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 20, 2014, 04:58:00 PM
Im trying since hours without a clue how to get that string to give out the Value behind its Variable.

I created a String in User.SetLineEnd="Geometry1.X8"
Geometry1.X8 is a Variable from that i nead the Value.

Does anybody know how to get hold of that value?
Title: Re: Dynamic Connectors smal blue handles
Post by: Yacine on September 20, 2014, 07:29:25 PM
Record a macro, open the shapesheet of the shape, modify geometry.x8 and read the result in the macro.
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 20, 2014, 08:58:13 PM
Thanks for the reply, I think that will not do the job.

maybe a bit more short and straight forward:

I want to resolve a string to a variable that exists in the ShapeSheet of my Visio file.

best regards
novski
Title: Re: Dynamic Connectors smal blue handles
Post by: Yacine on September 21, 2014, 06:31:19 AM
Sorry, I misunderstood your message.
Maybe this topic is closer to your problem: http://visguy.com/vgforum/index.php?topic=3870.0
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 21, 2014, 12:04:41 PM
HI
Yes ist is exactly what im looking for.

This is acepted but does not give out the Value of Geometry1.X1 instead it is static 0.000
=EVALTEXT("""Geometry1.X"""&User.LineCount)

This gives out a 1.000
=EVALCELL(User.ValueLineEnd)

This gets accepted but gives out a #VALUE! error
=SETF((User.Row_45),EVALTEXT("""Geometry1.X"""&User.LineCount))

This gives out a 0.000
=SETF(GetRef(User.Row_45),EVALTEXT("""Geometry1.X"""&User.LineCount)))


:2h later...
I found a way.

Setting the Prompt cell to:
=SETF(GetRef(User.Row_54),"""=Geometry1.X1|=Geometry1.X2|=Geometry1.X3|=Geometry1.X4|=Geometry1.X5|=Geometry1.X6|=Geometry1.X7|""")
Gives a base to make a index in a other prompt cell: =SETF(GetRef(User.Row_53),INDEX(User.Row_56,User.Row_54,"|",))
And that gives out my Geometry1.X1 point in mm witch in my case is 0.00mm in Cell: User.Row_53.Value
now i can change User.Row_56.Value by hand to any number i want. (+1)

With setting User.Row_56 to User.Row_55 i can make my operation be done automatically.

So now i get the coordinate of my x point as i need it. really cool.




Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 21, 2014, 12:06:42 PM
I still have a question.

Jumpy helped me out on the task to get hold of the Geometry1.X sections also when the geometry sections disappear.
He made a +Dependson(TxtPinX) behind the formula. Now my text will not move so it will not update the formula as well.
I experimentd a bit with the Pathlengt and segments but i can't follow how the segments are counted.
Neather do i find any information about the number of segments related to a connection line.
here: http://blogs.msdn.com/b/visio/archive/2010/01/15/the-point-along-path-shapesheet-functions-in-visio-2010.aspx
or here:

if i draw a straight 1D Line it counts 1 segment. If i lift of the middle vertex i get 7 and if i make a "S" its 11.

How does it count the segments or what is a segment...?
Title: Re: Dynamic Connectors smal blue handles
Post by: novski on September 26, 2014, 05:03:32 AM
fount it. And its a waaaaaaay easier formula than the absolutely cool trick from jumpy (thank you Jumpy anyway, to give me the knowledge about how to fix Visio to effect my formulas of GeometryX.XY trough the Prompt cell!)

The segmentcount seams to count the (Legs + edge). So because the two ends don't have an edge its possible to count +2 and then divide it trough 2 to get the correct number of Legs we see. This is more accurate than the reseting of a formula trough the prompt cell.
I noticed that that is hard to configure because the +Dependson(TxtPinX) sometimes doesn't seams to work on certain cells.

This is the full formula:
User.ConnectorLegs=INT((SEGMENTCOUNT(Geometry1.Path)+2)/2)

cheers
novski