[求助]如何把从一个文件中的部分对象拷贝到另一个文件中(解决了)
本帖最后由 作者 于 2006-8-10 16:42:26 编辑 <br /><br /> <P>()如何把从一个文件中的部分对象拷贝到另一个文件中</P><P>不知道用哪个命令啊.</P>
<P>建了个选择集,好像用copybojects不行啊.</P>
<P>Dim doc1 As AcadDocument<BR>Set doc1 = acadApp.Documents(acadApp.ActiveDocument.Name)<BR>Dim doc2 As AcadDocument<BR>Set doc2 = acadApp.Documents.Add("acaddocument")<BR>doc1.CopyObjects appendobjs, doc2.ModelSpace<BR>调用CopyObjects的文档,必须是包含appendobjs的文档。 <BR></P> <P>怎么不行?看看你的代码</P> <P> Dim FilterType(1) As Integer<BR> Dim FilterData(1) As Variant<BR> Set sjx = ThisDrawing.SelectionSets.Add("sjx")<BR> </P>
<P> FilterType(0) = 2<BR> FilterData(0) = "TK" '是圆</P>
<P> 'FilterType(1) = 62<BR> 'FilterData(1) = 10 '颜色是3</P>
<P> FilterType(1) = 8<BR> FilterData(1) = "0" '图层是0<BR> <BR> Dim mode As Integer</P>
<P> mode = acSelectionSetAll<BR> 'sjx.Select mode, , , FilterType, FilterData<BR> sjx.SelectOnScreen FilterType, FilterData '选择设计线<BR> Dim newvarAttributes, inpoint, entry1 As Variant<BR> Dim ss, sss, ssss As String<BR> Dim sjxcount As Integer<BR> sjxcount = sjx.Count<BR> <BR> Dim templateFileName As String<BR> Dim DOC1 As AcadDocument<BR> ReDim objects(sjxcount) As AcadEntity<BR> Dim retObjects As Variant</P>
<P> i = 0<BR> For Each entry In sjx</P>
<P> Set objects(i) = entry<BR> i = i + 1<BR> Next entry<BR> <BR> Set DOC1 = Documents.Add<BR> retObjects = ThisDrawing.CopyObjects(objects) '这里出错啊<BR> <BR>MsgBox "1"<BR> ThisDrawing.Application.ZoomAll</P> sjxcount = sjx.Count-1 ReDim objects(sjxcount-1) As AcadEntity retObjects = ThisDrawing.CopyObjects(objects) '这里出错啊<BR> 改了这里还是出错啊
页:
[1]