diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index 5ae4883f..ef928d26 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -1712,9 +1712,21 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) return BRepPrimAPI_MakeSphere (cc, r).Solid(); }, py::arg("c"), py::arg("r"), "create sphere with center 'c' and radius 'r'"); - m.def("Cylinder", [] (gp_Pnt cpnt, gp_Dir cdir, double r, double h) { - return BRepPrimAPI_MakeCylinder (gp_Ax2(cpnt, cdir), r, h).Solid(); + m.def("Cylinder", [] (gp_Pnt cpnt, gp_Dir cdir, double r, double h, + std::string bot, std::string top, std::string mantle) { + auto builder = BRepPrimAPI_MakeCylinder (gp_Ax2(cpnt, cdir), r, h); + if(mantle != "") + OCCGeometry::global_shape_properties[builder.Face().TShape()].name = mantle; + auto pyshape = py::cast(builder.Solid()); + gp_Vec v = cdir; + if(bot != "") + pyshape.attr("faces").attr("Min")(v).attr("name") = bot; + if(top != "") + pyshape.attr("faces").attr("Max")(v).attr("name") = top; + return pyshape; }, py::arg("p"), py::arg("d"), py::arg("r"), py::arg("h"), + py::arg("bot") = "", py::arg("top") = "", + py::arg("mantle") = "", "create cylinder with base point 'p', axis direction 'd', radius 'r', and height 'h'"); m.def("Cylinder", [] (gp_Ax2 ax, double r, double h) {