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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

casting ProFeature to ProAsmcomppath ?

CAD_Jimmy
11-Garnet

casting ProFeature to ProAsmcomppath ?

Hi,

 

I use ProSolidFeatVisit to get the assembly component, the output data type is <ProFeature>. (i put code below)

 

Now, I want to get the transformation matrix of two csys,

but , ProAsmcomppathTrfGet need the input <ProAsmcomppath> ,i don't know how to get it.

And is possible to change the ProFeature to ProAsmcomppath?

 

hope someone can help me.

thanks.

 

P.S. I don't have the memb_id_tab, so i can't use ProAsmcomppathInit .

 

the code that get all part 

ProError getAsmFeature( ProMdl asm_mdl,ProFeature** appdata)
{
ProError err;
err = ProArrayAlloc(0, sizeof(ProFeature), 1, (ProArray*)appdata);

err = ProSolidFeatVisit((ProSolid)asm_mdl,FeatureVisitActionFn,
FeatureFilterActionFn,(ProAppData)&appdata);
return err;
}

ProError FeatureVisitActionFn(ProFeature *feature,ProError err,ProAppData app_data)
{
ProMdl prtMdl;
ProMdlType p_type;
ProArray *pArray;
pArray=(ProArray*)((ProSurface **)app_data)[0];
err=ProAsmcompMdlGet(feature , &prtMdl);
err=ProMdlTypeGet(prtMdl,&p_type);

if (p_type == PRO_MDL_PART)
{
err=ProArrayObjectAdd(pArray,PRO_VALUE_UNUSED,1,feature);
}
else if (p_type == PRO_MDL_ASSEMBLY)
{
err = ProSolidFeatVisit((ProSolid)prtMdl, FeatureVisitActionFn, FeatureFilterActionFn, app_data);
}
if (feature != NULL) return(PRO_TK_NO_ERROR);
return(PRO_TK_CONTINUE);
}

ProError FeatureFilterActionFn(ProFeature *feature,ProAppData app_data)
{
ProFeattype FeatType;
ProFeatureTypeGet(feature,&FeatType);
if (FeatType==PRO_FEAT_COMPONENT) 
return PRO_TK_NO_ERROR;
else
return PRO_TK_CONTINUE;
}

 

 

3 REPLIES 3
RPN
17-Peridot
17-Peridot
(To:CAD_Jimmy)

You can't cast, would not make sense. If you have a select structure, extract the path from here and use

 

 tk_status = ProAsmcomppathTrfGet (
   &pathPtr,
   bottom_up,
   matrixPtr);

 

If not, you have to search it, and init a component path, this may fun if the component is assembled more then once.

neumann001040.png

In the sample assembly hierarchy, subassembly C is component identifier 9 within assembly A, Part B is component identifier 2 within assembly C, and so on. The subassembly AB occurs twice (contain same ID's). To refer to the two occurrences of part B, use the following int array:

9, 2 or/or 2, 3, 4, 5, 4

 

Good luck 🙂

 

 

 

Just a thought...!!

Are you trying to find t matrix for two different components of assembly?? If so, do use comppath visit (I can say exact API if you wish) instead of feature visit.

Thank you for the reply.

 

Finally, i use the function <ProSolidDispCompVisit> instead of < ProSolidFeatVisit >.

The visit function can get the part handle and the assembly component path.

So, i can also use <ProAsmcomppathTrfGet> to get the  transformation matrix of two csys.

 

 

Announcements


Top Tags