#include #include #include //======================================================================= //function : OCC23979 //purpose : //======================================================================= static Standard_Integer OCC23979 (Draw_Interpretor& theDI, Standard_Integer argc, const char ** argv) { if(argc != 4) { theDI << argc; theDI << "Usage: OCC23979 res num1 num2\n"; return 1; } Standard_Integer n = atoi(argv[2]); Standard_Integer m = atoi(argv[3]); Standard_Integer xbase, ybase; Standard_Integer size = 5; gp_Vec aVector(0,0,10); BRep_Builder aBuilder; TopoDS_Compound aCompound; aBuilder.MakeCompound(aCompound); for (Standard_Integer i = 0; i < n; i++) { for (Standard_Integer j = 0; j < m; j++) { xbase = i*10; ybase = j*10; TopoDS_Vertex aP1 = BRepBuilderAPI_MakeVertex(gp_Pnt(xbase,ybase,0)); TopoDS_Vertex aP2 = BRepBuilderAPI_MakeVertex(gp_Pnt(xbase+size,ybase,0)); TopoDS_Vertex aP3 = BRepBuilderAPI_MakeVertex(gp_Pnt(xbase+size*0.5,ybase+0.866*size,0)); TopoDS_Edge aE1 = BRepBuilderAPI_MakeEdge(aP1,aP2); TopoDS_Edge aE2 = BRepBuilderAPI_MakeEdge(aP2,aP3); TopoDS_Edge aE3 = BRepBuilderAPI_MakeEdge(aP3,aP1); TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(aE1,aE2,aE3); TopoDS_Face aFace = BRepBuilderAPI_MakeFace(aWire,Standard_False); TopoDS_Shape aPrism = BRepPrimAPI_MakePrism(aFace,aVector,Standard_False); aBuilder.Add(aCompound,aPrism); } } DBRep::Set(argv[1],aCompound); return 0; }