Hi,
You should clarify what you mean with: "the Depth of a Solid3D"?
If you mean the vertical ditance between the bottom of the solid to its top, you can use the solid extents (bounding box).
public static double GetSolid3dDepth(Solid3d solid)
{
var extents = solid.GeometricExtents;
return extents.MaxPoint.Z - extents.MinPoint.X
}
Hi,
Thank you for your idea!
Actually i would like to find the thickness of the solid3d. Attach you can also find an example with thickness of 0.12m. I tried with Geometric Extents but the value is not that accurate.
The other way could be AverageThickness = Volume / Area of one side. Do you know how to get the AREA of the upper or lower surface of this solid3d?
Can you please have a look.
@eirij wrote:
The other way could be AverageThickness = Volume / Area of one side. Do you know how to get the AREA of the upper or lower surface of this solid3d?
Here's a way using the Brep (Boundary Representation) API. You have to reference the acdbmgdbrep.dll assembly.
public static double GetAverageThickness(Solid3d solid)
{
double volume = solid.MassProperties.Volume;
using (var brep = new Brep(solid))
{
double area = brep.Faces
.Select(f => f.GetArea())
.Aggregate(Math.Max);
return volume / area;
}
}