Search code examples
pythonscriptingabaqus

How to know a material name of a certain part by accessing its INSTANCE in ABAQUS odb file(not MDB file) using Python scripting?


I am trying to know a material name from its'part instance' of ABAQUS ODB file. As of now i know how to get the particular instance name, I put the code below. Please let me know how to access it. I have gone through abaqus scripting guide manual but i was not able to find out. The thing is that we may input numerable materials property names in Model Data Base(mdb)file but do not assign it to the materials. So we can get what we want easily by accessing the ODB FILE.

instance1 = odb.rootAssembly.instances['instance_name']

Thank you for your time in advance


Solution

  • In Abaqus, in order to use a material, you must do the following:

    1. Create a section by defining the section name and the material name.
    2. Assign a section to some part of the model by creating a section assignment.

    Therefore, to retrieve all materials assigned to any part of an instance, you need to:

    1. Find all section assignments defined on the instance level.
    2. Identify the section used for the section assignment and look up the section.
    3. Retrieve the material name from the section.

    Section assignments can exist on assembly, part, and instance levels. Since you are talking about instances, I'm going to concentrate on that.

    odb = session.odbs[yourOdbName]
    
    root_assembly = odb.rootAssembly
    sections = odb.sections
    
    instance_name = 'yourInstanceName'
    section_assignments = root_assembly.instances[instance_name].sectionAssignments
    materials = []
    
    for section_assignment in section_assignments:
        section_name = section_assignment.sectionName
        section = sections[section_name]
        materials.append(section.material)
    

    The list materials should now contain the materials you are looking for.

    For more details on scripting access to these objects, consult chapters "44.1 SectionAssignment object" and "46.1 Section object" in the Abaqus 6.14 documentation; or the appropriate chapters from the Abaqus version you are using.