+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion doc/source/api/utility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@ Classes
value.Value
edb_error_manager.EDBErrorSeverity
edb_error_manager.EDBError
edb_error_manager.get_error_messages
edb_error_manager.get_error_messages


Enums
-----

.. autosummary::
:toctree: _autosummary

heat_sink.HeatSinkFinOrientation
hfss_extent_info.HFSSExtentInfoType
hfss_extent_info.OpenRegionType
layer_map.LayerMapUniqueDirection
10 changes: 7 additions & 3 deletions src/ansys/edb/core/layout/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
from ansys.edb.core.primitive.primitive import Primitive
from ansys.edb.core.session import StubAccessor, StubType
from ansys.edb.core.simulation_setup.simulation_setup import SimulationSetup
from ansys.edb.core.utility.hfss_extent_info import HfssExtentInfo
from ansys.edb.core.utility.hfss_extent_info import (
HfssExtentInfo,
HFSSExtentInfoType,
OpenRegionType,
)
from ansys.edb.core.utility.temperature_settings import TemperatureSettings
from ansys.edb.core.utility.value import Value

Expand Down Expand Up @@ -93,11 +97,11 @@ def primitive_helper(msg):
},
"HfssExtentsType": {
"msg": _translate_hfss_extents_enums,
"val": HfssExtentInfo.HFSSExtentInfoType,
"val": HFSSExtentInfoType,
},
"HfssExtentsOpenRegionType": {
"msg": _translate_hfss_extents_enums,
"val": HfssExtentInfo.OpenRegionType,
"val": OpenRegionType,
},
}

Expand Down
32 changes: 19 additions & 13 deletions src/ansys/edb/core/utility/conversions.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
"""This module performs conversions from arbitrary user input to explicit types."""
from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ansys.edb.core.typing import ValueLike, PointLike, Point3DLike

from ansys.api.edb.v1.edb_messages_pb2 import ValueMessage

from ansys.edb.core.geometry import point3d_data, point_data
from ansys.edb.core.utility import value


def to_value(val):
"""Take a value implicitly convertible to a ``Value``type and return as a ``Value`` type.
def to_value(val: ValueLike) -> value.Value:
"""Take a value implicitly convertible to a :class:`.Value` type and return as a :class:`.Value` type.

Parameters
----------
val : ansys.edb.core.typing.ValueLike
val : :term:`ValueLike`

Returns
-------
:class:`.Value`
.Value
"""
if isinstance(val, value.Value):
return val
Expand All @@ -26,16 +33,16 @@ def to_value(val):
)


def to_point(val):
"""Take a value implicitly convertible to a ``PointData`` type and return as a ``PointData`` type.
def to_point(val: PointLike) -> point_data.PointData:
"""Take a value implicitly convertible to a :class:`.PointData` type and return as a :class:`.PointData` type.

Parameters
----------
val : ansys.edb.core.typing.PointLike
val : :term:`Point2DLike`

Returns
-------
:class:`.PointData`
.PointData
"""
if isinstance(val, point_data.PointData):
return val
Expand All @@ -50,17 +57,16 @@ def to_point(val):
)


def to_point3d(val):
"""Convert a value to a ``Point3DData`` object.
def to_point3d(val: Point3DLike) -> point3d_data.Point3DData:
"""Take a value implicitly convertible to a :class:`.Point3DData` type and return as a :class:`.Point3DData` type.

Parameters
----------
val : Point3DData, tuple[:term:`ValueLike`,:term:`ValueLike`,:term:`ValueLike`]
Value to convert.
val : :term:`Point3DLike`

Returns
-------
:class:`.Point3DData`
.Point3DData
"""
if isinstance(val, point3d_data.Point3DData):
return val
Expand Down
38 changes: 29 additions & 9 deletions src/ansys/edb/core/utility/heat_sink.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
"""Heat sink."""
from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ansys.edb.core.typing import ValueLike

from enum import Enum

Expand All @@ -16,7 +22,8 @@ class HeatSinkFinOrientation(Enum):


class HeatSink:
"""Represents a heat sink.
"""Represents a heat sink, a three-dimensional modeling component \
that can exchange radiation with other objects in the model.

Attributes
----------
Expand All @@ -28,20 +35,33 @@ class HeatSink:
Base elevation of the the heat sink.
fin_height : :term:`ValueLike`
Fin height of the heat sink.
fin_orientation : HeatSinkFinOrientation
fin_orientation : .HeatSinkFinOrientation
Fin orientation of the heat sink if it is not set to the X axis.

"""

def __init__(
self,
fin_thickness=0,
fin_spacing=0,
fin_base_height=0,
fin_height=0,
fin_orientation=HeatSinkFinOrientation.X_ORIENTED,
fin_thickness: ValueLike = 0,
fin_spacing: ValueLike = 0,
fin_base_height: ValueLike = 0,
fin_height: ValueLike = 0,
fin_orientation: HeatSinkFinOrientation = HeatSinkFinOrientation.X_ORIENTED,
):
"""Initialize a heat sink object using given values."""
"""Initialize a heat sink object using given values.

Parameters
----------
fin_thickness : :term:`ValueLike`
Fin thickness of the heat sink.
fin_spacing : :term:`ValueLike`
Fin spacing of the heat sink.
fin_base_height : :term:`ValueLike`
Base elevation of the the heat sink.
fin_height : :term:`ValueLike`
Fin height of the heat sink.
fin_orientation : .HeatSinkFinOrientation
Fin orientation of the heat sink if it is not set to the X axis.
"""
self.fin_thickness = conversions.to_value(fin_thickness)
self.fin_spacing = conversions.to_value(fin_spacing)
self.fin_base_height = conversions.to_value(fin_base_height)
Expand Down
Loading
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载