Showing results for 
Search instead for 
Did you mean: 



i want to create a balloon symbol in assembly document, but failed. The codes are as follows:

    Dim objApp As SolidEdgeFramework.Application = GetObject(, "SolidEdge.Application")
    Dim objDoc As AssemblyDocument = objApp.ActiveDocument
    Dim objPMI As Object = Nothing


    Dim objBalloons As Balloons = objPMI.Balloons
    Dim objBalloon As Balloon

    objBalloon = objBalloons.Add(0, 0, 0)


but the returned "objBalloon" is nothing.  SolidEdge version is ST3.






Re: PMI_ByModelState

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I tested the following code on the latest version of SE and I believe that the AnnotInitData object was added only in ST5, so this probably won't help you on ST3.

Anyway, PMI API support was very limited or almost did NOT exist in early versions of ST and I don't remember when the PMI balloon creation really started to work!


EDIT: I think, the Balloons.Add() method you have used is intended to be used for Draft only.


' ASM: Create a PMI balloon attached to an occurrence
Dim objDoc As AssemblyDocument = objApp.ActiveDocument
Dim objOcc As Occurrence = objDoc.Occurrences.Item(1)
' Compute the range box of the first occurrence
Dim xMin, yMin, zMin As Double
Dim xMax, yMax, zMax As Double
objOcc.Range(xMin, yMin, zMin, xMax, yMax, zMax)
Dim center() As Double = {(xMin + xMax) / 2, (yMin + yMax) / 2, (zMin + zMax) / 2}
Dim objPlane As AsmRefPlane = objDoc.AsmRefPlanes.AddParallelByDistance(objDoc.AsmRefPlanes.Item(1), Math.Abs(center(2)), IIf(center(2) >= 0, igRight, igLeft), Nothing, Nothing, True)
' Get the PMI for the design model
Dim objPMI As PMI = Nothing
objDoc.PMI_ByModelState(objPMI, PMIModelStateConstants.seDesignModelState)
Dim objBalloons As Balloons = objPMI.Balloons
Dim initData As AnnotInitData = objBalloons.AnnotInitData
initData.SetConnectElementEx(objOcc, False, center(0), center(1), center(2))
Dim objBall As Balloon = objBalloons.AddBalloon(initData)
objBall.BalloonText = objOcc.Name
' Move the text a little bit away from the terminator (outside the occurrence)
objBall.SetVertex(0, center(0), center(1), center(2))
objBall.AddVertex(center(0) + 0.55 * (xMax - xMin), center(1) + 0.52 * (yMax - yMin), center(2))
objBall.BalloonType = DimBalloonTypeConstants.igDimBalloonOval
objBall.Style.OriginTerminatorType = DimTermTypeConstants.igDimStyleTermDot
objBall.Style.TerminatorType = DimTermTypeConstants.igDimStyleTermDot
objBall.Style.TerminatorDisplay = DimTermDisplayTypeConstants.igDimStyleTermOrig


Re: PMI_ByModelState


it seems that i have to update my solidedge. thank you very much