ANYgeometry 0.2.1__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.
- anygeometry/__init__.py +324 -0
- anygeometry/__main__.py +92 -0
- anygeometry/audit.py +984 -0
- anygeometry/chains.py +74 -0
- anygeometry/closure.py +622 -0
- anygeometry/curves.py +286 -0
- anygeometry/editing.py +1118 -0
- anygeometry/entities.py +168 -0
- anygeometry/errors.py +13 -0
- anygeometry/evaluation.py +69 -0
- anygeometry/features.py +1486 -0
- anygeometry/generators/__init__.py +5 -0
- anygeometry/generators/layout.py +117 -0
- anygeometry/generators/structural.py +423 -0
- anygeometry/identity.py +290 -0
- anygeometry/intersections.py +4446 -0
- anygeometry/model.py +6921 -0
- anygeometry/operations.py +910 -0
- anygeometry/overlaps.py +610 -0
- anygeometry/policies.py +19 -0
- anygeometry/predicates.py +1124 -0
- anygeometry/py.typed +1 -0
- anygeometry/serialization.py +1834 -0
- anygeometry/sketch.py +298 -0
- anygeometry/spatial.py +1190 -0
- anygeometry/strict_audit.py +4075 -0
- anygeometry/structural.py +1550 -0
- anygeometry/surfaces.py +601 -0
- anygeometry/tolerance.py +202 -0
- anygeometry/transactions.py +148 -0
- anygeometry-0.2.1.dist-info/METADATA +286 -0
- anygeometry-0.2.1.dist-info/RECORD +36 -0
- anygeometry-0.2.1.dist-info/WHEEL +5 -0
- anygeometry-0.2.1.dist-info/entry_points.txt +2 -0
- anygeometry-0.2.1.dist-info/licenses/LICENSE +674 -0
- anygeometry-0.2.1.dist-info/top_level.txt +1 -0
anygeometry/__init__.py
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"""Lightweight structural-surface geometry shared by the ANY ecosystem."""
|
|
2
|
+
|
|
3
|
+
from .curves import Arc, ArcFrame, CurveShape, DegenerateArcError, Spline, Straight
|
|
4
|
+
from .closure import ModelClosure, extract_model_closure
|
|
5
|
+
from .entities import Edge, EntityKind, EntityRef, Face, OrientedEdge, Vertex, VertexRole
|
|
6
|
+
from .editing import (
|
|
7
|
+
InsertResult,
|
|
8
|
+
Measurement,
|
|
9
|
+
PatternResult,
|
|
10
|
+
circular_pattern,
|
|
11
|
+
copy_entities,
|
|
12
|
+
insert_model,
|
|
13
|
+
linear_pattern,
|
|
14
|
+
measure,
|
|
15
|
+
mirror_entities,
|
|
16
|
+
reverse_edge,
|
|
17
|
+
reverse_face,
|
|
18
|
+
)
|
|
19
|
+
from .errors import GeometryError, GeometryTopologyError
|
|
20
|
+
from .evaluation import (
|
|
21
|
+
edge_tangent_many,
|
|
22
|
+
evaluate_edge_many,
|
|
23
|
+
evaluate_face_many,
|
|
24
|
+
face_derivatives_many,
|
|
25
|
+
face_normal_many,
|
|
26
|
+
project_to_face_many,
|
|
27
|
+
)
|
|
28
|
+
from .features import (
|
|
29
|
+
FeatureExecution,
|
|
30
|
+
FeatureExecutor,
|
|
31
|
+
FeatureHistory,
|
|
32
|
+
FeatureInputRef,
|
|
33
|
+
FeatureOutputRef,
|
|
34
|
+
FeatureRecord,
|
|
35
|
+
FeatureRegistry,
|
|
36
|
+
FeatureResult,
|
|
37
|
+
FeatureStatus,
|
|
38
|
+
RegenerationReport,
|
|
39
|
+
builtin_feature_registry,
|
|
40
|
+
)
|
|
41
|
+
from .intersections import (
|
|
42
|
+
ExpectedImprintChange,
|
|
43
|
+
FaceIntersection,
|
|
44
|
+
ImprintApplication,
|
|
45
|
+
ImprintOperation,
|
|
46
|
+
ImprintPlan,
|
|
47
|
+
apply_imprint,
|
|
48
|
+
clip_line_to_face,
|
|
49
|
+
intersect_faces,
|
|
50
|
+
intersect_surfaces,
|
|
51
|
+
line_cylinder,
|
|
52
|
+
line_line,
|
|
53
|
+
line_plane,
|
|
54
|
+
numerical_surface_intersection,
|
|
55
|
+
plane_cylinder,
|
|
56
|
+
plane_plane,
|
|
57
|
+
plan_imprint,
|
|
58
|
+
query_intersection,
|
|
59
|
+
)
|
|
60
|
+
from .model import GeometryModel
|
|
61
|
+
from .identity import EntityHandle, Resolution, ResolutionStatus
|
|
62
|
+
from .transactions import AABBChange, ChangeSet, TopologyTransaction
|
|
63
|
+
from .tolerance import DEFAULT_TOLERANCE_POLICY, TolerancePolicy, feature_extent
|
|
64
|
+
from .predicates import (
|
|
65
|
+
IntersectionComponent,
|
|
66
|
+
IntersectionDimension,
|
|
67
|
+
IntersectionKind,
|
|
68
|
+
IntersectionQuality,
|
|
69
|
+
IntersectionResult,
|
|
70
|
+
ParameterRange as IntersectionParameterRange,
|
|
71
|
+
qualified_line_line,
|
|
72
|
+
qualified_line_cylinder,
|
|
73
|
+
qualified_line_plane,
|
|
74
|
+
qualified_plane_plane,
|
|
75
|
+
qualified_segment_segment,
|
|
76
|
+
)
|
|
77
|
+
from .policies import MutationPolicy
|
|
78
|
+
from .spatial import (
|
|
79
|
+
AABB,
|
|
80
|
+
AABBTree,
|
|
81
|
+
IndexDiagnostics,
|
|
82
|
+
IndexUpdate,
|
|
83
|
+
IndexUpdateKind,
|
|
84
|
+
NearestQueryResult,
|
|
85
|
+
)
|
|
86
|
+
from .audit import (
|
|
87
|
+
AuditEvidenceQuality,
|
|
88
|
+
AuditEntity,
|
|
89
|
+
AuditCode,
|
|
90
|
+
AuditIssue,
|
|
91
|
+
AuditMetrics,
|
|
92
|
+
AuditPolicy,
|
|
93
|
+
AuditReport,
|
|
94
|
+
AuditScope,
|
|
95
|
+
AuditSeverity,
|
|
96
|
+
AuditWitness,
|
|
97
|
+
BroadPhaseDiagnostics,
|
|
98
|
+
)
|
|
99
|
+
from .strict_audit import audit_changed_region, strict_audit
|
|
100
|
+
from .structural import (
|
|
101
|
+
Attachment,
|
|
102
|
+
AttachmentEvidence,
|
|
103
|
+
AttachmentKind,
|
|
104
|
+
AttachmentTargetKind,
|
|
105
|
+
BoundaryPolicy,
|
|
106
|
+
Coedge,
|
|
107
|
+
ConnectivityPolicy,
|
|
108
|
+
ConnectionIntent,
|
|
109
|
+
FaceUse,
|
|
110
|
+
FrozenMetadata,
|
|
111
|
+
Junction,
|
|
112
|
+
JunctionKind,
|
|
113
|
+
JunctionMemberUse,
|
|
114
|
+
Member,
|
|
115
|
+
MemberEdgeUse,
|
|
116
|
+
NonManifoldPolicy,
|
|
117
|
+
Orientation,
|
|
118
|
+
ParameterRange,
|
|
119
|
+
Part,
|
|
120
|
+
Sheet,
|
|
121
|
+
SheetTopologyPolicy,
|
|
122
|
+
)
|
|
123
|
+
from .overlaps import (
|
|
124
|
+
FaceOverlap,
|
|
125
|
+
OverlapFragmentation,
|
|
126
|
+
find_coplanar_overlaps,
|
|
127
|
+
fragment_coplanar_overlaps,
|
|
128
|
+
)
|
|
129
|
+
from .operations import (
|
|
130
|
+
closest_point,
|
|
131
|
+
fragment_face,
|
|
132
|
+
project,
|
|
133
|
+
punch_hole,
|
|
134
|
+
split_face,
|
|
135
|
+
split_face_at,
|
|
136
|
+
split_face_between,
|
|
137
|
+
strip_face,
|
|
138
|
+
surface_point,
|
|
139
|
+
transform,
|
|
140
|
+
trim_face,
|
|
141
|
+
)
|
|
142
|
+
from .serialization import from_dict, read_geometry, to_dict, write_geometry
|
|
143
|
+
from .sketch import (
|
|
144
|
+
SketchConstraint,
|
|
145
|
+
SketchDefinition,
|
|
146
|
+
SketchPlane,
|
|
147
|
+
face_sketch_plane,
|
|
148
|
+
materialize_sketch,
|
|
149
|
+
solve_sketch,
|
|
150
|
+
)
|
|
151
|
+
from .surfaces import (
|
|
152
|
+
CoonsSurface,
|
|
153
|
+
Cone,
|
|
154
|
+
Cylinder,
|
|
155
|
+
Plane,
|
|
156
|
+
RuledSurface,
|
|
157
|
+
Surface,
|
|
158
|
+
SurfaceProtocol,
|
|
159
|
+
closest_uv,
|
|
160
|
+
surface_normal,
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
__all__ = [
|
|
164
|
+
"AABB",
|
|
165
|
+
"AABBChange",
|
|
166
|
+
"AABBTree",
|
|
167
|
+
"Arc",
|
|
168
|
+
"ArcFrame",
|
|
169
|
+
"Attachment",
|
|
170
|
+
"AttachmentEvidence",
|
|
171
|
+
"AttachmentKind",
|
|
172
|
+
"AttachmentTargetKind",
|
|
173
|
+
"AuditCode",
|
|
174
|
+
"AuditEntity",
|
|
175
|
+
"AuditEvidenceQuality",
|
|
176
|
+
"AuditIssue",
|
|
177
|
+
"AuditMetrics",
|
|
178
|
+
"AuditPolicy",
|
|
179
|
+
"AuditReport",
|
|
180
|
+
"AuditScope",
|
|
181
|
+
"AuditSeverity",
|
|
182
|
+
"AuditWitness",
|
|
183
|
+
"BoundaryPolicy",
|
|
184
|
+
"BroadPhaseDiagnostics",
|
|
185
|
+
"ChangeSet",
|
|
186
|
+
"Coedge",
|
|
187
|
+
"ConnectivityPolicy",
|
|
188
|
+
"ConnectionIntent",
|
|
189
|
+
"CoonsSurface",
|
|
190
|
+
"Cone",
|
|
191
|
+
"CurveShape",
|
|
192
|
+
"Cylinder",
|
|
193
|
+
"DegenerateArcError",
|
|
194
|
+
"Edge",
|
|
195
|
+
"EntityKind",
|
|
196
|
+
"EntityHandle",
|
|
197
|
+
"EntityRef",
|
|
198
|
+
"ExpectedImprintChange",
|
|
199
|
+
"Face",
|
|
200
|
+
"FaceIntersection",
|
|
201
|
+
"FaceOverlap",
|
|
202
|
+
"FaceUse",
|
|
203
|
+
"FeatureExecution",
|
|
204
|
+
"FeatureExecutor",
|
|
205
|
+
"FeatureHistory",
|
|
206
|
+
"FeatureInputRef",
|
|
207
|
+
"FeatureOutputRef",
|
|
208
|
+
"FeatureRecord",
|
|
209
|
+
"FeatureRegistry",
|
|
210
|
+
"FeatureResult",
|
|
211
|
+
"FeatureStatus",
|
|
212
|
+
"GeometryError",
|
|
213
|
+
"GeometryModel",
|
|
214
|
+
"GeometryTopologyError",
|
|
215
|
+
"FrozenMetadata",
|
|
216
|
+
"IndexDiagnostics",
|
|
217
|
+
"IndexUpdate",
|
|
218
|
+
"IndexUpdateKind",
|
|
219
|
+
"ImprintApplication",
|
|
220
|
+
"ImprintOperation",
|
|
221
|
+
"ImprintPlan",
|
|
222
|
+
"IntersectionComponent",
|
|
223
|
+
"IntersectionDimension",
|
|
224
|
+
"IntersectionKind",
|
|
225
|
+
"IntersectionParameterRange",
|
|
226
|
+
"IntersectionQuality",
|
|
227
|
+
"IntersectionResult",
|
|
228
|
+
"InsertResult",
|
|
229
|
+
"Measurement",
|
|
230
|
+
"Member",
|
|
231
|
+
"MemberEdgeUse",
|
|
232
|
+
"ModelClosure",
|
|
233
|
+
"MutationPolicy",
|
|
234
|
+
"NearestQueryResult",
|
|
235
|
+
"NonManifoldPolicy",
|
|
236
|
+
"Orientation",
|
|
237
|
+
"OrientedEdge",
|
|
238
|
+
"OverlapFragmentation",
|
|
239
|
+
"Plane",
|
|
240
|
+
"PatternResult",
|
|
241
|
+
"ParameterRange",
|
|
242
|
+
"Part",
|
|
243
|
+
"RegenerationReport",
|
|
244
|
+
"Resolution",
|
|
245
|
+
"ResolutionStatus",
|
|
246
|
+
"RuledSurface",
|
|
247
|
+
"SketchConstraint",
|
|
248
|
+
"SketchDefinition",
|
|
249
|
+
"SketchPlane",
|
|
250
|
+
"Sheet",
|
|
251
|
+
"SheetTopologyPolicy",
|
|
252
|
+
"Spline",
|
|
253
|
+
"Straight",
|
|
254
|
+
"Surface",
|
|
255
|
+
"SurfaceProtocol",
|
|
256
|
+
"TolerancePolicy",
|
|
257
|
+
"TopologyTransaction",
|
|
258
|
+
"Vertex",
|
|
259
|
+
"VertexRole",
|
|
260
|
+
"apply_imprint",
|
|
261
|
+
"audit_changed_region",
|
|
262
|
+
"closest_point",
|
|
263
|
+
"clip_line_to_face",
|
|
264
|
+
"closest_uv",
|
|
265
|
+
"copy_entities",
|
|
266
|
+
"circular_pattern",
|
|
267
|
+
"edge_tangent_many",
|
|
268
|
+
"evaluate_edge_many",
|
|
269
|
+
"evaluate_face_many",
|
|
270
|
+
"extract_model_closure",
|
|
271
|
+
"face_derivatives_many",
|
|
272
|
+
"face_normal_many",
|
|
273
|
+
"fragment_face",
|
|
274
|
+
"fragment_coplanar_overlaps",
|
|
275
|
+
"face_sketch_plane",
|
|
276
|
+
"from_dict",
|
|
277
|
+
"find_coplanar_overlaps",
|
|
278
|
+
"feature_extent",
|
|
279
|
+
"intersect_faces",
|
|
280
|
+
"intersect_surfaces",
|
|
281
|
+
"insert_model",
|
|
282
|
+
"line_cylinder",
|
|
283
|
+
"line_line",
|
|
284
|
+
"line_plane",
|
|
285
|
+
"qualified_line_line",
|
|
286
|
+
"qualified_line_cylinder",
|
|
287
|
+
"qualified_line_plane",
|
|
288
|
+
"qualified_plane_plane",
|
|
289
|
+
"qualified_segment_segment",
|
|
290
|
+
"linear_pattern",
|
|
291
|
+
"measure",
|
|
292
|
+
"materialize_sketch",
|
|
293
|
+
"mirror_entities",
|
|
294
|
+
"numerical_surface_intersection",
|
|
295
|
+
"plane_cylinder",
|
|
296
|
+
"plane_plane",
|
|
297
|
+
"plan_imprint",
|
|
298
|
+
"query_intersection",
|
|
299
|
+
"project",
|
|
300
|
+
"project_to_face_many",
|
|
301
|
+
"punch_hole",
|
|
302
|
+
"read_geometry",
|
|
303
|
+
"reverse_edge",
|
|
304
|
+
"reverse_face",
|
|
305
|
+
"split_face",
|
|
306
|
+
"split_face_at",
|
|
307
|
+
"split_face_between",
|
|
308
|
+
"strip_face",
|
|
309
|
+
"strict_audit",
|
|
310
|
+
"solve_sketch",
|
|
311
|
+
"surface_normal",
|
|
312
|
+
"surface_point",
|
|
313
|
+
"to_dict",
|
|
314
|
+
"transform",
|
|
315
|
+
"trim_face",
|
|
316
|
+
"write_geometry",
|
|
317
|
+
"builtin_feature_registry",
|
|
318
|
+
"DEFAULT_TOLERANCE_POLICY",
|
|
319
|
+
"Junction",
|
|
320
|
+
"JunctionKind",
|
|
321
|
+
"JunctionMemberUse",
|
|
322
|
+
]
|
|
323
|
+
|
|
324
|
+
__version__ = "0.2.1"
|
anygeometry/__main__.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Command-line inspection and example generation for ANYgeometry."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import json
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Sequence
|
|
9
|
+
|
|
10
|
+
from . import __version__
|
|
11
|
+
from .generators import stiffened_panel
|
|
12
|
+
from .serialization import read_geometry, write_geometry
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _parser() -> argparse.ArgumentParser:
|
|
16
|
+
parser = argparse.ArgumentParser(
|
|
17
|
+
prog="anygeometry",
|
|
18
|
+
description="Inspect or create a neutral ANYgeometry document.",
|
|
19
|
+
)
|
|
20
|
+
parser.add_argument("geometry_file", nargs="?", type=Path)
|
|
21
|
+
parser.add_argument(
|
|
22
|
+
"--write-example",
|
|
23
|
+
metavar="PATH",
|
|
24
|
+
type=Path,
|
|
25
|
+
help="write a small stiffened-panel geometry document",
|
|
26
|
+
)
|
|
27
|
+
parser.add_argument(
|
|
28
|
+
"--json",
|
|
29
|
+
action="store_true",
|
|
30
|
+
help="emit the inspection summary as JSON",
|
|
31
|
+
)
|
|
32
|
+
parser.add_argument("--version", action="version", version=__version__)
|
|
33
|
+
return parser
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _summary(path: Path) -> dict[str, object]:
|
|
37
|
+
geometry = read_geometry(path)
|
|
38
|
+
return {
|
|
39
|
+
"path": str(path),
|
|
40
|
+
"vertices": len(geometry.vertices),
|
|
41
|
+
"edges": len(geometry.edges),
|
|
42
|
+
"faces": len(geometry.faces),
|
|
43
|
+
"groups": {
|
|
44
|
+
name: len(geometry.group(name)) for name in sorted(geometry.groups)
|
|
45
|
+
},
|
|
46
|
+
"replacement_history": len(geometry.replacement_history()),
|
|
47
|
+
"topology": "valid",
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def main(args: Sequence[str] | None = None) -> int:
|
|
52
|
+
"""Run the lightweight CLI and return a process exit status."""
|
|
53
|
+
|
|
54
|
+
parser = _parser()
|
|
55
|
+
options = parser.parse_args(args)
|
|
56
|
+
if options.write_example is not None and options.geometry_file is not None:
|
|
57
|
+
parser.error("geometry_file and --write-example are mutually exclusive")
|
|
58
|
+
if options.write_example is not None:
|
|
59
|
+
geometry = stiffened_panel(
|
|
60
|
+
4.0,
|
|
61
|
+
3.0,
|
|
62
|
+
longitudinal_spacing=1.0,
|
|
63
|
+
transverse_spacing=2.0,
|
|
64
|
+
)
|
|
65
|
+
write_geometry(options.write_example, geometry)
|
|
66
|
+
print(f"Wrote {options.write_example}")
|
|
67
|
+
return 0
|
|
68
|
+
if options.geometry_file is None:
|
|
69
|
+
parser.print_help()
|
|
70
|
+
return 0
|
|
71
|
+
|
|
72
|
+
summary = _summary(options.geometry_file)
|
|
73
|
+
if options.json:
|
|
74
|
+
print(json.dumps(summary, indent=2, sort_keys=True))
|
|
75
|
+
else:
|
|
76
|
+
print(
|
|
77
|
+
f"{summary['path']}: {summary['vertices']} vertices, "
|
|
78
|
+
f"{summary['edges']} edges, {summary['faces']} faces; topology valid"
|
|
79
|
+
)
|
|
80
|
+
groups = summary["groups"]
|
|
81
|
+
if groups:
|
|
82
|
+
print(
|
|
83
|
+
"Groups: "
|
|
84
|
+
+ ", ".join(
|
|
85
|
+
f"{name}={count}" for name, count in groups.items()
|
|
86
|
+
)
|
|
87
|
+
)
|
|
88
|
+
return 0
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
if __name__ == "__main__":
|
|
92
|
+
raise SystemExit(main())
|