Cancel
Showing results for 
Search instead for 
Did you mean: 

Auto balloon integrity checker

Pioneer
Pioneer

Dear community

 

how can I achieve a check for completeness when I have set up a part list and ballons with callouts for each component listed in that partlist. what is the matching function or workflow for this?

 

Greetings

 

MArco

 

_____________________________
Are you familiar with my product?
click here
6 REPLIES

Re: Auto balloon integrity checker

Pioneer
Pioneer
I mean a function to check if all partlist callouts are ballooned on the drawing views
_____________________________
Are you familiar with my product?
click here

Re: Auto balloon integrity checker

Phenom
Phenom

@mascaritas wrote:
I mean a function to check if all partlist callouts are ballooned on the drawing views


'NXJournaling.com
'January 20, 2015
'
'NX 8.5
'
'Journal to report which items in a parts list do not have corresponding balloon callouts.
'Inspired by and based on the GTAC sample "report_missing_balloons_of_parts_lists" (nxapi_5333)
'by Frank Berger.
'The GTAC sample will only work with NX 9 or higher; this journal will work with NX 8.5,
'and possibly with older versions back to NX 5.

Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF

Module report_missing_balloons_v3

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()

Dim lw As ListingWindow = theSession.ListingWindow

Sub Main()

If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If

Dim workPart As Part = theSession.Parts.Work
lw.Open()

Dim partListTags() As Tag = Nothing
Dim numPartLists As Integer = 0
theUfSession.Plist.AskTags(partListTags, numPartLists)

If numPartLists = 0 Then
lw.WriteLine("No parts list found in the work part")
Return
End If

theUfSession.Plist.UpdateAllPlists()

If numPartLists > 1 Then
lw.WriteLine("ERROR: Cannot evaluate AutoBalloons with multiple parts lists.")
lw.WriteLine("Check environment variable UGII_UPDATE_ALL_ID_SYMBOLS_WITH_PLIST")
Return
End If

Dim numRows As Integer
theUfSession.Tabnot.AskNmRows(partListTags(0), numRows)

Dim plistPrefs As UFPlist.Prefs = Nothing
theUfSession.Plist.AskPrefs(partListTags(0), plistPrefs)

Dim colCallout As Tag = PartListCalloutColumn(partListTags(0))
If colCallout = Tag.Null Then
lw.WriteLine("parts list callout column not found")
Return
End If

Dim plBalloonList As New List(Of String)
CollectPartsListBalloons(plBalloonList, plistPrefs.symbol_type)

Dim missingBalloons As New List(Of String)

Dim startTime As DateTime = Now

'loop through rows of the parts list, look for corresponding autoballoon callout
For i As Integer = 0 To numRows - 1

Dim rowTag As Tag
theUfSession.Tabnot.AskNthRow(partListTags(0), i, rowTag)

Dim cellTag As Tag
theUfSession.Tabnot.AskCellAtRowCol(rowTag, colCallout, cellTag)

Dim calloutEvText As String = ""
theUfSession.Tabnot.AskEvaluatedCellText(cellTag, calloutEvText)

If plBalloonList.Contains(calloutEvText) Then
'balloon found, remove it from the list so future searches are potentially faster
plBalloonList.Remove(calloutEvText)
Else
'balloon not found, add callout to the "missing" list
missingBalloons.Add(calloutEvText)
End If

Next

Dim endTime As DateTime = Now

If missingBalloons.Count = 0 Then
lw.WriteLine("Tutti i componenti della PART LIST risultano pallinati !")
Else
lw.WriteLine("Hmmm... It seems that " & missingBalloons.Count.ToString & " parts in the list do NOT have corresponding balloon callouts.")
For Each missing As String In missingBalloons
lw.WriteLine(missing)
Next
End If

Dim elapsedTime As TimeSpan = endTime.Subtract(startTime)
'lw.WriteFullline("elapsed time: " & elapsedTime.ToString)

lw.Close()

End Sub

Function PartListCalloutColumn(ByVal partListTag As Tag) As Tag

Dim numColumns As Integer
theUfSession.Tabnot.AskNmColumns(partListTag, numColumns)

Dim rowTag As Tag
theUfSession.Tabnot.AskNthRow(partListTag, 0, rowTag)

For j As Integer = 0 To numColumns - 1
Dim colTag As Tag
theUfSession.Tabnot.AskNthColumn(partListTag, j, colTag)

Dim cellTag As Tag
theUfSession.Tabnot.AskCellAtRowCol(rowTag, colTag, cellTag)

'get the current cell text
Dim cellText As String = ""
theUfSession.Tabnot.AskCellText(cellTag, cellText)
If cellText = "$~C" Then
'callout column
Return colTag

End If

Next

Return Nothing

End Function

Sub CollectPartsListBalloons(ByRef theBalloonList As List(Of String), ByVal plSymbolType As Integer)

For Each tempId As Annotations.IdSymbol In theSession.Parts.Work.Annotations.IdSymbols

Dim theIdSymbolBuilder As Annotations.IdSymbolBuilder = theSession.Parts.Work.Annotations.IdSymbols.CreateIdSymbolBuilder(tempId)

If plSymbolType = theIdSymbolBuilder.Type + 1 Then
'symbol matches type used in parts list
Else
'symbol not the type used in parts list, skip it
Continue For
End If

'add unique callouts to the list

'assumes the callout is in the ".UpperText" property
'change this to .LowerText if needed

If Not theBalloonList.Contains(theIdSymbolBuilder.UpperText) Then
theBalloonList.Add(theIdSymbolBuilder.UpperText)
End If

theIdSymbolBuilder.Destroy()

Next

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image when the NX session terminates
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

'----Other unload options-------
'Unloads the image immediately after execution within NX
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

'Unloads the image explicitly, via an unload dialog
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
'-------------------------------

End Function

End Module

 

Thank you...

Using NX 11 / RuleDesigner PDM

Re: Auto balloon integrity checker

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

As noted in the code above, it was written for NX 8.5 and lower. If you are using NX 9 or higher, I suggest using this version.

Re: Auto balloon integrity checker

Creator
Creator

Hi,

 

I have Bill of Material with Quantity, Item No,Part Number,Part description, Flag notes in a PDF.

 

Is there any Macro that cross verify Balloon callouts in NX9 with Part list which is in PDF format?

Re: Auto balloon integrity checker

Phenom
Phenom

@cowski1 wrote:

As noted in the code above, it was written for NX 8.5 and lower. If you are using NX 9 or higher, I suggest using this version.


Hi @cowski1,

can you change the code in the manner that only missed balloon are reported and one message if all are present like the code added in the top of the topic ?

 
Thank you...

Using NX 11 / RuleDesigner PDM

Re: Auto balloon integrity checker

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

Based on my current schedule, I'll have to leave that to someone else...