feat: integrate SimpleCADAPI 2.0.2 CAD workflows

This commit is contained in:
Jerry
2026-08-03 11:17:05 +08:00
parent b5738e9109
commit c3a0f269b7
481 changed files with 110229 additions and 12826 deletions
@@ -2,6 +2,7 @@ from __future__ import annotations
import importlib.util
import json
import math
import tempfile
import unittest
from pathlib import Path
@@ -226,6 +227,63 @@ class CadExperienceTest(unittest.TestCase):
self.assertFalse(normalized["reconstruction_eligible"])
self.assertIn("no_closed_solid", normalized["rejection_reasons"])
def test_spur_gear_flanks_are_not_mislabeled_as_hole_pattern(self):
surfaces = [
{
"type": "cylinder",
"axis": [1.0, 0.0, 0.0],
"location": [0.0, 0.0, 0.0],
"radius": radius,
"area": 100.0,
}
for radius in (3.0, 8.8)
]
for index in range(40):
angle = 2.0 * math.pi * index / 40.0
surfaces.append(
{
"type": "cylinder",
"axis": [1.0, 0.0, 0.0],
"location": [
0.0,
7.5 * math.cos(angle),
7.5 * math.sin(angle),
],
"radius": 3.2,
"area": 10.0,
}
)
surfaces.extend(
{"type": "plane", "area": 250.0} for _ in range(2)
)
family, features, constraints, summary = STEP_MODULE._semantic_summary(
surfaces, [4.0, 0.0, 0.0], [8.0, 17.6, 17.6]
)
feature_roles = {item["type"] for item in features}
self.assertEqual("external_spur_gear", family)
self.assertEqual(20, summary["inferred_tooth_count"])
self.assertIn("external_spur_gear", feature_roles)
self.assertIn("equal_angular_tooth_pattern", feature_roles)
self.assertNotIn("repeated_axial_hole_pattern", feature_roles)
self.assertIn(
"equal_angular_tooth_pattern",
{item["id"] for item in constraints},
)
parameters = STEP_MODULE._semantic_parameter_candidates(
surfaces,
[4.0, 0.0, 0.0],
[8.0, 17.6, 17.6],
features,
summary,
)
values = {item["name"]: item["value"] for item in parameters}
self.assertEqual(20, values["tooth_count"])
self.assertAlmostEqual(0.8, values["gear_module"], places=6)
self.assertEqual(8.0, values["gear_width"])
self.assertNotIn("repeated_feature_count", values)
def test_sha256_identity_deduplicates_renamed_sources(self):
digest = "0" * 64
with tempfile.TemporaryDirectory() as temporary: