Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SSS148 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find "not-attached" ballons on drawings ? 1

Status
Not open for further replies.

Toost

Mechanical
Jan 18, 2011
2,993
Hi,
If I use manual ID-symbols ( i.e balloons) with a partslist, the balloon will update according to the corresponding line in the partslist.
If , for some reason "somebody has been cheating" and placed a non-attached balloon and manually entered some number in the balloon, the balloon will not update with the partslist. Assume that somebody adds a new component to the assembly and that the new component will re-order the partslist. Now all balloons will get new numbers except the "cheated one".

In the attached illustration, the balloon 387 is quite obviously a loose one since the arrow is far from attached, but if there are many balloons and the arrows look like they where attached,
How can i find the balloons that will not update with the partslist , or in reverse, highlight the balloons that will update ?

 
Replies continue below

Recommended for you

The following code will loop through the ID symbols and will check that the leader is associated to something. If it is not, it will be added to a named group so that you can find and fix it. Parts list autoballoons and symbols with no leaders are ignored. It could use some polish, but I think it is a start.

Try it out and let me know if you find any bugs.

Code:
'NXJournaling
'October 16, 2013
'
'Report ID symbols with a leader that is unassociated. Unassociated leaders are added to the
'group: "UNASSOCIATED_ID_SYMBOLS". Parts list autoballoons are not checked.
'limitation: only checks the first leader of a symbol
'refer to eng-tips thread561-352627

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

Module Module1

    Dim theSession As Session = Session.GetSession()
    Dim theUfSession As UFSession = UFSession.GetUFSession()
    Dim workPart As Part = theSession.Parts.Work
    Dim lw As ListingWindow = theSession.ListingWindow

    Sub Main()

        lw.Open()

        Dim unassociatedSymbolCount As Integer = 0
        Dim manualIdSymbols As New List(Of IdSymbol)
        CollectManualIdSymbols(manualIdSymbols)

        Dim nullGroup As Group = Nothing

        Dim groupBuilder1 As GroupBuilder
        groupBuilder1 = workPart.CreateGatewayGroupBuilder(nullGroup)
        groupBuilder1.ActivegroupOption = True
        groupBuilder1.ActionType = 0
        groupBuilder1.GroupDisplayProperties = False
        groupBuilder1.GroupName = "UNASSOCIATED_ID_SYMBOLS"

        For Each tempID As IdSymbol In manualIdSymbols

            If Not IsSymbolAssociated(tempID) Then

                unassociatedSymbolCount += 1
                Dim added1 As Boolean
                added1 = groupBuilder1.ObjectsInGroup.Add(tempID)
                Dim myIdSymbolBuilder As IdSymbolBuilder = workPart.Annotations.IdSymbols.CreateIdSymbolBuilder(tempID)
                'lw.WriteLine("unassociated ID symbol")
                'lw.WriteLine("text: " & myIdSymbolBuilder.UpperText)
                'lw.WriteLine("location: " & tempID.AnnotationOrigin.ToString)
                'lw.WriteLine("")

            End If

        Next

        If unassociatedSymbolCount > 0 Then
            Dim nXObject1 As NXObject
            nXObject1 = groupBuilder1.Commit()
            lw.WriteLine(unassociatedSymbolCount.ToString & " unassociated symbol(s) found, check the 'UNASSOCIATED_ID_SYMBOLS' group")
        Else
            lw.WriteLine("no unassociated ID Symbols found")
            'add code to ungroup any UNASSOCIATED_ID_SYMBOLS groups?
        End If

        groupBuilder1.Destroy()


        lw.Close()

    End Sub

    Sub CollectManualIdSymbols(ByRef theList As List(Of IdSymbol))

        'put all ID symbols, excluding parts list auto balloons, into a list
        For Each tempID As IdSymbol In workPart.Annotations.IdSymbols.ToArray()

            Dim theCallout As Tag = Nothing
            theUfSession.Drf.AskCalloutOfAnnotation(tempID.Tag, theCallout)
            If theCallout = Tag.Null Then
                'not an autoballoon
                theList.Add(tempID)
            End If

        Next

    End Sub

    Function IsSymbolAssociated(ByVal theSymbol As IdSymbol) As Boolean

        Dim myIdBuilder As IdSymbolBuilder

        myIdBuilder = workPart.Annotations.IdSymbols.CreateIdSymbolBuilder(theSymbol)

        'lw.WriteLine("num leaders: " & myIdBuilder.Leader.Leaders.Length.ToString)
        'ignore IDSymbols with no leaders
        If myIdBuilder.Leader.Leaders.Length > 0 Then

            Dim tagObj1 As TaggedObject
            tagObj1 = myIdBuilder.Leader.Leaders.FindItem(0)

            Dim leaderData1 As LeaderData = CType(tagObj1, LeaderData)
            Dim theObject As DisplayableObject
            Dim theView As View
            Dim thePoint As Point3d
            leaderData1.Leader.GetValue(theObject, theView, thePoint)

            If theObject Is Nothing Then
                Return False
            Else
                Return True
            End If

        Else
            'ID Symbol has no leaders
            'assume this is intentional
            Return True

        End If

    End Function

    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

www.nxjournaling.com
 
Brilliant Cowski !
I will give it a try.

Regards,
Tomas
 
Cowski,
I ran your journal on a few production drawings. I can't remember the item name of the specific one that had unassociated leaders,
I will ask the user if he remembers the item.

It works brilliant!

NX has an odd behavior though, if the found object is on a invisible drawing, the id symbol cannot be selected under the group for "Info - object". ( I tried to get info on what sheet it resides.)
Anyhow, i found a bonus feature , it will also find retained ID symbols.

Thanks again!

Regards,
Tomas
 
Thanks for the offer but I think that what I have is what I need.
, in some cases I will have to open sheet after sheet to find the foul balloon. :)

Super!

Tomas

 
We sometimes "cheat" and add unattached balloons for various reasons. If it accomplishes what you need in a timely manner and isn't easily broken it's not a cheat in my eyes... just another tool in the toolbox. There are a couple of ways to do this so that they do not break later. One, is to attach them to something that is not a component. Example, make the view the active sketch view and add a sketch line. Attach the balloon leader to the sketch line. Then, you can edit the text of the balloon, select category Relationship then Insert Onject Attribute and Link it to the Callout (partslist item number) for a component. If there is a reordering of the parts list, this callout changes and so does the balloon. It is linked to that component. Another example: we show where labels go on the drawing. A lot of times it is not worth making deformable parts or wrapping labels in the model in weird shapes. We bring in an imported view of the label and show it on the drafting sheet. In the model, the label also resides but as an empty reference set (just so it shows on the partslist). If you create a double leadered balloon and it is attached to a component in the assembly (showing location) and a line from an imported object (the label) they are dumb and remain empty. Then you use the relationship from above to link it to the actual label in the model via the partslist Callout number.

NX 8.0.1.5
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor