How to set bodies transparent in Mechanical?

Options
Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 409
First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
edited June 2023 in Structures

How to set bodies transparent in Mechanical?

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 409
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    Answer ✓
    Options

    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: 65
    First Anniversary Ansys Employee First Answer Name Dropper
    Answer ✓
    Options

    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: 409
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    Answer ✓
    Options

    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