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

Cannot create an Action for Rotate View

New Here ,
May 01, 2024 May 01, 2024

Copy link to clipboard

Copied

I created an Action called "Rotate View 180°" and then chose Insert Menu Item... from the hamburger dropdown on the Actions palette. Then I chose View > Rotate View > 180 and nothing goes into the field in the Insert Menu Item dialog. If I type "Rotate View" into that field and try searching for it, it cannot find it. If I choose another Menu Item from the View menu, it adds it.

 

Illustrator 28.4.1 (Arabic Version, but all the menus are in English)

TOPICS
Bug , Scripting , Tools

Views

239

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

Community Expert , May 02, 2024 May 02, 2024

Hi @Bill Planey, I've written a script for this and I use it extensively on imposed jobs where half the job is upside down. Let me know if it works okay for you.

- Mark

/**
 * @file UpsideDown.js
 * Rotates view by 180°.
 * @author m1b
 */

(function () {

    var doc = app.activeDocument,
        view = doc.activeView,
        ab = doc.artboards[doc.artboards.getActiveArtboardIndex()],
        intersection = intersectionOfBounds([view.bounds, ab.artboardRect]),
        newViewCenter = [
       
...

Votes

Translate

Translate
Adobe
Community Expert ,
May 01, 2024 May 01, 2024

Copy link to clipboard

Copied

Unfortunately, Illustrator imposes many restrictions on how users may or may not use commands as action steps. This is just one of them.

 

There are scripts that imitate artboard rotations in 90°-steps. You may do a search on GitHub.

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
Adobe Employee ,
May 01, 2024 May 01, 2024

Copy link to clipboard

Copied

Hello @Bill Planey,

Thanks for reaching out. I understand that this functionality is important to you, and I apologize for its unavailability at this time. Would you mind creating a UserVoice for this feature request (https://adobe.ly/3Wmdw4M) and adding your comments there? Doing this will help us prioritize this request, and you will be notified of any updates.

 

Feel free to reach out if you have more questions or need assistance. We'd be happy to help.

 

Thanks,

Anubhav

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
Community Expert ,
May 02, 2024 May 02, 2024

Copy link to clipboard

Copied

Hi @Bill Planey, I've written a script for this and I use it extensively on imposed jobs where half the job is upside down. Let me know if it works okay for you.

- Mark

/**
 * @file UpsideDown.js
 * Rotates view by 180°.
 * @author m1b
 */

(function () {

    var doc = app.activeDocument,
        view = doc.activeView,
        ab = doc.artboards[doc.artboards.getActiveArtboardIndex()],
        intersection = intersectionOfBounds([view.bounds, ab.artboardRect]),
        newViewCenter = [
            intersection[0] + (intersection[2] - intersection[0]) / 2,
            intersection[1] - (intersection[3] - intersection[1]) / 2
        ],
        viewCenter = view.centerPoint,
        dx = newViewCenter[0] - viewCenter[0];

    view.centerPoint = [viewCenter[0] + dx * 2, viewCenter[1]];

    if (view.rotateAngle == 0)
        view.rotateAngle = 180;
    else
        view.rotateAngle = 0;


    /**
     * Returns the overlapping rectangle
     * of two or more rectangles.
     * NOTE: Returns undefined if ANY
     * rectangles do not intersect.
     * @author m1b
     * @version 2022-07-24
     * @param {Array} arrayOfBounds - an array of bounds arrays [l, t, r, b].
     * @returns {Array} - bounds array [l, t, r, b] of overlap.
     */
    function intersectionOfBounds(arrayOfBounds) {

        // sort a copy of array
        var bounds = arrayOfBounds
            .slice()
            .sort(function (a, b) { return b[0] - a[0] || a[1] - b[1] });

        // start with first bounds
        var intersection = bounds.shift(),
            b;

        // compare each bounds, getting smaller
        while (b = bounds.shift()) {

            // if doesn't intersect, bail out
            if (!boundsDoIntersect(intersection, b))
                return;

            var l = Math.max(intersection[0], b[0]),
                t = Math.min(intersection[1], b[1]),
                r = Math.min(intersection[2], b[2]),
                b = Math.max(intersection[3], b[3]);

            intersection = [l, t, r, b];

        }

        return intersection;

    };

    /**
     * Returns true if the two bounds intersect.
     * @author m1b
     * @version 2024-03-10
     * @param {Array} bounds1 - bounds array.
     * @param {Array} bounds2 - bounds array.
     * @param {Boolean} [TLBR] - whether bounds arrays are interpreted as [t, l, b, r] or [l, t, r, b] (default: based on app).
     * @returns {Boolean}
     */
    function boundsDoIntersect(bounds1, bounds2, TLBR) {

        if (undefined == TLBR)
            TLBR = (/indesign/i.test(app.name));

        return !(

            TLBR

                ? (
                    // TLBR
                    bounds2[0] > bounds1[2]
                    || bounds2[1] > bounds1[3]
                    || bounds2[2] < bounds1[0]
                    || bounds2[3] < bounds1[1]
                )

                : (
                    // LTRB
                    bounds2[0] > bounds1[2]
                    || bounds2[1] < bounds1[3]
                    || bounds2[2] < bounds1[0]
                    || bounds2[3] > bounds1[1]
                )
        );

    };

})();

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
New Here ,
May 03, 2024 May 03, 2024

Copy link to clipboard

Copied

It works beautifully - and I was able to add it to the Actions palette because Illustrator did not deny adding a Script action from the File > Scripts submenu. Thank you!

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
Community Expert ,
May 03, 2024 May 03, 2024

Copy link to clipboard

Copied

LATEST

Nice!

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