最近点捕捉设置
void CmdBreak()
{
struct resbuf *rb;
ads_point ptInt;
ads_name ssname, nameObj;
resbuf vOsnode;
int iVarOsnode = 0;
int iVarOsnodeTemp = 0;
int es = ads_getvar(_T("OSMODE"), &vOsnode);
iVarOsnode = vOsnode.resval.rint;
vOsnode.resval.rint &= ~0x4000;
vOsnode.resval.rint |= 32;
es = ads_setvar(_T("OSMODE"), &vOsnode);
iVarOsnodeTemp = vOsnode.resval.rint;
rb = ads_buildlist(RTDXF0, _T("BLOCKREFERENCE"), NULL);
while (ads_getpoint(NULL, _T("\n点取打断点<退出>:"), ptInt) == RTNORM)
{
acutPrintf(_T("\n断点的坐标为:%.3f,%.3f,%.3f"), ptInt[0], ptInt[1], ptInt[2]);
es = ads_ssget(NULL, ptInt, NULL, rb, ssname);
if (es == RTNORM)
{
long iCount = 0;
ads_sslength(ssname, &iCount);
for (long i = 0; i < iCount; i++)
{
ads_ssname(ssname, i, nameObj);
//启动捕捉对象
vOsnode.resval.rint = 0;
es = ads_setvar(_T("OSMODE"), &vOsnode);
//在17建筑中没有实现打断(建筑中是使用ads_defun()方式注册的命令)
int nRet = ads_command(RTSTR, _T("_.BREAK"),
RTLB, RTENAME, nameObj, RT3DPOINT, &ptInt, RTLE,
RTSTR, _T("_F"), RT3DPOINT, &ptInt, RT3DPOINT, &ptInt, NULL);
ads_ssfree(nameObj);
//恢复捕捉对象信息
vOsnode.resval.rint = iVarOsnodeTemp;
es = ads_setvar(_T("OSMODE"), &vOsnode);
}
}//if
ads_ssfree(ssname);
}
ads_relrb(rb);
//恢复捕捉对象信息
vOsnode.resval.rint = iVarOsnode;
es = ads_setvar(_T("OSMODE"), &vOsnode);
}