RebarConstraint
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: 25.0.0.0 (25.0.0.0)
Syntax
public class RebarConstraint : IDisposableThe 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.
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 for a given RebarConstrainedHandle. Will throw exception if used for Shape Driven Rebar.
Public Method
Static Member
CreateConstraintToSurface
This method creates a constraint of ‘To Surface’ 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
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
GetDistanceToTargetCover
Returns the distance from the RebarConstrainedHandle to the target Host Cover Element surface. The RebarConstraintType of the RebarConstraint must be ‘ToCover’.
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 positive offset direction vector.
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
GetTargetElement.
Gets the Element object (either Host or Rebar) which provides the 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 constraint. Will return the Element which contains the face at targetIndex.
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
GetTargetRebarAngleOnBarOrHookBend
Returns the angular increment along a bar or hook bend to which the RebarConstraint is attached.
Public Method
GetTargetRebarBendNumber
Returns 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
Returns the TargetRebarConstraintType of the handle on the other Rebar Element to which this RebarConstraint is attached. The RebarConstraintType of the RebarConstraint must be ‘ToOtherRebar’. Rebar must be Shape Driven Rebar element.
Public Method
GetTargetRebarEdgeNumber
Returns 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
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
IsReferenceValidForConstraint
Checks if the reference provided can be used in creating 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
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
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
SetDistanceToTargetCover
Sets the distance from the RebarConstrainedHandle to the target Host Cover Element surface. The RebarConstraintType of the RebarConstraint must be ‘ToCover’.
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 RebarTargetConstraintType of the RebarConstraint is ‘BarBend’.
Public Method
TargetIsHookBend
Returns true if the RebarTargetConstraintType 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)
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 or to the face cover.
In order to create a Free Form Rebar Constraint you will need:
- RebarConstraintsManager which will manage the constraint.
- The rebar handle you want to constraint.
- A list of target references which must be element faces to which this handle is constrained.
- A Boolean value specifying that the constraint is to cover or directly to face. It will be the same value for all target references
- A double value that represent the offset distance from the rebar handle to target references.
RebarConstraints for Free Form Rebar should be created using the Create method and then added to the RebarConstraintsManager using the method SetPreferredConstraintForHandle.