Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

CAT

Status
Not open for further replies.

NaWin55

Mechanical
Mar 21, 2020
98
HI

i just started learning CAA c++ customization i have written code to create session and create PART Document
but the code is opening catia but not creating PART document


here is the script

#include <iostream>
#include "CATSession.h" //Header file to create Session
#include "CATSessionServices.h"
#include "CATDocumentServices.h"//Headr for document creation


using namespace std;

int main ()
{
char *iDocSessionName = "DocumentSession";
CATSession *oDocSession = NULL;
HRESULT hr = ::Create_Session(iDocSessionName,oDocSession);
if(SUCCEEDED(hr) && NULL != oDocSession)
cout<<"Session Created"<<endl;
else
{
cout<<"Failed to Create Session"<<endl;
return 0;
}

CATDocument *oDoc = NULL;
hr = CATDocumentServices :: New("Part",oDoc);
if(FAILED(hr) || NULL == oDoc)
{
cout<<"Failed in Creating Document"<<endl;
}
cout<<"Creted Document"<<endl;
if(NULL != iDocSessionName)
{
::Delete_Session(iDocSessionName);
}
}​

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor