How use the GlueTo method (Two 2D shapes)

Started by Miguel, February 08, 2017, 07:54:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

How use the GlueTo method (Two 2D shapes)

I have not option :(
1 (100%)
I have not option :(
0 (0%)

Total Members Voted: 1

Miguel

Hello world !

I need your brains to solve a small problem that I have encountered just recently. Indeed, I would like to know how to use the "GlueTo" method to glue two 2D shapes.

Public Sub Document_ShapeAdded (ByVal vsoShapeAdded As IVShape)

Dim vsoShapeOnPage As Visio.Shape
Dim vsoDocument As Visio.Document
Dim vsoPage As Visio.Page

Dim vsoReturnedSelection As Visio.Selection
Dim intSpatialRelation As VisSpatialRelationCodes


intSpatialRelation = visSpatialOverlap + visSpatialContainedIn
Set vsoReturnedSelection = vsoShapeAdded.SpatialNeighbors(intSpatialRelation, 0, 0)

    'Evaluate the results.
    If vsoReturnedSelection.Count = 0 Then
        'Aucune forme satisfait aux critères établis par les arguments de la méthode.
        strSpatialRelation = vsoShapeAdded.Name & " is not contained."
    Else
        'Build the positive result string.
        For Each vsoShapeOnPage In vsoReturnedSelection
           If vsoShapeOnPage.Name Like "Function*" And vsoShapeAdded.Name Like "port*" Then
               strSpatialRelation = strSpatialRelation & vsoShapeAdded.Name & " is contained by " & vsoShapeOnPage.Name & Chr$(10)


               '---> I've to use the GlueTo method

            End If
        Next
    End If

'Display the results on the shape added.
vsoShapeAdded.Text = strSpatialRelation

End Sub


As you can see, my program is using the SpatialNeighbors property to find out if one shape is contained in another. if I have a Shape which is contained in an another Shape so I have to stick my shapes with the GlueTo method. But I have trouble using this method. 
Here, My function is a Rectangle and my port is a group of Shape (Line + triangle)


So if you have a any solution or idea don't hesitate. Thank you