Visio Guy

Visio Discussions => Visio 2010 Issues => Topic started by: john.monroe on May 02, 2013, 05:20:33 PM

Title: Using Application.ConnectorToolDataObject
Post by: john.monroe on May 02, 2013, 05:20:33 PM
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"))


Title: Re: Using Application.ConnectorToolDataObject
Post by: john.monroe on May 02, 2013, 08:10:30 PM
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.
Title: Re: Using Application.ConnectorToolDataObject
Post by: Jumpy on May 03, 2013, 06:18:21 AM
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
Title: Re: Using Application.ConnectorToolDataObject
Post by: john.monroe on May 03, 2013, 04:21:09 PM
That is exactly what I needed.  Thanks much.