处理非线性反应器序列
最后一个重要细节涉及用户使用专用 GRIP 命令修改折线时 AutoCAD 中命令/反应器序列中的一个怪癖。这些命令(如 GRIP_MOVE 和 GRIP_ROTATE)可在选择对象的夹点并单击鼠标右键后从快捷菜单中使用。反应器序列不像简单的 MOVE 或 ERASE 命令那样线性。实际上,用户在另一个命令中更改为其他命令。为了演示这种情况,您可以加载第 6 课中的代码,该代码跟踪反应堆事件的顺序。或者只需查看以下带注释的 Visual LISP 控制台窗口输出,看看会发生什么: ;; To start, select the polyline and some of the circles by using a ;; crossing selection box. The items in the selection set-- ;; the chosen circles and the polyline--are now shown with grips on. ;; To initiate the sequence, click on one of the polyline grips: (GP:COMMAND-WILL-START #<VLR-Command-reactor> (GRIP_STRETCH)) ;; Now change the command to a move by right-clicking and choosing ;; MOVE from the pop-up menu. Notice that the command-ended ;; reactor fires in order to close out the GRIP_STRETCH command ;; without having fired an object reactor event: (GP:COMMAND-ENDED #<VLR-Command-reactor> (GRIP_STRETCH)) (GP:COMMAND-WILL-START #<VLR-Command-reactor> (GRIP_MOVE)) ;; Now drag the outline (and the selected circles) to a new location. (GP:OUTLINE-CHANGED #<VLA-OBJECT IAcadLWPolyline 028f3188> #<VLR-Object-reactor> nil) (GP:COMMAND-ENDED #<VLR-Command-reactor> (GRIP_MOVE)) 这表明您无法确定在所有情况下都会调用对象反应器回调。 这个序列中有一个相关的怪癖。即使在最终的命令结尾回调期间,仍属于夹点选择集的圆圈也无法删除。AutoCAD 仍打开这些圆圈。如果在命令结束的回调期间尝试擦除它们,则可能会使AutoCAD崩溃。若要解决此问题,可以使用另一个全局变量来存储指向磁贴对象的指针列表,直到可以将其删除为止。 处理非线性反应器序列
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-3-20 03:19
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.