How to get geometric information from TopoDS_Shape

Hi Bros, I just get TopoDS_Shape from AIS_InteractiveContext through mouse click, I try to get some geometric information from it, such as location, orient,radius of a Cylindrical surface,I was try to achieve it through BRepAdaptor_Surface, However, I have no idea with how to convert TopoDS_Shape to TopoDS_Face. I'm new in OCCT (maybe new in C++).
I hope my childish question didn't bother you.

Artem Zhidkov's picture

Hi Linbei,

Please, use TopoDS::Face() method to convert any shape to face, but be careful, it throws an exception if you convert a shape of wrong type.

And also, take a look at BRep_Tool class, it could provide you the most of information you described.



linbei jianbaoxia's picture

You are so nice, and I slove it, thanks for your help.
My technical route is : AIS_InteractiveContext→TopoDS_Shape→TopoDS_Face→BRepAdaptor_Surface→gp_Cylinder
It's just for Cylinder, other entity maybe can try in the same way.

heqingchen heqingchen's picture

Hi Linbei,
I have observed that you are also from China. The project I am working on has similar problems. I hope I can communicate with you, this is my wechat 17866628059.
Best regards