Skip to main content
1-Visitor
April 29, 2011
Question

How to retreive model ID from its handle?

  • April 29, 2011
  • 7 replies
  • 1952 views

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

1-Visitor
April 29, 2011
Rahul,



Try id of ProFeature.



Gary


1-Visitor
April 29, 2011

Gary,


How I will be able to initialize Profeature instance?



It would be helpful if you provide some example.

1-Visitor
April 29, 2011

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

10-Marble
April 29, 2011
Hey, Rahul,



You may try to access the ComponentFeat from the assembly. Something
1-Visitor
June 2, 2011

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.

1-Visitor
June 3, 2011

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.


1-Visitor
June 15, 2011

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.