2014-03-31 40 views
0

我試過在Python中做腳本,但這不起作用。用python提取Abaqus中的模態信息

錯誤是關於行fichier = open('results.txt','w'),但我不明白錯誤在哪裏。你有關於解決這個問題的想法嗎?

代碼是:

from odbAccess import * 
from abaqus import * 
from abaqusConstants import * 
import types 
import visualization 
from math import * 
from odbMaterial import * 
from odbSection import * 

frame_k=[] 
odb=openOdb(path='demoplaque.odb','r') # opens database with specified name 

for k in range (len(odb.steps['modal'].frames)): 
    frame_k.append(odb.steps['modal'].frames[k] 

fichier = open('results.txt','w') 
i=0 
for data in frame_k: 
     if str(data) != '[]': 
       fichier.write(str(data)) 
       i=i+1 
fichier.write('\n') 
fichier.close() 
+1

問題是什麼? –

+0

Abaqus告訴我,語法對於fichier = open('results.txt','w')行是無效的 – user3480888

回答

0

在行:

for k in range (len(odb.steps['modal'].frames)): 
    frame_k.append(odb.steps['modal'].frames[k] 

您需要關閉支架:

 frame_k.append(odb.steps['modal'].frames[k])