Merge branch 'cylinder_face_names' into 'master'

[occ] allow to give cylinder face names in constructor

See merge request jschoeberl/netgen!430
This commit is contained in:
Joachim Schöberl 2021-10-06 14:25:40 +00:00
commit 5fc8f4b2c4

View File

@ -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) {