CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

CopyProfile Method (ActiveX)

2023-1-4 11:13| 发布者: admin| 查看: 514| 评论: 0|来自: AutoCAD

摘要: 复制指定的配置文件。

复制指定的配置文件。

支持的平台:仅窗口

签名

工 务 局:

object.CopyProfile oldProfileName, newProfileName
对象

类型:首选项配置文件

此方法适用的对象。

旧配置文件名称

访问:仅输入

类型:字符串

要复制的配置文件的名称。

新配置文件名称

访问:仅输入

类型:字符串

要创建的新配置文件的名称。

返回值(RetVal)

无返回值。

言论

没有额外的评论。

例子

工 务 局:

Sub Example_CopyProfile()
    ' This example copies an existing profile.
    ' You can see the new profile under Options/Profiles
    '
    ' *Note: This example relies on the default profile "<<Unnamed Profile>>".
    ' If this profile has already been renamed or removed, be sure to change the
    ' name of the SourceProfile to one that currently exists.
    
    Dim ACADPref As AcadPreferencesProfiles
    Dim SourceProfile As String, DestinationProfile As String
    
    ' Use the PreferencesProfiles object
    Set ACADPref = ThisDrawing.Application.Preferences.Profiles
    
    ' Copy the default profile
    On Error GoTo ERRORTRAP
    
    SourceProfile = "<<Unnamed Profile>>"
    DestinationProfile = "NEW_PROFILE"
    
    ACADPref.CopyProfile SourceProfile, DestinationProfile
    
    MsgBox "We have just copied the existing profile " & SourceProfile & " to " & DestinationProfile
    
    Exit Sub
    
ERRORTRAP:
    If Err.Description <> "" Then
        MsgBox "The default profile '" & SourceProfile & "' cannot be found, please use a different source profile."
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CopyProfile()
    ;; This example copies an existing profile.
    ;; You can see the new profile under Options/Profiles
    ;;
    ;; *Note: This example relies on the default profile "<<Unnamed Profile>>".
    ;; If this profile has already been renamed or removed, be sure to change the
    ;; name of the SourceProfile to one that currently exists.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
  
    ;; Use the PreferencesProfiles object
    (setq ACADPref (vla-get-Profiles preferences))
    
    (setq SourceProfile "<<Unnamed Profile>>"
          DestinationProfile "NEW_PROFILE")
    
    (vla-CopyProfile ACADPref SourceProfile DestinationProfile)
    
    (alert (strcat "We have just copied the existing profile " SourceProfile " to " DestinationProfile))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 14:09

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部