Quantcast
Channel: VisioAutomation
Viewing all articles
Browse latest Browse all 742

New Post: new-visiogroup

$
0
0
This is a great example and when I run it it works. but..... I am struggling with the issue of grouping. Using your example in my code i get the following.
Cannot convert 'Microsoft.Office.Interop.Visio.ShapeClass' to the type 'Microsoft.Office.Interop.Visio.Shape' required by parameter 'Shapes'. Specified method is not supported.

The difference I think has to do with way you are dropping shapes. I decided to not drop the shapes as an array but individually.

Can you take a look at this section of code and tell me what I am not understanding?
    #This section draws the server boxes in the web server column
    $master1 = Get-VisioMaster "ftdr.servers.outer.box" $ftdr_stencil 
    $Shape1 = New-VisioShape $master1 -Points $gridweb,5.2

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

    $pages = $global:visio.ActiveDocument.Pages

    $envvalueall = $envvalue + " Environment"
    $page = Get-VisioPage -Name  $envvalueall

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

    Write-Host "Web Servers Direction: " $Webserversdirection

    if ($Webserversdirection -eq "Bi-Directional"){
        $connect.CellsU("EndArrow").FormulaU = 13
        $connect.CellsU("BeginArrow").FormulaU = 13
    }
    elseif ($Webserversdirection -eq "Right"){
        $connect.CellsU("EndArrow").FormulaU = 13
    }
    elseif($Webserversdirection -eq "Left"){

        $connect.CellsU("BeginArrow").FormulaU = 13
    }


    $master4 = Get-VisioMaster "ftdr.servername.whitebox.red" $ftdr_stencil 
    $Shapes4 = New-VisioShape $master4 -Points $gridweb,5.6
    Set-VisioText -Text "VIP"

    $master5 = Get-VisioMaster "ftdr.servername.whitebox.red" $ftdr_stencil 
    $Shapes5 = New-VisioShape $master5 -Points $gridweb,5.2
    Set-VisioText -Text "<env><site><tenant><number>"

    $master6 = Get-VisioMaster "ftdr.servername.whitebox.red" $ftdr_stencil 
    $Shapes6 = New-VisioShape $master6 -Points $gridweb,5
    Set-VisioText -Text "<env><site><tenant><number>"


    $master7 = Get-VisioMaster "ftdr.servername.whitebox.red" $ftdr_stencil 
    $Shapes7 = New-VisioShape $master7 -Points $gridweb,4.8
    Set-VisioText -Text "<env><site><tenant><number>"


    $master8 = Get-VisioMaster "ftdr.servername.whitebox.red" $ftdr_stencil 
    $Shapes8 = New-VisioShape $master8 -Points $gridweb,4.6
    Set-VisioText -Text "<env><site><tenant><number>"

    #Group the objects together
    $g1 = New-VisioGroup -Shapes $shapes1,$shapes4,$shapes5,$shapes6,$shapes7,$shapes8

Viewing all articles
Browse latest Browse all 742

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>