Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
I am working on a assembly which has some components.My intention is to retreive ID of each of the components ,I knew model name so I initialized its hanlde using -ProMdlInit() , I used this model handle in ProMdlIdGet() which I supposed will give me identifier of the model.It returns some arbitrary number as 524288 , but when I checked in model info its inernal ID is 39.
I am working on WF 5.0 M060
So is there any way to retreive internal model ID?
Gary,
How I will be able to initialize Profeature instance?
It would be helpful if you provide some example.
Try below code...
ProSolidFeatstatusGet((ProSolid)xAssembly, &lFeatureIds, &lFeatureStatus, &lFeatureCount)
for (lIndex = 0; lIndex < lFeatureCount; lIndex++)
{
if (ProFeatureInit((ProSolid)xAssembly, lFeatureIds[lIndex], &lFeature) != PRO_TK_NO_ERROR)
continue;
ProFeatureTypeGet(&lFeature, &lFeattype);
if (lFeattype == PRO_FEAT_COMPONENT)
{
ProAsmcompMdlGet((ProAsmcomp*)&lFeature, &lFeatureMdl);
ProMdlIdGet(lFeatureMdl, &lMdlId);
}
}
status = ProAsmcompconstraintAsmreferenceGet (constr_array [i], &asm_constr, &dtmside);
ProSelectionModelitemGet(asm_constr,&p_mdl_item);
ProModelitemMdlGet(&p_mdl_item,&p_owner);//successfully retrieve handle
ProMdlDataGet(p_owner,&p_data);
asse_obj_name.Format(_T("%s"),p_data.name);//retrieve name
ProMdlIdGet(p_owner,&p_id);
I want to retrive the name of assembly reference object. Ihave alreadyretrieved model handle,model name.But,when I try to retrieve its ID by ProMdlIdGet(p_owner,&p_id).ProE shuts down!Thank you.
status = ProAsmcompconstraintAsmreferenceGet (constr_array [i], &asm_constr, &dtmside);
ProSelectionModelitemGet(asm_constr,&p_mdl_item);
ProModelitemMdlGet(&p_mdl_item,&p_owner);//successfully retrieve handle
ProMdlDataGet(p_owner,&p_data);
asse_obj_name.Format(_T("%s"),p_data.name);//retrieve name
ProMdlIdGet(p_owner,&p_id);
I want to retrive the name of assembly reference object. Ihave alreadyretrieved model handle,model name.But,when I try to retrieve its ID by ProMdlIdGet(p_owner,&p_id).ProE shuts down!Thank you.
Check ProError value for ModelIDGet() , you will get some idea as to what is happening.
Also proe shuts down in cases of illegal conversion and memory issues.