RebarConstraint
A class representing a constraint on a handle of a rebar element.
For Shape Driven Rebar Constraints:
Each handle on a rebar is defined by a plane, and can be constrained along the direction perpendicular to the plane. Rebar constraints work by locking the handle planes to planar references, or 'targets.' These targets can be:
- planar surfaces of host elements, or
- the handle planes of stirrup bars (only applies to standard style bars).
For planar host element surfaces, a rebar handle can either be locked at a constant distance, or, if the host surface has a specified cover, then the handle can be joined directly to the cover of the surface.
Standard style bars can be locked to the handle planes of stirrup style rebar. In the special case of a straight, standard style bar, running perpendicular to the plane of the stirrup bar, the 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 handles can be constrained to planes at angles up to 60 degrees. Arc-shaped rebar is a special case, and can form constraints to concentric host surfaces.
RebarConstraints can only be constructed internally by Revit. They are available to the API by querying a rebar element's RebarConstraintsManager.
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.
System.Object
Autodesk.Revit.DB.Structure.RebarConstraint
public class RebarConstraint : IDisposable
| Name | Return Type | Description |
|---|---|---|
| AreGeometryTargetsTheSame(RebarConstraint) | bool | Returns true if the gemetrical targets (ex. face references, other rebar segment references) of "this" constriant are the same as the targets of the "other" constraint. Returns false otherwise. |
| ConstrainsRebarEnds() | bool | Returns true if this constraint constrains two rebar ends. |
| Create(RebarConstrainedHandle, IList<Reference>, Boolean, Double) | RebarConstraint | This method creates a constraint for a given Rebar Constrained Handle Tag. Will throw exception if used for Shape Driven Rebar. |
| Dispose() | None | Releases all resources used by the |
| FlipHandleOverTarget() | None | Flips the RebarConstrainedHandle to the other side of the target bar handle, maintaining the distance in absolute value. |
| GetConstraintType() | RebarConstraintType | Returns the RebarConstraintType of a RebarConstraint. |
| GetCustomHandleTag() | int | Returns the handle tag of the RebarConstrainedHandle. This is valid only for Free Form Rebar. |
| GetDistanceToTargetCover() | double | Returns the distance from the RebarConstrainedHandle to the target Host Cover Element surface. The RebarConstraintType of the RebarConstraint must be 'ToCover.' |
| GetDistanceToTargetHostFace() | double | Returns the distance from the RebarConstrainedHandle to the target Host Element surface. The RebarConstraintType of the RebarConstraint must be 'FixedDistanceToHostFace.' |
| GetDistanceToTargetRebar() | double | Gets the distance from the RebarConstrainedHandle to the target Rebar handle surface. The RebarConstraintType of the RebarConstraint must be 'ToOtherRebar.' |
| GetPositiveOffsetDirectionForToOtherRebarConstraint() | XYZ | Returns the positive offset direction vector. |
| GetRebarConstraintTargetHostFaceType() | RebarConstraintTargetHostFaceType | Returns the RebarConstraintTargetHostFaceType of the host Element face to which the RebarConstraint is attached. The RebarConstraintType of the RebarConstraint must be 'FixedDistanceToHostFace' or 'ToCover. |
| GetRebarConstraintTargetHostFaceType(Int32) | RebarConstraintTargetHostFaceType | Returns the RebarConstraintTargetHostFaceType of the host Element face to which the RebarConstraint is attached. The RebarConstraintType of the RebarConstraint must be 'FixedDistanceToHostFace' or 'ToCover.' |
| GetTargetCoverType(Int32) | RebarCoverType | Returns the RebarCoverType for the face specified by targetIndex. Returns null if no RebarHostData is present for target element. |
| GetTargetElement() | Element | Gets the Element object (either Host or Rebar) which provides the constraint. Will throw exception if it's a multi target constraint. |
| GetTargetElement(Int32) | Element | Gets the Element object (either Host or Rebar) which provides the constraint. Will return the Element which contains the face at targetIndex. |
| GetTargetHostFaceAndTransform(Int32, Transform) | Requested Face. | 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.' |
| GetTargetHostFaceReference() | Requested reference. | 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. |
| GetTargetHostFaceReference(Int32) | Requested reference. | 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.' |
| GetTargetRebarAngleOnBarOrHookBend() | int | Returns the angular increment along a bar or hook bend to which the RebarConstraint is attached. |
| GetTargetRebarBendNumber() | int | 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. |
| GetTargetRebarConstraintType() | TargetRebarConstraintType | 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. |
| GetTargetRebarEdgeNumber() | int | 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. |
| GetTargetRebarHookBarEnd() | int | 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. |
| HasAnEdgeNumber() | bool | Checks if the getTargetRebarEdgeNumber method can be called for the RebarConstraint. |
| IsBindingHandleWithTarget() | bool | Gets the relationship between two RebarConstrainedHandles. |
| IsEqual(RebarConstraint) | bool | Returns true 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. |
| IsFixedDistanceToHostFace() | bool | Returns true if the RebarConstraintType of the RebarConstraint is 'FixedDistanceToHostFace.' |
| IsReferenceValidForConstraint(Reference) | bool | Checks if the reference provided can be used in creating Rebar constraints |
| IsToCover() | bool | Returns true if the RebarConstraintType of the RebarConstraint is 'ToCover.' |
| IsToHostFaceOrCover() | bool | Returns true if the RebarConstraintType of the RebarConstraint is either 'FixedDistanceToHostFace' or 'ToCover.' |
| IsToOtherRebar() | bool | Returns true if the RebarConstraintType of the RebarConstraint is 'ToOtherRebar.' |
| IsUsingClearBarSpacing() | bool | Returns true if the RebarConstrainedHandle to target offset is the clear bar distance, false if the offset is measured between bar centers. |
| IsValid() | bool | Checks that the RebarConstraint still has access to valid Rebar constraint data and that its RebarConstraintsManager is still valid. |
| ReplaceReferenceTargets(RebarConstrainedHandle, IList<Reference>, Boolean, Double) | None | 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. |
| SetDistanceToTargetCover(Double) | None | Sets the distance from the RebarConstrainedHandle to the target Host Cover Element surface. The RebarConstraintType of the RebarConstraint must be 'ToCover.' |
| SetDistanceToTargetHostFace(Double) | None | Sets the distance from the RebarConstrainedHandle to the target Host Element surface. The RebarConstraintType of the RebarConstraint must be 'FixedDistanceToHostFace.' |
| SetDistanceToTargetRebar(Double) | None | Sets the offset distance between the constrained RebarConstrainedHandle and its target Rebar handle surface. |
| SetToBindHandleWithTarget(Boolean) | None | Sets the relationship between two RebarConstrainedHandles. |
| SetToUseClearBarSpacing(Boolean) | None | Sets whether the RebarConstrainedHandle to target offset is the clear bar distance, or is measured between bar centers. |
| TargetIsBarBend() | bool | Returns true if the RebarTargetConstraintType of the RebarConstraint is 'BarBend'. |
| TargetIsHookBend() | bool | Returns true if the RebarTargetConstraintType of the RebarConstraint is 'HookBend'. |
| TargetRebarConstraintTypeIsEdge() | bool | Returns true if the RebarConstraintType of the RebarConstraint is 'ToOtherRebar,' and the RebarConstraint is attached to an edge of the other Rebar Element. |
| Name | Return Type | Description |
|---|---|---|
| IsValidObject | bool | Specifies whether the .NET object represents a valid Revit entity. |
| NumberOfTargets | int | Identifies the number of references associated to the rebar handle. |