/* Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved. */ #ifndef PTTEST_DEBUG #line 3 "PTMfgProcTable.c" #endif /*--------------------------------------------------------------------*\ Pro/TOOLKIT includes \*--------------------------------------------------------------------*/ #include <ProToolkit.h> #include <ProMdl.h> #include <ProParameter.h> #include <ProUIDialog.h> #include <ProUtil.h> #include <ProUITree.h> #include <ProSolid.h> #include <ProUI.h> #include <ProUIPushbutton.h> #include <ProUISpinbox.h> #include <ProUISlider.h> #include <ProUIInputpanel.h> #include <ProArray.h> #include <ProUtil.h> #include <ProMfg.h> #include <ProElement.h> #include <ProMfgproctable.h> #include <ProMaterial.h> #include <ProFeature.h> #include <ProAsmcomp.h> #include <ProFeatType.h> #include <ProWstring.h> #include <ProUILabel.h> #include <stdlib.h> #include <ProTKRunTime.h> /*--------------------------------------------------------------------*\ Pro/DEVELOP includes \*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*\ C System includes \*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*\ Application includes \*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*\ Function Prototypes \*--------------------------------------------------------------------*/ #define DIALOG_NAME "Mfg-ProcItem-Dialog" #define UPDATE "Update" #define CANCEL "Cancel" /*--------------------------------------------------------------------*\ Global Variables used \*--------------------------------------------------------------------*/ static ProError status; static ProName tool_id,material_name; static int count; static double cut_feed,spindle_speed; static int FLAG; static ProMfgprocItem *sel_items; static ProElement complete_tree; static ProElement p_element; static double hole_dep_1; static double hole_dep_2; static ProBoolean found = PRO_B_FALSE; #define PT_TEST_LOG(func,status,err) \ if (err) \ { \ ProTKPrintf (" LOG Error: %s\t%d\n", func, status); \ } \ else \ ProTKPrintf (" LOG %s\t%d\n", func, status); #define PT_TEST_LOG_SUCC(func) \ PT_TEST_LOG (func, status, status != PRO_TK_NO_ERROR) void PTMfgUsrUpdateAction(char *dialog, char *component, ProAppData data); void PTMfgUsrCancelAction(char *dialog, char *component, ProAppData data); static ProError PTMfgMaterialGet (ProFeature* feat, ProAppData data); static ProError PTMfgHoledepth (ProFeature* feat, ProAppData data); static ProError PTMfgProcitemElemtreeGet(ProElement *elem_tree); static ProError PTMfgProctableItemActionHoleSet (ProMfg mfg, char* button_name, ProAppData appdata); static ProError PTMfgProctableItemActionPreReq (ProMfg mfg, char* button_name, ProAppData appdata); static ProError PTMfgProctableItemFeedSpeed (ProMfg mfg, char* button_name, ProAppData appdata); static ProError PTMfgProctableItemStepCreate (ProMfg mfg, char* button_name, ProAppData appdata); static ProError PTMfgDialogCreate(ProElement elem_tree); static ProError PTMfgParameterVisit(ProParameter* param, ProError status, ProAppData data); static ProError PTMfgElemtreeWalkthroughAction ( ProElement elem_tree, ProElement element, ProElempath elem_path, ProAppData app_data ); static ProError PTMfgElemtreePreReqAction ( ProElement elem_tree, ProElement element, ProElempath elem_path, ProAppData app_data ); static ProError PTTestMfgProcItemVisit ( ProMfgprocItem* item, ProError error, ProAppData app_data); static ProError PTMfgProcitemToolNameGet(ProElement element); typedef struct input_data { double cut_feed; double spindle_speed; } Data_Input; void PTUtilInitCounters(void) { count =0; cut_feed =0.0; spindle_speed=0.0; FLAG =0; ProStringToWstring(tool_id," "); ProStringToWstring(material_name," "); } /*====================================================================*\ FUNCTION : user_initialize() PURPOSE : \*====================================================================*/ int user_initialize( int argc, char *argv[], char *version, char *build, wchar_t errbuf[80]) { uiCmdCmdId cmd_id; PTUtilInitCounters(); status = ProMfgproctableMenuAdd ( "APISubMenu", L"Advanced", "Tools" ); PT_TEST_LOG_SUCC("ProMfgproctableMenuAdd") status = ProMfgproctablePushbuttonAdd ("APISubMenu","Adjust Drill", L"Adjust Drill", L"button_helptext",NULL, PTMfgProctableItemActionHoleSet, "Callback on the new submenu added in existing menu"); PT_TEST_LOG_SUCC("ProMfgproctablePushbuttonAdd"); status = ProMfgproctablePushbuttonAdd ("APISubMenu","Highlight Prereq", L"Highlight Prereq", L"button_helptext",NULL, PTMfgProctableItemActionPreReq, "Callback on the new submenu added in existing menu"); PT_TEST_LOG_SUCC("ProMfgproctablePushbuttonAdd"); status = ProMfgproctablePushbuttonAdd ("APISubMenu","Update Feed & Speed", L"Update Feed & Speed", L"button_helptext",NULL, PTMfgProctableItemFeedSpeed, "Callback on the new submenu added in existing menu"); PT_TEST_LOG_SUCC("ProMfgproctablePushbuttonAdd"); status = ProMfgproctablePushbuttonAdd ("APISubMenu","Fixture Part", L"Fixture Part", L"button_helptext",NULL, PTMfgProctableItemStepCreate, "Callback on the new submenu added in existing menu"); PT_TEST_LOG_SUCC("ProMfgproctablePushbuttonAdd"); return (PRO_TK_NO_ERROR); } /*====================================================================*\ FUNCTION : PTMfgProctableItemActionHoleSet PURPOSE : Execute HoleSet \*====================================================================*/ ProError PTMfgProctableItemActionHoleSet (ProMfg mfg, char* button_name, ProAppData appdata) { ProMdl mfg_mdl_under_test; status =ProMdlCurrentGet(&mfg_mdl_under_test); PT_TEST_LOG_SUCC("ProMdlCurrentGet"); status = ProMfgProctableVisit (mfg_mdl_under_test, PRO_MFGPROCTABLE_PROCESS, (ProMfgprocitemVisitAction) PTTestMfgProcItemVisit, NULL, NULL); PT_TEST_LOG_SUCC( "ProMfgProctableVisit"); return PRO_TK_NO_ERROR; } /*====================================================================*\ FUNCTION : PTMfgProctableItemActionPreReq PURPOSE : Execute Highlighting of Pre-Requisite steps \*====================================================================*/ ProError PTMfgProctableItemActionPreReq (ProMfg mfg, char* button_name, ProAppData appdata) { ProElement elem_tree; status = PTMfgProcitemElemtreeGet(&elem_tree); PT_TEST_LOG_SUCC("PTMfgProcitemElemtreeGet"); if ( status == PRO_TK_NO_ERROR) { status = ProElemtreeWrite (elem_tree, PRO_ELEMTREE_XML, L"selecteditem_prereq.inf"); PT_TEST_LOG_SUCC (" ProElemtreeWrite "); if ( status == PRO_TK_NO_ERROR ) { status = ProElemtreeElementVisit( elem_tree, ( ProElempath )NULL , ( ProElemtreeVisitFilter) NULL, ( ProElemtreeVisitAction) PTMfgElemtreePreReqAction, NULL ); PT_TEST_LOG_SUCC (" ProElemtreeElementVisit "); } } return PRO_TK_NO_ERROR; } /*====================================================================*\ FUNCTION : PTMfgProctableItemFeedSpeed() PURPOSE : Execute Feed/Speed \*====================================================================*/ ProError PTMfgProctableItemFeedSpeed (ProMfg mfg, char* button_name, ProAppData appdata) { ProAssembly r_solid_obj; ProMdl mfg_mdl_under_test; ProElempath epath; ProElement params_element; ProElempathItem p_items[3]; ProElemId elem_id; ProValueDataType value_type = -1; ProValue value = (ProValue)NULL; ProValueData value_data; status =ProMdlCurrentGet(&mfg_mdl_under_test); PT_TEST_LOG_SUCC("ProMdlCurrentGet"); status = PTMfgProcitemElemtreeGet(&complete_tree); PT_TEST_LOG_SUCC("PTMfgProcitemElemtreeGet"); if (status == PRO_TK_NO_ERROR) PTMfgProcitemToolNameGet(complete_tree); if (status == PRO_TK_NO_ERROR) { status = ProElempathAlloc(&epath); PT_TEST_LOG_SUCC ("ProElempathAlloc ()"); p_items[0].type = PRO_ELEM_PATH_ITEM_TYPE_ID; p_items[0].path_item.elem_id = PRO_E_MFG_PARAMS ; status = ProElempathDataSet(epath, p_items, 1); PT_TEST_LOG_SUCC ("ProElempathDataSet()"); status= ProElemtreeElementGet(complete_tree, epath, ¶ms_element); PT_TEST_LOG_SUCC ("ProElemtreeElementGet()"); if ( status == PRO_TK_NO_ERROR ) { status = ProElemtreeElementVisit( params_element,NULL, ( ProElemtreeVisitFilter) NULL, ( ProElemtreeVisitAction) PTMfgElemtreeWalkthroughAction, NULL ); PT_TEST_LOG_SUCC (" ProElemtreeElementVisit "); } ProElempathFree(&epath); } status = ProMfgAssemGet(mfg_mdl_under_test,&r_solid_obj); PT_TEST_LOG_SUCC ("ProMfgAssemGet"); status = ProSolidFeatVisit ((ProSolid)r_solid_obj, (ProFeatureVisitAction)PTMfgMaterialGet, NULL, NULL); PT_TEST_LOG_SUCC ("ProSolidFeatureVisit()"); status = PTMfgDialogCreate(params_element); PTUtilInitCounters(); return PRO_TK_NO_ERROR; } /*====================================================================*\ FUNCTION : PTMfgProctableItemStepCreate() PURPOSE : Execute Customized step creation \*====================================================================*/ ProError PTMfgProctableItemStepCreate (ProMfg mfg, char* button_name, ProAppData appdata) { return PRO_TK_NO_ERROR; } /**********************************ACTION FUNCTIONS*************************/ /*--------------------------------------------------------*\ FUNCTION : PTMfgElemtreeWalkthroughAction() PURPOSE : Action function for PTUtilElemtreeWalkthroug \*--------------------------------------------------------*/ ProError PTMfgElemtreeWalkthroughAction ( ProElement params_element, ProElement element, ProElempath elem_path, ProAppData app_data ) { ProElempathItem p_items[3]; ProValueDataType value_type = -1; ProElemId elem_id,p_elem_id; char * actual_value; ProValue value = (ProValue)NULL; ProValueData value_data; Data_Input *my_data; ProElempath epath; my_data = (Data_Input*) app_data; status = ProElementIdGet( element, &elem_id); PT_TEST_LOG_SUCC("ProElementIdGet"); if ( elem_id == PRO_E_MFG_PARAM_NAME ) { status = ProElementValuetypeGet ( element, &value_type ); PT_TEST_LOG(" ProElementValuetypeGet ", status, status != PRO_TK_NO_ERROR && status != PRO_TK_INVALID_TYPE && status != PRO_TK_EMPTY ); if(value_type ==PRO_VALUE_TYPE_STRING) { status = ProElementStringGet( element,( ProElementStringOptions) NULL, &actual_value); PT_TEST_LOG_SUCC (" ProElementStringGet "); if ( (strcmp ( "CUT_FEED",actual_value) == 0) ||( strcmp ( "SPINDLE_SPEED",actual_value) == 0)) { status = ProElempathAlloc(&epath); PT_TEST_LOG_SUCC ("ProElempathAlloc ()"); p_items[0].type = PRO_ELEM_PATH_ITEM_TYPE_INDEX; p_items[0].path_item.elem_index = count; p_items[1].type = PRO_ELEM_PATH_ITEM_TYPE_ID; p_items[1].path_item.elem_id = PRO_E_MFG_PARAMVAL; status = ProElempathDataSet(epath, p_items, 2); PT_TEST_LOG_SUCC ("ProElempathDataSet()"); status= ProElemtreeElementGet(params_element, epath, &p_element); PT_TEST_LOG_SUCC ("ProElemtreeElementGet()"); status = ProElementIdGet( p_element, &p_elem_id); PT_TEST_LOG_SUCC (" ProElementIdGet "); if (p_elem_id ==PRO_E_MFG_PARAMVAL) { status = ProElementValueGet ( p_element, &value); PT_TEST_LOG_SUCC("ProElementValueGet"); status = ProValueDataGet (value, &value_data); PT_TEST_LOG("ProValueDataGet()", status, (status != PRO_TK_NO_ERROR)); if (strcmp ( "CUT_FEED",actual_value) == 0) { cut_feed = value_data.v.d; if (FLAG == 1) { value_data.v.d = my_data->cut_feed; status = ProValueDataSet (value, &value_data); PT_TEST_LOG("ProValueDataSet()", status, (status != PRO_TK_NO_ERROR)); status = ProElementValueSet ( p_element, value); PT_TEST_LOG_SUCC("ProElementValueGet"); } } if (strcmp ( "SPINDLE_SPEED",actual_value) == 0) { spindle_speed = value_data.v.d; if (FLAG == 1) { value_data.v.d = my_data->spindle_speed; status = ProValueDataSet (value, &value_data); PT_TEST_LOG("ProValueDataSet()", status, (status != PRO_TK_NO_ERROR)); status = ProElementValueSet (p_element, value); PT_TEST_LOG_SUCC("ProElementValueGet"); } } count++; } ProElempathFree(&epath); } } status = ProMfgproctableDisplayUpdate (); PT_TEST_LOG_SUCC ("ProMfgproctableDisplayUpdate"); } return PRO_TK_NO_ERROR; } /*--------------------------------------------------------*\ FUNCTION : PTMfgUsrUpdateAction PURPOSE : Action function for the File Selection \*--------------------------------------------------------*/ void PTMfgUsrUpdateAction(char *dialog, char *component, ProAppData data) { ProElement params_element; ProCharName str; ProCharName str2; double cut_feed_value; double spindle_speed_value; Data_Input data1; wchar_t* wstr; wchar_t* wstr2; ProErrorlist p_errors; params_element = (ProElement) data; ProUIInputpanelValueGet(DIALOG_NAME,"cut_feed",&wstr); ProWstringToString(str, wstr); cut_feed_value= atof(str); ProUIInputpanelValueGet(DIALOG_NAME,"spindle_speed",&wstr2); ProWstringToString(str2, wstr2); spindle_speed_value= atof(str2); data1.cut_feed = cut_feed_value; data1.spindle_speed = spindle_speed_value; count =0; FLAG =1; status = ProElemtreeWrite (params_element, PRO_ELEMTREE_XML, L"before_redef.inf"); PT_TEST_LOG_SUCC (" ProElemtreeWrite "); status = ProElemtreeElementVisit( params_element, ( ProElempath )NULL , ( ProElemtreeVisitFilter) NULL, ( ProElemtreeVisitAction) PTMfgElemtreeWalkthroughAction, (ProAppData)&data1 ); PT_TEST_LOG_SUCC (" ProElemtreeElementVisit "); status = ProMfgprocitemRedefine (sel_items,complete_tree,&p_errors); PT_TEST_LOG_SUCC ("ProMfgprocitemRedefine"); status = ProMfgproctableDisplayUpdate (); PT_TEST_LOG_SUCC ("ProMfgproctableDisplayUpdate"); PTUtilInitCounters(); status = ProUIDialogExit(DIALOG_NAME, 0); PT_TEST_LOG_SUCC("ProUIDialogExit"); } /*--------------------------------------------------------*\ FUNCTION : PTMfgUsrCancelAction PURPOSE : Action function for the Directory Selection \*--------------------------------------------------------*/ void PTMfgUsrCancelAction(char *dialog, char *component, ProAppData data) { ProError status; PTUtilInitCounters(); status = ProUIDialogExit(DIALOG_NAME, 0); PT_TEST_LOG_SUCC("ProUIDialogExit"); } /*--------------------------------------------------------*\ FUNCTION : PTMfgElemtreePreReqAction() PURPOSE : Get the material \*--------------------------------------------------------*/ ProError PTMfgMaterialGet (ProFeature* feat, ProAppData data) { ProAsmcompType f_type; ProMaterial p_material; ProFeattype feat_type; ProSolid part; ProMdl p_mdl_handle; ProCharName c_name; ProMdl mfg_mdl_under_test; status =ProMdlCurrentGet(&mfg_mdl_under_test); PT_TEST_LOG_SUCC("ProMdlCurrentGet"); status = ProFeatureTypeGet(feat,&feat_type); PT_TEST_LOG_SUCC("ProFeatureTypeGet"); if(feat_type==PRO_FEAT_COMPONENT) { status = ProAsmcompTypeGet ((ProAsmcomp*)feat,feat->owner, &f_type); PT_TEST_LOG_SUCC("ProAsmcompTypeGet"); if ( f_type == PRO_ASM_COMP_TYPE_REF_MODEL) { status = ProAsmcompMdlGet ((ProAsmcomp*)feat,&p_mdl_handle); PT_TEST_LOG_SUCC("ProAsmcompMdlGet"); status = ProMaterialCurrentGet ((ProSolid)p_mdl_handle,&p_material); PT_TEST_LOG_SUCC("ProMaterialCurrentGet"); ProWstringToString (c_name, p_material.matl_name); ProWstringCopy(p_material.matl_name,material_name,PRO_VALUE_UNUSED); } } return PRO_TK_NO_ERROR; } /*--------------------------------------------------------*\ FUNCTION : PTMfgElemtreePreReqAction() PURPOSE : Action function for PTUtilElemtreeWalkthroug \*--------------------------------------------------------*/ ProError PTMfgElemtreePreReqAction ( ProElement elem_tree, ProElement element, ProElempath elem_path, ProAppData app_data ) { ProElemId elem_id; ProMfgprocItem *item_p_arr=NULL; ProAssembly r_solid_obj; int mfg_prereq_arr_count = 0; ProMdl mfg_mdl_under_test; status =ProMdlCurrentGet(&mfg_mdl_under_test); PT_TEST_LOG_SUCC("ProMdlCurrentGet"); status = ProMfgAssemGet(mfg_mdl_under_test,&r_solid_obj); PT_TEST_LOG_SUCC ("ProMfgAssemGet"); status = ProElementIdGet( element, &elem_id); PT_TEST_LOG_SUCC("ProElementIdGet"); if (elem_id == PRO_E_MFG_PREREQUISITE_ARR) { status = ProElementArrayCount(elem_tree,elem_path,&mfg_prereq_arr_count); PT_TEST_LOG_SUCC("ProElementArrayCount"); { ProElempath p_elem_path; ProElempathItem elempath_data_arr[]={ {PRO_ELEM_PATH_ITEM_TYPE_INDEX,0}, {PRO_ELEM_PATH_ITEM_TYPE_ID ,PRO_E_MFG_PREREQUISITE_ID} }; int ii=0; ProElement pre_req_elems; int pre_req_value; status = ProArrayAlloc((mfg_prereq_arr_count), sizeof(ProMfgprocItem),(mfg_prereq_arr_count), (ProArray *)&item_p_arr ); PT_TEST_LOG_SUCC("ProArrayAlloc()"); for(ii=0;ii<mfg_prereq_arr_count;ii++) { status = ProElempathAlloc(&p_elem_path); PT_TEST_LOG_SUCC("ProElempathAlloc"); elempath_data_arr[0].path_item.elem_index=ii; status = ProElempathDataSet(p_elem_path,elempath_data_arr,2); PT_TEST_LOG_SUCC("ProElempathDataSet"); status = ProElemtreeElementGet(element,p_elem_path,&pre_req_elems); PT_TEST_LOG_SUCC("ProElemtreeElementGet"); status = ProElementIntegerGet(pre_req_elems,NULL, &pre_req_value); PT_TEST_LOG_SUCC("ProElementIntegerGet"); item_p_arr[ii].type = PRO_NC_STEP_OBJECT; item_p_arr[ii].id = pre_req_value; item_p_arr[ii].owner = r_solid_obj; } status = ProMfgproctableSelecteditemsSet (PRO_MFGPROCTABLE_PROCESS,item_p_arr); PT_TEST_LOG_SUCC ("ProMfgproctableSelecteditemsSet"); status = ProMfgproctableDisplayUpdate (); PT_TEST_LOG_SUCC ("ProMfgproctableDisplayUpdate"); status = ProArrayFree ( (ProArray *)&item_p_arr ); PT_TEST_LOG_SUCC ("ProArrayFree"); } } return PRO_TK_NO_ERROR; } /*--------------------------------------------------------*\ FUNCTION : PTMfgDialogCreate PURPOSE : Creates the dialog \*--------------------------------------------------------*/ ProError PTMfgDialogCreate(ProElement params_element) { int choice; ProCharName str; ProName wstr; status = ProUIDialogCreate(DIALOG_NAME,DIALOG_NAME); PT_TEST_LOG_SUCC("ProUIPTMfgDialogCreate"); status = ProUIDialogWidthSet(DIALOG_NAME,300); PT_TEST_LOG_SUCC("ProUIPTMfgDialogCreate"); status = ProUIDialogHeightSet(DIALOG_NAME,160); PT_TEST_LOG_SUCC("ProUIPTMfgDialogCreate"); #if 0 /* Set with the .res file */ status = ProUIDialogTitleSet (DIALOG_NAME,L"Feed/Speed database access"); PT_TEST_LOG_SUCC ("ProUIDialogTitleSet()"); #endif status = ProUILabelTextSet (DIALOG_NAME, "tool_id_val", tool_id); PT_TEST_LOG_SUCC ("ProUILabelTextSet()"); status = ProUILabelTextSet (DIALOG_NAME, "material_val", material_name); PT_TEST_LOG_SUCC ("ProUILabelTextSet()"); ProTKSprintf(str,"%f",cut_feed); ProStringToWstring(wstr, str); ProUIInputpanelValueSet(DIALOG_NAME,"cut_feed",wstr); PT_TEST_LOG_SUCC("ProUIInputpanelValueSet"); ProTKSprintf(str,"%f",spindle_speed); ProStringToWstring(wstr, str); ProUIInputpanelValueSet(DIALOG_NAME,"spindle_speed",wstr); PT_TEST_LOG_SUCC("ProUIInputpanelValueSet"); status = ProUIPushbuttonActivateActionSet(DIALOG_NAME, UPDATE, PTMfgUsrUpdateAction, params_element); PT_TEST_LOG_SUCC("ProUIPushbuttonActivateActionSet"); status = ProUIPushbuttonActivateActionSet(DIALOG_NAME, CANCEL, PTMfgUsrCancelAction, NULL); PT_TEST_LOG_SUCC("ProUIPushbuttonActivateActionSet"); status = ProUIDialogActivate(DIALOG_NAME, &choice); PT_TEST_LOG_SUCC("ProUIDialogActivate"); status = ProUIDialogDestroy(DIALOG_NAME); PT_TEST_LOG_SUCC("ProUIDialogDestroy"); return status; } /*--------------------------------------------------------*\ FUNCTION : PTMfgProcitemElemtreeGet PURPOSE : Gets the elem tree of selected item \*--------------------------------------------------------*/ ProError PTMfgProcitemElemtreeGet(ProElement *elem_tree) { status = ProMfgproctableSelecteditemsGet (PRO_MFGPROCTABLE_PROCESS,&sel_items); PT_TEST_LOG_SUCC ("ProMfgproctableSelecteditemsGet"); /*TBD : Currently one one ( fitst item is checked here... To be updated with multiple selections of items in ui ..*/ status = ProMfgprocitemElemtreeGet (&sel_items[0], elem_tree); PT_TEST_LOG_SUCC("ProMfgprocitsmElemtreeGet"); return status; } /*--------------------------------------------------------*\ FUNCTION : PTTestMfgProcItemVisit PURPOSE : Action function for ProMfgProctableVisit \*--------------------------------------------------------*/ ProError PTTestMfgProcItemVisit ( ProMfgprocItem* item, ProError error, ProAppData app_data) { ProAnnotation annotation; ProMfgstepHolesetEndType end_type; ProDrillDepthType depth_type; status = ProMfgprocitemAnnotationGet (item, &annotation); PT_TEST_LOG_SUCC ("ProMfgprocitemAnnotationGet"); if ( status == PRO_TK_NO_ERROR) { status = ProParameterVisit (&annotation,NULL,PTMfgParameterVisit,"HOLE_ADJUST"); PT_TEST_LOG_SUCC("ProParameterVisit"); } if ( found == PRO_B_TRUE) { status = ProParameterVisit (&annotation,NULL,PTMfgParameterVisit,"HOLE_DEP_1"); PT_TEST_LOG_SUCC("ProParameterVisit"); status = ProParameterVisit (&annotation,NULL,PTMfgParameterVisit,"HOLE_DEP_2"); PT_TEST_LOG_SUCC("ProParameterVisit"); } status = ProMfgprocitemHolesetdepthtypeGet (item,&depth_type,&end_type); PT_TEST_LOG_SUCC("ProMfgprocitemHolesetdepthtypeGet"); if ((end_type == PRO_MFGSTEP_HOLESETEND_ALONG_AXIS) && (depth_type ==PRO_DRILL_BLIND)) { status = ProMfgprocitemHolesetdepthSet (item ,hole_dep_1); PT_TEST_LOG_SUCC ("ProMfgprocitemHolesetdepthSet"); } if (end_type ==PRO_MFGSTEP_HOLESETEND_REFERENCE) { status = ProMfgprocitemHolesetdepthSet (item ,hole_dep_2); PT_TEST_LOG_SUCC ("ProMfgprocitemHolesetdepthSet"); } return PRO_TK_NO_ERROR; } /*--------------------------------------------------------*\ FUNCTION : PTMfgParameterVisit PURPOSE : Visit the param. \*--------------------------------------------------------*/ ProError PTMfgParameterVisit(ProParameter* param, ProError status, ProAppData data) { ProCharName str; ProParamvalue value; ProParamvalueType type; short l_val; ProWstringToString(str,param->id); if ( strcmp (str, data) == 0) { status = ProParameterValueWithUnitsGet(param, &value, NULL); PT_TEST_LOG_SUCC ("ProParameterValueWithUnitsGet()"); status = ProParamvalueTypeGet (&value, &type); PT_TEST_LOG_SUCC ("ProParamvalueTypeGet()"); if (type == PRO_PARAM_BOOLEAN) { status = ProParamvalueValueGet (&value, type, (void *) &l_val); PT_TEST_LOG_SUCC ("ProParamvalueValueGet()"); if (l_val == 1) found = PRO_B_TRUE; } if (type == PRO_PARAM_DOUBLE) { if ( strcmp (str,"HOLE_DEP_1") == 0) { status = ProParamvalueValueGet (&value, type, (void *) &hole_dep_1); PT_TEST_LOG_SUCC ("ProParamvalueValueGet()"); } if ( strcmp (str,"HOLE_DEP_2") == 0) { status = ProParamvalueValueGet (&value, type, (void *) &hole_dep_2); PT_TEST_LOG_SUCC ("ProParamvalueValueGet()"); } } } return PRO_TK_NO_ERROR; } /*--------------------------------------------------------*\ FUNCTION : PTMfgProcitemToolNameGet PURPOSE : Get the tool name from elem tree. \*--------------------------------------------------------*/ ProError PTMfgProcitemToolNameGet(ProElement elem) { ProElempath epath; ProElement tool_element; ProElempathItem p_items[3]; ProElemId elem_id; ProValueDataType value_type = -1; ProValue value = (ProValue)NULL; ProValueData value_data; char toolname[100]; status = ProElemtreeWrite (elem, PRO_ELEMTREE_XML, L"selecteditem_feed.inf"); PT_TEST_LOG_SUCC (" ProElemtreeWrite "); status = ProElempathAlloc(&epath); PT_TEST_LOG_SUCC ("ProElempathAlloc ()"); p_items[0].type = PRO_ELEM_PATH_ITEM_TYPE_ID; p_items[0].path_item.elem_id = PRO_E_TOOL ; status = ProElempathDataSet(epath, p_items, 1); PT_TEST_LOG_SUCC ("ProElempathDataSet()"); status= ProElemtreeElementGet(complete_tree, epath, &tool_element); PT_TEST_LOG_SUCC ("ProElemtreeElementGet()"); status = ProElementIdGet( tool_element, &elem_id); PT_TEST_LOG_SUCC("ProElementIdGet"); if ( elem_id == PRO_E_TOOL ) { status = ProElementValueGet (tool_element, &value); PT_TEST_LOG_SUCC("ProElementValueGet"); status = ProValueDataGet (value, &value_data); PT_TEST_LOG_SUCC("ProValueDataGet()"); if (value_data.v.w == NULL) ProStringToWstring(tool_id,"TOOL_NOT_SET"); else ProWstringCopy(value_data.v.w,tool_id,PRO_VALUE_UNUSED); } ProElempathFree(&epath); return PRO_TK_NO_ERROR; } /*====================================================================*\ FUNCTION : user_terminate() PURPOSE : To handle any termination actions \*====================================================================*/ void user_terminate() { }