-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from MikeShepard/Develop
Added support for VisioSettings (Import-VisioSettings) and included a…
- Loading branch information
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@{ | ||
StencilPaths='c:\temp' | ||
|
||
Stencils=@{Containers='C:\temp\MyContainers.vssx'; | ||
Servers='SERVER_U.vssx'} | ||
|
||
Shapes=@{WebServer='Servers','Web Server'; | ||
DBServer='Servers','Database Server' | ||
} | ||
Containers=@{Domain='Containers','Domain' | ||
} | ||
|
||
Connectors=@{SQL=@{Color='Red';Arrow=$true}} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Import-Module VisioBot3000 -Force | ||
|
||
|
||
#start Visio and create a new document | ||
New-VisioApplication | ||
New-VisioDocument C:\temp\TestVisioPrimitives.vsdx | ||
|
||
$doc=Get-VisioDocument | ||
Set-VisioDiagramServices -Document $doc -Value $vis.ServiceAll | ||
|
||
#adjust path to match the location you put the setting file. | ||
Import-VisioSettings -path C:\Users\mike\Documents\WindowsPowerShell\modules\VisioBot3000\Examples\DiagramSettings.psd1 | ||
|
||
#draw a container with two items in it | ||
Domain MyDomain { | ||
WebServer PrimaryServer | ||
DBServer SQL01 | ||
} | ||
|
||
#add a connector | ||
SQL -from PrimaryServer -To SQL01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<# | ||
.SYNOPSIS | ||
Reads a psd1 file with settings for the current diagram. | ||
.DESCRIPTION | ||
Reads a psd1 file with settings for the current diagram. Should be called after a diagram has been opened or created. | ||
Currently supported sections are: | ||
StenciPaths - list of paths to be added to the stencilpath | ||
Stencils - hashtable with name=nickname of stencil, value=filename to stencil | ||
Shapes - hashtable with name=nickname, value=array with stencilname and mastername | ||
Containers - hashtable with name=nickname, value=array with stencilname and mastername | ||
Connectors - hashtable with name=nickname, value=hashtable of parameters splatted to register-visioconnector | ||
.PARAMETER Path | ||
The path to the psd1 file. Must be a full path, not just a filename. | ||
.INPUTS | ||
You cannot pipe anything to Import-VisioSettings | ||
.OUTPUTS | ||
None | ||
.EXAMPLE | ||
Import-VisioSettings c:\Config\DepartmentalDiagramSettings.psd1 | ||
#> | ||
function Import-VisioSettings{ | ||
[CmdletBinding()] | ||
Param([string]$path) | ||
$dir=Split-Path -Path $path -Parent | ||
$file=split-path -Path $path -leaf | ||
$settings=Import-LocalizedData -FileName $file -BaseDirectory $dir | ||
if($settings.StencilPaths){ | ||
$settings.StencilPaths | foreach-object {Add-StencilSearchPath -Path $_} | ||
} | ||
|
||
if($settings.Stencils){ | ||
$Settings.Stencils.GetEnumerator() | foreach{Register-VisioStencil -Name $_.Key -Path $_.Value} | ||
} | ||
|
||
if($settings.Shapes){ | ||
$Settings.Shapes.GetEnumerator() | foreach{Register-VisioShape -Name $_.Key -From $_.Value[0] -MasterName $_.Value[1]} | ||
} | ||
if($settings.Containers){ | ||
$Settings.Containers.GetEnumerator() | foreach{Register-VisioContainer -Name $_.Key -From $_.Value[0] -MasterName $_.Value[1]} | ||
} | ||
if($settings.Connectors){ | ||
|
||
$Settings.Connectors.GetEnumerator() | foreach{$options=$_.Value;Register-VisioConnector -Name $_.Key @options} | ||
} | ||
|
||
|
||
} |