/* Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved. */ /*---------------------- Pro/Toolkit Includes ------------------------*/ #include <ProToolkit.h> #include <ProSelection.h> /*---------------------- Application Includes ------------------------*/ #include <TestError.h> /*---------------------- Function Prototypes -------------------------*/ ProError UserSurfRename(); /*============================================================================*\ Function: UserSurfRename() Purpose: Rename Selected Surface \*============================================================================*/ ProError UserSurfRename() { int sel_count; ProError status; ProCharName name; ProModelitem p_mdl_item; ProFileName msgfile; ProName w_name; ProSelection *psels=NULL; /*----------------------------------------------------------------------------*\ Prompt user for selection of surface \*----------------------------------------------------------------------------*/ ProStringToWstring(msgfile,"msg_uggeom.txt"); status = ProMessageDisplay(msgfile,"USER Select Surface to Rename:"); ERROR_CHECK("UserSurfRename","ProMessageDisplay",status); if((ProSelect("surface",1,NULL,NULL,NULL,NULL,&psels, &sel_count) != PRO_TK_NO_ERROR) || (sel_count < 1)) return((int) PRO_TK_GENERAL_ERROR); status = ProSelectionModelitemGet(psels[0],&p_mdl_item); ERROR_CHECK( "UserSurfRename", "ProSelectionModelitemGet", status ); status = ProModelitemNameGet(&p_mdl_item,w_name); ERROR_CHECK( "UserSurfRename","ProModelitemNameGet",status); /*----------------------------------------------------------------------------*\ Display current name or "NONE" if surface is not named \*----------------------------------------------------------------------------*/ if(status != PRO_TK_NO_ERROR) ProTKSprintf(name,"NONE"); else { ProWstringToString(name,w_name); } status = ProMessageDisplay(msgfile,"USER Enter Name [%0s]:",name); ERROR_CHECK( "UserSurfRename","ProMessageDisplay(Enter Name)",status); status = ProMessageStringRead(PRO_NAME_SIZE,w_name); ERROR_CHECK( "UserSurfRename","ProMessageStringRead",status); if(status == PRO_TK_NO_ERROR) { status = ProModelitemNameSet(&p_mdl_item,w_name); ERROR_CHECK( "UserSurfRename","ProModelitemNameSet",status); } ProMessageClear(); return(status); }