How can I set Independent Bands on Legends in Mechanical?

Member, Moderator, Employee Posts: 481
100 Answers 250 Likes 100 Comments Second Anniversary
✭✭✭✭
edited June 2023 in Structures

How can I set Independent Bands on Legends in Mechanical?

Tagged:

Best Answer

  • Member, Moderator, Employee Posts: 481
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭
    Answer ✓

    I couldn't find a direct function but an alternative can be to just set the colors of the first and the last legend color band to the default ones we get via Mechanical GUI. Used the UInt32 Number for the colors:

    1. legend_setting.SetBandColor(legend_setting.NumberOfBands - 1, 16724940)
    2. legend_setting.SetBandColor(0, 6723993)

    If anyone has a better method, please share.

Answers

  • Member Posts: 2
    First Comment
    **

    I'd also like to know how to do the independent bands. The method above does set the upper and lower color bands to the same colors as independent bands, but at the expense of losing the blue and red bands. While it probably could be scripted to automatically replace the colors in between with the standard rainbow, being able to actually set the independent bands would be even better!

Welcome!

It looks like you're new here. Sign in or register to get started.