Submitted by iamfallen on Thu, 01/30/2014 - 04:04
Forums:
Is it possible for a journal to find every tabular note on a drawing sheet and then export it by row to the listing window? I haven't found a tabular note collector and my recorded journals are coming up blank.

re: tabular note collector
What you need to find are "tabular note sections"; the code below finds (and deletes) tabular notes from layer 256. You'll probably want to modify it a bit before running it :) but it does illustrate one way to cycle through and find tabular notes. Hopefully a future version will add a tabular note collection to make this easier...
Type 'Annotations.TAbleSection' is not defined.
I can't find Annotations.TableSection. I am guessing it is something in NX 8 or later? I am still on 7.5.
re: tablesection
Yes, it appears that the TableSection class is new to NX8. However, it isn't necessary for your task. Once you have the tag of the tabular note, you can use the functions in the UFTabnot class to query and modify it as you see fit.
tabular note code
Below is some code to write out info about the first tabular note found. It doesn't look for merged cells, not sure what it will report if one or more merged cells exist in the tabular note. I'll have to experiment with merged cells later...
Also, if you are exporting your notes to the listing window, be aware that there is a line length limit in the listing window (132 characters, I think). Long notes may wrap around to the next line; if this is unacceptable, you might try exporting the notes to a text file.
Stupid Question
Hey,
I have a stupid question about the FindTabularNotes sub. What does that first if statement do? I see that it is cycling the objects in the part, but that first statement just seems to tell it to keep running if the tag is set to null. Couldnt you eclude that statement or am I missing something (I probably am tbh)
Also, and I right in thinking that it will end this do loop when it is set to null again, and that will happen wither if its run out of tabulare notes or if the part never had any to begin with?
re: good question
The short answer is that, in this case, the If block can be removed without any ill consequences. I had copied some similar code and modified it for this purpose and didn't optimize this sub.
Passing in a null tag tells the cycle function to start from the beginning. If it returns a non-null tag, we pass that in on the next iteration and it will return the next object in the collection. When it runs out of objects, it will return a null tag.
One More Question
Thank you! I think I'm beginning to understand. I have one more question, which may or may not be easy. How can I limit the layers I have the function search through? Is there a way to tell the cycleobjectsinpart to do only certain layers in its search?
re: tabular note layer
The "DeleteTabularNotes" sub in the first code listing above shows how to get a tabular note object from its tag and check its layer.
Tabular Note export
I came back here to thank you and found out you had replied back later with code. After your comment about not actually needing the tablesection I went to work myself and came up with a solution that looks a lot like yours except my do loop to find all the tabular notes is in the main and my reading of the lines happens in a sub. It does seem to work fine merged cells. I did have to toss in "cell_text.Replace(vbCr, "::").Replace(vbLf, "::")" due to there being cases where multiple lines of text existed in a single cell.