Ansys Learning Forum › Forums › Discuss Simulation › General Mechanical › How to add annotations or probes using python in Mechanical 2020 version? › Reply To: How to add annotations or probes using python in Mechanical 2020 version?
November 19, 2024 at 10:57 am
hallinenjesse
Subscriber
It seems my other reply disappeared, so here it is again.
Â
defResult = ExtAPI.DataModel.Project.Model.Analyses[0].Solution.Children[1]
ds=ExtAPI.DataModel.InternalObject["ds"]
labelID=ds.Graphics.AddLabel(defResult.ObjectId, 520, "DeformResult", 0.024, 0.004136, 0.0082857, 0x0000ff)
# Arguments are: ObjectID, classID(520 for result), X_coor, Y_coor, Z_coor, color
# This just creates an annotation probe with text "DeformResult" not the value of a result at that location
ExtAPI.Graphics.Redraw()
Â
The code above worked pretty well for our use case, because we only needed labels with some custom text, but now I got asked if we can edit those labels some more.
So basically, is it possible to:
- Detect which label was clicked and get its labelID?
- Remove the line that connects the label and the Point?
- Temporary hide some of the labels?
I already checked the source code but couldn't find anything.