Search code examples
pythoncompositesectionsabaqus

Changing The names in the abaqus using python


I want to define a new name for every section and section assignment by defining a loop in python.

for i in range(numberofgrain):
    mysection = myModel.HomogeneousSolidSection(
                  material='Composite',
                  name=mySection[i],
                  thickness=None)

for example mySection1, mySection2,...for different parts of the model. Does anyone know how to do it?

Thanks in advance.


Solution

  • Don't know Abaqus, but it looks like your syntax should be

    mysection = []
    for i in range(numberofgrain):
        mysection.append(myModel.HomogeneousSolidSection(name='mySection[{}]'.format(i), material='Composite', thickness=None))
    

    or, if you are feeling adventurous,

    mysection = [myModel.HomogeneousSolidSection(name='mySection[{}]'.format(i), material='Composite', thickness=None) for i in range(numberofgrain)]
    

    Edit: - patched updating of mySection[i] names.