I'm creating a MacroFeature and I'm using a selection filter to get cylindrical faces only, but once I got such face, I want to calculate the height of the cylinder. Any ideas?

I'm creating a MacroFeature and I'm using a selection filter to get cylindrical faces only, but once I got such face, I want to calculate the height of the cylinder. Any ideas?

Hi Edgar,

The ISurface object defines the infinite cylinder from which your cylindrical face is trimmed. To calculate the height of the cylinder you need to look at the edges which terminate the cylinder at the top and bottom.

The exact process will vary considerably depending on how the cylinder is terminated. For the simple case of finding the distance between to parallel circular edges you would use IFace2:GetEdges to get hold of the two edges, pick a point on one edge and then use IEdge::GetClosestPointOn to find the closest point on the other edge. You then need to subtract one point from the other to get the vector distance between them.

If your cylinder is terminated by multiple circular and elliptical section edges then you might find it easier to start from IFace2::GetFirstLoop to group together the edges which make up each end of the cylinder.

Regards,

Dan

Josh's answer is much better than mine for a full cylinder with parallel ends. It will be quicker to implement and execute too.

Josh, have some mention points as compensation. Josh Brady

Dan

Hi Edgar,

The ISurface object defines the infinite cylinder from which your cylindrical face is trimmed. To calculate the height of the cylinder you need to look at the edges which terminate the cylinder at the top and bottom.

The exact process will vary considerably depending on how the cylinder is terminated. For the simple case of finding the distance between to parallel circular edges you would use IFace2:GetEdges to get hold of the two edges, pick a point on one edge and then use IEdge::GetClosestPointOn to find the closest point on the other edge. You then need to subtract one point from the other to get the vector distance between them.

If your cylinder is terminated by multiple circular and elliptical section edges then you might find it easier to start from IFace2::GetFirstLoop to group together the edges which make up each end of the cylinder.

Regards,

Dan