How can I define thermal fluid behavior to beam bodies in Mechanical through scripting?

Options
Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 813
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
edited June 2023 in Structures

Using ACT, how can I loop through all the bodies in the Mechanical tree, and change the model type for all beam bodies to "thermal fluid" ?

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 813
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options

    Here is a script that will loop through all bodies and parts in the tree and change the model type for all beam bodies :

        geodata=ExtAPI.DataModel.Project.Model.Analyses[0].GeoData
        geo = ExtAPI.DataModel.Project.Model.Geometry
        for i in range(len(geodata.Assemblies[0].Parts)):
            for j in range(len(geodata.Assemblies[0].Parts[i].Bodies)):
                bodygeo=geo.Children[i].Children[j]
                bodygeodata=geodata.Assemblies[0].Parts[i].Bodies[j]         
                if str(bodygeodata.BodyType)=='GeoBodyWire':
                    bodygeo.ModelType=PrototypeModelType.ModelPhysicsTypeFluid