We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.

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?

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:
  1. Detect which label was clicked and get its labelID?
  2. Remove the line that connects the label and the Point?
  3. Temporary hide some of the labels?

I already checked the source code but couldn't find anything.