Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Weird behavior with balloons in drawing in NX7.5

Status
Not open for further replies.

FranciscoR

Automotive
Oct 16, 2012
11
Hi, I'm trying to do a journal and I want to read the text each balloon contains in a sheet. In my company, we use a button with what I believe is a locally developed macro for creating balloons. There's also a second button on our toolbar for creating balloons immediately below or above a previously created ballon. This new balloon will not be treated as a separate object, instead, if you put mouse cursor over it, both balloons are highlighted and treated as a single IdSymbol. If i double click on it, only the text for the first balloon can be changed in the edit properties window. If I go to the Edit -> Annotations -> Edit text menu, i can actually select and modify each balloon independently. That's the way it behaves...

Now, in the journal, I can read the text in each IdSymbol correctly, however, it only gives me the main balloons. I wasn't able to read the extra balloons because, as I wrote above, the balloons are treated as a single IdSymbol so reading the UpperText value yields me just the text of one balloon.

Do any of you have an idea of how are they joining the balloons so I can find a way to unjoin them or another way to read the value of the other balloons?

Thank you.
Francisco R.


download.aspx


download.aspx


download.aspx
 
Replies continue below

Recommended for you

One more piece of data: If I do Ctrl+I (object information) on the balloon, the listing window does give me the three different strings... In which other way can I read those strings on a journal? what exactly does Ctrl+I queries? that way i would be able to read the missing strings...

download.aspx


Thanks in advance.
Francisco R.
 
The balloons are joined by editing the origin of the second one and spacing them a distance apart from each other, and making the second balloon associative to the first one.
So, to make it unassociative
edit -> annotation -> origin -> select lower balloon -> uncheck associative -> OK
 
The info window shows three text strings with three text origins, but only a single "object origin". I think there is more to it than simply three ID symbols placed next to each other. I have a vague theory as to how it was done, but have not had the time to test it. Can you upload a small example part? The only thing it really needs in it is one of these compound ID symbols.

www.nxjournaling.com
 
jerry1423, the second balloon is not associative to the first one. In fact i cannot individually select the second balloon. If i click (or right click) on the second balloon, both balloons are selected but it acts as if there was only one balloon.

cowski, I attached a quick example having nothing but the item balloons.
 
 http://files.engineering.com/getfile.aspx?folder=8f1205c7-83fd-489d-9863-315f4a854ef2&file=item_balloons.zip
I would consider submitting this to GTAC to see if they can decipher this.
 
Here's some code you can use to read all the text blocks.

Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module IDSymbol_info

    Sub Main()

        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
        lw.Open()

        Dim myIdBuilder As Annotations.IdSymbolBuilder

        If workPart.Annotations.IdSymbols.ToArray.Length = 0 Then
            lw.WriteLine("No ID symbols found in current work part")
            Return
        End If

        For Each tempID As Annotations.IdSymbol In workPart.Annotations.IdSymbols

            Dim symType As UFDrf.IdSymbolType
            Dim symInfo() As UFDrf.IdSymbolInfo
            Dim symOrigin(2) As Double
            theUfSession.Drf.AskIdSymbolInfo(tempID.Tag, symType, symOrigin, symInfo)

            'lw.WriteLine("symInfo.Length: " & symInfo.Length.ToString)
            lw.WriteLine("number of text blocks: " & symInfo(0).num_text.ToString)
            For i As Integer = 0 To symInfo(0).num_text - 1
                Dim drftAid As UFDrf.DraftAidTextInfo
                drftAid = symInfo(0).text_info(i)
                lw.WriteLine("text block: " & (i + 1).ToString & " number of text lines: " & drftAid.num_lines.ToString)
                For j As Integer = 0 To drftAid.num_lines - 1
                    Dim text As String
                    text = drftAid.text(j).full_string
                    lw.WriteLine("  line " & (j + 1).ToString & ": " & text)
                Next
            Next

            lw.WriteLine("")

        Next


    End Sub


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

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

    End Function

End Module

www.nxjournaling.com
 
Thanks for the help! The code posted does work fine in balloons with single leaders, however it will fail when using a balloon with multiple leaders, regardless of it being a single balloon or one of those "compounded balloons".

It seems this is similar to the problem referenced on thread . (I'm on NX 7544)

The weird thing tho, is that the issue is intermittent. Once every few tries, it will work fine with multiple leaders, while the rest of tries it will throw two different errors:

download.aspx

download.aspx


Do you know a workaround for this? it is crashing specifically at line:
theUfSession.Drf.AskIdSymbolInfo(tempID.Tag, symType, symOrigin, symInfo)
 
According to GTAC, this is a problem with the .AskIdSymbolInfo function:
I can confirm that it has been fixed in NX 10, however this doesn't help you much. Their suggestion is to use the IDSymbolBuilder object to get information about the ID symbol; however, I don't know of any way to get at the "text blocks" of a compound symbol through the IDSymbolBuilder object.

I would suggest contacting GTAC about this. I seriously doubt that they will issue a new patch for NX 7.5 on this issue, but they may be able to show how the IDSymbolBuilder can be used or offer some other work-around.

www.nxjournaling.com
 
Do you know how do they create that kind of compound symbol?

Thank you.
 
This error has been bugging me (no pun intended). I think I found a work-around for you; where the previous code failed in NX 9, this seems to work.

Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module3

    Sub Main()

        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
        lw.Open()

        Dim myIdBuilder As Annotations.IdSymbolBuilder

        If workPart.Annotations.IdSymbols.ToArray.Length = 0 Then
            lw.WriteLine("No ID symbols found in current work part")
            Return
        End If

        For Each tempID As Annotations.IdSymbol In workPart.Annotations.IdSymbols

            Dim searchMask(3) As Integer
            searchMask(0) = 0   'line data
            searchMask(1) = 0   'arc data
            searchMask(2) = 1   'text data
            searchMask(3) = 0   'arrow data
            Dim cycleFlag As Integer = 0
            Dim ann_data(9) As Integer
            Dim ann_data_type As Integer
            Dim ann_data_form As Integer
            Dim num_segments As Integer
            Dim ann_origin(1) As Double
            Dim radius_angle As Double

            Do
                theUfSession.Drf.AskAnnData(tempID.Tag, searchMask, cycleFlag, ann_data, ann_data_type, ann_data_form, num_segments, ann_origin, radius_angle)

                If cycleFlag = 0 Then
                    Exit Do
                End If

                lw.WriteLine("origin: " & ann_origin(0).ToString & ", " & ann_origin(1).ToString)

                Dim textLine As String
                Dim physLength As Integer
                Dim numChars As Integer
                For segmentNumber As Integer = 1 To num_segments
                    theUfSession.Drf.AskTextData(segmentNumber, ann_data, textLine, physLength, numChars)
                    lw.WriteLine("text: " & textLine)
                Next

                lw.WriteLine("")

            Loop Until cycleFlag = 0

        Next


    End Sub


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

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

    End Function

End Module


Without seeing the source code, I don't know exactly how they are doing it. But I've seen some functions in the documentation that sound like they could be used to add entities to an existing annotation (such as UF_DRF_add_to_dimension).

www.nxjournaling.com
 
Thanks cowski, however, I couldn't get your code to work. It throws an error when compiling:

"Line 51: Value of type '1-dimensional array of integer' cannot be converted to 'Integer'"

Line is:
theUfSession.Drf.AskTextData(1, ann_data, textLine, physLength, numChars)

and it seems the problem is that ann_data is an array and the function is not expecting an array. Seems to me that it should be an easy fix... I tried adding some parentheses to it but i couldn't get it to work. Let me know if you have a fix for this.



Also, I tried a workaround for your first code that seems to partially work. I'm checking the number of leaders for each balloon and if there are more than 1, they will be temporarily deleted to retrieve the balloons numbers, and then the leaders get added back. The only issue is that after deleting and adding back the leaders, they appear centered between both balloons, instead of being attached to the first balloon as it should be.
 
Dang it! Seems that .AskTextData isn't going to work for you until NX 8.5 (see PR 6789892).

Your work-around of deleting the leaders seems a good one. I'd suggest setting an undo mark before deleting the leaders, then performing an undo after you get the info you need.

www.nxjournaling.com
 
Just to let you know that adding an undo mark worked great. Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor