cancel
Showing results for 
Search instead for 
Did you mean: 

getting type and subtype of a selected Tabular Note.

Pioneer
Pioneer

Hi,

 

Im not getting type and subtype of a selected Tabular Note. 

Here is my code.

Filter applied as 
selection0 = (NXOpen.BlockStyler.SelectObject)theDialog.TopBlock.FindBlock("selection0");
selection0.SelectModeAsString = "Single";
PropertyList selectionProperties = this.selection0.GetProperties();

Selection.MaskTriple[] arrayMask = new Selection.MaskTriple[1];
arrayMask[0].Type = UFConstants.UF_tabular_note_type;	// 165
arrayMask[0].Subtype = UFConstants.UF_tabular_note_subtype; // 1
selectionProperties.SetSelectionFilter("SelectionFilter", Selection.SelectionAction.ClearAndEnableSpecific, arrayMask);
		
		
public int update_cb(NXOpen.BlockStyler.UIBlock block)
{
    try
    {
        if (block == selectionTable)
	{
	    PropertyList selectionProperties = this.selection0.GetProperties();
	    selectionProperties.GetPropertyNames();

	    TaggedObject[] taggedObjectVectorTables = selectionProperties.GetTaggedObjectVector("SelectedObjects");

	    try
	    {
		taggedObject = NXOpen.Utilities.NXObjectManager.Get((Tag)taggedObjectVectorTables[0].Tag);
		tableTag = (Tag) taggedObject.Tag;

		int intType ;
		int intSubType ;

		the_UFSession.Obj.AskTypeAndSubtype(tableTag, out intType, out intSubType);
		// getting object Type as 165 against 165
		// getting object subtype as 0 instead of 1
	     }
	     catch (Exception ex)
	     { 
	     } 
	}
    }
    catch (Exception ex)
    { 
    }
    return 0;
}

 

when i try to pass the Tag i got from 

tableTag = (Tag) taggedObject.Tag;

to thisUfSession.Tabnot.AskNmColumns(tagTabularNote, out total_No_Of_Columns);

 

Im getting an error as Passed object tag is not of Type UF_tabular_note_type

 

can anybody tel me  how to proceed further.

 

Regards,

Maddy

Windows 7 x64
NX 8.5, NX 9.0. And also NX 7.5
Visual Studio 2010 SP1, 2012 Update 4
5 REPLIES

Re: getting type and subtype of a selected Tabular Note.

Phenom
Phenom

When tabular notes are created you have to define the maximum height and if the height exceeds this value, then the tabular note is split into sections and you can control how the sections are layed out. When the tabular note is smaller than the maximum size it is still split into sections, just that there is only one section.

What I think is happening is that when you interactively select a tabular note what you are actually selecting is a tabular note section and each of these sections are of type:

UF_tabular_note_type/UF_tabular_note_section_subtype

I don't think you can interactively select the actual tabular note itself, only the sections. So to get the tabular note from the section, call:

UF_TABNOT_ask_tabular_note_of_section()

This is a C function and at NX8.5 (what I use) there is no NXOpen call to do the same thing so I had to call the UF wrapper:

nxopen.uf.UFTabNot.askTabularNoteOfSection()

 Hope this helps...

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP11 64bit Testing: NX9.0.2.5

Re: getting type and subtype of a selected Tabular Note.

Siemens Phenom Siemens Phenom
Siemens Phenom

 

The thing that you can see in your part is the section, which is of subtype 0:

 

#define UF_tabular_note_type                    165
#define UF_tabular_note_section_subtype                0
#define UF_tabular_note_subtype                             1
#define UF_tabular_note_row_subtype                     2

 

Many of the functions for manipulating tabular notes require that you pass in the UF_tabular_note_subtype tag, rather than the section.

 

It might help to thing of the type 1 as being an invisible container, that can have sections.

 

If you are performing a selection, you can only get the section directly - there is no way to pick the note itself.

 

If you have the section, (subtype 0), and you need the note, (subtype 1), then you need to call UF_TABNOT_ask_tabular_note_of_section(), or the wrapper for that call.

 

I hope this helps!

 

 

 

 

Re: getting type and subtype of a selected Tabular Note.

Pioneer
Pioneer

 

Thank you Inch Genius and Steve,

 

Thanks alot.....

 

Regards,

Maddy.

Windows 7 x64
NX 8.5, NX 9.0. And also NX 7.5
Visual Studio 2010 SP1, 2012 Update 4

Re: getting type and subtype of a selected Tabular Note.

Phenom
Phenom

@Maddy note the 'Genius' below my name is some sort of measure of experience automatically added by the community, like you have 'Experimenter'. Don't think I'm an egotist Man Wink

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP11 64bit Testing: NX9.0.2.5

Re: getting type and subtype of a selected Tabular Note.

Pioneer
Pioneer

@Inch, Ya sure,

     What you and Steve gave was a valuable thing for me as it saved my time. i had been worried about it for two days thinking that i had been doing something wrong because of which i was not able to get the result i wanted.

 

Thanks again guys.

 

Regards,

Maddy

Windows 7 x64
NX 8.5, NX 9.0. And also NX 7.5
Visual Studio 2010 SP1, 2012 Update 4