Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
in reply to: Anonymous

I have found a solution. Without error checking, it works as follows:

 

//get the extrude feature and type of extent, here assumed to be of type kToExtent
ExtrudeFeature extFeat = oCompDef.Features[1];
ToExtent toExt = extfeat.Extent as ToExtent;
PlanarSketch sketch = extFeat.Profile.Parent as PlanarSketch;
UnitVector sketchNormal = sketch.PlanarEntityGeometry.Normal;

//since ToFace returns a face collection, we grab the first
Faces extentFaces = toExt.ToFace as Faces;
Face extentFace = extentFaces[1];

//find the distance from a sketch point to a characteristic point on the face which defines the ToExtent, normal along the sketch plane.
double depth = sketch.SketchPoints[1].Geometry3d.VectorTo(face.PointOnFace).DotProduct(sketchNormal.AsVector());