Monday, August 4, 2014

Power of ilogic Part 2...

So, in Part 1 we looked at pulling information from Excel and putting it into Inventor.  And, as a reminder this is what the code looked like for that process.
GoExcel.Open("C:\Users\Public\Documents\Autodesk\Inventor 2015\Templates\Projects template.xlsx", "Sheet1")
iProperties.Value("Project", "Revision Number") = GoExcel.CellValue("B8")
iProperties.Value("Summary", "Manager") = GoExcel.CellValue("B6")
iProperties.Value("Summary", "Company") = GoExcel.CellValue("B5")
iProperties.Value("Project", "Project") = GoExcel.CellValue("B1")
iProperties.Value("Project", "Engineer") = GoExcel.CellValue("B7")
iProperties.Value("Custom", "Customer") = GoExcel.CellValue("B2")
iProperties.Value("Custom", "Address1") = GoExcel.CellValue("B3")
iProperties.Value("Custom", "Address2") = GoExcel.CellValue("B4")

This time we are going to look at how to take information from Inventor and put it into Excel.  We are going to use the same excel file as last time and just ad some more stuff to it.  We will use P1's code as our reference.
GoExcel.Open("C:\Users\Public\Documents\Autodesk\Inventor 2015\Templates\Projects template.xlsx", "Sheet1")
GoExcel.CellValue("B19") = iProperties.Value("Project", "Revision Number")
GoExcel.CellValue("B17") = iProperties.Value("Summary", "Manager")
GoExcel.CellValue("B16") = iProperties.Value("Summary", "Company")
GoExcel.CellValue("B12") = iProperties.Value("Project", "Project")
GoExcel.CellValue("B18") = iProperties.Value("Project", "Engineer")
GoExcel.CellValue("B13") = iProperties.Value("Custom", "Customer")
GoExcel.CellValue("B14") = iProperties.Value("Custom", "Address1")
GoExcel.CellValue("B15") = iProperties.Value("Custom", "Address2")

Notice that in this code we basically just flipp flopped what was on each side of the equal sign.
These are simple codes for pulling info out of an Inventor file.  In Part 3 we will look at writing a rule that will create an excel doc for us and then pull information out of your inventor part and input it into the newly created excel doc.

No comments:

Post a Comment