DiscussionsIssue archiveModeling Data and Algorithms

Archived discussion

How to get geometric information from TopoDS_Shape

Modeling Data and AlgorithmsTue, 03/22/2022 - 08:463 replies

Browse this forum
QuestionAuthor

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.

Discussion

3 archived replies

Posts are displayed in their archived order.

01Commenter-1

Hi Author,

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.

Regards,

Commenter-1

02Author

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.

03Commenter-2

Hi Author,
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