add_modeling_region#
- Layer.add_modeling_region(project: str, modeling_regions: list[dict[str, bool | float | str | dict[str, bool | float | str] | dict[str, float | str]]]) int #
Add one or more modeling regions to a specific project.
- Parameters:
project (str) – Name of the Sherlock project.
modeling_regions (list[dict[str, bool | float | str | dict[str, bool | float | str] | dict[str, float | str]]]) –
Modeling regions to add. Each dictionary should contain:
- cca_name: str
Name of the CCA.
- region_id: str
Unique region ID of the modeling region.
- region_units: str
Units of the modeling region.
- model_mode: str
Mode that specifies how the region is used. Valid values are
Enabled
,Disabled
andExcluded
.
- shape: PolygonalShape|RectangularShape|SlotShape|CircularShape|PCBShape
The shape of the modeling region.
- pcb_model_props: dict[str, bool | float | str]
PCB model parameters consisting of these properties:
- export_model_type: str
The type of model to be generated for a given modeling region. Valid values are
Default
,Sherlock
,Sweep
andNone
.
- elem_order: str
The type of 3D elements to be created for the PCB in the modeling region. Valid values are
First_Order
,Second_Order
andSolid_Shell
.
- max_mesh_size: float
The maximum size of the mesh to be used in the region.
- max_mesh_size_units: str
Units for the maximum mesh size.
- quads_preferred: bool
Whether to generate quad-shaped elements when creating the mesh if true.
- trace_model_props: dict[str, float | str]
Trace model parameters consisting of these properties:
- trace_model_typestr
The specification of whether trace modeling should be performed within the region. Valid values are
Default
,Enabled
andDisabled
.
- elem_order: str, optional
The type of 3D elements to be created for the PCB in the modeling region. Valid values are
First_Order
,Second_Order
andSolid_Shell
.
- trace_mesh_sizefloat, optional
The maximum mesh size to be used in the region when trace modeling is enabled.
- trace_mesh_size_units: str, optional
Units for the maximum mesh size when trace modeling is enabled.
- Returns:
Status code of the response. 0 for success.
- Return type:
int
Examples
>>> from ansys.sherlock.core.launcher import launch_sherlock >>> sherlock = launch_sherlock() >>> sherlock.project.import_odb_archive( "ODB++ Tutorial.tgz", True, True, True, True, project="Tutorial Project", cca_name="Card", ) >>> modeling_regions = [ { "cca_name": "Card", "region_id": "Region001", "region_units": "mm", "model_mode": "Enabled", "shape": PolygonalShape(points=[ (0, 0), (0, 6.35), (9.77, 0) ], rotation=87.8), "pcb_model_props": { "export_model_type": "Sherlock", "elem_order": "First_Order", "max_mesh_size": 0.5, "max_mesh_size_units": "mm", "quads_preferred": True }, "trace_model_props": { "trace_model_type": "Enabled", "elem_order": "Second_Order", "trace_mesh_size": 0.3, "trace_mesh_size_units": "mm" } } ] >>> result = sherlock.layer.add_modeling_region("Tutorial Project", modeling_regions)