Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hello,
I am trying to attch a material to a Creo part usingProMaterialfileRead() ,ProMaterialCurrentSet(), ProMaterialCurrentSet().
Altough the material gets added to part's database its not getting assigned to the part.
Does anyone know any API/function which can do the same ??
Regards,
Shreeshail
Hi,
I use the same function to do what you want to do.
ProMaterial p_material, o_material;
ProError ret = PRO_TK_NO_ERROR;
// LOAD YOUR MATERIAL SOMEWHERE HERE : )
p_material.part = (ProSolid)mdl;
wcscpy_s(p_material.matl_name, PRO_NAME_SIZE, materialname);
ProMaterialCurrentGet((ProSolid)mdl, &o_material);
if (_wcsicmp(o_material.matl_name, p_material.matl_name) != 0) {
//change material because it's a new one
ret = ProMaterialCurrentSet(&p_material);
if (ret != PRO_TK_NO_ERROR) {
writeRunnerLogLangDep(MAT_AM_CANT_SET_MATERIAL_AS_CURRENT, 2);
} else {
writeRunnerLogLangDep_d(MAT_AM_MATERIAL_IS_SET_AS_CURRENT, 0, 1);
setCost(1);
}
}
At my side this works since WF 4.0 till Creo 2.0
Best regards,
Eike