Changing style for balloons in a drawingview

Pioneer
Pioneer

Goodmorning all, 

 

I tried to change the style on a balloon I just created using "balloons.add(0,0,0)".

 

Unfortunately balloon.Style is read only, so while I can change things IN the style itself, I can not change the style to one of my predefined styles, while I can do this on the UI.

 

Is this a feature, or am I missing something?

6 REPLIES

Re: Changing style for balloons in a drawingview

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I assume you mean "Balloon shape"? If so, I have the answer and here is how I did it.

  • Selected the balloon in Solid Edge.
  • Started Spy for Solid Edge.
  • From the Object Browser tab, navigated to Application -> ActiveSelectSet -> Item(1) and selected the item.
  • In the property grid on the right, I located and selected "BalloonType".
  • Noticed that the details pane (bottom left) told me that the property was of type SolidEdgeConstants.DimBalloonTypeConstants.
  • Clicked the SolidEdgeConstants.DimBalloonTypeConstants link which took me to the Type Brower tab and selected the enum so that I could see the possible values.
  • Back in Object Browser, I manually changed the number to a few of the possible enum values to make sure it changed, and it did.

Below is a screenshot. Hope this helps.

 

Spy-BalloonType.png

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Changing style for balloons in a drawingview

Pioneer
Pioneer
No I actually meant Style.
In the spy it can be found under the balloon, accessible via Balloon.Style (as an dimstyle)/

You use it in your sample code to make sure the connection terminator is in the shape of an arrow.

The balloon shape, size etc I can manipulate without problems, I just would love to use the style I created.

ps the spy is a life saver, thanks for creating it Smiley Very Happy

Re: Changing style for balloons in a drawingview

Pioneer
Pioneer

OK, back to SE work. 

 

I did not mean the shape of the balloon.

 

The style can be predifined, when you change this via the normal UI you use: 

balloonStyle.PNG

Re: Changing style for balloons in a drawingview

Pioneer
Pioneer

After some experimentation we found that IF done through VBA (Excel) balloon.Style can be filled with A STRING eg "newStyle", and the balloon will use the newStyle predefined style...

 

But using the same code in  C# will result in compiler errors.

 

Working Excel vba: 

Public Sub Test()

Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgeDraft.DraftDocument
Dim objSheet As SolidEdgeDraft.Sheet
Dim objBalloons As SolidEdgeFrameworkSupport.Balloons
Dim objBalloon As SolidEdgeFrameworkSupport.Balloon
Dim objStyle As SolidEdgeFrameworkSupport.DimStyle

'Get SE en open goede document
    Set objApp = GetObject(, "SolidEdge.Application")

    If Err.Number = 91 Or Err.Number = 429 Then
        Err.Clear
        Set objApp = CreateObject("SolidEdge.Application")
    End If

'Set
    Set objDoc = objApp.ActiveDocument
    Set objSheet = objDoc.ActiveSheet
    Set objBalloons = objSheet.Balloons
    Set objBalloon = objBalloons.Item(1)

'Change style
    'THIS CODE WORKS USING VBA!
    objBalloon.Style = "ISO"

'Clean up
    Set objApp = Nothing
    Set objDoc = Nothing
    Set objSheet = Nothing
    Set objBalloons = Nothing
    Set objBalloon = Nothing
    Set objStyle = Nothing

End Sub

 

 

Re: Changing style for balloons in a drawingview

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I haven't had a chance to code this but looking at the Balloon.Style property, it is defined as:

 

SolidEdgeFrameworkSupport.DimStyle Style { get; }
   Member of SolidEdgeFrameworkSupport.Balloon

That said, I don't see how you could possibly be assinging it a string. Unless there's some voodoo magic that I'm not understanding yet, what you're saying about the VB code working with a string shouldn't be possible. What I would expect is that you would have to look up an existing DimStyle and apply it to the Balloon.Style property.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Changing style for balloons in a drawingview

Pioneer
Pioneer

I think we found it....

 

 

objBalloon.Style.Name = "newStyle"

When Style.name is assigned as a string is does not change the style name, but changes the ...connection (for lack of a better word)... to the style to the "predefined style" with that name.

 

The getting of a dimstyle and adding that is something we tried, but it does not seem to work.

 

After hours of digging through the api and SEspy, and we accidentally caught the above solution.

 

Voodoo magic indeed