Hi Dean,
You can use the following code to add / remove shapes to / from layers.
'Find a particular shape and add/remove it to/from layers
For Each shape As Aspose.Diagram.Shape In diagram.Pages(0).Shapes
If shape.Name.ToLower() = "shape1" Then
'Add shape1 in first two layers. Here "0;1" are indexes of the layers
Dim layer As LayerMem = shape.LayerMem
layer.LayerMember.Value = "0;1"
ElseIf shape.Name.ToLower() = "shape2" Then
'Remove shape2 from all the layers
Dim layer As LayerMem = shape.LayerMem
layer.LayerMember.Value = ""
ElseIf shape.Name.ToLower() = "shape3" Then
'Add shape3 in first layer. Here "0" is index of the first layer
Dim layer As LayerMem = shape.LayerMem
layer.LayerMember.Value = "0"
End If
Next shape
diagram.Save("Drawing1.vdx", SaveFileFormat.VDX)
Best Regards,
Muhammad Ijaz
Support Developer, Aspose Sialkot Team
Contact Ushttp://www.aspose.comYour File Format Experts
Keep in touch! We're on
Twitter and
Facebook