TAGGED: 3D-layout, ansys-hfss, api, python, python-ironpython, python-scripting, python-scripts
-
-
August 2, 2022 at 2:04 pm
psquadrito
SubscriberHi 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? -
August 8, 2022 at 12:41 pm
Praneeth
Ansys EmployeeHi 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. -
August 23, 2022 at 9:51 am
psquadrito
SubscriberThis has nothing to do with PyAEDT. I'm talking about the native HFSS python API
-
August 23, 2022 at 12:56 pm
Praneeth
Ansys EmployeeHi,
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. -
August 23, 2022 at 1:09 pm
psquadrito
SubscriberYes, 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? -
September 7, 2022 at 6:56 am
Praneeth
Ansys EmployeeHi,
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. -
September 7, 2022 at 8:35 am
psquadrito
SubscriberHow can i fetch the details of all the layers in a format compatible with the input of the ChangeLayers function?
-
September 7, 2022 at 8:38 am
Praneeth
Ansys EmployeeI did not get you. Can you please elaborate more?
-
September 7, 2022 at 8:50 am
psquadrito
SubscriberChangeLayers 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?
-
September 7, 2022 at 9:02 am
Praneeth
Ansys EmployeeYes 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. -
September 7, 2022 at 9:10 am
psquadrito
SubscriberAs 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
-
- The topic ‘How to change property of a given layer in a python script’ is closed to new replies.
- Y wiring method and the start and end points of winding.
- Lumped Port Deembed
- Optimizing Via Impedance in Ansys HFSS 3D Layout Using Geometric Parameter Sweep
- Hfss 3D pcb via capped and filled with epoxy
- AEDT Natural Convection with default correlation is failing solver initializatio
- HFSS libnvidia-ml.so too old or could not be found – Warning in slurm job output
- Three-Phase Voltage Imbalances in dual stator electric generator
- STL Import Errors in HFSS After Cleaning in SpaceClaim
- Calc Error in Field Calculator after PyAEDT Analyze
- import file autocad 3d
-
3882
-
1414
-
1241
-
1118
-
1015
© 2025 Copyright ANSYS, Inc. All rights reserved.