Balloons Position, Spacing and Overlap

Balloons Position, Spacing and Overlap

Ammar_HassanEHLNB
Explorer Explorer
467 Views
0 Replies
Message 1 of 1

Balloons Position, Spacing and Overlap

Ammar_HassanEHLNB
Explorer
Explorer

Hi Experts,

 

I am trying to automate the balloons positions with ilogic. With the reference code i have, it does a good job to align all the balloons in active sheet to perfectly horizontal with respect to leader positions. However, sometimes the leader head arrows of two balloons get very close to each other making the balloons overlap as shown in sample picture i shared. I want the balloons to not get overlapped, stay aligned vertically.

Can you give it a look and propose a solution, appreciated.

@JelteDeJong 

 

Dim doc As DrawingDocument = ThisDoc.Document
Dim sheet As Sheet = doc.ActiveSheet
Dim oTg As TransientGeometry = ThisApplication.TransientGeometry

For Each balloon As Balloon In sheet.Balloons	
    Dim moveBalloonX As Double = 10
	
    Dim posRootNode As Point2d = Balloon.Leader.AllNodes(2).Position

    Dim viewPos As Point2d = Balloon.ParentView.Position
    Dim viewWidth As Double = Balloon.ParentView.Width
    Dim viewHeight As Double = Balloon.ParentView.Height
    Dim viewScale As Double = Balloon.ParentView.Scale

    If (viewPos.X > posRootNode.X) Then
        'LEFT PLACEMENT
        moveBalloonX = viewPos.X - (viewWidth*0.75) - (moveBalloonX * viewScale)
    Else
        'RIGHT PLACEMENT
        moveBalloonX = viewPos.X + (viewWidth*0.75) + (moveBalloonX * viewScale)
    End If

    Dim posBalloon As Point2d = oTg.CreatePoint2d(moveBalloonX, posRootNode.Y)
    Balloon.Position = posBalloon
Next

  

0 Likes
468 Views
0 Replies
Replies (0)