• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Explorer ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

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;

          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.

TOPICS
Scripting

Views

721

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Aug 06, 2017 Aug 06, 2017

A second time around looking at the problem allowed me to solve the issue.

Just check to see if the geometric bounds rectagle is defined then do the processing otherwise ignore it.

Votes

Translate

Translate
Explorer ,
Aug 06, 2017 Aug 06, 2017

Copy link to clipboard

Copied

LATEST

A second time around looking at the problem allowed me to solve the issue.

Just check to see if the geometric bounds rectagle is defined then do the processing otherwise ignore it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines