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

View File

@ -365,7 +365,8 @@ DLL_HEADER void ExportNgOCC(py::module &m)
case TopAbs_FACE:
BRepGProp::SurfaceProperties (shape, props); break;
default:
throw Exception("Properties implemented only for FACE");
BRepGProp::LinearProperties(shape, props);
// throw Exception("Properties implemented only for FACE");
}
double mass = props.Mass();
gp_Pnt center = props.CentreOfMass();
@ -385,6 +386,12 @@ DLL_HEADER void ExportNgOCC(py::module &m)
OCCGeometry::global_shape_names[e.Current().TShape()] = name;
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) {
auto it = OCCGeometry::global_shape_cols.find(self.TShape());