Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

PYTHON: Get the name of the odb file 1

Status
Not open for further replies.

RGX124

Mechanical
Apr 5, 2005
75
Hi,

I would like to get the name of the odb file in a python script.
What is the Python command to get it?

The odb is already open, and the name as to be read.

Thanks

Rgx
 
Replies continue below

Recommended for you

Hello,

You can do it this way:

# assign variable to odb object
odbFile = openOdb(path = odbFileName)
# get file name and path
odbFileNameFull = odbFile.path
#split into separately name and path
odbFileName = os.path.split(odbFileNameFull)[1]
odbPath = os.path.split(odbFileNameFull)[0]

Regards,
akaBarten
 
Thanks.
This is the way to get the name of a file that you are opening in the Python script.
Is it possible to get the name of the odb file that is already opened in Abaqus viewer for example?
(I mean without re-opening it)

Rgx
 
Hi,

You can do it in the same way, but first you need set odb file from current viewport to a variable.

from abaqus import session
#
# find current viewport
currentViewport = session.viewports[session.currentViewportName]
# assign odb file from current viewport
odbFile = currentViewport.displayedObject
# get file name and path
odbFileNameFull = odbFile.path
#split into separately name and path
odbFileName = os.path.split(odbFileNameFull)[1]
odbPath = os.path.split(odbFileNameFull)[0]

Regards,
akaBarten
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor