Sketcher: support vertexes in sketch used e.g. for hole features

This commit is contained in:
wmayer
2020-11-07 13:47:15 +01:00
committed by abdullahtahiriyo
parent c79ac8d1fc
commit 6c956bb80f
2 changed files with 13 additions and 5 deletions

View File

@@ -4132,7 +4132,7 @@ TopoShape &TopoShape::makEFace(const std::vector<TopoShape> &shapes, const char
for(auto &s : shapes) {
if (s.getShape().ShapeType() == TopAbs_COMPOUND)
mkFace->useCompound(TopoDS::Compound(s.getShape()));
else
else if (s.getShape().ShapeType() != TopAbs_VERTEX)
mkFace->addShape(s.getShape());
}
mkFace->Build();

View File

@@ -3915,13 +3915,18 @@ TopoShape Sketch::toShape(void) const
return result;
#else
std::list<TopoDS_Edge> edge_list;
std::list<TopoDS_Vertex> vertex_list;
std::list<TopoDS_Wire> wires;
// collecting all (non constructive and non external) edges out of the sketch
for (;it!=Geoms.end();++it) {
auto gf = GeometryFacade::getFacade(it->geo);
if (!it->external && !gf->getConstruction() && (it->type != Point)) {
edge_list.push_back(TopoDS::Edge(it->geo->toShape()));
if (!it->external && !gf->getConstruction()) {
if (it->type != Point)
edge_list.push_back(TopoDS::Edge(it->geo->toShape()));
else
vertex_list.push_back(TopoDS::Vertex(it->geo->toShape()));
}
}
@@ -3963,9 +3968,10 @@ TopoShape Sketch::toShape(void) const
wires.push_back(aFix.Wire());
}
if (wires.size() == 1)
if (wires.size() == 1 && vertex_list.empty()) {
result = *wires.begin();
else if (wires.size() > 1) {
}
else if (wires.size() > 1 || !vertex_list.empty()) {
// FIXME: The right way here would be to determine the outer and inner wires and
// generate a face with holes (inner wires have to be tagged REVERSE or INNER).
// that's the only way to transport a somewhat more complex sketch...
@@ -3980,6 +3986,8 @@ TopoShape Sketch::toShape(void) const
builder.MakeCompound(comp);
for (std::list<TopoDS_Wire>::iterator wt = wires.begin(); wt != wires.end(); ++wt)
builder.Add(comp, *wt);
for (std::list<TopoDS_Vertex>::iterator wt = vertex_list.begin(); wt != vertex_list.end(); ++wt)
builder.Add(comp, *wt);
result.setShape(comp);
}
#endif