xtremi
Structural
- Jul 27, 2018
- 10
I am trying to create a plugin for Ansys Mechanical in Workbench 19.0, and I am doing so using the .NET API in a mix of C# and C++/CLI project.
Part of the plugin is to extract a lot of information form an analysis. It took me a long time to figure out how to set up my environment, but I'm finally able to read Analysis Settings, mesh and much more.
Unfortunately, now I'm stuck on specific problem;
If an analysis has a pressure load applied to a geometric face, I can retrieve an object of the [tt]Pressure[/tt] class. This class has a property [tt]Location[/tt] which is an interface class [tt]ISelectionInfo[/tt]. From there I can access a set of Ids.
Using the [tt]IMeshData[/tt] interface class of the analysis, I get the [tt]IMeshRegion[/tt] of the specific Ids using the method [tt]MeshRegionById(int id)[/tt]. This allows me to retrieve the elements on which the pressure is applied using the property [tt]ElementsIds[/tt] of [tt]IMeshRegion[/tt].
Now I have the elements, but I also need to know which faces the pressure is applied on.
The [tt]IMeshRegion[/tt] interface has these 4 methods:
In my example case I'm working on, the pressure load is applied to a geometric face, where the mesh attached to it are quadratic solid elements (20 noded).
By calling the GetFaces() method, I will receive an array of face ids, but it holds all the face ids (each face of each elements) not the face ids of where the pressure load is applied.
In the API Reference Guide, i found an Interface class [tt]IMechanicalSelectionInfo[/tt] which is derived from the [tt]ISelectionInfoClass[/tt]. That class has a property called [tt]ElementFaceIndices[/tt].
But I don't see how to access it. The [tt]Pressure[/tt] class only returns a [tt]ISelectionInfo[/tt] for the property [tt]Location[/tt].
So I guess my question is, given an [tt]IMeshRegion[/tt], how can I know which element faces belong to this region?
Thanks for any feedback!
Part of the plugin is to extract a lot of information form an analysis. It took me a long time to figure out how to set up my environment, but I'm finally able to read Analysis Settings, mesh and much more.
Unfortunately, now I'm stuck on specific problem;
If an analysis has a pressure load applied to a geometric face, I can retrieve an object of the [tt]Pressure[/tt] class. This class has a property [tt]Location[/tt] which is an interface class [tt]ISelectionInfo[/tt]. From there I can access a set of Ids.
Using the [tt]IMeshData[/tt] interface class of the analysis, I get the [tt]IMeshRegion[/tt] of the specific Ids using the method [tt]MeshRegionById(int id)[/tt]. This allows me to retrieve the elements on which the pressure is applied using the property [tt]ElementsIds[/tt] of [tt]IMeshRegion[/tt].
Now I have the elements, but I also need to know which faces the pressure is applied on.
The [tt]IMeshRegion[/tt] interface has these 4 methods:
Code:
void GetFaces(Int32[]& param1, Int32[]& param2, Int32[]& param3, Int32[]& param4)
Int32[] GetTri3ExteriorFaces()
Int32[] GetTri6ExteriorFaces()
Int32[] GetQuad4ExteriorFaces()
Int32[] GetQuad8ExteriorFaces()
In my example case I'm working on, the pressure load is applied to a geometric face, where the mesh attached to it are quadratic solid elements (20 noded).
By calling the GetFaces() method, I will receive an array of face ids, but it holds all the face ids (each face of each elements) not the face ids of where the pressure load is applied.
In the API Reference Guide, i found an Interface class [tt]IMechanicalSelectionInfo[/tt] which is derived from the [tt]ISelectionInfoClass[/tt]. That class has a property called [tt]ElementFaceIndices[/tt].
But I don't see how to access it. The [tt]Pressure[/tt] class only returns a [tt]ISelectionInfo[/tt] for the property [tt]Location[/tt].
So I guess my question is, given an [tt]IMeshRegion[/tt], how can I know which element faces belong to this region?
Thanks for any feedback!