Hi Tim Gattinger , I just had a look at your data and I noticed that the fields in the table you use, are defined as:
... and that there are no X and Y fields. In your code you define your fields like this:
fld_X = 'CentroidPOINT.INSIDE_X'
fld_Y = 'CentroidPOINT.INSIDE_Y'
fld_width = 'NABU_1.width'
fld_height = 'NABU_1.length'
When you have a point in the field name, that is normally the result of a join applied in ArcMap. When you acces the data using the path to the datasource, the datasource will not be aware of any joins you may have defined in ArcMap and therefore throw an error that the field does not exist. If you are sure about the field names, you can run the code in the Python windows of ArcMap, but you will have to access the data using the name in the Table of Contents.
So your line:
tbl = r'W:\Gattinger_Tim\GDB\rect_py.gdb\NABU_1'
... should be changed to:
tbl = 'NABU_1'
The alternative is to export the table with the join to a new table and this will create a physical result with the field that can be accessed using the path to the table. Be aware that the names of the fields will no longer contain dots, so you will have to adapt those names.
In order to simulate the result using your data, I took the "gewannstruktur" featureclass, created the X and Y fields based on the centroid of the polygons, joined this featureclass to the NABU_1 table and exported the result to a new table (NABU_2):
I used this table to generate the rectangles, using the following field definitions in the code:
fld_X = 'X'
fld_Y = 'Y'
fld_width = 'width'
fld_height = 'NABU_1_length'
The resulting featureclass is attached.