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

Rohith Patchigolla
Rohith Patchigolla Member, Moderator, Employee Posts: 206
100 Comments 25 Answers Second Anniversary 25 Likes
✭✭✭✭

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

Tagged:

Answers

  • Rohith Patchigolla
    Rohith Patchigolla Member, Moderator, Employee Posts: 206
    100 Comments 25 Answers 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.

    import mech_dpf
    import Ans.DataProcessing as dpf
    my_data_sources = dpf.DataSources(Model.Analyses[0].ResultFileName)
    
    scope_op1 = dpf.operators.scoping.on_property(requested_location = "Elemental", property_name = "mapdl_element_type",property_id= 186,data_sources = my_data_sources)
    outputIds1 = scope_op1.outputs.mesh_scoping.GetData()
    print(outputIds1)
    
    scope_op2 = dpf.operators.scoping.on_property(requested_location = "Elemental", property_name = "keyopt_2",property_id= 1,data_sources = my_data_sources)
    outputIds2 = scope_op2.outputs.mesh_scoping.GetData()
    print(outputIds2)
    
    op_intersection = dpf.operators.scoping.intersect() # operator instantiation
    op_intersection.inputs.scopingA.Connect(scope_op1)
    op_intersection.inputs.scopingB.Connect(scope_op2)
    scoping_intersection = op_intersection.outputs.intersection.GetData()
    print(scoping_intersection)