iLogic Code - Find and Highlight Overridden Balloons

iLogic Code - Find and Highlight Overridden Balloons

Anonymous
Not applicable
2,205 Views
7 Replies
Message 1 of 8

iLogic Code - Find and Highlight Overridden Balloons

Anonymous
Not applicable

Has anyone found a way to write code like this shown in the link below, but for overridden balloons instead? I have tried many variations and can't even get close.

 

http://inventortrenches.blogspot.com/2011/06/using-ilogic-to-find-dimension.html (Curtis Waguespack blog - excellent blog)

 

 

-------------Start of ilogic ------------------------------------------------

' Set a reference to the active document.

Dim oDoc As DrawingDocument

oDoc = ThisApplication.ActiveDocument

 

'Define the drawing dims collection

Dim oDrawingDims As DrawingDimension

 

'Dim oColor As Inventor.Color

Dim oColor As Color


'Prompt user to choose highlight / un-highlight

Dim booleanParam as Object

booleanParam = InputRadioBox("Select an Option", _

"Hightlight Overrides", "Un-Hightlight Overrides", True, Title := "iLogic")

 

'Loop through all dimensions and set colors

For Each oDrawingDims In oDoc.ActiveSheet.DrawingDimensions

   If booleanParam = True then

   'set color to magenta

   oColor = ThisApplication.TransientObjects.CreateColor(255, 0, 255)

   else

   'set color to black

   oColor = ThisApplication.TransientObjects.CreateColor(0, 0, 0)

   oColor.ColorSourceType = ColorSourceTypeEnum.kLayerColorSource

   end if

  

   if oDrawingDims.HideValue = True _

   or oDrawingDims.ModelValueOverridden = True then

   oDrawingDims.Text.Color = oColor

   Else

   End if

Next

'-------------End of ilogic ------------------------------------------------

0 Likes
Accepted solutions (1)
2,206 Views
7 Replies
Replies (7)
Message 2 of 8

dean.morrison
Advocate
Advocate
Accepted solution

So i don't think you can change the colour of the balloons like the dimensions..

 

However i changed the prompt to identify if there are overrides, and choose whether or not to fix them.

 

Also i am unsure how to remove the override completely, instead i made the override match the itemnumber.

 

Hope it helps.

 

Dean.

 

SyntaxEditor Code Snippet

' Set a reference to the active document.
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
 
'Define the drawing dims collection
Dim oBalloon As Balloon
 
'Loop through all dimensions and set colors
For Each oBalloon In oDoc.ActiveSheet.Balloons

   If oBalloon.BalloonValueSets(1).OverrideValue <> "" And oBalloon.BalloonValueSets(1).OverrideValue <> oBalloon.BalloonValueSets(1).ItemNumber Then
   Info = (oBalloon.BalloonValueSets(1).ItemNumber & " overridden with" & oBalloon.BalloonValueSets(1).OverrideValue)

    Dim booleanParam as Object
    booleanParam = InputRadioBox(Info , _
    "Fix Override", "Leave Override", True, Title := "iLogic")

    If booleanParam = True Then
       oBalloon.BalloonValueSets(1).OverrideValue = oBalloon.BalloonValueSets(1).ItemNumber
       End If
   End If
Next

 

Message 3 of 8

Curtis_Waguespack
Consultant
Consultant

Hi huntjw36,

 

To strip the  overrides we can use just this:

 

'Loop through all balloons 
For Each oBalloon In ThisApplication.ActiveDocument.ActiveSheet.Balloons
	'clear overrides
    oBalloon.BalloonValueSets(1).OverrideValue = "" 
Next

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 4 of 8

Anonymous
Not applicable

Dean,

 

 

 Thank you for your help. I modified the code to work for our application. See below.

 

 

'-------------Start Of ilogic ------------------------------------------------
Dim Message As Integer
Dim N As Integer                                        'TOTAL NUMBER OF SHEETS
Dim X As Integer                                        'SHEET NUMBER USED FOR DO LOOP COUNTER
Dim Y As String                                         'SHEET NUMBER AS STRING FOR ACTIVE SHEET PART OF DO LOOP

Dim oDrawing As DrawingDocument
oDrawing = ThisApplication.ActiveDocument
Dim osheet As Sheet
i = 0
'count total sheets
For Each osheet In oDrawing.Sheets
If osheet.ExcludeFromCount = True Then
i = i + 1
Else
End If
Next
'Remove the excluded sheet from the total number of sheets
oMySheetCount = oDrawing.Sheets.Count - i
N = oMySheetCount
X = 1
'---------------------------------------Message Box asking the user if they wish to continue---------------------------------
Message = MessageBox.Show("This Operation Will Check " & N & " Sheets for Overridden Balloons. Press the OK button, if you wish to continue.", "Drawing Dimension Check Operations", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
If Message = 2 Then 
Exit Sub
Else

MultiValue.UpdateAfterChange = True
 
'Loop through all sheets to find overidden balloons

Do While X <= N
Y = X

ActiveSheet = ThisDrawing.Sheet("Sheet:"&Y)
ThisApplication.ActiveView.Fit                            'ZOOM ALL' Set a reference to the active document.
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
 
'Define the drawing dims collection
Dim oBalloon As Balloon
For Each oBalloon In oDoc.ActiveSheet.Balloons

   If oBalloon.BalloonValueSets(1).OverrideValue <> "" And oBalloon.BalloonValueSets(1).OverrideValue <> oBalloon.BalloonValueSets(1).ItemNumber Then
   Info = "ITEM "&(oBalloon.BalloonValueSets(1).OverrideValue & " SHOULD BE " & oBalloon.BalloonValueSets(1).ItemNumber)
  
      Dim booleanParam as Object
    booleanParam = InputRadioBox(Info , _
    "FIX THE OVERRIDE?", "LEAVE THE OVERRIDE?", True, Title := "SHEET: "&Y)

    If booleanParam = True Then
       oBalloon.BalloonValueSets(1).OverrideValue = oBalloon.BalloonValueSets(1).ItemNumber
       End If
   End If
Next
X = X+1                                            'COUNTER FOR DO LOOP 
Loop

End If

X = 1                                            'RESETTING THE COUNTER
Y = X                                            'RESETTING THE SHEET NUMBER TO THE COUNTER


ActiveSheet = ThisDrawing.Sheet("Sheet:1")
iLogicVb.UpdateWhenDone = True
RuleParametersOutput()    
InventorVb.DocumentUpdate()
ThisDoc.Save
'-------------End of ilogic ----------------------------------------------

 

Message 5 of 8

Anonymous
Not applicable

In the same way, I have one new balloon report output requirement.

 

We often work on massive assemblies. The one I am working on has over 14000 parts overall and I am adding 75 unique items to this assembly but some items may have quantities up to 24. All 24 are not in the same location and our internal requirement is to add the same balloon number at different locations with over-ride quantities. So, there may be, lets say, balloon number 8 in 5 different locations. Each may have different over--ridden quantities. 

This is very painful to create and manage.

What I am looking to do is to try to run a report of all balloon notes showing individual occurrence of each balloon number and its over-ridden quantity. Then compare it to the total qty in the BOM to see if our manually entered quantities for each balloon adds up to the BOM quantity for that item number.

I can make use of much of your code to identify the balloons with over-rides but I could use lots of help otherwise. 

 

Anyone have this type of need or solution to it? Perhaps our guru  Curtis Waguespack can help?

 

Thank you.

 

 

0 Likes
Message 6 of 8

drafting03_AR
Contributor
Contributor
This code works great and does exactly what I was looking for. However, I found that it does not check attached balloons (when you have multiple balloons attached to the same leader) that are overridden. Is there any way to do this?
0 Likes
Message 7 of 8

Curtis_Waguespack
Consultant
Consultant

@drafting03_AR 

 

See the example at this link and look at the "i = i+1" portion of the code. This is how we access the attached balloons.

Compare it to MESSAGE 12 OF 18 on that thread. Post 12 is only getting the first level balloons, post 16 is getting all levels.

 

https://forums.autodesk.com/t5/inventor-forum/inventor-2022-parts-list-balloon-indicating-icons/m-p/...

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 8 of 8

maxim.teleguz
Advocate
Advocate

@Anonymous wrote:

Dean,

 

 

 Thank you for your help. I modified the code to work for our application. See below.

 

 

'-------------Start Of ilogic ------------------------------------------------
Dim Message As Integer
Dim N As Integer                                        'TOTAL NUMBER OF SHEETS
Dim X As Integer                                        'SHEET NUMBER USED FOR DO LOOP COUNTER
Dim Y As String                                         'SHEET NUMBER AS STRING FOR ACTIVE SHEET PART OF DO LOOP

Dim oDrawing As DrawingDocument
oDrawing = ThisApplication.ActiveDocument
Dim osheet As Sheet
i = 0
'count total sheets
For Each osheet In oDrawing.Sheets
If osheet.ExcludeFromCount = True Then
i = i + 1
Else
End If
Next
'Remove the excluded sheet from the total number of sheets
oMySheetCount = oDrawing.Sheets.Count - i
N = oMySheetCount
X = 1
'---------------------------------------Message Box asking the user if they wish to continue---------------------------------
Message = MessageBox.Show("This Operation Will Check " & N & " Sheets for Overridden Balloons. Press the OK button, if you wish to continue.", "Drawing Dimension Check Operations", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
If Message = 2 Then 
Exit Sub
Else

MultiValue.UpdateAfterChange = True
 
'Loop through all sheets to find overidden balloons

Do While X <= N
Y = X

ActiveSheet = ThisDrawing.Sheet("Sheet:"&Y)
ThisApplication.ActiveView.Fit                            'ZOOM ALL' Set a reference to the active document.
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
 
'Define the drawing dims collection
Dim oBalloon As Balloon
For Each oBalloon In oDoc.ActiveSheet.Balloons

   If oBalloon.BalloonValueSets(1).OverrideValue <> "" And oBalloon.BalloonValueSets(1).OverrideValue <> oBalloon.BalloonValueSets(1).ItemNumber Then
   Info = "ITEM "&(oBalloon.BalloonValueSets(1).OverrideValue & " SHOULD BE " & oBalloon.BalloonValueSets(1).ItemNumber)
  
      Dim booleanParam as Object
    booleanParam = InputRadioBox(Info , _
    "FIX THE OVERRIDE?", "LEAVE THE OVERRIDE?", True, Title := "SHEET: "&Y)

    If booleanParam = True Then
       oBalloon.BalloonValueSets(1).OverrideValue = oBalloon.BalloonValueSets(1).ItemNumber
       End If
   End If
Next
X = X+1                                            'COUNTER FOR DO LOOP 
Loop

End If

X = 1                                            'RESETTING THE COUNTER
Y = X                                            'RESETTING THE SHEET NUMBER TO THE COUNTER


ActiveSheet = ThisDrawing.Sheet("Sheet:1")
iLogicVb.UpdateWhenDone = True
RuleParametersOutput()    
InventorVb.DocumentUpdate()
ThisDoc.Save
'-------------End of ilogic ----------------------------------------------

 


should just fix it to be:

If booleanParam = True Then
       oBalloon.BalloonValueSets(1).OverrideValue = ""
End If
0 Likes