Creating 2D sheet setup using dynamo

I have created a Dynamo script for placing floor plans on sheets. However, I encounter an error in some instances, indicating that the plan is larger than the sheet size and cannot be placed.
And when the plans do fit on the sheet, they appear in the corner rather than in the center.

Can anyone assist me in achieving the placement of plans on a sheet with the correct scale and ensuring that they are centered?

What about your sheet set-up? Where is the origin of all titleblocks you are using?

Your image did not upload, can you try again?


This is my Dynamo script. What modifications should I implement to align it with my requirements?

Hi @pravin.ghuge do you mean something here ?