• admin

Teamcenter custom handler build in BMIDE

In this blog we can see how to register and build a custom handler through BMIDE. Please refer my previous blog Setting up BMIDE for coding and building DLL to set up BMIDE for coding.


Register Custom Handler

  • Make sure you have a active library defined in Extensions\Code Generation folders. If you need a new library for managing handlers, create a new library and make it as active library.

  • Create a custom extension rule.

  • Open the Extensions\Rules folders, right-click the Extensions folder, and choose New Extension Definition.

  • In Extension dialog box, along with Name of the extension and click the Add button to the right of Availability table.

  • Select the business object as Session, Business object as Type, Operation as BMF_SESSION_register_epm_handlers and Extension Point as BaseAction.


Extension availability
  • Click Finish

Extension view
  • Add your custom extension as a base action on the BMF_SESSION_register_epm_handlers operation.

  • Open the Session business object and click the Operations tab.

  • Select the BMF_SESSION_register_epm_handlers operation.

  • In the Extension Attachments tab, click the Add button to the right of the table.

  • Click the Browse button to the right of the Extension box and select the custom extension you created earlier.

  • Click Finish.

Session object

  • Save your datamodel and deploy the package into Teamcenter. Else you can build the dll and deploy the package which will also deploy the libraries.

Code Generation

  • Next step is to write the code that get executed whenever the handler is called.

  • This code can register both action and rule handlers.

  • Ensure that your project is set up for coding. Refer this blog for Setting up BMIDE for coding and building DLL.

  • Open the Advanced perspective by choosing Window→Open Perspective → Other → Advanced.

  • In the Extensions view of the Advanced perspective, under the Rules\Extensions folders, Right-click the new extension you created and choose Generate extension code.

  • The extension boilerplate code is generated into an extension-name.cxx C++ file and an extension-name.hxx header file. To see these files, open the project in the Navigator view and browse to the src\server\library directory.

Boilerplate code
  • Write your extension code in the generated files. Register your handlers in the *.cpp file.

Sample:

int L4_register_handlers( METHOD_message_t * /*msg*/, va_list /*args*/ )
{
    EPM_register_rule_handler("L4_RuleHandler", "Rule Handler",(EPM_rule_handler_t)L4_RuleHandler);
     EPM_register_action_handler("L4_ActionHandler", "Action Handler", (EPM_rule_handler_t)L4_ActionHandler);
     return 0;
}

Build your libraries

  • Once the code implementation is done, next step is to build and deploy the libraries.

  • Select your project in Navigator and build by selection Project->Project Build.

makefile.wntx64

  • Remove value -FS from CXX_FLAGS

  • Remove values ucrt.lib vcruntime.lib from SYSLIBS


Dependent Libraries

  • In case you are using various module in ITK programming, add those modules as dependent libraries to your custom library.

Dependent Libraries

If you have already deployed the package for custom library and extensions, you can build the DLL using Project->Project Build option. This should generate the dll and lib files in \output\wntx64\lib directory. Copy the dll file to TC_ROOT\bin and lib file to TC_ROOT\lib.

If you have not deployed the new library and new extension, you can build the library and package the template. Deploying the package in tem will deploy the dll and lib files to your TC_ROOT.