Page 57
Specify the name that displays in the Autodesk Inventor Model tree, under 3rd
Party.
External Path (Method 3)
Another option for reading data into iLogic program is to link the spreadsheet to the
inventor file by writing code to specify the path to the Excel file. For a filename, you can
either specify a relative or absolute path.
Relative Path:
If you do not specify a path, iLogic assumes that the Excel document is in the same
folder as the current Inventor document. A relative path is assumed to be in the
same folder as the Inventor file. iLogic also searches for the file under the project
Workspace path. You can use a relative path under the project Workspace path.
The syntax to use for writing code for a spreadsheet that utilizes a Relative
Path is:
o GoExcel.CellValue("filename.xls", "Sheet1", "A2")
Absolute Path:
An absolute path is entered in the iLogic code to read data directly from the
spreadsheet file location. Although, using an absolute path can make it difficult to
send the model to another user on another computer or if the file moves it could
make all your code invalid.
The syntax to use for writing code for a spreadsheet that utilizes an
Absolute Path is:
o GoExcel.CellValue("C:\BOMs\filename.xls", "Sheet1", "A2")
There are ways to write code to make the path a parameter. This will allow you to update
the code quickly, if the path changes. Even better, you could write code to browse for the
file location and once you select the file; the parameter for the path will update the code.
An example of this will be shown later.
Parameter Creation Using the API
Some API expressions to create parameters are as follows:
The following code snippet allows any parameter creation code to be simpler and more
compact, with the same outcome. Writing this expression will save typing time and this code
snippet only needs to be defined once in your code.
'-----------------SHORTENS THE AMOUNT OF TEXT TO TYPE WHEN CREATING PARAMETER CODE
oMyParameter=ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters