Corrected an error caused by a recent commit that was attempting

to avoid bogus values for array pitch in the direction in which
a cell is not arrayed:  If the array declares an ANGLE of 90 or
270, then rows and columns are effectively swapped for the
purpose of figuring out which coordinate direction should be
ignored in the input.  The original example did not use ANGLE
and so the exception was not handled.
This commit is contained in:
R. Timothy Edwards 2026-03-16 12:50:17 -04:00
parent 058b320c3f
commit 7d9167257a
2 changed files with 16 additions and 7 deletions

View File

@ -1 +1 @@
8.3.621
8.3.623

View File

@ -789,8 +789,8 @@ calmaElementSref(
char *filename)
{
int nbytes, rtype, cols, rows, nref, n, i, savescale;
int xlo, ylo, xhi, yhi, xsep, ysep;
bool madeinst = FALSE;
int xlo, ylo, xhi, yhi, xsep, ysep, angle;
bool madeinst = FALSE, rotated = FALSE;
char *sname = NULL;
bool isArray = FALSE;
bool dolookahead = FALSE;
@ -990,6 +990,14 @@ calmaElementSref(
refarray[2].p_x = refarray[2].p_y = 0;
}
/* If the array is given an angle, then the meaning of rows and
* columns needs to be swapped for the purpose of ignoring
* X or Y values in the case of a 1-row or 1-column entry.
*/
angle = GeoTransAngle(&trans, 0);
if ((angle == 90) || (angle == 270) || (angle == -90) || (angle == -270))
rotated = TRUE;
/* If this is a cell reference, then we scale to magic coordinates
* and place the cell in the magic database. However, if this is
* a cell to be flattened a la "gds flatten", then we keep the GDS
@ -1000,6 +1008,7 @@ calmaElementSref(
* is problematic, and probably incorrect.
*/
for (n = 0; n < nref; n++)
{
savescale = calmaReadScale1;
@ -1011,17 +1020,17 @@ calmaElementSref(
* them as needed.
*/
if ((n > 0) && (rows == 1))
if ((n > 0) && ((!rotated && (rows == 1)) || (rotated && (cols == 1))))
{
calmaReadX(&refarray[n], 1);
calmaSkipBytes(4);
refarray[n].p_y = 0;
refarray[n].p_y = refarray[0].p_y;
}
else if ((n > 0) && (cols == 1))
else if ((n > 0) && ((!rotated && (cols == 1)) || (rotated && (rows == 1))))
{
calmaSkipBytes(4);
calmaReadY(&refarray[n], 1);
refarray[n].p_x = 0;
refarray[n].p_x = refarray[0].p_x;
}
else
calmaReadPoint(&refarray[n], 1);