Connect line to edge of process

N

naive14

Totally new to Viso but...

How do I connect a line to touch the nearest edge of a process node ? What I
see so far by recording a macro is this :

Set vsoCell1 =
Application.ActiveWindow.Page.Shapes.ItemFromID(3).CellsU("BeginX")
Set vsoCell2 =
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(7, 4, 0)
vsoCell1.GlueTo vsoCell2

.... but use of CellsSRC would have to change coordinates when the line comes
from a different direction. Is there a function that does:

line1.glueto shape1, NearestEdge ???
 
J

JuneTheSecond

Hi naive14,

Is glue settings "glue to sides" on?
Would you try next?
ActiveDocument.GlueSettings = ActiveDocument.GlueSettings +
visGlueToGeometry
 
N

naive14

Thanks JuneII, I added your code to the beginning of my macro but it didn't
have an effect. Should I have to change how I identify the line ie: use
something other than CellsSRC. The line still gets put to the center of the
shape.

I got around the problem by moving the line/connector to the back so the
solid shape hid the line behind it. Maybe this is the better way but I
wouldn't mind knowing how to do this properly if you have a minute.

thanks.
 
J

JuneTheSecond

How do you like GlueToPos ?
myline.Cells("EndX").GlueToPos myrect, 0.5, 1
0.5 and 1 are the rate to the width and height.
for details please refer to the help of GlueToPos.
 
M

Mark Nelson [MS]

Yes, use dynamic (shape-to-shape) glue, rather than static (point-to-point)
glue:

Dim vsoCell1 As Visio.Cell
Dim vsoCell2 As Visio.Cell
Set vsoCell1 =
Application.ActiveWindow.Page.Shapes.ItemFromID(5).CellsU("BeginX")
Set vsoCell2 =
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionObject,
visRowXFormOut, 0)
vsoCell1.GlueTo vsoCell2
Set vsoCell1 =
Application.ActiveWindow.Page.Shapes.ItemFromID(5).CellsU("EndX")
Set vsoCell2 =
Application.ActiveWindow.Page.Shapes.ItemFromID(4).CellsSRC(visSectionObject,
visRowXFormOut, 0)
vsoCell1.GlueTo vsoCell2

In this example the connector is ShapeID 5. The shapes being glued to are
ShapeID 1 and 4. Notice that Cell2 is set to the Transform of the shape
instead of a particular connection point.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top