Fixed more typing problems

This commit is contained in:
gumyr 2025-01-13 20:18:18 -05:00
parent e923f733e0
commit 60a4d24cd4
3 changed files with 20 additions and 18 deletions

View file

@ -1322,7 +1322,11 @@ class WorkplaneList:
points_per_workplane = [] points_per_workplane = []
workplane = WorkplaneList._get_context().workplanes[0] workplane = WorkplaneList._get_context().workplanes[0]
localized_pts = [ localized_pts = [
workplane.from_local_coords(pt) if isinstance(pt, tuple) else pt (
cast(Vector, workplane.from_local_coords(Vector(pt)))
if isinstance(pt, tuple)
else Vector(pt)
)
for pt in points for pt in points
] ]
if len(localized_pts) == 1: if len(localized_pts) == 1:

View file

@ -46,6 +46,7 @@ from ezdxf import zoom
from ezdxf.colors import RGB, aci2rgb from ezdxf.colors import RGB, aci2rgb
from ezdxf.math import Vec2 from ezdxf.math import Vec2
from OCP.BRepLib import BRepLib from OCP.BRepLib import BRepLib
from OCP.BRepTools import BRepTools_WireExplorer
from OCP.Geom import Geom_BezierCurve from OCP.Geom import Geom_BezierCurve
from OCP.GeomConvert import GeomConvert from OCP.GeomConvert import GeomConvert
from OCP.GeomConvert import GeomConvert_BSplineCurveToBezierCurve from OCP.GeomConvert import GeomConvert_BSplineCurveToBezierCurve
@ -1109,15 +1110,15 @@ class ExportSVG(Export2D):
@staticmethod @staticmethod
def _wire_edges(wire: Wire, reverse: bool) -> list[Edge]: def _wire_edges(wire: Wire, reverse: bool) -> list[Edge]:
# edges = [] edges = []
# explorer = BRepTools_WireExplorer(wire.wrapped) explorer = BRepTools_WireExplorer(wire.wrapped)
# while explorer.More(): while explorer.More():
# topo_edge = explorer.Current() topo_edge = explorer.Current()
# edges.append(Edge(topo_edge)) edges.append(Edge(topo_edge))
# explorer.Next() explorer.Next()
edges = wire.edges() # edges = wire.edges()
if reverse: # if reverse:
edges.reverse() # edges.reverse()
return edges return edges
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View file

@ -53,13 +53,10 @@ from abc import ABC, abstractmethod
from typing import ( from typing import (
cast as tcast, cast as tcast,
Any, Any,
Dict,
Generic, Generic,
Optional, Optional,
Protocol, Protocol,
SupportsIndex, SupportsIndex,
Tuple,
Type,
TypeVar, TypeVar,
Union, Union,
overload, overload,
@ -70,7 +67,7 @@ from collections.abc import Callable, Iterable, Iterator
import OCP.GeomAbs as ga import OCP.GeomAbs as ga
import OCP.TopAbs as ta import OCP.TopAbs as ta
from IPython.lib.pretty import pretty, PrettyPrinter from IPython.lib.pretty import pretty, RepresentationPrinter
from OCP.Aspect import Aspect_TOL_SOLID from OCP.Aspect import Aspect_TOL_SOLID
from OCP.BOPAlgo import BOPAlgo_GlueEnum from OCP.BOPAlgo import BOPAlgo_GlueEnum
from OCP.BRep import BRep_Tool from OCP.BRep import BRep_Tool
@ -2204,7 +2201,9 @@ class GroupBy(Generic[T, K]):
"""Select group by shape""" """Select group by shape"""
return self.group(self.key_f(shape)) return self.group(self.key_f(shape))
def _repr_pretty_(self, printer: PrettyPrinter, cycle: bool = False) -> None: def _repr_pretty_(
self, printer: RepresentationPrinter, cycle: bool = False
) -> None:
""" """
Render a formatted representation of the object for pretty-printing in Render a formatted representation of the object for pretty-printing in
interactive environments. interactive environments.
@ -2840,9 +2839,7 @@ def _topods_entities(shape: TopoDS_Shape, topo_type: Shapes) -> list[TopoDS_Shap
while explorer.More(): while explorer.More():
item = explorer.Current() item = explorer.Current()
out[hash(item)] = ( out[hash(item)] = item # needed to avoid pseudo-duplicate entities
item # needed to avoid pseudo-duplicate entities
)
explorer.Next() explorer.Next()
return list(out.values()) return list(out.values())