双击CAD对象,显示自定义对话框实现方法,用vlisp怎么调用这个veto()方法?
双击CAD对象,显示自定义对话框实现方法,用vlisp怎么调用这个veto()方法?class TlsApplication : IExtensionApplication { void IExtensionApplication.Initialize() { TTest.Start(); } void IExtensionApplication.Terminate() { } } class TTest { static bool m_Veto = false; public static void Start() { Application.DocumentManager.DocumentLockModeChanged += new DocumentLockModeChangedEventHandler(vetoCommand); Application.BeginDoubleClick += new BeginDoubleClickEventHandler(beginDoubleClick); } static void beginDoubleClick(object sender, BeginDoubleClickEventArgs e) { Document doc = Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; PromptSelectionResult res = ed.SelectImplied(); SelectionSet ss = res.Value; if (ss != null) { if (ss.Count == 1) { using (Transaction tr = doc.TransactionManager.StartTransaction()) { Line line = tr.GetObject(ss.ObjectId, OpenMode.ForRead) as Line; if (line != null) { ResultBuffer rb = line.GetXDataForApplication("MyApp"); if (rb != null) { m_Veto = true; } } } } } } static void vetoCommand(object sender, DocumentLockModeChangedEventArgs e) { if (e.GlobalCommandName.ToLower() == "properties") { if (m_Veto) { e.Veto();
Application.ShowAlertDialog("hello"); m_Veto = false; } } } }
Veto 如何用来屏蔽CAD命令,用lisp实现
;;;=======创建文档管理器反应器*docmReactor*及回调函数==============================
(defun at_docm_reactor (/)
(if (not *docmReactor*)
(setq *docmReactor*
(vlr-docmanager-reactor
nil
'((:vlr-documentLockModeChanged . vetoCommand))
)
)
) ;_定义文档管理器反应器*docmReactor*
)
(defun vetoCommand (reactorObject parameterlist / e)
(setq e parameterlist)
(if (wcmatch (strcase (nth 4 e)) "*eattedit*,*EATTEDIT*")
(progn
(princ "hello")
(princ "如何调用 veto()方法屏蔽(阻止)命令运行")
)
)
)
;;;================================================================================ http://bbs.mjtd.com/forum.php?mod=viewthread&tid=89825&extra=&highlight=%CB%AB%BB%F7&page=1 不知道是不是版本问题,双击调用了attrib,但是返回不了鼠标点。 我在2022内用没变化
wangsr 发表于 2023-10-29 12:45
我在2022内用没变化
我的是2021 机械版 本帖最后由 sfzyr 于 2023-10-29 16:41 编辑
DocumentLockModeChangedEventArgs.Veto Method
Description
This function can be called during a DocumentLockModeChanged callback if it is a callback for a lock request. The result will be that the lock request will be vetoed, which normally means that the command will be canceled before it can start. When this function is called, DocumentLockModeChangeVetoed will be sent.
It is only active during DocumentLockModeChanged in case the receiver of the call needs to make any changes in the document before deciding whether to veto or not. By waiting until the changed callback, the document will be currently locked when the ability to veto is given. This is necessary because it is not possible to change the document's lock status from within any of these callbacks.
Visual Basic
Public Function Veto() As void
C#
public void Veto();
Links
DocumentLockModeChangedEventArgs Class, Autodesk.AutoCAD.ApplicationServices Namespace
==============================
在lisp中如何调用??请各位给与支持,谢谢。
这个veto方法,或者叫函数,能在LISP里面调用,从而在特定场合下取消执行的命令,按照自己的程序执行。 直接vlisp的反应器就可以实现,不过好像不能点击实体对象本身 我爱lisp 发表于 2023-10-31 11:06
直接vlisp的反应器就可以实现,不过好像不能点击实体对象本身
;;;=======创建文档管理器反应器*docmReactor*及回调函数==============================
(defun at_docm_reactor (/)
(if (not *docmReactor*)
(setq *docmReactor*
(vlr-docmanager-reactor
nil
'((:vlr-documentLockModeChanged . vetoCommand))
)
)
) ;_定义文档管理器反应器*docmReactor*
)
(defun vetoCommand (reactorObject parameterlist / e)
(setq e parameterlist)
(if (wcmatch (strcase (nth 4 e)) "*eattedit*,*EATTEDIT*")
(progn
(princ "hello")
(princ "如何调用 veto()方法屏蔽(阻止)命令运行")
)
)
)
这个回调函数如何修改?才能把执行中的指令给取消掉,从而执行自定义函数
页:
[1]