乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 80|回复: 1

[编程交流] Best way to control events (pr

[复制链接]

1

主题

1

帖子

0

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 22:09:33 | 显示全部楼层 |阅读模式
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
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 23:29:51 | 显示全部楼层
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.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-4 11:10 , Processed in 0.817578 second(s), 56 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表