pload MODELING VISUALIZATION
# create a box
box b 8.0 10.0 15.0
explode b E
# make chamfer at the fifth edge in the box
set aDist 4.0
chamf r b b_5 $aDist
# display results
vinit View1
vdisplay -dispMode 0 b
vdisplay -dispMode 1 r
vsetcolor r RED
vfit
// Make a box with a corner at [0, 0, 0] and the specified sizes.Standard_RealaSizeX=8.0;Standard_RealaSizeY=10.0;Standard_RealaSizeZ=15.0;TopoDS_ShapeaBox=BRepPrimAPI_MakeBox(aSizeX,aSizeY,aSizeZ);myResult<<"Box at corner [0, 0, 0] and sizes ["<<aSizeX<<", "<<aSizeY<<", "<<aSizeZ<<"] was created in yellow wirewrame"<<std::endl;// Initialize chamfer algo.BRepFilletAPI_MakeChamferanAlgo(aBox);// Set edge to apply a chamfer with specified distance from it.// Select the 5th edge in the map returned by TopExp::MapShapes method.TopTools_IndexedMapOfShapeanEdges;TopExp::MapShapes(aBox,TopAbs_EDGE,anEdges);TopoDS_EdgeanEdge=TopoDS::Edge(anEdges.FindKey(5));Standard_RealaDist=4.0;anAlgo.Add(aDist,anEdge);myResult<<"Make a chamfer of "<<aDist<<" size on an edge in green"<<std::endl;Handle(AIS_ColoredShape)anAisBox=newAIS_ColoredShape(aBox);Handle(AIS_ColoredShape)anAisEdge=newAIS_ColoredShape(anEdge);anAisBox->SetColor(Quantity_Color(Quantity_NOC_YELLOW));anAisEdge->SetColor(Quantity_Color(Quantity_NOC_GREEN));anAisEdge->SetWidth(2.5);myObject3d.Append(anAisBox);myObject3d.Append(anAisEdge);myContext->SetDisplayMode(anAisBox,0,Standard_True);// Make a chamfer.anAlgo.Build();if(anAlgo.IsDone()){// Get result.TopoDS_ShapeaResult=anAlgo.Shape();myResult<<"Fillet was built. Result shape is in red shading"<<std::endl;Handle(AIS_ColoredShape)anAisResult=newAIS_ColoredShape(aResult);anAisResult->SetColor(Quantity_Color(Quantity_NOC_RED));myObject3d.Append(anAisResult);myContext->SetDisplayMode(anAisResult,1,Standard_True);constTopTools_ListOfShape&aGenShapes=anAlgo.Generated(anEdge);for(TopTools_ListOfShape::IteratoranIt(aGenShapes);anIt.More();anIt.Next()){Handle(AIS_ColoredShape)anAisShape=newAIS_ColoredShape(anIt.Value());anAisShape->SetColor(Quantity_Color(Quantity_NOC_RED));anAisShape->SetWidth(2.5);myObject3d.Append(anAisShape);}}