Using API to change property in balloon style

Using API to change property in balloon style

DWhiteley
Advisor Advisor
709 Views
2 Replies
Message 1 of 3

Using API to change property in balloon style

DWhiteley
Advisor
Advisor

I've got a drawing with a part ballooned in it.

 

What I would like to do is edit the style using the API so that the property in the balloon is pointing to a customer property in that part.

 

I've tried:

 

Dim oBalloon As Balloon
For Each oBalloon In oSheet.Balloons

          oBalloon.Style.Properties = "customproperty='ITEM#'"

....

 

This doesn't work. Has anyone got any ideas on how to do this?

 

Thanks in advance.

 

Dave Whiteley

Envisage UK Ltd

 

 

0 Likes
710 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

 

Dim drawDoc As DrawingDocument 
Dim currentSheet As Sheet
Dim oBalloon As Balloon 
Dim valueSet As BalloonValueSet

currentSheet = drawDoc.Sheets.Item(page) ' insert your page number here i.e. 1 or 2 or 3 etc
x = 0

For Each oBalloon In currentSheet.Balloons x=x+1 Try Dim oBalloonType As BalloonTypeEnum Dim oBalloonData As Object Call oBalloon.GetBalloonType(oBalloonType, oBalloonData) Dim oBVS As BalloonValueSet oBVS = oBalloon.BalloonValueSets(1) If InStr(oBVS.OverrideValue,"A1") > 0 And oBVS.Value = 185 Then 'This line is looking for a balloon with a specific string in its override value and that also has a balloon value of 185 which is based on the part it is referencing oBVS.OverrideValue = Parameter("Part1.ipt.Parameter1") 'change the override value of the balloon to a specific parameter from a specific .ipt file End If
'add more if statements if you want to change the value of more than one balloon
Catch
End Try
Next

 

At the end of the  day, changing balloon values is very difficult and fussy. I opted to instead create leader values with text since it is much easier to interact with than the balloon function. 

0 Likes
Message 3 of 3

DWhiteley
Advisor
Advisor

That's brilliant, thanks Nick. I'll give that a go.

 

Dave

0 Likes