10 May 2023
Avoid using Inventor models with same file and internal name
The way Inventor differentiates files from each other is based on the combination of the file name and internal name - at least one of them should be different for each model.
If both are the same for two models in the same assembly, they are just in different folders, but their geometry is different, then that can cause unexpected results: e.g. when translating the assembly to other file formats (inc SVF used by Autodesk Viewer)
It's very easy to check your model for such issues. I created the below iLogic code so that it can be used both locally and on Design Automation as well, e.g. following this blog post.
Structure FileNameInternalName
Dim FileName As String
Dim InternalName As String
End Structure
Sub Main
Dim asm As AssemblyDocument = ThisDoc.Document
Dim fileNameInternalNames = New Dictionary(Of FileNameInternalName, List(Of String))
For Each f As File In asm.File.AllReferencedFiles
Dim fileName = System.IO.Path.GetFileName(f.FullFileName)
Dim filePath = System.IO.Path.GetDirectoryName(f.FullFileName)
Dim item = New FileNameInternalName With {
.FileName = fileName,
.InternalName = f.InternalName
}
If fileNameInternalNames.ContainsKey(item) Then
fileNameInternalNames.Item(item).Add(filePath)
Else
fileNameInternalNames.Add(item, New List(Of String)({filePath}))
End If
Next
Logger.Info("Checked " + asm.File.AllReferencedFiles.Count.ToString() + " files and found the following issues")
Logger.Info("<issues>")
For Each f In fileNameInternalNames
If f.Value.Count > 1 Then
Logger.Info("'" + f.Key.FileName + "' can be found at these places with the same internal name:")
For Each i In f.Value
Logger.Info(" >> " + i)
Next
End If
Next
Logger.Info("</issues>")
End Sub
After running the rule using my sample assembly, I get this in the iLogic Log palette of Inventor:
INFO|Checked 145 files and found the following issues
INFO|<issues>
INFO|'Upper Seat Cover.ipt' can be found at these places with the same internal name:
INFO| >> C:\Temp\Car_Seat\Car Seat\Workspace\folder
INFO| >> C:\Temp\Car_Seat\Car Seat\Workspace
INFO|</issues>