ANSYS mechanical version 2021r2 & 2023R1
Is there any good way to use code check if a geometry is Visible? The geometries include the body\face\edge.
Hi ZZ.tang! For example, like this:
# body: Ansys.ACT.Automation.Mechanical.Body body = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.Body)[0] isBodyVisible = body.Visible body.Visible = True # Show body body.Visible = False # Hide body # part: Ansys.ACT.Automation.Mechanical.Part part = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.Part)[0] isPartVisible = part.Visible part.Visible = True # Show part part.Visible = False # Hide part
Hello
not sure what the question is here (perhaps there is none )?
If you are having any issues with the script, or u would like to ask something, please expand and explain a bit more in detail and we will then try and help.
thank you
Erik
My question> @AlexGh said:
Hi ZZ.tang! For example, like this: # body: Ansys.ACT.Automation.Mechanical.Body body = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.Body)[0] isBodyVisible = body.Visible body.Visible = True # Show body body.Visible = False # Hide body # part: Ansys.ACT.Automation.Mechanical.Part part = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.Part)[0] isPartVisible = part.Visible part.Visible = True # Show part part.Visible = False # Hide part
Thanks AlexGh Eric,
let me try to explain my question more clearly. I'm trying to use "DataModel.GeoData.GeoEntityById(geoid)" to get a "Ansys.ACT.Common.Geometry.GeoBodyWrapper \ GeoFaceWrapper \GeoEdgeWrapper" I want to know if the Geo****Wrapper has been hidden in GUI.
Or is there any good way to check if a "Geo****Wrapper" is belonging to a "DataModelObjectCategory"
Thanks!
Hi
A geobody does not have such property (check if visible - see below link on the difference between the 2 bodies which can be confusing)
One can though combine the above script, and getting the Tree body from a Geo body , and then checking if the Tree body is visible or not (above script).
(see below the difference between the two type of bodies and how to obtain them)
https://discuss.ansys.com/discussion/2288/whats-the-difference-between-tree-geometry-and-geodata-in-mechanical-api
All the best
@Erik Kostson said: Hi A geobody does not have such property (check if visible - see below link on the difference between the 2 bodies which can be confusing) One can though combine the above script, and getting the Tree body from a Geo body , and then checking if the Tree body is visible or not (above script). (see below the difference between the two type of bodies and how to obtain them) https://discuss.ansys.com/discussion/2288/whats-the-difference-between-tree-geometry-and-geodata-in-mechanical-api All the best Erik
@Erik Kostson said: Hi
Thanks Erik, this is very helpful for me.