I have been using sample code that allows features in a part file to be selected and used for measurement purposes through a UserSelectionPostNotify function. The lastest improvement is to determine if the focus within solidworks has been changed to a different part file. This appears to work but sometimes the SelMgr = swModel.SelectionManager (the first line in the UserSelectionPostNotify function throws an error).
Sometimes it appears that the focus of the part is slow "register" (or come into focus). Many times there is no delay at all and other times as much as 10 seconds passes before selections begin to be successful. Once a part is in focus and numerous selections can be made. There is only an issue (sometimes) when switching between parts.
Any ideas why this happens? Any ideas about how to fix this?
Thank you for any help.
SolidworksApi macros