-1

I have developed a macro in Illustrator CC (Version 21). Starting from a document of a given size, it deforms it and pastes several copies into another. The macro has 27 Actions in total.

This works fine except for one thing: starting from the same template but adding different artwork that fits a fixed predefined zone, the final outputs are shifted from one case to the next or one execution to the next.

I can't see any difference in the sizes of the elements that I am processing and whenever pasting, I am using Paste in Place operations.

Any idea what could explain such discrepancies ?

enter image description here


Update:

I have identified where the sequence goes wrong:

  1. Create a rectangle that covers the whole document,

  2. Select everything,

  3. Make a clipping mask (the rectangle at step 1),

  4. Scale non-uniformly, i.e. 86% on X and 100% on Y.

This is where the problem appears: the centering of the stretched document seems to move unpredictably. I suspect that the mouse position at some moment (before launching the macro) can have an influence.

Update 2:

After deeper observation, I notice that the first time you open a document and process it, the centering is wrong; then if you reopen a second times and more, the centering becomes correct. And then if you open another, the same phenomenon repeats.

/version 3
/name [ 11
    57617270696e6720386f7a
]
/isOpen 1
/actionCount 1
/action-2 {
    /name [ 14
        5761727020746f204d6173746572
    ]
    /keyIndex 0
    /colorIndex 0
    /isOpen 1
    /eventCount 4
    /event-1 {
        /useRulersIn1stQuadrant 0
        /internalName (ai_plugin_rectTool)
        /localizedName [ 14
            52656374616e676c6520546f6f6c
        ]
        /isOpen 0
        /isOn 1
        /hasDialog 1
        /showDialog 0
        /parameterCount 6
        /parameter-1 {
            /key 1953460076
            /showInPalette -1
            /type (integer)
            /value 15
        }
        /parameter-2 {
            /key 2003072104
            /showInPalette -1
            /type (unit real)
            /value 670.9606299213
            /unit 592476268
        }
        /parameter-3 {
            /key 1751607412
            /showInPalette -1
            /type (unit real)
            /value 290.8346456693
            /unit 592476268
        }
        /parameter-4 {
            /key 1668182644
            /showInPalette -1
            /type (boolean)
            /value 0
        }
        /parameter-5 {
            /key 1668183128
            /showInPalette -1
            /type (unit real)
            /value 335.48
            /unit 592476268
        }
        /parameter-6 {
            /key 1668183129
            /showInPalette -1
            /type (unit real)
            /value -145.415
            /unit 592476268
        }
    }
    /event-2 {
        /useRulersIn1stQuadrant 0
        /internalName (adobe_selectAll)
        /localizedName [ 10
            53656c65637420416c6c
        ]
        /isOpen 0
        /isOn 1
        /hasDialog 0
        /parameterCount 0
    }
    /event-3 {
        /useRulersIn1stQuadrant 0
        /internalName (adobe_makeMask)
        /localizedName [ 18
            4d616b6520436c697070696e67204d61736b
        ]
        /isOpen 0
        /isOn 1
        /hasDialog 0
        /parameterCount 0
    }
    /event-4 {
        /useRulersIn1stQuadrant 0
        /internalName (adobe_scale)
        /localizedName [ 5
            5363616c65
        ]
        /isOpen 0
        /isOn 1
        /hasDialog 1
        /showDialog 0
        /parameterCount 7
        /parameter-1 {
            /key 1970169453
            /showInPalette -1
            /type (boolean)
            /value 0
        }
        /parameter-2 {
            /key 1818848869
            /showInPalette -1
            /type (boolean)
            /value 0
        }
        /parameter-3 {
            /key 1752136302
            /showInPalette -1
            /type (unit real)
            /value 85.3033530481
            /unit 592474723
        }
        /parameter-4 {
            /key 1987339116
            /showInPalette -1
            /type (unit real)
            /value 100.0
            /unit 592474723
        }
        /parameter-5 {
            /key 1668247673
            /showInPalette -1
            /type (boolean)
            /value 0
        }
        /parameter-6 {
            /key 1684370520
            /showInPalette -1
            /type (unit real)
            /value 0.
            /unit 592476268
        }
        /parameter-7 {
            /key 1684370521
            /showInPalette -1
            /type (unit real)
            /value 0.
            /unit 592476268
        }
    }
}
  • 1
    There's really no possible way to answer this without knowing what each and every step does exactly. – Scott Jun 8 '17 at 19:01
  • @Metis: maybe. I am hoping that someone recognizes a situation he already faced. I have now nailed down that the problem occurs at the Scale operation. – Yves Daoust Jun 8 '17 at 19:30
0

The only thing I could guess at is the scale origin. If it's not centered, then it's feasible that things may shift to the left slightly after the scaling.

As my comment states, this kind needs to explain the exact procedures in each step. You have a few move actions... which beg the questions.. move how? What distance? from what origin?

  • As explained in the updates, I have nailed down the problem a little. Only four actions are involved and I strongly suspect the Scale action. The Moves are not involved. But what is most striking is that whatever the transformation(s), the results are different from one execution to the next. I have added the relevant code of the macros. – Yves Daoust Jun 8 '17 at 21:30
  • To be honest, I don't delve into the math structure of actions. I can guess.. that 86% of 100% is 86%... 86% of 86% is 73.9%... 86% of 73.9% is 63.5%.... but again.. guessing. – Scott Jun 8 '17 at 21:36
  • No, I mean starting from the original file every time. Twice the same execution on the same file yields different results. It is not a matter of maths. – Yves Daoust Jun 8 '17 at 21:42
0

I think I have solved the issue.

By reconstructing the macro and comparing to the old code, I noticed that the last two parameters DX and DY do not appear.

These must have been remnants of the macros created under an older version of Illustrator. And even they were set to 0., their presence had a bad influence.

I have removed them from the old code, and it seems that the instability has disappeared.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.