feat(product): owner decisions on multi-body parts
- A cut that splits the body is no longer refused: cut_rsolid(on_split="pieces")
(the default) returns every piece as list[Solid] ordered by centroid, recorded as
make_cut_rsolid_list with piece_order=centroid and replayed in that order;
on_split="error" keeps the strict contract. One-piece cuts are unchanged.
- Pieces become bodies: make_part_rpart(body=pieces) -> body_1..n,
bodies={"bar": pieces} -> bar_1..n.
- Overlapping bodies are allowed and warned: inspect_body_overlaps_rlist and a
BodyOverlapWarning when the definition is built.
- Multi-body definitions use profile simplecad-part-definition-3 (new schema);
profile 2 is back to its dev bytes, so profile-2 readers refuse them.
- part_from_bodies: the implicit-Part rule (all open bodies, named by variable).
- Skill pages, API docs, stubs, design doc section 9, SDK defect 24.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -85,6 +85,15 @@ void bind_structure(py::module_& m) {
|
||||
throw scad::TypeError("give exactly one of body (a Solid) or bodies (several named solids)");
|
||||
if (!bodies.is_none())
|
||||
return sp::make_part_rpart(text(part_id, "part_id"), body_list(bodies), optional_name(name));
|
||||
if (is_pieces(body) && py::len(body) > 1) { // a split cut: its pieces are bodies body_1 .. body_n
|
||||
std::vector<sp::Body> pieces;
|
||||
add_bodies(pieces, sp::kDefaultBodyId, body);
|
||||
return sp::make_part_rpart(text(part_id, "part_id"), pieces, optional_name(name));
|
||||
}
|
||||
if (is_pieces(body))
|
||||
return sp::make_part_rpart(text(part_id, "part_id"),
|
||||
typed<Solid>(py::reinterpret_borrow<py::object>(body[py::int_(0)]), "body"),
|
||||
optional_name(name));
|
||||
return sp::make_part_rpart(text(part_id, "part_id"), typed<Solid>(body, "body must be a Solid"),
|
||||
optional_name(name));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user