从图形克隆到另一个图形:
- Public Sub CloneLayers()
- Dim pAxDoc As AxDbDocument
- ' Create an instance...
- Set pAxDoc = New AxDbDocument
- ' Load in the drawing containg the layers...
- pAxDoc.Open "C:\Temp\CloneLayersTest.dwg"
-
- ' Delcare an object array to hold the layers...
- Dim pLayersToClone() As AcadLayer
- Dim i As Integer
- Dim pAxLayer As AcadLayer
-
- i = -1
- For Each pAxLayer In pAxDoc.Layers
- i = i + 1
- ReDim Preserve pLayersToClone(i)
- Set pLayersToClone(i) = pAxLayer
- Next
-
- ' Clone 'em!
- pAxDoc.CopyObjects pLayersToClone, ThisDrawing.Layers
-
- ' Clean up
- Set pAxDoc = Nothing
- End Sub
确保设置对AutoCAD/ObjectDBX Common 16.0类型库的引用。干杯,格伦。 |