Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
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;
}
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.
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 🙂
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.