From 8dafb0a690b673f519d142a631bc89ef7160e459 Mon Sep 17 00:00:00 2001 From: hm-thinkbook14p Date: Fri, 30 Oct 2026 00:40:55 +0800 Subject: [PATCH] feat(python): add named-parent native assembly operations --- python/src/vde_assembly.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/python/src/vde_assembly.cpp b/python/src/vde_assembly.cpp index da4f918b6..05458e037 100644 --- a/python/src/vde_assembly.cpp +++ b/python/src/vde_assembly.cpp @@ -81,6 +81,25 @@ Example: }, py::arg("name"), "Add an empty subassembly node") + .def("add_part_to", + [](Assembly& a, const std::string& parent, const std::string& name, + BrepModel model) { + AssemblyNode* node = a.root.find_child(parent); + if (!node) return false; + return node->add_part(name, std::move(model), + core::Transform3D::Identity()) != nullptr; + }, + py::arg("parent"), py::arg("name"), py::arg("model"), + "Add a part under an existing named node") + .def("add_subassembly_to", + [](Assembly& a, const std::string& parent, const std::string& name) { + AssemblyNode* node = a.root.find_child(parent); + if (!node) return false; + return node->add_subassembly( + name, core::Transform3D::Identity()) != nullptr; + }, + py::arg("parent"), py::arg("name"), + "Add a subassembly under an existing named node") .def("part_count", &Assembly::part_count, "Total number of leaf parts") .def("node_count", &Assembly::node_count, "Total number of tree nodes (including subassemblies)") .def("visit_parts", [](const Assembly& a) {