Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

USE MDB objects without GUI

Status
Not open for further replies.

leo81

Bioengineer
Dec 6, 2007
43
0
0
BE
Hello guys,

How can I run appropriately a python script in which therare are calls to mdb objects without use the GUI?

I can start my python script with the different command lines:

abq67ef1 python myscript.py
abq67ef1 cae startup=myscript.py
abq67ef1 cae noGUI=myscript.py

but the script doesn't work anymore after executing the line:

os.system(r"c:\tempabaqus\indentation4.cae")

(to access to the .cae)


So, I can call myscript.py but it cannot execute the next commands in which there are calls to mdb objects like this:

def myinput(Youngs):
mdb=openMdb( 'Indentation4.cae')
mdb.models['Model-1'].materials['Elastic Linear'].elastic.setValues(table=((Youngs,0.4999),))

On the contrary if I execute the same strings by the python box in the GUI...it works...but it is unuseful if I would like to authomatize the process.

I hope someone could be able to help me.

Thank you very much.


Leo
 
Replies continue below

Recommended for you

I don't get why you're trying to open the .cae with the os.system command? You should be able to access everything you need from the .cae file through the OpenMdb command? Try running the script without the os.system command and using the third command line in your list.
 
eh no....

this is the problem....

the mdb object is not recognized...

What I should do is to authomatize the procedure:

1. upload Indentation4.cae
2. go to menu-->file-->run script

what about point 2.?

I hope I have explained...
 
Ok maybe I've misunderstood what you are trying to do. From your first post you say you're trying to run the script without the GUI using the command line. If you want to do that use the command:
abq67ef1 cae noGUI=myscript.py

You don't need the line 'os.system(r"c:\tempabaqus\indentation4.cae")' in your script. To access the model you only need the line:

File=openMdb(pathName="indentation4")

Just make sure that you've imported the correct Abaqus modules in your script:

from abaqusConstants import *
from abaqus import *

Here's an example of a script that can be run 'automatically' from the command line:

from abaqusConstants import *
from abaqus import *
#
File=openMdb(pathName="Input")
Part=File.models['Model-1'].parts['Part-1']
 
Hi,

mmm...the problem is not using the command line. I explain better:

my script run perfectly using the command line, but my aim is to automathize all the excecution. I would like to start everything from the DOS prompt or from python. So i need

os.system(r"c:\tempabaqus\indentation4.cae

to open the .cae where there is saved the job to run. So what I am able to do until now:

1. to use python to run a module in which the first line:

os.system(r"c:\tempabaqus\indentation4.cae

is executed.

note: It means that Python and Abaqus communicate. So, I am able to run the script.

2. to run the rest of the script from the python command window or from the gui using file-->menu-->run script

what I would like to do:

Avoid point 2 automathize the manual procedure using the GUI. The script run...but only using the GUI. THe problem reading the resto of the script is that I used mdb objects and they are not recognized. It seems that I have missed part of the python code in which I have to define something to permit to force the kernel. I am not able to automathize the operation that a normal user does using the GUI to run a script.

I hope I explained my problem...otherwise...do you have skype? eheheh...

thanks a lot for your time

have a nice day

Leo
 
Status
Not open for further replies.
Back
Top