Rebar contraints change automatically

longt61
Advocate

Rebar contraints change automatically

longt61
Advocate
Advocate

I am using Revit 2019 and have an issue with rebar constraint behaviors.

I created a tool to create and set rebar to a specific location inside a Beam element. When I use the default RebarBarType or other small bar type, the tool works fine. However, if I increase the bar type for the standard bar, whenever the stirrup is set into the Beam, the standard bars that suppose to snap to the bar segment of the stirrups automatically changed their location. 

Take a closer look, I find that the constraint for Bar segment of the standard bars have changed automatically and unexpectedly.

 

constarint_correct.pngconstraint_wrong.png

 

 

 

It only happens with the straight shape (M_00 by default of Revit) and when the stirrups are added to the beam as shown below (I have splited the process into multiple commits)

 

before the stirrups are addedbefore the stirrups are addedafter the stirrup are addedafter the stirrup are added

 

I tried to pick a face of the beam and explicitly set the constraint with RebarConstraint.ReplaceReferenceTargets(), but it didn't work with shape driven rebar.

Why is this happening? How can I control this with the RebarContraint and RebarconstrainedHandle ,or other solution if possible?  Thank you all in advance.

0 Likes
Reply
541 Views
1 Reply
Reply (1)

longt61
Advocate
Advocate

I just figured out a walkaround for this problem

Each rebar has a handle that constrains itself to a :constraint candidate as you can read the document and explanation in this link: rebar constraint.

By default, the rebar created by API has no preferred constraint (which will take priority above all other constraint candidates when rebar gets into its "snapping zone"). To solve my problem I have to :

- set the preferred constraint for the bar segment handle to upper face of the hosting beam (RebarConstraintType.FixedDistanceToHostFace)

- set the offset to the face exactly as I wanted.

In my case, the reason only straight shape snap incorrectly is that the other shape (L shape, U shape...) has more than 1 bar segment handle so that the other handle can keep the bar in the same place so that it satisfied the offset  and constraint value.

Still, I haven't found any document that mention the exact distance for "snapping zone", except the API documentation here that said the default snapping distance is:
- rebar radius from rebar center to host face

- the sum of 2 rebar radiuses from the first rebar center to the second rebar center.

which is not true in my case.

0 Likes

Type a product name