In Mechanical scripting how can I create a Named Selection that is scoped to a list of node numbers?

Member, Employee, GitHub-issue-creator Posts: 353
50 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭
edited June 2023 in Structures

I have a list of node numbers in a CSV file. I would like to create a named selection with the node numbers, so that I can visualize where are these nodes located at the mesh.

Is this possible with Mechanical Scripting?

Tagged:

Answers

  • Member, Employee, GitHub-issue-creator Posts: 353
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    1. nodeIDs = [1,3,9]
    2. ns = ExtAPI.DataModel.Project.Model.AddNamedSelection()
    3. ns.ScopingMethod = ns.ScopingMethod.Worksheet
    4. for nodeID in nodeIDs:
    5.   criterion=Ansys.ACT.Automation.Mechanical.NamedSelectionCriterion()
    6.   criterion.Action= criterion.Action.Add
    7.   criterion.EntityType = criterion.EntityType.MeshNode
    8.   criterion.Criterion = criterion.Criterion.NodeNumber
    9.   criterion.Operator = criterion.Operator.Equal
    10.   criterion.Value = nodeID
    11.   ns.GenerationCriteria.Add(criterion)
    12. ns.Generate()

Welcome!

It looks like you're new here. Sign in or register to get started.