1 Reply Latest reply on Aug 6, 2017 3:34 PM by Bill McLean

    Rectangle geometricBounds property causing the error 'invalid object for this request'

    Bill McLean

      I have a textFrame a small number of graphicObjects that are grouped together.  The text frame checks to see if it is part of a group and processes each of the graphic elements.

       

      var parent = sign.textFrame.parent;

       

      if (parent != undefined)

      {

      // see if this sign is part of a group then grap the other graphic elements

           if (parent instanceof Group)

           {

           for (var i = 0; i < parent.allPageItems.length; i++)

           {

                var graphicItem = parent.allPageItems[i];

                if (graphicItem instanceof Rectangle)

                {

                  var saRectangle = new SARectangle(graphicItem);

                  this.rectangles.push(saRectangle);

                }

           else if (graphicItem instanceof GraphicLine)

           {

                var saLine = new SALine(graphicItem);

                this.lines.push(saLine);

           }

      }

       

      The SARectangle function is defined as:

       

       

      function SARectangle (rectangle)

      {

           this.rotation = rectangle.absoluteRotationAngle;

           logger.info("Rectangle: ")

           boundsProperty  = (rectangle.visible ? 'visible' : 'geometric') + 'Bounds';

           var rect = rectangle[boundsProperty];

           this.upperLeft = new SAPoint(rect[1], rect[0]);

           this.lowerRight = new SAPoint(rect[3], rect[2]);

           this.upperLeft.toPixels();

           this.lowerRight.toPixels();

           logger.info("upperLeft (" + rect[1] + "," + rect[0] + ") to upperLeft (" + upperLeft.x + "," + saUpperLeft.y + ")");

           logger.info("lowerRight (" + rect[3] + "," + rect[2] + ") to upperLeft (" + upperLeft.x + "," + saUpperLeft.y + ")");

      }

       

      The problem is that the geometricBounds property does not seem to be defined!  When the rect variable is assigned the error 'invalid object for this request' is thrown.

       

      Any help would be appreciated.