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

Can I clear object rotation information?

Explorer ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

I'm working on some isometric illustrations and have set up some actions/shortcuts to speed up my workflow. These work fine *if* I draw the object and then immediately run the action, however, I've discovered that *if* have done any rotation or previous transformation to my object(s) {(which is often necessary for me in order to 'discover' my desired result)} - the results are totally whacked out (compared to my usual/desired results).

 

I'm left wondering– is there any way to 'clear' the info. that is likely related to and residing with the object that I have worked with? That way I can rotate, tweak and test as many options as needed in getting my shape to just the right form before applying my actions.

 

Thanks, 

Dave

 

TOPICS
Scripting , Tools

Views

363

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
Community Expert ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

Hi Dave,

 

I'm not sure if this'll help in your case, but Illustrator attaches a hidden 'tag' to any item that is manually rotated and tries to keep track of it by adjusting the tag value every time the item is rotated. So I wondered if you could try removing the tag before running your script/action?

 

This snippet will remove the tag from the first selected item.

var item = selection[0];
removeRotationTag(item);

function removeRotationTag(item) {
    if (item.tags.length > 0) {
        if (item.tags[0].name == "BBAccumRotation") {
            item.tags[0].remove();
        }
    }
}

- Mark

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
Explorer ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

Mark,

Thanks for the suggestion. How would I go about removing the tag you speak of?

 

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 ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

The script I posted will remove the tag from the first selected item. Can you see if it makes a difference? If it works you can perhaps incorporate it in your overall script.

- Mark

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
Engaged ,
Mar 05, 2021 Mar 05, 2021

Copy link to clipboard

Copied

This should be a bit more thorough:

 

function removeRotationTag(item) {
	if (item.typename === "GroupItem") {
		removeAllRotationTags(item.pageItems)
	} else {
		try {
			item.tags.getByName("BBAccumRotation").remove()
		} catch (_) {}
		if (item.typename === "CompoundPathItem") {
			removeAllRotationTags(item.pathItems)
		}
	}
}

function removeAllRotationTags(items) {
	for (var i = 0; i < items.length; i++) {
		removeRotationTag(items[i])
	}
}

removeAllRotationTags(app.activeDocument.selection)

 

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
Explorer ,
Mar 05, 2021 Mar 05, 2021

Copy link to clipboard

Copied

Mark,

Thank you for being kind enough to take the time to do this- however, I'm afraid it's still over my head. I'm just used to creating pretty simple actions using the actions palette.

 

Thanks, 

Dave

 

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
Engaged ,
Mar 05, 2021 Mar 05, 2021

Copy link to clipboard

Copied

Copy and paste the code into a plain text file and save it with a .jsx extension.

 

In AI, select the objects from which you want to remove rotation info.

 

To run the script, click File > Scripts > Other Script and choose the JSX file. The script should only take a moment to run.

 

If you need to run it frequently, copy the script to AI’s “Presets/Scripts” folder and relaunch AI. The script will then appear in the File > Scripts menu.

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
Explorer ,
Mar 05, 2021 Mar 05, 2021

Copy link to clipboard

Copied

Thanks - I'll create that and give it a shot while I'm working on some files. I'll report back to let you know how it goes.

 

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 ,
Mar 05, 2021 Mar 05, 2021

Copy link to clipboard

Copied

LATEST

Hi Dave, yes please let us know. I'm interested in whether that helped in your case. Please use @hhas01's improved code as it will work on compound path items and also look inside groups for more items.

 

Thanks @hhas01 for your help here. Great instructions on running a script!

- Mark

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 ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

Which version of Illustrator are you using?

 

Also, can you provide some of the actions you are talking about (including additional instructions, if necessary)?

 

And perhaps some sketches that may explain your request a bit better?

 

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