Connector issue

I can not seem to get the ConnectShapesViaConnector to connect 2 process shapes. IS there something I am missing? Below is the code and the output image:

        Dim templateFileName As String = "C:\Randy.vss"
    <SPAN style="COLOR: green">'Dim vssDiagram As New Diagram("C:\VISIOTEST.vsd")</SPAN>

    <SPAN style="COLOR: blue">Dim</SPAN> lic <SPAN style="COLOR: blue">As</SPAN> <SPAN style="COLOR: #2b91af">License</SPAN> = <SPAN style="COLOR: blue">New</SPAN> <SPAN style="COLOR: #2b91af">License</SPAN>()
    lic.SetLicense(<SPAN style="COLOR: #a31515">"Aspose.Total.lic"</SPAN>)

    <SPAN style="COLOR: blue">Dim</SPAN> masterName <SPAN style="COLOR: blue">As</SPAN> <SPAN style="COLOR: blue">String</SPAN> = <SPAN style="COLOR: #a31515">"Process"</SPAN>

    <SPAN style="COLOR: blue">Dim</SPAN> cShape <SPAN style="COLOR: blue">As</SPAN> <SPAN style="COLOR: blue">Long</SPAN> = diagram.AddShape(2, 9.5, 1, 1, masterName, 0)

    <SPAN style="COLOR: blue">Dim</SPAN> shape <SPAN style="COLOR: blue">As</SPAN> <SPAN style="COLOR: #2b91af">Shape</SPAN> = diagram.Pages(0).Shapes.GetShape(cShape)

    shape.Text.Value.Add(<SPAN style="COLOR: blue">New</SPAN> <SPAN style="COLOR: #2b91af">Txt</SPAN>(<SPAN style="COLOR: #a31515">"Waiting Export"</SPAN>))
    shape.Name = <SPAN style="COLOR: #a31515">"Rectangle1"</SPAN>
    shape.XForm.LocPinX.Ufe.F = <SPAN style="COLOR: #a31515">"Width*0.5"</SPAN>
    shape.XForm.LocPinY.Ufe.F = <SPAN style="COLOR: #a31515">"Height*0.5"</SPAN>
    shape.Line.LineColor.Value = <SPAN style="COLOR: #a31515">"10"</SPAN>
    shape.Line.LineWeight.Value = 0.003
    <SPAN style="COLOR: green">'shape.Line.LinePattern.Value = 1</SPAN>
    shape.Fill.FillBkgnd.Value = <SPAN style="COLOR: #a31515">"1"</SPAN>
    shape.Fill.FillForegnd.Value = <SPAN style="COLOR: #a31515">"#533DFF"</SPAN>
    shape.Fill.FillPattern.Value = 30


    <SPAN style="COLOR: blue">Dim</SPAN> cShape2 <SPAN style="COLOR: blue">As</SPAN> <SPAN style="COLOR: blue">Long</SPAN> = diagram.AddShape(3.5, 9.5, 1, 1, <SPAN style="COLOR: #a31515">"Subprocess"</SPAN>, 0)

    <SPAN style="COLOR: blue">Dim</SPAN> shape1 <SPAN style="COLOR: blue">As</SPAN> <SPAN style="COLOR: #2b91af">Shape</SPAN> = diagram.Pages(0).Shapes.GetShape(cShape2)

    shape1.Text.Value.Add(<SPAN style="COLOR: blue">New</SPAN> <SPAN style="COLOR: #2b91af">Txt</SPAN>(<SPAN style="COLOR: #a31515">"Exported"</SPAN>))
    shape1.Name = <SPAN style="COLOR: #a31515">"Rectangle2"</SPAN>
    shape1.XForm.LocPinX.Ufe.F = <SPAN style="COLOR: #a31515">"Width*0.5"</SPAN>
    shape1.XForm.LocPinY.Ufe.F = <SPAN style="COLOR: #a31515">"Height*0.5"</SPAN>
    shape1.Line.LineColor.Value = <SPAN style="COLOR: #a31515">"10"</SPAN>
    shape1.Line.LineWeight.Value = 0.003
    <SPAN style="COLOR: green">'shape1.Line.LinePattern.Value = 1</SPAN>
    shape1.Fill.FillBkgnd.Value = <SPAN style="COLOR: #a31515">"1"</SPAN>
    shape1.Fill.FillForegnd.Value = <SPAN style="COLOR: #a31515">"#533DFF"</SPAN>
    shape1.Fill.FillPattern.Value = 30

    diagram.AddMaster(templateFileName, <SPAN style="COLOR: #a31515">"Dynamic connector"</SPAN>)

    <SPAN style="COLOR: blue">Dim</SPAN> connector1 <SPAN style="COLOR: blue">As</SPAN> <SPAN style="COLOR: #2b91af">Shape</SPAN> = <SPAN style="COLOR: blue">New</SPAN> <SPAN style="COLOR: #2b91af">Shape</SPAN>()
    <SPAN style="COLOR: blue">Dim</SPAN> connecter1Id <SPAN style="COLOR: blue">As</SPAN> <SPAN style="COLOR: blue">Long</SPAN> = diagram.AddShape(connector1, <SPAN style="COLOR: #a31515">"Dynamic connector"</SPAN>, 0)
    diagram.Pages(0).ConnectShapesViaConnector(cShape, <SPAN style="COLOR: #2b91af">ConnectionPointPlace</SPAN>.Right, cShape2, <SPAN style="COLOR: #2b91af">ConnectionPointPlace</SPAN>.Left, connecter1Id)

    <SPAN style="COLOR: blue">Dim</SPAN> imageStream <SPAN style="COLOR: blue">As</SPAN> <SPAN style="COLOR: blue">New</SPAN> <SPAN style="COLOR: #2b91af">MemoryStream</SPAN>()

    diagram.Save(imageStream, <SPAN style="COLOR: #2b91af">SaveFileFormat</SPAN>.PNG)

    <SPAN style="COLOR: blue">Me</SPAN>.rbIm.DataValue = imageStream.ToArray</PRE>


Hi Randy,

I cannot find variable 'diagram' declared in your code. Are you sure if this is the complete code? Please also attach Randy.vss file for further analysis.

Best Regards,

Here is the diagram var

Dim diagram As Diagram = New Diagram("C:\Randy.vss")
I have also attched the Randy.vss

Hi Randy,

Dynamic connector was missing from your stencil. After adding a new master for dynamic connector, I was able to create attached PNG from your code.

Best Regards,

Thank you for your response, I am still unable to get this to work, Could you please tell me how you added the Dynamic Connector to the Stencil? Thanks

Hi Randy,

You can open the stencil in MS Visio and drag the shapes from other shapes' windows to this stencil. I am also attaching a sample stencil. You can open this stencil in MS Visio and rename, delete or edit the masters according to your requirement.

Best Regards,