AutoCAD 将图层设置信息保存在图形集合的扩展字典中。Layers 首次在图形中保存图层设置时,AutoCAD 将执行以下操作:
每次在图形中保存另一个图层设置时,AutoCAD 都会创建另一个对象来描述所保存的设置,并将其存储在 ACAD_LAYERSTATE 字典中。下图说明了该过程。XRecordXRecord 在使用 ActiveX 处理图层设置时,您不需要(也不应尝试)解释。使用对象的功能访问保存的图层设置。XRecordsLayerStateManager 列出图形中保存的图层设置如果已在当前图形中保存了图层设置,则以下代码将列出所有已保存的图层设置的名称: Sub Ch4_ListStates() On Error Resume Next Dim oLSMDict As AcadDictionary Dim XRec As Object Dim layerstateNames As String layerstateNames = "" ' Get the ACAD_LAYERSTATES dictionary, which is in the ' extension dictionary in the Layers object. Set oLSMDict = ThisDrawing.Layers.GetExtensionDictionary.Item("ACAD_LAYERSTATES") ' List the name of each saved layer setting. Settings are ' stored as XRecords in the dictionary. For Each XRec In oLSMDict layerstateNames = layerstateNames + XRec.Name + vbCrLf Next XRec MsgBox "The saved layer settings in this drawing are: " + vbCrLf + layerstateNames End Sub |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:24
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.