我这里有一段给你参考吧 procedure TForm1.Button4Click(Sender: TObject); var vCadApp:Variant; vActiveDoc:Variant; sfilename,cmdsfile:string; i : integer; begin sfilename := ParamStr(1); //取运行参数,也就是带处理的dwg文件 vCadApp := CreateOleObject('autoCad.Application'); vCadApp.Visible := true; vActiveDoc := vCadApp.ActiveDocument; cmdsfile := ExtractFileDir(Application.ExeName)+'\zn_main_s.fas'; cmdsfile := StringReplace(cmdsfile,'\','\\', [rfReplaceAll]); vActiveDoc.SendCommand('(load "'+cmdsfile+'")'+#13); vActiveDoc.SendCommand('(print "\n欢迎使用室内分布系统CAD辅助画图软件,版权属于50868,\nEmail:050868@163.com,陈海容2006年11月11日" )'+#13); cmdsfile := ExtractFileDir(Application.ExeName); cmdsfile := StringReplace(cmdsfile,'\','\\', [rfReplaceAll]); vActiveDoc.SendCommand('(zn_main_s_t "'+cmdsfile + '")'+#13); vActiveDoc.SendCommand('(repeat 400(print ))'+#13); end; |