Weird behavior with balloons in drawing in NX7.5
Weird behavior with balloons in drawing in NX7.5
(OP)
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.



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.








RE: Weird behavior with balloons in drawing in NX7.5
Thanks in advance.
Francisco R.
RE: Weird behavior with balloons in drawing in NX7.5
So, to make it unassociative
edit -> annotation -> origin -> select lower balloon -> uncheck associative -> OK
RE: Weird behavior with balloons in drawing in NX7.5
www.nxjournaling.com
RE: Weird behavior with balloons in drawing in NX7.5
cowski, I attached a quick example having nothing but the item balloons.
RE: Weird behavior with balloons in drawing in NX7.5
RE: Weird behavior with balloons in drawing in NX7.5
RE: Weird behavior with balloons in drawing in NX7.5
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 Modulewww.nxjournaling.com
RE: Weird behavior with balloons in drawing in NX7.5
It seems this is similar to the problem referenced on thread http://www.eng-tips.com/viewthread.cfm?qid=353196 . (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:
Do you know a workaround for this? it is crashing specifically at line:
theUfSession.Drf.AskIdSymbolInfo(tempID.Tag, symType, symOrigin, symInfo)
RE: Weird behavior with balloons in drawing in NX7.5
https://solutions.industrysoftware.automation.siem...
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
RE: Weird behavior with balloons in drawing in NX7.5
Thank you.
RE: Weird behavior with balloons in drawing in NX7.5
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 ModuleWithout 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
RE: Weird behavior with balloons in drawing in NX7.5
"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.
RE: Weird behavior with balloons in drawing in NX7.5
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
RE: Weird behavior with balloons in drawing in NX7.5