How to change geometry of existing object?

How can i change geometry of existing TopoDS_Shape or AIS_Shape, that already attached to AIS_InteractiveContext?
Thank you for help.

AP's picture

Use this function, this how you make a parametric modeller, you can swap the shape of an ais and update it, this is straight from OpenShapeFactory.

void HSF::updateAIS(TopoDS_Shape aShape, Handle_AIS_Shape &anAIS, Handle_AIS_InteractiveContext ic)
{
if(aShape.IsNull()) return;
if (anAIS.IsNull()){
anAIS=new AIS_Shape(aShape);
ic->SetMaterial(anAIS,Graphic3d_NOM_NEON_GNC);
ic->SetColor(anAIS, Quantity_NOC_BLACK);
ic->SetDisplayMode(anAIS,1,Standard_False);
}
if (!anAIS->HasPresentation()){
ic->Display(anAIS, 1,0,false,false);
}
else
{
anAIS->Set(aShape);
ic->Deactivate(anAIS);
ic->Redisplay(anAIS,true,true);
}
ic->Update(anAIS,true);
ic->CurrentViewer()->Redraw();
}

Best,

AlexP

jelle's picture

cool, pretty useful!
somewhat related; do you know how to add a TopoDS_Shape to an AIS representation perhaps?

cheers,

-jelle

AP's picture

What do you mean by an AIS representation?

Best,

AlexP