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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

C++ toolkit how to recognize predefined flexibility

jack15
9-Granite

C++ toolkit how to recognize predefined flexibility

I am working on creating an application to insert parts into an assembly. I want to be able to recognize that a model being has predefined flexibility. When operating Creo manually if you insert a model with predefined flexibility Creo will tell you that and ask if you want to use it. However there does not seem to be an equivalent function in the C++ toolkit.

What I have been trying to use is the method wfcWModel::isVariantFeatModel(), however this always returns false. I have tried using pfcSession::RetrieveModel() and pfcSession::GetModelFromFilename() to retrieve the model before checking it, but both yield the same result.

I am hoping that someone may have some insight to make this work.

I will also note that the method wfcWComponentFeat::IsFlexible() exists but this will only recognize components that already have flexibility 'turned on'

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RPN
17-Peridot
17-Peridot
(To:jack15)

I did not tested my guess 😉


But after you have assembled the model with


extern ProError
ProAsmcompAssemble (

ProAssembly owner_assembly,

ProSolid component_model,
ProMatrix init_pos,
ProAsmcomp *feature );

You have it in your assembly, now use 

 

extern ProError ProAsmcompFlexibleWithPredefineditemsSet (ProAsmcomp *comp);
/*
Purpose: convert the specified component to flexible one using the predefined
flexibility varied items defined on its component model.

Input Arguments:
comp - The component to be converted to flexible one

Output Arguments:
None

Return Values:
PRO_TK_NO_ERROR - The function succeeded
PRO_TK_BAD_INPUTS - The input argument is invalid.

 

Based on the status you may know if you have assembled a flexible component. You can still convert the model to be not flexible.

I think you have first to assemble, and before you apply constraints, check for a flexible component. There are other functions for flexible components, but I think you need to deal with the return status.

 

Nice riddle😉

 

View solution in original post

4 REPLIES 4

I don't know how to check not assembled model. But you can use a function at assembled component

wfcWComponentFeat::CreatePredefinedFlexibilityComponent

If the model has predefined flexibility, then this function return no error.

Hey this one doesn't work without already knowing the AsmItems. This function will also return no error even if the component does not have predefined flexibility as long as the items passed in with AsmItems are valid parameters/dimensions.

My goal is to be able to recognize a flexible component and get the varied items before it is fully inserted, like how it works when a flexible part is added to an assembly in Creo manually.

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

I did not tested my guess 😉


But after you have assembled the model with


extern ProError
ProAsmcompAssemble (

ProAssembly owner_assembly,

ProSolid component_model,
ProMatrix init_pos,
ProAsmcomp *feature );

You have it in your assembly, now use 

 

extern ProError ProAsmcompFlexibleWithPredefineditemsSet (ProAsmcomp *comp);
/*
Purpose: convert the specified component to flexible one using the predefined
flexibility varied items defined on its component model.

Input Arguments:
comp - The component to be converted to flexible one

Output Arguments:
None

Return Values:
PRO_TK_NO_ERROR - The function succeeded
PRO_TK_BAD_INPUTS - The input argument is invalid.

 

Based on the status you may know if you have assembled a flexible component. You can still convert the model to be not flexible.

I think you have first to assemble, and before you apply constraints, check for a flexible component. There are other functions for flexible components, but I think you need to deal with the return status.

 

Nice riddle😉

 

jack15
9-Granite
(To:RPN)

Thank you RPN! 

This method was exactly what I needed 🙂 

extern ProError ProAsmcompFlexibleWithPredefineditemsSet (ProAsmcomp *comp);

Top Tags