[求助]使用CopyObjects不能复制尺寸标注
<p>用下面的代码把当前图纸中所有的图形复制到一张新建dwg中,其他图形都是好的,就是标注没有复制过去</p><p>Sub main()<br/> Dim doc1 As AcadDocument, doc2 As Object<br/> Dim ssetObj As AcadSelectionSet<br/> Dim objCollection() As Object<br/> Set doc1 = Application.ActiveDocument<br/> <br/> Set ssetObj = doc1.ActiveSelectionSet<br/> ssetObj.Select acSelectionSetAll</p><p> If ssetObj.Count > 0 Then<br/> ReDim objCollection(ssetObj.Count - 1) As Object<br/> For k = 0 To ssetObj.Count - 1<br/> Set objCollection(k) = ssetObj(k)<br/> Next k<br/> <br/> Set doc2 = Documents.Add<br/> doc1.CopyObjects objCollection, doc2.ModelSpace<br/> End If</p><p><br/>End Sub<br/></p> <p>标注也复制过去了,只不过没显示出来</p><p> Dim doc1 As AcadDocument, doc2 As AcadDocument<br/> Dim ssetObj As AcadSelectionSet<br/> Dim objCollection() As Object<br/> Dim k As Integer<br/> Set doc1 = Application.ActiveDocument<br/> <br/> Set ssetObj = doc1.ActiveSelectionSet<br/> ssetObj.Select acSelectionSetAll</p><p> If ssetObj.Count > 0 Then<br/> ReDim objCollection(ssetObj.Count - 1) As Object<br/> For k = 0 To ssetObj.Count - 1<br/> Set objCollection(k) = ssetObj.Item(k)<br/> <br/> Next k<br/> <br/> Set doc2 = Documents.Add<br/> doc1.CopyObjects objCollection, doc2.ModelSpace<br/> End If<br/> For k = 0 To ssetObj.Count - 1<br/> doc2.ModelSpace.Item(k).Visible = True<br/> Next k</p> 都是好人啊。
页:
[1]