Search code examples
pythonabaqus

How to identify node set names in an assembly in abaqus with Python scripting?


I am analyzing a model with various node sets in Abaqus, from which I want to extract different data.

I have been introducing node set names by hand for each analysis, and this can be quite tedious if there is plenty of node sets in the model.

I was wondering if there is any way of obtaining a list with all the node set names in it. Is it possible?

Example of the result I am expecting:

NSETS=['NSET-1',''NSET-2'...]

Solution

  • It depends on whether you're interacting with a model database or output database and where the set resides. Once you identify where you're accessing the sets dictionary you can use the keys method to get a list of set names. For example, to get the set names in an instance in the assembly:

    NSETS = mdb.models['Model-1'].rootAssembly.instances['PART-1-1'].sets.keys()
    

    You can use the same approach for getting the set names elsewhere. In the Abaqus Scripting Reference Manual there are two relevant sections that show where you can access sets. The first is for accessing sets in the model database:

    Abaqus > Scripting Reference > Python commands > Region commands > Set object

    import part
    mdb.models[name].parts[name].allInternalSets[name]
    mdb.models[name].parts[name].allSets[name]
    mdb.models[name].parts[name].sets[name]
    import assembly
    mdb.models[name].rootAssembly.allinstances.sets[name]
    mdb.models[name].rootAssembly.allInternalSets[name]
    mdb.models[name].rootAssembly.allSets[name]
    mdb.models[name].rootAssembly.instances[name].sets[name]
    mdb.models[name].rootAssembly.modelInstances[i].sets[name]
    mdb.models[name].rootAssembly.sets[name]
    

    And for accessing sets from the output database:

    Abaqus > Scripting Reference > Python commands > Odb commands > OdbSet object

    import odbAccess session.odbs[name].parts[name].elementSets[name]
    session.odbs[name].parts[name].nodeSets[name]
    session.odbs[name].parts[name].surfaces[name]
    session.odbs[name].rootAssembly.elementSets[name]
    session.odbs[name].rootAssembly.instances[name].elementSets[name]
    session.odbs[name].rootAssembly.instances[name].nodeSets[name]
    session.odbs[name].rootAssembly.instances[name].surfaces[name]
    session.odbs[name].rootAssembly.nodeSets[name]
    session.odbs[name].rootAssembly.surfaces[name]
    session.odbs[name].steps[name].frames[i].fieldOutputs[name].values[i].instance.elementSets[name]
    session.odbs[name].steps[name].frames[i].fieldOutputs[name].values[i].instance.nodeSets[name]
    session.odbs[name].steps[name].frames[i].fieldOutputs[name].values[i].instance.surfaces[name]