OnNewOccurence event returns null occurence

OnNewOccurence event returns null occurence

viktorkulik
Contributor Contributor
557 Views
2 Replies
Message 1 of 3

OnNewOccurence event returns null occurence

viktorkulik
Contributor
Contributor

I have some basic c# code to catch the OnNewOccurence event and this was working fine at first but now its returning null as the occurence. The EventTimingEnum is also passed in as "Before", not sure if its related. Would there be a reason for this? I can't figure out what changed that would have made it stop working. The other parameters like DocumentObject and Context are being returned fine.

private void AssemblyEvents_OnNewOccurrence(_AssemblyDocument DocumentObject, ComponentOccurrence Occurrence, EventTimingEnum BeforeOrAfter, NameValueMap Context, out HandlingCodeEnum HandlingCode)
        {
            if (PartBeingPlaced != null)
            {
                
               
                HandlingCode = HandlingCodeEnum.kEventHandled;
                
            }
            else
            {
                //HandlingCode = HandlingCodeEnum.kEventNotHandled;
            }
            HandlingCode = HandlingCodeEnum.kEventHandled;
        }
0 Likes
Accepted solutions (1)
558 Views
2 Replies
Replies (2)
Message 2 of 3

AlexKorzun
Autodesk
Autodesk
Accepted solution

The documentation for the AssemblyEvents.OnNewOccurrence (http://help.autodesk.com/view/INVNTOR/2020/ENU/?guid=GUID-653479CE-850B-4597-8B1A-75907DA3446B)
states the occurrence argument is Nothing (null in C#), if BeforeOrAfter is kBefore

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

0 Likes
Message 3 of 3

viktorkulik
Contributor
Contributor

Thanks, checking for the before/after fixed it. 

0 Likes