Author Topic: Using Application.ConnectorToolDataObject  (Read 4818 times)

0 Members and 1 Guest are viewing this topic.

john.monroe

  • Newbie
  • *
  • Posts: 6
Using Application.ConnectorToolDataObject
« on: May 02, 2013, 12: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.

Code
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"))

« Last Edit: May 03, 2013, 11:27:52 AM by Visio Guy »

john.monroe

  • Newbie
  • *
  • Posts: 6
Re: Using Application.ConnectorToolDataObject
« Reply #1 on: May 02, 2013, 03: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.

Jumpy

  • Hero Member
  • *****
  • Posts: 1061
Re: Using Application.ConnectorToolDataObject
« Reply #2 on: May 03, 2013, 01: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

john.monroe

  • Newbie
  • *
  • Posts: 6
Re: Using Application.ConnectorToolDataObject
« Reply #3 on: May 03, 2013, 11:21:09 AM »
That is exactly what I needed.  Thanks much.