Skip to main content
1-Visitor
November 28, 2018
Question

Retrieve constraint of component by toolkit

  • November 28, 2018
  • 1 reply
  • 2579 views

Hi All,

 

Kindly suggest how to retrieve constraint of a component in assembly by toolkit

 

regards,

MS

1 reply

RPN
18-Opal
November 30, 2018

You should consider to start here:

 

ProAsmcompConstraintsGet (ProAsmcomp *component,ProAsmcompconstraint **pp_constraints );

 

Read ProAsmcomp.h

 

Have fun 🤔

Manjunath1-VisitorAuthor
1-Visitor
December 1, 2018

Hi RPN,

I used the following code 

	ProError err;
	ProMdl mdl;
	ProSelection* sel;
	int count;
	ProAsmcomp* cmp;
	ProAsmcompconstraint* constr;
	
	err = ProMdlCurrentGet(&mdl);
	err = ProSelect("membfeat",1,NULL,NULL,NULL,NULL,&sel,&count);
	err = ProSelectionModelitemGet(sel[0],(ProModelitem *)cmp);
	err = ProAsmcompConstraintsGet(cmp,&constr);
	return err;

but I could not retrieve the constraints

 

Regards,

Manjunath S

RPN
18-Opal
December 1, 2018

Sorry, I’m not at my desk, but As far I remember the selection option is invalid. Because  you will get a PRO_FEATURE and not a PRO_PART or PRO_ASSEMBLY

 

Input Arguments:

     component       - The assembly component

 

Component Feature membfeat PRO_FEATURE 
Assemble component model component PRO_PART, PRO_ASSEMBLY

 

Try this

 

err = ProSelect("component",1,NULL,NULL,NULL,NULL,&sel,&count);

Component and Feature ID are the same, you can also set the model item type to PRO_PART or PRO_ASSEMBLY manually in your code, after you have selected the feature, and extracted the model item. But this is the purpose of the „component“ option.