大多数集合和容器对象都是通过 or 对象访问的。和 对象包含一个属性,用于访问大多数可用 Collection 对象的对象或对象 ID。例如,下面的代码定义一个变量并检索表示当前图形中集合的对象:DocumentDatabaseDocumentDatabaseLayersTableLayers VB.NET'' Get the current document and start the Transaction Manager Dim acCurDb As Database = Application.DocumentManager.MdiActiveDocument.Database Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() '' This example returns the layer table for the current database Dim acLyrTbl As LayerTable acLyrTbl = acTrans.GetObject(acCurDb.LayerTableId, _ OpenMode.ForRead) '' Dispose of the transaction End Using C#// Get the current document and start the Transaction Manager Database acCurDb = Application.DocumentManager.MdiActiveDocument.Database; using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction()) { // This example returns the layer table for the current database LayerTable acLyrTbl; acLyrTbl = acTrans.GetObject(acCurDb.LayerTableId, OpenMode.ForRead) as LayerTable; // Dispose of the transaction } VBA/ActiveX 代码参考Dim layerCollection as AcadLayers Set layerCollection = ThisDrawing.Layers 相关概念父主题: |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-7 20:02
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.