molejo 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.
molejo/__init__.py ADDED
@@ -0,0 +1,79 @@
1
+ # molejo - analytic flexible parts for mechanical CAD
2
+ # Copyright (C) 2026 Luis Henrique Cassis Fagundes
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ """Analytic flexible parts for mechanical CAD.
6
+
7
+ A molejo shape is a serializable spec -- a planar profile swept along a
8
+ parametric path whose numeric slots may reference named scalar
9
+ parameters. This package is the Python side: the authoring layer that
10
+ writes the spec, and the evaluator that turns spec plus parameter values
11
+ into a deterministic triangle mesh::
12
+
13
+ from molejo import Shape, Circle, Line, P
14
+
15
+ tube = Shape(
16
+ profile=Circle(radius=2.0),
17
+ path=[Line(to=(0.0, 0.0, P.length))],
18
+ path_samples=8, profile_samples=32,
19
+ )
20
+ tube.to_json() # the spec -- what a browser gets
21
+ mesh = tube.evaluate(length=46.8) # numpy vertices and faces
22
+ mesh.to_stl() # binary STL bytes
23
+
24
+ Spec version 1 is defined in :mod:`molejo.spec` and evaluated in
25
+ :mod:`molejo.evaluator`, which sweeps a circle or polygon profile along
26
+ the whole v1 path vocabulary -- ``line``, ``arc``, ``helix``, ``spline``
27
+ and ``wrap`` -- open or closed into a loop.
28
+
29
+ :mod:`molejo.brep` evaluates the same documents exactly, to closed OCCT
30
+ solids, for a consumer whose testing architecture asserts on exact
31
+ shapes::
32
+
33
+ tube.brep(length=46.8).volume()
34
+
35
+ It needs the ``brep`` extra (``pip install molejo[brep]``) and is
36
+ imported only when asked for, so a plain install meshes and exports STL
37
+ on numpy alone. See the repository's openspec/ records.
38
+ """
39
+
40
+ from .authoring import (
41
+ Arc,
42
+ Circle,
43
+ Helix,
44
+ Line,
45
+ P,
46
+ ParamRef,
47
+ Polygon,
48
+ Shape,
49
+ Spline,
50
+ Teeth,
51
+ Wrap,
52
+ )
53
+ from .evaluator import EvaluationError, Mesh, evaluate
54
+ from .spec import SPEC_VERSION, SpecError, parameter_names, validate
55
+
56
+ __author__ = "Luis Henrique Cassis Fagundes"
57
+ __email__ = "lhfagundes@gmail.com"
58
+ __version__ = "0.1.0"
59
+
60
+ __all__ = [
61
+ "SPEC_VERSION",
62
+ "Arc",
63
+ "Circle",
64
+ "EvaluationError",
65
+ "Helix",
66
+ "Line",
67
+ "Mesh",
68
+ "P",
69
+ "ParamRef",
70
+ "Polygon",
71
+ "Shape",
72
+ "SpecError",
73
+ "Spline",
74
+ "Teeth",
75
+ "Wrap",
76
+ "evaluate",
77
+ "parameter_names",
78
+ "validate",
79
+ ]