[英]“No Keywords Defined” Error in Importing .inp model in Abaqus
I'm having some issues when I import .inp
models into Abaqus CAE.我在将.inp
模型导入 Abaqus CAE 时遇到了一些问题。 I defined this new input file starting from an original input file, and changing the values of some parameters via a Python loop that works fine and produces the new .inp
I need.我从原始输入文件开始定义了这个新输入文件,并通过 Python 循环更改了一些参数的值,该循环工作正常并生成我需要的新.inp
。
The fact is that when I try to import the new input files into CAE, it doesn't work and the error NoKeywordsDefinedError appears.事实是,当我尝试将新输入文件导入 CAE 时,它不起作用并出现错误 NoKeywordsDefinedError。 The funny fact is that if I copy and paste the content of the new .inp
file into the old one, and I import that model, well, it works.有趣的事实是,如果我将新.inp
文件的内容复制并粘贴到旧文件中,然后导入该模型,那么,它就可以工作了。
I defined the new .inp
using in this way:我以这种方式定义了新的.inp
:
inputFile=open('Job-1.inp','r')
outputFile=open('ModifiedInput'+'_RUN'+str(run)+'_LEVEL'+str(r)+'.inp','w')
number_of_lines = 0
for line in inputFile:
line = line.strip("\n")
number_of_lines += 1
if number_of_lines == XXX:
line = line.replace('old','new')
outputFile.write(line)
Maybe I should specify something when I write the lines into the new file?也许我应该在将行写入新文件时指定一些内容?
A few things you could do to improve your script:您可以做一些事情来改进您的脚本:
outputFile.write
statement outside of the number_of_lines
check.我假设您还想写出您不修改的行,因此将outputFile.write
语句移到number_of_lines
检查之外。inputFile=open('Job-1.inp','r')
outputFile=open('ModifiedInput'+'_RUN'+str(run)+'_LEVEL'+str(r)+'.inp','w')
number_of_lines = 0
for line in inputFile:
#line = line.strip("\n")
number_of_lines += 1
if number_of_lines == XXX:
line = line.replace('old','new')
outputFile.write(line)
inputFile.close()
outputFile.close()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.