LayoutRuleClearSpacing Class

LayoutRuleClearSpacing Class

This class indicate the layout rule of a Beam System is Clear-Spacing.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DBAPIObject
    Autodesk.Revit.DBLayoutRule
      Autodesk.Revit.DBLayoutRuleClearSpacing

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

The LayoutRuleClearSpacing type exposes the following members.

Constructors
 NameDescription
Public methodLayoutRuleClearSpacingConstructor of LayoutRuleFixedDistance. Create LayoutRuleFixedDistance with the values passed in.
Top
Properties
 NameDescription
Public propertyCode exampleIsReadOnlyIdentifies if the object is read-only or modifiable.
(Inherited from APIObject)
Public propertyJustifyTypeGet or set the type of justification.
Public propertySpacingGet or set the spacing of the beam system.
Top
Methods
 NameDescription
Public methodDisposeCauses the object to release immediately any resources it may be utilizing.
(Inherited from APIObject)
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Remarks
To use this type of LayoutRule, the distance between the beams and the justify-type must be set.
Example
private bool LayoutRuleClearSpacingInformation(BeamSystem beamSystem)
{
    //get the layoutRule of the beamsystem
    Autodesk.Revit.DB.LayoutRule layoutRule = beamSystem.LayoutRule;

    string message = "BeamSystem layout rule : " + layoutRule;

    //create a new instance of the LayoutRuleClearSpacing class 
    LayoutRuleClearSpacing myLayoutRuleClearSpacing = 
             new LayoutRuleClearSpacing(10.0, BeamSystemJustifyType.Beginning);

    //set the new layoutRule to the beamsystem
    beamSystem.LayoutRule = myLayoutRuleClearSpacing;

    LayoutRuleClearSpacing clearSpacing = beamSystem.LayoutRule as LayoutRuleClearSpacing;
    if (null == clearSpacing)
    {
        return false;
    }

    //try to get the property value of the beamsystem LayoutRule
    BeamSystemJustifyType justifyType = clearSpacing.JustifyType;

    double spacing = clearSpacing.Spacing;

    message += "\nNew BeamSystem layout rule: " + clearSpacing;
    message += "\nNew BeamSystem spacing: " + spacing;
    message += "\nNew BeamSystem justification: " + justifyType;

    TaskDialog.Show("Revit",message);

    return true;
}
Private Function LayoutRuleClearSpacingInformation(beamSystem As BeamSystem) As Boolean
    'get the layoutRule of the beamsystem
    Dim layoutRule As Autodesk.Revit.DB.LayoutRule = beamSystem.LayoutRule

    Dim message As String = "BeamSystem layout rule : " & layoutRule.ToString()

    'create a new instance of the LayoutRuleClearSpacing class 
    Dim myLayoutRuleClearSpacing As New LayoutRuleClearSpacing(10.0, BeamSystemJustifyType.Beginning)

    'set the new layoutRule to the beamsystem
    beamSystem.LayoutRule = myLayoutRuleClearSpacing

    Dim clearSpacing As LayoutRuleClearSpacing = TryCast(beamSystem.LayoutRule, LayoutRuleClearSpacing)
    If clearSpacing Is Nothing Then
        Return False
    End If

    'try to get the property value of the beamsystem LayoutRule
    Dim justifyType As BeamSystemJustifyType = clearSpacing.JustifyType

    Dim spacing As Double = clearSpacing.Spacing

    message += vbLf & "New BeamSystem layout rule: " & clearSpacing.ToString()
    message += vbLf & "New BeamSystem spacing: " & spacing
    message += vbLf & "New BeamSystem justification: " & justifyType

    TaskDialog.Show("Revit", message)

    Return True
End Function

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