Skip to main content
1-Visitor
July 21, 2018
Solved

How to Use Creo ToolKit Function "ProExpldstateMovesSet()"

  • July 21, 2018
  • 2 replies
  • 4418 views

Hi All,

As title, I have already given parameters including below

---

p_move_arr.comp_set=&asm_prt_data[i].comp_path;
p_move_arr.move.value=300;
p_move_arr.move.move_type=PRO_EXPLDANIM_MOVE_TRANSLATE;

p_move_arr.move.direction.dir_vector[0]=0

p_move_arr.move.direction.dir_vector[1]=1

p_move_arr.move.direction.dir_vector[2]=0

for(int start_p=0;start_p<3;start_p++)
{
p_move_arr.move.direction.start_point[start_p]=0;
}

err=ProExpldstateMovesSet(&exp_hand,&p_move_arr);

------

But the component  dosent  move  in my creo3.0

is there any problems in my program?

Best answer by FV_01
edited, please check for spelling errors

 

/* //somewhere in calling function
{
ProAsmcomppath *cpath_arr = NULL;
ProArrayAlloc( 0, sizeof(ProAsmcomppath), 1, (ProArray*) &cpath_arr);
ProArrayObjectAdd( (ProArray*) &cpath_arr, PRO_VALUE_UNUSED, 1, (void*) &cpath1);
ProArrayObjectAdd( (ProArray*) &cpath_arr, PRO_VALUE_UNUSED, 1, (void*) &cpath2);
ProArrayObjectAdd( (ProArray*) &cpath_arr, PRO_VALUE_UNUSED, 1, (void*) &cpath3);
...

}
*/



ProError err = PRO_TK_GENERAL_ERROR;
ProVector trans_vecZ = {0.0, 0.0, 1.0};
ProVector trans_vecX = {1.0, 0.0, 0.0}; ProExpldAnimMoveData *moves_arr = NULL;
err=ProArrayAlloc(0, sizeof(ProExpldAnimMoveData), 1, (ProArray *)&moves_arr);
//repeat as needed
{
//all of it has to called AFTER moves_arr allocated
ProExpldAnimMoveData move_dataZ;
ProExpldAnimMoveData move_dataX;
err=ProExpldAnimDataTranslatemoveInit(trans_vecZ,cpath_arr, &move_dataZ);
err=ProArrayObjectAdd((ProArray*)&moves_arr,PRO_VALUE_UNUSED,1,(void*)&move_dataZ);
err=ProExpldAnimDataTranslatemoveInit(trans_vecX,cpath_arr, &move_dataX);
err=ProArrayObjectAdd((ProArray*)&moves_arr,PRO_VALUE_UNUSED,1,(void*)&move_dataX);

}

{
ProName expName = L"TEST";
ProExpldstate expl_state; err=ProExpldstateCreate((ProSolid)asm_mdl,expName,NULL,&expl_state); err=ProExpldstateMovesSet(&expl_state,moves_arr); err=ProExpldanimmovedataProarrayFree(moves_arr);
err=ProExpldstateActivate((ProSolid)asm_mdl,&expl_state);
}

err=ProAssemblyExplode((ProAssembly)asm_mdl); err=ProWindowRepaint(-1);



 


 

2 replies

timy1-VisitorAuthor
1-Visitor
July 22, 2018

Is there anyone can help me ~~

July 23, 2018

Hello,

p_move_arr in your code is used as struct. This is wrong. You should be using ProExpldAnimDataTranslatemoveInit and adding the initiated object to a ProArray of 'ExpldStateMoves'.

An explode state itself should be either created or initiated and after moves were set should be activated with ProExpldstateActivate(..) and finally ProAssemblyExplode(...)  should be called to display an exploded assembly.

FV. 

timy1-VisitorAuthor
1-Visitor
July 24, 2018

Hi @FV_01,

below are my code

---

ProName expName;
ProExpldstate exp_hand;
VecCopy(trans_vec,Vec_Carray_resonable[0].vec_resonable);        //assign vector to trans_vec


err=ProExpldAnimDataTranslatemoveInit(trans_vec,&asm_prt_data[i].comp_path,&move_data);

***the function will output "PRO_TK_BAD_INPUTS", if I dont give ProArray of compont.

(Here is a question, if i dont give a specific compnent, How do i know which component I could control? )


move_data.move.value=30;
ProStringToWstring(expName,"Demo");
err=ProExpldstateCreate((ProSolid)asm_mdl,expName,&move_data,&exp_hand);
err=ProExpldstateInit(expName,NULL,(ProSolid)asm_mdl,&exp_hand);
err=ProExpldstateActivate((ProSolid)asm_mdl,&exp_hand);
err=ProAssemblyExplode((ProAssembly)asm_mdl);

---

Could you please give me an example to demonstrate how to do it?

BTW

If I assigned &asm_prt_data->comp_path, The function will output PRO_TK_NO_ERROR, but the explode result still shows nothing.

FV_0117-PeridotAnswer
July 25, 2018
edited, please check for spelling errors

 

/* //somewhere in calling function
{
ProAsmcomppath *cpath_arr = NULL;
ProArrayAlloc( 0, sizeof(ProAsmcomppath), 1, (ProArray*) &cpath_arr);
ProArrayObjectAdd( (ProArray*) &cpath_arr, PRO_VALUE_UNUSED, 1, (void*) &cpath1);
ProArrayObjectAdd( (ProArray*) &cpath_arr, PRO_VALUE_UNUSED, 1, (void*) &cpath2);
ProArrayObjectAdd( (ProArray*) &cpath_arr, PRO_VALUE_UNUSED, 1, (void*) &cpath3);
...

}
*/



ProError err = PRO_TK_GENERAL_ERROR;
ProVector trans_vecZ = {0.0, 0.0, 1.0};
ProVector trans_vecX = {1.0, 0.0, 0.0}; ProExpldAnimMoveData *moves_arr = NULL;
err=ProArrayAlloc(0, sizeof(ProExpldAnimMoveData), 1, (ProArray *)&moves_arr);
//repeat as needed
{
//all of it has to called AFTER moves_arr allocated
ProExpldAnimMoveData move_dataZ;
ProExpldAnimMoveData move_dataX;
err=ProExpldAnimDataTranslatemoveInit(trans_vecZ,cpath_arr, &move_dataZ);
err=ProArrayObjectAdd((ProArray*)&moves_arr,PRO_VALUE_UNUSED,1,(void*)&move_dataZ);
err=ProExpldAnimDataTranslatemoveInit(trans_vecX,cpath_arr, &move_dataX);
err=ProArrayObjectAdd((ProArray*)&moves_arr,PRO_VALUE_UNUSED,1,(void*)&move_dataX);

}

{
ProName expName = L"TEST";
ProExpldstate expl_state; err=ProExpldstateCreate((ProSolid)asm_mdl,expName,NULL,&expl_state); err=ProExpldstateMovesSet(&expl_state,moves_arr); err=ProExpldanimmovedataProarrayFree(moves_arr);
err=ProExpldstateActivate((ProSolid)asm_mdl,&expl_state);
}

err=ProAssemblyExplode((ProAssembly)asm_mdl); err=ProWindowRepaint(-1);