Shape copying confusion

I have a script which copies a file, then attempts to copy a shape from the first page 10 times onto the second page, moving each shape an inch to the right.

What I end up with is:

  1. 3 copies of the shape
  2. The names of the 2nd and 3rd copy aren’t what they’re set to (but the 1st is fine)
  3. If I make the page auto-size, it sizes like there are 10 of them (lots of blank space to the right).
  4. The container styles of the original, the first copy and the other copies are all different (well, copy 2 and 3 are the same…but there are 3 different looks).
  5. The spacing of the 3 copies isn’t consistent…there’s an extra space (like there’s a missing copy) between the 1st and 2nd copy.

I have attached a zip of the input file as well as a sample output.

Here’s the code:

$template='c:\temp\TestDocument.vsdx'
$diagramfile=join-path c:\temp\ "$([guid]::newguid()).vsdx"
copy-item $template $diagramfile 
 $doc = New-Object Aspose.Diagram.Diagram -ArgumentList $diagramFile
 
  $sourcepage=$doc.pages[0]
  $shape=$sourcepage.Shapes.GetShape([int]3005)
  
  $page=$doc.Pages[1]
  $pos=0
  $page.pagesheet.Copy($sourcePage.PageSheet)
  1..10 | foreach {
  $shape2=new-object Aspose.Diagram.Shape
    $shape2.Copy($shape)
    $addedID=$page.Addshape($shape2,$shape2.master.name)
    $shape2.Name="NEWSHAPE.$addedID"
    $shape2.Move($pos,0)
    $shape2.SetWidth($shape2.xform.width.value)
    write-host "Added shape with Id $addedID, $($shape2.name)"
    $pos+=1
}
$doc.Save($diagramFile, [Aspose.Diagram.SaveFileFormat]::vsdx)
ii $diagramfile

TestDocument.zip (236.7 KB)

e058b69d-4546-48a4-aa4d-af45375161a1.zip (247.9 KB)

This post was flagged by the community and is temporarily hidden.

@MikeShepard1
Thanks for the template file and out file.
After an initial testing, I am able to reproduce the issue as you mentioned by using your template file.I found the shapes are not all displayed.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): DIAGRAMNET-53815

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.