Quantcast
Channel: PTC Community : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 11410

Pro/toolkit : ProAssemblyAutointerchange() function?

$
0
0

Hello All

 

I'm trying to use the  ProAssemblyAutointerchange()  function to replace a family table istance in an assembly model but I get a PRO_TK_GENERAL error.

Has someone used this function?

 

thanks in advance.

 

here my code :

 

ProAssembly _parentasm;   /* root assembly  */

   

ProMdl _component;        // component under root assembly

ProFeature feat;                    // component feature (old component)

int *ids;                 // component identifiers from the assembly

 

ProName istname;                    // new istance name

ProFamtable ftab;         // family table

ProFaminstance fist;      // new family table istance

ProMdl newmdl;            // new model

 

ProError err;

ProName tmpname;

int i,psize;

 

...

 

// retrieve new component from family table

err=ProFamtableInit(_component,&ftab);

if ( err!=PRO_TK_NO_ERROR) ....

 

err=ProFaminstanceInit(istname,&ftab,&fist);

if ( err!=PRO_TK_NO_ERROR) ....

 

err=ProFaminstanceRetrieve(&fist,&newmdl);

if ( err!=PRO_TK_NO_ERROR) ....

 

// debug info

ProMdlNameGet(_parentasm,tmpname);

printf("Assembly = %ls\n",tmpname);

ProMdlNameGet(_component,tmpname);

printf("Old Model = %ls\n",tmpname);

ProMdlNameGet(newmdl,tmpname);

printf("New Model = %ls\n",tmpname);

 

// component id array

err = ProArrayAlloc (0, sizeof(int), 1, (ProArray*)&ids);

if ( err!=PRO_TK_NO_ERROR) ....

 

err = ProArrayObjectAdd((ProArray*)&ids,PRO_VALUE_UNUSED,1,&(feat.id) );

if ( err!=PRO_TK_NO_ERROR) ....

 

// debug component id info, (it displays the right internal feature id)

err = ProArraySizeGet((ProArray)ids,&psize);

if ( err!=PRO_TK_NO_ERROR) ....

for ( i=0 ; i<psize ; i++ )

  printf("id = %d\n",ids[i]);

 

// replace the componente  (HERE I GET THE ERROR!)

err = ProAssemblyAutointerchange( _parentasm , ids , newmdl );

if ( err!=PRO_TK_NO_ERROR) ....

 

// free resource

ProArrayFree((ProArray*)&ids);

 

...


Viewing all articles
Browse latest Browse all 11410

Trending Articles