How do I define a Pull(Extrude) Mesh Edit in Mechanical?

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

How do I create this object in Mechanical, through scripting?

Tagged:

Answers

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

    Adapt the following code:

    mesh = ExtAPI.DataModel.Project.Model.Mesh
    extrude = mesh.AddPullExtrude()
    extrude.Location = ExtAPI.SelectionManager.CurrentSelection # this scopes a face that is manually selected in Mechanical. Adapt this to your own needs. For robustness, using a named selection is recommended
    extrude.Height = Quantity("2[mm]")
    mesh.GenerateMesh()
    extrude.Generate()