简体   繁体   English

从python控制abaqus命令提示符

[英]Control abaqus command prompt from python

For couple of days I am searching for a way to control abaqus command prompt from Python script to run an .py file for abaqus. 几天来,我正在寻找一种方法来控制来自Python脚本的abaqus命令提示符,以便为abaqus运行.py文件。 Actually my main purpose is to extract vonMises data from an .odb file. 实际上我的主要目的是从.odb文件中提取vonMises数据。

I can run my main code to run the abaqus analysis with this code below; 我可以使用下面的代码运行我的主代码来运行abaqus分析;

import subprocess
subprocess.call(['C:\SIMULIA\Abaqus\Commands\\abq6131.bat cae noGUI=C:\Users\\acer\Desktop\GereksizDosyalar\macro7.py'], shell=True)

This code simply open abaqus command prompt with "abq6131.dat" and run the analysis. 此代码只需使用“abq6131.dat”打开abaqus命令提示符并运行分析。

My second code to extract data from .odb file with python is; 我用python从.odb文件中提取数据的第二个代码是;

subprocess.call(['C:\SIMULIA\Abaqus\Commands\\abq6131.bat abaqus python odbMaxMises.py -odb Job-1.odb'], shell=True)

but it gives error: Error: ***ERROR: "odbMaxMises.py" is not an Abaqus database file. 但它给出错误:错误:***错误:“odbMaxMises.py”不是Abaqus数据库文件。

Actually if I manually open abaqus command prompt and write 实际上如果我手动打开abaqus命令提示符并写入

abaqus python odbMaxMises.py -odb Job-1.odb

I can get the result. 我可以得到结果。 So do you know how to control abaqus command via python? 所以你知道如何通过python控制abaqus命令吗? For example I want to write something on python and see it on the abaqus command prompt. 例如,我想在python上写一些东西,并在abaqus命令提示符下看到它。 Thanks in advance.. 提前致谢..

I managed to get something simmilar working using the regular python command in the unix terminal and the following scripts: 我设法使用unix终端中的常规python命令和以下脚本获得simmilar工作:

File 1 (ran in unix terminal using python file1.py NOT abaqus python...): 文件1(使用python file1.py而不是abaqus python在unix终端中运行):

import os
os.system("abaqus viewer nogui=test.py")

File 2 (test.py): 文件2(test.py):

import sys
print >> sys.__stdout__, 'It worked'

Hope something simmilar works for you. 希望simmilar能为您效劳。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM