Skip to main content
Inspiring
June 16, 2023
Answered

Transform each

  • June 16, 2023
  • 1 reply
  • 381 views

I have to repost this huge thing Illustrator is missing.
Transform each thinks sublayers are separate objects. If I have 20 sublayers full of objects, there is no way of transforming them individually. I have to make transform each for every sublayer twice. First time I have to deselect on object from specific sublayer and then transform each. Later select this one object and transform it it again.

 

Everyone knows how annoying this is. Adobe thinks it is absolutely normal behaviour. It is as silly if there were feature where you cannot change color of multiple objects at once.

Upvote here:
https://illustrator.uservoice.com/forums/601447-illustrator-bugs/suggestions/34407571-transform-each

This topic has been closed for replies.
Correct answer Sorontar

Solution: I had to just ask from Chat GPT for a script.
Group is considered a separate object, while sublayer is not.

// Prompt for the percentage value
var percentageStr = prompt("Enter the percentage value for scaling each object:", "50"); // Modify the default value as needed
var percentage = parseFloat(percentageStr) / 100;

// Function to transform the selected item
function transformItem(item) {
  var bounds = item.visibleBounds;
  var centerX = (bounds[2] + bounds[0]) / 2;
  var centerY = (bounds[3] + bounds[1]) / 2;
  item.translate(centerX, centerY);
  item.resize(percentage * 100, percentage * 100, true, true, true, true, percentage * 100, Transformation.CENTER);
  item.translate(-centerX, -centerY);
}

// Get the selected items
var selectedItems = app.activeDocument.selection;

// Apply transformation to each selected item
for (var i = 0; i < selectedItems.length; i++) {
  var selectedItem = selectedItems[i];
  transformItem(selectedItem);
}

1 reply

SorontarAuthorCorrect answer
Inspiring
June 16, 2023

Solution: I had to just ask from Chat GPT for a script.
Group is considered a separate object, while sublayer is not.

// Prompt for the percentage value
var percentageStr = prompt("Enter the percentage value for scaling each object:", "50"); // Modify the default value as needed
var percentage = parseFloat(percentageStr) / 100;

// Function to transform the selected item
function transformItem(item) {
  var bounds = item.visibleBounds;
  var centerX = (bounds[2] + bounds[0]) / 2;
  var centerY = (bounds[3] + bounds[1]) / 2;
  item.translate(centerX, centerY);
  item.resize(percentage * 100, percentage * 100, true, true, true, true, percentage * 100, Transformation.CENTER);
  item.translate(-centerX, -centerY);
}

// Get the selected items
var selectedItems = app.activeDocument.selection;

// Apply transformation to each selected item
for (var i = 0; i < selectedItems.length; i++) {
  var selectedItem = selectedItems[i];
  transformItem(selectedItem);
}