Skip to main content
1-Visitor
Jul 21, 2018 6:10 AM UTC
Solved

How to Use Creo ToolKit Function "ProExpldstateMovesSet()"

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?

FV_01
FV_01Answer
Jul 25, 2018 1:08 PM UTC
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);



 


 

8 replies

timy1-VisitorAuthor
1-Visitor
Jul 22, 2018 7:43 AM UTC

Is there anyone can help me ~~

Translate
FV_01
Jul 23, 2018 3:20 PM UTC

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. 

Translate
timy1-VisitorAuthor
1-Visitor
Jul 24, 2018 9:23 AM UTC

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.

Translate
FV_01
Jul 24, 2018 12:34 PM UTC
LIB_COREUTILS_API ProError ProExpldAnimDataTranslatemoveInit (ProVector trans_vec, 
 ProAsmcomppath *comp_set, 
 ProExpldAnimMoveData *p_move_data);
/*
 Purpose: Creats a translational move.

 Input Arguments:
 trans_vec - The direction of the translation. Cannot be NULL.
 comp_set - ProArray of components to which this move will be applied.
 cannot be NULL or empty.
 Output Arguments:
 p_move_data - The move. Cannot be NULL.

 Return Values:
 PRO_TK_NO_ERROR - The move is created successfully.
 PRO_TK_BAD_INPUTS - Some arguments are invalid.

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

 

look at the function definition above - the second argument (comp_set) is ProArray of ProAsmcomppath

 

You are also missing using function ProExpldstateMovesSet - how does your exploded state know what moves to use?

Also you are not adding the initiated move_data to moves array...

 

what you should be doing is:

-initiate ProArray of ProExpldAnimMovedata

- initiate ProArray of ProAsmcomppath

- build ProArray of ProAsmcomppath - components to be moved in exploded view

- initiate ProExpldAnimMovedata struct

- add this struct to ProArray of movedatas, repeat those two steps as necessary

- create exploded state with ProExpldstateCreate, use NULL for move_data argument

- add movedatas ProArray to the exploded state with ProExpldstateMovesSet

- release movedata ProArray with ProExpldanimmovedataProarrayFree

- activate exploded state with ProExpldstateActivate

- finally ProAssemblyExplode

 

Translate