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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How to retreive model ID from its handle?

ptc-3191571
1-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?


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
7 REPLIES 7

Rahul,



Try id of ProFeature.



Gary


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

Hey, Rahul,



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

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.

Top Tags