willcan 发表于 2005-8-21 13:16:00

谁能帮我看看这段代码是什么意思?

这段代码对应了CAD里的什么操作?始终弄不明白,尤其是那些函数里的参数.求哪位看出个所以然的谈谈自己的想法,感激不尽!
void SetVars(int cmd,int bpmd,int fdia, int cmddia)
{
struct resbuf *cmdRes,*bpmdRes,*fdiaRes, *cmddias;
cmdRes= ads_newrb(RTSHORT);
bpmdRes = ads_newrb(RTSHORT);
fdiaRes = ads_newrb(RTSHORT);
cmddias = ads_newrb(RTSHORT);
cmdRes ->resval.rint = cmd;
bpmdRes->resval.rint = bpmd;
fdiaRes->resval.rint = fdia;
cmddias->resval.rint = cmddia;
ads_setvar("cmdecho",cmdRes);
ads_setvar("blipmode",bpmdRes);
ads_setvar("filedia",fdiaRes);
ads_setvar("cmddia",cmddias);
ads_relrb(cmdRes);
ads_relrb(bpmdRes);
ads_relrb(fdiaRes);
ads_relrb(cmddias);
}
void PostAcadCommand(CString theCmdLine)
{
   CWnd * pACad = (CWnd::FromHandle(adsw_acadMainWnd()))->GetTopWindow( );
   LPARAM lParam = 0x00190001;
   int len = theCmdLine.GetLength();
   for(int i=0; i
void CFrameDlg::OnOK()
{
   csPath = "D:\\1.dwg";
   SetVars(0,0,0,1);
   ads_command(RTSTR, "._tilemode", RTSTR,"0", RTNONE);
   ads_command(RTSTR,"._pspace",RTNONE);
   ads_command(RTSTR,"._insert",RTSTR,(LPCTSTR)csPath, RTSTR, "0,0,0", RTREAL,1.0,RTSTR,"",RTSTR,"",RTNONE);
   ads_command(RTSTR, "._zoom", RTSTR,"_extents", RTNONE);
   ads_printf("continue MVIEW to insert Model space viewports for output.\n");
   SetVars(1,0,1,1);
&nbspostAcadCommand("._mview ");
}

风之助 发表于 2005-8-23 20:49:00

以上一些函数都属于ads函数,在ObjectARX中不再用了,采用了新的函数名(新旧函数对照表见adsmigr.h)
#define ads_newrb acutNewRb
#define ads_relrb acutRelRb
#define ads_setvar acedSetVar
#define ads_command acedCommand
#define ads_printf acutPrintf
这几个函数的具体用法参见doc中acutNewRb、acutRelRb、acedSetVar、acedCommand、acutPrintf、acutNewRb全局函数的用法。
页: [1]
查看完整版本: 谁能帮我看看这段代码是什么意思?