add_modeling_region#

Layer.add_modeling_region(project: str, modeling_regions: List[Dict[str, str | float | bool | dict]])#

Add one or more modeling regions to a specific project.

Parameters:
  • project (str) – Name of the Sherlock project.

  • modeling_regions (list of dict) –

    List of modeling regions to add. Each dictionary should contain:

    • cca_namestr

      Name of the CCA.

    • region_idstr

      Unique region ID of the modeling region.

    • region_unitsstr

      Units of the modeling region.

    • model_modestr

      Mode that specifies how the region is used. Valid values are Enabled, Disabled and Excluded.

    • shape: PolygonalShape|RectangularShape|SlotShape|CircularShape|PCBShape

      The shape of the modeling region.

    • pcb_model_propslist

      List of the PCB model parameters consisting of these properties:

      • export_model_typestr

        The type of model to be generated for a given modeling region. Valid values are Default, Sherlock, Sweep and None.

      • 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 and Solid_Shell.

      • max_mesh_sizefloat

        The maximum size of the mesh to be used in the region.

      • max_mesh_size_unitsstr

        Units for the maximum mesh size.

      • quads_preferredbool

        Whether to generate quad-shaped elements when creating the mesh if true.

    • trace_model_propslist

      List of the 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 and Disabled.

      • 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 and Solid_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)