|
我想获取图中草图的直线.4,下面是我写的代码,可是我得到却是绝对轴里的横向和纵向两条线。
//得到草图底部的直线
CATIDescendants * piSketPart = NULL;
rc=spSketchFeat->QueryInterface(IID_CATIDescendants,(void **)& piSketPart);
if (SUCCEEDED(rc))
{
cout<<"查询CATIDescendants成功"<<endl;
}
else
cout<<"查询CATIDescendants失败"<<endl;
CATLISTV(CATISpecObject_var) lineList;
piSketPart->GetAllChildren("CATCurve",lineList);
int lineNum = lineList.Size();
cout<<"直线的个数为"<<lineNum<<endl;
CATISpecObject * spLineFeat= NULL;
CATLine * piButtonLine = NULL;
for (int i=1;i<=lineNum;i++)
{
spLineFeat = lineList;
if (NULL_var != spLineFeat)
{
cout<<"spLineFeat不为空"<<endl;
CATCurve * piLine= NULL;
rc=spLineFeat->QueryInterface(IID_CATCurve,(void **)& piLine);
if (SUCCEEDED(rc))
{
cout<<"查询CATLine成功"<<endl;
CATIAlias * piLineAlias = NULL;
if (SUCCEEDED(spLineFeat->QueryInterface(IID_CATIAlias,(void **)&piLineAlias)))
{
cout<<"查询CATIAlias成功"<<endl;
CATUnicodeString LineName=piLineAlias->GetAlias();
cout<<LineName<<endl;
const CATUnicodeString ButtonLineName = "直线.4";
if (LineName == ButtonLineName)
{
piButtonLine = piLine;
}
if (NULL != piButtonLine)
{
cout<<"piButtonLine不为空"<<endl;
}
}
piLineAlias->Release();
piLineAlias = NULL;
}
}
} |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|