Splicing rebars issue

Hi All, @c.poupin

Using the attached script, I’m trying to create longitudinal rebars (top_rebar and btm_rebar) and stirrups for each beam in an intersecting beam network.

After creation, the longitudinal rebars should be constrained to the stirrups and stacked vertically so that they do not overlap or penetrate each other at intersection points or supports. This is ensured by checking whether a beam is oriented as “principal” (dir_flag == True) or “secondary” (dir_flag == False).

The longitudinal rebars must then be spliced using splice_rebar() whenever their length exceeds 12.00 m.

I initially tested splice_rebar() in a separate script that only creates the longitudinal rebars (top_rebar and btm_rebar) for each beam. In this test, I deliberately omitted the stirrups, so no stacking rules were applied. All rebars were spliced as expected.

However, when I ran the main script, in which splice_rebar() is called as the final step after the rebars have been successfully constrained, I noticed that only the longitudinal rebars (top_rebar and btm_rebar) belonging to “secondary” beams (dir_flag == False) were successfully spliced.

For the rebars belonging to “principal” beams (dir_flag == True), splicing fails, and an empty list is returned for these rebars, as shown in the output below, even though result.Error == RebarSpliceByRulesError.Success for all rebars, and this is confirmed by the second output below.

Python Script: spliced rebar Id is:520415
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 2
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520416
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 2
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520417
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 2
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520418
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 2
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520419
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 1
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520420
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 1
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520421
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 1
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520422
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 1
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520423
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 1
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520424
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 1
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520425
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 2
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520426
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 2
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520427
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 2
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520428
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 2
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520429
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 1
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520430
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 1
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520431
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 1
Python Script: __________________________________________________
Python Script: spliced rebar Id is:520432
Python Script: result for splice rebar is: Success
Python Script: splice geometries count is: 1
Python Script: __________________________________________________

I’m therefore having trouble identifying the root cause of this behavior!?

Please check the attached script and Revit model below:
Remark: The script is too long to post here due to the forum’s character limit, so please refer to the attached file

new_beams_spliced_rebars.py (34.6 KB)

splice_rebars_beams_network.rvt (2.6 MB)

Any help would be greatly appreciated.

Thanks in advance!