diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index a6c5381647..fb76358685 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -33,9 +33,10 @@ jobs: runs-on: ubuntu-latest steps: - name: PyAnsys documentation style checks - uses: ansys/actions/doc-style@v5 + uses: ansys/actions/doc-style@v8 with: token: ${{ secrets.GITHUB_TOKEN }} + vale-version: "2.29.6" smoke-tests: name: Build and Smoke tests diff --git a/pyproject.toml b/pyproject.toml index 7b96e6957d..f9cd16bd8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi" [project] # Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections name = "ansys-edb-core" -version = "0.1.8" +version = "0.1.9" description = "A python wrapper for Ansys Edb service" readme = "README.rst" requires-python = ">=3.8" @@ -26,7 +26,7 @@ classifiers = [ # FIXME: add ansys-api-edb version dependencies = [ - "ansys-api-edb==1.0.9", + "ansys-api-edb==1.0.10", "protobuf>=3.19.3,<5", "grpcio>=1.44.0" ] diff --git a/src/ansys/edb/core/geometry/polygon_data.py b/src/ansys/edb/core/geometry/polygon_data.py index e99908f8dc..fb0092b89f 100644 --- a/src/ansys/edb/core/geometry/polygon_data.py +++ b/src/ansys/edb/core/geometry/polygon_data.py @@ -109,7 +109,7 @@ def arc_data(self): h, incr = 0, 1 p1, p2 = self.points[i], self.points[(i + incr) % n] if p2.is_arc: - h, incr = p2.arc_height, 2 + h, incr = p2.arc_height.double, 2 p2 = self.points[(i + incr) % n] segments.append(ArcData(p1, p2, height=h)) i += incr @@ -225,9 +225,9 @@ def has_self_intersections(self, tol=1e-9): messages.polygon_data_with_tol_message(self, tol) ).value - @parser.to_polygon_data + @parser.to_polygon_data_list def remove_self_intersections(self, tol=1e-9): - """Create a polygon with all self-intersections removed. + """Remove self-intersections from this polygon. Parameters ---------- @@ -236,7 +236,8 @@ def remove_self_intersections(self, tol=1e-9): Returns ------- - PolygonData + list[.PolygonData] + A list of non self-intersecting polygons. """ return self.__stub.RemoveSelfIntersections( messages.polygon_data_with_tol_message(self, tol) @@ -302,7 +303,7 @@ def scale(self, factor, center): PolygonData """ return self.__stub.Transform( - messages.polygon_data_transform_message("scale", factor, center) + messages.polygon_data_transform_message("scale", self, factor, center) ) @parser.to_polygon_data diff --git a/src/ansys/edb/core/hierarchy/component_group.py b/src/ansys/edb/core/hierarchy/component_group.py index 103fe2adb8..28c22b19e5 100644 --- a/src/ansys/edb/core/hierarchy/component_group.py +++ b/src/ansys/edb/core/hierarchy/component_group.py @@ -29,7 +29,7 @@ class ComponentGroup(Group): __stub: ComponentGroupServiceStub = StubAccessor(StubType.component_group) @classmethod - def create_with_component(cls, layout, name, comp_name): + def create(cls, layout, name, comp_name): """Create a component group with a component. Parameters diff --git a/src/ansys/edb/core/inner/messages.py b/src/ansys/edb/core/inner/messages.py index 0ebf319c78..442a42d7ec 100644 --- a/src/ansys/edb/core/inner/messages.py +++ b/src/ansys/edb/core/inner/messages.py @@ -202,7 +202,7 @@ def point_property_message(target, point): def point_data_rotate_message(point, center, angle): """Convert to a ``PointRotateMessage`` object.""" return PointDataRotateMessage( - point=point_message(point), rotation_center=point_message(center), angle=angle + point=point_message(point), rotate_center=point_message(center), rotate_angle=angle ) @@ -260,9 +260,9 @@ def polygon_data_pair_with_tolerance_message(pd1, pd2, tol): ) -def _polygon_data_transform_message_point_value(point, value): +def _polygon_data_transform_message_point_value(val, point): """Convert to a ``PolygonDataTransformMessage`` object.""" - return PolygonDataTransformMessage.PointValueMessage(point=point_message(point), value=value) + return PolygonDataTransformMessage.PointValueMessage(point=point_message(point), value=val) def polygon_data_transform_message(op, pd, *args): @@ -310,7 +310,7 @@ def polygon_data_with_points_message(pd, point=None, polygon=None): elif polygon is not None: payload["polygon"] = polygon_data_message(polygon) - return PolygonDataWithPointsMessage(polygon=polygon_data_message(pd), **payload) + return PolygonDataWithPointsMessage(target=polygon_data_message(pd), **payload) def polygon_data_expand_message(pd, offset, tol, round_corner, max_corner_expansion): @@ -481,7 +481,7 @@ def transform_message(transform): else: return TransformMessage( scale=value_message(transform.scale), - angle=value_message(transform.angle), + angle=value_message(transform.rotation), mirror=transform.mirror, offset_x=value_message(transform.offset_x), offset_y=value_message(transform.offset_y), @@ -502,9 +502,9 @@ def point3d_message(point3d): return Point3DMessage(x=value_message(x), y=value_message(y), z=value_message(z)) -def point_3d_property_message(target, value): +def point_3d_property_message(target, val): """Convert to a ``Point3DPropertyMessage`` object.""" - return Point3DPropertyMessage(target=edb_obj_message(target), origin=point3d_message(value)) + return Point3DPropertyMessage(target=edb_obj_message(target), value=point3d_message(val)) def layout_get_items_message(layout, item_type): @@ -543,14 +543,14 @@ def temperature_settings_message(settings): ) -def hfss_extent_message(val): +def hfss_extent_message(hfss_val): """Convert to an ``ExtentMessage`` object.""" - if type(val) == float or type(val) == int: - value = val + if type(hfss_val) == float or type(hfss_val) == int: + val = hfss_val absolute = False else: - value, absolute = val - return HfssExtentMessage(value=value, absolute=absolute) + val, absolute = hfss_val + return HfssExtentMessage(value=val, absolute=absolute) def hfss_extent_info_message(hfss_info): @@ -722,7 +722,7 @@ def primitive_edge_params_message(primitive, point): def pad_edge_params_message(padstack_instance, layer, arc): """Convert to a ``PadEdgeParamsMessage`` object.""" return PadEdgeParamsMessage( - padstack_instance=padstack_instance.msg, + padstack=padstack_instance.msg, layer=layer_ref_message(layer), arc=arc_message(arc), ) @@ -932,13 +932,6 @@ def net_ref_message(net): return NetRefMessage(id=edb_obj_message(net.msg if net is not None else 0)) -def adaptive_frequency_message(frequency: str, max_delta_s: float, max_passes: int): - """Convert to an ``AdaptiveFrequencyDataMessage`` object.""" - return AdaptiveFrequencyDataMessage( - adaptive_frequency=frequency, max_delta=str(max_delta_s), max_passes=max_passes - ) - - def _length_mesh_operation_message(mesh_op): return LengthMeshOperationMessage( max_length=mesh_op.max_length, @@ -1097,15 +1090,17 @@ def differential_pair_creation_message(layout, name, pos_net, neg_net): return DifferentialPairCreationMessage( layout=edb_obj_message(layout), name=name, - pos_net=net_ref_message(pos_net), - neg_net=net_ref_message(neg_net), + positive_net=net_ref_message(pos_net), + negative_net=net_ref_message(neg_net), ) def differential_pair_net_refs_message(dp, pos_net, neg_net): """Convert to a ``DifferentialPairNetRefsMessage`` object.""" return DifferentialPairNetRefsMessage( - dp=edb_obj_message(dp), pos_net=net_ref_message(pos_net), neg_net=net_ref_message(neg_net) + dp=edb_obj_message(dp), + positive_net=net_ref_message(pos_net), + negative_net=net_ref_message(neg_net), ) diff --git a/src/ansys/edb/core/layout/layout.py b/src/ansys/edb/core/layout/layout.py index 197d166375..f8f986febf 100644 --- a/src/ansys/edb/core/layout/layout.py +++ b/src/ansys/edb/core/layout/layout.py @@ -273,7 +273,7 @@ def zone_primitives(self): This property is read-only. """ - return [Primitive(msg) for msg in self.__stub.GetZonePrimitives(self.msg)] + return [Primitive(msg).cast() for msg in self.__stub.GetZonePrimitives(self.msg).items] @property def fixed_zone_primitive(self): @@ -464,3 +464,51 @@ def snap_primitives(self, layer, tol="0.05um", check_connectivity=True): self.__stub.SnapPrimitives( _geometry_simplifications_settings_with_option_msg(self, layer, tol, check_connectivity) ) + + def create_mesh_region( + self, + xy_exp, + pos_z_exp, + neg_z_exp, + use_active_nets, + incl_ref, + ext, + num_x_partitions, + num_y_partitions, + ): + """Designate a mesh region in a design and create partitions for simulation. + + Parameters + ---------- + xy_exp: :class:`.Value` + Horizontal padding on both sides of the new mesh. + pos_z_exp: :class:`.Value` + Vertical padding above the new mesh region. + neg_z_exp: :class:`.Value` + Vertical padding below the new mesh region. + use_active_nets: bool + True will create a new mesh region defined by the active nets in the design. + False will create a new mesh region defined by the dielectric extents in the design. + incl_ref: bool + True will include bot positive nets and reference nets in the definition of the new mesh region. + False will not include bot positive nets and reference nets. + ext: :class:`.ExtentType` + Geometry extent type. + num_x_partitions: int + Number of partitions to create on x axis in the new mesh region. + num_y_partitions: int + Number of partitions to create on y axis in the new mesh region. + """ + self.__stub.CreateMeshRegion( + layout_pb2.CreateMeshRegionMessage( + layout=self.msg, + xy_exp=messages.value_message(xy_exp), + pos_z_exp=messages.value_message(pos_z_exp), + neg_z_exp=messages.value_message(neg_z_exp), + use_active_nets=use_active_nets, + incl_ref=incl_ref, + ext=ext.value, + num_x_partitions=num_x_partitions, + num_y_partitions=num_y_partitions, + ) + ) diff --git a/src/ansys/edb/core/primitive/primitive.py b/src/ansys/edb/core/primitive/primitive.py index e661120302..69cc029e33 100644 --- a/src/ansys/edb/core/primitive/primitive.py +++ b/src/ansys/edb/core/primitive/primitive.py @@ -618,7 +618,8 @@ def set_parameters(self, center_x, center_y, radius): ) ) - def get_polygon_data(self): + @property + def polygon_data(self): """:class:`.PolygonData`: \ Polygon data object of the circle.""" return Circle.render(*self.get_parameters(), self.is_void) @@ -1220,22 +1221,24 @@ def set_traj(self, x1, y1, x2, y2): Parameters ---------- x1 : :class:`.Value` - X value of the the start point. + X value of the start point. y1 : :class:`.Value` - Y value of the the start point. + Y value of the start point. x2 : :class:`.Value` - X value of the the end point. + X value of the end point. y2 : :class:`.Value` Y value of the end point. """ self.__stub.SetTraj( - target=self.msg, - traj=bondwire_pb2.BondwireTrajMessage( - x1=messages.value_message(x1), - y1=messages.value_message(y1), - x2=messages.value_message(x2), - y2=messages.value_message(y2), - ), + bondwire_pb2.SetBondwireTrajMessage( + target=self.msg, + traj=bondwire_pb2.BondwireTrajMessage( + x1=messages.value_message(x1), + y1=messages.value_message(y1), + x2=messages.value_message(x2), + y2=messages.value_message(y2), + ), + ) ) @property @@ -1512,7 +1515,7 @@ def solderball_layer(self, solderball_layer): padstack_instance_pb2.PadstackInstSetSolderBallLayerMessage( target=self.msg, layer=solderball_layer.msg, - )(self, solderball_layer) + ) ) @property diff --git a/src/ansys/edb/core/simulation_setup/simulation_settings.py b/src/ansys/edb/core/simulation_setup/simulation_settings.py index 83faad67ac..5593e67d90 100644 --- a/src/ansys/edb/core/simulation_setup/simulation_settings.py +++ b/src/ansys/edb/core/simulation_setup/simulation_settings.py @@ -226,6 +226,15 @@ def via_material(self): def via_material(self, via_material): self.__stub.SetViaMaterial(messages.string_property_message(self, via_material)) + @property + def mesh_for_via_plating(self): + """:obj:`bool`: Flag indicating if meshing for via plating is enabled.""" + return self.__stub.GetMeshForViaPlating(self.msg).value + + @mesh_for_via_plating.setter + def mesh_for_via_plating(self, mesh_for_via_plating): + self.__stub.SetMeshForViaPlating(messages.bool_property_message(self, mesh_for_via_plating)) + @property def model_type(self): """:class:`.ModelType`: model type.""" diff --git a/tests/e2e/scratch/sim_setup_scratch.py b/tests/e2e/scratch/sim_setup_scratch.py index 51772e6f44..c4a1334783 100644 --- a/tests/e2e/scratch/sim_setup_scratch.py +++ b/tests/e2e/scratch/sim_setup_scratch.py @@ -141,6 +141,10 @@ def do_advanced_test(settings: HFSSAdvancedSettings): settings.via_material = "new_via_material" new_via_material = settings.via_material + og_mesh_via_plating = settings.mesh_for_via_plating + settings.mesh_for_via_plating = not og_mesh_via_plating + new_mesh_via_plating = settings.mesh_for_via_plating + og_ic_mode_auto_resolution = settings.ic_mode_auto_resolution settings.ic_mode_auto_resolution = not og_ic_mode_auto_resolution new_ic_mode_auto_resolution = settings.ic_mode_auto_resolution