|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
CAA: 和CATIA v5 R11 CATIA v5 R13中Draft的复制问题
本人做了一个程序,在CATIA v5 R11中可以进行复制视图,但到了CATIA v5 R13就不行了,总是提示我 command interruput,请高手指点!!!
主要代码如下:
CATListValCATISpecObject_var spViewToPasteList=spSheet1->GetViewList();
CATICutAndPastable_var spSrcCCP(CATISpecObject_var(spSheet1)->GetFeatContainer());
CATICutAndPastable_var spTarCCP(CATISpecObject_var(spSheet2)->GetFeatContainer());
IdFormat MyFmy ="CATDrwCont" ;
const CATFormat* pFmt = CATFormat::GetRegisteredFormat(MyFmy);
ListOfVarBaseUnknown newListToCopy;
ListOfVarBaseUnknown listFromCopy;
for ( int j = 1; j<=spViewToPasteList.Size(); j++)
{
CATIView_var(spViewToPasteList[j])->SetViewType(Main_View);
listFromCopy.Append(spViewToPasteList[j]);
listPastedObjects= spTarCCP -> Paste (extractedListToCopy,&listTargetObjects ,pFmt);
CATISketch_var spSkech =(CATIView_var(spViewToPasteList[j]))->GetSketch();
CATIDescendants_var spDes(spSkech);
if (!spDes)
{
cout << "No CATIDecendants Interface." << endl;
}
else
{
CATListValCATISpecObject_var listChildren;
spDes->GetAllChildren("CATIDrwText", listChildren); //"CATISpecObject"
int c = listChildren.Size();
for (int i = 1; i<=c; i++) ((CATIDrwText_var)listChildren[i])->SetOrientationReference(1);
}
HRESULT rc = spSrcCCP -> BoundaryExtract (newListToCopy, &listFromCopy,pFmt);
ListOfVarBaseUnknown extractedListToCopy;
CATICutAndPastable_var spSrcCCPExt = spSrcCCP -> Extract (newListToCopy, pFmt);
int r = 0;
if (!!spSrcCCPExt) r = spSrcCCPExt->BoundaryExtract(extractedListToCopy, NULL,pFmt);
for( j=1;j<=extractedListToCopy.Size();j++)
{
double ox,oy;
CATIDftViewMakeUp *ViewMU =NULL;
rc=extractedListToCopy[j]->QueryInterface(IID_CATIDftViewMakeUp, (void **)&ViewMU);
if(SUCCEEDED(rc))
{ ViewMU->GetPosition(&ox,&oy);
ViewMU->SetPosition(ox,oy);
}
ListOfVarBaseUnknown listPastedObjects ;
ListOfVarBaseUnknown listTargetObjects ;
listTargetObjects.Append(spSheet2);
listPastedObjects= spTarCCP -> Paste (extractedListToCopy,&listTargetObjects ,pFmt);
} |
|