RebarConstraint Class


Rebar Constraint Class

A class representing a constraint on a handle of a rebar element.
Inheritance Hierarchy
System Object
Autodesk.Revit.DB.Structure RebarConstraint

Namespace: Autodesk.Revit.DB.Structure
Assembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntax
public class RebarConstraint : IDisposable

The RebarConstraint type exposes the following members.

Properties
Name Description
Public property IsValidObject Specifies whether the .NET object represents a valid Revit entity.
Public property NumberOfTargets Identifies the number of references associated to the rebar handle.
Top
Methods
Name Description
Public method ConstrainsRebarEnds Returns true if this constraint constrains two rebar ends.
Public method Static member Create This method creates a constraint of 'ToHostFace' or 'ToCover' type for a given RebarConstrainedHandle. Using this method for Shape-Driven Rebar will throw exception. If you need a new RebarConstraint for a handle of a Shape-Driven Rebar, you can obtain a list of possible constraints using one of the RebarConstraintsManager.GetConstraintCandidatesForHandle functions, choose the desired one, and set it as preferred.
Public method Static member CreateConstraintToCustomTarget

This method creates a constraint of 'ToCustomTarget' type for a given RebarConstrainedHandle.

The RebarConstrainedHandle should belong to a Free Form Rebar should allow constrains to custom target.

Public method Static member CreateConstraintToHostEdge

This method creates a constraint of 'ToHostEdge' type for a given RebarConstrainedHandle.

The RebarConstrainedHandle should belong to a Free Form Rebar and must be allowed to constrain to host edges.

Public method Static member CreateConstraintToHostEdgeCover

This method creates a constraint of 'ToHostEdgeCover' type for a given RebarConstrainedHandle.

The RebarConstrainedHandle should belong to a Free Form Rebar and must be allowed to constrain to host edges.

The RebarConstrainedHandle that is constrained 'ToHostEdgeCover' must allow offset value.

Public method Static member CreateConstraintToRebarEdge

This method creates a constraint of 'ToOtherRebar' type with Edge target type for a given RebarConstrainedHandle.

The RebarConstrainedHandle should belong to a Free Form Rebar, otherwise it will throw exception.

Public method Static member CreateConstraintToSurface

This method creates a constraint of 'ToSurface' type for a given RebarConstrainedHandle.

The RebarConstrainedHandle should belong to a Shape Driven Rebar, otherwise it will throw exception.

Public method Dispose Releases all resources used by the RebarConstraint
Public method Equals Determines whether the specified object is equal to the current object.
(Inherited from Object )
Public method FlipHandleOverTarget Flips the RebarConstrainedHandle to the other side of the target bar handle, maintaining the distance in absolute value.
Public method FlipSideForClearBarSpacingZeroDistanceConstraint Flips the side on which a RebarConstrainedHandle constrained using clear bar distance with zero offset connects to another Rebar target handle.
Public method GetConstraintToRebarEdgeProperties Gets the properties for all target rebar edges.
Public method GetConstraintType Returns the RebarConstraintType of a RebarConstraint.
Public method GetCustomHandleTag Returns the handle tag of the RebarConstrainedHandle. This is valid only for Free Form Rebar.
Public method GetDistanceToCustomTarget Gets the distance from the RebarConstrainedHandle to the custom target.
Public method GetDistanceToTargetCover Returns the distance from the RebarConstrainedHandle to the target Host Cover Element surface. The RebarConstraintType of the RebarConstraint must be 'ToCover'.
Public method GetDistanceToTargetHostEdge Returns the distance from the RebarConstrainedHandle to the target host edge. The RebarConstraintType of the RebarConstraint must be 'ToHostEdge' and must allow offset value.
Public method GetDistanceToTargetHostEdgeCover Returns the distance from the RebarConstrainedHandle to the target host edge cover. The RebarConstraintType of the RebarConstraint must be 'ToHostEdgeCover'.
Public method GetDistanceToTargetHostFace Returns the distance from the RebarConstrainedHandle to the target Host Element surface. The RebarConstraintType of the RebarConstraint must be 'FixedDistanceToHostFace'.
Public method GetDistanceToTargetRebar Gets the distance from the RebarConstrainedHandle to the target Rebar handle surface. The RebarConstraintType of the RebarConstraint must be 'ToOtherRebar'.
Public method GetHashCode Serves as the default hash function.
(Inherited from Object )
Public method GetPositiveOffsetDirectionForToOtherRebarConstraint Returns the default positive offset direction vector for a constraint to a Shape Driven Rebar.
Public method GetRebarConstrainedHandle Gets the RebarConstrainedHandle for which this constraint is.
Public method GetRebarConstraintTargetHostFaceType Returns the RebarConstraintTargetHostFaceType of the host Element face to which the RebarConstraint is attached. The RebarConstraintType of the RebarConstraint must be 'FixedDistanceToHostFace' or 'ToCover'. Will throw exception if it's a multi target constraint.
Public method GetRebarConstraintTargetHostFaceType(Int32) Returns the RebarConstraintTargetHostFaceType of the host Element face to which the RebarConstraint is attached. The RebarConstraintType of the RebarConstraint must be 'FixedDistanceToHostFace' or 'ToCover'.
Public method GetSurfaceForConstraintToSurface This method retrieves the surface for a constraint of 'To Surface' type.
Public method GetTargetCoverType Returns the RebarCoverType for the face specified by targetIndex. Returns null if no RebarHostData is present for target element.
Public method GetTargetCoverTypeForToHostEdgeConstraint Returns the RebarCoverType for the face provided at faceIndex, that forms the edge of this RebarConstraint at the specified targetIndex. The RebarConstraintType of the RebarConstraint must be 'ToHostEdge' or 'ToHostEdgeCover'. Returns null if no RebarHostData is present for target element.
Public method GetTargetElement Gets the Element object (either Host or Rebar) which provides the target reference at index 0 for this constraint. Will throw exception if it's a multi target constraint.
Public method GetTargetElement(Int32) Gets the Element object (either Host or Rebar) which provides the target reference at specified index for this constraint.
Public method GetTargetHostEdgeAndTransform Returns the target host edge and the transform that is associated to the host edge's geometry. The RebarConstraintType of the RebarConstraint must be 'ToHostEdge' or 'ToHostEdgeCover'. Only applied to Free Form Rebar.
Public method GetTargetHostFaceAndTransform Returns the face to which the RebarConstraint is attached associated to the given target index. The RebarConstraintType of the RebarConstraint must be 'FixedDistanceToHostFace' or 'ToCover'.
Public method GetTargetHostFaceReference Returns a reference to the host Element face to which the RebarConstraint is attached. The RebarConstraintType of the RebarConstraint must be 'FixedDistanceToHostFace' or 'ToCover'. Will throw exception if it's a multi target constraint.
Public method GetTargetHostFaceReference(Int32) Returns a reference that corresponds to the face to which the RebarConstraint is attached specified by the targetIndex. The RebarConstraintType of the RebarConstraint must be 'FixedDistanceToHostFace' or 'ToCover'.
Public method GetTargetHostFaceReferenceForEdgeConstraint Returns a reference to the host Element face provided at faceIndex, that forms the edge of this RebarConstraint at the specified targetIndex. The RebarConstraintType of the RebarConstraint must be 'ToHostEdge' or 'ToHostEdgeCover'.
Public method GetTargetRebarAngleOnBarOrHookBend Returns the angular increment along a bar or hook bend to which the RebarConstraint is attached.
Public method GetTargetRebarBendNumber Gets the number of the bend on the other Rebar Element to which this RebarConstraint is attached. The RebarConstraint must be of RebarConstraintType 'ToOtherRebar,' and the TargetRebarConstraintType must be 'BarBend'. Rebar must be Shape Driven Rebar element.
Public method GetTargetRebarConstraintType Gets the TargetRebarConstraintType of the handle on the other Rebar Element to which this RebarConstraint is attached. The RebarConstraintType of the RebarConstraint must be 'ToOtherRebar'.
Public method GetTargetRebarEdgeNumber Gets the number of the edge on the other Rebar Element to which this RebarConstraint is attached. The RebarConstraint must be of RebarConstraintType 'ToOtherRebar,' and the TargetRebarConstraintType must be 'Edge'. Rebar must be Shape Driven Rebar element.
Public method GetTargetRebarHandleBehavior Gets the RebarHandleBehavior of the handle of the other Rebar Element to which this RebarConstraint is attached. The RebarConstraintType of the RebarConstraint must be 'ToOtherRebar'.
Public method GetTargetRebarHookBarEnd Returns 0 or 1 to indicate which end hook on the other Rebar Element to which this RebarConstraint is attached. The RebarConstraint must be of RebarConstraintType 'ToOtherRebar,' and the TargetRebarConstraintType must be 'HookBend'. Rebar must be Shape Driven Rebar element.
Public method GetType Gets the Type of the current instance.
(Inherited from Object )
Public method HasAnEdgeNumber Checks if the getTargetRebarEdgeNumber method can be called for the RebarConstraint.
Public method IsBindingHandleWithTarget Gets the relationship between two RebarConstrainedHandles.
Public method IsEqual Checks if the specified RebarConstraint is the same as 'this'. The method can be used to determine which of the RebarConstraint candidates offered by the RebarConstraintsManager is currently active.
Public method IsFixedDistanceToHostFace Checks if the RebarConstraintType of the RebarConstraint is 'FixedDistanceToHostFace'.
Public method Static member IsReferenceAValidEdgeForConstraint Checks if the reference provided can be used in creating 'ToHostEdge' or 'ToHostEdgeCover' constraint.
Public method Static member IsReferenceAValidFaceForConstraint Checks if the reference provided can be used in creating 'ToFace' or 'ToCover' constraints.
Public method IsReferenceValidForConstraint Obsolete.
Checks if the reference provided can be used in creating 'ToFace' or 'ToCover' Rebar constraints
Public method IsToCover Checks if the RebarConstraintType of the RebarConstraint is 'ToCover'. Returns true if the RebarConstraintType of the RebarConstraint is 'ToCover', false otherwise.
Public method IsToCustomTarget Checks if the RebarConstraintType of the RebarConstraint is 'ToCustomTarget'.
Public method IsToHostEdge Checks if the RebarConstraintType of the RebarConstraint is 'ToHostEdge'.
Public method IsToHostEdgeCover Checks if the RebarConstraintType of the RebarConstraint is 'ToHostEdgeCover'.
Public method IsToHostFaceOrCover Returns true if the RebarConstraintType of the RebarConstraint is either 'FixedDistanceToHostFace' or 'ToCover'.
Public method IsToOtherRebar Checks if the RebarConstraintType of the RebarConstraint is 'ToOtherRebar'.
Public method IsToSurface Checks if the RebarConstraintType of the RebarConstraint is 'ToSurface'.
Public method IsUsingClearBarSpacing Returns true if the RebarConstrainedHandle to target offset is the clear bar distance, false if the offset is measured between bar centers.
Public method IsValid Checks that the RebarConstraint still has access to valid Rebar constraint data and that its RebarConstraintsManager is still valid.
Public method Static member IsValidSurfaceToConstraintHandleTo Checks if the surface can be used to create a constraint to it for the input handle.
Public method ReplaceReferenceTargets(IList Reference , RebarConstraintType) Replaces the current set of references, with the newly provided ones. Will throw exception if this is a constraint for Shape Driven Rebar.
Public method ReplaceReferenceTargets(RebarConstrainedHandle, IList Reference , Boolean, Double) Obsolete.
Replaces the current set of references, the type of constraint and the offset value, with the newly provided ones. Will throw exception if this is a constraint for Shape Driven Rebar.
Public method SetConstraintToRebarEdgeProperties Sets the properties of the constraint to target rebar edges.
Public method SetDistanceToCustomTarget Sets the distance from the RebarConstrainedHandle to the custom target.
Public method SetDistanceToTargetCover Sets the distance from the RebarConstrainedHandle to the target Host Cover Element surface. The RebarConstraintType of the RebarConstraint must be 'ToCover'.
Public method SetDistanceToTargetHostEdge Sets the distance from the RebarConstrainedHandle to the target host edge. The RebarConstraintType of the RebarConstraint must be 'ToHostEdge' and must allow offset value.
Public method SetDistanceToTargetHostEdgeCover Sets the distance from the RebarConstrainedHandle to the target host edge cover. The RebarConstraintType of the RebarConstraint must be 'ToHostEdgeCover'.
Public method SetDistanceToTargetHostFace Sets the distance from the RebarConstrainedHandle to the target Host Element surface. The RebarConstraintType of the RebarConstraint must be 'FixedDistanceToHostFace'.
Public method SetDistanceToTargetRebar Sets the offset distance between the constrained RebarConstrainedHandle and its target Rebar handle surface.
Public method SetToBindHandleWithTarget Sets the relationship between two RebarConstrainedHandles.
Public method SetToUseClearBarSpacing Sets whether the RebarConstrainedHandle to target offset is the clear bar distance, or is measured between bar centers.
Public method TargetIsBarBend Returns true if the TargetRebarConstraintType of the RebarConstraint is 'BarBend'.
Public method TargetIsHookBend Returns true if the TargetRebarConstraintType of the RebarConstraint is 'HookBend'.
Public method TargetRebarConstraintTypeIsEdge Returns true if the RebarConstraintType of the RebarConstraint is 'ToOtherRebar,' and the RebarConstraint is attached to an edge of the other Rebar Element.
Public method ToString Returns a string that represents the current object.
(Inherited from Object )
Top
Remarks

For Shape Driven Rebar Constraints:

Each handle on a rebar is defined by a plane, and can be constrained along the direction perpendicular to a surface. Rebar constraints work by locking the handle planes to targets. These targets can be: surfaces of host elements (faces or cover), the handle planes of other Rebar element or any generic surface.

A special case is for of a straight, standard style bar, running perpendicular to the plane of the stirrup bar. This bar can constrain itself to distinct locations along bends in stirrup bars - points located at 0 degrees, 45 degrees, 90 degrees, etc. around each bend. This is done by simultaneously locking both the straight bar's edge handle and its planar position handle to one or both of the stirrup edges adjacent to the bend in the stirrup.

Usually, to form a constraint, the handle plane and the reference plane must be parallel. However, bar end or segment handles can be constrained to planes at angles up to 84 degrees. Arc-shaped rebar is a special case, and can form constraints to concentric host surfaces.

For Free Form Rebar Constraints:

Each handle of the Rebar can be constrained to multiple host faces, covers of the host faces, host edges or other Rebar's edges. There are handles that can have have custom constraints which are specific for each [!:Autodesk::Revit::DB::Structure::IRebarUpdateServer] .

RebarConstraints for Free Form Rebar should be created using the specific Create methods and then added to the RebarConstraintsManager using the method SetPreferredConstraint.

See Also
ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →