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

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
100 Answers 500 Comments 250 Likes First Anniversary
✭✭✭✭

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

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭

    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()