ScadPy 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scadpy/__init__.py +5 -0
- scadpy/color/__init__.py +3 -0
- scadpy/color/constants/BEIGE.py +3 -0
- scadpy/color/constants/BLACK.py +3 -0
- scadpy/color/constants/BLUE.py +3 -0
- scadpy/color/constants/BROWN.py +3 -0
- scadpy/color/constants/DARK_GRAY.py +3 -0
- scadpy/color/constants/DEFAULT_COLOR.py +3 -0
- scadpy/color/constants/DEFAULT_OPACITY.py +1 -0
- scadpy/color/constants/GRAY.py +3 -0
- scadpy/color/constants/GREEN.py +3 -0
- scadpy/color/constants/ORANGE.py +3 -0
- scadpy/color/constants/RED.py +3 -0
- scadpy/color/constants/WHITE.py +3 -0
- scadpy/color/constants/YELLOW.py +3 -0
- scadpy/color/constants/__init__.py +29 -0
- scadpy/color/type/__init__.py +3 -0
- scadpy/color/type/color.py +3 -0
- scadpy/color/utils/__init__.py +3 -0
- scadpy/color/utils/get_random_color.py +36 -0
- scadpy/core/__init__.py +3 -0
- scadpy/core/assembly/__init__.py +5 -0
- scadpy/core/assembly/combinations/__init__.py +13 -0
- scadpy/core/assembly/combinations/concat_assemblies.py +50 -0
- scadpy/core/assembly/combinations/exclude_assemblies.py +135 -0
- scadpy/core/assembly/combinations/intersect_assemblies.py +128 -0
- scadpy/core/assembly/combinations/subtract_assemblies.py +151 -0
- scadpy/core/assembly/combinations/unify_assemblies.py +59 -0
- scadpy/core/assembly/topologies/__init__.py +41 -0
- scadpy/core/assembly/topologies/directed_edge/__init__.py +9 -0
- scadpy/core/assembly/topologies/directed_edge/get_assembly_directed_edge_directions.py +70 -0
- scadpy/core/assembly/topologies/directed_edge/get_assembly_directed_edge_to_edge.py +49 -0
- scadpy/core/assembly/topologies/directed_edge/get_assembly_directed_edge_to_vertex.py +54 -0
- scadpy/core/assembly/topologies/edge/__init__.py +9 -0
- scadpy/core/assembly/topologies/edge/get_assembly_edge_lengths.py +46 -0
- scadpy/core/assembly/topologies/edge/get_assembly_edge_midpoints.py +51 -0
- scadpy/core/assembly/topologies/edge/get_assembly_edge_normals.py +67 -0
- scadpy/core/assembly/topologies/face_corner/__init__.py +13 -0
- scadpy/core/assembly/topologies/face_corner/get_assembly_face_corner_angles.py +72 -0
- scadpy/core/assembly/topologies/face_corner/get_assembly_face_corner_normals.py +103 -0
- scadpy/core/assembly/topologies/face_corner/get_assembly_face_corner_to_incoming_directed_edge.py +65 -0
- scadpy/core/assembly/topologies/face_corner/get_assembly_face_corner_to_outgoing_directed_edge.py +65 -0
- scadpy/core/assembly/topologies/face_corner/get_assembly_face_directed_edge_to_corner.py +79 -0
- scadpy/core/assembly/topologies/part/__init__.py +5 -0
- scadpy/core/assembly/topologies/part/get_assembly_part_colors.py +55 -0
- scadpy/core/assembly/topologies/vertex/__init__.py +7 -0
- scadpy/core/assembly/topologies/vertex/get_assembly_vertex_coordinates.py +70 -0
- scadpy/core/assembly/topologies/vertex/get_assembly_vertex_to_part.py +62 -0
- scadpy/core/assembly/transformations/__init__.py +19 -0
- scadpy/core/assembly/transformations/color_assembly.py +24 -0
- scadpy/core/assembly/transformations/mirror_vertex_coordinates.py +68 -0
- scadpy/core/assembly/transformations/pull_vertex_coordinates.py +64 -0
- scadpy/core/assembly/transformations/push_vertex_coordinates.py +64 -0
- scadpy/core/assembly/transformations/resize_vertex_coordinates.py +121 -0
- scadpy/core/assembly/transformations/rotate_vertex_coordinates.py +73 -0
- scadpy/core/assembly/transformations/scale_vertex_coordinates.py +76 -0
- scadpy/core/assembly/transformations/translate_vertex_coordinates.py +70 -0
- scadpy/core/assembly/types/__init__.py +7 -0
- scadpy/core/assembly/types/assembly.py +14 -0
- scadpy/core/assembly/types/topology_filter.py +6 -0
- scadpy/core/assembly/utils/__init__.py +9 -0
- scadpy/core/assembly/utils/lookup_pairs.py +56 -0
- scadpy/core/assembly/utils/resolve_topology_filter.py +84 -0
- scadpy/core/assembly/utils/transform_filtered_parts.py +55 -0
- scadpy/core/component/__init__.py +3 -0
- scadpy/core/component/exporters/__init__.py +7 -0
- scadpy/core/component/exporters/map_component_to_html_file.py +47 -0
- scadpy/core/component/exporters/map_component_to_screen.py +63 -0
- scadpy/core/component/features/__init__.py +5 -0
- scadpy/core/component/features/get_component_bounds.py +38 -0
- scadpy/core/component/utils/__init__.py +9 -0
- scadpy/core/component/utils/blend_component_colors.py +77 -0
- scadpy/core/component/utils/get_intersecting_component_index_groups.py +108 -0
- scadpy/core/part/__init__.py +3 -0
- scadpy/core/part/combinations/__init__.py +11 -0
- scadpy/core/part/combinations/concat_parts.py +48 -0
- scadpy/core/part/combinations/intersect_parts.py +147 -0
- scadpy/core/part/combinations/subtract_parts.py +94 -0
- scadpy/core/part/combinations/unify_parts.py +143 -0
- scadpy/core/part/types/__init__.py +5 -0
- scadpy/core/part/types/part.py +34 -0
- scadpy/core/part/utils/__init__.py +5 -0
- scadpy/core/part/utils/blend_part_colors.py +32 -0
- scadpy/d2/__init__.py +2 -0
- scadpy/d2/shape/__init__.py +9 -0
- scadpy/d2/shape/combinations/__init__.py +21 -0
- scadpy/d2/shape/combinations/are_shape_parts_intersecting.py +49 -0
- scadpy/d2/shape/combinations/concat_shape.py +48 -0
- scadpy/d2/shape/combinations/exclude_shape.py +71 -0
- scadpy/d2/shape/combinations/intersect_shape.py +64 -0
- scadpy/d2/shape/combinations/intersect_shape_parts.py +71 -0
- scadpy/d2/shape/combinations/subtract_shape.py +72 -0
- scadpy/d2/shape/combinations/subtract_shape_parts.py +66 -0
- scadpy/d2/shape/combinations/unify_shape.py +51 -0
- scadpy/d2/shape/combinations/unify_shape_parts.py +74 -0
- scadpy/d2/shape/exporters/__init__.py +17 -0
- scadpy/d2/shape/exporters/map_shape_to_dxf.py +43 -0
- scadpy/d2/shape/exporters/map_shape_to_dxf_file.py +38 -0
- scadpy/d2/shape/exporters/map_shape_to_html.py +117 -0
- scadpy/d2/shape/exporters/map_shape_to_html_file.py +58 -0
- scadpy/d2/shape/exporters/map_shape_to_screen.py +51 -0
- scadpy/d2/shape/exporters/map_shape_to_svg.py +40 -0
- scadpy/d2/shape/exporters/map_shape_to_svg_file.py +38 -0
- scadpy/d2/shape/features/__init__.py +9 -0
- scadpy/d2/shape/features/get_shape_bounds.py +40 -0
- scadpy/d2/shape/features/get_shape_part_bounds.py +37 -0
- scadpy/d2/shape/features/is_shape_empty.py +38 -0
- scadpy/d2/shape/importers/__init__.py +13 -0
- scadpy/d2/shape/importers/map_dxf_to_shape.py +55 -0
- scadpy/d2/shape/importers/map_geometries_to_shape.py +45 -0
- scadpy/d2/shape/importers/map_geometry_to_shape.py +43 -0
- scadpy/d2/shape/importers/map_parts_to_shape.py +62 -0
- scadpy/d2/shape/importers/map_svg_to_shape.py +55 -0
- scadpy/d2/shape/primitives/__init__.py +6 -0
- scadpy/d2/shape/primitives/circle.py +68 -0
- scadpy/d2/shape/primitives/polygon.py +86 -0
- scadpy/d2/shape/primitives/rectangle.py +85 -0
- scadpy/d2/shape/primitives/square.py +57 -0
- scadpy/d2/shape/topologies/__init__.py +53 -0
- scadpy/d2/shape/topologies/corner/__init__.py +15 -0
- scadpy/d2/shape/topologies/corner/are_shape_corners_convex.py +75 -0
- scadpy/d2/shape/topologies/corner/get_shape_corner_angles.py +58 -0
- scadpy/d2/shape/topologies/corner/get_shape_corner_normals.py +82 -0
- scadpy/d2/shape/topologies/corner/get_shape_corner_to_incoming_directed_edge.py +39 -0
- scadpy/d2/shape/topologies/corner/get_shape_corner_to_outgoing_directed_edge.py +39 -0
- scadpy/d2/shape/topologies/corner/get_shape_corner_to_vertex.py +65 -0
- scadpy/d2/shape/topologies/directed_edge/__init__.py +11 -0
- scadpy/d2/shape/topologies/directed_edge/get_shape_directed_edge_directions.py +44 -0
- scadpy/d2/shape/topologies/directed_edge/get_shape_directed_edge_to_corner.py +41 -0
- scadpy/d2/shape/topologies/directed_edge/get_shape_directed_edge_to_edge.py +51 -0
- scadpy/d2/shape/topologies/directed_edge/get_shape_directed_edge_to_vertex.py +63 -0
- scadpy/d2/shape/topologies/edge/__init__.py +11 -0
- scadpy/d2/shape/topologies/edge/get_shape_edge_lengths.py +43 -0
- scadpy/d2/shape/topologies/edge/get_shape_edge_midpoints.py +46 -0
- scadpy/d2/shape/topologies/edge/get_shape_edge_normals.py +40 -0
- scadpy/d2/shape/topologies/edge/get_shape_edge_to_vertex.py +71 -0
- scadpy/d2/shape/topologies/ring/__init__.py +7 -0
- scadpy/d2/shape/topologies/ring/get_shape_ring_to_part.py +46 -0
- scadpy/d2/shape/topologies/ring/get_shape_ring_types.py +46 -0
- scadpy/d2/shape/topologies/vertex/__init__.py +11 -0
- scadpy/d2/shape/topologies/vertex/get_shape_part_vertex_coordinates.py +62 -0
- scadpy/d2/shape/topologies/vertex/get_shape_vertex_coordinates.py +44 -0
- scadpy/d2/shape/topologies/vertex/get_shape_vertex_to_part.py +42 -0
- scadpy/d2/shape/topologies/vertex/get_shape_vertex_to_ring.py +63 -0
- scadpy/d2/shape/transformations/__init__.py +43 -0
- scadpy/d2/shape/transformations/chamfer_shape.py +259 -0
- scadpy/d2/shape/transformations/color_shape.py +46 -0
- scadpy/d2/shape/transformations/convexify_shape.py +79 -0
- scadpy/d2/shape/transformations/fill_shape.py +68 -0
- scadpy/d2/shape/transformations/fillet_shape.py +289 -0
- scadpy/d2/shape/transformations/grow_shape.py +82 -0
- scadpy/d2/shape/transformations/linear_cut_shape.py +116 -0
- scadpy/d2/shape/transformations/linear_extrude_shape.py +60 -0
- scadpy/d2/shape/transformations/linear_slice_shape.py +144 -0
- scadpy/d2/shape/transformations/mirror_shape.py +53 -0
- scadpy/d2/shape/transformations/pull_shape.py +67 -0
- scadpy/d2/shape/transformations/push_shape.py +67 -0
- scadpy/d2/shape/transformations/radial_extrude_shape.py +285 -0
- scadpy/d2/shape/transformations/radial_slice_shape.py +132 -0
- scadpy/d2/shape/transformations/recoordinate_shape.py +82 -0
- scadpy/d2/shape/transformations/resize_shape.py +91 -0
- scadpy/d2/shape/transformations/rotate_shape.py +63 -0
- scadpy/d2/shape/transformations/scale_shape.py +58 -0
- scadpy/d2/shape/transformations/shrink_shape.py +69 -0
- scadpy/d2/shape/transformations/translate_shape.py +54 -0
- scadpy/d2/shape/types/__init__.py +3 -0
- scadpy/d2/shape/types/shape.py +792 -0
- scadpy/d2/shape/types/utils/__init__.py +5 -0
- scadpy/d2/shape/types/utils/shapely_base_geometry_to_shapely_polygons.py +25 -0
- scadpy/d2/shape/utils/__init__.py +5 -0
- scadpy/d2/shape/utils/shapely_base_geometry_to_shapely_polygons.py +55 -0
- scadpy/d2/utils/__init__.py +3 -0
- scadpy/d2/utils/resolve_vector_2d.py +50 -0
- scadpy/d3/__init__.py +2 -0
- scadpy/d3/solid/__init__.py +8 -0
- scadpy/d3/solid/combinations/__init__.py +21 -0
- scadpy/d3/solid/combinations/are_solid_parts_intersecting.py +51 -0
- scadpy/d3/solid/combinations/concat_solid.py +48 -0
- scadpy/d3/solid/combinations/exclude_solid.py +71 -0
- scadpy/d3/solid/combinations/intersect_solid.py +64 -0
- scadpy/d3/solid/combinations/intersect_solid_parts.py +73 -0
- scadpy/d3/solid/combinations/subtract_solid.py +72 -0
- scadpy/d3/solid/combinations/subtract_solid_parts.py +68 -0
- scadpy/d3/solid/combinations/unify_solid.py +51 -0
- scadpy/d3/solid/combinations/unify_solid_parts.py +73 -0
- scadpy/d3/solid/exporters/__init__.py +11 -0
- scadpy/d3/solid/exporters/map_solid_to_html.py +318 -0
- scadpy/d3/solid/exporters/map_solid_to_html_file.py +58 -0
- scadpy/d3/solid/exporters/map_solid_to_screen.py +51 -0
- scadpy/d3/solid/exporters/map_solid_to_stl_file.py +48 -0
- scadpy/d3/solid/features/__init__.py +11 -0
- scadpy/d3/solid/features/get_solid_bounds.py +37 -0
- scadpy/d3/solid/features/get_solid_part_bounds.py +37 -0
- scadpy/d3/solid/features/get_solid_part_colors.py +39 -0
- scadpy/d3/solid/features/is_solid_empty.py +36 -0
- scadpy/d3/solid/importers/__init__.py +11 -0
- scadpy/d3/solid/importers/map_geometries_to_solid.py +42 -0
- scadpy/d3/solid/importers/map_geometry_to_solid.py +42 -0
- scadpy/d3/solid/importers/map_parts_to_solid.py +66 -0
- scadpy/d3/solid/importers/map_stl_to_solid.py +37 -0
- scadpy/d3/solid/primitives/__init__.py +7 -0
- scadpy/d3/solid/primitives/cone.py +70 -0
- scadpy/d3/solid/primitives/cuboid.py +75 -0
- scadpy/d3/solid/primitives/cylinder.py +73 -0
- scadpy/d3/solid/primitives/polyhedron.py +60 -0
- scadpy/d3/solid/primitives/sphere.py +58 -0
- scadpy/d3/solid/topologies/__init__.py +8 -0
- scadpy/d3/solid/topologies/triangle/__init__.py +5 -0
- scadpy/d3/solid/topologies/triangle/get_solid_triangle_to_vertex.py +49 -0
- scadpy/d3/solid/topologies/vertex/__init__.py +7 -0
- scadpy/d3/solid/topologies/vertex/get_solid_vertex_coordinates.py +39 -0
- scadpy/d3/solid/topologies/vertex/get_solid_vertex_to_part.py +37 -0
- scadpy/d3/solid/transformations/__init__.py +23 -0
- scadpy/d3/solid/transformations/color_solid.py +46 -0
- scadpy/d3/solid/transformations/convexify_solid.py +64 -0
- scadpy/d3/solid/transformations/mirror_solid.py +53 -0
- scadpy/d3/solid/transformations/pull_solid.py +67 -0
- scadpy/d3/solid/transformations/push_solid.py +67 -0
- scadpy/d3/solid/transformations/recoordinate_solid.py +68 -0
- scadpy/d3/solid/transformations/resize_solid.py +92 -0
- scadpy/d3/solid/transformations/rotate_solid.py +93 -0
- scadpy/d3/solid/transformations/scale_solid.py +58 -0
- scadpy/d3/solid/transformations/translate_solid.py +54 -0
- scadpy/d3/solid/types/__init__.py +3 -0
- scadpy/d3/solid/types/solid.py +448 -0
- scadpy/d3/utils/__init__.py +3 -0
- scadpy/d3/utils/resolve_vector_3d.py +50 -0
- scadpy/utils/__init__.py +6 -0
- scadpy/utils/resolve_vector.py +64 -0
- scadpy/utils/x.py +38 -0
- scadpy/utils/y.py +38 -0
- scadpy/utils/z.py +38 -0
- scadpy-0.1.0.dist-info/METADATA +282 -0
- scadpy-0.1.0.dist-info/RECORD +236 -0
- scadpy-0.1.0.dist-info/WHEEL +4 -0
- scadpy-0.1.0.dist-info/licenses/LICENSE.md +43 -0
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterable, Sequence
|
|
4
|
+
from functools import cached_property
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Self, final
|
|
7
|
+
|
|
8
|
+
import numpy as np
|
|
9
|
+
from numpy.typing import NDArray
|
|
10
|
+
from shapely.geometry.polygon import Polygon
|
|
11
|
+
from typeguard import typechecked
|
|
12
|
+
|
|
13
|
+
from scadpy.color.constants import BLACK, WHITE
|
|
14
|
+
from scadpy.core.assembly import Assembly
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from scadpy import Color, Part, Solid, TopologyFilter
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@final
|
|
21
|
+
@typechecked
|
|
22
|
+
class Shape(Assembly[Polygon]):
|
|
23
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None: # pyright: ignore[reportExplicitAny, reportAny]
|
|
24
|
+
super().__init__(*args, **kwargs)
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def dimensions(cls) -> int:
|
|
28
|
+
return 2
|
|
29
|
+
|
|
30
|
+
##########
|
|
31
|
+
# vertex #
|
|
32
|
+
##########
|
|
33
|
+
|
|
34
|
+
@cached_property
|
|
35
|
+
def vertex_coordinates(self: Self) -> NDArray[np.float64]:
|
|
36
|
+
"""
|
|
37
|
+
Shortcut for :func:`get_shape_vertex_coordinates`.
|
|
38
|
+
|
|
39
|
+
See :func:`get_shape_vertex_coordinates` for full documentation.
|
|
40
|
+
"""
|
|
41
|
+
from scadpy import get_shape_vertex_coordinates
|
|
42
|
+
|
|
43
|
+
return get_shape_vertex_coordinates(self)
|
|
44
|
+
|
|
45
|
+
@cached_property
|
|
46
|
+
def vertex_to_part(self: Self) -> NDArray[np.int64]:
|
|
47
|
+
"""
|
|
48
|
+
Shortcut for :func:`get_shape_vertex_to_part`.
|
|
49
|
+
|
|
50
|
+
See :func:`get_shape_vertex_to_part` for full documentation.
|
|
51
|
+
"""
|
|
52
|
+
from scadpy import get_shape_vertex_to_part
|
|
53
|
+
|
|
54
|
+
return get_shape_vertex_to_part(self)
|
|
55
|
+
|
|
56
|
+
def recoordinate(self: Self, vertex_coordinates: NDArray[np.float64]) -> Shape:
|
|
57
|
+
"""Rebuild this shape with new vertex coordinates.
|
|
58
|
+
|
|
59
|
+
Shortcut for :func:`recoordinate_shape`.
|
|
60
|
+
See :func:`recoordinate_shape` for full documentation.
|
|
61
|
+
"""
|
|
62
|
+
from scadpy.d2.shape import recoordinate_shape
|
|
63
|
+
|
|
64
|
+
return recoordinate_shape(self, vertex_coordinates)
|
|
65
|
+
|
|
66
|
+
############
|
|
67
|
+
# features #
|
|
68
|
+
############
|
|
69
|
+
|
|
70
|
+
@cached_property
|
|
71
|
+
def is_empty(self: Self) -> bool:
|
|
72
|
+
"""
|
|
73
|
+
Shortcut for :func:`is_shape_empty`.
|
|
74
|
+
|
|
75
|
+
See :func:`is_shape_empty` for full documentation.
|
|
76
|
+
"""
|
|
77
|
+
from scadpy import is_shape_empty
|
|
78
|
+
|
|
79
|
+
return is_shape_empty(self)
|
|
80
|
+
|
|
81
|
+
@cached_property
|
|
82
|
+
def bounds(self: Self) -> NDArray[np.float64]:
|
|
83
|
+
"""
|
|
84
|
+
Shortcut for :func:`get_shape_bounds`.
|
|
85
|
+
|
|
86
|
+
See :func:`get_shape_bounds` for full documentation.
|
|
87
|
+
"""
|
|
88
|
+
from scadpy import get_shape_bounds
|
|
89
|
+
|
|
90
|
+
return get_shape_bounds(self)
|
|
91
|
+
|
|
92
|
+
################
|
|
93
|
+
# combinations #
|
|
94
|
+
################
|
|
95
|
+
|
|
96
|
+
def __add__(self: Self, other: Shape) -> Shape:
|
|
97
|
+
"""Concatenate two shapes. Shortcut for :func:`concat_shape`."""
|
|
98
|
+
from scadpy import concat_shape
|
|
99
|
+
|
|
100
|
+
return concat_shape(shapes=[self, other])
|
|
101
|
+
|
|
102
|
+
def __or__(self: Self, other: Shape) -> Shape:
|
|
103
|
+
"""Unite two shapes. Shortcut for :func:`unify_shape`."""
|
|
104
|
+
from scadpy import unify_shape
|
|
105
|
+
|
|
106
|
+
return unify_shape(shapes=[self, other])
|
|
107
|
+
|
|
108
|
+
def __and__(self: Self, other: Shape) -> Shape:
|
|
109
|
+
"""Intersect two shapes. Shortcut for :func:`intersect_shape`."""
|
|
110
|
+
from scadpy import intersect_shape
|
|
111
|
+
|
|
112
|
+
return intersect_shape(shapes=[self, other])
|
|
113
|
+
|
|
114
|
+
def __sub__(self: Self, other: Shape) -> Shape:
|
|
115
|
+
"""Subtract a shape from this shape. Shortcut for :func:`subtract_shape`."""
|
|
116
|
+
from scadpy import subtract_shape
|
|
117
|
+
|
|
118
|
+
return subtract_shape(to_be_subtracted=self, to_subtract=other)
|
|
119
|
+
|
|
120
|
+
def __xor__(self: Self, other: Shape) -> Shape:
|
|
121
|
+
"""Compute symmetric difference with another shape. Shortcut for :func:`exclude_shape`."""
|
|
122
|
+
from scadpy import exclude_shape
|
|
123
|
+
|
|
124
|
+
return exclude_shape(shapes=[self, other])
|
|
125
|
+
|
|
126
|
+
def concat(self: Self, shapes: Sequence[Shape]) -> Shape:
|
|
127
|
+
"""Concatenate this shape with others.
|
|
128
|
+
|
|
129
|
+
Shortcut for :func:`concat_shape`.
|
|
130
|
+
See :func:`concat_shape` for full documentation.
|
|
131
|
+
"""
|
|
132
|
+
from scadpy import concat_shape
|
|
133
|
+
|
|
134
|
+
return concat_shape(shapes=[self, *shapes])
|
|
135
|
+
|
|
136
|
+
def unify(self: Self, shapes: Sequence[Shape]) -> Shape:
|
|
137
|
+
"""Unite this shape with others.
|
|
138
|
+
|
|
139
|
+
Shortcut for :func:`unify_shape`.
|
|
140
|
+
See :func:`unify_shape` for full documentation.
|
|
141
|
+
"""
|
|
142
|
+
from scadpy import unify_shape
|
|
143
|
+
|
|
144
|
+
return unify_shape(shapes=[self, *shapes])
|
|
145
|
+
|
|
146
|
+
def intersect(self: Self, shapes: Sequence[Shape]) -> Shape:
|
|
147
|
+
"""Intersect this shape with others.
|
|
148
|
+
|
|
149
|
+
Shortcut for :func:`intersect_shape`.
|
|
150
|
+
See :func:`intersect_shape` for full documentation.
|
|
151
|
+
"""
|
|
152
|
+
from scadpy import intersect_shape
|
|
153
|
+
|
|
154
|
+
return intersect_shape(shapes=[self, *shapes])
|
|
155
|
+
|
|
156
|
+
def subtract(self: Self, other: Shape) -> Shape:
|
|
157
|
+
"""Subtract a shape from this shape.
|
|
158
|
+
|
|
159
|
+
Shortcut for :func:`subtract_shape`.
|
|
160
|
+
See :func:`subtract_shape` for full documentation.
|
|
161
|
+
"""
|
|
162
|
+
from scadpy import subtract_shape
|
|
163
|
+
|
|
164
|
+
return subtract_shape(to_be_subtracted=self, to_subtract=other)
|
|
165
|
+
|
|
166
|
+
def exclude(self: Self, shapes: Sequence[Shape]) -> Shape:
|
|
167
|
+
"""Compute the symmetric difference of this shape with others.
|
|
168
|
+
|
|
169
|
+
Shortcut for :func:`exclude_shape`.
|
|
170
|
+
See :func:`exclude_shape` for full documentation.
|
|
171
|
+
"""
|
|
172
|
+
from scadpy import exclude_shape
|
|
173
|
+
|
|
174
|
+
return exclude_shape(shapes=[self, *shapes])
|
|
175
|
+
|
|
176
|
+
##############
|
|
177
|
+
# topologies #
|
|
178
|
+
##############
|
|
179
|
+
|
|
180
|
+
@cached_property
|
|
181
|
+
def part_colors(self: Self) -> NDArray[np.float64]:
|
|
182
|
+
"""
|
|
183
|
+
Shortcut for :func:`get_assembly_part_colors`.
|
|
184
|
+
|
|
185
|
+
See :func:`get_assembly_part_colors` for full documentation.
|
|
186
|
+
"""
|
|
187
|
+
from scadpy.core.assembly import get_assembly_part_colors
|
|
188
|
+
|
|
189
|
+
return get_assembly_part_colors(self)
|
|
190
|
+
|
|
191
|
+
@cached_property
|
|
192
|
+
def ring_to_part(self: Self) -> NDArray[np.int64]:
|
|
193
|
+
"""
|
|
194
|
+
Shortcut for :func:`get_shape_ring_to_part`.
|
|
195
|
+
|
|
196
|
+
See :func:`get_shape_ring_to_part` for full documentation.
|
|
197
|
+
"""
|
|
198
|
+
from scadpy.d2.shape import get_shape_ring_to_part
|
|
199
|
+
|
|
200
|
+
return get_shape_ring_to_part(self)
|
|
201
|
+
|
|
202
|
+
@cached_property
|
|
203
|
+
def ring_types(self: Self) -> NDArray[np.object_]:
|
|
204
|
+
"""
|
|
205
|
+
Shortcut for :func:`get_shape_ring_types`.
|
|
206
|
+
|
|
207
|
+
See :func:`get_shape_ring_types` for full documentation.
|
|
208
|
+
"""
|
|
209
|
+
from scadpy.d2.shape import get_shape_ring_types
|
|
210
|
+
|
|
211
|
+
return get_shape_ring_types(self)
|
|
212
|
+
|
|
213
|
+
@cached_property
|
|
214
|
+
def vertex_to_ring(self: Self) -> NDArray[np.int64]:
|
|
215
|
+
"""
|
|
216
|
+
Shortcut for :func:`get_shape_vertex_to_ring`.
|
|
217
|
+
|
|
218
|
+
See :func:`get_shape_vertex_to_ring` for full documentation.
|
|
219
|
+
"""
|
|
220
|
+
from scadpy.d2.shape import get_shape_vertex_to_ring
|
|
221
|
+
|
|
222
|
+
return get_shape_vertex_to_ring(self)
|
|
223
|
+
|
|
224
|
+
@cached_property
|
|
225
|
+
def corner_to_vertex(self: Self) -> NDArray[np.int64]:
|
|
226
|
+
"""
|
|
227
|
+
Shortcut for :func:`get_shape_corner_to_vertex`.
|
|
228
|
+
|
|
229
|
+
See :func:`get_shape_corner_to_vertex` for full documentation.
|
|
230
|
+
"""
|
|
231
|
+
from scadpy.d2.shape import get_shape_corner_to_vertex
|
|
232
|
+
|
|
233
|
+
return get_shape_corner_to_vertex(self)
|
|
234
|
+
|
|
235
|
+
@cached_property
|
|
236
|
+
def corner_angles(self: Self) -> NDArray[np.float64]:
|
|
237
|
+
"""
|
|
238
|
+
Shortcut for :func:`get_shape_corner_angles`.
|
|
239
|
+
|
|
240
|
+
See :func:`get_shape_corner_angles` for full documentation.
|
|
241
|
+
"""
|
|
242
|
+
from scadpy.d2.shape import get_shape_corner_angles
|
|
243
|
+
|
|
244
|
+
return get_shape_corner_angles(self)
|
|
245
|
+
|
|
246
|
+
@cached_property
|
|
247
|
+
def are_corners_convex(self: Self) -> NDArray[np.bool_]:
|
|
248
|
+
"""
|
|
249
|
+
Shortcut for :func:`are_shape_corners_convex`.
|
|
250
|
+
|
|
251
|
+
See :func:`are_shape_corners_convex` for full documentation.
|
|
252
|
+
"""
|
|
253
|
+
from scadpy.d2.shape import are_shape_corners_convex
|
|
254
|
+
|
|
255
|
+
return are_shape_corners_convex(self)
|
|
256
|
+
|
|
257
|
+
@cached_property
|
|
258
|
+
def corner_normals(self: Self) -> NDArray[np.float64]:
|
|
259
|
+
"""
|
|
260
|
+
Shortcut for :func:`get_shape_corner_normals`.
|
|
261
|
+
|
|
262
|
+
See :func:`get_shape_corner_normals` for full documentation.
|
|
263
|
+
"""
|
|
264
|
+
from scadpy.d2.shape import get_shape_corner_normals
|
|
265
|
+
|
|
266
|
+
return get_shape_corner_normals(self)
|
|
267
|
+
|
|
268
|
+
@cached_property
|
|
269
|
+
def corner_to_outgoing_directed_edge(self: Self) -> NDArray[np.int64]:
|
|
270
|
+
"""
|
|
271
|
+
Shortcut for :func:`get_shape_corner_to_outgoing_directed_edge`.
|
|
272
|
+
|
|
273
|
+
See :func:`get_shape_corner_to_outgoing_directed_edge` for full documentation.
|
|
274
|
+
"""
|
|
275
|
+
from scadpy.d2.shape import get_shape_corner_to_outgoing_directed_edge
|
|
276
|
+
|
|
277
|
+
return get_shape_corner_to_outgoing_directed_edge(self)
|
|
278
|
+
|
|
279
|
+
@cached_property
|
|
280
|
+
def corner_to_incoming_directed_edge(self: Self) -> NDArray[np.int64]:
|
|
281
|
+
"""
|
|
282
|
+
Shortcut for :func:`get_shape_corner_to_incoming_directed_edge`.
|
|
283
|
+
|
|
284
|
+
See :func:`get_shape_corner_to_incoming_directed_edge` for full documentation.
|
|
285
|
+
"""
|
|
286
|
+
from scadpy.d2.shape import get_shape_corner_to_incoming_directed_edge
|
|
287
|
+
|
|
288
|
+
return get_shape_corner_to_incoming_directed_edge(self)
|
|
289
|
+
|
|
290
|
+
@cached_property
|
|
291
|
+
def directed_edge_to_corner(self: Self) -> NDArray[np.int64]:
|
|
292
|
+
"""
|
|
293
|
+
Shortcut for :func:`get_shape_directed_edge_to_corner`.
|
|
294
|
+
|
|
295
|
+
See :func:`get_shape_directed_edge_to_corner` for full documentation.
|
|
296
|
+
"""
|
|
297
|
+
from scadpy.d2.shape import get_shape_directed_edge_to_corner
|
|
298
|
+
|
|
299
|
+
return get_shape_directed_edge_to_corner(self)
|
|
300
|
+
|
|
301
|
+
@cached_property
|
|
302
|
+
def directed_edge_to_vertex(self: Self) -> NDArray[np.int64]:
|
|
303
|
+
"""
|
|
304
|
+
Shortcut for :func:`get_shape_directed_edge_to_vertex`.
|
|
305
|
+
|
|
306
|
+
See :func:`get_shape_directed_edge_to_vertex` for full documentation.
|
|
307
|
+
"""
|
|
308
|
+
from scadpy.d2.shape import get_shape_directed_edge_to_vertex
|
|
309
|
+
|
|
310
|
+
return get_shape_directed_edge_to_vertex(self)
|
|
311
|
+
|
|
312
|
+
@cached_property
|
|
313
|
+
def directed_edge_to_edge(self: Self) -> NDArray[np.int64]:
|
|
314
|
+
"""
|
|
315
|
+
Shortcut for :func:`get_shape_directed_edge_to_edge`.
|
|
316
|
+
|
|
317
|
+
See :func:`get_shape_directed_edge_to_edge` for full documentation.
|
|
318
|
+
"""
|
|
319
|
+
from scadpy.d2.shape import get_shape_directed_edge_to_edge
|
|
320
|
+
|
|
321
|
+
return get_shape_directed_edge_to_edge(self)
|
|
322
|
+
|
|
323
|
+
@cached_property
|
|
324
|
+
def directed_edge_directions(self: Self) -> NDArray[np.float64]:
|
|
325
|
+
"""
|
|
326
|
+
Shortcut for :func:`get_shape_directed_edge_directions`.
|
|
327
|
+
|
|
328
|
+
See :func:`get_shape_directed_edge_directions` for full documentation.
|
|
329
|
+
"""
|
|
330
|
+
from scadpy.d2.shape import get_shape_directed_edge_directions
|
|
331
|
+
|
|
332
|
+
return get_shape_directed_edge_directions(self)
|
|
333
|
+
|
|
334
|
+
@cached_property
|
|
335
|
+
def edge_to_vertex(self: Self) -> NDArray[np.int64]:
|
|
336
|
+
"""
|
|
337
|
+
Shortcut for :func:`get_shape_edge_to_vertex`.
|
|
338
|
+
|
|
339
|
+
See :func:`get_shape_edge_to_vertex` for full documentation.
|
|
340
|
+
"""
|
|
341
|
+
from scadpy.d2.shape import get_shape_edge_to_vertex
|
|
342
|
+
|
|
343
|
+
return get_shape_edge_to_vertex(self)
|
|
344
|
+
|
|
345
|
+
@cached_property
|
|
346
|
+
def edge_lengths(self: Self) -> NDArray[np.float64]:
|
|
347
|
+
"""
|
|
348
|
+
Shortcut for :func:`get_shape_edge_lengths`.
|
|
349
|
+
|
|
350
|
+
See :func:`get_shape_edge_lengths` for full documentation.
|
|
351
|
+
"""
|
|
352
|
+
from scadpy.d2.shape import get_shape_edge_lengths
|
|
353
|
+
|
|
354
|
+
return get_shape_edge_lengths(self)
|
|
355
|
+
|
|
356
|
+
@cached_property
|
|
357
|
+
def edge_midpoints(self: Self) -> NDArray[np.float64]:
|
|
358
|
+
"""
|
|
359
|
+
Shortcut for :func:`get_shape_edge_midpoints`.
|
|
360
|
+
|
|
361
|
+
See :func:`get_shape_edge_midpoints` for full documentation.
|
|
362
|
+
"""
|
|
363
|
+
from scadpy.d2.shape import get_shape_edge_midpoints
|
|
364
|
+
|
|
365
|
+
return get_shape_edge_midpoints(self)
|
|
366
|
+
|
|
367
|
+
@cached_property
|
|
368
|
+
def edge_normals(self: Self) -> NDArray[np.float64]:
|
|
369
|
+
"""
|
|
370
|
+
Shortcut for :func:`get_shape_edge_normals`.
|
|
371
|
+
|
|
372
|
+
See :func:`get_shape_edge_normals` for full documentation.
|
|
373
|
+
"""
|
|
374
|
+
from scadpy.d2.shape import get_shape_edge_normals
|
|
375
|
+
|
|
376
|
+
return get_shape_edge_normals(self)
|
|
377
|
+
|
|
378
|
+
#############
|
|
379
|
+
# importers #
|
|
380
|
+
#############
|
|
381
|
+
|
|
382
|
+
@classmethod
|
|
383
|
+
def from_parts(cls, parts: Sequence[Part[Polygon]]) -> Shape:
|
|
384
|
+
"""Shortcut for :func:`map_parts_to_shape`.
|
|
385
|
+
|
|
386
|
+
See :func:`map_parts_to_shape` for full documentation.
|
|
387
|
+
"""
|
|
388
|
+
from scadpy import map_parts_to_shape
|
|
389
|
+
|
|
390
|
+
return map_parts_to_shape(parts)
|
|
391
|
+
|
|
392
|
+
@classmethod
|
|
393
|
+
def from_geometries(cls, geometries: Sequence[Polygon]) -> Shape:
|
|
394
|
+
"""Shortcut for :func:`map_geometries_to_shape`.
|
|
395
|
+
|
|
396
|
+
See :func:`map_geometries_to_shape` for full documentation.
|
|
397
|
+
"""
|
|
398
|
+
from scadpy.d2.shape.importers import map_geometries_to_shape
|
|
399
|
+
|
|
400
|
+
return map_geometries_to_shape(geometries)
|
|
401
|
+
|
|
402
|
+
@classmethod
|
|
403
|
+
def from_geometry(cls, geometry: Polygon) -> Shape:
|
|
404
|
+
"""Shortcut for :func:`map_geometry_to_shape`.
|
|
405
|
+
|
|
406
|
+
See :func:`map_geometry_to_shape` for full documentation.
|
|
407
|
+
"""
|
|
408
|
+
from scadpy.d2.shape.importers import map_geometry_to_shape
|
|
409
|
+
|
|
410
|
+
return map_geometry_to_shape(geometry)
|
|
411
|
+
|
|
412
|
+
@classmethod
|
|
413
|
+
def from_svg(cls, source: str | Path) -> Shape:
|
|
414
|
+
"""Shortcut for :func:`map_svg_to_shape`.
|
|
415
|
+
|
|
416
|
+
See :func:`map_svg_to_shape` for full documentation.
|
|
417
|
+
"""
|
|
418
|
+
from scadpy import map_svg_to_shape
|
|
419
|
+
|
|
420
|
+
return map_svg_to_shape(source)
|
|
421
|
+
|
|
422
|
+
@classmethod
|
|
423
|
+
def from_dxf(cls, source: str | Path) -> Shape:
|
|
424
|
+
"""Shortcut for :func:`map_dxf_to_shape`.
|
|
425
|
+
|
|
426
|
+
See :func:`map_dxf_to_shape` for full documentation.
|
|
427
|
+
"""
|
|
428
|
+
from scadpy import map_dxf_to_shape
|
|
429
|
+
|
|
430
|
+
return map_dxf_to_shape(source)
|
|
431
|
+
|
|
432
|
+
###################
|
|
433
|
+
# transformations #
|
|
434
|
+
###################
|
|
435
|
+
|
|
436
|
+
def translate(
|
|
437
|
+
self: Self,
|
|
438
|
+
translation: float | Iterable[float],
|
|
439
|
+
vertex_filter: TopologyFilter[Shape] | None = None,
|
|
440
|
+
) -> Shape:
|
|
441
|
+
"""Translate this shape.
|
|
442
|
+
|
|
443
|
+
Shortcut for :func:`translate_shape`.
|
|
444
|
+
See :func:`translate_shape` for full documentation.
|
|
445
|
+
"""
|
|
446
|
+
from scadpy import translate_shape
|
|
447
|
+
|
|
448
|
+
return translate_shape(
|
|
449
|
+
shape=self, translation=translation, vertex_filter=vertex_filter
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
def scale(
|
|
453
|
+
self: Self,
|
|
454
|
+
scale: float | Iterable[float],
|
|
455
|
+
pivot: float | Iterable[float] = 0,
|
|
456
|
+
vertex_filter: TopologyFilter[Shape] | None = None,
|
|
457
|
+
) -> Shape:
|
|
458
|
+
"""Scale this shape.
|
|
459
|
+
|
|
460
|
+
Shortcut for :func:`scale_shape`.
|
|
461
|
+
See :func:`scale_shape` for full documentation.
|
|
462
|
+
"""
|
|
463
|
+
from scadpy import scale_shape
|
|
464
|
+
|
|
465
|
+
return scale_shape(shape=self, scale=scale, pivot=pivot, vertex_filter=vertex_filter)
|
|
466
|
+
|
|
467
|
+
def resize(
|
|
468
|
+
self: Self,
|
|
469
|
+
size: Iterable[float | None],
|
|
470
|
+
auto: bool = False,
|
|
471
|
+
pivot: float | Iterable[float] | None = None,
|
|
472
|
+
vertex_filter: TopologyFilter[Shape] | None = None,
|
|
473
|
+
) -> Shape:
|
|
474
|
+
"""Resize this shape.
|
|
475
|
+
|
|
476
|
+
Shortcut for :func:`resize_shape`.
|
|
477
|
+
See :func:`resize_shape` for full documentation.
|
|
478
|
+
"""
|
|
479
|
+
from scadpy import resize_shape
|
|
480
|
+
|
|
481
|
+
return resize_shape(shape=self, size=size, auto=auto, pivot=pivot, vertex_filter=vertex_filter)
|
|
482
|
+
|
|
483
|
+
def mirror(
|
|
484
|
+
self: Self,
|
|
485
|
+
normal: float | Iterable[float],
|
|
486
|
+
pivot: float | Iterable[float] = 0,
|
|
487
|
+
) -> Shape:
|
|
488
|
+
"""Mirror this shape.
|
|
489
|
+
|
|
490
|
+
Shortcut for :func:`mirror_shape`.
|
|
491
|
+
See :func:`mirror_shape` for full documentation.
|
|
492
|
+
"""
|
|
493
|
+
from scadpy import mirror_shape
|
|
494
|
+
|
|
495
|
+
return mirror_shape(shape=self, normal=normal, pivot=pivot)
|
|
496
|
+
|
|
497
|
+
def pull(
|
|
498
|
+
self: Self,
|
|
499
|
+
distance: float,
|
|
500
|
+
pivot: float | Iterable[float] = 0,
|
|
501
|
+
vertex_filter: TopologyFilter[Shape] | None = None,
|
|
502
|
+
) -> Shape:
|
|
503
|
+
"""Move vertices of this shape toward a pivot point.
|
|
504
|
+
|
|
505
|
+
Shortcut for :func:`pull_shape`.
|
|
506
|
+
See :func:`pull_shape` for full documentation.
|
|
507
|
+
"""
|
|
508
|
+
from scadpy import pull_shape
|
|
509
|
+
|
|
510
|
+
return pull_shape(
|
|
511
|
+
shape=self, distance=distance, pivot=pivot, vertex_filter=vertex_filter
|
|
512
|
+
)
|
|
513
|
+
|
|
514
|
+
def push(
|
|
515
|
+
self: Self,
|
|
516
|
+
distance: float,
|
|
517
|
+
pivot: float | Iterable[float] = 0,
|
|
518
|
+
vertex_filter: TopologyFilter[Shape] | None = None,
|
|
519
|
+
) -> Shape:
|
|
520
|
+
"""Move vertices of this shape away from a pivot point.
|
|
521
|
+
|
|
522
|
+
Shortcut for :func:`push_shape`.
|
|
523
|
+
See :func:`push_shape` for full documentation.
|
|
524
|
+
"""
|
|
525
|
+
from scadpy import push_shape
|
|
526
|
+
|
|
527
|
+
return push_shape(
|
|
528
|
+
shape=self, distance=distance, pivot=pivot, vertex_filter=vertex_filter
|
|
529
|
+
)
|
|
530
|
+
|
|
531
|
+
def color(self: Self, color: Color) -> Shape:
|
|
532
|
+
"""Set the color of all parts in this shape.
|
|
533
|
+
|
|
534
|
+
Shortcut for :func:`color_shape`.
|
|
535
|
+
See :func:`color_shape` for full documentation.
|
|
536
|
+
"""
|
|
537
|
+
from scadpy import color_shape
|
|
538
|
+
|
|
539
|
+
return color_shape(shape=self, color=color)
|
|
540
|
+
|
|
541
|
+
def chamfer(
|
|
542
|
+
self: Self,
|
|
543
|
+
size: float | np.ndarray,
|
|
544
|
+
corner_filter: TopologyFilter[Shape] | None = None,
|
|
545
|
+
epsilon: float = 1e-8,
|
|
546
|
+
) -> Shape:
|
|
547
|
+
"""
|
|
548
|
+
Shortcut for :func:`chamfer_shape`.
|
|
549
|
+
|
|
550
|
+
See :func:`chamfer_shape` for full documentation.
|
|
551
|
+
"""
|
|
552
|
+
from scadpy import chamfer_shape
|
|
553
|
+
|
|
554
|
+
return chamfer_shape(
|
|
555
|
+
shape=self, size=size, corner_filter=corner_filter, epsilon=epsilon
|
|
556
|
+
)
|
|
557
|
+
|
|
558
|
+
def fillet(
|
|
559
|
+
self: Self,
|
|
560
|
+
size: float | np.ndarray,
|
|
561
|
+
corner_filter: TopologyFilter[Shape] | None = None,
|
|
562
|
+
segment_count: int = 32,
|
|
563
|
+
epsilon: float = 1e-8,
|
|
564
|
+
) -> Shape:
|
|
565
|
+
"""
|
|
566
|
+
Shortcut for :func:`fillet_shape`.
|
|
567
|
+
|
|
568
|
+
See :func:`fillet_shape` for full documentation.
|
|
569
|
+
"""
|
|
570
|
+
from scadpy import fillet_shape
|
|
571
|
+
|
|
572
|
+
return fillet_shape(
|
|
573
|
+
shape=self,
|
|
574
|
+
size=size,
|
|
575
|
+
corner_filter=corner_filter,
|
|
576
|
+
segment_count=segment_count,
|
|
577
|
+
epsilon=epsilon,
|
|
578
|
+
)
|
|
579
|
+
|
|
580
|
+
def convexify(self: Self) -> Shape:
|
|
581
|
+
"""
|
|
582
|
+
Shortcut for :func:`convexify_shape`.
|
|
583
|
+
|
|
584
|
+
See :func:`convexify_shape` for full documentation.
|
|
585
|
+
"""
|
|
586
|
+
from scadpy import convexify_shape
|
|
587
|
+
|
|
588
|
+
return convexify_shape(shape=self)
|
|
589
|
+
|
|
590
|
+
def fill(self: Self) -> Shape:
|
|
591
|
+
"""
|
|
592
|
+
Shortcut for :func:`fill_shape`.
|
|
593
|
+
|
|
594
|
+
See :func:`fill_shape` for full documentation.
|
|
595
|
+
"""
|
|
596
|
+
from scadpy import fill_shape
|
|
597
|
+
|
|
598
|
+
return fill_shape(shape=self)
|
|
599
|
+
|
|
600
|
+
def grow(self: Self, distance: float) -> Shape:
|
|
601
|
+
"""
|
|
602
|
+
Shortcut for :func:`grow_shape`.
|
|
603
|
+
|
|
604
|
+
See :func:`grow_shape` for full documentation.
|
|
605
|
+
"""
|
|
606
|
+
from scadpy import grow_shape
|
|
607
|
+
|
|
608
|
+
return grow_shape(shape=self, distance=distance)
|
|
609
|
+
|
|
610
|
+
def linear_cut(
|
|
611
|
+
self: Self,
|
|
612
|
+
axis: float | Iterable[float],
|
|
613
|
+
pivot: float | Iterable[float] = 0,
|
|
614
|
+
) -> Shape:
|
|
615
|
+
"""
|
|
616
|
+
Shortcut for :func:`linear_cut_shape`.
|
|
617
|
+
|
|
618
|
+
See :func:`linear_cut_shape` for full documentation.
|
|
619
|
+
"""
|
|
620
|
+
from scadpy import linear_cut_shape
|
|
621
|
+
|
|
622
|
+
return linear_cut_shape(shape=self, axis=axis, pivot=pivot)
|
|
623
|
+
|
|
624
|
+
def linear_extrude(self: Self, height: float) -> Solid:
|
|
625
|
+
"""
|
|
626
|
+
Shortcut for :func:`linear_extrude_shape`.
|
|
627
|
+
|
|
628
|
+
See :func:`linear_extrude_shape` for full documentation.
|
|
629
|
+
"""
|
|
630
|
+
from scadpy import linear_extrude_shape
|
|
631
|
+
|
|
632
|
+
return linear_extrude_shape(shape=self, height=height)
|
|
633
|
+
|
|
634
|
+
def linear_slice(
|
|
635
|
+
self: Self,
|
|
636
|
+
thickness: float,
|
|
637
|
+
direction: float | Iterable[float],
|
|
638
|
+
pivot: float | Iterable[float] = 0,
|
|
639
|
+
) -> Shape:
|
|
640
|
+
"""
|
|
641
|
+
Shortcut for :func:`linear_slice_shape`.
|
|
642
|
+
|
|
643
|
+
See :func:`linear_slice_shape` for full documentation.
|
|
644
|
+
"""
|
|
645
|
+
from scadpy import linear_slice_shape
|
|
646
|
+
|
|
647
|
+
return linear_slice_shape(
|
|
648
|
+
shape=self, thickness=thickness, direction=direction, pivot=pivot
|
|
649
|
+
)
|
|
650
|
+
|
|
651
|
+
def radial_extrude(
|
|
652
|
+
self: Self,
|
|
653
|
+
axis: float | Iterable[float],
|
|
654
|
+
start: float = 0,
|
|
655
|
+
end: float = 360,
|
|
656
|
+
pivot: float | Iterable[float] = 0,
|
|
657
|
+
segment_count: int = 64,
|
|
658
|
+
) -> Solid:
|
|
659
|
+
"""
|
|
660
|
+
Shortcut for :func:`radial_extrude_shape`.
|
|
661
|
+
|
|
662
|
+
See :func:`radial_extrude_shape` for full documentation.
|
|
663
|
+
"""
|
|
664
|
+
from scadpy import radial_extrude_shape
|
|
665
|
+
|
|
666
|
+
return radial_extrude_shape(
|
|
667
|
+
shape=self,
|
|
668
|
+
axis=axis,
|
|
669
|
+
start=start,
|
|
670
|
+
end=end,
|
|
671
|
+
pivot=pivot,
|
|
672
|
+
segment_count=segment_count,
|
|
673
|
+
)
|
|
674
|
+
|
|
675
|
+
def radial_slice(
|
|
676
|
+
self: Self, start: float = 0, end: float = 360, pivot: float | Iterable[float] = 0
|
|
677
|
+
) -> Shape:
|
|
678
|
+
"""
|
|
679
|
+
Shortcut for :func:`radial_slice_shape`.
|
|
680
|
+
|
|
681
|
+
See :func:`radial_slice_shape` for full documentation.
|
|
682
|
+
"""
|
|
683
|
+
from scadpy import radial_slice_shape
|
|
684
|
+
|
|
685
|
+
return radial_slice_shape(shape=self, start=start, end=end, pivot=pivot)
|
|
686
|
+
|
|
687
|
+
def rotate(
|
|
688
|
+
self: Self,
|
|
689
|
+
angle: float,
|
|
690
|
+
pivot: float | Iterable[float] = 0,
|
|
691
|
+
vertex_filter: TopologyFilter[Shape] | None = None,
|
|
692
|
+
) -> Shape:
|
|
693
|
+
"""
|
|
694
|
+
Shortcut for :func:`rotate_shape`.
|
|
695
|
+
|
|
696
|
+
See :func:`rotate_shape` for full documentation.
|
|
697
|
+
"""
|
|
698
|
+
from scadpy import rotate_shape
|
|
699
|
+
|
|
700
|
+
return rotate_shape(shape=self, angle=angle, pivot=pivot, vertex_filter=vertex_filter)
|
|
701
|
+
|
|
702
|
+
def shrink(self: Self, distance: float) -> Shape:
|
|
703
|
+
"""
|
|
704
|
+
Shortcut for :func:`shrink_shape`.
|
|
705
|
+
|
|
706
|
+
See :func:`shrink_shape` for full documentation.
|
|
707
|
+
"""
|
|
708
|
+
from scadpy import shrink_shape
|
|
709
|
+
|
|
710
|
+
return shrink_shape(shape=self, distance=distance)
|
|
711
|
+
|
|
712
|
+
#############
|
|
713
|
+
# exporters #
|
|
714
|
+
#############
|
|
715
|
+
|
|
716
|
+
def to_screen(
|
|
717
|
+
self: Self,
|
|
718
|
+
background_color: Color = WHITE,
|
|
719
|
+
foreground_color: Color = BLACK,
|
|
720
|
+
) -> None:
|
|
721
|
+
"""
|
|
722
|
+
Shortcut for :func:`map_shape_to_screen`.
|
|
723
|
+
|
|
724
|
+
See :func:`map_shape_to_screen` for full documentation.
|
|
725
|
+
"""
|
|
726
|
+
from scadpy import map_shape_to_screen
|
|
727
|
+
|
|
728
|
+
map_shape_to_screen(
|
|
729
|
+
shape=self,
|
|
730
|
+
background_color=background_color,
|
|
731
|
+
foreground_color=foreground_color,
|
|
732
|
+
)
|
|
733
|
+
|
|
734
|
+
def to_html_file(
|
|
735
|
+
self: Self,
|
|
736
|
+
path: str,
|
|
737
|
+
background_color: Color = WHITE,
|
|
738
|
+
foreground_color: Color = BLACK,
|
|
739
|
+
) -> int:
|
|
740
|
+
"""
|
|
741
|
+
Shortcut for :func:`map_shape_to_html_file`.
|
|
742
|
+
|
|
743
|
+
See :func:`map_shape_to_html_file` for full documentation.
|
|
744
|
+
"""
|
|
745
|
+
from scadpy import map_shape_to_html_file
|
|
746
|
+
|
|
747
|
+
return map_shape_to_html_file(
|
|
748
|
+
shape=self,
|
|
749
|
+
path=path,
|
|
750
|
+
background_color=background_color,
|
|
751
|
+
foreground_color=foreground_color,
|
|
752
|
+
)
|
|
753
|
+
|
|
754
|
+
def to_svg(self: Self) -> str:
|
|
755
|
+
"""
|
|
756
|
+
Shortcut for :func:`map_shape_to_svg`.
|
|
757
|
+
|
|
758
|
+
See :func:`map_shape_to_svg` for full documentation.
|
|
759
|
+
"""
|
|
760
|
+
from scadpy import map_shape_to_svg
|
|
761
|
+
|
|
762
|
+
return map_shape_to_svg(shape=self)
|
|
763
|
+
|
|
764
|
+
def to_svg_file(self: Self, path: str | Path) -> int:
|
|
765
|
+
"""
|
|
766
|
+
Shortcut for :func:`map_shape_to_svg_file`.
|
|
767
|
+
|
|
768
|
+
See :func:`map_shape_to_svg_file` for full documentation.
|
|
769
|
+
"""
|
|
770
|
+
from scadpy import map_shape_to_svg_file
|
|
771
|
+
|
|
772
|
+
return map_shape_to_svg_file(shape=self, path=path)
|
|
773
|
+
|
|
774
|
+
def to_dxf(self: Self) -> str:
|
|
775
|
+
"""
|
|
776
|
+
Shortcut for :func:`map_shape_to_dxf`.
|
|
777
|
+
|
|
778
|
+
See :func:`map_shape_to_dxf` for full documentation.
|
|
779
|
+
"""
|
|
780
|
+
from scadpy import map_shape_to_dxf
|
|
781
|
+
|
|
782
|
+
return map_shape_to_dxf(shape=self)
|
|
783
|
+
|
|
784
|
+
def to_dxf_file(self: Self, path: str | Path) -> int:
|
|
785
|
+
"""
|
|
786
|
+
Shortcut for :func:`map_shape_to_dxf_file`.
|
|
787
|
+
|
|
788
|
+
See :func:`map_shape_to_dxf_file` for full documentation.
|
|
789
|
+
"""
|
|
790
|
+
from scadpy import map_shape_to_dxf_file
|
|
791
|
+
|
|
792
|
+
return map_shape_to_dxf_file(shape=self, path=path)
|