USE MDB objects without GUI
USE MDB objects without GUI
(OP)
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
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





RE: USE MDB objects without GUI
RE: USE MDB objects without GUI
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...
RE: USE MDB objects without GUI
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']
RE: USE MDB objects without GUI
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