乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 9|回复: 0

autocadmap短线检查源码

[复制链接]

2

主题

4

帖子

1

银币

初来乍到

Rank: 1

铜币
12
发表于 2009-6-19 14:53:00 | 显示全部楼层 |阅读模式
//-------------------------------------短线检查----------------------------------------------------------
void CleanupShortLine()
{
SetCurLayer(_T("checklayer"),250);
ade_id cleanupVarId = ADE_NULLID;          // variable ID
ade_id cleanupModelId = ADE_NULLID;        // clean ID
   ade_id cleanupactionVarId = ADE_NULLID;    //variable ID
ads_name ss;                               // selection set
long qty = 0;                              // quantity数量
long totalqty=0;                           //所有错误的总和
int type = 0;                              // clean error group type
int subtype = 0;                           // clean error group subtype
int done = 0;                              //是否完成清理工作
int resultCode = 0;
CString str;
//给cleanup变量分配内存,变量初始化为它们的缺省值,使用tpm_varalloc.
cleanupVarId = tpm_varalloc();
    cleanupactionVarId=tpm_varalloc();
//为cleanup模型分配内存,使用 tpm_cleanalloc.
cleanupModelId = tpm_cleanalloc();
if( ! cleanupVarId || ! cleanupModelId ||!cleanupactionVarId)
{
  acutPrintf(_T("\n内存分配失败."));
  tpm_varfree(cleanupVarId);
  tpm_cleanfree(cleanupModelId);
  return;
}
tpm_cleanactionlistins(cleanupVarId,1,1,cleanupactionVarId);//必须在tpm_cleaninit前调用
tpm_cleanactionlistins(cleanupVarId,2,256,cleanupactionVarId);//必须在tpm_cleaninit前调用
if(acedSSGet(_T("X"),NULL,NULL,NULL,ss)!= RTNORM)//第一个参数为NULL为自由选,“X”为全选
{
  acutPrintf(_T("\n获取选择集失败!"));
  tpm_varfree(cleanupVarId);
  tpm_cleanfree(cleanupModelId);
  tpm_varfree(cleanupactionVarId);
  return;
}
// 初始化一个目标选择集命名为 ss进行清理工作
tpm_cleaninit(cleanupModelId, cleanupVarId, ss);//初始化清理模型
resultCode = tpm_cleanstart(cleanupModelId);//开始清理进程
if( resultCode != RTNORM )
{
  acutPrintf(_T("\n清理工作启动失败."));
  tpm_varfree(cleanupVarId);
  tpm_varfree(cleanupactionVarId);
  tpm_cleanfree(cleanupModelId);
  return;
}
// Count errors by group type and subtype
while ( ! done)
{
  resultCode = tpm_cleangroupnext(cleanupModelId);
  if ( resultCode == RTNORM )
  {
   if (tpm_cleancomplete(cleanupModelId) == TRUE )
   {
    done = 1;
   }
   else
   {
    type = tpm_cleangrouptype(cleanupModelId);
    subtype = tpm_cleangroupsubtype(cleanupModelId);
    tpm_cleangroupqty(cleanupModelId, &qty);
    tpm_cleangroupmark(cleanupModelId);
//         tpm_cleangroupfix(cleanupModelId);
    if(qty>0)
    {
     acutPrintf(_T("\n组类型:%d,子类型:%d,错误数目:%
d"),type,subtype,qty);
     totalqty+=qty;
    }
   } // else
  } // if
  else
  {
   acutPrintf(_T("\n没有要清理的对象"));
  }
} // while
resultCode = tpm_cleanend(cleanupModelId);//完成清理进程并更新图形,修复被tpm_cleanerrorfix指定的
要修复的错误
    resultCode = acedSSFree(ss);//最后释放选择集
tpm_cleanfree(cleanupModelId);//释放清理模型
tpm_varfree(cleanupVarId);//释放配置变量
tpm_varfree(cleanupactionVarId);//释放配置变量
if(totalqty==0)
  str.Format(_T("\n恭喜!未找到任何错误。"));
else
     str.Format(_T("短线错误%d处"),totalqty);
acedAlert(str);
}
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-2-6 00:55 , Processed in 0.162698 second(s), 54 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表