feat: add knowledge-driven joint design studio

This commit is contained in:
Jerry
2026-08-14 13:53:51 +08:00
parent 7d12459a32
commit 281afdfd9e
57 changed files with 269659 additions and 1152 deletions
+13 -6
View File
@@ -220,12 +220,8 @@ def apply_transform(shape, placement: ComponentPlacement):
def write_compound_step(shapes: dict[str, object], path: Path) -> None:
if not shapes:
raise OcpInterferenceError("cannot_write_empty_joint_compound")
compound = compound_shape(shapes)
ocp = _import_ocp()
compound = ocp["TopoDS_Compound"]()
builder = ocp["BRep_Builder"]()
builder.MakeCompound(compound)
for shape in shapes.values():
builder.Add(compound, shape)
path.parent.mkdir(parents=True, exist_ok=True)
writer = ocp["STEPControl_Writer"]()
writer.Transfer(compound, ocp["STEPControl_AsIs"])
@@ -234,6 +230,18 @@ def write_compound_step(shapes: dict[str, object], path: Path) -> None:
raise OcpInterferenceError(f"step_write_failed: {path}")
def compound_shape(shapes: dict[str, object]):
if not shapes:
raise OcpInterferenceError("cannot_build_empty_joint_compound")
ocp = _import_ocp()
compound = ocp["TopoDS_Compound"]()
builder = ocp["BRep_Builder"]()
builder.MakeCompound(compound)
for shape in shapes.values():
builder.Add(compound, shape)
return compound
def detect_interferences_from_placed_shapes(
shapes: dict[str, object],
*,
@@ -288,4 +296,3 @@ def detect_interferences_from_placed_shapes(
)
)
return metrics, results