Jump to content

Best way to control events (prevent or allow) deletion / moving of objects )


pvel

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...