private static void ChangeExtrusionHeight(Solid3d solid, Vector3d extrusionDirection, double newHeight)
{
var fullPath
= new FullSubentityPath
( new[] { solid
.ObjectId },
new SubentityId
(SubentityType
.Null, IntPtr
.Zero)); using (var brep
= new Brep
(fullPath
)) {
var face = brep.Faces
.Where(f
=> ((ExternalBoundedSurface
)f
.Surface).BaseSurface is Plane plane
&& plane.Normal.IsParallelTo(extrusionDirection))
.Select(f =>
{
var plane = (Plane)((ExternalBoundedSurface)f.Surface).BaseSurface;
return new { f
.SubentityPath.SubentId, Height
= Math
.Abs(plane
.Coefficients.D) }; })
.OrderByDescending(x => x.Height)
.First();
solid
.ExtrudeFaces(new[] { face
.SubentId }, newHeight
- face
.Height,
0.0); }
}