The CopyObjects method will copy the objects in place if no other BlockTable is specified. In the example below the ModelSpace of the new file DOC1 was set as the destination for the copied objects.
Code:Sub danblock() Dim ss As AcadSelectionSet Dim fType(0) As Integer Dim fData(0) As Variant Dim ent As AcadEntity With ThisDrawing.SelectionSets While .Count > 0 .Item(0).Delete Wend Set ss = .Add("setbom") End With fType(0) = 0 fData(0) = "LINE,CIRCLE,INSERT,LWPOLYLINE" ss.SelectOnScreen fType, fData If ss.Count = 0 Then Exit Sub Dim DOC1 As AcadDocument Dim CurrDoc As AcadDocument Set CurrDoc = ThisDrawing.Application.ActiveDocument Set DOC1 = Documents.Add Dim exportFile As String exportFile = "C:\DXFExprt" 'Modify as needed Dim objCollection() As Object Dim intCount As Integer Dim i As Integer intCount = ss.Count - 1 ReDim objCollection(intCount) For i = 0 To intCount Set objCollection(i) = ss.Item(i) Next CurrDoc.CopyObjects objCollection, DOC1.ModelSpace DOC1.Export exportFile, "DXF", DOC1.SelectionSets.Add("Temp") End Sub




Reply With Quote
Bookmarks