QPyaedt#

class QPyaedt(design: QDesign, renderer_type: str, project_name: str | None = None, design_name: str | None = None, initiate=False, options: Dict | None = None)[source]#

Will fill this out later.

_summary_

Parameters:
  • design (QDesign) – Use QGeometry within either QDesign or MultiPlanar design to obtain elements for Ansys.

  • renderer_type (str) – Choose string from list [‘HFSS_DM’, ‘HFSS_EM’, ‘Q3D’] for the type of design to insert into project.

  • project_name (Union[str, None], optional) – Give a name, or one will be made based on class name of renderer. Defaults to None.

  • design_name (Union[str, None], optional) – Give a name, or one will be made based on class name of renderer. Defaults to None.

  • initiate (bool, optional) – True to initiate the renderer. Defaults to False.

  • options (Dict, optional) – Used to override all options. Defaults to None.

Attributes

GROUPS = ['Non Model', 'Solids', 'Unclassified', 'Sheets', 'Lines']#
NAME_DELIM = '_'#

Name delimiter

default_options = {'Cj': 0, 'Lj': 1e-08, 'begin_disable_autosave': True, 'close_enable_autosave': True, 'sample_holder_bottom': '-1.2mm', 'sample_holder_top': '1.2mm', 'x_buffer_width_mm': 0.25, 'y_buffer_width_mm': 0.25}#

Default options

default_setup = {}#

Default setup.

design#

Return a reference to the parent design object.

desktop#

Access to hidden variable for Ansys desktop.

Returns:

easier reference to pyaedt desktop.

Return type:

pyaedt.desktop.Desktop

element_extensions = {}#

Element extensions dictionary

element_table_data = {'junction': {'capacitance': 0, 'inductance': 1e-08}, 'path': {'wire_bonds': False}}#

Element table data.

logger#

Returns the logger.

name = 'base'#

Name

options#

Options for the QRenderer.

renderer_types = ['HFSS_DM', 'HFSS_EM', 'Q3D']#

Methods

activate_user_project_design()[source]#

If Ansys is not started, then start using the project and name defined by user. Otherwise, activate the project and design that user chose. It appears that pyaedt can identify the project, if needed, we can pro-actively activate the project.

add_endcaps(layer_open_pins_list: list, layer_num: int, endcap_str: str = 'endcap')[source]#

Add a list of end-caps for open pins for a specific layer ONLY. This method ASSUMES there is something in open_pins list. This method ASSUMES that the components and corresponding pins are within design. This method ASSUMES the list already corresponds to the layer number. This method wil make a sublist of open_pins for each the layer_num passed.

Parameters:
  • open_pins (list) – list of tuples with (component name , pin name) JUST for the layer passed to this method.

  • layer_num (int) – The layer which the end-caps should be on.

  • endcap_str (str) – Used to name the geometry when rendered to Ansys.

add_fillet_linestring(qgeom: Series, points_3d: list, qc_fillet: float, a_polyline: pyaedt.modeler.Primitives.Polyline)[source]#

Determine the idx of Polyline vertices to fillet and fillet them.

Parameters:
  • qgeom (pd.Series) – One row from QGeometry table._

  • points_3d (list) – Each entry is list of x,y,z vertex.

  • qc_fillet (float) – Radius of fillet value

  • a_polyline (pyaedt.modeler.Primitives.Polyline) – A pyaetd primitive used for linestring from qgeometry table.

add_linestring_width(qc_width: float, a_polyline: pyaedt.modeler.Primitives.Polyline, points_3d: list, material: str) pyaedt.modeler.Primitives.Polyline[source]#

Determine the orthogonal vector. Then sweep along a_polyline using qc_width. Then return the reference to new polyline with sweep in Ansys.

Parameters:
  • qc_width (float) – The width of polyline to generate.

  • a_polyline (pyaedt.modeler.Primitives.Polyline) – The center of desired polyline.

  • points_3d (list) – [[x0,y0,z0], ….[xn,yn,zn]] List of list of points used for a_polyline.

  • material (str) – The material to widen.

Returns:

Reference to polyline that was widened.

Return type:

pyaedt.modeler.Primitives.Polyline

add_one_endcap(comp_name: str, pin_name: str, layer: int, endcap_str: str = 'endcap')[source]#

Create a rectangle, then add thickness and denote to be subtracted for open pin.

Parameters:
  • comp_name (str) – Component which has the open pin.

  • pin_name (str) – Name of pin which in open within the component.

  • layer (int) – The layer which the user choose to put the component on.

  • endcap_str (str) – Used to name the geometry when rendered to Ansys.

add_table_data_to_QDesign(class_name: str)#

During init of renderer, this needs to happen. In particular, each renderer needs to update custom columns and values within QDesign.

Parameters:

class_name (str) – Name from cls.name for each renderer.

aedt_render_by_layer_then_tables(open_pins: list | None, port_list: list | None, jj_to_port: list | None, ignored_jjs: list | None, skip_junction: bool = False, data_type: int = 0)[source]#
auto_wirebonds(table)[source]#

Adds wirebonds to the Ansys model for path elements where; subtract = True and wire_bonds = True.

Uses render options for determining of the: * wb_threshold – the minimum distance between two vertices of a path for a wirebond to be added. * wb_offset – offset distance for wirebond placement (along the direction of the cpw) * wb_size – controls the width of the wirebond (wb_size * path[‘width’])

chip_designation_error()[source]#

Warning message that appears when the Ansys renderer fails to locate a component’s chip designation. Provides instructions for a temporary workaround until the layer stack is finalized.

chip_not_main()[source]#

Warning message that appears when a component’s chip designation is not ‘main’. As of 05/10/21, all chip designations should be ‘main’ until the layer stack is finalized. Provides instructions for a temporary workaround until the layer stack is finalized.

clean_user_design()[source]#

Clean the user project and design corresponding to the current_app

Args: None

Returns: None

close()[source]#

Alias of _close_renderer()

Returns:

True

Return type:

bool

confirm_open_pins_are_valid_names(open_pins: list, pair_used: list) bool[source]#

Check if all names of components and corresponding pins are within design. Otherwise log an error

Parameters:
  • open_pins (list) – The user input for open_pins.

  • pair_used (list) – Passed to multiple checks to ensure (component_name, pin) are not accidentally reused.

Returns:

True if all components and pins found in design.

False if any one component or pin is not found in design.

Return type:

bool

create_fill_true_box()[source]#

Create 3D box used for both fill and or as a subtract box for geometries when subtract==True from qgeometry table.

disconnect_ansys()[source]#

Disconnect Ansys. In future, may want this to behave differently.

force_exit_ansys()[source]#

This will allow user to force closing of Ansys.

get_chip_names() List[str][source]#

Obtain a list of chips on which the selection of components, if valid, resides.

Returns:

Chips to render.

Return type:

List[str]

get_open_pins_in_layer(open_pins: list, layer_num: int) list[source]#

Reduce the open_pins list and only return the open_pins for layer_nums.

Parameters:
  • open_pins (list) – The list given by user for render_design.

  • layer_num (int) – The layer number being rendered.

Returns:

A subset of open_pins for the denoted layer_num.

Return type:

list

static get_renderer(name: str)#

Returns an already loaded and instantiated renderer.

Parameters:

name (str) – rendering name

Returns:

Renderer with the given name

Return type:

QRenderer

classmethod get_template_options(design: QDesign, render_template: Dict = None, logger_: Logger = None, template_key: str = None) Dict#

Creates template options for the Metal QRenderer class required for the class to function, based on the design template; i.e., be created, made, and rendered. Provides the blank option structure required.

The options can be extended by plugins, such as renderers.

Parameters:
  • design (QDesign) – A design class.

  • render_template (Dict, optional) – Template options to overwrite the class ones. Defaults to None.

  • logger (logging.Logger, optional) – A logger for errors. Defaults to None.

  • template_key (str, optional) – The design.template_options key identifier. If None, then use _get_unique_class_name(). Defaults to None.

Returns:

Dictionary of renderer’s default options based on design.template_options.

Return type:

Dict

get_unique_component_ids(highlight_qcomponents: list | None = None) Tuple[list, int]#

Confirm the list doesn’t have names of components repeated. Confirm that the name of component exists in QDesign. If QDesign doesn’t contain any component, or if all components in QDesign are found in highlight_qcomponents, return an empty list; otherwise return a list of unique components to be sent to the renderer. The second returned item, an integer, specifies which of these 3 cases applies.

Parameters:

highlight_qcomponents (Union[list, None], optional) – Components to render. Defaults to None.

Returns:

Tuple: Empty or partial list of components in QDesign.
int: 0 subset selected

1 every component selected 2 invalid

Return type:

Tuple[list, int]

initialized()[source]#

Abstract method. Must be implemented by the subclass. Is renderer ready to be used? Implementation must return boolean True if successful. False otherwise.

classmethod load()#

Load the renderer and register all its extensions. Only performed once.

Once complete, the renderer is added to the class attribute ‘__loaded_renderers__’ of QRenderer

Returns:

True if success, otherwise throws an error.

Return type:

bool

open_pin_names_not_valid(comp_name: str, pin_name: str)[source]#

Stop and give error if the component name or pin name from open_pins are not valid within design.

Parameters:
  • comp_name (str) – Name of component which should have an open pin.

  • pin_name (str) – Name of pin which should be open.

parse_value(value: Any | List | Dict | Iterable) Any#

Same as design.parse_value. See design for help.

Returns:

Parsed value of input.

Return type:

object

classmethod populate_element_extensions()#

Populate cls.element_extensions which will be used to create columns for tables in QGeometry tables.

The structure of cls.element_table_data should be same as cls.element_extensions.

populate_project_and_design()[source]#

Add project and design based on user input.

render_chip(chip_name: str, draw_sample_holder: bool)[source]#

Render individual chips.

Parameters:
  • chip_name (str) – Name of chip.

  • draw_sample_holder (bool) – Option to draw vacuum box around chip.

render_chips(draw_sample_holder: bool = True, box_plus_buffer: bool = True)[source]#

Render all chips containing components in self.qcomp_ids.

Parameters:
  • draw_sample_holder (bool, optional) – Option to draw vacuum box around chip. Defaults to True.

  • box_plus_buffer (bool, optional) – Whether or not to use a box plus buffer. Defaults to True.

render_component(component)[source]#

Abstract method. Must be implemented by the subclass. Render the specified component.

Parameters:

component (QComponent) – Component to render.

render_components(table_type: str, layer_num: int, port_list: list | None, jj_to_port: list | None, ignored_jjs: list | None)[source]#

Render components by breaking them down into individual elements. Render all components of the design. If selection is none, then render all components.

Parameters:

table_type (str) – Table type (poly, path, or junction).

render_design(selection: List | None = None, box_plus_buffer: bool = True)[source]#

Must be implemented by the subclass to finish the logic for HFSS OR Q3D within project.

Renders all design chips and components. Note: This needs to be extended with additional logic for Q3D and HFSS.

render_element(qgeom: Series, is_junction: bool, port_list: list | None, jj_to_port: list | None, ignored_jjs: list | None)[source]#

Abstract method. Must be implemented by the subclass. Render the specified element

Parameters:

element (Element) – Element to render.

render_element_path(qgeom: Series)[source]#

Render one row from the qgeometry table.

Parameters:

qgeom (pd.Series) – One row from the qgeometry table.

render_element_poly(qgeom: Series)[source]#

Render a closed polygon.

Parameters:

qgeom (pd.Series) – GeoSeries of element properties.

save_screenshot(path: str | None = None, show: bool = True)[source]#

Save the screenshot.

Parameters:
  • path (str, optional) – Path to save location. Defaults to None.

  • show (bool, optional) – Whether or not to display the screenshot. Defaults to True.

Returns:

path to png formatted screenshot.

Return type:

pathlib.WindowsPath

start(force=False)#

Call any initialization (single run) step required to setup the renderer for the first execution, such as connecting to some API or COM, or importing the correct material libraries, etc.

Parameters:

force (bool) – If True, need to scrap the existing initialization and re-do If False, will start a new one only if none exists. Defaults to False.

Returns:

is the renderer initialized successfully (thus usable?)

Return type:

bool

stop()#

Any calls that one may want to make after a rendering is complete.

subtract_from_ground(layer_num: int, data_type: int = 0)[source]#

For each chip, subtract all “negative” shapes residing on its surface if any such shapes exist. Data is stored by layer, but we always assume each layer to be unique

Need to use a rectangular for each layer, which has fill, has been made as part of create_fill_true_box.

update_options(render_options: Dict | None = None, render_template: Dict | None = None)#

If template options has not been set for this renderer, then gather all the default options for children and add to design. The GUI would use this to store the template options.

Then give the template options to render to store in self.options. Then user can over-ride the render_options.

Parameters:
  • render_options (Dict, optional) – If user wants to over-ride the template options. Defaults to None.

  • render_template (Dict, optional) – All the template options for each child. Defaults to None.