pvel Posted May 22, 2014 Share Posted May 22, 2014 Hi all, Can anyone point me in the right direction, concerning the best way to intervene and control user actions (moving / deleting) in objectARX? I'm kind of lost as there seem to be many ways? For example, what is the best way to prevent deletion of certain lines (custom entities or not).. - Use the ObjectOverride classes elements and throw up an exception in Erase: http://adndevblog.typepad.com/autocad/2012/05/prevent-deletionerasing-of-entity.html - Using the notification and reactor classes? Or is the purpose of these only to inform you about something? Why are they called reactor? It seems you can catch messages but that's when they already happend. "we have deleted line ".. Should you undo the deletion in the reactor? - Hooking into the windows message loop with acedRegisterFilterWinMsg and catch 'erase'? - Jigs? - Other ways? I'd like to get control over custom entities, prevent deletion, change entities after the user is 'finished' (pressed escape, or mouse release), see if an entity can even be moved around before it happens (and prevent it), etc. What is the best way to take control of these kind of events? Thank you for any clarification. Regard , Peter Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 27, 2014 Share Posted May 27, 2014 Welcome to CADTutor. I don't code in ARX personally, but speaking conceptually; depending on which version & .NET Framework you're using, one option is to register ObjectModified Event handlers, and filter for ObjectId(s) of Type, XData, etc. and use the CommandCancelled, CommandEnded, or CommandFailed, etc. to restore the original Object Properties (or the Object itself) accordingly. You might also look into the Veto() Method depending on the specific situation, or conditions of the Command being invoked; otherwise, consider the Close() Method via ObjectOverrule. Cheers [Edit] - I just checked the DevBlog link, and see now that Viru created a new EraseOverrule Type that inherits from ObjectOverrule. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.