Exporting elements ID of contact region

Hello, I am trying to print element ids of the contact region but it gives an error that "CONTACT_01" (name of contact region is not defined., even though I have created a contact with this name and same is present in the .inp file. Below is the code I am using. Pls give suggestions if any.

from ansys.mapdl.core import launch_mapdl

mapdl = launch_mapdl()

mapdl.input("model1_input4.inp")

mapdl.cmsel('S', 'CONTACT_01')

element_ids = mapdl.cmlist("ELEM")

print(element_ids)

Thanks

Answers

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 339
    25 Answers 100 Comments 25 Likes First Anniversary
    ✭✭✭✭
    edited October 2023

    Can you confirm you can select the component if you simply issue the APDL commands as text like:

    Mapdl.input_strings("CMSEL,S,CONTACT_01")

    https://mapdl.docs.pyansys.com/version/stable/api/_autosummary/ansys.mapdl.core.Mapdl.input_strings.html

    Also, is the component a nodal or element component? Seems from context it should be elemental?

  • Shailesh Kumar
    Shailesh Kumar Member Posts: 10
    First Comment
    **

    Hello, Thanks for your reply

    I tried using the above command but it still showing the same error.

    The exact error msg is -----------"Error in instance GRPC_127.0.0.1:50052

    SELECT COMPONENT CONTACT_01

    *** ERROR *** CP = 0.859 TIME= 09:29:52
    Component CONTACT_01 is not defined."----------

    And the component is element component and I am trying to get element ids.