How do I find a Face's TOPOID using C# / IronPython?

Member, Moderator, Employee Posts: 468
100 Answers 250 Likes 100 Comments Second Anniversary
✭✭✭✭
edited June 2023 in Structures

How do I find a Face's TOPOID using C# / IronPython?

enter image description here

Tagged:

Answers

  • Member, Moderator, Employee Posts: 468
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭
    Answer ✓

    C#

    Please add reference to “Ansys.Common.Interop.221.dll” and “Ansys.Mechanical.DataModel.dll” in the C# project.

    1. using Ansys.Common.Interop.DSPartMgr;
    2. using Ansys.ACT.Common.Geometry;
    3. public void Test()
    4. {
    5. var geo = _api.DataModel.GeoData as GeometryWrapper;
    6. var pm = geo.InternalObject;
    7. uint partId = 3; // Part ID
    8. uint id = 9; // Reference ID of the face
    9. var mgr = pm as IPmPartMgr;
    10. var part = mgr.get_PartById(partId);
    11. var topoID = part.GetTopoId(id);
    12. }

    Python

    1. import clr
    2. clr.AddReference("Ansys.Common.Interop.212")
    3.  
    4. api = ExtAPI
    5. geo = api.DataModel.GeoData
    6. pm = geo.InternalObject
    7.  
    8. partId = 3
    9. id = 34 # Replace face’s reference ID
    10.  
    11. part = Ansys.Common.Interop.DSPartMgr.IPmPartMgr.get_PartById(pm, partId)
    12. topoId = part.GetTopoId(id)
    13. print topoId

Welcome!

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