User login

Navigation

You are here

saving abaqus odb with new name in python

Hi all,

I would like to add some custom fieldOutputs to an odb and I wish to save the results using a different name for the odb, in order not to mess up the original odb. For how much I tried I cannot find a solution, it seems that I can only save an odb with using its original name/path . Does anybody know how to do that?

Thanks

Comments

You might not need to save the entire ODB separately, rather could do away with saving only the information you need to save. The following example does it for some custom XY data.

odb = session.Odb(name='NEW_ODB_NAME.odb', onlyHasUserDefinedData=ON)
xy = session.xyDataObjects['XYData-1']
odb.userData.XYData('XYData-1', xy)
odb.save()

Regards

Alright, but if you need to add additional fields to an existing solutions (e.g. incremental displacements), then you would also need to copy all other info: nodes, elements, existing fields, etc.

If it is a matter of just copying a file, then you may use

import shutil
shutil.copy("ORIGINAL_FILE_NAME", "NEW_FILE_NAME")

Yes, that's exactly what I did. What annoys me is having to write the (possibly huge) odb twice, one for coying, one for saving. Thank you very much for your reply.

 

N

 

I do not understand. You said two seemingly contradictory things.

1. "wish to save the results using a different name for the odb, in order not to mess up the original odb"

2. "annoys me is having to write the (possibly huge) odb twice"

If you don't wish to mess up the original odb, then writing/copying a new one is the logical resort.

 

Am I missing something?

 

 

Sorry if I wasn't clear

Your proposal is what I did:

open original odb --> copy to new odb --> add fields --> save new odb      two write operations

I wonder if there is an easy way to do:

open original odb --> add fields --> save to new odb     sparing the first copy

In simpler terms, if you want to modify, say,  a text file and save it with a different name, usually you do not need to copy the original file with a new name first! Can you do it with an odb?

Subscribe to Comments for "saving abaqus odb with new name in python"

Recent comments

More comments

Syndicate

Subscribe to Syndicate