Skip to content
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

problem creating shape #102

Open
mythrandir52 opened this issue Jun 18, 2019 · 5 comments
Open

problem creating shape #102

mythrandir52 opened this issue Jun 18, 2019 · 5 comments

Comments

@mythrandir52
Copy link

i am having an issue creating a shape from the "Active Directory US" template. It can seem to find the shape listed. so the object is coming back as null. I know i am doing something probably simple wrong. Can someone help please. Is there an easy way to masters for a given visio doc.

The code open visio, create the page and then loads the active direct template but i can seem to grab the group or other objects from the shape template.

Mycode:
`
Import-Module Visio

$app= New-VisioApplication
$doc = New-VisioDocument

$grp = Open-VisioDocument "actdir_u.vstx"

$g = get-visiomaster -Name "Group" $grp

$shapes = New-VisioShape -Master $g -Points 2.2,6.8
`

@mythrandir52 mythrandir52 changed the title problem create shape problem creating shape Jun 18, 2019
@mythrandir52
Copy link
Author

i added as a test

$stencil_comp = Open-VisioDocument "Computers and Monitors.vss"
get-visiomaster -Name * $stencil_comp

and it came back with a list of the objects.

i get nothing back from

$grp = Open-VisioDocument "actdir_u.vstx"
get-visiomaster -Name * $grp

@guldmann0211
Copy link

Try changing ...

get-visiomaster -Name * -document $stencil_comp

@guldmann0211
Copy link

However when trying to place it...

PS C:\WINDOWS\system32> $shapes = New-VisioShape -Master $g -Points 2.2,6.8
New-VisioShape : Cannot bind parameter 'Points'. Cannot convert the "2,2" value of type "System.Double" to type
"VisioAutomation.Geometry.Point".
At line:1 char:45

  • $shapes = New-VisioShape -Master $g -Points 2.2,6.8
  •                                         ~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [New-VisioShape], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VisioPowerShell.Commands.VisioShape.NewVisioShape

@guldmann0211
Copy link

Tried various variations with the same lack of luck..

$shapes = New-VisioShape -Master $g -Points @(2.2,6.8)

or more elaborate

$point1 = New-Object VisioAutomation.Geometry.Point 2.0, 6.0
$point2 = New-Object VisioAutomation.Geometry.Point 2.0, 8.0
$points = @($point1,$point2)

Assuming $pc_master is correctly set

$shapes = New-VisioShape -Masters $pc_master -Points $points

@saveenr
Copy link
Owner

saveenr commented Apr 5, 2024

Sorry for the late response @guldmann0211. Will take a look very, very soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants