JOURNALOFENGINEERINGGRAPHICSNo.1AutoCADExcel610054AutoCADCADdwgBOMActiveXAutomationAutoCADExcelVBAAutoCADExcelBOMActiveXAutomationAutoCADExcelActiveXAutomationTH122A1003-0158(2003)01-0050-06AutoCADCADdwgAutoCADdwgBOMExceldwgExcelBOMExcelBOMAutoCADExcelAutoCADExcel200107021962CAD/CAE/CAM1ActiveXAutomationAutoCADExcelAutodeskMicrosoftAutoCADExcelActiveXAutomationMicrosoft[1]1ActiveX2AutoCADActiveXAutoCAD14ActiveX2000ActiveX2[2]12ActiveXActiveX1ActiveX2AutoCADActiveX……1ApplicationAutoCADGetObject()CreateObject()AutoCADVBDimacadobjAsObject'acadobjOnErrorResumeNextSetacadobj=GetObject(,AutoCAD.Application)'AutoCADIfErrorThen'AutoCAD2000Err.ClearSetacadobj=CreateObject(,AutoCAD.Application)'AutoCADEndIfAutoCADGetObject()AutoCADAutoCADGetObject()ErrCreateObject()AutoCAD2DocumentDocumentsDocumentAutoCADDocumentsDocumentsAdd3ModelSpaceModelSpaceDocumentAutoCAD4TextMtextAutoCADTextMtext3ExcelExcelActiveX3[3]1ApplicationExcelExcelGetObject()CreateObject()AutoCAD2WorkBookWorkBooksWorkBookExcelExcelWorkBooks3WorksheetWorksheetsWorksheet3Sheet1Sheet2Sheet3Worksheets4AutoCADExcelActiveXActiveXVBVBADelphiVCJAVAVBAVBAVisualBasicforApplicationVBVBVBAAutoCADExcelVBA[1]AutoCADExcel1AutoCADVBAAutoCADVBThisDrawing.Application’,ThisDrawingDimacadobjAsAcadApplication’,acadobjAcadApplication2EntityTypeDimiAsIntegerDimretObjAsObjectWithacadApp.ActiveDocument.ModelSpace'…3ExcelActiveXFori=0To.Count-1Step1SetretObj=.Item(i)IfretObj.EntityType=_acTextOrretObj.EntityType=acMtextThen'StringList.AddItemretObj.TextString,0EndIfNextiEndWithStringList.RefreshEndSub'mxbSetssetObj=ThisDrawing.SelectionSets.Add(mxb)'ssetObj.SelectOnScreenIfssetObj.Count=0Then'a=MsgBox(,vbRetryCancel)Ifa=4ThenCallForm_LoadElseIfa=2ThenEndEndIfEndIfMsgBox&ssetObj.Count3ExcelExcelExcelxy'TextStringArray1=retObj.TextString'XYArray2=retObj.InsertionPointxcoordinate(cnt)=Array2(0)ycoordinate(cnt)=Array2(1)temp(cnt)=Array1'ExcelForCount=1ToyForRowNum=1ToxI=I+1ExcelSheet.Cells(Count,RowNum).Value=temp(I)NextRowNumNextCountAutoCADExcel4[1].VBAAutoCAD2000[M].:,1999.27~143,284~298.[2]MarionCottingham,AutoCADVBA[M]..:,2001.83~103.[3].Excel2000VB[M].:,2000.284~298.TheComplementationMethodofTransferringTitleBlockofAutoCADintoExcelDUPing-anLIWeifanxin(UniversityofElectronicScienceandTechnologyofChina,Chengdu610054,China)Abstract:AutoCADisawide-usedCADsoftware,buttheBOMofaproductcannotbeformedbasedonthetitleblocksofassemblydrawingsthataresavedindifferentdwgfiles.Inthispaper,ActiveXAutomationtechniqueisusedtorealizethecommunicationbetweenAutoCADandExcel,andVBAdevelopmenttoolisadoptedtoimplementtheautomatictransferringofthetitleblockinAutoCADintoExcel,inwhichsomemanipulationsontablescanbecompletedconvenientlyandtheBOMwillbeformed.TheActiveXAutomationtechnique,theobjectmodelofAutoCADandExcel,theattributesandmethodsofsomeprimaryobjectsareintroduced,andfinallythecomplementationmethodoftheautomatictransferringandkeycodesarepresentedinthispaper.Keywords:computerapplication;automatictransferoftitleblook;ActiveXAutomationtechnique;dataexchange4ExcelAutoCAD明细表自动导入Excel的实现方法作者:杜平安,李维繁新作者单位:电子科技大学,成都,610054刊名:工程图学学报英文刊名:JOURNALOFENGINEERINGGRAPHICS年,卷(期):2003,24(1)被引用次数:9次参考文献(3条)1.王钰用VB开发AutoCAD2000应用程序19992.MarionCottingham.孔祥丰AutoCADVBA从入门到精通20013.易辰工作室Excel2000VB开发实例指南2000引证文献(8条)1.朱红建AutoCAD与数据库间数据交换技术的研究[期刊论文]-新技术新工艺2009(5)2.吴伟中.何文平采用AutoCAD表格对象的明细栏定制方法[期刊论文]-工程图学学报2008(4)3.刘煜.王建华用VisualBasic.Net实现图纸明细表信息的提取和更新[期刊论文]-机械设计与制造2008(4)4.吴伟中.贾长学AutoCAD普通表格转换为表格对象的方法[期刊论文]-机械工程师2007(4)5.李进.马晓平.朱骏.唐桂林CATIA环境下获取ERP系统中BOM数据[期刊论文]-江苏科技大学学报(自然科学版)2006(2)6.侯黎升.阮狄克.贾连顺.谭军.叶晓健.何勍.赵广民.李超AutoCAD在骨科图像分析领域的应用[期刊论文]-海军总医院学报2005(1)7.侯黎升.贾连顺.谭军.阮狄克.叶晓健.何勍.赵广民.李超AutoCAD在脊柱外科图像分析领域的应用[期刊论文]-脊柱外科杂志2004(3)8.王永杰.周振红.苗丽AutoCAD和Excel间的数据通信[期刊论文]-河南科学2004(4)本文链接:授权使用:广东商学院图书馆(gdsxy),授权号:64890b83-beec-423b-a4b4-9e43009d3f12下载时间:2010年12月5日