Tuesday, January 17, 2006

Copy dimstyles between drawings using VBA

' Add reference to AutoCAD/ObjectDBX Common 16.0 Type Library (axdb16enu.dll)
' This samples copies all dimstyles from specified drawing to the current drawing
' Existing dimstyles are not affected
Public Sub ImportDimstyles()
   Dim oAxDbDoc As New AxDbDocument
   oAxDbDoc.Open "c:\DimStyles.dwg"
   Dim oObj() As Object
   Dim oDs As AcadDimStyle
   Dim i As Integer
   For i = 0 To oAxDbDoc.DimStyles.Count - 1
      ReDim Preserve oObj(i)
      Set oObj(i) = oAxDbDoc.DimStyles(i)
   Next
   oAxDbDoc.CopyObjects oObj, ThisDrawing.Database.DimStyles
End Sub

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner