Add Rectangle Shape to Connector

Started by snsisk, July 01, 2008, 01:32:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

snsisk


I'm new at shape development so what I'm asking may be elementary.  I'm looking for technique or approach information on how to add text to a connector to:

1)  Provide a soft shadow to the text block or shape.

2)  Keep the center of the text block or shape in the middle of the connector.

I have attached an image that looks something like the desired end state.

Thanks,

Steve

Lars-Erik

#1
Adding text to the center of a connection line is as simple as double clicking it, Visio will automaticly keep the text centered, unless you grab the yellow control handle and move it. The standard shadow option, will not work the way you want however, as it will draw a shadow below the line aswell as the text. You can use the fill option to create a filled background for your text.

If you draw a text field, it will draw a shadow of the text, not the field. So if you want it to look like the picture you added, you would probably need to create your own shape. Creating control lines with other shapes attached to them without destroying the built-in Visio options of the control line is (in my experience) tricky. But maybe someone else can come up with a good solution to this.

The text though shouldn't be a problem :)

- Lars

visProcessEng

I belive I have put something together that might help.

You make a dynamic connector,
Add text  "Call it text"

Using shape sheet add a "Section" assume it to be Geometry 2.

add 3 rows to this section (total of 5 rows).

Add formulas as follows


Geometry2.X1=Controls.TextPosition+TxtWidth*0.5
Geometry2.Y1=Controls.TextPosition.Y+TxtHeight*-0.5

Geometry2.X2=Controls.TextPosition+TxtWidth*-0.5
Geometry2.Y2=Geometry2.Y1

Geometry2.X3=Geometry2.X2
Geometry2.Y3=Controls.TextPosition.Y+TxtHeight*0.5

Geometry2.X4=Geometry2.X1
Geometry2.Y4=Geometry2.Y3

Geometry2.X5=Geometry2.X1
Geometry2.Y5=Geometry2.Y1

Unless you or I have made a mistake this should make a rectangular box centered about the "Text".  You can then set this box with a fill and shadow as you see fit.  Also the connector can be set to "Curved", without impacting the geometry of the box.

The connector will share the shadow setting of the box however. 

If you want to be able to rotate the text relative to the line, you will need to add a control point and set the Text Angle off of this AND dust off your old Trig books to manipulate the corners of the box based on the text angle. 

Hope this works for you.  Shoot me a message if you would like me to email you my little shape.

Cheers,
Steve


Visio Guy

Nice Steve!

You can also reference TxtPinX/Y instead of the control handle. They're linked on the Dynamic Connector.

Getting rid of the line where connector crosses the box is is pretty tricky, if not impossible (without code), but if your text is off the line, then you should be ok.

Control handle to rotate the text will be a bit tricky, because it won't follow the text-positioning control handle when it moves. IE: moving the position of the text will change the angle of the text. Might be better off using a Shape Data field for this, or making the text rotation handle operate about the lower-left of the shape (kind of abstract, though)
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

visProcessEng

#4
By setting Text Block Margins to Zero, or very nearly zero (if zero half the rectangle line gets impacted) the TextBlock background color will cover over the connector. 

Another option is to upgrade to Visio Professional (a big disappointment to me) and use the Data Graphic features.  These do give you a couple of helpful tools integrate data driven text with shapes.

It is noted that connectors are particularly problematic in this case because you never want them to be groups (because the group takes up so much space).  I have produced some stripped down versions of Data Graphics, which don't require the Data Graphics interface to work, however there is quite a bit of overhead associated with making them work and manipulating them. 

Again I would be happy to email you a vsd with the connector that I am talking about.

Chris that goes for you to.

Regards,
Steve

I have figured out how to post, or at least I will attempt below.


Regards,
Steve

Visio Guy

Here's a thought:

1. You make the shadow offset (0,0)
2. Make the line color 100% transparent (thus tricking Visio into still giving it a shadow)

The line is now completely behind the box, because it is really a shadow!
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

visProcessEng

#6
Nicely done! 

However it does sacrifice the first key objective.

"1)  Provide a soft shadow to the text block or shape."

I have posted a solution to a similar problem that I use for P&ID Line Tag Numbers on connectors.  Of course it doesn't have shadows either, I checked and shadows didn't seem to work with the text block.  It is likely possible to make it work, but would require more time and interest to atchieve.

Please note that the "Piping annotation leader" is not grouped with the line (it is connected but not grouped). 

snsisk

Wow!  You folks are awesome.  I never dreamed I'd get that kind of dialog from my question.  Thanks all.  I appreciate your comments and will need a little time to digest them.  If the best approach for this capability is VBA code, then that is certainly what I want to do.  Basically, I'm up for the challenge for developing this capability the right way.  I'd be more than happy to share the end product for posting on VisGuy.

I'm attempting to dress up a 40 inch x 60 inch diagram with many lines and labels.  Visio Guy, my rounded edges question was to add some pizazz to the rectangles in the same diagram.

Thanks all and keep those suggestions coming.

Steve

 

visProcessEng

I fear there is an excess of Steves participating in this post. 

In any event,

Steve,

If you have a very large diagram with a very large data set to manage,   I would think it would be worth inventing in the Visio Professional.  This would likely give you 90% of what you are looking for and will further assist in managing the data, as you will be able to link it to an external data source (Excel spreadheet).   

Just don't expect much from the VisPro "upgrade" outside of those two little bits.

P.S.  If this is being read by any MS people,  Please explain how you justify to yourselves bundling Visio Pro with Process Engineering Stencils from 1995?  The least you could have done would have been to resave them so that the file dates are CLOSE to 2007.  Just imagine poor Johnny (or Stevie) under the Christmas Tree, Opens his Visio 2007 Process Engineering Stencil and sees... 

The same Shapes that he already had from Visio 4.0. 

I WANT THE WORLD TO KNOW!

snsisk

visProcessEng,

I am using Visio 2003 Professional SP3.  Were you referring to another edition of Visio?

Unfortunately, the diagram I'm working on doesn't have much correlative data.  I'm attempting to add some flare to an otherwise dull and boring diagram.

I appreciate your willingness to share your expertise and knowledge.

visProcessEng

Regrettably the Data Graphics feature was added with Visio 2007.

Please appreciate this is not an endorsement of Data Graphics, however it is a very encouraging step forward from the folks at MS.

visProcessEng

This is an example of a Data Graphic.


Note that I have stripped out the shape data and user defined cells that the Data Graphic Engine from MS dumps into these shapes.  I find this stuff only confuses the shape and results in strange behavior from the data graphic shape, as well as being almost impossible to decipher.

vojo

this might help...feel free to play with the lines (offsets, centers, line bending, etc)


Visio Guy

@vojo,

I dig the isometric "column header" notes. Did you get the idea from the Isometric Pipe download?
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Visio Guy

@visProcessEng

A tip regarding grouped shapes: you can protect the shape against sub-selection (so that the user just thinks it's a shape, and doesn't sub-select your text box and blow away the linked field, for instance) by doing this:


  • Select shape
  • Format > Behavior
  • Selection = Group Only

Now the only way to get into the group is to open it up, via Edit > Open Group.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010