Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.

Ansys Learning Forum Forums AIS Japan 構造 全てのボディに内容の異なるコマンドを設定したい Reply To: 全てのボディに内容の異なるコマンドを設定したい

yasuhiro.ogawa.j4a
Subscriber

Thank you for your response. Based on your comments, I was able to accomplish what I wanted to do. FYI, I am attaching the code.

# Creating the content to write in the command
mat_list = []
for i in range(1, 100):
    mat_list.append("mat{}".format(i))

# Creating the command and writing the contents
for num in range(1, 100):

    treeBody = Model.Geometry.Children[0].Children[num-1]  
    cs = treeBody.AddCommandSnippet()
    cs.AppendText(mat_list[num-1])

[bingo_chatbox]