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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Retrieve constraint of component by toolkit

Manjunath
13-Aquamarine

Retrieve constraint of component by toolkit

Hi All,

 

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

 

regards,

MS

5 REPLIES 5
RPN
17-Peridot
17-Peridot
(To:Manjunath)

You should consider to start here:

 

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

 

Read ProAsmcomp.h

 

Have fun 🤔

Manjunath
13-Aquamarine
(To:RPN)

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
17-Peridot
17-Peridot
(To:Manjunath)

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. 

Manjunath
13-Aquamarine
(To:RPN)

Hi, 

When i use option "component" I couldn't select a part from sub assembly.

Is there any other way to proceed with this

 

RPN
17-Peridot
17-Peridot
(To:Manjunath)

Ok, use prt_or_asm, this should work.
Announcements


Top Tags