cadi-saml 0.4.0__tar.gz

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.
Files changed (68) hide show
  1. cadi_saml-0.4.0/LIBRARY.md +217 -0
  2. cadi_saml-0.4.0/PKG-INFO +244 -0
  3. cadi_saml-0.4.0/pyproject.toml +59 -0
  4. cadi_saml-0.4.0/setup.cfg +4 -0
  5. cadi_saml-0.4.0/src/cadi_saml/__init__.py +81 -0
  6. cadi_saml-0.4.0/src/cadi_saml/analysis/__init__.py +19 -0
  7. cadi_saml-0.4.0/src/cadi_saml/analysis/fea.py +385 -0
  8. cadi_saml-0.4.0/src/cadi_saml/analysis/materials.py +189 -0
  9. cadi_saml-0.4.0/src/cadi_saml/analysis/solver.py +232 -0
  10. cadi_saml-0.4.0/src/cadi_saml/analysis/visualization.py +571 -0
  11. cadi_saml-0.4.0/src/cadi_saml/backend/__init__.py +3 -0
  12. cadi_saml-0.4.0/src/cadi_saml/backend/occt_backend.py +1884 -0
  13. cadi_saml-0.4.0/src/cadi_saml/core/__init__.py +5 -0
  14. cadi_saml-0.4.0/src/cadi_saml/core/assembly.py +2195 -0
  15. cadi_saml-0.4.0/src/cadi_saml/core/ports.py +162 -0
  16. cadi_saml-0.4.0/src/cadi_saml/core/sheet_metal.py +354 -0
  17. cadi_saml-0.4.0/src/cadi_saml/core/sketch.py +213 -0
  18. cadi_saml-0.4.0/src/cadi_saml/core/text_engine.py +203 -0
  19. cadi_saml-0.4.0/src/cadi_saml/drafting/__init__.py +16 -0
  20. cadi_saml-0.4.0/src/cadi_saml/drafting/drawing.py +271 -0
  21. cadi_saml-0.4.0/src/cadi_saml/drafting/projection.py +192 -0
  22. cadi_saml-0.4.0/src/cadi_saml/ir/__init__.py +24 -0
  23. cadi_saml-0.4.0/src/cadi_saml/ir/nodes.py +224 -0
  24. cadi_saml-0.4.0/src/cadi_saml/ir/parser.py +113 -0
  25. cadi_saml-0.4.0/src/cadi_saml/kinematics/__init__.py +36 -0
  26. cadi_saml-0.4.0/src/cadi_saml/kinematics/joints.py +49 -0
  27. cadi_saml-0.4.0/src/cadi_saml/kinematics/motion_solver.py +255 -0
  28. cadi_saml-0.4.0/src/cadi_saml/kinematics/relations.py +140 -0
  29. cadi_saml-0.4.0/src/cadi_saml/kinematics/webgl_motion.py +853 -0
  30. cadi_saml-0.4.0/src/cadi_saml/reverse/__init__.py +3 -0
  31. cadi_saml-0.4.0/src/cadi_saml/reverse/step_importer.py +165 -0
  32. cadi_saml-0.4.0/src/cadi_saml/std_parts/__init__.py +26 -0
  33. cadi_saml-0.4.0/src/cadi_saml/std_parts/bearings.py +96 -0
  34. cadi_saml-0.4.0/src/cadi_saml/std_parts/fasteners.py +88 -0
  35. cadi_saml-0.4.0/src/cadi_saml/std_parts/gears.py +258 -0
  36. cadi_saml-0.4.0/src/cadi_saml/std_parts/linkages.py +192 -0
  37. cadi_saml-0.4.0/src/cadi_saml/std_parts/motors.py +170 -0
  38. cadi_saml-0.4.0/src/cadi_saml/std_parts/motorsport.py +254 -0
  39. cadi_saml-0.4.0/src/cadi_saml/std_parts/nuts.py +169 -0
  40. cadi_saml-0.4.0/src/cadi_saml/std_parts/profiles.py +138 -0
  41. cadi_saml-0.4.0/src/cadi_saml/std_parts/springs.py +249 -0
  42. cadi_saml-0.4.0/src/cadi_saml/std_parts/washers.py +93 -0
  43. cadi_saml-0.4.0/src/cadi_saml/validation/__init__.py +3 -0
  44. cadi_saml-0.4.0/src/cadi_saml/validation/validation_engineer.py +413 -0
  45. cadi_saml-0.4.0/src/cadi_saml.egg-info/PKG-INFO +244 -0
  46. cadi_saml-0.4.0/src/cadi_saml.egg-info/SOURCES.txt +66 -0
  47. cadi_saml-0.4.0/src/cadi_saml.egg-info/dependency_links.txt +1 -0
  48. cadi_saml-0.4.0/src/cadi_saml.egg-info/requires.txt +7 -0
  49. cadi_saml-0.4.0/src/cadi_saml.egg-info/top_level.txt +2 -0
  50. cadi_saml-0.4.0/src/cadpy/__init__.py +77 -0
  51. cadi_saml-0.4.0/tests/test_advanced_features.py +141 -0
  52. cadi_saml-0.4.0/tests/test_advanced_occt_capabilities.py +77 -0
  53. cadi_saml-0.4.0/tests/test_advanced_occt_modules.py +143 -0
  54. cadi_saml-0.4.0/tests/test_aesthetic_shapes.py +199 -0
  55. cadi_saml-0.4.0/tests/test_ai_engine.py +144 -0
  56. cadi_saml-0.4.0/tests/test_architectural_improvements.py +218 -0
  57. cadi_saml-0.4.0/tests/test_drafting.py +89 -0
  58. cadi_saml-0.4.0/tests/test_e2e_assembly.py +81 -0
  59. cadi_saml-0.4.0/tests/test_extended_capabilities.py +170 -0
  60. cadi_saml-0.4.0/tests/test_fea_analysis.py +127 -0
  61. cadi_saml-0.4.0/tests/test_fea_visualization.py +84 -0
  62. cadi_saml-0.4.0/tests/test_formula_student_wheel.py +436 -0
  63. cadi_saml-0.4.0/tests/test_kinematics.py +127 -0
  64. cadi_saml-0.4.0/tests/test_library_upgrades.py +174 -0
  65. cadi_saml-0.4.0/tests/test_reverse_engineering.py +46 -0
  66. cadi_saml-0.4.0/tests/test_robustness_and_safety.py +149 -0
  67. cadi_saml-0.4.0/tests/test_sheet_metal_and_smart_fillets.py +118 -0
  68. cadi_saml-0.4.0/tests/test_token_reduction.py +193 -0
@@ -0,0 +1,217 @@
1
+ # CADi SAML — Semantic Assembly Modeling Language for Python
2
+
3
+ [![PyPI Version](https://img.shields.io/pypi/v/cadi_saml.svg)](https://pypi.org/project/cadi_saml/)
4
+ [![Python Versions](https://img.shields.io/pypi/pyversions/cadi_saml.svg)](https://pypi.org/project/cadi_saml/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ **Deterministic, Zero-Coordinate, LLM-Native CAD & Kinematics Engine built on OpenCASCADE (OCCT)**
8
+
9
+ `cadi_saml` is a high-level Python CAD library purpose-built for AI/LLM code generation and mechanical engineering automation. Instead of thousands of lines of fragile coordinate transformations, `cadi_saml` enables declarative modeling — using semantic ports, kinematic joint mates, cascading parametric formulas, and monolithic mechanical assemblies — while an industrial-grade OpenCASCADE core generates watertight B-Rep solids, 2D ISO drawings, and interactive 3D WebGL motion simulations.
10
+
11
+ ---
12
+
13
+ ## ⚡ Quick Installation
14
+
15
+ ```bash
16
+ pip install cadi_saml
17
+ ```
18
+
19
+ *Note: For full B-Rep solid kernel compilation, ensure an OpenCASCADE Python binding (such as `cadquery-ocp` / `OCP`) is available in your Python environment.*
20
+
21
+ ---
22
+
23
+ ## 🚀 Key Features
24
+
25
+ ### 1. Planar Linkages & Reciprocating Engines
26
+ Model authentic monolithic crankshafts, connecting rods, pistons, and engine frames with coupled non-linear kinematics:
27
+
28
+ ```python
29
+ from cadi_saml import Assembly, OCCTBackend
30
+
31
+ with Assembly("Planar_Crank_Slider", units="mm", material="Steel4140") as asm:
32
+ # 1. Engine Bedplate Frame with Main Bearing Stand & 36mm Cylinder Bore
33
+ frame = asm.add_engine_frame(
34
+ "engine_frame",
35
+ base_length=250.0,
36
+ base_width=90.0,
37
+ cylinder_bore_dia=36.0,
38
+ origin=(0.0, 0.0, 0.0)
39
+ )
40
+
41
+ # 2. Monolithic Counterweighted Crankshaft (R=30mm)
42
+ crank = asm.add_crankshaft(
43
+ "crankshaft",
44
+ crank_radius=30.0,
45
+ disc_radius=44.0,
46
+ origin=(0.0, 0.0, 17.0)
47
+ )
48
+
49
+ # 3. Forged Connecting Rod (L=90mm)
50
+ conrod = asm.add_connecting_rod(
51
+ "connecting_rod",
52
+ length=90.0,
53
+ origin=(30.0, 0.0, 27.0)
54
+ )
55
+
56
+ # 4. Horizontal Slider Piston with Ring Grooves & Wristpin
57
+ piston = asm.add_slider_piston(
58
+ "slider_piston",
59
+ diameter=34.0,
60
+ length=42.0,
61
+ origin=(120.0, 0.0, 32.0)
62
+ )
63
+
64
+ # Define Kinematic Joints
65
+ asm.add_revolute_joint("crankshaft", origin=(0.0, 0.0, 17.0), axis=(0.0, 0.0, 1.0))
66
+ asm.add_revolute_joint("connecting_rod", origin=(30.0, 0.0, 27.0), axis=(0.0, 0.0, 1.0))
67
+ asm.add_prismatic_joint("slider_piston", origin=(120.0, 0.0, 32.0), axis=(1.0, 0.0, 0.0))
68
+
69
+ # Coupled Planar Slider-Crank Motion Coupler
70
+ asm.add_slider_crank_relation(
71
+ crank_part="crankshaft",
72
+ conrod_part="connecting_rod",
73
+ piston_part="slider_piston",
74
+ crank_radius=30.0,
75
+ conrod_length=90.0,
76
+ crank_center=(0.0, 0.0, 17.0),
77
+ slide_axis=(1.0, 0.0, 0.0)
78
+ )
79
+
80
+ # Solve forward kinematics at 90° crank rotation
81
+ states = asm.solve_motion("crankshaft", value=90.0)
82
+ print(f"Piston Position: {states['slider_piston'].translation_mm:.2f} mm")
83
+
84
+ # Generate interactive 3D WebGL motion animation
85
+ asm.export_motion_html("planar_mechanism.html", driver_part="crankshaft")
86
+ ```
87
+
88
+ ---
89
+
90
+ ### 2. Involute Spur & Helical Gear Transmissions
91
+ High-precision gear modeling with standard modules, pitch circles, keyways, and automatic center-distance speed ratios:
92
+
93
+ ```python
94
+ with Assembly("GearReductionStage", units="mm") as asm:
95
+ # Driving Pinion (m=2.5 mm, z=20)
96
+ pinion = asm.add_spur_gear("pinion", module=2.5, teeth=20, face_width=25.0, bore_dia=16.0, origin=(0, 0, 0))
97
+
98
+ # Driven Wheel (m=2.5 mm, z=40) at Center Distance a = 75 mm
99
+ wheel = asm.add_spur_gear("wheel", module=2.5, teeth=40, face_width=25.0, bore_dia=25.0, origin=(75.0, 0, 0))
100
+
101
+ # Kinematic Transmission Mate (i = 20 / 40 = 0.5)
102
+ asm.add_revolute_joint("pinion", origin=(0, 0, 0), axis=(0, 0, 1))
103
+ asm.add_revolute_joint("wheel", origin=(75.0, 0, 0), axis=(0, 0, 1))
104
+ asm.add_gear_relation("pinion", "wheel", ratio=0.5, reverse=True)
105
+ ```
106
+
107
+ ---
108
+
109
+ ### 3. Sheet Metal with DIN 6935 K-Factor Bend Deduction
110
+ Generate folded sheet metal parts with exact industrial bend allowances and flat pattern calculation:
111
+
112
+ ```python
113
+ with Assembly("SheetMetalEnclosure", units="mm") as asm:
114
+ bracket = asm.add_sheet_metal_bracket(
115
+ name="chassis_mount",
116
+ bracket_type="U",
117
+ width=50.0,
118
+ length1=60.0,
119
+ length2=40.0,
120
+ thickness=2.0,
121
+ k_factor=0.44,
122
+ hole_diameter=6.5
123
+ )
124
+ ```
125
+
126
+ ---
127
+
128
+ ### 4. Motorsport Running Gear & High-Performance Suspension
129
+ Formula Student and GT3 racing standard parts library:
130
+
131
+ ```python
132
+ with Assembly("MotorsportCorner", units="mm") as asm:
133
+ rotor = asm.add_brake_rotor("ventilated_rotor", outer_diameter=240.0)
134
+ caliper = asm.add_brake_caliper("caliper", length=140.0)
135
+ nut = asm.add_centerlock_nut("wheel_nut", size="M30")
136
+ coilover = asm.add_coilover("suspension_damper", extended_length=320.0, stroke=80.0, wire_dia=10.0)
137
+ rod_end = asm.add_heim_joint("heim_joint", thread_size="M10")
138
+ ```
139
+
140
+ ---
141
+
142
+ ### 5. Standard Hardware & Modular Profiles
143
+ Single-line insertion of off-the-shelf industrial parts:
144
+
145
+ ```python
146
+ # Aluminum Extrusion Profiles
147
+ rail = asm.add_profile("rail_x", profile_type="2040", length=300.0)
148
+
149
+ # Stepper Motors
150
+ motor = asm.add_motor("z_stepper", frame="NEMA17", body_length=40.0)
151
+
152
+ # Bearings & Fasteners
153
+ bearing = asm.add_bearing("shaft_bearing", standard="SKF", code="608ZZ")
154
+ bolt = asm.add_bolt("clamp_bolt", size="M6", length=25.0)
155
+ ```
156
+
157
+ ---
158
+
159
+ ### 6. Organic Modeling & NACA Aerodynamics
160
+ Exact C2-continuous aerodynamic NACA 4-digit airfoil lofts:
161
+
162
+ ```python
163
+ with Assembly("AerodynamicWing", units="mm") as asm:
164
+ root = asm.section_naca(code="2412", chord=160.0, center=(0, 0, 0))
165
+ tip = asm.section_naca(code="0012", chord=100.0, center=(0, 250.0, 30.0))
166
+ wing = asm.add_loft("fsae_rear_wing", sections=[root, tip])
167
+ ```
168
+
169
+ ---
170
+
171
+ ### 7. Automated 2D ISO Engineering Drawings
172
+ Export multi-view engineering technical drawings with OpenCASCADE Hidden Line Removal (HLR):
173
+
174
+ ```python
175
+ asm.export_drawing(
176
+ filepath="technical_drawing.svg",
177
+ sheet_size="A4",
178
+ title="PLANAR CRANK-SLIDER MECHANISM",
179
+ material="Steel4140"
180
+ )
181
+ ```
182
+
183
+ ---
184
+
185
+ ### 8. Geometry Validation & Physical Properties
186
+ Full B-Rep manifold verification, clash detection, and GProp physical mass properties:
187
+
188
+ ```python
189
+ from cadi_saml import ValidationEngineer
190
+
191
+ validator = ValidationEngineer()
192
+ validator.check_manifold(solid) # Is it a watertight manifold 3D solid?
193
+ clashes = validator.check_clashes(solids) # Are components colliding?
194
+
195
+ # Physical mass & center of gravity calculation
196
+ mass_props = asm.get_mass_properties()
197
+ print(f"Total Mass: {mass_props['total_mass_kg']:.3f} kg")
198
+ print(f"Center of Gravity: {mass_props['center_of_gravity']}")
199
+ ```
200
+
201
+ ---
202
+
203
+ ## 📦 Multi-Format Export Support
204
+
205
+ | Format | Extension | Target |
206
+ |---|---|---|
207
+ | **STEP** | `.step`, `.stp` | SolidWorks, Siemens NX, CATIA, Fusion 360, FreeCAD |
208
+ | **IGES** | `.igs`, `.iges` | Legacy CAM / CNC Machining |
209
+ | **STL** | `.stl` | 3D Printing (SLA / SLS / FDM) |
210
+ | **GLTF** | `.gltf`, `.glb` | Three.js, Blender, Unreal Engine, Web 3D |
211
+ | **SVG** | `.svg` | ISO 2D Engineering Drawings with Title Block |
212
+ | **HTML** | `.html` | Standalone interactive 3D WebGL Motion Player |
213
+
214
+ ---
215
+
216
+ ## 📄 License
217
+ MIT License. Developed by the CADi Team.
@@ -0,0 +1,244 @@
1
+ Metadata-Version: 2.4
2
+ Name: cadi_saml
3
+ Version: 0.4.0
4
+ Summary: CADi SAML: Deterministic, Zero-Coordinate, LLM-Native CAD & Kinematics Engine for Python built on OpenCASCADE
5
+ Author: CADi Team
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Omerersen/Project-CAD-
8
+ Project-URL: Repository, https://github.com/Omerersen/Project-CAD-
9
+ Keywords: cad,opencascade,brep,llm,ai,parametric,assembly,3d-modeling,cadpy,mechanical-engineering
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Manufacturing
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
14
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: pyyaml>=6.0
22
+ Requires-Dist: numpy>=1.24.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=7.0; extra == "dev"
25
+ Requires-Dist: build>=1.0.0; extra == "dev"
26
+ Requires-Dist: twine>=5.0.0; extra == "dev"
27
+
28
+ # CADi SAML — Semantic Assembly Modeling Language for Python
29
+
30
+ [![PyPI Version](https://img.shields.io/pypi/v/cadi_saml.svg)](https://pypi.org/project/cadi_saml/)
31
+ [![Python Versions](https://img.shields.io/pypi/pyversions/cadi_saml.svg)](https://pypi.org/project/cadi_saml/)
32
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
33
+
34
+ **Deterministic, Zero-Coordinate, LLM-Native CAD & Kinematics Engine built on OpenCASCADE (OCCT)**
35
+
36
+ `cadi_saml` is a high-level Python CAD library purpose-built for AI/LLM code generation and mechanical engineering automation. Instead of thousands of lines of fragile coordinate transformations, `cadi_saml` enables declarative modeling — using semantic ports, kinematic joint mates, cascading parametric formulas, and monolithic mechanical assemblies — while an industrial-grade OpenCASCADE core generates watertight B-Rep solids, 2D ISO drawings, and interactive 3D WebGL motion simulations.
37
+
38
+ ---
39
+
40
+ ## ⚡ Quick Installation
41
+
42
+ ```bash
43
+ pip install cadi_saml
44
+ ```
45
+
46
+ *Note: For full B-Rep solid kernel compilation, ensure an OpenCASCADE Python binding (such as `cadquery-ocp` / `OCP`) is available in your Python environment.*
47
+
48
+ ---
49
+
50
+ ## 🚀 Key Features
51
+
52
+ ### 1. Planar Linkages & Reciprocating Engines
53
+ Model authentic monolithic crankshafts, connecting rods, pistons, and engine frames with coupled non-linear kinematics:
54
+
55
+ ```python
56
+ from cadi_saml import Assembly, OCCTBackend
57
+
58
+ with Assembly("Planar_Crank_Slider", units="mm", material="Steel4140") as asm:
59
+ # 1. Engine Bedplate Frame with Main Bearing Stand & 36mm Cylinder Bore
60
+ frame = asm.add_engine_frame(
61
+ "engine_frame",
62
+ base_length=250.0,
63
+ base_width=90.0,
64
+ cylinder_bore_dia=36.0,
65
+ origin=(0.0, 0.0, 0.0)
66
+ )
67
+
68
+ # 2. Monolithic Counterweighted Crankshaft (R=30mm)
69
+ crank = asm.add_crankshaft(
70
+ "crankshaft",
71
+ crank_radius=30.0,
72
+ disc_radius=44.0,
73
+ origin=(0.0, 0.0, 17.0)
74
+ )
75
+
76
+ # 3. Forged Connecting Rod (L=90mm)
77
+ conrod = asm.add_connecting_rod(
78
+ "connecting_rod",
79
+ length=90.0,
80
+ origin=(30.0, 0.0, 27.0)
81
+ )
82
+
83
+ # 4. Horizontal Slider Piston with Ring Grooves & Wristpin
84
+ piston = asm.add_slider_piston(
85
+ "slider_piston",
86
+ diameter=34.0,
87
+ length=42.0,
88
+ origin=(120.0, 0.0, 32.0)
89
+ )
90
+
91
+ # Define Kinematic Joints
92
+ asm.add_revolute_joint("crankshaft", origin=(0.0, 0.0, 17.0), axis=(0.0, 0.0, 1.0))
93
+ asm.add_revolute_joint("connecting_rod", origin=(30.0, 0.0, 27.0), axis=(0.0, 0.0, 1.0))
94
+ asm.add_prismatic_joint("slider_piston", origin=(120.0, 0.0, 32.0), axis=(1.0, 0.0, 0.0))
95
+
96
+ # Coupled Planar Slider-Crank Motion Coupler
97
+ asm.add_slider_crank_relation(
98
+ crank_part="crankshaft",
99
+ conrod_part="connecting_rod",
100
+ piston_part="slider_piston",
101
+ crank_radius=30.0,
102
+ conrod_length=90.0,
103
+ crank_center=(0.0, 0.0, 17.0),
104
+ slide_axis=(1.0, 0.0, 0.0)
105
+ )
106
+
107
+ # Solve forward kinematics at 90° crank rotation
108
+ states = asm.solve_motion("crankshaft", value=90.0)
109
+ print(f"Piston Position: {states['slider_piston'].translation_mm:.2f} mm")
110
+
111
+ # Generate interactive 3D WebGL motion animation
112
+ asm.export_motion_html("planar_mechanism.html", driver_part="crankshaft")
113
+ ```
114
+
115
+ ---
116
+
117
+ ### 2. Involute Spur & Helical Gear Transmissions
118
+ High-precision gear modeling with standard modules, pitch circles, keyways, and automatic center-distance speed ratios:
119
+
120
+ ```python
121
+ with Assembly("GearReductionStage", units="mm") as asm:
122
+ # Driving Pinion (m=2.5 mm, z=20)
123
+ pinion = asm.add_spur_gear("pinion", module=2.5, teeth=20, face_width=25.0, bore_dia=16.0, origin=(0, 0, 0))
124
+
125
+ # Driven Wheel (m=2.5 mm, z=40) at Center Distance a = 75 mm
126
+ wheel = asm.add_spur_gear("wheel", module=2.5, teeth=40, face_width=25.0, bore_dia=25.0, origin=(75.0, 0, 0))
127
+
128
+ # Kinematic Transmission Mate (i = 20 / 40 = 0.5)
129
+ asm.add_revolute_joint("pinion", origin=(0, 0, 0), axis=(0, 0, 1))
130
+ asm.add_revolute_joint("wheel", origin=(75.0, 0, 0), axis=(0, 0, 1))
131
+ asm.add_gear_relation("pinion", "wheel", ratio=0.5, reverse=True)
132
+ ```
133
+
134
+ ---
135
+
136
+ ### 3. Sheet Metal with DIN 6935 K-Factor Bend Deduction
137
+ Generate folded sheet metal parts with exact industrial bend allowances and flat pattern calculation:
138
+
139
+ ```python
140
+ with Assembly("SheetMetalEnclosure", units="mm") as asm:
141
+ bracket = asm.add_sheet_metal_bracket(
142
+ name="chassis_mount",
143
+ bracket_type="U",
144
+ width=50.0,
145
+ length1=60.0,
146
+ length2=40.0,
147
+ thickness=2.0,
148
+ k_factor=0.44,
149
+ hole_diameter=6.5
150
+ )
151
+ ```
152
+
153
+ ---
154
+
155
+ ### 4. Motorsport Running Gear & High-Performance Suspension
156
+ Formula Student and GT3 racing standard parts library:
157
+
158
+ ```python
159
+ with Assembly("MotorsportCorner", units="mm") as asm:
160
+ rotor = asm.add_brake_rotor("ventilated_rotor", outer_diameter=240.0)
161
+ caliper = asm.add_brake_caliper("caliper", length=140.0)
162
+ nut = asm.add_centerlock_nut("wheel_nut", size="M30")
163
+ coilover = asm.add_coilover("suspension_damper", extended_length=320.0, stroke=80.0, wire_dia=10.0)
164
+ rod_end = asm.add_heim_joint("heim_joint", thread_size="M10")
165
+ ```
166
+
167
+ ---
168
+
169
+ ### 5. Standard Hardware & Modular Profiles
170
+ Single-line insertion of off-the-shelf industrial parts:
171
+
172
+ ```python
173
+ # Aluminum Extrusion Profiles
174
+ rail = asm.add_profile("rail_x", profile_type="2040", length=300.0)
175
+
176
+ # Stepper Motors
177
+ motor = asm.add_motor("z_stepper", frame="NEMA17", body_length=40.0)
178
+
179
+ # Bearings & Fasteners
180
+ bearing = asm.add_bearing("shaft_bearing", standard="SKF", code="608ZZ")
181
+ bolt = asm.add_bolt("clamp_bolt", size="M6", length=25.0)
182
+ ```
183
+
184
+ ---
185
+
186
+ ### 6. Organic Modeling & NACA Aerodynamics
187
+ Exact C2-continuous aerodynamic NACA 4-digit airfoil lofts:
188
+
189
+ ```python
190
+ with Assembly("AerodynamicWing", units="mm") as asm:
191
+ root = asm.section_naca(code="2412", chord=160.0, center=(0, 0, 0))
192
+ tip = asm.section_naca(code="0012", chord=100.0, center=(0, 250.0, 30.0))
193
+ wing = asm.add_loft("fsae_rear_wing", sections=[root, tip])
194
+ ```
195
+
196
+ ---
197
+
198
+ ### 7. Automated 2D ISO Engineering Drawings
199
+ Export multi-view engineering technical drawings with OpenCASCADE Hidden Line Removal (HLR):
200
+
201
+ ```python
202
+ asm.export_drawing(
203
+ filepath="technical_drawing.svg",
204
+ sheet_size="A4",
205
+ title="PLANAR CRANK-SLIDER MECHANISM",
206
+ material="Steel4140"
207
+ )
208
+ ```
209
+
210
+ ---
211
+
212
+ ### 8. Geometry Validation & Physical Properties
213
+ Full B-Rep manifold verification, clash detection, and GProp physical mass properties:
214
+
215
+ ```python
216
+ from cadi_saml import ValidationEngineer
217
+
218
+ validator = ValidationEngineer()
219
+ validator.check_manifold(solid) # Is it a watertight manifold 3D solid?
220
+ clashes = validator.check_clashes(solids) # Are components colliding?
221
+
222
+ # Physical mass & center of gravity calculation
223
+ mass_props = asm.get_mass_properties()
224
+ print(f"Total Mass: {mass_props['total_mass_kg']:.3f} kg")
225
+ print(f"Center of Gravity: {mass_props['center_of_gravity']}")
226
+ ```
227
+
228
+ ---
229
+
230
+ ## 📦 Multi-Format Export Support
231
+
232
+ | Format | Extension | Target |
233
+ |---|---|---|
234
+ | **STEP** | `.step`, `.stp` | SolidWorks, Siemens NX, CATIA, Fusion 360, FreeCAD |
235
+ | **IGES** | `.igs`, `.iges` | Legacy CAM / CNC Machining |
236
+ | **STL** | `.stl` | 3D Printing (SLA / SLS / FDM) |
237
+ | **GLTF** | `.gltf`, `.glb` | Three.js, Blender, Unreal Engine, Web 3D |
238
+ | **SVG** | `.svg` | ISO 2D Engineering Drawings with Title Block |
239
+ | **HTML** | `.html` | Standalone interactive 3D WebGL Motion Player |
240
+
241
+ ---
242
+
243
+ ## 📄 License
244
+ MIT License. Developed by the CADi Team.
@@ -0,0 +1,59 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cadi_saml"
7
+ version = "0.4.0"
8
+ description = "CADi SAML: Deterministic, Zero-Coordinate, LLM-Native CAD & Kinematics Engine for Python built on OpenCASCADE"
9
+ authors = [
10
+ { name = "CADi Team" }
11
+ ]
12
+ readme = "LIBRARY.md"
13
+ license = { text = "MIT" }
14
+ requires-python = ">=3.10"
15
+ keywords = [
16
+ "cad",
17
+ "opencascade",
18
+ "brep",
19
+ "llm",
20
+ "ai",
21
+ "parametric",
22
+ "assembly",
23
+ "3d-modeling",
24
+ "cadpy",
25
+ "mechanical-engineering",
26
+ ]
27
+ classifiers = [
28
+ "Development Status :: 4 - Beta",
29
+ "Intended Audience :: Manufacturing",
30
+ "Intended Audience :: Science/Research",
31
+ "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
32
+ "Topic :: Scientific/Engineering :: Mathematics",
33
+ "Programming Language :: Python :: 3",
34
+ "Programming Language :: Python :: 3.10",
35
+ "Programming Language :: Python :: 3.11",
36
+ "Programming Language :: Python :: 3.12",
37
+ ]
38
+ dependencies = [
39
+ "pyyaml>=6.0",
40
+ "numpy>=1.24.0",
41
+ ]
42
+
43
+ [project.optional-dependencies]
44
+ dev = [
45
+ "pytest>=7.0",
46
+ "build>=1.0.0",
47
+ "twine>=5.0.0",
48
+ ]
49
+
50
+ [project.urls]
51
+ Homepage = "https://github.com/Omerersen/Project-CAD-"
52
+ Repository = "https://github.com/Omerersen/Project-CAD-"
53
+
54
+ [tool.setuptools.packages.find]
55
+ where = ["src"]
56
+
57
+ [tool.pytest.ini_options]
58
+ testpaths = ["tests"]
59
+ addopts = "-ra"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,81 @@
1
+ """
2
+ cadi-saml: Deterministic, LLM-friendly CAD Modeling and Assembly Engine.
3
+ Built natively on OpenCASCADE (OCCT).
4
+ """
5
+
6
+ from .core.assembly import Assembly, PartReference, SafeEvaluator, CircularDependencyError
7
+ from .core.ports import PortStatus, StalePortError, OverConstrainedError, ConstraintStatus
8
+ from .core.sketch import Sketch
9
+ from .core.sheet_metal import SheetMetalBuilder, BendDefinition, FlatPatternResult
10
+ from .std_parts.fasteners import Fastener
11
+ from .std_parts.bearings import Bearing
12
+ from .std_parts.nuts import Nut
13
+ from .std_parts.washers import Washer
14
+ from .std_parts.profiles import Profile
15
+ from .std_parts.motors import Motor
16
+ from .std_parts.motorsport import Motorsport
17
+ from .ir.nodes import AssemblyIR, CrossSection, ExportFormat, MateType, PatternType, UnitSystem
18
+
19
+ from .ir.parser import SAMLParser
20
+ from .backend.occt_backend import OCCTBackend
21
+ from .reverse.step_importer import STEPReverseEngineer
22
+ from .validation.validation_engineer import ValidationEngineer, ClashReport
23
+ from .analysis.fea import FEAStudy, FEAResult
24
+ from .analysis.materials import Material, MATERIALS_DB, get_material
25
+ from .drafting.drawing import DrawingSheet
26
+ from .drafting.projection import HLRViewExtractor, ProjectorView
27
+ from .kinematics.joints import RevoluteJoint, PrismaticJoint
28
+ from .kinematics.relations import GearRelation, RackPinionRelation, BeltRelation, ScrewRelation
29
+ from .kinematics.motion_solver import KinematicMechanism, KinematicState
30
+
31
+ __version__ = "0.3.0"
32
+ __all__ = [
33
+ "Assembly",
34
+ "PartReference",
35
+ "SafeEvaluator",
36
+ "CircularDependencyError",
37
+ "PortStatus",
38
+ "StalePortError",
39
+ "OverConstrainedError",
40
+ "ConstraintStatus",
41
+
42
+ "Sketch",
43
+ "SheetMetalBuilder",
44
+ "BendDefinition",
45
+ "FlatPatternResult",
46
+ "CrossSection",
47
+ "PatternType",
48
+ "Fastener",
49
+ "Bearing",
50
+ "Nut",
51
+ "Washer",
52
+ "Profile",
53
+ "Motor",
54
+ "Motorsport",
55
+ "AssemblyIR",
56
+ "MateType",
57
+ "UnitSystem",
58
+ "ExportFormat",
59
+ "SAMLParser",
60
+ "OCCTBackend",
61
+ "STEPReverseEngineer",
62
+ "ValidationEngineer",
63
+ "ClashReport",
64
+ "FEAStudy",
65
+ "FEAResult",
66
+ "Material",
67
+ "MATERIALS_DB",
68
+ "get_material",
69
+ "DrawingSheet",
70
+ "HLRViewExtractor",
71
+ "ProjectorView",
72
+ "RevoluteJoint",
73
+ "PrismaticJoint",
74
+ "GearRelation",
75
+ "RackPinionRelation",
76
+ "BeltRelation",
77
+ "ScrewRelation",
78
+ "KinematicMechanism",
79
+ "KinematicState",
80
+ ]
81
+
@@ -0,0 +1,19 @@
1
+ """
2
+ cadi_saml.analysis
3
+ ==================
4
+ Finite Element Analysis (FEA) and Structural Simulation module for cadi_saml.
5
+ """
6
+
7
+ from .materials import Material, MATERIALS_DB, get_material
8
+ from .solver import LinearElasticitySolver, FEMSolution
9
+ from .fea import FEAStudy, FEAResult
10
+
11
+ __all__ = [
12
+ "Material",
13
+ "MATERIALS_DB",
14
+ "get_material",
15
+ "LinearElasticitySolver",
16
+ "FEMSolution",
17
+ "FEAStudy",
18
+ "FEAResult",
19
+ ]