Hi,
I'm using Inventor 2017 and sometimes some files are not found.
Is it possible to solve the file through the API instead of using the Inventor command?
My idea is to create an API to automatically solve lost reference problems without the need of users intervention.
Thanks.
Solved! Go to Solution.
Solved by sajith_subramanian. Go to Solution.
Hi marcelo.zattera,
Please see below a piece of VBA code that does something similar. There could be better ways to achieve this, but hopefully this should help get you started.
Sub main() Dim assemdoc As AssemblyDocument Set assemdoc = ThisApplication.ActiveDocument Dim oCCs As ComponentOccurrences Dim occ As ComponentOccurrence Dim Path As String Dim Filename As String Dim FullFileName As String Dim Resolvedfile As String Set oCCs = assemdoc.ComponentDefinition.Occurrences Path = "C:\Temp\" 'The path which contains the unresolved file For Each occ In oCCs ' check for missing reference. If occ.ReferencedDocumentDescriptor.ReferenceMissing = True Then ' This will return true for unresolved and suppressed. FullFileName = occ.ReferencedDocumentDescriptor.FullDocumentName 'Get the full document name Filename = Right$(FullFileName, Len(FullFileName) - InStrRev(FullFileName, "\")) ' Extract the filename from the full filename. Resolvedfile = ThisApplication.DesignProjectManager.ResolveFile(Path, Filename) 'Resolve file. Full file name is returned. Null will be returned if cannot be resolved. Call occ.Replace(Resolvedfile, False) ' replace unresolved occurrence with the resolvedfile End If Next End Sub
Do let me know if it works for you.
Regards,
Sajith
@sajith_subramanian do you have any idea, how this can be done using
Apprentice Server
Can't find what you're looking for? Ask the community or share your knowledge.