split an edge that's part of a solid with ReShape

Hi all:
I am trying to split 1 edge of a solid box and somehow have the shapes updated so that I end up with a new box that has 13 edges instead of 12.
I have included the code which basically shows how I am using BRepTools_Reshape. The sub-shapes are not updated correctly. What am I missing?
I am doing the Apply on the original box. Am I supposed to do it for each face that connects to the split edge as well ?

Ugo Capeto's picture

here's the code:

#include "occ_header.h"

int main(int argc, char *argv[]) {

TopoDS_Solid aBox;
TopoDS_Edge anEdge;
TopoDS_Vertex Vertex1,Vertex2;

Standard_Real Length=1, Width=1, Depth=1;
TopTools_IndexedMapOfShape edgeMap;
TopTools_IndexedMapOfShape vertexMap;

// create a box

aBox = BRepPrimAPI_MakeBox(Length,Width,Depth);

// asign an edge to split

anEdge= TopoDS::Edge(edgeMap(1));

// find the end point of this edge

TopExp::MapShapes(anEdge, TopAbs_VERTEX, vertexMap);

// assign u=Param to split

Standard_Real First,Last,Param;
const Handle(Geom_Curve)& Curve=BRep_Tool::Curve(anEdge,First,Last);
cout << " First= " << First << " Last= " << Last << " \n";
Param = (Last-First)*0.5;

// create two new edges by spliting the original edge
TopoDS_Edge edge1 = BRepBuilderAPI_MakeEdge(Curve,First,Param);
TopoDS_Edge edge2 = BRepBuilderAPI_MakeEdge(Curve,Param,Last);

// create a wire to add these two edges

BRepBuilderAPI_MakeWire wire;

// replace edge with wire

BRepTools_ReShape *reshaper = new BRepTools_ReShape;
TopoDS_Shape aBox2=reshaper->Apply(aBox);


return 0;


Ugo Capeto's picture

anybody knows what needs to be done for the solid and its sub-shapes to be updated correctly?

Ugo Capeto's picture

if i do the reshaper->apply to 1 of the 2 connected faces, it doesn't work either - the face is not correctly updated (can't be displayed).
how on earth does it work?