OnFileResolution with Content Center parts

OnFileResolution with Content Center parts

j.haggenjos
Advocate Advocate
346 Views
2 Replies
Message 1 of 3

OnFileResolution with Content Center parts

j.haggenjos
Advocate
Advocate

Hello all,

 

 

I have an issue with the OnFileResolution event in my AddIn. I'm hoping you can help me. I already have "embedded interop types" set to false, so unfortunately this is not my issue.

 

In most case, I can use my custom file resolution logic to give inventor a file path. However, when trying to resolve a content center part, Inventor seems to simply ignore the file path I'm providing.

Stepping through the code, I can see I'm providing the correct path on disk. However, the file is still unresolved when the assembly finishes opening. However, If I "right click -> Resolve file" in the model browser, Inventor finds the files without issues (at the path I'm providing in the code).

 

We are using Inventor 2019. We are planning to upgrade to 2022 soon, so I tested 2022 and the issue also happen.

In 2022, each unresolved file asks for manual input and providing the file does nothing (popup comes back, only skip works). And then "right click -> Resolve file" works as expected (same as 2019).

 

I also noticed that the event does not fire "after" for content center parts, even if the part is not resolved. So it may be a bug in Inventor?

 

Below is my code:

 

 

    Private Sub FileAccessEvents_OnFileResolution(RelativeFileName As String, LibraryName As String, ByRef CustomLogicalName() As Byte, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, ByRef FullFileName As String, ByRef HandlingCode As HandlingCodeEnum) Handles FileAccessEvents.OnFileResolution

        HandlingCode = HandlingCodeEnum.kEventNotHandled
        Dim tentativePath As String = CustomFileResolution(RelativeFileName, LibraryName, Context)
        If IO.File.Exists(tentativePath) Then
            HandlingCode = HandlingCodeEnum.kEventHandled
            FullFileName = tentativePath
        End If
    End Sub

 

 

0 Likes
347 Views
2 Replies
Replies (2)
Message 2 of 3

bradeneuropeArthur
Mentor
Mentor

Are the paths local or on a server?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 3

j.haggenjos
Advocate
Advocate

Path are on local disk.

 

A few more thing after further testing:

 

In Inventor 2019 using the GUI file resolution ("right click -> Resolve file") auto resolve without asking user to provide the path (parts are in same folder as assembly). Inventor opens with unresolved item without asking for path until resolve file is manually triggered.

 

In Inventor 2022 using the GUI file resolution, Inventor asks for the path and does not accept the path I provide. While opening, Inventor automatically asks for path of missing files.

 

Providing the path on the file resolution event does not work in both 2019 and 2022. However, if I moved the parts somewhere within the content center folder and provide the path, Inventor will then accept it and resolve to it.

 

 

If I move the part to be within the content center (can be different from original path), Inventor will then accept the provided path (API or GUI).

 

 

My current workaround is to use the OnDocumentOpen event (after) to replace the unresolved component. This works well. However, replacing the reference is a slow process and I would like to avoid it. Also, with Inventor 2022 user has to manually skip file resolution before my workaround triggers and replace the missing reference.

0 Likes