1、创建点、线、面、实体并显示
#include <BRepBuilderAPI_MakeVertex.hxx>
void COCCDemoDoc::OnButtonCreatepnt()
{
gp_Pnt aPnt(10,10,10);
TopoDS_Shape aShape = BRepBuilderAPI_MakeVertex(aPnt);
Handle(AIS_Shape) aisShpae = new AIS_Shape(aShape);
GetAISContext()->Display(aisShpae,true);
}
#include <gce_MakeLin.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
void COCCDemoDoc::OnButtonCereatlin()
{
gp_Pnt aPnt1(10, 10, 10);
gp_Pnt aPnt2(100, 100, 100);
gp_Lin aLine = gce_MakeLin(aPnt1, aPnt2);
TopoDS_Shape aShape = BRepBuilderAPI_MakeEdge(aLine,0,100);
Handle(AIS_Shape) aisShpae = new AIS_Shape(aShape);
GetAISContext()->Display(aisShpae, true);
}
#include <gce_MakePln.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
void COCCDemoDoc::OnButtonCereatface()
{
gp_Pnt aPnt1(0, 0, 0);
gp_Pnt aPnt2(100, 0, 0);
gp_Pnt aPnt3(0, 100, 0);
gp_Pln aPln = gce_MakePln(aPnt1, aPnt2, aPnt3);
TopoDS_Shape aShape = BRepBuilderAPI_MakeFace(aPln, 0, 100,0,100);
Handle(AIS_Shape) aisShpae = new AIS_Shape(aShape);
GetAISContext()->Display(aisShpae, true);
}
#include <BRepPrimAPI_MakeBox.hxx>
void COCCDemoDoc::OnButtonCreatecube()
{
TopoDS_Shape aShape = BRepPrimAPI_MakeBox(100, 100, 100);
Handle(AIS_Shape) aisShpae = new AIS_Shape(aShape);
GetAISContext()->Display(aisShpae, true);
}
2、效果如图:
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/97c263c4088a4f4a83ae25790c46b440.png)
ps:复杂曲线曲面的创建,可参考sample下面的Geometry和Modeling项目;