Share

Profile Class

A geometric profile consisting of a loop of curves.

Inheritance Hierarchy

System.Object
  Autodesk.Revit.DB.APIObject
    Autodesk.Revit.DB.GeometryObject
      Autodesk.Revit.DB.Profile


Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 26.1.0.0 (26.1.0.34)

Syntax

C#

public class Profile : GeometryObject

The Profile type exposes the following members.

Properties

 NameDescription
Public propertyCurvesRetrieve the curves that make up the boundary of the profile.
Public propertyFilledGet or set whether the profile is filled.
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 propertyTransformedTransforms this profile and returns the result.
Public propertyVisibilityThe visibility.
(Inherited from GeometryObject)

Methods

 NameDescription
Public methodCloneReturns a copy of this profile.
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 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 methodToStringReturns a string that represents the current object.
(Inherited from Object)

Remarks

The profile may be filled.

Example

C#

public void GetProfile(Element element)
{
    string messageInfo = "Profile : ";
    if (element is FamilyInstance)
    {
        FamilyInstance beam = element as FamilyInstance;
        if (beam.StructuralType == StructuralType.Beam)
        {
            // Get swept profile
            Autodesk.Revit.DB.SweptProfile sweptProfile = beam.GetSweptProfile();
            Autodesk.Revit.DB.Profile profile = sweptProfile.GetSweptProfile();
            // Get swept profile curves size
            messageInfo += "\nSelection name : " + beam.Name;
            messageInfo += "\nSwept Profile Driving Curve size is " + profile.Curves.Size;
            messageInfo += "\nProfile is filled :  " + profile.Filled;
            if (!profile.IsReadOnly)
            {
                profile.Filled = !profile.Filled;
                messageInfo += "\nProfile is filled after setting:  " + profile.Filled;
            }
            TaskDialog.Show("Revit",messageInfo);
        }
    }
}

VB

Public Sub GetProfile(element As Element)
    Dim messageInfo As String = "Profile : "
    If TypeOf element Is FamilyInstance Then
        Dim beam As FamilyInstance = TryCast(element, FamilyInstance)
        If beam.StructuralType = StructuralType.Beam Then
       ' Get swept profile
       Dim sweptProfile As Autodesk.Revit.DB.SweptProfile = beam.GetSweptProfile()
            Dim profile As Autodesk.Revit.DB.Profile = sweptProfile.GetSweptProfile()
       ' Get swept profile curves size
            messageInfo += vbLf & "Selection name : " + beam.Name
            messageInfo += vbLf & "Swept Profile Driving Curve size is " + profile.Curves.Size
            messageInfo += vbLf & "Profile is filled :  " + profile.Filled
            If Not profile.IsReadOnly Then
                profile.Filled = Not profile.Filled
                messageInfo += vbLf & "Profile is filled after setting:  " + profile.Filled
            End If
            TaskDialog.Show("Revit", messageInfo)
        End If
    End If
End Sub

See Also

Reference

Was this information helpful?