Depth of Solid3D

Depth of Solid3D

eirij
Advocate Advocate
598 Views
3 Replies
Message 1 of 4

Depth of Solid3D

eirij
Advocate
Advocate

Hi,

Is there any way to find the Depth of a Solid3D?

Thanks!

0 Likes
Accepted solutions (1)
599 Views
3 Replies
Replies (3)
Message 2 of 4

_gile
Consultant
Consultant

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
        }


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 4

eirij
Advocate
Advocate

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.

0 Likes
Message 4 of 4

_gile
Consultant
Consultant
Accepted solution

@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;
            }
        }


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub