Submitted by dsurajitd on Sat, 07/16/2016 - 02:17
Forums:
Hello everyone,
I have started working on NX spreadsheets and ran into the following problem
Is there a way to retrieve the cell values from NX spreadsheet using NXOpen/UFUNC. I have checked in GTAC, they have answers for importing expressions into the spreadsheets.
Also how do we use SpreadSheetData class? The detailed description does not mention the class from where we should create the object.And its parent Transient Object class does not have useful functions.
Thanks!!
re: NX spreadsheet
From the API docs, it appears that the SpreadSheetData class is for use with CAM tooling operations; I don't think it gives you access to the general gateway or modeling spreadsheets.
To get the gateway or modeling spreadsheets, try the .ExtractSpreadsheet function. This will allow you to extract the information to an external Excel file; you can then use the Excel object model to query or modify the contents. The .StoreSpreadsheet function would then be used to store the data in the prt file.
The closest example code that I have on hand can be found here:
http://nxjournaling.com/content/editing-spreadsheet-controlled-tabular-note
Hi,
Hi,
I have tried the .StoreSpreadsheet function,and I have succeeded in bringing a single sheet from an external workbook to the NX spreadsheet.
However I am not able to append multiple sheets to the NX spreadsheet.
The previous sheets get overwritten once I re-run the code.
Also in the above link that you have provided they have used Tabnot class. Is there any claas for NXspreadsheet
Thanks
re: spreadsheet
I believe that you will need to extract the existing spreadsheet with the .ExtractSpreadsheet NX function then call Excel functions to add a sheet and modify it before calling the NX .StoreSpreadsheet function. If you just call the .StoreSpreadsheet on a newly created Excel sheet, I would expect it to overwrite the existing NX spreadsheet.
There appear to be a few "spreadsheet" type functions in the NX API, but it appears they are for specialized functions (tooling, vehicle design, motion application, etc) and are not meant to modify the modeling spreadsheet.