UNDO after Remove

Hi All,

I'm having some troubles to get the original shape after a Deletion process (BRep_Builder::Remove) and using TDocStd_Document::Undo(). Below is my code ( consider aShape a squared Wire(4 edges), and aEdge is one its Edges ):

Handle(XCAFApp_Application) anApp = XCAFApp_Application::GetApplication();
Handle(TDocStd_Document) myDoc;
anApp->NewDocument("MDTV-Standard", myDoc);
myDoc->SetUndoLimit(9);

/* FIRST OPERATION.................*/

myDoc->NewCommand();

TDF_Label chLb = myDoc->Main().FindChild( 1, true );
TNaming_Builder b( chLb );
b.Generated( aShape );

myDoc->SetModified( chLb );
myDoc->CommitCommand();
myDoc->Recompute();

/* SECOND OPERATION.................*/
myDoc->NewCommand();

BRep_Builder builder;
builder.Remove( aShape, aEdge );

TNaming_Builder c( chLb );
c.Remove( aEdge );

myDoc->SetModified( chLb );
myDoc->CommitCommand();
myDoc->Recompute();

Handle(TNaming_NamedShape) aNsA = NULL;
TDF_Label tempChA = myDoc->Main().FindChild( 1, false );
if (tempChA.FindAttribute( TNaming_NamedShape::GetID(), aNsA ))
{
TopTools_IndexedMapOfShape mapEdge;
TopExp::MapShapes( aNsA->Get(), TopAbs_EDGE, mapEdge );
cout }

/* UNDO STEP.......................*/
myDoc->Undo();

Handle(TNaming_NamedShape) aNsB = NULL;
TDF_Label tempChB = myDoc->Main().FindChild( 1, false );
if (tempChB.FindAttribute( TNaming_NamedShape::GetID(), aNsB ))
{
TopTools_IndexedMapOfShape mapEdge;
TopExp::MapShapes( aNsB->Get(), TopAbs_EDGE, mapEdge );
cout }

In the first and second "cout" I have the same numeber of Edges: "3". I was supposing in the second "cout" I would have 4 as number of edges.
What am I doing wrong?

Regards,

tmacedo29's picture

Nobody?