Question Author Tue, 01/19/2021 - 20:32 Hello,
I'm quite new to OpenCascade.
I've successfully built a simple object from boolean a operation: a cone cut by a sphere.
I've also been successful in displaying this object using the code:
// Display Object
TopoDS_Shape myShape1 = MakeObject();
Handle(AIS_Shape) AIS_Shape1 = new AIS_Shape( myShape1);
// mContext->SetMaterial(AISBottle,Graphic3d_NOM_GOLD); //compile error...
mContext->SetDisplayMode(AIS_Shape1, 1, Standard_False);
mContext->Display(AIS_Shape1, Standard_False);
// mContext->SetCurrentObject(AISBottle,Standard_False);
But it's unclear to me how to update the visualized object when its geometry is changed.
For example; if the sphere radius used in the boolean operation is changed , is it mandatory to re-create a new AIS_Shape object or some kind of Update() method can be called ?
Thanks for your help !!
01 Commenter-1 Wed, 01/20/2021 - 21:35 Updating presentation will look like that:
// display original shape
const TopoDS_Shape aShapeOld = MakeObject();
Handle(AIS_Shape) aShapePrs = new AIS_Shape (aShapeOld);
mContext->Display (aShapePrs, AIS_Shaded, 0, false);
// redraw viewer
// display new shape
const TopoDS_Shape aShapeNew = MakeObject();
aShapePrs->SetShape (aShapeNew);
aShapePrs->SetToUpdate();
mContext->Display (aShapePrs, AIS_Shaded, 0, false);
// redraw viewer02 Author Thu, 01/21/2021 - 11:10 Understood !
Many thanks Kirill for this clarification.
Regards,
Karl