Paging File Usage grows but never comes backs down.

Hi,

I’ve got an issue regarding the Paging File Usage going through the roof and never coming back down. All I'm doing it translating selected shapes and redisplaying them. If you look at the bottom of my TranslateObject routine, I'm applying a transformation and reassigning the Ais_Shape with that new transformed shape. If I comment out that line, the paging file usage stays put, but if I call hAISObj->Set(myTrsf.Shape()); the paging file grows until finally it crashes. Any help or ideas would be greatly apprecitaed.

Thanks,
Kevin

void CView2d::OnMyMouseMove(CPoint cpoint)
{
gp_Pnt currentpnt = ConvertClickToPoint(cpoint.x,cpoint.y);

gp_Trsf trans;//Define the transformation
gp_Pnt newpnt;

AIS_ListOfInteractive objects;
myAISContext->DisplayedObjects (objects);
AIS_ListIteratorOfListOfInteractive iobject (objects);

while (iobject.More ())
{
Handle_MyAIS_Shape aShape;
if (iobject.Value()->IsKind(STANDARD_TYPE(MyAIS_Shape)))
{
aShape = Handle_MyAIS_Shape::DownCast(iobject.Value());

Quantity_Color C = aShape->MyGetColor();
if(C == Quantity_NOC_PURPLE)
{
TopLoc_Location toploc = aShape->Shape().Location();
gp_Trsf aTrsf = toploc.Transformation();
gp_XYZ CurXYZ = aTrsf._CSFDB_Getgp_Trsfloc();

newpnt.SetX(CurXYZ.X() + currentpnt.X() - m_gpAnchorPnt.X());
newpnt.SetY(CurXYZ.Y() + currentpnt.Y() - m_gpAnchorPnt.Y());
newpnt.SetZ(0);
TranslateObject(aShape, newpnt, &_map_shape_int);
myAISContext->Redisplay(aShape, Standard_False, Standard_False);
}
}
iobject.Next ();
}
m_gpAnchorPnt = currentpnt;
myAISContext->UpdateCurrentViewer();
}

/**************************************************************************/
void TranslateObject(Handle(MyAIS_Shape) hAISObj, gp_Pnt Position,
TopTools_DataMapOfShapeInteger *map_shape)
/**************************************************************************/
{
gp_Pnt newpnt, oldpnt;

BOOL IsBound = FALSE;
int BoundID = 0;
if ( map_shape->IsBound( hAISObj->Shape() ) )
{
IsBound = TRUE;
BoundID = map_shape->Find( hAISObj->Shape() );
}

TopLoc_Location toploc = hAISObj->Shape().Location();
gp_Trsf aTrsf = toploc.Transformation();
gp_XYZ CurXYZ = aTrsf._CSFDB_Getgp_Trsfloc();
gp_Mat CurMat = aTrsf._CSFDB_Getgp_Trsfmatrix();

Standard_Real xdiff, ydiff, zdiff;
xdiff = Position.X() - CurXYZ.X();
ydiff = Position.Y() - CurXYZ.Y();
zdiff = Position.Z() - CurXYZ.Z();

gp_Pnt org_pnt, new_pnt;
org_pnt.SetCoord(CurXYZ.X(), CurXYZ.Y(), CurXYZ.Z());
new_pnt.SetCoord(CurXYZ.X()+xdiff, CurXYZ.Y()+ydiff, CurXYZ.Z()+zdiff);

aTrsf.SetTranslation(org_pnt, new_pnt);

BRepBuilderAPI_Transform myTrsf(hAISObj->Shape(), aTrsf, Standard_False);
if(IsBound)
map_shape->Bind( myTrsf.Shape(), BoundID );

//PF Usage goes up and never comes back down when calling this.
hAISObj->Set(myTrsf.Shape()); //

}

K Rutherford's picture

I forgot to mention that I'm using OpenCASCADE5.2 so this might be a bug that has been fixed now.

-Kevin

Paul Jimenez's picture

Do you ever remove/unbind the shape-before-transformation from map_shape? You blame setting the transformed shape in hAISObj, but, maybe, the problem is not really there. It could also be a problem with the version of OCC you're using, as you suggested, but I wouldn't know.