Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MintJulep 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
Joined
Apr 5, 2005
Messages
75
Location
FR
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
 
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

Back
Top