Programmatically redirect links on drawing

G

Guy007

I have a VDX drawing which I am processing and manipulating through code.
One thing I want to do is to redirect a link's endpoint which is glued to a
shape's centre, to the centre of another shape on the drawing.

How can I do this? What XML element(s) do I need to change?
 
G

Guy007

Note that I need to do this using DatadiagramML and not by launching a Visio
instance in my .NET application.

thanks
 
A

AlEdlund

Mine look like this. Starts at shape(filesrv) connectionpoint(right) and
goes to shape(router) connectionpoint(right)


<BeginX Unit='FT'
F='PAR(PNT(FileSrv!Connections.right.X,FileSrv!Connections.right.Y))'>107</BeginX>
<BeginY Unit='IN'
F='PAR(PNT(FileSrv!Connections.right.X,FileSrv!Connections.right.Y))'>44</BeginY>
<EndX Unit='FT'
F='PAR(PNT(Router!Connections.right.X,Router!Connections.right.Y))'>107</EndX>
<EndY Unit='IN'
F='PAR(PNT(Router!Connections.right.X,Router!Connections.right.Y))'>66.75</EndY>
 
G

Guy007

Mine is different:
F="_WALKGLUE(EndTrigger,BegTrigger,WalkPreference)"

Where
BegTrigger = "_XFTRIGGER(Project!EventXFMod)"
EndTrigger = "_XFTRIGGER(Project.2!EventXFMod)"

And how do you compute the numeric values for BeginX, EndX, etc?

Thanks!
 
C

Chris Roth [Visio MVP]

Al's examples are glued to connection points.

Guy007's connectors are glued dynamically - they will walk around the
shape. These are probably easier to change, since there are no numerical
values to recalculate.

When working with Visio xml, you can leave some data out, and Visio will
recalculate it when you open the drawing (in Visio)

If the drawing will never be opened in Visio, then you run the danger of
having to re-write everything that Visio does.

For example, I use automation to drop shapes on a page, and to connect
them. I let Visio do the routing of the connectors for me.

Similarly, when I create a Visio-xml file, I specify the begin- and end-
shapes to which connectors are glued, but I don't do the routing. I let
Visio horse with that when the drawing gets opened.



--
Hope this helps,

Chris Roth
Visio MVP


Visio Guy: Smart Graphics for Visual People

Articles: http://www.visguy.com
Shapes: http://www.visguy.com/shapes
Dev: http://www.visguy.com/category/development/
Forum: http://www.viguy.com/vgforum
 
G

Guy007

Hi Chris,

I tried clearing out the MoveTo and LineTo X and Y values of the link in the
<Geom> tag. I also cleared the PinX and PinY values in the<XForm> tag.

I also modified the BegTriggger and EndTrigger formulae to point to the new
shapes.

When I open the drawing in Visio, the line does not show up (or it shows up
in the incorrect location). But then, if I drag about one of the two new
endpoint shapes of the link, the link gets displayed correctly.

Any ideas why this is happening, and how I can cause Visio to compute the
missing values as soon as the drawing is opened (instead of when the shape is
moved)?

Ideally, I would not like to use automation to draw shapes. A simple
straight line connector is all that I need - I don't really mind at this
stage, if the link passes over existing shapes or links in the drawing!

Thanks to everyone for your help! :)

Dan
 
C

Chris Roth [Visio MVP]

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