CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2020 开发者帮助

EndUndoMark 方法 (ActiveX)

2024-5-18 18:20| 发布者: admin| 查看: 86| 评论: 0|原作者: admin|来自: AutoCAD

EndUndoMark 方法 (ActiveX)

标记操作块的结束。

支持的平台:仅限 Windows

签名

VBA:

object.EndUndoMark
对象

类别: 文档

此方法应用到的对象。

返回值 (RetVal)

无返回值。

言论

此方法允许 AutoCAD 关闭环境,以便将 to 中的操作视为一组操作。StartUndoMarkEndUndoMark

例子

VBA:

Sub Example_EndUndoMark()
    ' This example creates a series of lines, each one with an undo marker
    ' defined for it. After lines are created you can switch to AutoCAD and type
    ' the Undo command, and only one line at a time will be undone. If StartUndoMark
    ' call is not made, an undo in AutoCAD will undo all the lines at once.
    
    Dim line As AcadLine
    Dim stPnt(0 To 2) As Double
    Dim endPnt(0 To 2) As Double
    stPnt(0) = 1: stPnt(1) = 2: stPnt(2) = 0
    endPnt(0) = 2: stPnt(1) = 1: stPnt(2) = 0
    
    ' Create the lines
    Dim j As Integer
    For j = 0 To 3
        ThisDrawing.StartUndoMark
        Set line = ThisDrawing.ModelSpace.AddLine(stPnt, endPnt)
        stPnt(0) = stPnt(0) + 3
        endPnt(0) = endPnt(0) + 3
        ThisDrawing.EndUndoMark
    Next
    ZoomAll
    
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_EndUndoMark()
    ;; This example creates a series of lines, each one with an undo marker
    ;; defined for it. After lines are created you can switch to AutoCAD and type
    ;; the Undo command, and only one line at a time will be undone. If StartUndoMark
    ;; call is not made, an undo in AutoCAD will undo all the lines at once.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))  

    (setq stPnt (vlax-3d-point 1 2 0)
          endPnt (vlax-3d-point 2 1 0))  

    ;; Create the lines
    (setq j 0)
    (while (>= 3 j)
        (vla-StartUndoMark doc)
        (setq line (vla-AddLine modelSpace stPnt endPnt))
        (vlax-safearray-put-element (vlax-variant-value stPnt) 0 (+ (vlax-safearray-get-element (vlax-variant-value stPnt) 0) 3))
        (vlax-safearray-put-element (vlax-variant-value endPnt) 0 (+ (vlax-safearray-get-element (vlax-variant-value endPnt) 0) 3))
        (setq j (1+ j))
        (vla-EndUndoMark doc)
    )
    (vla-ZoomAll acadObj)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1   苏公网安备32011402011833)

GMT+8, 2024-12-15 12:34

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部