Create a list of rebars container name using API

Hi everyone @c.poupin @Mike.Buttery

In order to create a list of rebar containers of my model based on the rebar diameter, as shown in the first image below, I should check a condition related to my circular rebars to determine the correct length of my containers list, whether the remainder bar exists or not ( Let me explain: for either outer circular rebars and inner circular rebars, I should group rebars with a length of 12.00 m in a separate container for each. If there are remainder rebars less than 12.00 m, I should group them separately in other container for each. In my code, I named them "remaind_out_cir_rebar " for the outer rebar remainders and "remaind_inner_cir_rebar " for the inner rebar remainders.)

I’ve studied the case where the remaind_out_cir_rebar and remaind_inner_cir_rebar lists are not null, as shown in the 2nd image , but I’m struggling to achieve all other cases.

here the part of the code to get rebar container names:

if remaind_out_cir_rebar and remaind_inner_cir_rebar:
    rebar_type = [V_rebar_type, V_rebar_type, cir_rebar_type, cir_rebar_type, cir_rebar_type, cir_rebar_type]
    container_name = [i.ToDSType(False).Name for i in rebar_type]
else:
    rebar_type = [V_rebar_type, V_rebar_type, cir_rebar_type, cir_rebar_type] 
    container_name = [i.ToDSType(False).Name for i in rebar_type]

OUT = [i.ToProtoType().Length for i in remaind_out_cir_rebar], [i.ToProtoType().Length for i in remaind_inner_cir_rebar], container_name

Any help would be apreciated.

Thanks.

Have you any idea @jacob.small ?

Thanks.

I have no idea what your goal is on this one. Can you explain the goal to me as if I was a five year old?

and next year…
i’ll be six
I can never let a good The Office quote pass by

1 Like

@jacob.small

are you being serious or sarcastic !?

I’m trying to collect all the rebar containers of my model in the output list. To achieve this, I have to create vertical and circular rebars for both the outside and inside faces of the model, as shown in the image below.

The container count can vary and be 4, 5, or 6, depending on a condition related to the length of the circular rebars for each face. I have to check if the rebars’ length is 12.00m or less. If it is, I must then group each type in their corresponding containers based on their length and faces.

I have finally found a solution to my issue, and I can now study all cases according to the following code.

containers parameters
if remaind_out_cir_rebar and remaind_inner_cir_rebar:
    rebar_curves = [out_V_rebar, inner_V_rebar, out_cir_rebar, remaind_out_cir_rebar, inner_cir_rebar, remaind_inner_cir_rebar]
    rebar_vectors = [out_V_Vect, inner_V_Vect, out_cir_Vect, remaind_out_cir_Vect, inner_cir_Vect,  remaind_inner_cir_Vect]
    rebar_type = [V_rebar_type, V_rebar_type, cir_rebar_type, cir_rebar_type, cir_rebar_type, cir_rebar_type]
    St_Hook = [start_hook, start_hook, end_hook, end_hook, end_hook, end_hook]
    End_Hook = [end_hook, end_hook, end_hook, end_hook, end_hook, end_hook]
    container_name = [i.ToDSType(False).Name for i in rebar_type]
    
elif remaind_out_cir_rebar and not remaind_inner_cir_rebar:
    rebar_curves = [out_V_rebar, inner_V_rebar, out_cir_rebar, remaind_out_cir_rebar, inner_cir_rebar]
    rebar_vectors = [out_V_Vect, inner_V_Vect, out_cir_Vect, remaind_out_cir_Vect, inner_cir_Vect]
    rebar_type = [V_rebar_type, V_rebar_type, cir_rebar_type, cir_rebar_type, cir_rebar_type]
    St_Hook = [start_hook, start_hook, end_hook, end_hook, end_hook]
    End_Hook = [end_hook, end_hook, end_hook, end_hook, end_hook]
    container_name = [i.ToDSType(False).Name for i in rebar_type]

elif not remaind_out_cir_rebar and remaind_inner_cir_rebar:
    rebar_curves = [out_V_rebar, inner_V_rebar, out_cir_rebar, inner_cir_rebar, remaind_inner_cir_rebar]
    rebar_vectors = [out_V_Vect, inner_V_Vect, out_cir_Vect, inner_cir_Vect, remaind_inner_cir_Vect]
    rebar_type = [V_rebar_type, V_rebar_type, cir_rebar_type, cir_rebar_type, cir_rebar_type]
    St_Hook = [start_hook, start_hook, end_hook, end_hook, end_hook]
    End_Hook = [end_hook, end_hook, end_hook, end_hook, end_hook]
    container_name = [i.ToDSType(False).Name for i in rebar_type]
else:
    rebar_curves = [out_V_rebar, inner_V_rebar, out_cir_rebar, inner_cir_rebar]
    rebar_vectors = [out_V_Vect, inner_V_Vect, out_cir_Vect, inner_cir_Vect]
    rebar_type = [V_rebar_type, V_rebar_type, cir_rebar_type, cir_rebar_type]
    St_Hook = [start_hook, start_hook, end_hook, end_hook]
    End_Hook = [end_hook, end_hook, end_hook, end_hook]    
    container_name = [i.ToDSType(False).Name for i in rebar_type]

Thanks.

Nope - I’m just quite lost by the request as I am not a rebar expert nor a structural engineer, and don’t have a full project to test stuff with. This was why I didn’t reply to the topic at all until you @ messaged me, and then I needed some direction.

I’m guessing the previous issue was resolved via the elif statements?

2 Likes

@jacob.small

“Yes, I’ve added an ‘elif’ statement to enable swapping the condition that checks whether either of the two reminder rebars lists (outer list and inner list) is empty or not, and that solved my issue.”

Thanks.

1 Like