5 Replies Latest reply on Aug 20, 2008 9:21 AM by (Archie_Tucker)

    Object Reference Point VBscript

      How do you change the reference point of an object? The problem is when I use the move command (example, myCurrentObject.move Array(myLabelX + 2, myLabelY)) the move works fine as long as the reference point is the TopLeft corner.
        • 1. Re: Object Reference Point VBscript
          Stephan Moebius Level 1
          Sorry, i can only help with javascript. But perhaps it's similar.

          app.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_RIGHT_ANCHOR;

          app.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_LEFT_ANCHOR;

          app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_LEFT_ANCHOR;

          app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_CENTER_ANCHOR;

          app.layoutWindows[0].transformReferencePoint = AnchorPoint.LEFT_CENTER_ANCHOR;

          app.layoutWindows[0].transformReferencePoint = AnchorPoint.CENTER_ANCHOR;

          app.layoutWindows[0].transformReferencePoint = AnchorPoint.RIGHT_CENTER_ANCHOR;

          • 2. Re: Object Reference Point VBscript
            [Jongware] Most Valuable Participant
            How does it fail? Moving the object using the bottom right anchor yields the same effect, shouldn't it?

            For [object].flip and [object].transform you have to specify an anchor point, and that seems logical, as you can flip and/or rotate around any of the corners, but for move it seems obsolete.
            • 3. Re: Object Reference Point VBscript
              Level 1
              But changing the anchor point won't affect the behavior of the move command. It always moves the top-left to the point you specify. You have to work out the geometry yourself.

              • 4. Re: Object Reference Point VBscript
                Level 1
                Thanks for everyone's response. I will try to better explain. I have different templates, one for each stamp (rubber stamp) size. Depending on the size of the stamp the number of columns and rows on the template maybe different. The stamps are text boxes treaded together. I create the tagged text file to import the stamps. The problem yesterday was with a template that has 2 textframes that are rotated 90 degrees and 3 textframes that are rotated 0 degrees (5 stamps on template). After the stamps are edited I use a script to create the labels that go on the stamp handles. The script copies the stamps to a new page using the duplicate command, if the stamp is rotated it puts it back to 0 rotation. After duplicated the stamps it then moves them to fit on the page of labels, then uses the transform command to reduce them to fit on the label.
                The problem is on the ones that are rotated 90 degress it some times uses the Top Right instead of Top Left (the textframes may have artwork added to the frame, then grouped). Below is the code used for the move.

                Rem --------------------------------------
                Function myMoveStamps (myLabelDocument, myLabelCols, myLabelRows, myLabelStartX, myLabelStartY, myLabelWidth, myLabelHeight, myLabelHorizontalSpace, myLabelVerticalSpace, myLabelPercent, myLabelHorizontalOffSet, myLabelVerticalOffSet, myMountNumber)

                K = 0
                For I = 1 to myLabelCols
                For J = 1 to myLabelRows
                K = K + 1
                If K <= cInt(myMountNumber) Then
                Set myCurrentObject = myLabelDocument.PageItems.item(cStr(K))

                myObjectBounds = myCurrentObject.GeometricBounds

                myObjectWidth = myObjectBounds(3) - myObjectBounds(1)
                myObjectHeight = myObjectBounds(2) - myObjectBounds(0)

                myLabelX = myLabelStartX + (myLabelWidth / 2) - (myObjectWidth / 2) + ((I-1) * myLabelHorizontalSpace) + myLabelHorizontalOffSet
                myLabelY = myLabelStartY + (myLabelHeight / 2) - (myObjectHeight / 2) + ((J-1) * myLabelVerticalSpace) + myLabelVerticalOffSet
                myCurrentObject.move Array(myLabelX + 2, myLabelY)
                set myScaleMatrix = myInDesign.TransformationMatrices.Add(cDbl(myLabelPercent), cDbl(myLabelPercent))
                myCurrentObject.Transform idCoordinateSpaces.idPasteboardCoordinates,idAnchorPoint.idCenterAnchor, myScaleMatrix

                End If

                End Function
                • 5. Re: Object Reference Point VBscript
                  Level 1
                  I think I have found the solution listed below.

                  myRotation = myCurrentObject.AbsoluteRotationAngle
                  If myRotation <> 0 Then
                  myLabelX = myLabelX + myObjectWidth
                  End If