Is it possible to execute a fill command based on a user-selected block?
I don't know MCBE commands well, but here is at least an idea:
First, clone the block to the lowest X, Y and Z coordinate of your area. Then, clone the block from there one block further in the positive X direction. Then clone both blocks together, this time two blocks further in X direction. Then four, eight and so on. Then repeat for the Y and Z directions.
I assume the commands would look something like this:
/clone ~ ~-1 ~ ~ ~-1 ~ 0 0 0
/clone 0 0 0 0 0 0 1 0 0
/clone 0 0 0 1 0 0 2 0 0
/clone 0 0 0 3 0 0 4 0 0
/clone 0 0 0 7 0 0 8 0 0
/clone 0 0 0 15 0 0 0 1 0
/clone 0 0 0 15 1 0 0 2 0
/clone 0 0 0 15 3 0 0 4 0
/clone 0 0 0 15 7 0 0 0 1
/clone 0 0 0 15 7 1 0 0 2
With this method you only need n+1
commands to fill an area of 2^n
blocks with an arbitrary block type. So for example just 3×5+1
=16 commands for the 32768 blocks in a (2^5)³
=32×32×32 area.