allow to set names for all shapes (e.g. edges)

This commit is contained in:
Joachim Schoeberl 2021-07-28 20:16:32 +02:00
parent f2e8425145
commit 8f2e0611e0
2 changed files with 12 additions and 5 deletions

View File

@ -373,7 +373,7 @@ namespace netgen
int facenr = 0; int facenr = 0;
int edgenr = mesh.GetNSeg(); // int edgenr = mesh.GetNSeg();
(*testout) << "faces = " << geom.fmap.Extent() << endl; (*testout) << "faces = " << geom.fmap.Extent() << endl;
int curr = 0; int curr = 0;
@ -468,7 +468,6 @@ namespace netgen
cof = BRep_Tool::CurveOnSurface (edge, face, s0, s1); cof = BRep_Tool::CurveOnSurface (edge, face, s0, s1);
int geomedgenr = geom.emap.FindIndex(edge); int geomedgenr = geom.emap.FindIndex(edge);
NgArray <MeshPoint> mp; NgArray <MeshPoint> mp;
NgArray <double> params; NgArray <double> params;
@ -522,12 +521,13 @@ namespace netgen
for (size_t i = 1; i <= mp.Size()+1; i++) for (size_t i = 1; i <= mp.Size()+1; i++)
{ {
edgenr++; // edgenr++;
Segment seg; Segment seg;
seg[0] = pnums[i-1]; seg[0] = pnums[i-1];
seg[1] = pnums[i]; seg[1] = pnums[i];
seg.edgenr = edgenr; // seg.edgenr = edgenr;
seg.edgenr = geomedgenr;
seg.si = facenr; seg.si = facenr;
seg.epgeominfo[0].dist = params[i-1]; seg.epgeominfo[0].dist = params[i-1];
seg.epgeominfo[1].dist = params[i]; seg.epgeominfo[1].dist = params[i];

View File

@ -365,7 +365,8 @@ DLL_HEADER void ExportNgOCC(py::module &m)
case TopAbs_FACE: case TopAbs_FACE:
BRepGProp::SurfaceProperties (shape, props); break; BRepGProp::SurfaceProperties (shape, props); break;
default: default:
throw Exception("Properties implemented only for FACE"); BRepGProp::LinearProperties(shape, props);
// throw Exception("Properties implemented only for FACE");
} }
double mass = props.Mass(); double mass = props.Mass();
gp_Pnt center = props.CentreOfMass(); gp_Pnt center = props.CentreOfMass();
@ -386,6 +387,12 @@ DLL_HEADER void ExportNgOCC(py::module &m)
return shape; return shape;
}) })
.def_property("name", [](const TopoDS_Shape & self) {
return OCCGeometry::global_shape_names[self.TShape()];
}, [](const TopoDS_Shape & self, string name) {
OCCGeometry::global_shape_names[self.TShape()] = name;
})
.def_property("col", [](const TopoDS_Shape & self) { .def_property("col", [](const TopoDS_Shape & self) {
auto it = OCCGeometry::global_shape_cols.find(self.TShape()); auto it = OCCGeometry::global_shape_cols.find(self.TShape());
Vec<3> col(0.2, 0.2, 0.2); Vec<3> col(0.2, 0.2, 0.2);