How to use selection logic in dpf in Mechanical? Example, select Solid186 elements with keyopt(2)=1?

Member, Moderator, Employee Posts: 242
50 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭

How to use selection logic in dpf in Mechanical? Example, select Solid186 elements with keyopt(2)=1?

Tagged:

Answers

  • Member, Moderator, Employee Posts: 242
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    The below code will help to get the scoping based on intersection between all elements with name SOLID186 and all the elements with Keyoption(2) = 1, getting all Solid186 elements with Keyopt(2) = 1.

    1. import mech_dpf
    2. import Ans.DataProcessing as dpf
    3. my_data_sources = dpf.DataSources(Model.Analyses[0].ResultFileName)
    4.  
    5. scope_op1 = dpf.operators.scoping.on_property(requested_location = "Elemental", property_name = "mapdl_element_type",property_id= 186,data_sources = my_data_sources)
    6. outputIds1 = scope_op1.outputs.mesh_scoping.GetData()
    7. print(outputIds1)
    8.  
    9. scope_op2 = dpf.operators.scoping.on_property(requested_location = "Elemental", property_name = "keyopt_2",property_id= 1,data_sources = my_data_sources)
    10. outputIds2 = scope_op2.outputs.mesh_scoping.GetData()
    11. print(outputIds2)
    12.  
    13. op_intersection = dpf.operators.scoping.intersect() # operator instantiation
    14. op_intersection.inputs.scopingA.Connect(scope_op1)
    15. op_intersection.inputs.scopingB.Connect(scope_op2)
    16. scoping_intersection = op_intersection.outputs.intersection.GetData()
    17. print(scoping_intersection)

Welcome!

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