Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to Undo Checkout of All (Inventor) Suppressed Components

shiftctrl.io
Enthusiast

How to Undo Checkout of All (Inventor) Suppressed Components

shiftctrl.io
Enthusiast
Enthusiast

Hi All,

 

I posted the following question on the Inventor Customization forum, though haven't received a response, so wondering if this is the right place to ask. 

 

Below is a method in a C# application which will delete all suppressed occurrences from an assembly, however I need to add some logic to first undo checkout of the suppressed components prior to the delete operation.

 

Any suggestions?

 

public static void DeleteSuppressedOccurrences(Document document)
{
    if ((int)document.DocumentType != Enum.AssemblyDocument) return;
    var assyDoc = (AssemblyDocument)document;
    var assyOccs = assyDoc.ComponentDefinition.Occurrences;
    foreach (ComponentOccurrence occ in assyOccs)
    {
        if (occ.Suppressed)
        {
            occ.Delete();
        }
    }
}
0 Likes
Reply
663 Views
3 Replies
Replies (3)

Markus.Koechl
Autodesk
Autodesk

I suggest activating each occurrence and call the UI command to Undo Checkout like this

{
    Inventor.Application mApp = ThisApplication;
    Inventor.ControlDefinition mControlDef;
    mControlDef = mApp.CommandManager.ControlDefinitions.Item("VaultUndoCheckoutTop");
    mControlDef.Execute2(true);
}

 



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes

shiftctrl.io
Enthusiast
Enthusiast

Hey Markus, thanks for the reply. I was actually looking into that same method but couldn't figure out how to do the undo checkout of specific occurrences. From what I saw, running that execute, would check-in all the components unless each component is opened individually.

 

Is that what you meant by "activate each component"?

 

If so, I was concerned that would drain a lot of resources (not sure if that's true), hence why I was looking for a way to specify the component for the Undo Checkout. From what I can tell, there is no way to do that, except for perhaps adding a new class that will connects to Vault via the Vault API and specify which file to Undo Checkout. 

0 Likes

Markus.Koechl
Autodesk
Autodesk

Yes, that was what I meant; the command handles the "top" document or the "active" one from an API perspective. Either edit the occurrence or open it to apply the command.

I doubt, that doing this via Vault server calls outperformed this approach as you need multiple steps doing it and refreshing Inventor.



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes