Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi,
I use the following code to get the constraint of selected component in assembly
ProError status; ProSelection* sels; int n_sels = 1; ProFeature *feat; ProAsmcomppath path; ProAsmcomp *AsmComp; ProAsmcompconstraint *constr; status = ProSelect("part", n_sels, NULL, NULL, NULL, NULL, &sels, &n_sels); if(status != PRO_TK_NO_ERROR || n_sels == 0) return status; status = ProSelectionAsmcomppathGet(sels[0],&path); status = ProFeatureInit(path.owner,path.table_num,feat); status = ProAsmcompConstraintsGet((ProAsmcomp *)feat,&constr); return status;
but I get error PRO_TK_INVALID_TYPE (-18)
Kindly help me
Select a Feature or a component, check that you get the correct feature ID.
@RPN , I tried to retrieve the ID of selected component, its returning correct value. But I coudn't get constraints
@Manjunath wrote:
Hi,
I use the following code to get the constraint of selected component in assembly
ProError status; ProSelection* sels; int n_sels = 1; ProFeature *feat; ProAsmcomppath path; ProAsmcomp *AsmComp; ProAsmcompconstraint *constr; status = ProSelect("part", n_sels, NULL, NULL, NULL, NULL, &sels, &n_sels); if(status != PRO_TK_NO_ERROR || n_sels == 0) return status; status = ProSelectionAsmcomppathGet(sels[0],&path); status = ProFeatureInit(path.owner,path.table_num,feat); status = ProAsmcompConstraintsGet((ProAsmcomp *)feat,&constr); return status;but I get error PRO_TK_INVALID_TYPE (-18)
Kindly help me
ProFeatureInit(path.owner, path.table_num, feat) makes absolutely no sense... the second argument is wrong because instead of an id you are using a count... you also had declared 'feat' as a pointer to the ProFeature - which is also wrong because ProFeatureInit would need sizeof(ProFeature) for its output argument instead of sizeof(ProFeature*)...
Take a look at UgAsmcompConstraint.c in protoolkit installation directory.
ProSelectionModelitemGet is all you need if you have a selection object.
'path.comp_id_table...' and so on is what you'll need to pass to ProFeatureInit if that the route you want to go.