Submitted by iamfallen on Thu, 10/15/2015 - 04:16
Forums:
Is it possible to edit the contents of a cell in a spreadsheet controlled tabular note? I can read and write to a non spreadsheet controlled tab note, but I am only able to read from one that is spreadsheet controlled. The code does not error when "writing", it just does not change the text.

re: edit spreadsheet note
You can determine if a cell is driven by the spreadsheet by looking at the cell preferences. The code below shows how to do this.
To edit the spreadsheet values, I think you would have to extract the spreadsheet to a file, manipulate the values, and then store the spreadsheet back in the part - but I have not verified this workflow yet. The relevant commands would be .ExtractSpreadsheet and .StoreSpreadsheet.
re: re: edit spreadsheet note
Any Idea what the spreadsheet name would be? The help file only lists:
"MODELING_SHEET" - modeling spreadsheet data
"DEFAULT_SHEET" - Gateway spreadsheet data
"PART_FAMILY_SHEET" - Part Family spreadsheet data
I tried the modeling and default sheets. Both times I got:
re: edit spreadsheet note
The code below doesn't quite work, but it is close. The code looks at each tabular note; if the note in row 1, col 1 references a spreadsheet, it will attempt to modify the note. It successfully extracts and edits the spreadsheet; but it errors on the call to .StoreSpreadsheet. It doesn't seem to like the name of the spreadsheet even though it is the name that was extracted from the spreadsheet. This might be a case for GTAC to investigate. My guess is that the .StoreSpreadsheet method has not been updated to handle tabular note spreadsheets.
For what it's worth, here's the code (edit the value of "tempFile" to something appropriate for your setup before running it):
re: edit spreadsheet tabnote
I spoke with GTAC this morning.
I have confirmed that we do not have any way to do this using NXOpen. The extract/store spreadsheet functions are only expected to work with three specific spreadsheets, as documented in the Open C Reference for the original C function from which the wrapper method is created: Spreadsheet object name: "MODELING_SHEET" - modeling spreadsheet data "DEFAULT_SHEET" - Gateway spreadsheet data "PART_FAMILY_SHEET" - Part Family spreadsheet data While you might be able to successfully extract a spreadsheet with a different name - such as TABNOT_SPREADSHEET2 - The related Store function is not going to work with names other than what is shown in the docs. This is why you are seeing the error message about "The first parameter passed in was invalid. at NXOpen.UF.UFXs.StoreSpreadsheet(String spreadsheet_name..." -- it will only accept one of the names shown in the documentation.This IR was converted into an enhancement request (ER) on 20-OCT-2015
and is now referenced as ER Number 7540975. It is OPEN for review at this time.
They suggested to convert the tabular notes from spreadsheet controlled via ConvertToNonSpreadsheetTabnote().
Thank you for your help.