MikeShepard / VisioBot3000

Simple Visio Automation from Powershell
MIT License
50 stars 13 forks source link

1 of 2 shapes under container is not surrounded by or connected to its container. #75

Closed bfay65 closed 4 years ago

bfay65 commented 4 years ago

Hi! Thanks for all your great blogs! Am learning so much from this.

Perhaps I'm doing something wrong but downloaded your latest VisioBot3000 code and ran the sample at: https://github.com/MikeShepard/VisioBot3000/blob/master/Examples/VisioDSL3.ps1

1 of 2 shapes under container is not surrounded by or connected to the container (image attached).

image

Thanks!

bfay65 commented 4 years ago

The code I ran:

PS C:\PS\VisioBot3000-master>

clean-up because I'm re-running this over and over

stop-process -Name VISIO -ea SilentlyContinue remove-item c:\temp\testvisio5.vsdx -ea SilentlyContinue import-module VisioBot3000 -Force

Diagram C:\temp\TestVisio3.vsdx

Define shapes, containers, and connectors for the diagram

Stencil Containers -From C:\temp\MyContainers.vssx Stencil Servers -From SERVER_U.vssx Shape WebServer -From Servers -MasterName 'Web Server' Container Location -From Containers -MasterName 'Location' Container Domain -From Containers -MasterName 'Domain' Container Logical -From Containers -MasterName 'Logical' Connector SQL -Color Red -arrow

this is the diagram

Set-NextShapePosition -x 3.5 -y 7 Logical MyFarm { Location MyCity { Domain MyDomain { WebServer PrimaryServer WebServer HotSpare

    }
}
Location DRSite {
    Domain MyDomain -name SiteB_MyDomain {
        Set-RelativePositionDirection Vertical
        WebServer BackupServer

    }
}

} SQL -From PrimaryServer -To BackupServer Hyperlink $BackupServer -link http://google.com

Complete-Diagram

MikeShepard commented 4 years ago

I've seen this before, but can't reproduce it with the current repo.

bfay65 commented 4 years ago

Thanks for such a quick reply! Pardon me if I'm not doing something right. Am new to both power-shell and github: I clicked download on this page: https://github.com/MikeShepard/VisioBot3000, It says Latest commit: cc70594 on Jul 2, 2018. Is that not the latest? Sorry, but I reeeeeallly need to get this to work somehow in order to use VisioBot3000...Any thoughts?

Today I did this same operation (below) on a completely different machine in PS ISE Name : Windows PowerShell ISE Host Version : 5.1.18362.145

To install...I ran: CD "C:\PS\VisioBot3000-master" Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted $RootFolder = "C:\PS\VisioBot3000-master" CD $RootFolder

Import-Module VisioBot3000

Install-Module -Name VisioBot3000

Lastly ran the code with no errors:

clean-up because I'm re-running this over and over

stop-process -Name VISIO -ea SilentlyContinue remove-item c:\temp\testvisio3.vsdx -ea SilentlyContinue import-module VisioBot3000 -Force

Diagram C:\temp\TestVisio1.vsdx

Define shapes, containers, and connectors for the diagram

Stencil Containers -From C:\temp\MyContainers.vssx Stencil Servers -From SERVER_U.vssx Shape WebServer -From Servers -MasterName 'Web Server' Container Location -From Containers -MasterName 'Location' Container Domain -From Containers -MasterName 'Domain' Container Logical -From Containers -MasterName 'Logical' Connector SQL -Color Red -arrow

this is the diagram

Set-NextShapePosition -x 3.5 -y 7 Logical MyFarm { Location MyCity { Domain MyDomain { WebServer PrimaryServer WebServer HotSpare

    }
}
Location DRSite {
    Domain MyDomain -name SiteB_MyDomain {
        Set-RelativePositionDirection Vertical
        WebServer BackupServer

    }
}

} SQL -From PrimaryServer -To BackupServer Hyperlink $BackupServer -link http://google.com

Complete-Diagram

#########################

Thanks Mike!

bfay65 commented 4 years ago

image

bfay65 commented 4 years ago

I also wonder if it could be related to my Visio version...1911 Office 365 Plan 2. Is that the same version you used to try reproducing this?

Thanks

bfay65 commented 4 years ago

Figured something out...Second and 3rs server in list of children are is container, so it's skipping the first...and I did see one of your more recent changes was about skipping something. Haven't had time to look at code again yet: New-VisioContainer -shape (Get-VisioShape Location) -label DRSite -contents { New-VisioContainer -shape (Get-VisioShape Domain) -label MyDomain -contents { New-VisioShape -master WebServer -label BackupServer -x 5 -y 8 New-VisioShape -master WebServer -label BackupServer_2 -x 6 -y 8 New-VisioShape -master WebServer -label BackupServer_2 -x 7 -y 8 } }

image

bfay65 commented 4 years ago

I just removed the Skip 1 like you had done (I believe in your last commit) and all works great now!:

image

Am trying to understand how I did NOT have that change. As I said, I clicked download on this page: https://github.com/MikeShepard/VisioBot3000, which says "Latest commit: cc70594 on Jul 2, 2018".

So was this (above) NOT actually the latest code? Is there a better place from which to grab the latest and be sure? Learning here and want to be sure I understand.

Thanks so much!

MikeShepard commented 4 years ago

I'm as confused as you are. I just downloaded the code via the download link and the zip has the correct code (without the skip). I cloned the repo locally when you opened the issue and it also didn't have the skip.

Not sure how you got an old commit, but that's what it sounds like.

FWIW, at least you've got things working now. If you have questions about using VisioBot let me know.

bfay65 commented 4 years ago

Thanks so much Mike! I don't believe I've had this great/prompt/helpful of a response from anyone in other sites/blogs etc...so I really appreciate experiencing this process more like a real conversation with a pro who really cares and is passionate about their art-form (rather than waiting for days...weeks for someone to get back with me with a not-so-helpful answer). Am thrilled to have this working! Have been more of a .Net C# programmer until recently - thus some ignorance re: Power-Shell/Visio.

...and since you kindly mentioned asking more VisioBot questions...(be careful what you ask for) (;

NOTE: Please lmk if this should begin a different venue/new dialog for this topic below - is somewhat related/gives the reason behind why I asked the above questions in the first place:

I've been working on a PowerShell project to pull shape data from hundreds of original ("Non-Visualizer", Visio, Cross-functional) diagrams into a Visualizer template, but have since discovered Visualizer limitations:

Based on my own research - I've come to the following (potentially flawed) conclusions about Visio and its Visualizer capabilities:

  1. No way to convert "Non-Visualizer" diags. into "Visualizer" diags. (to avoid manually redoing the data side of all of my diagrams)
  2. Visualizer really has no way to control drop coordinates for each shape or container
  3. No way to contain child shapes inside of parent shapes
  4. ...thus when 'contained' shapes are created, they are plopped down in separate locations (within the designated function but far from their respective parent container
  5. Once I open the new 'Visiolized' diag., I try to manually move the shapes back into their containers - only to have ALL THE SHAPES REARRANGE Maddening!!! ):

It baffles me that the devs haven't taken this tech (Visualizer) to the next level...it's sooo close to being something people can use for some more complex processes. Yet it seems they've left out some obvious/blaring capabilities.

So, I set out to create my own 'Visio-lizer' using com objects in Powershell. A bit of a learning curve. As I progressed, I discovered even more annoying things about Visio along the way (part of this frustration perhaps coming from my own ignorance of the nuances and vastness of Visio - a love/hate relationship for me, actually). I kept thinking there had to be others who have tried this - searching the net without much luck. I had even found one of your articles at one point but couldn't get a sample to work (my bad for not sticking with it). Then moved on at the time. Weeks went by as I learned how to extract objects from the original diags (am still struggling a bit to get the relationships between each, types of shapes etc. but am now close).

Then FINALLY last week; though getting closer to building the new diags. to my own specs from the old data with COM objects, I was still struggling with containing objects appropriately. I searched again for examples - stumbled upon your code here - you know the rest.

I wrote this novella above for 2 reasons:

  1. Out of respect for your great efforts on this through the years, others may more readily see this and understand its value.
  2. Am thinking if you know some details of my own struggle, you'll be able to spot/poke holes in any misconceptions I may have about my approach, perception of Visio, use of PS, etc.. I.E.:
    1. Maybe you're aware of some Visualizer capabilities I've misunderstood
    2. Can give tips on extracting objects from the original diags...esp. re: Retrieving type data from orig. to determine new shape type in new data diag. Retrieving connector (parent/child) relationships between shape, containers, functions & phases:
    3. Related to #2 above: when attempting to connect shapes with Visualizer, I felt obligated to relate the container to each child-server(s) within, then back out to the container, then to the next container...and so on. Am now wondering how to best reflect this in the data template for my 'Visio-Lizer" PS code.
    4. ...and lastly - related to #3 (above): IDK if you're familiar with SquaredUp, but assume so if you're writing code related to mapping servers... I should be trying to somehow match those parent/child relationships to the XML relationships of containers/child-components I'm getting from SquaredUp Application XML (so I can update VisioTile (creating interactive diagrams with health checks) as servers are updated and relationships are changed). This is something I can likely figure out through time, but if you're aware of any other tips, tricks, techs I don't know about related to this, I'd love to hear them.

Thanks for indulging me!

bfay65 commented 4 years ago

And FYI - Absolutely no expectations on response to the last comment/ramble. More food for thought (and fishing for more knowledge) than anything.

Happy New Year!