使用python进行组件对象建模

时间:2018-03-10 08:01:06

标签: python-2.7 excel-vba com vba excel

我正在尝试通过python使用COM来使用STAAD.Pro。在excel VBA中使用以下代码可以获得完美的结果。

Private Sub CommandButton1_Click()

Set Obj = GetObject(, "StaadPro.OpenSTAAD")
Dim x3 As Long
Dim x4 As Double

x3 = 9
x4 = 0

Obj.Output.GetMemberSteelDesignRatio x3, x4
Cells(1, 1) = Obj.GetProcessId
Cells(1, 2) = x4

End Sub

但是,当我尝试在Python中实现时,我遇到错误,因为“Bool对象无法调用”

>>> import win32com.client
>>> obj = win32com.client.Dispatch("StaadPro.OpenSTAAD")
>>> obj.GetProcessId
10260
>>> x3 = 9
>>> x4 = 0.0
>>> obj.Output.GetMemberSteelDesignRatio(x3, x4)
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
TypeError: 'bool' object is not callable
>>> obj.Output.GetMemberSteelDesignRatio(long(x3), float(x4))
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
TypeError: 'bool' object is not callable
>>> 

帮助。

0 个答案:

没有答案