使用python更改abaqus中的名称

使用python更改abaqus中的名称,python,composite,sections,abaqus,Python,Composite,Sections,Abaqus,我想通过在python中定义一个循环,为每个节和节分配定义一个新名称 for i in range(numberofgrain): mysection = myModel.HomogeneousSolidSection( material='Composite', name=mySection[i], thickness=None) 例如,模型的不同部分的mySection1、m

我想通过在python中定义一个循环,为每个节和节分配定义一个新名称

for i in range(numberofgrain):
    mysection = myModel.HomogeneousSolidSection(
                  material='Composite',
                  name=mySection[i],
                  thickness=None)
例如,模型的不同部分的mySection1、mySection2等。有人知道怎么做吗


提前感谢。

我不知道Abaqus,但看起来您的语法应该是

mysection = []
for i in range(numberofgrain):
    mysection.append(myModel.HomogeneousSolidSection(name='mySection[{}]'.format(i), material='Composite', thickness=None))
或者,如果你喜欢冒险

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

编辑:-修补更新mySection[i]名称。

+注意:对于较旧的python版本,您可能需要
'mySection[{0}]
非常感谢@Hugh Bothwell。它工作得很好。@MojENG-nudge如果它解决了您的问题,您应该单击此答案旁边的复选标记以使其成为正式答案。您的意思是
name=mySection[i]
?是的,我的意思是name=mySection[i]以使mySection[1]、mySection[2]、,。。。对于模型中的不同部分。