GetPropNames and GetPropValues for Layered Impedance Boundary Script

The following example script used Object Oriented commands to GetPropName for a Layered Impedance Boundary, and then use the names to use GetPropValue for those properties.

' ----------------------------------------------

' Script Recorded by Ansys Electronics Desktop Version 2022.1.0

' 14:55:18 Oct 25, 2022

' ----------------------------------------------

Option Explicit

test_layered_impedance()

Sub test_layered_impedance()

Dim oAnsoftApp

Dim oDesktop

Dim oProject

Dim oDesign

Dim oEditor

Dim oModule

Dim oBoundaries

Dim Layered_Boundaries

Dim single_boundary

Dim oBoundary

Dim Get_Boundary_Properties

Dim Layer_Name

Dim Layer_Type

Dim Layer_Roughness

Dim Layer_Inf_Ground_Plane

Dim Layer_Two_Sided

Dim Layer_Shell_Element

Dim Layer_Number_of_Layers

Dim Layer_L1_Thickness

Dim Layer_L1_Material

Dim Layer_L2_Thickness

Dim Layer_L2_Material

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop.2022.1")

Set oDesktop = oAnsoftApp.GetAppDesktop()

oDesktop.RestoreWindow

Set oProject = oDesktop.SetActiveProject("test1")

Set oDesign = oProject.SetActiveDesign("HFSSDesign1")

Set oModule = oDesign.GetModule("BoundarySetup")

 

Set oBoundaries = oDesign.GetChildObject("Boundaries")

Layered_Boundaries = oModule.GetBoundariesOfType("Layered Impedance")

For Each single_boundary In Layered_Boundaries

Set oBoundary = oBoundaries.GetChildObject(single_boundary)

'Get_Boundary_Properties = oBoundary.GetPropNames()

Layer_Name = oBoundary.GetPropValue("Name")

Layer_Type = oBoundary.GetPropValue("Type")

Layer_Roughness = oBoundary.GetPropValue("Roughness")

Layer_Inf_Ground_Plane = oBoundary.GetPropValue("Inf Ground Plane")

Layer_Two_Sided = oBoundary.GetPropValue("Two sided")

Layer_Shell_Element = oBoundary.GetPropValue("Shell Element")

Layer_Number_of_Layers = oBoundary.GetPropValue("Number of Layers")

Layer_L1_Thickness = oBoundary.GetPropValue("Layer 1/Thickness")

Layer_L1_Material = oBoundary.GetPropValue("Layer 1/Material")

Layer_L2_Thickness = oBoundary.GetPropValue("Layer 2/Thickness")

Layer_L2_Material = oBoundary.GetPropValue("Layer 2/Material")

MsgBox ("Name = " & Layer_Name & vbNewLine _

& "Type = " & Layer_Type & vbNewLine _

& "Roughness = " & Layer_Roughness & vbNewLine _

& "Inf Ground = " & Layer_Inf_Ground_Plane & vbNewLine _

& "Two-Sided = " & Layer_Two_Sided & vbNewLine _

& "Shell Element = " & Layer_Shell_Element & vbNewLine _

& "Number of Layers = " & Layer_Number_of_Layers & vbNewLine _

& "Layer 1 Thickness = " & Layer_L1_Thickness & vbNewLine _

& "Layer 1 Material = " & Layer_L1_Material & vbNewLine _

& "Layer 2 Thickness = " & Layer_L2_Thickness & vbNewLine _

& "Layer 2 Material = " & Layer_L2_Material)

Next

End Sub