mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-26 21:00:34 +05:00
set color of CSG top-level object
This commit is contained in:
parent
7e83edabf1
commit
5de14c63a4
@ -374,7 +374,8 @@ DLL_HEADER void ExportCSG(py::module &m)
|
||||
self.Save (filename);
|
||||
}))
|
||||
.def("Add",
|
||||
[] (CSGeometry & self, shared_ptr<SPSolid> solid, py::list bcmod, double maxh)
|
||||
[] (CSGeometry & self, shared_ptr<SPSolid> solid, py::list bcmod, double maxh,
|
||||
py::tuple col)
|
||||
{
|
||||
solid->AddSurfaces (self);
|
||||
solid->GiveUpOwner();
|
||||
@ -384,6 +385,12 @@ DLL_HEADER void ExportCSG(py::module &m)
|
||||
self.GetTopLevelObject(tlonr)->SetTransparent(solid->IsTransparent());
|
||||
self.GetTopLevelObject(tlonr)->SetMaxH(maxh);
|
||||
|
||||
// cout << "rgb = " << py::len(rgb) << endl;
|
||||
if (py::len(col)==3)
|
||||
self.GetTopLevelObject(tlonr) -> SetRGB(py::cast<double>(col[0]),
|
||||
py::cast<double>(col[1]),
|
||||
py::cast<double>(col[2]));
|
||||
|
||||
// bcmod is list of tuples ( solid, bcnr )
|
||||
for (int i = 0; i < py::len(bcmod); i++)
|
||||
{
|
||||
@ -412,7 +419,8 @@ DLL_HEADER void ExportCSG(py::module &m)
|
||||
}
|
||||
return tlonr;
|
||||
},
|
||||
py::arg("solid"), py::arg("bcmod")=py::list(), py::arg("maxh")=1e99
|
||||
py::arg("solid"), py::arg("bcmod")=py::list(), py::arg("maxh")=1e99,
|
||||
py::arg("col")=py::tuple()
|
||||
)
|
||||
|
||||
.def("AddSurface", FunctionPointer
|
||||
|
@ -35,6 +35,6 @@ p3 = Plane(Pnt(0,0,0),Vec(0,-1,0)).bc("left")
|
||||
p4 = Plane(Pnt(1,1,1),Vec(0,1,0)).bc("right")
|
||||
p5 = Plane(Pnt(0,0,0),Vec(0,0,-1)).bc("bottom")
|
||||
p6 = Plane(Pnt(1,1,1),Vec(0,0,1)).bc("top")
|
||||
unit_cube.Add (p1*p2*p3*p4*p5*p6)
|
||||
unit_cube.Add (p1*p2*p3*p4*p5*p6, col=(0,0,1))
|
||||
# unit_cube.Add (OrthoBrick(Pnt(0,0,0), Pnt(1,1,1)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user