Tabular_note_type associative origin

Hello! I have a question how to get associativity to each drafting view for each tabular note. I now how that should be for annotations.tablesections type, some code below:

For Each table256 As Tag In thetablenotes256
'this is valid for tabular_note_section_subtype
Dim myTabNote As NXOpen.Annotations.TableSection
Dim point3d As Point3d
Dim origindata As Annotations.Annotation.AssociativeOriginData
Dim origintype As Annotations.AssociativeOriginType
myTabNote = NXObjectManager.Get(table256)
point3d = myTabNote.AnnotationOrigin
origindata = myTabNote.GetAssociativeOrigin(point3d)
origintype = origindata.OriginType.RelativeToView
If myTabNote.HasAssociativeOrigin Then
listofrelative.Add(myTabNote)
End If

But I need to get the similar approach for tabular_note_subtype tags in order to be able to get cell taxt after that.
Does Anybody know how set this up? Would be very appreciate for help.

thanks
E

If you have a reference to a table section, you can get the note it belongs to with the .AskTabularNoteOfSection method. This will return the tabular note tag that the section belongs to.

Thanks for advice! I`ve just used the similar method as you recomended (asknthsection) and get the section tag, after that I was able to use proper namespace for getting relative_to_view option. Here is a piece of code:

For Each table_1 As Tag In thetablenotes_1
Dim i As Integer = 0
Dim tablesection As Tag
theUfsession.Tabnot.AskNthSection(table_1,0,tablesection)
Dim myTabNote As NXOpen.Annotations.TableSection
myTabNote = Utilities.NXObjectManager.Get(tablesection)
Dim point3d As Point3d
Dim origindata As Annotations.Annotation.AssociativeOriginData
Dim origintype As Annotations.AssociativeOriginType
point3d = myTabNote.AnnotationOrigin
origindata = myTabNote.GetAssociativeOrigin(point3d)
origintype = origindata.OriginType.RelativeToView

If myTabNote.HasAssociativeOrigin Then
list_of_relative.Add(myTabNote)
End If

Thanks a lot for support!

thanks
E

Can I ask additional question? is it possible to get view name of view which is tablesections belongs to? Could you give any clue or maybe piece of code?

thanks
E

The "originData" should have an .AssociatedView property that will return the view the table is associated to. Once you have the view object, you can query its .Name property.

Ok, I coped with that, thanks for your support!

thanks
E

Hello! Could you please help me with question:
I have group of tabular note tags where I found origin data and origin type(relative view), but I need to sort group on additional new groups depends of view quantity on the drawing.
For example, if I have 10 views with relative tabular notes on it, then 10 lists of tags will be created, and if one more view with notes appeared, new list of tags will be added.
I need it, because I don`t exactly know how much views could be on the drawing initially.
There any idea how to do it?! thanks a lot in advance.

thanks
E

I'm not quite sure what you are asking. It sounds like you want to create a list for each view to store the tags of the notes associated with that view. Is this correct? If not, please clarify.

Yes, you got me perfectly right! I would like to able to create new list of tags got each view, but problem is - quantity of views on the drawing arent defined. Maybe some kind of loop with counter can help, but i dont know exactly how to realize that for list creation, in this case(

thanks
E

Any ideas, regarding my question?

thanks
E

Yes. I'd suggest using a dictionary object where the key is the view object (or tag of the view) and the item is a list of annotations (or tags of annotations) that are associated with the view. One strategy to build the dictionary would be to iterate through the annotations. For each annotation, check to see what view it is associated to. If it is associated to a view, check the dictionary to see if the view exists there. If it does, add the annotation to the view's item list. If the view does not exist in the dictionary, add it along with a list of annotations (the current one you are querying) as its item value. Once the annotations are mapped out, you can quickly get a list of annotations for a given view.

You can find some example code of using dictionaries and lists at:
http://nxjournaling.com/comment/3597#comment-3597

The code above shows how to use a list of objects as the "item" in a dictionary object.

Ok, dictionary should work in this case, i need to check it. Thanks a lot for this idea!

thanks
E