find Drawing with missing ballon with Ilogic

find Drawing with missing ballon with Ilogic

Darkforce_the_ilogic_guy
Advisor Advisor
1,007 Views
8 Replies
Message 1 of 9

find Drawing with missing ballon with Ilogic

Darkforce_the_ilogic_guy
Advisor
Advisor

I am trying to make an ilogic program that help finding error and save time in the 2d review faces.

 

is there a way to check an drawing if all part/assembly on the drawing have ballon? when you have a drawing open you can see if any are missing on the part list ...but I need to check all drawing if anyone is missing .. for  the endgame of making a rapport  that give the user a list of what they need to check on witch drawing

bt_0-1614585108878.png

so do anyone know a way to do this ?  

Accepted solutions (2)
1,008 Views
8 Replies
Replies (8)
Message 2 of 9

bradeneuropeArthur
Mentor
Mentor
Accepted solution
Public Sub main
	
	Dim a As Inventor.DrawingDocument = ThisDoc.Document
	Dim s As Inventor.Sheet = a.ActiveSheet
	Dim pl As Inventor.PartsList = s.PartsLists.Item(1)
	
	For Each r As Inventor.PartsListRow In pl.PartsListRows
		
		MsgBox(r.Ballooned)
		
		Next
	
	End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 9

bradeneuropeArthur
Mentor
Mentor
Accepted solution

Or a bit more useful

Public Sub main
	
	Dim a As Inventor.DrawingDocument = ThisDoc.Document
	Dim s As Inventor.Sheet = a.ActiveSheet
	Dim pl As Inventor.PartsList = s.PartsLists.Item(1)
	Dim q As Boolean = True
	For Each r As Inventor.PartsListRow In pl.PartsListRows
		
		
		If r.Ballooned = False Then
			q = False
			End If
			
		'MsgBox(r.Ballooned)
		
		Next
		If q = False Then
			MsgBox ("one or more items are not ballooned")
			End If
	
	End Sub

message:

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 4 of 9

that work on an drawing . but I like to run it on a all the drawing on an assembly 

 

somthing like this... I know the code does not work. but is there a way to find 

 

'Test code
Dim a As Inventor.DrawingDocument = oFS2.GetFile(Left(brow.ReferencedFileDescriptor.FullFileName, Len(brow.ReferencedFileDescriptor.FullFileName) -4) & ".idw")
	Dim s As Inventor.Sheet = a.ActiveSheet
	Dim pl As Inventor.PartsList = s.PartsLists.Item(1)
	Dim q As Integer = 0

q = 0 For Each r As Inventor.PartsListRow In pl.PartsListRows If r.Ballooned = False Then q = q +1 End If 'MsgBox(r.Ballooned) Next 'If q <> 0 Then GoExcel.CellValue(ExcelFile, ExcelSheet, "K" & Row2) = q 'MsgBox (q & " items are not ballooned") 'End If ' End test code

 

This is my complet code 

 

Class BOMEXport
Shared Row2 As Integer = 3
Shared oDate1 As DateTime
Shared oDate2 As DateTime
Shared oToday As DateTime


Sub main


Row2 =3
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

Dim oBOM As BOM
oBOM = oDoc.ComponentDefinition.BOM

oBOM.StructuredViewEnabled = True
oBOM.StructuredViewFirstLevelOnly = False
oBOM.StructuredViewDelimiter = "."

oBOM.PartsOnlyViewEnabled = True

Dim oBOMView As BOMView
oBOMView = oBOM.BOMViews.Item("Structured")
debug("Call ExportToExcel")
Call ExportToExcel(oBOMView.BOMRows)

debug(GoExcel.ToString)
debug("save excel file")
GoExcel.Save
GoExcel.Close

 

 

 

 


End Sub

Public Function ExportToExcel(brows As BOMRowsEnumerator)
'Dim Row2 As Integer
Try
If Row2 ❤️ Then


End If
Catch


end try


ExcelFile = "C:\Working Folder\CAD\Kallesoe\Kallesoe iLogic\Underdevelopment\ReviewDrawing.xlsx"
ExcelSheet = "CompleteDataSet"
GoExcel.Open(ExcelFile, ExcelSheet)

 

Dim brow As BOMRow
For Each brow In brows
Dim rDoc As Document
rDoc = brow.ComponentDefinitions.Item(1).Document

Dim docPropertySet As PropertySet
docPropertySet = rDoc.PropertySets.Item("Design Tracking Properties")

Dim docPropertySet1 As PropertySet
docPropertySet1 = rDoc.PropertySets.Item("User Defined Properties")
Dim docPropertySet2 As PropertySet

docPropertySet2 = rDoc.PropertySets.Item("User Defined Properties")
'item , part number, qty, description, G_L (Custom), Raw material, Status (Custom)


Try
debug(brow.ItemNumber & " Row nr " & Row2)
GoExcel.CellValue(ExcelFile, ExcelSheet, "B" & Row2) = brow.ItemNumber
Catch

End Try
Try
GoExcel.CellValue(ExcelFile, ExcelSheet, "C" & Row2) = docPropertySet.Item("Part Number").Value
Catch

end try
Try
Dim strFileName As String
Dim oFS As Object

 


strFileName = brow.ReferencedFileDescriptor.FullFileName

oFS = CreateObject("Scripting.FileSystemObject")

'Dato for hvornår den sidste er blevet ændret
oDate1 = oFS.GetFile(strFileName).DateLastModified




GoExcel.CellValue(ExcelFile, ExcelSheet, "D" & Row2) = oDate1

 

Catch

End Try


Try



GoExcel.CellValue(ExcelFile, ExcelSheet, "U" & Row2) = docPropertySet.Item("Description").Value
Catch

End Try

 


Dim oFS2 As Object
oDate2 = Nothing

oFS2 = CreateObject("Scripting.FileSystemObject")
Try
oDate2 = oFS2.GetFile(Left(brow.ReferencedFileDescriptor.FullFileName, Len(brow.ReferencedFileDescriptor.FullFileName) -4) & ".idw").DateLastModified

GoExcel.CellValue(ExcelFile, ExcelSheet, "F" & Row2) = "Yes"
Catch
oDate2 = Nothing
GoExcel.CellValue(ExcelFile, ExcelSheet, "F" & Row2) = "No"
End Try


'Test code
Dim a As Inventor.DrawingDocument = oFS2.GetFile(Left(brow.ReferencedFileDescriptor.FullFileName, Len(brow.ReferencedFileDescriptor.FullFileName) -4) & ".idw")
Dim s As Inventor.Sheet = a.ActiveSheet
Dim pl As Inventor.PartsList = s.PartsLists.Item(1)
Dim q As Integer = 0
q = 0
For Each r As Inventor.PartsListRow In pl.PartsListRows


If r.Ballooned = False Then
q = q +1
End If



Next

GoExcel.CellValue(ExcelFile, ExcelSheet, "K" & Row2) = q


' End test code

GoExcel.CellValue(ExcelFile, ExcelSheet, "E" & Row2) = oDate2


If oDate2 < oDate1 Or oDate2 = Nothing Then
GoExcel.CellValue(ExcelFile, ExcelSheet, "G" & Row2) = "No"
Else
GoExcel.CellValue(ExcelFile, ExcelSheet, "G" & Row2) = "Yes"
End If

 


GoExcel.CellValue(ExcelFile, ExcelSheet, "I" & Row2) = right(brow.ReferencedFileDescriptor.FullFileName,3) ' extension


'find docPropertySet.Item("Description").Value
Try
If docPropertySet.Item("Description").Value = docPropertySet1.Item("Part Description").Value Then
GoExcel.CellValue(ExcelFile, ExcelSheet, "J" & Row2) = "No"
Else If docPropertySet.Item("Description").Value <> docPropertySet1.Item("Part Description").Value And docPropertySet.Item("Description").Value = "J" & Row2 <> ""
GoExcel.CellValue(ExcelFile, ExcelSheet, "J" & Row2) = "Yes"
End If

Catch

If docPropertySet.Item("Description").Value = "" Then
GoExcel.CellValue(ExcelFile, ExcelSheet, "J" & Row2) = "No"
Else
GoExcel.CellValue(ExcelFile, ExcelSheet, "J" & Row2) = "yes"

End If

End Try



 

 

 

 

 


debug("Item nr. " & brow.ItemNumber)' & "part number " &docPropertySet.Item("Part Number").Value & "qty " & brow.ItemQuantity & "description " & docPropertySet.Item("Description").Value & "Length " & docPropertySet1.Item("G_L").Value & "Raw Material " & docPropertySet1.Item("Raw Material").Value & "Status " &docPropertySet1.Item("Status").Value)
Row2 = Row2 + 1
If Not brow.ChildRows Is Nothing
Call ExportToExcel(brow.ChildRows)
End If

 

Next


End Function

 

Public Sub debug(txt As String)
Trace.WriteLine("NTI : " & txt)
End Sub


End Class

0 Likes
Message 5 of 9

That is a different question.

You need to run the code in the assembly to see if all parts and  sub-assemblies have been ballooned, right?

First question how do you know on which drawing the assembly is (only) drawn/used. it can be an different drawings.

If you are using Vault-pro, You could use the Vault API for it, but only with inventor it is hard to find. 

There is a where used function in Inventor API but that only works if the drawings are all opened already.

So that will not bring a lot!

Please can you give me an answer to these questions?

 

Regards,

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 6 of 9

yes. I want to run the code in the assembly to see if all parts and  sub-assemblies have been ballooned. well part is not needed sind we are not balloned part drawing. sind there is always only one componemt to ballooned 

 

the drawing is always at the same location as the 3d file.  

 

so I can do a code like this to get the fullfilename and location on the drev 

 

Left(brow.ReferencedFileDescriptor.FullFileName, Len(brow.ReferencedFileDescriptor.FullFileName) -4) & ".idw"

 for now I simple want to information need to see with files you might need to look as for missing ballooned

 

I am trying to make a larger program that find error that human easyly mis.  for now I can check  if

 

  1. you forgot to update your 2d after change 3d files 
  2. if there is a drawing at all
  3. and if the drawing is old ... so we save time by not  reviewing old drawing again and again
  4. check if an weigt was added to new purchased  part , like motor  cylinder and stuff like that 

chekcing for ballons is not the next level I wanted to add 😉

0 Likes
Message 7 of 9

pl.sivakumar
Advocate
Advocate
Public Sub Main
	
	Dim a As Inventor.DrawingDocument = ThisDoc.Document
	Dim s As Inventor.Sheet = a.ActiveSheet
	Dim pl As Inventor.PartsList = s.PartsLists.Item(1)
	Dim q As Boolean = True
	For Each r As Inventor.PartsListRow In pl.PartsListRows
		
		
		If r.Ballooned = False Then
			q = False
			End If
			
		'MsgBox(r.Ballooned)
		
		Next
		If q = False Then
			MsgBox ("one or more items are not ballooned")
			End If
	
	End Sub

Above rule I kept in the trigger, Working good in the assembly drawing, But the Part drawing shows  below error

 

"Error on line 5 in rule: Missing Balloons, in document: 22030.08.002-00.idw

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"

 

0 Likes
Message 8 of 9

pl.sivakumar
Advocate
Advocate

All are working good in the assembly drawing

The same rule is kept in the trigger, While running in  part drawing the following error shown, Can possible to support

 

Error on line 11 in rule: Missing Balloons, in document: part.idw

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

0 Likes
Message 9 of 9

pl.sivakumar
Advocate
Advocate

Code updated, Now it will work in Trigger

 

Public Sub Main
Dim oDoc As DrawingDocument = Nothing
Try ' Is it a drawing?
oDoc = ThisApplication.ActiveEditDocument
Catch
MsgBox("This iLogic rule only works with drawing documents!")
Return
End Try
Dim a As Inventor.DrawingDocument = ThisDoc.Document
Dim s As Inventor.Sheet = a.ActiveSheet
If s.PartsLists.Count = 0 Then
	Exit Sub
End If 
Dim pl As Inventor.PartsList = s.PartsLists.Item(1)
Dim q As Boolean = True
For Each r As Inventor.PartsListRow In pl.PartsListRows
If r.Ballooned = False Then
q = False
End If
'MsgBox(r.Ballooned)
Next
If q = False Then
MessageBox.Show("Balloon Missing", "Warning")
End If
End Sub