/* Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved. */ /*--------------------------------------------------------------------*\ Pro/TOOLKIT includes \*--------------------------------------------------------------------*/ #include <ProToolkit.h> #include <ProMenu.h> #include <ProNcseq.h> #include <ProElement.h> #include <ProModelitem.h> #include <ProNcseqElem.h> #include <ProFeature.h> #include <ProSolid.h> #include <ProElemId.h> #include <ProFeatType.h> /*--------------------------------------------------------------------*\ Application includes \*--------------------------------------------------------------------*/ #include "UtilString.h" #include "UtilGeom.h" #include "TestError.h" #include "TestConsts.h" #include "MfgMenu.h" #include <ProTKRunTime.h> /*====================================================================*\ FUNCTION : ProTestNCSequenceCreate PURPOSE : ProTestNCSequenceCreate \*====================================================================*/ ProError ProTestNCSequenceCreate(MfgMenuChoice *obj_action) { static char *menu[] = {"TkMfgNCSeq","TkMfgNCDQ",""}; ProError status = PRO_TK_NO_ERROR; int nc_type, done_quit; int id; int ProTestChooseNCSeqType(int *nc_type, int opt); int ProTestNCSeqDQ(int *done_quit, int opt); nc_type = PRO_NCSEQ_CONV_SURF_MILL; status = ProMenuPush(); TEST_CALL_REPORT ("ProMenuPush", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenuFileRegister((char*)"TkMfgNCSeq",(char*)"tkmfgncseq.mnu", &id); TEST_CALL_REPORT ("ProMenuFileRegister", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonActionSet((char*)"TkMfgNCSeq",(char*)"TkMfgNCSeq", (ProMenubuttonAction)ProMenuHold,NULL,0); TEST_CALL_REPORT ("ProMenubuttonActionSet", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonActionSet((char*)"TkMfgNCSeq",(char*)"-ConvMill", (ProMenubuttonAction)ProTestChooseNCSeqType, &nc_type, PRO_NCSEQ_CONV_SURF_MILL); TEST_CALL_REPORT ("ProMenubuttonActionSet", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonActionSet((char*)"TkMfgNCSeq",(char*)"-FaceMill", (ProMenubuttonAction)ProTestChooseNCSeqType, &nc_type, PRO_NCSEQ_FACE_MILL); TEST_CALL_REPORT ("ProMenubuttonActionSet", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonActionSet((char*)"TkMfgNCSeq",(char*)"-HoleMake", (ProMenubuttonAction)ProTestChooseNCSeqType, &nc_type, PRO_NCSEQ_HOLEMAKING); TEST_CALL_REPORT ("ProMenubuttonActionSet", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenuDatamodeSet((char*)"TkMfgNCSeq", (ProBoolean)0); TEST_CALL_REPORT ("ProMenuDatamodeSet", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenuFileRegister((char*)"TkMfgNCDQ",(char*)"tkmfgncdq.mnu", &id); TEST_CALL_REPORT ("ProMenuFileRegister", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonActionSet((char*)"TkMfgNCDQ",(char*)"TkMfgNCDQ", (ProMenubuttonAction)ProMenuHold,NULL,0); TEST_CALL_REPORT ("ProMenubuttonActionSet", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonActionSet((char*)"TkMfgNCDQ",(char*)"Done", (ProMenubuttonAction)ProTestNCSeqDQ, &done_quit, MFGTK_DONE); TEST_CALL_REPORT ("ProMenubuttonActionSet", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonActionSet((char*)"TkMfgNCDQ",(char*)"Quit", (ProMenubuttonAction)ProTestNCSeqDQ, &done_quit, MFGTK_QUIT); TEST_CALL_REPORT ("ProMenubuttonActionSet", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProCompoundmenuCreate(menu, &id); TEST_CALL_REPORT ("ProCompoundmenuCreate", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonHighlight((char*)"TkMfgNCSeq",(char*)"-ConvMill"); TEST_CALL_REPORT ("ProMenubuttonHighlight", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenuProcess(menu[0], &id); TEST_CALL_REPORT ("ProMenuProcess", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); if( done_quit == MFGTK_QUIT ) { status = ProMenuPop(); TEST_CALL_REPORT("ProMenuPop", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonUnhighlight((char*)"TkMfgDQ",(char*)"Done"); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); return((ProError)0); } switch(nc_type) { case PRO_NCSEQ_CONV_SURF_MILL: ProTKPrintf((char*)"PRO_NCSEQ_CONV_SURF_MILL\n"); break; case PRO_NCSEQ_FACE_MILL: ProTKPrintf((char*)"PRO_NCSEQ_FACE_MILL\n"); break; case PRO_NCSEQ_HOLEMAKING: ProTKPrintf((char*)"PRO_NCSEQ_HOLEMAKING\n"); break; default: break; } /* Return to previous menu. */ status = ProMenuPop(); TEST_CALL_REPORT ("ProMenuPop", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonUnhighlight((char*)"TkMfgDQ",(char*)"Done"); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonActivate((char*)"TkMfgAct",(char*)"-Redefine"); TEST_CALL_REPORT ("ProMenubuttonActivate", "ProTestNCSequenceCreate", status, status != PRO_TK_NO_ERROR); return ((ProError)1); } /*====================================================================*\ FUNCTION : ProTestChooseNCSeqType PURPOSE : ProTestChooseNCSeqType \*====================================================================*/ int ProTestChooseNCSeqType(int *nc_type, int opt) { ProError status; switch(opt) { case PRO_NCSEQ_CONV_SURF_MILL: status = ProMenubuttonUnhighlight((char*)"TkMfgNCSeq",(char*)"-FaceMill"); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSeqType", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonUnhighlight((char*)"TkMfgNCSeq",(char*)"-HoleMake"); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSeqType", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonHighlight((char*)"TkMfgNCSeq",(char*)"-ConvMill"); TEST_CALL_REPORT ("ProMenubuttonHighlight", "ProTestNCSeqType", status, status != PRO_TK_NO_ERROR); *nc_type = PRO_NCSEQ_CONV_SURF_MILL; break; case PRO_NCSEQ_FACE_MILL: status = ProMenubuttonUnhighlight((char*)"TkMfgNCSeq",(char*)"-ConvMill"); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSeqType", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonUnhighlight((char*)"TkMfgNCSeq",(char*)"-HoleMake"); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSeqType", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonHighlight((char*)"TkMfgNCSeq",(char*)"-FaceMill"); TEST_CALL_REPORT ("ProMenubuttonHighlight", "ProTestNCSeqType", status, status != PRO_TK_NO_ERROR); *nc_type = PRO_NCSEQ_FACE_MILL; break; case PRO_NCSEQ_HOLEMAKING: status = ProMenubuttonUnhighlight((char*)"TkMfgNCSeq",(char*)"-ConvMill"); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSeqType", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonUnhighlight((char*)"TkMfgNCSeq",(char*)"-FaceMill"); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSeqType", status, status != PRO_TK_NO_ERROR); status = ProMenubuttonHighlight((char*)"TkMfgNCSeq",(char*)"-HoleMake"); TEST_CALL_REPORT ("ProMenubuttonHighlight", "ProTestNCSeqType", status, status != PRO_TK_NO_ERROR); *nc_type = PRO_NCSEQ_HOLEMAKING; break; default: break; } return(0); } /*====================================================================*\ FUNCTION : ProTestNCSeqDQ PURPOSE : ProTestNCSeqDQ \*====================================================================*/ int ProTestNCSeqDQ(int *done_quit, int opt) { ProError status; switch(opt) { case MFGTK_DONE: status = ProMenuDelete(); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSeqDQ", status, status != PRO_TK_NO_ERROR); status = ProMenuDelete(); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSeqDQ", status, status != PRO_TK_NO_ERROR); *done_quit = MFGTK_DONE; break; case MFGTK_QUIT: status = ProMenuDelete(); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSeqDQ", status, status != PRO_TK_NO_ERROR); status = ProMenuDelete(); TEST_CALL_REPORT ("ProMenubuttonUnhighlight", "ProTestNCSeqDQ", status, status != PRO_TK_NO_ERROR); *done_quit = MFGTK_QUIT; break; default: break; } return(0); }