Solid Class

Solid Class

A 3d solid.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DBAPIObject
    Autodesk.Revit.DBGeometryObject
      Autodesk.Revit.DBSolid

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class Solid : GeometryObject
Public Class Solid
	Inherits GeometryObject
public ref class Solid : public GeometryObject
type Solid = 
    class
        inherit GeometryObject
    end

The Solid type exposes the following members.

Properties
 NameDescription
Public propertyEdgesThe edges that belong to the solid.
Public propertyCode exampleFacesThe faces that belong to the solid.
Public propertyCode exampleGraphicsStyleIdThe ElementId of the GeometryObject's GraphicsStyle
(Inherited from GeometryObject)
Public propertyIdA unique integer identifying the GeometryObject in its associated non view-specific GeometryElement.
(Inherited from GeometryObject)
Public propertyIsElementGeometryIndicates whether this geometry is obtained directly from an Element.
(Inherited from GeometryObject)
Public propertyCode exampleIsReadOnlyIdentifies if the object is read-only or modifiable.
(Inherited from APIObject)
Public propertySurfaceAreaReturns the total surface area of this solid.
Public propertyVisibilityThe visibility.
(Inherited from GeometryObject)
Public propertyVolumeReturns the signed volume of this solid.
Top
Methods
 NameDescription
Public methodComputeCentroidReturns the Centroid of this solid.
Public methodDisposeCauses the object to release immediately any resources it may be utilizing.
(Inherited from APIObject)
Public methodEquals Determines whether the specified Object is equal to the current Object.
(Inherited from GeometryObject)
Public methodGetBoundingBox Retrieves a box that circumscribes the solid geometry.
Public methodGetHashCode Gets the integer value of the geometry object as hash code
(Inherited from GeometryObject)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodCode exampleIntersectWithCurve Calculates and returns the intersection between a curve and this solid.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Remarks
A solid is defined by the faces and edges that form its boundary.
Example
private void GetAndTransformSolidInfo(Application application, Element element, Options geoOptions)
{
    // Get geometry element of the selected element
    Autodesk.Revit.DB.GeometryElement geoElement = element.get_Geometry(geoOptions);

    // Get geometry object
    foreach (GeometryObject geoObject in geoElement)
    {
        // Get the geometry instance which contains the geometry information
        Autodesk.Revit.DB.GeometryInstance instance = geoObject as Autodesk.Revit.DB.GeometryInstance;
        if (null != instance)
        {
            foreach (GeometryObject instObj in instance.SymbolGeometry)
            {
                Solid solid = instObj as Solid;
                if (null == solid || 0 == solid.Faces.Size || 0 == solid.Edges.Size)
                {
                    continue;
                }

                Transform instTransform = instance.Transform;
                // Get the faces and edges from solid, and transform the formed points
                foreach (Face face in solid.Faces)
                {
                    Mesh mesh = face.Triangulate();
                    foreach (XYZ ii in mesh.Vertices)
                    {
                       XYZ point = ii;
                        XYZ transformedPoint = instTransform.OfPoint(point);
                    }
                }
                foreach (Edge edge in solid.Edges)
                {
                   foreach (XYZ ii in edge.Tessellate())
                    {
                       XYZ point = ii;
                        XYZ transformedPoint = instTransform.OfPoint(point);
                    }
                }
            }
        }
    }

}
Private Sub GetAndTransformSolidInfo(application As Application, element As Element, geoOptions As Options)
    ' Get geometry element of the selected element
    Dim geoElement As Autodesk.Revit.DB.GeometryElement = element.Geometry(geoOptions)

    ' Get geometry object
    For Each geoObject As GeometryObject In geoElement
        ' Get the geometry instance which contains the geometry information
        Dim instance As Autodesk.Revit.DB.GeometryInstance = TryCast(geoObject, Autodesk.Revit.DB.GeometryInstance)
        If instance IsNot Nothing Then
            For Each instObj As GeometryObject In instance.SymbolGeometry
                Dim solid As Solid = TryCast(instObj, Solid)
                If solid Is Nothing OrElse 0 = solid.Faces.Size OrElse 0 = solid.Edges.Size Then
                    Continue For
                End If

                Dim instTransform As Transform = instance.Transform
                ' Get the faces and edges from solid, and transform the formed points
                For Each face As Face In solid.Faces
                    Dim mesh As Mesh = face.Triangulate()
                    For Each ii As XYZ In mesh.Vertices
                        Dim point As XYZ = ii
                        Dim transformedPoint As XYZ = instTransform.OfPoint(point)
                    Next
                Next
                For Each edge As Edge In solid.Edges
                    For Each ii As XYZ In edge.Tessellate()
                        Dim point As XYZ = ii
                        Dim transformedPoint As XYZ = instTransform.OfPoint(point)
                    Next
                Next
            Next
        End If
    Next

End Sub

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also