void Panel::CreateGeometricalSetBoj()
{
HRESULT hr;
CATDocument *pDoc = NULL;
CATFrmEditor *pEditor =CATFrmEditor::GetCurrentEditor();//获取当前的编辑器
CATILinkableObject *pLinkable = NULL;
hr = pEditor->GetUIActiveObject().Search(IID_CATILinkableObject , (void**)&pLinkable);
pDoc = pLinkable->GetDocument();
if (NULL == pDoc)
{
MessageBox(NULL , _T("pdoc空指针!") ,_T("警告" ), MB_OK);
return;
}
CATIContainerOfDocument_var spConODocs = pDoc;
CATIContainer *_pContainer = NULL;
hr = spConODocs->GetSpecContainer(_pContainer);
if (NULL == _pContainer)
{
MessageBox(NULL , _T("_pContainer空指针!") ,_T("警告" ), MB_OK);
return;
}
CATIGSMFactory_var spGSMFactory = NULL_var;
spGSMFactory = _pContainer;
CATIContainer_var spContainer= _pContainer;
CATIPrtContainer_var spPartCont = spContainer;
CATIPrtPart_var pIPrtPart = spPartCont->GetPart();
//CATIContainer_var spContainer = pISpecOnPart->GetFeatContainer();
CATIMechanicalRootFactory * pMechanicalRootFactory = NULL;
hr = _pContainer->QueryInterface( IID_CATIMechanicalRootFactory ,
( void**)& pMechanicalRootFactory );
if ( SUCCEEDED(hr) )
{
CATISpecObject_var spiSpecOnGSMTool ;
hr = pMechanicalRootFactory->CreateGeometricalSet("Flutes" ,
pIPrtPart,
spiSpecOnGSMTool);
}
}
{
HRESULT hr;
CATDocument *pDoc = NULL;
CATFrmEditor *pEditor =CATFrmEditor::GetCurrentEditor();//获取当前的编辑器
CATILinkableObject *pLinkable = NULL;
hr = pEditor->GetUIActiveObject().Search(IID_CATILinkableObject , (void**)&pLinkable);
pDoc = pLinkable->GetDocument();
if (NULL == pDoc)
{
MessageBox(NULL , _T("pdoc空指针!") ,_T("警告" ), MB_OK);
return;
}
CATIContainerOfDocument_var spConODocs = pDoc;
CATIContainer *_pContainer = NULL;
hr = spConODocs->GetSpecContainer(_pContainer);
if (NULL == _pContainer)
{
MessageBox(NULL , _T("_pContainer空指针!") ,_T("警告" ), MB_OK);
return;
}
CATIGSMFactory_var spGSMFactory = NULL_var;
spGSMFactory = _pContainer;
CATIContainer_var spContainer= _pContainer;
CATIPrtContainer_var spPartCont = spContainer;
CATIPrtPart_var pIPrtPart = spPartCont->GetPart();
//CATIContainer_var spContainer = pISpecOnPart->GetFeatContainer();
CATIMechanicalRootFactory * pMechanicalRootFactory = NULL;
hr = _pContainer->QueryInterface( IID_CATIMechanicalRootFactory ,
( void**)& pMechanicalRootFactory );
if ( SUCCEEDED(hr) )
{
CATISpecObject_var spiSpecOnGSMTool ;
hr = pMechanicalRootFactory->CreateGeometricalSet("Flutes" ,
pIPrtPart,
spiSpecOnGSMTool);
}
}