Skip to content

How do i get the centroid coordinate details of the Bodies, faces, and edges by using PyGemetry #1674

Answered by RobPasMue
raj366v asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @raj366v - from a generic perspective, this is currently not possible. However, there are workarounds one can try to implement. From a body perspective, if you retrieve the various faces, you can request the face.shape property for each of them. Now, inside shape you also have access to the bbox property (i.e. the bounding box) and finally you could request for the center of that bounding box. Finally, you could approximate by taking all face centers and averaging them.

Finall call to get the center of a face:

center_param = face.shape.box_uv.get_center()
centroid = face.shape.geometry.evaluate_proportion(center_param.u, center_param.v).position

Nonetheless, we will take note of this r…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@raj366v
Comment options

@RobPasMue
Comment options

Answer selected by RobPasMue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants