Using Application.ConnectorToolDataObject

Started by john.monroe, May 02, 2013, 05:20:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

john.monroe

I am using Application.ConnectorToolDataObject to glue to objects together.  I want to further change some additional attributes of the glued connector but failing to do this.

I want to set the connector object to have a arrow and add some text but I can't seem to modify the connector after glueing.


import-module visiops

$visio = New-VisioApplication  | Out-Null

#Open an existing template
$ftdr_template = Open-VisioDocument "c:\temp\yourtemplate.vst"

#open a stencil
$ftdr_stencil = Open-VisioDocument c:\temp\yourtemplate_stencil.vss

$pages = $visio.ActiveDocument.Pages
$page = Get-VisioPage -Name "PRD Environment"

$master = Get-VisioMaster "ftdr.servers.outer.box" $ftdr_stencil
$Shape1 = New-VisioShape $master -Points $gridweb,5.2

$master = Get-VisioMaster "ftdr.servers.outer.box" $ftdr_stencil
$Shape2 = New-VisioShape $master -Points $gridapp,5.2

$connect = $page.Drop($page.Application.ConnectorToolDataObject,0,0)
$start = $connect.CellsU("BeginX").GlueTo($shape1.CellsU("PinX"))
$end = $connect.CellsU("EndX").GlueTo($shape2.CellsU("PinX"))



john.monroe

Taking this a step further I am able to get to some of the attibutes.
              $connect = $page.Drop($page.Application.ConnectorToolDataObject,0,0)
              $start = $connect.CellsU("BeginX").GlueTo($shape1.CellsU("PinX"))
              $end = $connect.CellsU("EndX").GlueTo($shape2.CellsU("PinX"))
              $connect.set_Text("80,443")

What i don't see if the line types attribute like i see described in the Graphical side of the tool.  I need to know what the name of the atribute is to set the endpoints to have arrows.

Jumpy

You Should look at the Visio SDK, that contains many nice examples or the Visio object model.
Many attributes of a shape are changes in the ShapeSheet, that is accessible via Code with .Cells or .CellsSRC.

For your example:
$connect.CellsU("BeginArrow").FormulaU = 10

http://msdn.microsoft.com/de-de/library/office/ff765204.aspx

john.monroe

That is exactly what I needed.  Thanks much.