Hello, I installed the Aspose.Diagram nuget package for VB.NET but I am having some issues. I basically converted the code from the C# page on yall’s website since there were no VB examples. I modified this one to be circles but i have tested with rectangles as well. I added some test values and after testing a level with 6 objects it does not draw all my connections it only draws 2 connections. What am i doing wrong? It will draw 3 or 4 connections if i start to take away some of my shapes/connections but i am not understanding what the issue is
Private Sub CircleTest()
Dim diagramObject As New InputC()
Dim InputCircles As New List(Of InputCircle)
Dim InputConnectors As New List(Of InputConnector)
Dim Page As New Aspose.Diagram.Page
Dim ShapeX As New Aspose.Diagram.Shape()
Dim ShapeId As Long
Dim Test2 As String()
InputCircles = New List(Of InputCircle) From {
New InputCircle() With {
.name = "A",
.text = $"Mike Brady{vbCrLf}Carol Brady"
},
New InputCircle() With {
.name = "B",
.text = $"Greg Brady"
},
New InputCircle() With {
.name = "C",
.text = "Peter Brady"
},
New InputCircle() With {
.name = "D",
.text = "Bobby Brady"
},
New InputCircle() With {
.name = "E",
.text = "Marcia Brady"
},
New InputCircle() With {
.name = "F",
.text = "Jan Brady"
},
New InputCircle() With {
.name = "G",
.text = "Cindy Brady"
},
New InputCircle() With {
.name = "H",
.text = "Tom Brady"
}
}
InputConnectors = New List(Of InputConnector) From {
New InputConnector() With {
.OriginShapeName = "A",
.DestinationShapeName = "B"
},
New InputConnector() With {
.OriginShapeName = "A",
.DestinationShapeName = "C"
},
New InputConnector() With {
.OriginShapeName = "A",
.DestinationShapeName = "D"
},
New InputConnector() With {
.OriginShapeName = "A",
.DestinationShapeName = "E"
},
New InputConnector() With {
.OriginShapeName = "A",
.DestinationShapeName = "F"
},
New InputConnector() With {
.OriginShapeName = "A",
.DestinationShapeName = "G"
},
New InputConnector() With {
.OriginShapeName = "B",
.DestinationShapeName = "H"
},
New InputConnector() With {
.OriginShapeName = "C",
.DestinationShapeName = "H"
},
New InputConnector() With {
.OriginShapeName = "D",
.DestinationShapeName = "H"
},
New InputConnector() With {
.OriginShapeName = "E",
.DestinationShapeName = "H"
},
New InputConnector() With {
.OriginShapeName = "F",
.DestinationShapeName = "H"
},
New InputConnector() With {
.OriginShapeName = "G",
.DestinationShapeName = "H"
}
}
diagramObject = New InputC() With {
.InputCircles = InputCircles,
.InputConnectors = InputConnectors}
Dim BSDiagram As New Aspose.Diagram.Diagram("Basic Shapes.vss")
Page = BSDiagram.Pages(0)
Dim ShapeNames As New Dictionary(Of String, Long)
For Each circle In diagramObject.InputCircles
ShapeX = New Aspose.Diagram.Shape()
ShapeId = BSDiagram.AddShape(ShapeX, "Circle", 0)
ShapeNames.Add(circle.name, ShapeId)
ShapeX = Page.Shapes.GetShape(ShapeId)
ShapeX.Text.Value.Add(New Aspose.Diagram.Txt(circle.text))
Next
For Each connector In diagramObject.InputConnectors
Dim connectorId = BSDiagram.AddShape(New Aspose.Diagram.Shape(), "Dynamic connector", 0)
Page.ConnectShapesViaConnector(ShapeNames(connector.OriginShapeName),
Aspose.Diagram.Manipulation.ConnectionPointPlace.Bottom,
ShapeNames(connector.DestinationShapeName),
Aspose.Diagram.Manipulation.ConnectionPointPlace.Top,
connectorId)
Next
Dim layoutOptions As New Aspose.Diagram.AutoLayout.LayoutOptions() With {
.LayoutStyle = Aspose.Diagram.AutoLayout.LayoutStyle.FlowChart,
.Direction = Aspose.Diagram.AutoLayout.LayoutDirection.TopToBottom,
.SpaceShapes = 2,
.EnlargePage = False
}
BSDiagram.Layout(layoutOptions)
Page.PageSheet.PrintProps.PrintPageOrientation.Value = Aspose.Diagram.PrintPageOrientationValue.Portrait
Dim saveOptions As New Aspose.Diagram.Saving.DiagramSaveOptions()
saveOptions.SaveFormat = Aspose.Diagram.SaveFileFormat.Vsdx
saveOptions.AutoFitPageToDrawingContent = True
BSDiagram.Save("output.vsdx", saveOptions)
MsgBox("Done")
End Sub
Public Class InputC
Public Property InputCircles As List(Of InputCircle)
Public Property InputConnectors As List(Of InputConnector)
End Class
Public Class InputConnector
Public Property OriginShapeName As String
Public Property DestinationShapeName As String
End Class
Public Class InputCircle
Public Property name As String
Public Property text As String
End Class