-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New-VisioRackShape v1.1 PR #78
base: master
Are you sure you want to change the base?
Conversation
Updated VisioShape.ps1 to add the new function New-VisioRackShape Updated VisioBot3000.psd1 FunctionsToExport to include New-VisioRackShape
Adds New-VisioRackShape_Example.ps1 to \Examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall really clean. A few comments/questions/suggestions in the main function
VisioShape.ps1
Outdated
.PARAMETER FirstU | ||
The first (lowest) U space in which to place the new rack equipment shape. | ||
|
||
.PARAMETER X |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confused by the x and y parameters. You're going to move the shape automatically, so why not just use these default values and not have the user supply them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided it would be nice to allow the user to chose where the initial shape is dropped prior to connecting it to the rack shape. Parameters $X
and $Y
are not mandatory. If they are not supplied they default to $X=1.00
and $Y=0.25
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to have default values, put that in the parameter definition...
[Parameter(Mandatory=$false)]$X=1.00
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to have default values, put that in the parameter definition... [Parameter(Mandatory=$false)]$X=1.00
I genuinely didn't know you could do that #everydayisaschoolday
:-)
I will amend the $X
and $Y
defaults when I have some free time later in the week/weekend. Thx
VisioShape.ps1
Outdated
} | ||
|
||
<# | ||
@Mike - unsure where $updatemode is set and if I need to worry about it here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, UpdateMode is kind of unsupported and experimental (and cool).
I would probably use an if/then like this:
if($updateMode){
$droppedshape=... (as in the commented code)
} else {
$droppedShape=$p.Drop .... (as you have it)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated as per feedback in VisioShape.ps1 - mc1903@b94cc8f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have been more clear.
In UpdateMode, to point is to use shapes on the page if they exist...if not, create a shape as necessary.
If you look at new-visioshape you can see how this might look.
As is, you wouldn't update the position of a rack shape in update mode.
Probably not a huge deal, but if we can make it work it would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have been more clear...
No, I am probably being a bit thick :-).
I assume I just set $UpdateMode=$true
before calling New-VisioRackShape
with updated rack equipment shape BeginXY and EndXY placements?
Again, I will look to fix this later in the week/weekend. Thx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Mike,
I hope you are well. Sorry it's taken me longer than I had planned to look at this again. It got busy at work and I spent most of last weekend replacing a built-in dishwasher; which turned out to be crash course in electrics, plumbing and carpentry!
I am still not getting how I invoke UpdateMode
in order to test it. If you have 5 mins can you give me an example of how it should work/be invoked? I did look at New-VisioShape
as you suggested but it doesn't help me tbh.
Do I need to add a -UpdateMode
parameter to the New-VisioRackShape
function? If this is the case, would a Set-VisioRackShape
function be better for moving existing shapes?
Cheers
M
Updated New-VisioRackShape function (now v1.2) based on Mike's initial PR78 feedback. MikeShepard#78 (comment)
I’m out of pocket until Monday afternoon myself. Update mode happens when you open an existing document. I’d have to think about how to make it make sense in your example. I’ll see what I can do and touch base early in the week.
Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: mc1903 ***@***.***>
Sent: Saturday, October 16, 2021 9:14:56 AM
To: MikeShepard/VisioBot3000 ***@***.***>
Cc: Mike Shepard ***@***.***>; Mention ***@***.***>
Subject: Re: [MikeShepard/VisioBot3000] New-VisioRackShape v1.1 PR (#78)
@mc1903 commented on this pull request.
________________________________
In VisioShape.ps1<#78 (comment)>:
+ }
+ ElseIf ($RackVendor -match 'Cisco') {
+ $FirstUBXY = $FirstU
+ $FirstUEXY = $FirstU
+ $BeginXY = "=PAR(PNT($RackLabel!Connections.Cab$($FirstUBXY)A.X,$RackLabel!Connections.Cab$($FirstUBXY)A.Y))"
+ $EndXY = "=PAR(PNT($RackLabel!Connections.Cab$($FirstUBXY)B.X,$RackLabel!Connections.Cab$($FirstUBXY)B.Y))"
+ }
+ Else {
+ Write-Verbose "Rack Vendor $RackVendor is NOT known/supported. Skipping!"
+ Break
+ }
+
+ }
+
+<#
+ @mike - unsure where $updatemode is set and if I need to worry about it here?
Hi Mike,
I hope you are well. Sorry it's taken me longer than I had planned to look at this again. It got busy at work and I spent most of last weekend replacing a built-in dishwasher; which turned out to be crash course in electrics, plumbing and carpentry!
I am still not getting how I invoke UpdateMode in order to test it. If you have 5 mins can you give me an example of how it should work/be invoked? I did look at New-VisioShape as you suggested but it doesn't help me tbh.
Do I need to add a -UpdateMode parameter to the New-VisioRackShape function? If this is the case, would a Set-VisioRackShape function be better for moving existing shapes?
Cheers
M
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#78 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABKI2IT7AGDNXZMHZ3V55Z3UHGCGBANCNFSM5EY6Q7BA>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
and...might be able to get to this tomorrow.
…On Sat, Oct 16, 2021 at 5:09 PM Mike Shepard ***@***.***> wrote:
I’m out of pocket until Monday afternoon myself. Update mode happens when
you open an existing document. I’d have to think about how to make it make
sense in your example. I’ll see what I can do and touch base early in the
week.
Get Outlook for iOS <https://aka.ms/o0ukef>
------------------------------
*From:* mc1903 ***@***.***>
*Sent:* Saturday, October 16, 2021 9:14:56 AM
*To:* MikeShepard/VisioBot3000 ***@***.***>
*Cc:* Mike Shepard ***@***.***>; Mention <
***@***.***>
*Subject:* Re: [MikeShepard/VisioBot3000] New-VisioRackShape v1.1 PR (#78)
***@***.**** commented on this pull request.
------------------------------
In VisioShape.ps1
<#78 (comment)>
:
> + }
+ ElseIf ($RackVendor -match 'Cisco') {
+ $FirstUBXY = $FirstU
+ $FirstUEXY = $FirstU
+ $BeginXY = "=PAR(PNT($RackLabel!Connections.Cab$($FirstUBXY)A.X,$RackLabel!Connections.Cab$($FirstUBXY)A.Y))"
+ $EndXY = "=PAR(PNT($RackLabel!Connections.Cab$($FirstUBXY)B.X,$RackLabel!Connections.Cab$($FirstUBXY)B.Y))"
+ }
+ Else {
+ Write-Verbose "Rack Vendor $RackVendor is NOT known/supported. Skipping!"
+ Break
+ }
+
+ }
+
+<#
+ @mike - unsure where $updatemode is set and if I need to worry about it here?
Hi Mike,
I hope you are well. Sorry it's taken me longer than I had planned to look
at this again. It got busy at work and I spent most of last weekend
replacing a built-in dishwasher; which turned out to be crash course in
electrics, plumbing and carpentry!
I am still not getting how I invoke UpdateMode in order to test it. If
you have 5 mins can you give me an example of how it should work/be
invoked? I did look at New-VisioShape as you suggested but it doesn't
help me tbh.
Do I need to add a -UpdateMode parameter to the New-VisioRackShape
function? If this is the case, would a Set-VisioRackShape function be
better for moving existing shapes?
Cheers
M
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#78 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKI2IT7AGDNXZMHZ3V55Z3UHGCGBANCNFSM5EY6Q7BA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Finally worked up an update example. After running your rack example and saving the doc in c:\temp\rack.vsdx, move the rack to the middle of the page (manually) and save the diagram. Copy your example script and change the new-visiodocument to open-VisioDocument -path c:\temp\rack1.vsdx -Update This will open the document in "update mode" Then, add to the end of the script this line (which just adds a new server to the rack) If it works, it would not move the rack back to the position specified in the script, but it would add the new server to the rack. I've adjusted the VisioShape.ps1 file and attached it here. I think I got it working. Just noticed that you're outputting $droppedShape if Verbose is specified...not sure why you'd to that. |
Hi Mike, Excellent, thank you. I will take a look over the weekend. Ref "Just noticed that you're outputting $droppedShape if Verbose is specified...not sure why you'd to that." As I was adding lots of rack equipment shapes, one after the other, the pages of $droppedShape output were just flashing past and giving me a bit of a headache. I felt I would only want to see the $droppedShape output if something wasn't working and I ran the function with -Verbose. Cheers |
About verbose...I see why you did that, but there are a couple of problems
with that approach.
1. Using Visiobot as a dsl requires that shape functions (like
add-visioshape) output the shape object. It doesn't seem like the
rackShape function will work in that mode so this isn't really a big deal.
2. Verbose output should be done with Write-Verbose, and is text only. If
you want optional object output, the accepted pattern is to add a
-Passthru switch.
…On Thu, Nov 4, 2021 at 4:58 AM mc1903 ***@***.***> wrote:
Hi Mike,
Excellent, thank you. I will take a look over the weekend.
Ref "*Just noticed that you're outputting $droppedShape if Verbose is
specified...not sure why you'd to that.*"
As I was adding lots of rack equipment shapes, one after the other, the
pages of $droppedShape output were just flashing past and giving me a bit
of a headache. I felt I would only want to see the $droppedShape output if
something wasn't working and I ran the function with -Verbose.
Cheers
M
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#78 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKI2IW332XNHUUMMQPZUXLUKJKOHANCNFSM5EY6Q7BA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Amended New-VisioRackShape function (now v1.4) based on Mike's feedback regarding UpdateMode.
Morning Mike. Updated as v1.4. I encountered this issue with your suggested logic for
Also, I took your earlier comments onboard, regarding my previous change to allow specifying the initial I am not too familiar with DSL, so have removed the logic that was suppressing the I hope this works for you, please let me know what you think. Cheers |
Hi @MikeShepard,
Pull Request for adding the
New-VisioRackShape
function as discussed in #77I have included an example in the CBH and an extended example in the Examples folder.
Let me know if you want any changes/etc.
Cheers.
M