Line labels at BOTH ENDS of the line?

Started by tinsley207, September 22, 2015, 06:34:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tinsley207

Is this possible?  Can I have a line with two places for text labels?  One at the beginning of the line and one at the end?  I need this because I'm making an engineering drawing with lots of lines representing wires.  Each wire has a number.  It would be nice to have a label in the drawing at EACH END of the wire.  I know you can select the line an just start typing but the text defaults to the middle of the line and it looks like you only get one shot at the text.  Any ideas?

wapperdude

Visio 2019 Pro

JohnGoldsmith

Hi,

I'll add a link to this post I wrote recently:

http://visualsignals.typepad.co.uk/vislog/2015/04/building-a-labelled-dynamic-connector-in-visio.html

The main focus started with hiding the standard line in the Dynamic connector, but then progressed to include end labels.

Hope that helps.

Best regards

John
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/

Yacine

Yacine

tinsley207

Thanks very much!  I will start with that stencil and make it my own!  PERFECT!

Nate

wapperdude

It looks nice, John.  Looked thru what you did, lot of thought and effort.  Unfortunately, for those of us who have NOT moved beyond V2007, we can't take advantage of your development.

Turns out, handling the text box at the begin point is relatively easy because only the 2nd line in Geometry 1 needs to be checked.  But, to get the proper placement at the end point, you need the last segment, and that could be anywhere depending upon number of corners.  Easy enough to find with a little code, but, alas,  no pure shapesheet solution for us sluggards.

The RECTSECT was a nice touch!

Wapperdude
Visio 2019 Pro

JohnGoldsmith

@tinsley - great.  Glad that's worked for you.

@yacine and @wapperdude - thanks guys, it was fun to do and sorry it doesn't port back to 2007 - I wanted to put those PATH... functions to work :)

I did start off by looking at the 2nd line of the first geometry section, but unfortunately when you choose a curved line style the row type gets changed to NURBSTo and the referencing formulas get blown away.

Another interesting aspect is that line jumps get included in SEGMENTCOUNT, contary to what the docs say, so this makes it difficult to assume that each segment represents a corner in the connector.

Best regards

John
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/

vojo

so got to ask:  Why wouldnt you do this as a group
- standard or preferred connector with all the behaviors you want
- first text block = beginx + 5mm, beginy+ 5mm   (maybe some logic like gravity to help...maaybe some guard()  )
- send text block = endx -5mm, endy -5mm (maybe some logic like gravity to help maybe some guard()
- Group them
- Set children first in behavior

you can drag connector where you want...text boxes follow

I do this for pure horizontal lines (transaction sequences)....general purpose is more complex.

So just asking in case I ever want to make it more general purpose (horizontal/angled/vertical/etc)

wapperdude

#8
Nice to have the site back!  Been waiting to post this for a couple of days.

First, thanks again, John, for your effort.  I guess imitation is high complement.  I  used many of your features to develop this V2007 version.

Here's a connector shape with a "textbox" at each end.  Behavior mimics the shape that John Goldsmith did above, except this is V2007 compatible.  Because some of the function's that John leveraged only became available with V2010, it was necessary to use a small macro to get the placement of the textbox at the connector end point.  The necessity is due to the option to hide the line segment spanning between the two textboxes.  There are a couple of additional features which I've added.  Everything is available via right click menu, double clicking the shape, or using the normal GUI interface.  While the textboxes make most sense for right angle connectors, the shape doesn't "blow up" for either straight or curved.  See attached.  The macro just "orients" the end textbox such that the control point is the line termination point, and, is always closest to the connection point side of the shape.

@Vojo:  there is no obvious choice.  Either method ultimately uses about the same amount of development to get all of the formulas and relations defined.  I think of the "connector" as being the parent.  So, I always expect it to be on top.  Making the connector a group, guarantees this, plus, it saves one extra shape level.  Personal preference.  Ultimately, what works best for you and whomever else may use the shape.  Each approach has merits and short-comings.

Wapperdude


Visio 2019 Pro

JohnGoldsmith

@Vojo - my connector does use grouping.  The labels are sub-shapes just as you suggest.  The extra geometry section in the top connector shape is just there to provide short lines to the labels when the main (first) geometry section is set to NoLine.

@wapperdude - That's a nice job and I particularlly like the multi-leg connectors too!
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/

markem

I realize this is YEARS old, but I had a though while reading this. Here is the idea:

Why not do the following:

1. Make a square.
2. Put a line across the square. Make sure the line stops on both sides of the square. GROUP them.
3. Connect from first item you want to have a line connected to - TO the opposite side of the square.
4. Connect from where the wire is to go eventually TO the square.
4a. This should make it look like the line is continuous. (Object A-line-(square with line)-line-Object B)
5. Now you have two lines. Yes, there is a square in between the two places but we are not through yet.
6. Move the square where you want it to go. This might take you a bit to decide.
7. Shrink the square down so it takes up only one square across. (So you basically can't see it.)
8. Make the FILL on that square to be NONE.
9. Make the LINE on that square to be NOTHING.
10. Now you have a way to have a label at each end because it really is two lines and you can make the labels be at either end of the lines.

That's it!

wapperdude

Interesting concept.  It could work as you describe.  However,....several issues with this approach...
1) it doesn't preserve end to end continuity.  Thus, network connectivity reports become problematical.
2) it is not user friendly requiring multiple additional steps:...
   > still need to attach the 2 free ends, plus, additionally
    > drag the square around
    > resize the square
    > hide the squaret
3) there is no performance gained by the approach

Visio 2019 Pro

markem

Hey Wapperdude!

Actually, I think it does preserve end to end continuity. Not as a "This line and only this line" kind of a thing but more of a "You start here, go to square, and then continue on to the end" kind of thing. Remember - as far as I know - this is just a drawing. We are not really laying down lines of copper on plastic. Just representing them.
The square does not need (necessarily) to be dragged around. I just said that because you could do that and all four items would remain attached to each other.
Secondly, ONCE you have created the square all you need to do is to just copy/paste it and then you have it again for the next two lines.
The same is true for the resizing of the square. You only do it once. When you copy/paste - the size is kept.
The same is true for the hiding of the square. Once made - you just copy/paste and the "hidden" part is also copy/pasted.

The original question was that the person was dealing with a wiring diagram. Most wiring diagrams are composed of a lot of straight lines. The problem with wiring diagrams is that there might be a chip between where a wire starts and where it ends. In this case you may need some way to handle having to make the line go around that chip. Visio is pretty good about handling this by itself, but a row of chips blocking the way may make it so Visio freaks out. So this idea was given as a way to get around that problem.

markem

Here is what I mean. I did NOT put labels on each of the lines - but that would be easy to do. Also, the little line I have which is over the square (or box) is just a straight line. As you can see - at the end of the video the line makes a right turn. So what. Just adjust the line that is in the square. This is what I thought the guy was asking about.

Here is a link to my video. Tried to upload but too big.

https://www.dropbox.com/scl/fi/k8czsn6hjnmg2dqcxdkow/Video_2024-02-24_172911.wmv?rlkey=xddqu5dhbtlfo0uvohggn1590&dl=0