﻿# Verwendung des COM-Servers

> [HTML Version](using-the-com-server.html)

Der COM-Server kann verwendet werden, um Funktionen innerhalb der MESYS-Software aus anderen Programmen heraus aufzurufen.

Ein einfaches Beispiel in einer VisualBasic-Funktion:

````
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



````
And here the same example in Python using the members with variants as \[in, out\] parameters do not work from python:

Und hier das gleiche Beispiel in Python mit den Funktionen mit VARIANTS da die \[in, out\] Parameter in Python nicht funktionieren:

````
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

````
 

