Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.

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.

[bingo_chatbox]