why i can not get the right area in the topo_shape??

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main(void)
{
char * filename="czg.brep";

gp_Pnt p0(-0.0,-0.0,0.1);
gp_Pnt p1(0.04,-0.0,0.1);
gp_Pnt p2(0.04,0.04,0.1);
gp_Pnt p3(-0.0,0.04,0.1);
TopoDS_Wire w=BRepBuilderAPI_MakePolygon(p0,p1,p2,p3,true);
TopoDS_Face f=BRepBuilderAPI_MakeFace(w);
GProp_GProps System;
Standard_Real tolerance=1.0e-1;
gp_Pnt p4(0.0,0.0,0.0);
gp_Ax2 ax0(p4,gp::DZ());
TopoDS_Solid cylinder1=BRepPrimAPI_MakeCylinder(ax0,0.08,0.2);
TopoDS_Solid cylinder2=BRepPrimAPI_MakeCylinder(ax0,0.04,0.1);
TopoDS_Shape shape0=BRepAlgoAPI_Cut(cylinder1,cylinder2);
TopExp_Explorer Ex_face;
TopoDS_Solid shape3;
int count=0;
for (Ex_face.Init(shape0,TopAbs_SOLID); Ex_face.More(); Ex_face.Next())
{
count++;
shape3=TopoDS::Solid(Ex_face.Current());
}

TopoDS_Face shape1;
TopoDS_Shape component=BRepAlgoAPI_Common(shape3,f);
for (Ex_face.Init(component,TopAbs_FACE); Ex_face.More(); Ex_face.Next())
{
shape1=TopoDS::Face(Ex_face.Current());
}
BRepGProp::SurfaceProperties(shape1,System);
std::cout

chenzaigao's picture

i get the area on the surface ,but i really want to get the area which is inside of the shape3

Rob Bachrach's picture

By "area which is inside of shape3", I assume you mean the volume. If so, you want to use BRepGProp::VolumeProperties instead of SurfaceProperties.

Rob

chenzaigao's picture

i mean that i want to get the area of the intersection area of the solid and the face ,but actually i get the area on the surface ,the actually area i want to get is 0.04*0.04-PI*0.04*0.04/4,but i get the area is PI*0.04*0.04/4,so i do not know the reason.