You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose a project has many variables, such as a DOE. In that case, exporting the geometry for each variation of the DOE becomes slow using the current method of applying one variable at a time using a for loop.
Steps for implementing the feature
def set_multiple_variables(design_variables, project_variables=None):
"""
Updates design and project variables in the HFSS (High Frequency Structure Simulator) application.
Parameters:
-----------
design_variables : dict
A dictionary where keys are the names of design variables, and values are their respective values.
Example: {"Width": "5mm", "Height": "10mm"}
project_variables : dict, optional
A dictionary where keys are the names of project variables, and values are their respective values.
If not provided, only the design variables are updated.
Returns:
--------
None
The method modifies the variables directly in the HFSS application via the `ChangeProperty` method.
Notes:
------
- The method updates the "LocalVariables" tab for design variables.
- If `project_variables` is provided, it updates the "ProjectVariables" tab as well.
- This function assumes the presence of a global `hfss_app` object that interfaces with the HFSS application.
- The HFSS `ChangeProperty` API method is used to apply the updates.
- Potential issues could arise if variable names in the dictionaries are invalid or if the dictionaries are not formatted correctly.
Examples:
---------
# Example to set design variables only
set_all_variables_at_once({"Width": "10mm", "Height": "20mm"})
# Example to set both design and project variables
set_all_variables_at_once({"Width": "10mm", "Height": "20mm"}, {"$dielectric_constant_L1": "3.3", "$dielectric_constant_L2": "4.1"})
"""
local_variables = ["NAME:AllTabs",
["NAME:LocalVariableTab", ["NAME:PropServers", "LocalVariables"], ["NAME:ChangedProps"]]]
for key in design_variables.keys():
local_variables[1][2].append(["NAME:" + key, "Value:=", design_variables[key]])
hfss_app.odesign.ChangeProperty(local_variables)
if project_variables:
project_vars = ["NAME:AllTabs",
["NAME:ProjectVariableTab", ["NAME:PropServers", "ProjectVariables"], ["NAME:ChangedProps"]]]
for key in design_variables.keys():
project_vars[1][2].append(["NAME:" + key, "Value:=", project_variables[key]])
hfss_app.odesign.ChangeProperty(local_variables)
Useful links and references
No response
The text was updated successfully, but these errors were encountered:
Description of the feature
Suppose a project has many variables, such as a DOE. In that case, exporting the geometry for each variation of the DOE becomes slow using the current method of applying one variable at a time using a for loop.
Steps for implementing the feature
def set_multiple_variables(design_variables, project_variables=None):
"""
Updates design and project variables in the HFSS (High Frequency Structure Simulator) application.
Useful links and references
No response
The text was updated successfully, but these errors were encountered: