Cancel
Showing results for 
Search instead for 
Did you mean: 

GeneralNoteBuilder not setting Category or Text in GeneralNote as expected

Pioneer
Pioneer

For information I am embedding as PMI that doesn't have pre-defined "specialty" categories, I'm using the GeneralNote object type.  But I'm having a problem where general notes placed in the model are defaulting to the first Category and Identifier available in the dialog box, not what my script tries to assign them.  This results in the text shown on the note being incorrect.  Strangely, the Title attribute comes across just fine!

The code segment originally looked like this:

toggleBuilder1.Title = title
toggleBuilder1.Category = self.ctrlNoteData[title]['Category'] 
toggleBuilder1.Identifier = self.ctrlNoteData[title]['Identifier']
toggleBuilder1.Revision = self.ctrlNoteData[title]['Revision']
text1 = [self.ctrlNoteData[title]['Text']]
toggleBuilder1.SetText(text1)    

When that didn't work like I expected, based on this, https://docs.plm.automation.siemens.com/data_services/resources/nx/10/nx_api/en_US/custom/nxopen_pyt...I tried changing it to this:

toggleBuilder1.Title(title)
toggleBuilder1.Category(self.ctrlNoteData[title]['Category']) 
toggleBuilder1.Identifier(self.ctrlNoteData[title]['Identifier'])
toggleBuilder1.Revision(self.ctrlNoteData[title]['Revision'])
text1 = [self.ctrlNoteData[title]['Text']]
toggleBuilder1.SetText(text1)      

But that complains because "str" object is not callable.

Are GeneralNote objects somehow beholden to only contain Categories and Identifiers that our administrators put into a setup file somewhere?  If I want to use Text that isn't in that file, do I need to keep the Category and Identifier always at "User Defined"?  Or am I just doing something incorrectly above?

 

Edited to add:

Well, this "works" in that I get the text I wanted instead of the default text:

toggleBuilder1.Title = title
toggleBuilder1.Category = "User Defined"  
toggleBuilder1.Identifier = "User Defined" 
toggleBuilder1.Revision = self.ctrlNoteData[title]['Revision']
text1 = [self.ctrlNoteData[title]['Text']]
toggleBuilder1.SetText(text1)     

But I still wanted to use the Category and Identifiers for my own purposes.  Is there a way to force it to accept new ones that aren't in some .dfa file somewhere?