ITK Programming-Item creation with dataset

#include<stdio.h>

#include<tc/tc.h>

#include<tccore/item.h>

#include<ae/datasettype.h>

#include<ae/dataset.h>

#include<tccore/aom.h>

#include<ae/ae.h>

#include<sa/tcfile.h>

#include<tccore/grm.h>

int ITK_user_main(int argc, char *argv[])

{

int ifail=0;

tag_t tDatasettype=NULLTAG;

tag_t tNewDataset=NULLTAG;

tag_t item=NULLTAG;

tag_t rev=NULLTAG;

tag_t tNewFileTag=NULLTAG;

tag_t specification=NULLTAG;

tag_t relation=NULLTAG;

IMF_file_t fileDescriptor;

 

ifail = ITK_init_module(“infodba”,”infodba password”,”dba”);

if(ifail != ITK_ok)

{

printf(“\nTeamcenter Login Failed”);

}

else

{

printf(“\nTeamcenter Login Successful.”);

ifail =ITEM_create_item(“000010″,”Test_part”,”Item”,”001″,&item,&rev);

if (ifail!=ITK_ok)

{

printf(“\npart is not created”);

}

else

{

printf(“\npart is created.”);

}

 

AOM_save(item);

AE_find_datasettype2(“Text”,&tDatasettype);

if(tDatasettype != NULLTAG)

{

printf(“\ndataset type not found”);

}

else

{

printf(“\ndataset type found”);

}

AE_create_dataset_with_id(tDatasettype,”Test01″, “DEMO_01″,”001″,”1” ,&tNewDataset);

if(tNewDataset != NULLTAG)

{

printf(“\ndataset not Created”);

}

else

{

printf(“\ndataset created successfully”);

}

IMF_fmsfile_import(“please put location of dataset/test.txt”,”TEST.txt”,SS_TEXT,&tNewFileTag,&fileDescriptor);

if(fileDescriptor != NULLTAG)

{

printf(“\nDataset File is not imported successfully”);

}

else

{

printf(“\nDataset File is imported successfully”);

}

AOM_refresh(tNewDataset,TRUE);

AE_add_dataset_named_ref2(tNewDataset,”Text”,PART,tNewFileTag);

AOM_refresh(tNewDataset,FALSE);

AOM_save(tNewDataset);

AOM_unload(tNewFileTag);

AOM_unload(tNewDataset);

GRM_find_relation_type(“IMAN_specification”,&specification);

GRM_create_relation(rev,tNewDataset,specification,NULLTAG,&relation);

}

ITK_exit_module(TRUE);

printf(“\nTItem is created successfully with attached dataset.”);

return 0;

}

 


  Popular Teamcenter Article published


 


Four Easy Steps to Get Subscribed

Step1:-Enter your Email address and Hit SUBSCRIBE Button.

Step2:-Please check inbox and open the email with the subject lineConfirm your subscription for Global PLM“.

Step3:-Please click “Confirm Follow” and you got the email with the subject” Confirmed subscription to posts on Global PLM”.

Step4:-Voila, You are subscribed.Happy Learning


 

admin