Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Curtis_Waguespack
542 Views, 6 Replies

Open Drawing from Balloon

A quick example of how to open a drawing from a balloon.

 

@harvey3ELEA 

 

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument

While True

	'select Balloon
	Dim oBalloon As Balloon = Nothing
	oBalloon = ThisApplication.CommandManager.Pick _
	(SelectionFilterEnum.kDrawingBalloonFilter, _
	"Select a balloon to open a it's drawing. " & " (press ESC To Exit selection)")

	If IsNothing(oBalloon) Then Exit While

	Dim oLeader As Leader
	If oBalloon IsNot Nothing Then oLeader = oBalloon.Leader

	Dim oLeaderNode As LeaderNode = oLeader.AllNodes(oLeader.AllNodes.Count)
	Dim oIntent As GeometryIntent = oLeaderNode.AttachedEntity
	Dim oCurve As DrawingCurve = oIntent.Geometry
	Dim oProxy As EdgeProxy = oCurve.ModelGeometry
	Dim oOcc As ComponentOccurrence = oProxy.ContainingOccurrence
	Dim oRefDoc As Document = oOcc.Definition.Document
	Dim oFilePath As String = oRefDoc.FullFileName()
	Dim oDrawingFilePath As String = Left(oFilePath, Len(oFilePath) -3) & "idw"

	Try
		oDrawDoc = ThisApplication.Documents.Open(oDrawingFilePath, True)
		Exit While
	Catch
		MsgBox("Could not open " & oDrawingFilePath, , "iLogic")
	End Try


End While