明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1539|回复: 1

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

[复制链接]
发表于 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<len;i++)
   {
    pACad->ostMessage( WM_CHAR, WPARAM(theCmdLine), lParam);
   }
   return;
}

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);
   ostAcadCommand("._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全局函数的用法。

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 06:18 , Processed in 0.173203 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表