How can I get the centroid of multiple edges,
I have two questions below,
Is there a way to get edge loops similar to the “extend to limits” function? I need to use the counts in edge loops for further development.
How can I get the centroid of multiple edges, similar to the edges summary in selection information?
I could use ExtAPI.UserInterface.GetPane to get this information, but it might be slower than accessing it directly with GeoData.
Answers
-
Hi
- To use the extend limit and adjacent tools see this:
- ExtAPI.UserInterface.GetPane :
I do not think that works for Selection Information (only way I know is to use jscript and export info to text file). There is a post here in the forum on this. (https://discuss.ansys.com/discussion/3394/how-do-i-fetch-selection-information-data-in-mechanical)
To do it manually get all centroids and calculate the average to get the overall centroid of all perhaps
Hope this helps
0 -
Hi Erik,
Thanks for your quick response:)
As I know, the DoGraphicsAdjacentSelectRecursive(ExtAPI) must interact with the GUI, and its performance is lower than running in the background.
So is there other alternative that can replace DoGraphicsAdjacentSelectRecursive(ExtAPI)?
If my understanding above is incorrect, please feel free to correct me.0 -
See the Bolt Tools Add on in Mechanical. Load it and use the console to see the app directory.
In the app directory there is a file: GeoConnectivityHelper.py
This module will help get connected edges and faces so you can work with them as a 'zone' concept (multiple connected entities).
One of the methods on the zone classes is GetCentroid(), which will calculate the centroid of the zone (code is all there). No need for the UI to be open or to read info from UI controls.
0 -
Hi Mike,
Thank you for your suggestion. I took some time to understand the content in GeoConnectivityHelper.py and executed the code below. However, it still doesn’t seem to retrieve the correct centroid of these three edges.
I wonder if my code might be incorrect or used in the wrong way. Could you please give me some suggestions if there’s anything wrong? Thanks!
0