在已经用cad打开两个已经保存过的dwg文件的前提下,运行如下代码: Sub a() Dim lobj As AcadLine, lobj2 As AcadLine Dim doc1 As AcadDocument, doc2 As AcadDocument Dim spo(2) As Double, epo(2) As Double spo(0) = 0: spo(1) = 0: spo(2) = 0 spo(0) = 5: spo(1) = 5: spo(2) = 0 Set doc1 = ThisDrawing.Application.Documents(0) Set doc2 = ThisDrawing.Application.Documents(1) ThisDrawing.Application.ActiveDocument = doc1 Set lobj = ThisDrawing.ModelSpace.AddLine(spo, epo) ThisDrawing.Application.ActiveDocument = doc2 Set lobj2 = lobj.Copy End Sub
doc2没有直线,这是为什么呢?当然了,我也可以自己在doc2里用这个语句来实现Set lobj = ThisDrawing.ModelSpace.AddLine(spo, epo) ,但是我想知道从doc1拷贝到doc2,要用什么方法,请高手指点啊。 |