将 AutoCAD 数据库与 LayerStateManager 对象相关联。 支持的平台:仅窗口 签名工 务 局: object.SetDatabase Database 返回值(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))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 05:55
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.