I can copy the values from an excel spreadsheet and include them in a drawing sheet and when updating the excel sheet the value in the inventor table is updated
Thanks
Solved! Go to Solution.
Solved by WCrihfield. Go to Solution.
Hi @Miguel.CarvajalS34Q6. I am just curious if you meant what you said as a statement or a question? Do you need help making that happen, or have you already figured it out and done it? If you have already figured it out and done it, I am not sure why you created this post.
Wesley Crihfield
(Not an Autodesk Employee)
It is a question. I am trying to generate a code that helps me to update the data faster in inventor from excel.
Hi @Miguel.CarvajalS34Q6. OK. So, if you already have custom tables in your drawing, and you just want to quickly update them using an iLogic rule, here is an iLogic rule that should do that task for you. It loops through each sheet in the drawing, and each custom table on each sheet, and uses their Update method. However, you will need to manually run the rule for it to do its job, unless you put the rule under one of the available events within the Event Triggers dialog.
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("A Drawing document must be active for this code to work. Exiting.", vbCritical, "")
Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDoc.Document
For Each oSheet As Sheet In oDDoc.Sheets
'if no custom tables on this sheet, skip to next sheet
If oSheet.CustomTables.Count = 0 Then Continue For
For Each oTable As CustomTable In oSheet.CustomTables
'try to update the table
oTable.Update
Next
Next
Wesley Crihfield
(Not an Autodesk Employee)
it is possible to link an excel table with a general inventor table, all the data that is inserted in the excel table is reflected in the inventor table. Thanks for the help
Hi @Miguel.CarvajalS34Q6. Yes. This can be done fairly simply, either manually, or by code.
Manually you would just go to the 'Annotate' tab > Table panel, and click on the General table tool. Once the dialog opens, click on the Browse button, then select the Excel spreadsheet file you want to reference for the table's data, then optionally specify the starting cell of the data within, and which row contains header type data.
And here is a very simple example of doing this by code. This example is not supplying the extra optional information, just inserting a basic table based on a specified Excel file to a specified location on the sheet.
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("A Drawing document must be active for this code to work. Exiting.", vbCritical, "")
Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDDoc.ActiveSheet
Dim oExcelFileName As String = "C:\Temp\MyExcelTableData.xlsx"
Dim oPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(6,6)
Dim oCTable As CustomTable = oSheet.CustomTables.AddExcelTable(oExcelFileName, oPoint)
Once you have created and inserted this type of Excel based table, if you make changes to that data in the Excel file, save the Excel file, and close the Excel file, then you will likely need select the table and right-click on it, and choose Update. I would assume that if the drawing document was closed when the Excel data was edited, that the table in the drawing would be automatically updated to match the Excel data when you open the drawing document.
Wesley Crihfield
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.