the parameters of an entity ,the radius of a cylinder

how can i get the parameters of an entity stored in OCC,for example the radius of a cylinder?And the tolerance of the cylinder?

Dennis G.'s picture

Hello cierahuy,

I assume you're having a TopoDS_Face which is a cylindrical face and you want to know the cylinder's radius. Is that correct?

[code] ----------------------------------------------------------------
// get cylinder radius
TopoDS_Face myFace = aCylindricalFace;
TopLoc_Location loc;
Handle(Geom_Surface) theSurf = BRep_Tool::Surface(myFace, loc);
GeomAdaptor_Surface theAdaptSurf(theSurf);
if(theAdaptSurf.GetType() == GeomAbs_Cylinder)
gp_Cylinder theCyl = theAdaptSurf.Cylinder();
Standard_Real radius = theCyl.Radius();
[\code] ---------------------------------------------------------------

Concerning the tolerance of a shape please take a look at chapter 3.3.1 of 'shape_heal.pdf' in you OCC/doc directory.

Good luck,


cierahuy's picture

Dennis,thank you so much!
But i am still puzzled.I have taken a look at the chapter you suggested,and here is the problem,the tolerance in the document refers to the value of shapes in OCC,while what i want to know of the value is the tolerance of a workpiece ,such like the uptolerance and the downtolerance of the diameter of a shaft in a machanical drawing,take AutoCAD for example.How can i get this kind of data?
Thank you again!