Balloons suppression

Balloons suppression

Anonymous
Not applicable
1,379 Views
8 Replies
Message 1 of 9

Balloons suppression

Anonymous
Not applicable

Hi everybody,

Is someone can help me?

I m searching for suppressing all balloons on a view?

What can be ligne of code used to do that?

Thanks for your help

0 Likes
Accepted solutions (1)
1,380 Views
8 Replies
Replies (8)
Message 2 of 9

KKizildemir
Collaborator
Collaborator

Hi,

 

You can hide with that code:

Dim oDoc As Inventor.DrawingDocument
Dim oSheetName As String = "Sheet:1" 'Your Sheet Name
Dim oViewName As String = "VIEW1" 'Your View Name

oDoc = ThisDoc.Document

Dim oSheet As Inventor.Sheet

For Each oSheet In oDoc.Sheets

	If oSheet.Name = oSheetName Then

		For Each oBalloon As Inventor.Balloon In oSheet.Balloons

			If oBalloon.ParentView.Name = oViewName Then
				oBalloon.Layer.Visible = False
End If Next End If Next

Regards,

 

Signature

website
emailskypelinkedinyoutubeemail
Message 3 of 9

Anonymous
Not applicable

Fist of all,

Thanks for the answer.

The problem is that even if we gave the name of the view in which we want delete the balloons, they disappear on all the sheet.

Can you solve the problem?

Thank you very much.

0 Likes
Message 4 of 9

johnsonshiue
Community Manager
Community Manager

Hi Do you mind sharing an example here? The behavior does not sound right to me.

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 5 of 9

jtylerbc
Mentor
Mentor

@johnsonshiue,

 

I've never tried to do exactly what is being attempted here.  However, the way I'm understanding the code, it does the following:

  1. Checks the sheet to see if it's the specified target name.  If so, continue.
  2. Cycle through the balloons, checking the name of the view they are attached to.  If the view name matches the target name, continue.
  3. Turn off the visibility of the layer that the balloons are on.

Since it works by turning off the layer, it will always shut off all the balloons unless the balloons for different views are placed on different layers.  I think the code itself is actually functioning correctly, but it is the wrong logic for the intended result.  I'm not sure if there is a way to do what is being asked for or not, but if a method does exist, turning the balloon layer off isn't it.

 

As written, this code can only result in the following two outcomes:

  1. The sheet and view names don't match the targets.  Nothing happens.
  2. The sheet and view names match the targets.  Turn off all the balloons.

 

Message 6 of 9

KKizildemir
Collaborator
Collaborator
Right, I got the problem that occurs when the layer turns off. I gonna try to find another way.

Thanks for your feedback.
Signature

website
emailskypelinkedinyoutubeemail
0 Likes
Message 7 of 9

KKizildemir
Collaborator
Collaborator
Accepted solution

Hi again,

 

The problem is hiding the main balloon layer hides all the balloons on the same sheet. To fix this, you must create a new dummy layer (its name can be anything) and assign your related balloons to this dummy layer. Then try the code I gave. Please watch the video attached.

 

In the object model, I can't find a connection between a drawing view and balloons attached on this view except the layer selection. The logic is reasonable: A balloon can be attached more than one view with adding multiple leader. So this causes inconsistent definition.

 

Regards,

 

 

 

Signature

website
emailskypelinkedinyoutubeemail
Message 8 of 9

Anonymous
Not applicable

Thank you very much.

It works correctly. It was just a problem of layers

0 Likes
Message 9 of 9

KKizildemir
Collaborator
Collaborator
You're welcome. Have a nice day!
Signature

website
emailskypelinkedinyoutubeemail
0 Likes