Showing results for 
Search instead for 
Did you mean: 

Draft: getting the name of each parts/asm and their balloons

Valued Contributor
Valued Contributor

Hi everybody,


I have a draft which represents an assembly of 2 parts.

Each parts is referred by a balloon.


I know how to get balloons'text only if they've been added with the "Item Number" option during their creation in Solid Edge draft.


I extract all of the nodes of the draft, and with the node.filename and node.itemnumber, I have the relation I am looking for.


BUT, if you create the balloon (in SE, I don't meen programmatically) inserting text manually (without the "Item Number" option, I cannot get the ballon's text and the part or asm it's linked to. I really don't have any idea.


Here the code I have:



Public Sub InformacionPlano(ByVal Nodes As SolidEdgeDraft.ModelNodes)


Dim Node As SolidEdgeDraft.ModelNode

Dim balloons As SolidEdgeFrameworkSupport.Balloons

Dim balloon As SolidEdgeFrameworkSupport.Balloon

Dim objDoc As SolidEdgeDraft.DraftDocument

Dim objSheet As SolidEdgeDraft.Sheet


objDoc = SE_App.ActiveDocument

objSheet = objDoc.ActiveSheet

balloons = objSheet.Balloons


' I am getting the item number (if the balloon has been created with the "Item Number" option in Solid Edge draft, the Item Number is the same that the ballon text






if Node.ModelType = SolidEdgeDraft.ModelNodeTypeConstants.igAssemblyNode Then

Nodes = Node.ModelNodes



End If

end sub


Thanks a lot, It really driving me crazy.


Posted by: Greg Forel
Post date: 11/24/2006 2:05:47 AM


RE: Draft: getting the name of each parts/asm and their balloons

Valued Contributor
Valued Contributor



I can believe it, but I have an (the?) answer.


You have to get the item number of the balloon.


dim intItemNb integer

dim strTxtBalloon as string


strTextBalloon = Balloon.BalloonText


Now, you have the number of the balloon, and the ItemNumber it's referred. So you can get the FileName in order to associate the Text of a Balloon with fullpath of the part or asm it is linked.


I hope it could help.


Bye, Greg.



Posted by: Greg Forel
Post date: 11/24/2006 2:19:47 AM

RE: Draft: getting the name of each parts/asm and their balloons

Valued Contributor
Valued Contributor

Greg, I do not believe this is entirely correct.


It will only work if the balloon is linked to parts list and the Display by Item Number is on:

mBalloon.LinkToPartsList = True

mBalloon.DisplayByItemNumber = True


Otherwise it will throw a runtime error of Invalid Procedure Call.


There are a couple of ways I see to do this. The first is to do what Greg wrote, but to set LinkToPartsList and DisplayByItemNumber before calling getting the item number and then resetting those values to their original state.

mBalloon.LinkToPartsList = True

mBalloon.DisplayByItemNumber = True

mBalloon.GetItemNumber (long)

mBalloon.LinkToPartsList = False '(original state)

mBalloon.DisplayByItemNumber = False '(original state)


Don't worry, this will not update the drawing unless you do a drawing view update before setting your values back.


After this you will still have to loop through the balloon collection to find the matching balloon.


Another approach is to start with the balloon and find the file that it is pointing to.


Dim x As Double, y As Double, z As Double

Dim bKeypoint As Boolean

Dim Terminator As Object

Dim GraphicMember As Object

Dim ModMember As Object


mBalloon.GetTerminator Terminator, x, y, z, bKeypoint

Set GraphicMember = Terminator.object

Set ModMember = GraphicMember.ModelMember

MemberName = ModMember.FILENAME


However, there is something important to consider in this approach and that is that if the ballooned part is in a sub-assembly, you will get the filename of the part and not the sub-assembly.


There is also another can of worms I ran into. To make this correct you also need to consider whether the draftlist is a Top-level list or Atomic. I don't believe there is anywhere in the API to determine this. I could only determine this from the ItemNumber of the model nodes.

If the Top-level option is used the file the baloon is on and all of its ancestors will have the same ItemNumber, which means the sub-assembly will be the file the balloon represents.

If the Atomic option is used the file the balloon is on will have an ItemNumber but all of its ancestors will have an ItemNumber = -1 and isBallooned= False.


So as I see it the easiest way is Greg's way with the addition of setting LinkToPartsList and DisplayByItemNumber and the fact that when finding the ModelNode that corresponds you may have to loop through sub-assembly ModelNodes if the Atomic option is used.


Does anyone know an even quicker way?

The text property %{File Name|G} in the balloon will give the correct value in SE but I don't know how you can get the information through the api.


Hopefully something in here was helpful or made sense.



Posted by: Carl Breving
Post date: 3/15/2007 10:18:20 AM