CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

SetDatabase Method (ActiveX)

2023-1-4 02:27| 发布者: admin| 查看: 376| 评论: 0|来自: AutoCAD

摘要: 将 AutoCAD 数据库与 LayerStateManager 对象相关联。

将 AutoCAD 数据库与 LayerStateManager 对象相关联。

支持的平台:仅窗口

签名

工 务 局:

object.SetDatabase Database
对象

类型:层状态管理器

此方法适用的对象。

数据库

访问:仅输入

类型:数据库

要与该对象关联的数据库对象。LayerStateManager

返回值(RetVal)

无返回值。

言论

没有额外的评论。

例子

工 务 局:

Sub Example_SetDatabase()
    ' The following code saves the color and linetype settings
    ' of the current layer. It uses the SetDatabase method to
    ' associate the current drawing database with the
    ' LayerStateManager object. 

    Dim oLSM As AcadLayerStateManager

    ' Access the LayerStateManager object
    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager." & Left(AcadApplication.Version, 2))

    ' Associate the current drawing database with LayerStateManager
    oLSM.SetDatabase ThisDrawing.Database

    oLSM.Save "ColorLinetype", acLsColor + acLsLineType

End Sub

Visual LISP:

(defun c:Example_SetDatabase()
    ;; The following code saves the color and linetype settings
    ;; of the current layer. It uses the SetDatabase method to
    ;; associate the current drawing database with the
    ;; LayerStateManager object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Access the LayerStateManager object
    (setq oLSM (vla-GetInterfaceObject acadObj (strcat "AutoCAD.AcadLayerStateManager." (substr (getvar "ACADVER") 1 2))))

    ;; Associate the current drawing database with LayerStateManager
    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 05:11

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部