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 )
GMT+8, 2024-6-10 18:53
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.