Electronics

Electronics

Topics related to HFSS, Maxwell, SIwave, Icepak, Electronics Enterprise and more.

How to change property of a given layer in a python script

    • psquadrito
      Subscriber
      Hi everybody.
      I'm currently tring to write a python script to change the properties of one (or more) layer in HFSS 3D layout.
      According to the documentation the function to use is ChangeLayer(). This function seems to work only if i give as a input the full stackup including the additional layers(symbols, posprocessing....and so on).
      For a 2 layer stackup means something like this:
       
      oEditor.ChangeLayers(
          [
              "NAME:layers",
              "Mode:="        , "Laminate",
              [
                  "NAME:pps"
              ],
              [
                  "NAME:stackup layer",
                  "Name:="        , "Top Layer",
                  "ID:="          , 1,
                  "Type:="        , "signal",
                  "Top Bottom:="      , "top",
                  "Color:="       , 255,
                  "Transparency:="    , 60,
                  "Pattern:="     , 1,
                  "VisFlag:="     , 127,
                  "Locked:="      , False,
                  "DrawOverride:="    , 0,
                  "Zones:="       , [],
                  [
                      "NAME:Sublayer",
                      "Thickness:="       , "0.0502mm",
                      "LowerElevation:="  , "0.0027021",
                      "Roughness:="       , "0um",
                      "BotRoughness:="    , "0um",
                      "SideRoughness:="   , "0um",
                      "Material:="        , "copper",
                      "FillMaterial:="    , "air"
                  ]
              ],
              [
                  "NAME:stackup layer",
                  "Name:="        , "Bottom Layer",
                  "ID:="          , 41,
                  "Type:="        , "signal",
                  "Top Bottom:="      , "bottom",
                  "Color:="       , 16711680,
                  "Transparency:="    , 60,
                  "Pattern:="     , 1,
                  "VisFlag:="     , 127,
                  "Locked:="      , False,
                  "DrawOverride:="    , 0,
                  "Zones:="       , [],
                  [
                      "NAME:Sublayer",
                      "Thickness:="       , "0.0502mm",
                      "LowerElevation:="  , "2.54e-05",
                      "Roughness:="       , "0um",
                      "BotRoughness:="    , "0um",
                      "SideRoughness:="   , "0um",
                      "Material:="        , "copper",
                      "FillMaterial:="    , "air"
                  ]
              ],
              [
                  "NAME:layer",
                  "Name:="        , "Measures",
                  "ID:="          , 45,
                  "Type:="        , "measures",
                  "Top Bottom:="      , "neither",
                  "Color:="       , 4144959,
                  "Transparency:="    , 60,
                  "Pattern:="     , 1,
                  "VisFlag:="     , 127,
                  "Locked:="      , False,
                  "DrawOverride:="    , 0
              ],
              [
                  "NAME:layer",
                  "Name:="        , "SIwave Regions",
                  "ID:="          , 44,
                  "Type:="        , "siwavehfsssolverregions",
                  "Top Bottom:="      , "neither",
                  "Color:="       , 8355711,
                  "Transparency:="    , 60,
                  "Pattern:="     , 1,
                  "VisFlag:="     , 127,
                  "Locked:="      , False,
                  "DrawOverride:="    , 0
              ],
              [
                  "NAME:layer",
                  "Name:="        , "Outline",
                  "ID:="          , 43,
                  "Type:="        , "outline",
                  "Top Bottom:="      , "neither",
                  "Color:="       , 0,
                  "Transparency:="    , 60,
                  "Pattern:="     , 1,
                  "VisFlag:="     , 127,
                  "Locked:="      , False,
                  "DrawOverride:="    , 0
              ],
              [
                  "NAME:layer",
                  "Name:="        , "Rats",
                  "ID:="          , 46,
                  "Type:="        , "rat",
                  "Top Bottom:="      , "neither",
                  "Color:="       , 16711680,
                  "Transparency:="    , 60,
                  "Pattern:="     , 1,
                  "VisFlag:="     , 0,
                  "Locked:="      , False,
                  "DrawOverride:="    , 0
              ],
              [
                  "NAME:layer",
                  "Name:="        , "Errors",
                  "ID:="          , 47,
                  "Type:="        , "error",
                  "Top Bottom:="      , "neither",
                  "Color:="       , 255,
                  "Transparency:="    , 60,
                  "Pattern:="     , 2,
                  "VisFlag:="     , 127,
                  "Locked:="      , True,
                  "DrawOverride:="    , 0
              ],
              [
                  "NAME:layer",
                  "Name:="        , "Symbols",
                  "ID:="          , 48,
                  "Type:="        , "symbol",
                  "Top Bottom:="      , "neither",
                  "Color:="       , 8323199,
                  "Transparency:="    , 60,
                  "Pattern:="     , 0,
                  "VisFlag:="     , 127,
                  "Locked:="      , False,
                  "DrawOverride:="    , 0
              ],
              [
                  "NAME:layer",
                  "Name:="        , "Postprocessing",
                  "ID:="          , 49,
                  "Type:="        , "postprocessing",
                  "Top Bottom:="      , "neither",
                  "Color:="       , 9017384,
                  "Transparency:="    , 60,
                  "Pattern:="     , 1,
                  "VisFlag:="     , 127,
                  "Locked:="      , False,
                  "DrawOverride:="    , 0
              ]
          ])
       
      What i would like to do is set one properties of one layer. Something like this:
       
      oEditor.ChangeLayers(
          [
              "NAME:layers",
              "Mode:="        , "Laminate",
              [
                  "NAME:pps"
              ],
              [
                  "NAME:stackup layer",
                  "Name:="        , "Top Layer",
                  "ID:="          , 1,
                  "Type:="        , "signal",
                  "Top Bottom:="      , "top",
                  "Color:="       , 255,
                  "Transparency:="    , 60,
                  "Pattern:="     , 1,
                  "VisFlag:="     , 127,
                  "Locked:="      , False,
                  "DrawOverride:="    , 0,
                  "Zones:="       , [],
                  [
                      "NAME:Sublayer",
                      "Thickness:="       , "0.0502mm",
                      "LowerElevation:="  , "0.0027021",
                      "Roughness:="       , "0um",
                      "BotRoughness:="    , "0um",
                      "SideRoughness:="   , "0um",
                      "Material:="        , "copper",
                      "FillMaterial:="    , "air"
                  ]
              ]
          ])
      However if i try this way the function gives a very general error.
      According to the documentation it should be possible to do this but i cannot succeed.
      What is the recommended way?
    • Praneeth
      Ansys Employee

      Hi psquadrito,

      Thank you for reaching to us and we appreciate your patience.

      Please note that PyAEDT comes under open source, so we would like to advise you to post in Git Hub under discussions. You can post your query in the following link - Discussions · pyansys/pyaedt · GitHub.

      All the very best,
      Praneeth.

    • psquadrito
      Subscriber

      This has nothing to do with PyAEDT. I'm talking about the native HFSS python API

    • Praneeth
      Ansys Employee

      Hi,

      Did you try recording the script while doing the required task and see how it is recorded in the script? This can help you to troubleshoot if required.

      All the very best,
      Praneeth.

    • psquadrito
      Subscriber

      Yes, the code pasted above is coming from a recorded script and it requires the full stackup as input, even if i just want to change properties of only one layer. According to the documentation seems possible (see picture below).



      Maybe i'm just misunderstanding the docs and the function only accept the fullstackup as input. In this case what would be the best way to use the ChangeLayers() function?

    • Praneeth
      Ansys Employee

      Hi,

      We appreciate your patience and regret for the delay in updating you.

      Change layer function is not only to update the parameters of a single layer, but it can be used to update the properties of all the defined layers. It is equivalent to opening the Layer stackup. Hence, you need to add the details of the whole stackup for updating the single layer.

      Best regards,
      Praneeth.

    • psquadrito
      Subscriber

      How can i fetch the details of all the layers in a format compatible with the input of the ChangeLayers function?

    • Praneeth
      Ansys Employee

      I did not get you. Can you please elaborate more?

    • psquadrito
      Subscriber

      ChangeLayers function need as input parameter the details of all the layer in the stackup in a compatible format. Is there an API that i can use to get this informations?

    • Praneeth
      Ansys Employee

      Yes you can get the format for a full stack up layer definition. Are you aware of recording script option provided in the Automation tab? You can use that option and open the edit layer option in the UI. Do the modifications as required and close the window. You can stop the script and open it to see how it is implemented. This script you can modify by simply running the updated script.

      Best regards,
      Praneeth.

    • psquadrito
      Subscriber

      As i have already mentioned earlier the code pasted above is coming from a recorded script. This however do not help me because the recorded script will work only on a specific case and only with the same stackup. If i want to create a general purpose script i have to find a way to get the stackup details while the script is running.

      It is a simple yes or no answer. If yes i would like to know what is the function that returns the stackup details, if no i will have to loop through the layers and get the info from there

Viewing 10 reply threads
  • The topic ‘How to change property of a given layer in a python script’ is closed to new replies.