- UID
- 533871
- 积分
- 45
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2007-1-1
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
//-------------------------------------重复线检查----------------------------------------------------------
void CleanupDuplicates()
{
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_varfree(cleanupactionVarId);
tpm_cleanfree(cleanupModelId);
return;
}
tpm_cleanactionlistins(cleanupVarId,1,8,cleanupactionVarId);//必须在tpm_cleaninit前调用
TCHAR* pszConfigVarName = _T("INCLUDEOBJS_AUTOSELECT");//如何指定要清理的图元,0手动,1全部
struct resbuf* pIncludeObjsVarValRb = acutBuildList(RTSHORT,1,0);
resultCode = tpm_varset(
cleanupVarId,
pszConfigVarName,
pIncludeObjsVarValRb);//设置配置变量的值
acutRelRb(pIncludeObjsVarValRb);
TCHAR* pLayerName =_T("LINK_LAYER");//已设为1,所以此项失效
struct resbuf* pLayerRb = acutBuildList(RTSTR,_T(""),0);//""为包含所有图层
resultCode = tpm_varset(
cleanupVarId,
pLayerName,
pLayerRb);//设置配置变量的值
acutRelRb(pLayerRb);
// 初始化一个目标选择集命名为 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)
{
totalqty+=qty;
}
} // else
} // if
else
{
acedAlert(_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);
} |
|