Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Pattern Modification

williaps

New member
All,


I am trying to modify a pattern value with the following code. I don't get any error messages but the feature is not redefined. Does anyone have any suggestions?


ProError visit_action(ProFeature *p_feature, ProError status, ProAppData app_data) {





char *szFuncName = "visit_action()",


szTemp[64];


wchar_t *wszTableName = NULL;


double dInstValue = 0;


int i = 0,


j = 0;


ProError pro_error = PRO_TK_NO_ERROR;


ProElement pro_elemTree,


pro_elem;


ProElempath pro_elemPath = NULL;


ProElempathItem pro_aElemPathItem[6];


ProErrorlist pro_errorList;


ProFeatureCreateOptions pro_featCreateOpts[1];


//Get a handle to the element tree


pro_error = ProPatternElemtreeCreate(p_feature, PRO_FEAT_PATTERN, &pro_elemTree);


PROUTIL_CALL_REPORT("ProPatternElemtreeCreate()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Allocate an element path


pro_error = ProElempathAlloc(&pro_elemPath);


PROUTIL_CALL_REPORT("ProElempathAlloc()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Create the path to the pattern table list


pro_aElemPathItem[0].type = PRO_ELEM_PATH_ITEM_TYPE_ID;


pro_aElemPathItem[0].path_item.elem_id = PRO_E_PAT_TABLE_LIST;


pro_aElemPathItem[1].type = PRO_ELEM_PATH_ITEM_TYPE_INDEX;


pro_aElemPathItem[1].path_item.elem_index = 0;


pro_aElemPathItem[2].type = PRO_ELEM_PATH_ITEM_TYPE_ID;


pro_aElemPathItem[2].path_item.elem_id = PRO_E_PAT_TABLE_INSTANCES;


pro_aElemPathItem[3].type = PRO_ELEM_PATH_ITEM_TYPE_INDEX;


pro_aElemPathItem[3].path_item.elem_index = 7;


pro_aElemPathItem[4].type = PRO_ELEM_PATH_ITEM_TYPE_ID;


pro_aElemPathItem[4].path_item.elem_id = PRO_E_PAT_TABLE_INSTANCE_DIMS;


pro_aElemPathItem[5].type = PRO_ELEM_PATH_ITEM_TYPE_ID;


pro_aElemPathItem[5].path_item.elem_id = PRO_E_PAT_TABLE_INSTANCE_DIM_VALUE;


//Set the data for the element path


pro_error = ProElempathDataSet(pro_elemPath, pro_aElemPathItem, 6);


PROUTIL_CALL_REPORT("ProElempathDataSet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Get the element


pro_error = ProElemtreeElementGet(pro_elemTree, pro_elemPath, &pro_elem);


PROUTIL_CALL_REPORT("ProElemtreeElementGet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Get the element value


pro_error = ProElementDoubleGet(pro_elem, NULL, &dInstValue);


PROUTIL_CALL_REPORT("ProElementDoubleGet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


printf("%f\n", dInstValue);


dInstValue = 1676.4;


//Set the element value


pro_error = ProElementDoubleSet(pro_elem, dInstValue);


PROUTIL_CALL_REPORT("ProElementDoubleSet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Free the element path


pro_error = ProElempathFree(&pro_elemPath);


PROUTIL_CALL_REPORT("ProElempathFree()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);





//Redefine the feature


pro_featCreateOpts[0] = PRO_FEAT_CR_NO_OPTS;


pro_error = ProFeatureRedefine(NULL, p_feature, pro_elemTree, pro_featCreateOpts, 1, &pro_errorList);


PROUTIL_CALL_REPORT("ProFeatureRedefine()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


return PRO_TK_NO_ERROR;


}








Patrick Williams


Application Engineer


Steelcase, Inc.
 

Sponsor

Articles From 3DCAD World

Back
Top