fjfhgdwfn 发表于 2006-8-9 19:09:00

[求助]如何把从一个文件中的部分对象拷贝到另一个文件中(解决了)

本帖最后由 作者 于 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>

雪山飞狐_lzh 发表于 2006-8-9 21:54:00

<P>怎么不行?看看你的代码</P>

fjfhgdwfn 发表于 2006-8-10 08:06:00

<P>&nbsp;Dim FilterType(1) As Integer<BR>&nbsp;&nbsp; Dim FilterData(1) As Variant<BR>&nbsp;&nbsp; Set sjx = ThisDrawing.SelectionSets.Add("sjx")<BR>&nbsp;&nbsp; </P>
<P>&nbsp;&nbsp; FilterType(0) = 2<BR>&nbsp;&nbsp; FilterData(0) = "TK" '是圆</P>
<P>&nbsp;&nbsp; 'FilterType(1) = 62<BR>&nbsp;&nbsp; 'FilterData(1) = 10&nbsp; '颜色是3</P>
<P>&nbsp;&nbsp; FilterType(1) = 8<BR>&nbsp;&nbsp; FilterData(1) = "0"&nbsp; '图层是0<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; Dim mode As Integer</P>
<P>&nbsp;mode = acSelectionSetAll<BR>&nbsp;'sjx.Select mode, , , FilterType, FilterData<BR>&nbsp; sjx.SelectOnScreen FilterType, FilterData '选择设计线<BR>&nbsp;&nbsp;&nbsp; Dim newvarAttributes, inpoint, entry1 As Variant<BR>&nbsp;&nbsp;&nbsp; Dim ss, sss, ssss As String<BR>&nbsp;&nbsp;&nbsp; Dim sjxcount As Integer<BR>&nbsp;&nbsp;&nbsp; sjxcount = sjx.Count<BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; Dim templateFileName As String<BR>&nbsp;&nbsp; Dim DOC1 As AcadDocument<BR>&nbsp;&nbsp;&nbsp; ReDim objects(sjxcount) As AcadEntity<BR>&nbsp;&nbsp;&nbsp;&nbsp; Dim retObjects As Variant</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = 0<BR>&nbsp;&nbsp;&nbsp;&nbsp; For Each entry In sjx</P>
<P>&nbsp;&nbsp; Set objects(i) = entry<BR>&nbsp;&nbsp;&nbsp; i = i + 1<BR>&nbsp;&nbsp;&nbsp;&nbsp; Next entry<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; Set DOC1 = Documents.Add<BR>&nbsp;&nbsp;&nbsp;&nbsp; retObjects = ThisDrawing.CopyObjects(objects) '这里出错啊<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>MsgBox "1"<BR>&nbsp;ThisDrawing.Application.ZoomAll</P>

雪山飞狐_lzh 发表于 2006-8-10 08:39:00

sjxcount = sjx.Count-1

wyj7485 发表于 2006-8-10 08:39:00

ReDim objects(sjxcount-1) As AcadEntity

fjfhgdwfn 发表于 2006-8-10 11:22:00

retObjects = ThisDrawing.CopyObjects(objects) &#39;这里出错啊<BR>&nbsp;改了这里还是出错啊
页: [1]
查看完整版本: [求助]如何把从一个文件中的部分对象拷贝到另一个文件中(解决了)