Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
rikard.nilsson
in reply to: MattH_Work

Hi,

 

I'm assuming that the Sketched Symbol has a leader, becuase I don't know how to attach a symbol in any other way..

 

But here is a quick way to find the view name. This is the one that I came up with anyway..

I hope that it will help you..

 

Regards

Rikard

 

Dim oSheet As Sheet = ThisDoc.Document.ActiveSheet
Dim symbol as SketchedSymbol
For Each item in oSheet.SketchedSymbols
    If item.Name = "Test" Then
        symbol = item
        Exit For
    End If
Next

Dim rn As LeaderNode = symbol.leader.AllNodes.Item(2)
Dim geoInt As GeometryIntent  = rn.AttachedEntity
Dim DC As DrawingCurve = geoInt.Geometry

For Each oView In oSheet.DrawingViews
        Dim LeftX As Double = oView.Left
        Dim RightX As Double = LeftX + oView.Width
        Dim TopY As Double = oView.Top
        Dim BottomY As Double = TopY-oView.Height
        
        If DC.MidPoint.x >= LeftX And DC.MidPoint.x <= RightX And DC.MidPoint.y >= BottomY And DC.MidPoint.y <= TopY Then
             MessageBox.Show(oView.Name, "Title")
            Exit For
        End If
Next