How do we set variables and run functions with UI panel elements?

I’ve been trying to create a procedural pallet generator for a logistics project and am totally stuck on how to put the function and variables into a panel UI add-on.

The standard pallet scale is (1.200, 0.800, 0.144) and my function spawns the blocks correctly based on some math.

What I want, is to predefine the pallet size, then define the blocks size and then press a button to have it generate dynamically.
I have gone through many tutorials that always use row operators and add the mesh first and then scale it.

Hello ! What do you currently have ?

Hello and thank you for your reply. Here is the code:

Here is the output in the 3D View:

I essentially only need to change the Pallet Dimension variables and the Block Size Variables and then run the same math when setting the Block Locations variables and then a button to run the function called allBlocks()

I also found this after the first replies and it might be enough for now:

I’d really advise against using the method suggested in the page you linked, it may be fine for 2 or 3 actions but it basically prevents you from extending your script any further as soon as you want to add more parameters to your operators. The cost of registering additional operators is close to none and it lets you extend them as you wish. One button = one operator is the blender paradigm

Thank you for this help.
I opted for modeling in Blender and putting it all together in the Unreal Engine and now things are moving forward much faster and better.