hope it looks better this time...
gp_Pnt point = BRep_Tool::Pnt(vertex);
array ^coordinates = gcnew array(3);
coordinates[0] = point.X();
coordinates[1] = point.Y();
coordinates[2] = point.Z();
BRep_Builder builder;
TopoDS_Vertex first, last, aVertex;
TopTools_IndexedMapOfShape edgesMap, verticesMap;
TopExp::MapShapes(shape, TopAbs_VERTEX, verticesMap);
TopExp::MapShapes(shape, TopAbs_EDGE, edgesMap);
Handle(ShapeBuild_ReShape) reshaper = new ShapeBuild_ReShape;
int vertexUpdates = 0;
for(int j=1; j <= edgesMap.Extent(); j++)
{
TopExp::Vertices( TopoDS::Edge(edgesMap(j)), first, last);
if(first.IsEqual(vertex) || last.IsEqual(vertex))
{
if(first.IsEqual(vertex))
aVertex = first;
else
aVertex = last;
if( (value[0] != coordinates[0]) || (value[1] != coordinates[1]) || (value[2] != coordinates[2]))
{
builder.UpdateVertex(aVertex, gp_Pnt(value[0], value[1], value[2]), Precision::Confusion());
int key = verticesMap.FindIndex(aVertex);
reshaper->Replace(verticesMap(key), aVertex);
vertexUpdates++;
break;
}
}
}
TraceDebugFormattedStr(" VertexProperty Error. Updated vertices: ","%i",".",vertexUpdates);
if(vertexUpdates > 0)
{
shape = reshaper->Apply(shape);
ShapeFix_Shape fixer(shape);
fixer.Perform();
shape = fixer.Shape();
aisShape = new AIS_Shape(shape);
... //Displaying
}