Calling for the right element inside a group

Hello, im pretty new to sofistic and i don’t get this part. I defined a group of beams, but now i want to put a different load on the first and last beam. I can put the same load on every group number by using:

'beam grp 2 type pg pa #conc_load
but now i want to put a different load on the first and last beam. I thought when using grp 2, and GDIV=0, my elements in group 2 would be numbered 200001 and so on but that doesnt seem to work for me and it tell me no element is stroed there when i try this
$ loop#i0 (#length/4)+1
$ let#i1 #i0+1
$ if#i1==1
$ beam 200000+#i1 type pg pa (#conc_load/2)
$ elseif #i1==(#length/4)+1
$ beam 200000+#i1 type pg pa (#conc_load/2)
$ else
$ beam 200000+#i1 type pg pa #conc_load
$ endif
$ endloop
My group itself is defined as follows:
grp 2 $horizontal connections
loop#i0 (#length/4)+1
let#i1 #i0+1
beam fit na 100+4*#i0+1 300+4*#i0+1 div 20 ncs 1 $Horizontal connection
endloop

Can someone help me how to call for the right beam element inside a group?

Hi,

You should specify the base number!
In your case, base 200000.

Could you please share your SSD so I can verify your code?

Hmm i thought defining base didnt work when using default GDIV values.
Anyway, this is a wetransfer link to my SSD.

this what you want to do :slight_smile: ??

indeed :heart:

:slight_smile:
In fact, to make your task easier, you should group the edge beams into one group and the intermediate beams into another group. Then, when defining the loading, you should use the groups rather than the bar numbers, which will allow you to significantly optimize your code by eliminating loops and if conditions.

Because if you use base 200000 and GDIV 0, each bar will be divided into several sub-bars that will have numbers starting from 200001, 200002, 200003, etc. However, in your code, you only reference the first element of each bar.

You will find below the codes that I have updated. Good luck! :slight_smile:

+PROG SOFIMSHA urs:37.1 $ Text Input for Modeling
HEAD Text Input for Modeling2
SYST 3D gdir negz gdiv 100000
Sto#dx 1 $[m]
Sto#width 10.5 $[m]
sto#length 80 $[m]
loop#i0 #length+1
let#xx(#i0) (-7.5/40^2)(#i0-40)^2+7.5 $ z coordinate of upper beams
endloop
loop#i0 #length+1 $variable 0-1-2-…-80
let#i1 #i0+1 $variable 1-2-3-…-81
node no 100+#i1 x #i0
#dx y 0.5*#width $nodes left bottom beam
node no 200+#i1 x #i0*#dx y 0.5*#width z #xx(#i0) $nodes left upper beam

node no 300+#i1 x #i0*#dx y (-0.5)*#width $nodes right bottom beam
node no 400+#i1 x #i0*#dx y (-0.5)*#width z #xx(#i0)  $nodes left upper beam

endloop
grp 1 $square profiles
loop#i0 #length
let#i1 #i0+1
beam fit na 100+#i1 100+#i1+1 div 4 ncs 3 $bottom left beam
beam fit na 200+#i1 200+#i1+1 div 4 ncs 3 $upper left beam
beam fit na 300+#i1 300+#i1+1 div 4 ncs 3 $bottom right beam
beam fit na 400+#i1 400+#i1+1 div 4 ncs 3 $upper right beam
endloop
loop#i0 (#length/4)+1
let#i1 #i0+1
if (#i1==1)|(#i1==(#length/4)+1)
grp 20 $horizontal connections
beam fit na 100+4*#i0+1 300+4*#i0+1 div 20 ncs 1 $Horizontal connection beams
else
grp 21 $horizontal connections
beam fit na 100+4*#i0+1 300+4*#i0+1 div 20 ncs 1 $Horizontal connection beams
endif
endloop
grp 3 $Vertical connections (beams at start and end dont need connecting)
loop#i0 #length-1
let#i1 #i0+1
beam fit na 100+#i1+1 200+#i1+1 div 10 ncs 1 $vertical connection beams left
beam fit na 300+#i1+1 400+#i1+1 div 10 ncs 1 $vertical connection beams right
endloop
node 101,301,181,381 fix pp
END

+PROG SOFILOAD urs:31.1 $ Text Input for Loads
HEAD Actions
ACT ‘G’ TITL “dead load”
ACT ‘Q’ TITL “live load”
ACT ‘S’ TITL “Snow loading”
ACT ‘W’ TITL “Wind loading”
END
+PROG SOFILOAD urs:33.1 $ Text Input for Loads
HEAD Text Input for Loads
LC NO 1 type ‘G’ facd 1.00 titl ‘Dead weight’ $ Dead load
LC NO 2 type ‘G’ titl ‘Concrete slab 20 cm’ $ Dead load concrete slab
sto#t_concrete 0.2 $[m]
sto#rho_concrete 2400 $[kg/m^3]
sto#section_length 4 $[m]
sto#conc_load #section_length*#t_concrete*#rho_concrete10^-39.81 $[kN/m]
beam grp 20 type pg pa (#conc_load/2)
beam grp 21 type pg pa #conc_load
LC NO 3 type ‘W’ titl ‘Wind right’ $Wind coming from the right side
LC NO 4 type ‘W’ titl ‘Wind left’ $Wind coming from the left side
END

Thank you alot for helping out Omri!