Show/Hide Toolbars

MESYS Calculation Software

Navigation: General > COM Interface

Using the COM server

Scroll Prev Top Next More

The COM server can be used to call functions within the MESYS software from other programs.

A simple example in a VisualBasic function:

Public Sub test()

Dim mesys As MesysCOM

Set mesys = New MesysCOM

Dim rbc As MesysRBC


Set rbc = mesys.createRBC

Dim d As Long

Dim pmax As Double


Call rbc.setVarInt("inputType", 2)

Call rbc.setVarInt("Z", 12)

Call rbc.setVarDouble("Dw", 5)

Call rbc.setVarDouble("Dpw", 50)

Call rbc.setVarDouble("Fy", 1000)

Call rbc.setVarDouble("ni", 500)


result = rbc.Calculate

Call rbc.showReport("c:/temp/report.pdf")

Call rbc.getVarDouble("pmax", pmax)

Call rbc.getVarInt("Z", d)

Call rbc.calculateBearing(True, 0, True, 1000, True, 0, False, 0, False, 0, 500, 0, 20, 20)

Call rbc.getVarDouble("pmax", pmax2)

Set rbc = Nothing

Set mesys = Nothing


End Sub



The server provides the interface MesysCOM which can be used to create calculation modules. Available methods are:

void setLanguage(QString lang);
Pass language as two characters ("de", "en", "fr", "es", "ko", "zh")

MesysRBC* createRBC();
Create bearing calculation module without user interface.

MesysSHAFT* createSHAFT();
Create shaft calculation module without user interface.

MesysHERTZ* createHERTZ();
Create Hertz stress calculation module without user interface.

Create ball screw calculation module without user interface.

MesysGUIRBC* createGUIRBC();
Create bearing calculation module with user interface.

Create hertz stress calculation module with user interface.

Create shaft calculation module with user interface.

Create ball screw calculation module with user interface.


The interfaces MesysRBC, MesysSHAFT and others without GUI create calculation modules without user interface. MesysGUIRBC, MesysGUISHAFT are calculation modules with user interface.


General methods for all calculation modules are:


bool calculate();
Run calculation.

bool loadFile(QString filename);
Load file.

bool saveFile(QString filename);
Save calculation file.

bool generateReport(QString filename);
Generate a report into the filename.

bool showReport(QString filename);
Generate the report into the filename and call a program to view it.

bool setVarDouble(QString name, double value);
Set variable to double value.

bool setVarBool(QString name, bool value);
Set variable to boolean value.

bool setVarInt(QString name, int value);
Set variable to integer value.

bool setVarString(QString name, QString value);
Set variable to character value.

bool getVarDouble(QString name, double &value);
Read back double variable.

bool getVarBool(QString name, bool &value);
Read back boolean variable.

bool getVarInt(QString name, int &value);
Read back integer variable.

bool getVarString(QString name, QString &value);
Read back character variable.



Additional methods for bearing calculation:


bool calculateBearing(bool enterFx, double Fx_or_Ux, bool enterFy, double Fy_or_Uy, bool enterFz, double Fz_or_Uz, bool enterMy, double My_or_Ry, bool enterMz, double Mz_or_Rz, double ni, double ne, double Ti, double Te);
Run bearing calculation with given loading.

bool setupLoadSpectrum(int count, bool enterFx, bool enterFy, bool enterFz, bool enterMy, bool enterMz);
Setup load spectrum definition.

bool setLoadSpectrumLoad(int loadCase, double Fx_or_Ux, double Fy_or_Uy, double Fz_or_Uz, double My_or_Ry, double Mz_or_Rz, double ni, double ne, double Ti, double Te, double TOil);
Set load spectrum load for each load case

bool selectBearingFromDatabase(QString manufacturer, QString bearingName);
Selects a bearing based on name and manufacturer from the database


Each calculation module with GUI provides following methods:

void showWindow();
Show user interface.

void hideWindow();
Hide user interface.

void exec();
Show user interface and process events until the window is closed.

void setLanguage(QString lang);
Pass language as two characters ("de", "en", "fr", "es", "ko", "zh")

MesysModule* getCalcModule();
Get the calculation module from the user interface.

void setCalcModule(MesysModule*);
Set the calculation module for the user interface.



The names for variables of the calculation modules are the same as provided for the custom report templates. Currently the use for the shaft calculation is limited as additional functions for changing loads and supports are missing.