CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2019 开发者帮助

AutoSaveInterval 属性 (ActiveX)

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

AutoSaveInterval 属性 (ActiveX)

指定自动保存间隔(以分钟为单位)。

支持的平台:仅限 Windows

签名

VBA:

object.AutoSaveInterval
对象

类型:PreferencesOpenSave

此属性应用于的对象。

属性值

只读:

类型:整数

0 >= 自动保存间隔 <= 600

等于 0 的间隔将禁用自动保存。

大于 0 的间隔会自动以指定的间隔保存图形。

言论

此属性的初始设置为 120。

对图形进行更改后,计时器将立即启动。每当保存图形时,它就会重置并重新启动。除非使用该属性指定了其他名称,否则当前图形将保存为 auto.sv$AutoSavePath

注意:此属性也由 SAVETIME 系统变量控制。ISAVEBAK 系统变量(使用属性设置)可提高增量保存的速度,尤其是对于较大的图形。ISAVEPERCENT 系统变量(使用该属性设置)确定图形中允许的浪费空间量。CreateBackupIncrementalSavePercent

例子

VBA:

Sub Example_AutoSaveInterval()
    ' This example returns the current setting of
    ' AutoSaveInterval. It then changes the value, and finally
    ' it resets the value back to the original setting.
    
    Dim preferences As AcadPreferences
    Dim currAutoSaveInterval As Integer
    Dim newAutoSaveInterval As Integer
    
    Set preferences = ThisDrawing.Application.preferences
    
    ' Retrieve the current AutoSaveInterval value
    currAutoSaveInterval = preferences.OpenSave.AutoSaveInterval
    MsgBox "The current value for AutoSaveInterval is " & currAutoSaveInterval, vbInformation, "AutoSaveInterval Example"
    
    ' Change the value for AutoSaveInterval
    If currAutoSaveInterval = 0 Then
        newAutoSaveInterval = 10
    Else
        newAutoSaveInterval = 0
    End If
    preferences.OpenSave.AutoSaveInterval = newAutoSaveInterval
    MsgBox "The new value for AutoSaveInterval is " & newAutoSaveInterval, vbInformation, "AutoSaveInterval Example"
    
    ' Reset AutoSaveInterval to its original value
    preferences.OpenSave.AutoSaveInterval = currAutoSaveInterval
    MsgBox "The AutoSaveInterval value is reset to " & currAutoSaveInterval, vbInformation, "AutoSaveInterval Example"
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_AutoSaveInterval()
    ;; This example returns the current setting of
    ;; AutoSaveInterval. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
  
    ;; Retrieve the current AutoSaveInterval value
    (setq currAutoSaveInterval (vla-get-AutoSaveInterval (vla-get-OpenSave preferences)))
    (alert (strcat "The current value for AutoSaveInterval is " (itoa currAutoSaveInterval)))
    
    ;; Change the value for AutoSaveInterval
    (if (= currAutoSaveInterval 0)
        (setq newAutoSaveInterval 10)
        (setq newAutoSaveInterval 0)
    )

    (vla-put-AutoSaveInterval (vla-get-OpenSave preferences) newAutoSaveInterval)
    (alert (strcat "The new value for AutoSaveInterval is " (itoa newAutoSaveInterval)))
    
    ;; Reset AutoSaveInterval to its original value
    (vla-put-AutoSaveInterval (vla-get-OpenSave preferences) currAutoSaveInterval)
    (alert (strcat "The AutoSaveInterval value is reset to " (itoa currAutoSaveInterval)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2025-3-5 17:57

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部