[英]How to fix this loop error in python for abaqus?
I created an abaqus model with different parts and each part has the same node numbering. 我创建了一个包含不同部分的abaqus模型,并且每个部分具有相同的节点编号。 I'm trying to make a set that contains all nodes with labale of 180. I wrote this loop but it takes just the the last part's node.
我正在尝试制作一个包含所有Labale为180的节点的集合。我编写了此循环,但它仅包含最后一部分的节点。 How can I correct this script to take all nodes with label of 180 from all parts?
如何更正此脚本以从各个部分获取所有标签均为180的节点?
for j in range(1,n):
mdb.models['Model-1'].rootAssembly.SetFromNodeLabels(nodeLabels=(('part-'+str(j), (180, )), ), name='SETofNode180')
Through every iteration of the for loop a new node set is created and overwrites any existing node set. 通过for循环的每次迭代,都会创建一个新的节点集并覆盖任何现有的节点集。 That's why you're only seeing one node set which contains a single node from the last part in your list.
这就是为什么您只看到一个列表中最后一部分包含一个节点的节点集的原因。
You should construct a list of node labels separately and then call SetFromNodeLabels
once, passing it a list of all the node labels. 您应该分别构造一个节点标签列表,然后一次调用
SetFromNodeLabels
,并将所有节点标签的列表传递给它。
nodeLabels = []
for j in range(1,n):
nodeLabels.append( ('part-'+str(j), (180, )) )
mdb.models['Model-1'].rootAssembly.SetFromNodeLabels(nodeLabels=nodeLabels, name='SETofNode180')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.