PYTHON: Get the name of the odb file
PYTHON: Get the name of the odb file
(OP)
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
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





RE: PYTHON: Get the name of the odb file
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
RE: PYTHON: Get the name of the odb file
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
RE: PYTHON: Get the name of the odb file
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