feat: add knowledge-driven joint design studio
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user