


{"id":394250,"date":"2024-11-19T10:57:23","date_gmt":"2024-11-19T10:57:23","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/394250\/"},"modified":"2024-11-19T10:57:23","modified_gmt":"2024-11-19T10:57:23","slug":"394250","status":"publish","type":"reply","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/394250\/","title":{"rendered":"Reply To: How to add annotations or probes using python in Mechanical 2020 version?"},"content":{"rendered":"<p>&lt;div&gt;It seems my other reply disappeared, so here it is again.&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;defResult = ExtAPI.DataModel.Project.Model.Analyses[0].Solution.Children[1]&lt;\/div&gt;&lt;div&gt;ds=ExtAPI.DataModel.InternalObject[&#8220;ds&#8221;]&lt;\/div&gt;&lt;div&gt;labelID=ds.Graphics.AddLabel(defResult.ObjectId, 520, &#8220;DeformResult&#8221;, 0.024, 0.004136, 0.0082857, 0x0000ff)&lt;\/div&gt;&lt;div&gt;# Arguments are: ObjectID, classID(520 for result), X_coor, Y_coor, Z_coor, color&lt;\/div&gt;&lt;div&gt;# This just creates an annotation probe with text &#8220;DeformResult&#8221; not the value of a result at that location&lt;\/div&gt;&lt;div&gt;ExtAPI.Graphics.Redraw()&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;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.&lt;\/div&gt;&lt;div&gt;So basically, is it possible to:&lt;\/div&gt;&lt;div&gt;<\/p>\n<ol>\n<li>Detect which label was clicked and get its labelID?<\/li>\n<li>Remove the line that connects the label and the Point?<\/li>\n<li>Temporary hide some of the labels?<\/li>\n<\/ol>\n<p>&lt;p&gt;I already checked the source code but couldn&#8217;t find anything.&lt;\/p&gt;&lt;\/div&gt;<\/p>\n","protected":false},"template":"","class_list":["post-394250","reply","type-reply","status-publish","hentry"],"aioseo_notices":[],"acf":[],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies\/394250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/reply"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies\/394250\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=394250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}