cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Pro/toolkit : ProAssemblyAutointerchange() function?

Highlighted

Pro/toolkit : ProAssemblyAutointerchange() function?

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);

...

Tags (1)
2 REPLIES 2
Highlighted

Re: Pro/toolkit : ProAssemblyAutointerchange() function?

Hi,

Your code works fine , just ensure you add valid and correct feature Id in API

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

It appears feature object is not initialized , so feature Id will be a garbage value.

Thanks

Highlighted

Re: Pro/toolkit : ProAssemblyAutointerchange() function?

Hi

I find out the issue: the model had regeneration problems, I fixed the errors moving the cursor under the component feature, after that it works fine.

Thanks

Announcements