General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Possible to customize labels added using Graphics.AddLabel in Mechanical 2020?

    • hallinenjesse
      Subscriber
      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 python code above works pretty well for our use case, because we only need 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, so that label stays in the point location like normal annotations?
      3. Temporary hide some of the labels?
      4. Or basically edit anything else than what can be seen in the above code?
    • mrife
      Ansys Employee

      Hi hallinenjesse

      The Ansys Developers Portal Forum is open to the public and you can ask scripting questions there: https://discuss.ansys.com/

      On that forum try searching for annotations then check on the 'Community Forum' box on the upper left.  Then post your questions as needed.

      Mike

Viewing 1 reply thread
  • You must be logged in to reply to this topic.