Imports System.IO
Imports System.Runtime.InteropServices
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgePart.PartDocument
Dim objBalloons As SolidEdgeFrameworkSupport.Balloons
Dim objBalloon1 As SolidEdgeFrameworkSupport.Balloon = Nothing
Dim objPMI As SolidEdgeFrameworkSupport.PMI
Try
'Get Application object
objApp = Marshal.GetActiveObject("SolidEdge.Application")
'Get Part document containing an extruded part
objDoc = objApp.ActiveDocument
'Get the PMI object from the document
objPMI = Nothing
objDoc.PMI_ByModelState(objPMI)
'Get the balloons collection from the PMI object
objBalloons = objPMI.Balloons
Dim i As Integer
For i = 1 To objBalloons.Count Step 1
objBalloon1 = objBalloons.Item(i)
Next
Dim PMIBalloonName As String
'Get the name of balloon object
PMIBalloonName = objBalloon1.PMIName
MsgBox(PMIBalloonName.ToString)
'Set the name for balloon object
objBalloon1.PMIName = "Test"
Catch ex As Exception
MsgBox(ex.ToString)
objApp = Nothing
objDoc = Nothing
objBalloons = Nothing
objBalloon1 = Nothing
objPMI = Nothing
If Not objDoc Is Nothing Then
objDoc.Close(False)
objDoc = Nothing
End If
End Try
End Sub
End Class