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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exclude: "tests/integration/files"
repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.12
rev: v0.13.0
hooks:
- id: ruff-check
- id: ruff-format
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/2230.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pre-commit automatic update
4 changes: 2 additions & 2 deletions src/ansys/geometry/core/_grpc/_services/v0/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

from typing import TYPE_CHECKING

import pint

from ansys.api.dbu.v0.admin_pb2 import BackendType as GRPCBackendType
from ansys.api.dbu.v0.dbumodels_pb2 import (
DrivingDimension as GRPCDrivingDimension,
Expand Down Expand Up @@ -55,6 +53,8 @@
TrimmedCurve as GRPCTrimmedCurve,
TrimmedSurface as GRPCTrimmedSurface,
)
import pint

from ansys.geometry.core.errors import GeometryRuntimeError
from ansys.geometry.core.misc.checks import graphics_required

Expand Down
2 changes: 2 additions & 0 deletions src/ansys/geometry/core/_grpc/_services/v0/faces.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def set_color(self, **kwargs) -> dict: # noqa: D102
@protect_grpc
def get_normal(self, **kwargs) -> dict: # noqa: D102
from ansys.api.geometry.v0.faces_pb2 import GetNormalRequest

from ansys.geometry.core.math.vector import UnitVector3D

# Create the request - assumes all inputs are valid and of the proper type
Expand Down Expand Up @@ -242,6 +243,7 @@ def evaluate(self, **kwargs) -> dict: # noqa: D102
@protect_grpc
def create_iso_parametric_curve(self, **kwargs) -> dict: # noqa: D102
from ansys.api.geometry.v0.faces_pb2 import CreateIsoParamCurvesRequest

from ansys.geometry.core.shapes.parameterization import Interval

# Create the request - assumes all inputs are valid and of the proper type
Expand Down
9 changes: 3 additions & 6 deletions src/ansys/geometry/core/_grpc/_services/v0/prepare_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ def extract_volume_from_edge_loops(self, **kwargs) -> dict: # noqa: D102

@protect_grpc
def remove_rounds(self, **kwargs) -> dict: # noqa: D102
from google.protobuf.wrappers_pb2 import BoolValue

from ansys.api.geometry.v0.models_pb2 import Face
from ansys.api.geometry.v0.preparetools_pb2 import RemoveRoundsRequest
from google.protobuf.wrappers_pb2 import BoolValue

# Create the request - assumes all inputs are valid and of the proper type
request = RemoveRoundsRequest(
Expand All @@ -110,10 +109,9 @@ def remove_rounds(self, **kwargs) -> dict: # noqa: D102

@protect_grpc
def share_topology(self, **kwargs) -> dict: # noqa: D102
from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue

from ansys.api.geometry.v0.models_pb2 import Body
from ansys.api.geometry.v0.preparetools_pb2 import ShareTopologyRequest
from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue

# Create the request - assumes all inputs are valid and of the proper type
request = ShareTopologyRequest(
Expand All @@ -132,10 +130,9 @@ def share_topology(self, **kwargs) -> dict: # noqa: D102

@protect_grpc
def enhanced_share_topology(self, **kwargs) -> dict: # noqa: D102
from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue

from ansys.api.geometry.v0.models_pb2 import Body
from ansys.api.geometry.v0.preparetools_pb2 import ShareTopologyRequest
from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue

# Create the request - assumes all inputs are valid and of the proper type
request = ShareTopologyRequest(
Expand Down
24 changes: 9 additions & 15 deletions src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ def __init__(self, channel: grpc.Channel):

@protect_grpc
def find_split_edges(self, **kwargs) -> dict: # noqa: D102
from google.protobuf.wrappers_pb2 import DoubleValue

from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest
from google.protobuf.wrappers_pb2 import DoubleValue

# Create the request - assumes all inputs are valid and of the proper type
request = FindSplitEdgesRequest(
Expand Down Expand Up @@ -123,9 +122,8 @@ def find_inexact_edges(self, **kwargs) -> dict: # noqa: D102

@protect_grpc
def find_short_edges(self, **kwargs) -> dict: # noqa: D102
from google.protobuf.wrappers_pb2 import DoubleValue

from ansys.api.geometry.v0.repairtools_pb2 import FindShortEdgesRequest
from google.protobuf.wrappers_pb2 import DoubleValue

# Create the request - assumes all inputs are valid and of the proper type
request = FindShortEdgesRequest(
Expand Down Expand Up @@ -170,9 +168,9 @@ def find_duplicate_faces(self, **kwargs) -> dict: # noqa: D102

@protect_grpc
def find_missing_faces(self, **kwargs) -> dict: # noqa: D102
from ansys.api.geometry.v0.repairtools_pb2 import FindMissingFacesRequest
from google.protobuf.wrappers_pb2 import DoubleValue

from ansys.api.geometry.v0.repairtools_pb2 import FindMissingFacesRequest
from ansys.geometry.core.logger import LOG

from ..base.conversions import (
Expand Down Expand Up @@ -221,9 +219,9 @@ def find_missing_faces(self, **kwargs) -> dict: # noqa: D102

@protect_grpc
def find_small_faces(self, **kwargs) -> dict: # noqa: D102
from ansys.api.geometry.v0.repairtools_pb2 import FindSmallFacesRequest
from google.protobuf.wrappers_pb2 import DoubleValue

from ansys.api.geometry.v0.repairtools_pb2 import FindSmallFacesRequest
from ansys.geometry.core.logger import LOG

from ..base.conversions import (
Expand Down Expand Up @@ -272,9 +270,9 @@ def find_small_faces(self, **kwargs) -> dict: # noqa: D102

@protect_grpc
def find_stitch_faces(self, **kwargs) -> dict: # noqa: D102
from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest
from google.protobuf.wrappers_pb2 import DoubleValue

from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest
from ansys.geometry.core.logger import LOG

from ..base.conversions import from_measurement_to_server_length
Expand Down Expand Up @@ -360,9 +358,8 @@ def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102

@protect_grpc
def find_and_fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102
from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue

from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest
from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue

from ..base.conversions import from_measurement_to_server_length

Expand Down Expand Up @@ -427,9 +424,8 @@ def repair_geometry(self, **kwargs) -> dict: # noqa: D102

@protect_grpc
def find_interferences(self, **kwargs) -> dict: # noqa: D102
from google.protobuf.wrappers_pb2 import BoolValue

from ansys.api.geometry.v0.repairtools_pb2 import FindInterferenceRequest
from google.protobuf.wrappers_pb2 import BoolValue

# Create the request - assumes all inputs are valid and of the proper type
request = FindInterferenceRequest(
Expand All @@ -453,9 +449,8 @@ def find_interferences(self, **kwargs) -> dict: # noqa: D102

@protect_grpc
def find_and_fix_short_edges(self, **kwargs): # noqa: D102
from google.protobuf.wrappers_pb2 import DoubleValue

from ansys.api.geometry.v0.repairtools_pb2 import FindShortEdgesRequest
from google.protobuf.wrappers_pb2 import DoubleValue

# Create the request - assumes all inputs are valid and of the proper type
request = FindShortEdgesRequest(
Expand Down Expand Up @@ -510,9 +505,8 @@ def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102

@protect_grpc
def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102
from google.protobuf.wrappers_pb2 import DoubleValue

from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest
from google.protobuf.wrappers_pb2 import DoubleValue

# Create the request - assumes all inputs are valid and of the proper type
request = FindSplitEdgesRequest(
Expand Down
4 changes: 2 additions & 2 deletions src/ansys/geometry/core/connection/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

from typing import TYPE_CHECKING

from pint import Quantity, UndefinedUnitError

from ansys.api.geometry.v0.models_pb2 import (
Arc as GRPCArc,
Circle as GRPCCircle,
Expand All @@ -43,6 +41,8 @@
Surface as GRPCSurface,
TrimmedCurve as GRPCTrimmedCurve,
)
from pint import Quantity, UndefinedUnitError

from ansys.geometry.core.materials.material import (
Material,
MaterialProperty,
Expand Down
3 changes: 2 additions & 1 deletion src/ansys/geometry/core/connection/product_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
import subprocess # nosec B404
from typing import TYPE_CHECKING

from ansys.tools.path import get_available_ansys_installations, get_latest_ansys_installation

from ansys.geometry.core.connection.backend import ApiVersions, BackendType
from ansys.geometry.core.logger import LOG
from ansys.tools.path import get_available_ansys_installations, get_latest_ansys_installation

if TYPE_CHECKING: # pragma: no cover
from ansys.geometry.core.modeler import Modeler
Expand Down
13 changes: 7 additions & 6 deletions src/ansys/geometry/core/designer/body.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
from functools import cached_property, wraps
from typing import TYPE_CHECKING, Union

from beartype import beartype as check_input_types
import matplotlib.colors as mcolors
from pint import Quantity

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from ansys.api.geometry.v0.commands_pb2 import (
AssignMidSurfaceOffsetTypeRequest,
Expand All @@ -43,6 +39,10 @@
ShellRequest,
)
from ansys.api.geometry.v0.commands_pb2_grpc import CommandsStub
from beartype import beartype as check_input_types
import matplotlib.colors as mcolors
from pint import Quantity

from ansys.geometry.core.connection.client import GrpcClient
from ansys.geometry.core.connection.conversions import (
plane_to_grpc_plane,
Expand Down Expand Up @@ -1851,12 +1851,13 @@ def plot( # noqa: D102
**plotting_options: dict | None,
) -> None:
# lazy import here to improve initial module load time
import ansys.geometry.core as pyansys_geometry
from ansys.geometry.core.plotting import GeometryPlotter
from ansys.tools.visualization_interface.types.mesh_object_plot import (
MeshObjectPlot,
)

import ansys.geometry.core as pyansys_geometry
from ansys.geometry.core.plotting import GeometryPlotter

use_service_colors = (
use_service_colors
if use_service_colors is not None
Expand Down
6 changes: 3 additions & 3 deletions src/ansys/geometry/core/designer/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
from typing import TYPE_CHECKING, Any, Optional, Union
import uuid

from beartype import beartype as check_input_types
from pint import Quantity

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from ansys.api.geometry.v0.commands_pb2 import (
CreateBeamSegmentsRequest,
Expand All @@ -45,6 +42,9 @@
)
from ansys.api.geometry.v0.components_pb2_grpc import ComponentsStub
from ansys.api.geometry.v0.models_pb2 import Direction, Line, SetObjectNameRequest
from beartype import beartype as check_input_types
from pint import Quantity

from ansys.geometry.core.connection.client import GrpcClient
from ansys.geometry.core.connection.conversions import (
grpc_curve_to_curve,
Expand Down
10 changes: 5 additions & 5 deletions src/ansys/geometry/core/designer/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
from pathlib import Path
from typing import Union

from beartype import beartype as check_input_types
from google.protobuf.empty_pb2 import Empty
import numpy as np
from pint import Quantity, UndefinedUnitError

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from ansys.api.geometry.v0.commands_pb2 import (
AssignMidSurfaceOffsetTypeRequest,
AssignMidSurfaceThicknessRequest,
CreateBeamCircularProfileRequest,
)
from ansys.api.geometry.v0.commands_pb2_grpc import CommandsStub
from beartype import beartype as check_input_types
from google.protobuf.empty_pb2 import Empty
import numpy as np
from pint import Quantity, UndefinedUnitError

from ansys.geometry.core.connection.backend import BackendType
from ansys.geometry.core.connection.conversions import (
grpc_curve_to_curve,
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/geometry/core/designer/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
from enum import Enum, unique
from typing import TYPE_CHECKING

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from pint import Quantity

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from ansys.geometry.core.connection.client import GrpcClient
from ansys.geometry.core.errors import GeometryRuntimeError
from ansys.geometry.core.math.bbox import BoundingBox
Expand Down
11 changes: 6 additions & 5 deletions src/ansys/geometry/core/designer/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
from enum import Enum, unique
from typing import TYPE_CHECKING

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from ansys.api.geometry.v0.commands_pb2 import FaceOffsetRequest
from ansys.api.geometry.v0.commands_pb2_grpc import CommandsStub
from beartype import beartype as check_input_types
import matplotlib.colors as mcolors
from pint import Quantity

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from ansys.api.geometry.v0.commands_pb2 import FaceOffsetRequest
from ansys.api.geometry.v0.commands_pb2_grpc import CommandsStub
from ansys.geometry.core.connection.client import GrpcClient
from ansys.geometry.core.designer.edge import Edge
from ansys.geometry.core.designer.vertex import Vertex
Expand Down Expand Up @@ -604,12 +604,13 @@ def plot(

"""
# lazy import here to improve initial module loading time
import ansys.geometry.core as pyansys_geometry
from ansys.geometry.core.plotting import GeometryPlotter
from ansys.tools.visualization_interface.types.mesh_object_plot import (
MeshObjectPlot,
)

import ansys.geometry.core as pyansys_geometry
from ansys.geometry.core.plotting import GeometryPlotter

use_service_colors = (
use_service_colors
if use_service_colors is not None
Expand Down
6 changes: 3 additions & 3 deletions src/ansys/geometry/core/designer/geometry_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
from enum import Enum, unique
from typing import TYPE_CHECKING, Union

from beartype import beartype as check_input_types
from pint import Quantity

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from ansys.api.geometry.v0.commands_pb2 import (
ChamferRequest,
Expand Down Expand Up @@ -59,6 +56,9 @@
ThickenFacesRequest,
)
from ansys.api.geometry.v0.commands_pb2_grpc import CommandsStub
from beartype import beartype as check_input_types
from pint import Quantity

from ansys.geometry.core.connection.client import GrpcClient
from ansys.geometry.core.connection.conversions import (
line_to_grpc_line,
Expand Down
3 changes: 1 addition & 2 deletions src/ansys/geometry/core/misc/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,12 @@ def run_if_graphics_required():
if __GRAPHICS_AVAILABLE is None:
try:
# Attempt to perform the imports
import ansys.tools.visualization_interface # noqa: F401
import pygltflib # noqa: F401
import pyvista # noqa: F401
import trame # noqa: F401
import vtk # noqa: F401

import ansys.tools.visualization_interface # noqa: F401

__GRAPHICS_AVAILABLE = True
except (ModuleNotFoundError, ImportError):
__GRAPHICS_AVAILABLE = False
Expand Down
7 changes: 4 additions & 3 deletions src/ansys/geometry/core/modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
from pathlib import Path
from typing import TYPE_CHECKING, Generator, Optional

from grpc import Channel

from ansys.api.geometry.v0.commands_pb2 import UploadFileRequest
from ansys.api.geometry.v0.commands_pb2_grpc import CommandsStub
from grpc import Channel

from ansys.geometry.core.connection.backend import ApiVersions, BackendType
from ansys.geometry.core.connection.client import GrpcClient
import ansys.geometry.core.connection.defaults as pygeom_defaults
Expand All @@ -42,11 +42,12 @@
from ansys.geometry.core.typing import Real

if TYPE_CHECKING: # pragma: no cover
from ansys.platform.instancemanagement import Instance

from ansys.geometry.core.connection.docker_instance import LocalDockerInstance
from ansys.geometry.core.connection.product_instance import ProductInstance
from ansys.geometry.core.designer.design import Design
from ansys.geometry.core.designer.geometry_commands import GeometryCommands
from ansys.platform.instancemanagement import Instance


class Modeler:
Expand Down
Loading
Loading