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

How to retreive model ID from its handle?

Highlighted
Newbie

How to retreive model ID from its handle?

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?

7 REPLIES 7

How to retreive model ID from its handle?

Rahul,



Try id of ProFeature.



Gary


RE: How to retreive model ID from its handle?

Gary,


How I will be able to initialize Profeature instance?



It would be helpful if you provide some example.

RE: How to retreive model ID from its handle?

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);
}
}

How to retreive model ID from its handle?

Hey, Rahul,



You may try to access the ComponentFeat from the assembly. Something

RE: How to retreive model ID from its handle?

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.

RE: How to retreive model ID from its handle?


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.


RE: How to retreive model ID from its handle?

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.

Announcements