简体   繁体   中英

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. Actually my main purpose is to extract vonMises data from an .odb file.

I can run my main code to run the abaqus analysis with this code below;

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.

My second code to extract data from .odb file with python is;

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.

Actually if I manually open abaqus command prompt and write

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

I can get the result. So do you know how to control abaqus command via python? For example I want to write something on python and see it on the abaqus command prompt. Thanks in advance..

I managed to get something simmilar working using the regular python command in the unix terminal and the following scripts:

File 1 (ran in unix terminal using python file1.py NOT abaqus python...):

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

File 2 (test.py):

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

Hope something simmilar works for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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