Set rebar parameter - sheet name

Hello there
I am somewhat new but familiar to the concept of dynamo but i seem to have stumbled across some issues.
What i’m trying to develop is to make a script that sets the value of a project parameter, in this case the G.sheet parameter to take the value of the sheet number and assign it to all the rebars in an active view.
This would result in a much more intuitive schedule of rebars, i.e. all rebars of transversal beams will have the G.sheet allocated as the sheet number in which they can be found (Transversal beams rebar sheet)
I’ve attached an imagine that will hopefully further clarify my predicament.

basically i want it to be automatic to all the rebars in a view. The one i did is a little hard to use because i need manually select only the rebars.

You could try something like this:

  1. Use Springs.Sheet.Views+ to get the views that exist on a list of sheets.
  2. Get all instances of rebar in those views (Springs.ElementsOfCategory).
  3. Flatten those sublists of rebar so that you have all rebar elements per sheet.
  4. Assign the corresponding sheet number to each sublist of rebar instances.

Thank you very much for replying.
I will try what you said, and hope to work. Meanwhile i thought about this and i think it would be better to switch from a parameter to rebar partition. This way i can set the numbering all over again.

Thank you very much again!