如何摆脱形状标签

How to get rid of the Shape Label

我正在尝试自动化网络图,但我无法摆脱云形标签。当我尝试去掉 -Label 参数时,云不会被绘制出来。我知道我可以手动删除标签,但是有没有一种方法可以不使用 -Label 参数来绘制云?我在下面提供了我的代码:

#Import-Module Visio
Import-Module VisioBot3000 -Force

## Variables
$Username = $env:USERNAME
$set_x = 2.25
$set_y = 5.5
## Empty CE Router List
$CE_Router_List = @()
## Empty Site Address list
$Site_Address = @()
## Empty arrows list
$arrows = @()
$Gold_Car_List = @()


$Servers = Read-Host 'How many routers do you have?'

## Opens the Visio application
New-VisioApplication
## Opens the Verizon network diagram template
Open-VisioDocument
## Creates a new Visio Page
New-VisioPage

## Register the network shapes stencil (with US measurements)
$CloudStencil = Register-VisioStencil -Name NetworkLocations -Path 'NETLOC_U.VSSX'
$PESwitchStencil = Register-VisioStencil -Name NetworkSymbols -Path 'NETSYM_U.VSSX'
$GoldCarStencil = Register-VisioStencil -Name BasicShapes -Path 'BASIC_U.VSSX'

## Register the PE switch shape
$PE_Switch_Shape = Register-VisioShape -Name 'ATM switch' -StencilName NetworkSymbols -MasterName 'ATM switch'
## Register the CE Router shape
$CE_Router_Shape = Register-VisioShape -Name Router -StencilName NetworkSymbols -MasterName Router
$Cloud_Shape = Register-VisioShape -Name Cloud -StencilName NetworkLocations -MasterName Cloud
## Register the Gold CAR
$Gold_Car = Register-VisioShape -Name Can -Stencil BasicShapes -MasterName Can

## Creates the initial Cloud
$Cloud = New-VisioShape Cloud -Label Cloud -x 5.6296 -y 4.445
## Adjusts the width of the Cloud
$Cloud_Width = $Cloud.CellsU('Width').FormulaU = '3 in'
## Adjusts the height of the Cloud
$Cloud_Height = $Cloud.CellsU('Height').FormulaU = '1.89 in'

<#
.SYNOPSIS
    Sets the color of a shape
.DESCRIPTION
    Sets the color of a shape and subshapes to a given color
.EXAMPLE
    $shape= add-visioshape -stencil BasicShapes -name Square
    Set-ShapeColor -shape $shape -color Red
.INPUTS
    You cannot pipe any objects into Set-ShapeColor
.OUTPUTS
    None
.PARAMETER Shape
    The shape to apply the color to
.PARAMETER Color
    The color you want the shape to be
    #>
function Set-VisioShapeColor {
    [CmdletBinding()]
    Param($Shape,
        [System.Drawing.Color]$Color,
        [ValidateSet('FillForegnd', 'FillBkgnd')]$FillType = 'FillBkgnd'
        )
    $ColorFormula = "=THEMEGUARD(rgb($($Color.R),$($Color.G),$($Color.B)))"


    $shape.CellsU($fillType).FormulaForce = $ColorFormula
    $shape.CellsU('FillGradientEnabled').FormulaForce = 'FALSE'
    $shape.CellsU('FillPattern').FormulaForce = '1'
    $shape.shapes | foreach-object {
        $_.CellsU('FillGradientEnabled').FormulaForce = 'FALSE'
        $_.CellsU($fillType).FormulaForce = $colorFormula 
    }
}

## Set the Cloud color to gray
Set-VisioShapeColor -shape $PIP_Cloud -color Gray

##Creates all of the CE Routers
$num = 0
for ($initial = 1; $initial -le $Servers; $initial++) {
    $CE_Router = New-VisioShape -Master Router -Label '123 Ashwood Drive, Los Angeles, California' -x $set_x  -y $set_y -Name MyRouter
    $CE_Router.CellsU('Width').FormulaU = '0.20 in'
    $CE_Router.CellsU('Height').FormulaU = '0.15 in'
    $CE_Router.CellsU("Char.Size").FormulaU="7 pt"
    $CE_Router_List += $CE_Router
    $num++
}

## The arrows that connect from the Cloud to the CE Router.
Foreach($element in $CE_Router_List)   {
   $arrows+=New-VisioConnector -From $Cloud -To $element -name SQLConnection -Arrow -color Red
}

$page=Get-VisioPage
$Page.PageSheet.CellsSRC(1,24,8).FormulaForceU="6"
$Page.PageSheet.CellsSRC(1,24,9).FormulaForceU="16"
$Page.Layout()
$Page.ResizeToFitContents()

$sel = New-VisioSelection -Objects ($CE_Router_List.Name+$arrows.Name+'Cloud') -Visible

你想要的语法来自:

https://www.powershellstation.com/2016/04/29/introducing-visiobot3000-part-2-superman/

所以在页面上放置形状的代码行的语法是:

New-VisioShape -master WebServer -name PrimaryServer -x 5 -y 5

您的代码不遵循此格式。