COM 서버는 다른 프로그램에서 MESYS 소프트웨어 내의 기능을 호출하는 데 사용할 수 있습니다.
VisualBasic 함수에서의 간단한 예:
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", pmax)
Set rbc = Nothing
Set mesys = Nothing
End Sub
그리고 여기 Python에서 [in, out] 매개 변수로 변형이 있는 멤버를 사용하는 동일한 예제는 Python에서 작동하지 않습니다:
import comtypes.client
mesys = comtypes.client.CreateObject("MesysCOM64.MesysCOM")
rbc = mesys.createRBC()
rbc.setVar("inputType", 2)
rbc.setVar("Z", 12)
rbc.setVar("Dw", 5)
rbc.setVar("Dpw", 50)
rbc.setVar("Fy", 1000)
rbc.setVar("ni", 500)
rbc.calculate()
rbc.showReport("c:/temp/report.pdf")
pmax = rbc.getVar("pmax")
z = rbc.getVar("Z")
rbc.calculateBearing(True, 0, True, 1000, True, 0, False, 0, False, 0, 500, 0, 20, 20)
pmax2 = rbc.getVar("pmax")
stiffness = rbc.getStiffnessMatrixAsVector();
rbc = None
mesys = None
서버는 계산 모듈을 생성하는 데 사용할 수 있는 MesysCOM 인터페이스를 제공합니다. 사용 가능한 메서드는 다음과 같습니다:
•void setLanguage([in] BSTR p_lang);
Pass language as two characters ("de", "en", "fr", "es", "tr", "ko", "zh", "ja")
•int getVersion();
Returns version in format yyyymm.
•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.
•MesysBALLSCREW* createBALLSCREW();
Create ball screw calculation module without user interface.
•MesysGUIRBC* createGUIRBC();
Create bearing calculation module with user interface.
•MesysGUIHERTZ* createGUIHERTZ();
Create hertz stress calculation module with user interface.
•MesysGUISHAFT* createGUISHAFT();
Create shaft calculation module with user interface.
•MesysGUIBALLSCREW* createGUIBALLSCREW();
Create ball screw calculation module with user interface.
MesysRBC, MesysSHAFT 및 GUI가 없는 인터페이스는 사용자 인터페이스 없이 계산 모듈을 생성합니다. MesysGUIRBC, MesysGUISHAFT는 사용자 인터페이스가 있는 계산 모듈입니다.
모든 계산 모듈의 일반적인 방법은 다음과 같습니다:
•VARIANT_BOOL calculate();
Run calculation.
•VARIANT_BOOL loadFile([in] BSTR p_filename);
Load file.
•VARIANT_BOOL saveFile([in] BSTR p_filename);
Save calculation file.
•VARIANT_BOOL generateReport([in] BSTR p_filename);
Generate a report into the filename.
•VARIANT_BOOL showReport([in] BSTR p_filename);
Generate the report into the filename and call a program to view it.
•VARIANT_BOOL generateSpecialReport([in] BSTR p_type, [in] BSTR p_filename);
•Generate a special report into the filename. Use type as "resultTables" for result tables.
•VARIANT_BOOL generateImage([in] BSTR p_imageID, [in] BSTR p_filename, [in] int p_dpi, [in] int p_widthinMM, [in] int p_heightinMM);
Generate an image and save it as file.
•SAFEARRAY(VARIANT) getDiagramData([in] BSTR p_imageID);
Get the diagram data for diagrams. The format of the return value is [["name", ["x", "abscissa label", "abscissa unit", [1, 2, 3, ...], ["y", "ordinate label", "ordinate unit", [1, 2, 3, ...]], ["name", ...]]
•VARIANT_BOOL setVarDouble([in] BSTR p_name, [in] double p_value);
Set variable to double value.
•VARIANT_BOOL setVarBool([in] BSTR p_name, [in] VARIANT_BOOL p_value);
Set variable to boolean value.
•VARIANT_BOOL setVarInt([in] BSTR p_name, [in] int p_value);
Set variable to integer value.
•VARIANT_BOOL setVarString([in] BSTR p_name, [in] BSTR p_value);
Set variable to character value.
•VARIANT_BOOL getVarDouble([in] BSTR p_name, [in,out] double *p_value);
Read back double variable.
•VARIANT_BOOL getVarBool([in] BSTR p_name, [in,out] VARIANT_BOOL *p_value);
Read back boolean variable.
•VARIANT_BOOL getVarInt([in] BSTR p_name, [in,out] int *p_value);
Read back integer variable.
•VARIANT_BOOL getVarString([in] BSTR p_name, [in,out] BSTR *p_value);
Read back character variable.
•VARIANT_BOOL setVar([in] BSTR p_name, [in] VARIANT p_value);
Set variable using variant
•VARIANT getVar([in] BSTR p_name);
Get variable using variant
•VARIANT_BOOL resizeArray([in] BSTR p_name, [in] int p_count);
Resize array variable
베어링 연산을 위한 추가 방법:
•VARIANT_BOOL calculateBearing([in] VARIANT_BOOL p_enterFx, [in] double p_Fx_or_Ux, [in] VARIANT_BOOL p_enterFy, [in] double p_Fy_or_Uy, [in] VARIANT_BOOL p_enterFz, [in] double p_Fz_or_Uz, [in] VARIANT_BOOL p_enterMy, [in] double p_My_or_Ry, [in] VARIANT_BOOL p_enterMz, [in] double p_Mz_or_Rz, [in] double p_ni, [in] double p_ne, [in] double p_Ti, [in] double p_Te);
Run bearing calculation with given loading.
•VARIANT_BOOL setupLoadSpectrum([in] int p_count, [in] VARIANT_BOOL p_enterFx, [in] VARIANT_BOOL p_enterFy, [in] VARIANT_BOOL p_enterFz, [in] VARIANT_BOOL p_enterMy, [in] VARIANT_BOOL p_enterMz);
Setup load spectrum definition.
•VARIANT_BOOL setLoadSpectrumLoad([in] int p_loadCase, [in] double p_frequency, [in] double p_Fx_or_Ux, [in] double p_Fy_or_Uy, [in] double p_Fz_or_Uz, [in] double p_My_or_Ry, [in] double p_Mz_or_Rz, [in] double p_ni, [in] double p_ne, [in] double p_Ti, [in] double p_Te, [in] double p_TOil);
Set load spectrum load for each load case
•VARIANT_BOOL selectBearingFromDatabase([in] BSTR p_manufacturer, [in] BSTR p_bearingName);
Selects a bearing based on name and manufacturer from the database
•VARIANT_BOOL getStiffnessMatrix([in,out] double *p_c11, [in,out] double *p_c12, [in,out] double *p_c13, [in,out] double *p_c14, [in,out] double *p_c15, [in,out] double *p_c21, [in,out] double *p_c22, [in,out] double *p_c23, [in,out] double *p_c24, [in,out] double *p_c25, [in,out] double *p_c31, [in,out] double *p_c32, [in,out] double *p_c33, [in,out] double *p_c34, [in,out] double *p_c35, [in,out] double *p_c41, [in,out] double *p_c42, [in,out] double *p_c43, [in,out] double *p_c44, [in,out] double *p_c45, [in,out] double *p_c51, [in,out] double *p_c52, [in,out] double *p_c53, [in,out] double *p_c54, [in,out] double *p_c55);
Reads back the bearing stiffness matrix with units N, Nm, mm, rad. The order of rows and columns is like in the report ux, uy, uz, ry, rz.
•SAFEARRAY(VARIANT) getStiffnessMatrixAsVector();
Reads back the bearing stiffness matrix as vector with units N, Nm, mm, rad. The order of the elements is per row.
•SAFEARRAY(VARIANT) getRollingElementResults([in] int p_loadCase, [in] int p_bearing, [in] int p_row, [in] int p_rollingElement, [in] int p_section);
Returns results for single rolling elements. The parameter 'section' is only used for roller bearings, for section==-1 the forces acting on the roller are returned. The parameter 'loadCase' is only used if a load spectrum is defined.
볼스크류 연산을 위한 추가 방법:
•VARIANT_BOOL calculateBallScrew([in] VARIANT_BOOL p_enterFx, [in] double p_Fx_or_Ux, [in] VARIANT_BOOL p_enterFy, [in] double p_Fy_or_Uy, [in] VARIANT_BOOL p_enterFz, [in] double p_Fz_or_Uz, [in] double p_Rx, [in] VARIANT_BOOL p_enterMy, [in] double p_My_or_Ry, [in] VARIANT_BOOL p_enterMz, [in] double p_Mz_or_Rz, [in] double p_ni, [in] double p_ne, [in] double p_Ti, [in] double p_Te);
Run ball screw calculation with given loading
•VARIANT_BOOL setupLoadSpectrum([in] int p_count, [in] VARIANT_BOOL p_enterFx, [in] VARIANT_BOOL p_enterFy, [in] VARIANT_BOOL p_enterFz, [in] VARIANT_BOOL p_enterMy, [in] VARIANT_BOOL p_enterMz);
Setup load spectrum definition
•VARIANT_BOOL setLoadSpectrumLoad([in] int p_loadCase, [in] double p_frequency, [in] double p_Fx_or_Ux, [in] double p_Fy_or_Uy, [in] double p_Fz_or_Uz, [in] double p_Rx, [in] double p_My_or_Ry, [in] double p_Mz_or_Rz, [in] double p_ni, [in] double p_ne, [in] double p_Ti, [in] double p_Te);
Sets load spectrum load for each load case
•VARIANT_BOOL getStiffnessMatrix([in,out] double *p_c11, [in,out] double *p_c12, [in,out] double *p_c13, [in,out] double *p_c14, [in,out] double *p_c15, [in,out] double *p_c21, [in,out] double *p_c22, [in,out] double *p_c23, [in,out] double *p_c24, [in,out] double *p_c25, [in,out] double *p_c31, [in,out] double *p_c32, [in,out] double *p_c33, [in,out] double *p_c34, [in,out] double *p_c35, [in,out] double *p_c41, [in,out] double *p_c42, [in,out] double *p_c43, [in,out] double *p_c44, [in,out] double *p_c45, [in,out] double *p_c51, [in,out] double *p_c52, [in,out] double *p_c53, [in,out] double *p_c54, [in,out] double *p_c55);
Reads back the stiffness matrix with units N, Nm, mm, rad. The order of rows and columns is like in the report ux, uy, uz, ry, rz.
•SAFEARRAY(VARIANT) getStiffnessMatrixAsVector();
Reads back the bearing stiffness matrix as vector with units N, Nm, mm, rad. The order of the elements is per row.
•SAFEARRAY(VARIANT) getRollingElementResults([in] int p_loadCase, [in] int p_bearing, [in] int p_thread, [in] int p_rollingElement);
Returns results for single rolling elements. The parameter 'loadCase' is only used if a load spectrum is defined and should be set to zero otherwise.
샤프트 연산을 위한 추가 방법:
•VARIANT_BOOL importREXS([in] BSTR p_path);
Import system in REXS format
•VARIANT_BOOL exportREXS([in] BSTR p_path);
Export system in REXS format
•void resizeLoadSpectrum([in] int p_count);
Resize load spectrum, which needs to be active.
•VARIANT_BOOL setLoadSpectrumElement([in] int p_id, [in] BSTR p_component, [in] int p_index, [in] double p_value);
Set data for load spectrum element
•VARIANT_BOOL setPosition([in] int p_id, [in] double p_position);
Set position for force or support
•SAFEARRAY(VARIANT) getShaftIds();
Get list of shaft IDs
•SAFEARRAY(VARIANT) getForceIds();
Get list of force IDs
•SAFEARRAY(VARIANT) getSupportIds();
Get list of support IDs
•SAFEARRAY(VARIANT) getSectionIds();
Get list of section IDs
•SAFEARRAY(VARIANT) getBearingIds();
Get list of bearing IDs
•SAFEARRAY(VARIANT) getBallscrewIds();
Get list of ballscrew IDs
•SAFEARRAY(VARIANT) getGroupIds();
Get list of group IDs
•SAFEARRAY(VARIANT) getElasticPartIds();
Get list of elastic part IDs
•int getShaftIdByName([in] BSTR p_name);
Get ID for first shaft with given name. Returns zero if not found.
•int getForceIdByName([in] BSTR p_name);
Get ID for first force with given name. Returns zero if not found.
•int getSupportIdByName([in] BSTR p_name);
Get ID for first support with given name. Returns zero if not found.
•int getSectionIdByName([in] BSTR p_name);
Get ID for first section with given name. Returns zero if not found.
•int getBearingIdByName([in] BSTR p_name);
Get ID for first bearing with given name. Returns zero if not found.
•int getBallscrewIdByName([in] BSTR p_name);
Get ID for first ballscrew with given name. Returns zero if not found.
•int getElasticPartIdByName([in] BSTR p_name);
Get ID for first elastic part with given name. Returns zero if not found.
•BSTR getName([in] int p_id);
Get element name for ID
•VARIANT getIDVar([in] int p_id, [in] BSTR p_name);
Get variable for element with given ID
•VARIANT_BOOL setIDVar([in] int p_id, [in] BSTR p_name, [in] VARIANT p_value);
Set variable for element with given ID
•VARIANT_BOOL resizeIDArray([in] int p_id, [in] BSTR p_name, [in] int p_count);
Resize array variable for element with given ID
•MesysRBC* getBearingModule([in] int p_id);
Get bearing calculation for given ID as copy
•VARIANT_BOOL setBearingModule([in] int p_id, [in] MesysRBC* p1);
Set bearing calculation for given ID
•MesysBALLSCREW* getBallScrewModule([in] int p_id);
Get ballscrew calculation for given ID as copy
•VARIANT_BOOL setBallScrewModule([in] int p_id, [in] MesysBALLSCREW* p1);
Set ballscrew calculation for given ID
GUI가 있는 각 연산 모듈은 다음과 같은 방법을 제공합니다:
•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([in] BSTR p_lang);
Pass language as two characters ("de", "en", "fr", "es", "tr", "ko", "zh", "ja")
•MesysModule* getCalcModule();
Get the calculation module from the user interface.
•void setCalcModule(MesysModule*);
Set the calculation module for the user interface.
•void runParameterVariation([in] BSTR p_resultFilePath);
Runs the parameter calculation with the given definitions and saves the results table into the given file. Only available for shaft, bearing and ball screw calculation.