autocad 2008 - 在两个打开的图纸之间复制对象

时间:2014-08-01 12:56:00

标签: vba autocad

我试图将折线从图纸复制到另一个

'save reference to source drawing
dim sourceDWG as acadDocument
set sourceDWG = thisdrawing

'opening a new drawing
dim destinationDWG as acadDocument
Set destinationDWG = Application.Documents.Add

'users choses the polyline
Dim poli As Object
Dim punct(0 To 2) As Double
ThisDrawing.Utility.GetEntity poli, punct, "please, choose a poliline"

'copy object from sourceDWG to destinationDWG
Dim objects(0 To 0) As Object
Set objects(0) = poli 
sourceDWG.CopyObjects obiecte 

问题在于最后一行。 SourceDWG指向当前的绘图 - 目标绘图,而不是源绘图。此代码在堆栈溢出编辑器中输入,因此它可能包含typeo'

1 个答案:

答案 0 :(得分:1)

解决:源文件是poli.document,目的地是thisdrawing.modelspace

poli.Document.CopyObjects obiecte, ThisDrawing.ModelSpace