How do I find a Face's TOPOID using C# / IronPython?
Ayush Kumar
Member, Moderator, Employee Posts: 468
✭✭✭✭
Answers
-
C#
Please add reference to “Ansys.Common.Interop.221.dll” and “Ansys.Mechanical.DataModel.dll” in the C# project.
- using Ansys.Common.Interop.DSPartMgr;
- using Ansys.ACT.Common.Geometry;
- public void Test()
- {
- var geo = _api.DataModel.GeoData as GeometryWrapper;
- var pm = geo.InternalObject;
- uint partId = 3; // Part ID
- uint id = 9; // Reference ID of the face
- var mgr = pm as IPmPartMgr;
- var part = mgr.get_PartById(partId);
- var topoID = part.GetTopoId(id);
- }
Python
- import clr
- clr.AddReference("Ansys.Common.Interop.212")
- api = ExtAPI
- geo = api.DataModel.GeoData
- pm = geo.InternalObject
- partId = 3
- id = 34 # Replace face’s reference ID
- part = Ansys.Common.Interop.DSPartMgr.IPmPartMgr.get_PartById(pm, partId)
- topoId = part.GetTopoId(id)
- print topoId
2