Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Creo 9.0.6.0
Dear PTC team,
I want to figure out how to customize Ribbon via Creo TOOLKIT. To do it I launch an example from Creo 9.0.6.0\Common Files\otk\otk_cpp\x86e_win64\obj called otk_install.zip. When the auxiliary application is active I see that the Ribbon has changed and have a new group (20250228_screenshot_1.png).
To save Customized Ribbon I follow the next steps from the User's guide:
1. Go to File -> Options -> Options
2. In "Creo Parametric Options" window go to Ribbon press Export->Save Auxiliary Application user interface.
Then I check resulting toolkitribbonui.rbn (attached) or creo_parametric_customization.ui (depends on Export option) and can read nothing cause the encoding is incorrect.
It seems strange cause initial file otk_install_test.rbn is readable.
What 's interesting is that if I try to import Ribbon from the creo_parametric_customization.ui file, it works seamlessly, which makes me think that this file has a standard encoding for Creo.
What I tried to do:
1. Open the file with different encodings in Notepad and Visual Studio Code.
2. Use python script to open the file in binary format and then guess the encoding using
Solved! Go to Solution.
I found out that there is no necessity to modify directly any *.rbn file to get the Ribbon updated.
I followed the next steps from the html manual (<Creo directory>\Common Files\otk_cpp_doc\objecttoolkit_Creo\index.html) and it worked:
Set the configuration option tk_enable_ribbon_custom_save to yes before customizing the ribbon user interface. The steps to add commands to the Creo Parametric ribbon user interface are as follows:
The code to create a command:
#include <wfcSession.h>
#include <pfcGlobal.h>
#include <pfcCommand.h>
#include <pfcUI.h>
#include <pfcExceptions.h>
#include <wfcClient.h>
#include <fstream>
static ofstream logFile;
class MyCallBack : public virtual pfcUICommandActionListener
{
public:
void OnCommand();
};
/* Entry */
extern "C" int user_initialize(
int argc,
char *argv[],
char *version,
char *build,
wchar_t errbuf[80])
{
try
{
pfcSession_ptr Session = pfcGetProESession ();
wfcWSession_ptr wSession = wfcWSession::cast (Session);
pfcUICommand_ptr InputCommand1 = wSession->UICreateCommand("My_command", new MyCallBack() );
InputCommand1->Designate ("msg_user.txt", "My_label", "My_help", "My_description");
return (wfcTK_NO_ERROR);
}
xcatchbegin
xcatchcip (Ex)
logFile << "Exception:\n" << Ex << endl;
return (wfcTK_NO_ERROR);
xcatchend
}
/* Exit*/
extern "C" void user_terminate()
{
logFile<< endl;
logFile<< "================================================" << endl;
logFile<< "OTK application terminated successfully."<<endl;
logFile<< "================================================" << endl;
logFile.close();
}
void MyCallBack::OnCommand()
{
try
{
pfcSession_ptr Session = pfcGetProESession ();
Session->UIShowMessageDialog("Test succeeded!!", NULL);
}
xcatchbegin
xcatchcip (Ex)
logFile << "Exception:\n" << Ex << endl;
xcatchend
}
I found out that there is no necessity to modify directly any *.rbn file to get the Ribbon updated.
I followed the next steps from the html manual (<Creo directory>\Common Files\otk_cpp_doc\objecttoolkit_Creo\index.html) and it worked:
Set the configuration option tk_enable_ribbon_custom_save to yes before customizing the ribbon user interface. The steps to add commands to the Creo Parametric ribbon user interface are as follows:
The code to create a command:
#include <wfcSession.h>
#include <pfcGlobal.h>
#include <pfcCommand.h>
#include <pfcUI.h>
#include <pfcExceptions.h>
#include <wfcClient.h>
#include <fstream>
static ofstream logFile;
class MyCallBack : public virtual pfcUICommandActionListener
{
public:
void OnCommand();
};
/* Entry */
extern "C" int user_initialize(
int argc,
char *argv[],
char *version,
char *build,
wchar_t errbuf[80])
{
try
{
pfcSession_ptr Session = pfcGetProESession ();
wfcWSession_ptr wSession = wfcWSession::cast (Session);
pfcUICommand_ptr InputCommand1 = wSession->UICreateCommand("My_command", new MyCallBack() );
InputCommand1->Designate ("msg_user.txt", "My_label", "My_help", "My_description");
return (wfcTK_NO_ERROR);
}
xcatchbegin
xcatchcip (Ex)
logFile << "Exception:\n" << Ex << endl;
return (wfcTK_NO_ERROR);
xcatchend
}
/* Exit*/
extern "C" void user_terminate()
{
logFile<< endl;
logFile<< "================================================" << endl;
logFile<< "OTK application terminated successfully."<<endl;
logFile<< "================================================" << endl;
logFile.close();
}
void MyCallBack::OnCommand()
{
try
{
pfcSession_ptr Session = pfcGetProESession ();
Session->UIShowMessageDialog("Test succeeded!!", NULL);
}
xcatchbegin
xcatchcip (Ex)
logFile << "Exception:\n" << Ex << endl;
xcatchend
}