How to set bodies transparent in Mechanical?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 444
250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
✭✭✭✭
edited June 2023 in Structures

How to set bodies transparent in Mechanical?

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 444
    250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
    ✭✭✭✭
    Answer ✓

    From 2021R1 onwards:

    transparency = body.PropertyByName("Transparency")
    # Change the value from 0-1, 1 being opaque, 0 being completely transparent.
    transparency.InternalValue = 0.5
    
  • Aria
    Aria Member, Employee Posts: 67
    Ansys Employee Photogenic First Anniversary 25 Answers
    ✭✭✭✭
    Answer ✓

    The transparency property is added for 2021 R1. Do we have a js method for 2020R2 and older?

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 444
    250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
    ✭✭✭✭
    Answer ✓

    For previous versions (from Landon Kanner's TIG post):

    DS = ExtAPI.DataModel.InternalObject["ds"] 
    bodies = ExtAPI.DataModel.Project.Model.Geometry.GetChildren[Ansys.ACT.Automation.Mechanical.Body](True)
    DS.Graphics.Drawable(bodies[0].InternalObject).Material.Transparency = 0.5