@Martin,
The attached table and script does is a concept script. It does not handle the offset and local vs global X and Y locations.
It creates the table
Names Default To Here( 1 );
//create table
dt = New Table( "global loc",
Add Rows( 8 ),
New Column( "X",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [10, 30, 90, 80, 90, 90, 120, 119] )
),
New Column( "Y",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [88, 22, 44, 80, 44, 90, 90, 43] ),
Set Display Width( 51 )
),
New Column( "Cavity",
Character,
"Nominal",
Set Values( {"A", "A", "A", "A", "B", "B", "B", "B"} )
)
);
dt << Color by Column(:Cavity);
biv = dt << Bivariate( Y( :Y ), X( :X ) );
fb = report(biv)[FrameBox(1)];
cavList = Associative Array(dt:Cavity) << get keys;
for(i=1, i<=nitems(cavList), i++,
idx = dt << get rows where(:Cavity == cavList[i]);
xmat = dt:X[idx];
ymat = dt:Y[idx];
clr = color of(Row State (idx[1]));
Eval(eval Expr(fb << Add Graphics Script( Description(Expr(cavList[i])),
Fill Color(Expr(clr));
Polygon( Expr(xmat`), Expr(ymat`))
)));
);
Then adds a script for each polygon, rectanngle??
Right click on the framebox and select customize
There are multiple platforms to handle this. Your problem is one similar to semiconductor wafer maps and alignment (mis-alignment) of layers.
Hope that helps. Now to select a shape you can use @Mark_Bailey suggestion also adding a row llegend can help with connectivity to the data table.
fb << Row Legend( "Cavity", Color(1), Marker(0) );
There is much more you can do. It depends upon the GUI you want.