Is there any good way to use code check if the geometry is Visible?
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.
Comments
-
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
0 -
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
0 -
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!
0 -
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)
All the best
Erik
1 -
@Erik Kostson said:
HiA 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)
All the best
Erik
Thanks Erik, this is very helpful for me.
1