Sunday, December 31, 2017

iLogic and the Inventor Project File

iLogic and the Inventor Project File




Issue:
You want to reference the current Inventor Project file within an iLogic rule.

Solution:
Here is a quick iLogic snippet that will demonstrate how to work with the Project file and path. In this example the project name, project file name, project path, and the full project path and file name are written to a message box.





------ start of iLogic ----------------------------------------------------------

Dim IPJ as String
Dim IPJ_Name as String
Dim IPJ_Path as String
Dim FNamePos As Long
set a reference to the FileLocations object.
IPJ = ThisApplication.FileLocations.FileLocationsFile
get the location of the last backslash seperator
FNamePos = InStrRev(IPJ, "", -1)    
get the project file name with the file extension
IPJ_Name = Right(IPJ, Len(IPJ) - FNamePos)
get the project name (without extension)
IPJ_ShortName = Left(IPJ_Name, Len(IPJ_Name) - 4)
get the path of the folder containing the project file
IPJ_Folder_Location = Left(IPJ, Len(IPJ) - <

visit link download